extensions

package
v0.1.0-rc.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 39 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Extension releases

Each extension is an independent repository and publishes its own GitHub Release when a version tag such as v0.1.0 is pushed. Workflows test before publishing unless the tagged commit includes [skip tests], and build Linux (linux), macOS (darwin) and Windows (windows), each for amd64 and arm64. Tags with a prerelease suffix create GitHub prereleases.

The fixed asset format is <extension-id>-<tag>-<os>-<arch>.zip, plus one SHA256SUMS per release. ZIPs contain exactly one top-level <extension-id>/ directory with resources/extension.json, the entry point, README, license and resource notices. Manifest versions follow the tag without v. Go entries live in bin/ and use .exe on Windows; Office Viewer includes its bundled JavaScript in dist/ and package.json, with no development dependencies.

The extension marketplace loads the official catalog and resolves each repository's latest GitHub Release. Opening or refreshing the marketplace only checks version metadata; it never downloads packages automatically. Select Install extension to install an extension, or Update extension when a newer version is available. Pencode selects the workspace server's OS and architecture, downloads and extracts its ZIP, checks its release digest when provided, and validates the manifest and resources before publishing. Updates preserve the enabled/disabled state and reload enabled extensions immediately; failed validation leaves the installed package intact. The local-directory installation option remains available.

For manual installation, download for the workspace server's OS and architecture and extract directly into ~/.pencode/extensions/ (%USERPROFILE%/.pencode/extensions/ on Windows). For example:

sha256sum --check --ignore-missing SHA256SUMS
unzip docker-v0.1.0-linux-amd64.zip -d ~/.pencode/extensions/

This creates ~/.pencode/extensions/docker/resources/extension.json and ~/.pencode/extensions/docker/bin/docker. Preserve executable permissions when extracting on Linux/macOS. Restart Pencode to discover the extension. You can also use the extension manager to install the extracted docker/ directory. Install on the remote server for a remote workspace.

Extension Downloads Runtime requirements
Codex Agent Releases Codex CLI and its configured account
Docker Releases Docker CLI and an accessible Docker daemon
Go Releases Go toolchain; gopls and Delve install automatically
Markdown Preview Releases No additional runtime
Material Icons Releases No additional runtime
Office Viewer Releases Node.js 22+ or Bun
PHP Releases Selected language server/debugger prerequisites; see its README
UI Demo Releases No additional runtime

Release packages target Pencode's PEB v20 SDK (Pencode v0.1.0-rc.5). Go modules pin the published SDK dependency; Office Viewer's workflow checks out the matching TypeScript SDK commit before npm ci. Its six platform assets use the same portable bundled JavaScript. Using a downloaded Go extension does not require a Go toolchain unless the extension itself manages Go tools.

Documentation

Overview

Package extensions bridges server-owned extensions to GUI appearance and views.

Index

Constants

View Source
const DefaultMarketplaceURL = "https://pencode-labs.github.io/extensions/extensions.json"
View Source
const MarketplaceOutputChannelName = "Extension Marketplace"
View Source
const (
	StartupTimeout = 5 * time.Second
)

Variables

This section is empty.

Functions

func Install

func Install(ctx context.Context, backend *client.Client, source string) (Installed, *Bundle, error)

Install uploads a selected local package to the server. Only this explicit file-transfer source is opened locally; installed packages always live there.

func SetEnabled

func SetEnabled(ctx context.Context, backend *client.Client, id string, enabled bool) (Installed, *Bundle, error)

Enabling is prepared on the server and committed only after GUI resource validation. Failed activation preserves the installed disabled manifest.

Types

type ActionExtension

type ActionExtension struct {
	Output *output.Channel

	ID      string
	Actions []peb.Action
	// contains filtered or unexported fields
}

ActionExtension retains a validated process entry for its live button session.

func (*ActionExtension) Start

func (extension *ActionExtension) Start(values peb.SettingValues, wake func()) *ActionSession

type ActionResult

type ActionResult struct {
	Err       error
	UI        *peb.UI
	Assets    map[string][]byte
	Icons     map[string][]byte
	Lifecycle *peb.LifecycleReply
	Change    peb.ActionChange
	Token     uint64
	// Fatal marks a disconnected process; its actions must be removed.
	Fatal bool
}

type ActionSession

type ActionSession struct {
	Results <-chan ActionResult
	Done    <-chan struct{}
	// contains filtered or unexported fields
}

func (*ActionSession) Close

func (s *ActionSession) Close()

func (*ActionSession) Editor

func (s *ActionSession) Editor(a peb.Action) Editor

Editor binds a live Open With action to a view in the window's extension process.

func (*ActionSession) NotifyFiles

func (s *ActionSession) NotifyFiles(changes peb.FileChanges)

func (*ActionSession) Submit

func (s *ActionSession) Submit(c peb.ActionContext) bool

func (*ActionSession) SubmitLifecycle

func (s *ActionSession) SubmitLifecycle(event peb.LifecycleEvent, token uint64) bool

SubmitLifecycle serializes host lifecycle events with action and UI requests.

func (*ActionSession) SubmitSettings

func (s *ActionSession) SubmitSettings(values peb.SettingValues) bool

func (*ActionSession) SubmitUI

func (s *ActionSession) SubmitUI(event peb.UIEvent) bool

type Bundle

type Bundle struct {
	ID, Label       string
	LanguagePacks   []localization.Pack
	Settings        []peb.Setting
	Actions         *ActionExtension
	Themes          []Theme
	IconThemes      []peb.IconTheme
	Icons           map[string][]byte
	Editors         []Editor
	Fonts           []Font
	LanguageServers []LanguageServer
	DebugAdapters   []peb.DebugAdapter
}

Bundle owns all imported assets. No extension directory remains open after registration, and rendering performs no disk reads for extension icons.

func Load

func Load(ctx context.Context, backend *client.Client, id string) (*Bundle, error)

func (*Bundle) Close

func (b *Bundle) Close()

Close releases an unconsumed registration. Once imported into a workbench, its font registry owns these faces instead.

type Editor

type Editor struct {
	Output *output.Channel

	LocalID string
	peb.Action
	// contains filtered or unexported fields
}

Editor retains its validated process entry for on-demand activation.

func (*Editor) Start

func (editor *Editor) Start(root string, values peb.SettingValues, wake func()) *EditorSession

type EditorResult

type EditorResult struct {
	Reply   peb.EditorReply
	Err     error
	Assets  map[string][]byte
	Message peb.EditorMessage
}

type EditorSession

type EditorSession struct {
	Results <-chan EditorResult
	Done    <-chan struct{}
	// contains filtered or unexported fields
}

EditorSession owns one view in the window's shared extension process. All pipe I/O happens on its worker; the UI submits at most one outstanding request and never blocks.

func (*EditorSession) Close

func (s *EditorSession) Close()

Close releases this view asynchronously; the window's extension process stays alive.

func (*EditorSession) NotifyFiles

func (s *EditorSession) NotifyFiles(changes peb.FileChanges)

func (*EditorSession) Submit

func (s *EditorSession) Submit(message peb.EditorMessage) bool

func (*EditorSession) SubmitSettings

func (s *EditorSession) SubmitSettings(values peb.SettingValues) bool

type Font

type Font struct {
	Regular, Bold *font.Face
	ID, Label     string
}

Font holds parsed, memory-backed faces validated on the loader worker.

type Host

type Host struct {
	Results <-chan Result
	// contains filtered or unexported fields
}

func Start

func Start(backend *client.Client, wake func(), logs *output.Store) *Host

Start discovers packages on the server. GUI workers import only immutable resources; no process creation or installed-directory I/O happens here.

func (*Host) Close

func (h *Host) Close()

type Installed

type Installed = protocol.ExtensionInfo

type LanguageServer

type LanguageServer struct {
	Output *output.Channel

	LocalID string
	peb.LanguageServer
	// contains filtered or unexported fields
}

LanguageServer is a validated contribution. A workspace activates one process per contribution and root, shared by all matching open documents.

func (*LanguageServer) DocumentLanguage

func (s *LanguageServer) DocumentLanguage(name string) string

func (*LanguageServer) Match

func (s *LanguageServer) Match(name string) bool

func (*LanguageServer) Start

func (s *LanguageServer) Start(ctx context.Context, root string, handler lsp.Handler) (*lsp.Client, error)

type Listing

type Listing struct {
	Name                          string `json:"name"`
	Repository                    string `json:"repository"`
	Description                   string `json:"description"`
	Version, URL, Digest, Problem string
}

func (*Listing) NewerThan

func (l *Listing) NewerThan(version string) bool

type Manifest

type Manifest = protocol.ExtensionManifest

Metadata uses the same domain types on both sides of the connection.

type Marketplace

type Marketplace struct {
	Client      *http.Client
	Source, API string
}

Marketplace's zero value uses the official catalog and public GitHub API.

func (Marketplace) Install

func (m Marketplace) Install(ctx context.Context, backend *client.Client, l Listing, update bool) (Installed, *Bundle, error)

Install downloads and extracts a release into disposable local staging, then validates and publishes it through the workspace server's transaction.

func (Marketplace) List

func (m Marketplace) List(ctx context.Context, goos, arch string) ([]Listing, error)

List checks release metadata only; packages are downloaded by an explicit Install.

type Result

type Result struct {
	Err    error
	Bundle *Bundle
	ID     string
}

type Theme

type Theme struct {
	Theme     *syntax.Theme
	ID, Label string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL