Interface: ExtensionContext
Defined in: packages/sdk/src/types.ts:890
The object handed to Extension.activate. It is the only sanctioned way an extension touches the running app: register contributions, invoke commands, and read/drive state through the typed consumer services. Every register* call returns a Disposable and is also tracked on ExtensionContext.subscriptions.
Properties
extensionId
readonly extensionId: string;Defined in: packages/sdk/src/types.ts:892
The activating extension's id (its Extension.id).
subscriptions
readonly subscriptions: Disposable[];Defined in: packages/sdk/src/types.ts:894
Disposables tracked for this extension; the host disposes them on teardown.
storage
readonly storage: ExtensionStorageScopes;Defined in: packages/sdk/src/types.ts:910
Persisted, per-extension key/value storage, in two scopes (ExtensionStorageScopes): global (shared across all workspaces — for the extension's own settings) and workspace (scoped to the active workspace). Each is the extension's own bag, shared across all its surfaces — status bar, side panels, and settings page — independent of whether any panel has mounted.
.get() / .set() are safe to call in Extension.activate. Note the app state hydrates asynchronously and the workspace bag is swapped on workspace change, so a value persisted last session may not be present at the instant activate runs — subscribe and re-read to pick up restored or switched values. (SidePanelProps.storage exposes the same workspace scope keyed by panel id, for panel-local UI state.)
workspaces
readonly workspaces: WorkspaceService;Defined in: packages/sdk/src/types.ts:993
Consumer API for driving workspace state — create, rename, reorder, activate, soft close/reopen, and hard delete. Subscribe to a frozen state for read access without depending on Valtio.
editors
readonly editors: EditorService;Defined in: packages/sdk/src/types.ts:999
The editor & document domain — open files into editor tabs, drive the active editor (save / close), and register editor save handlers. Opening editors lives here, not on ExtensionContext.workspaces.
layout
readonly layout: LayoutService;Defined in: packages/sdk/src/types.ts:1005
Consumer API for app layout — side-panel collapse state. Read via getState/useServiceState/subscribe; drive via toggleSidePanel / setSidePanelCollapsed.
process
readonly process: ProcessService;Defined in: packages/sdk/src/types.ts:1011
Persistent process / PTY sessions that survive app restarts — the core primitive under the terminal (and future task runners, REPLs). Spawn or re-attach a session and drive it via the returned ProcessSession.
processes
readonly processes: ProcessesService;Defined in: packages/sdk/src/types.ts:1019
Workspace process observability — a live view of what is running in each terminal, with optional CPU/memory stats and a surgical kill that leaves the shell alive. Complements ExtensionContext.process (which spawns sessions); this surface is for reading and controlling what's already running. See ProcessesService for the full API.
agents
readonly agents: AgentsService;Defined in: packages/sdk/src/types.ts:1029
Host-computed coding-agent activity and resume-identity observability — a live, read-only view of what each terminal's agent is doing (none/working/idle/error/dead) and, once a terminal's backend is confirmed dead after an unclean shutdown, a resume hint for it. Detection is fully sealed in the host implementation; there is no registration API. @beta — the shape may still change. See AgentsService for the full API.
terminals
readonly terminals: TerminalService;Defined in: packages/sdk/src/types.ts:1037
Consumer API for the terminal domain — open a terminal tab in a workspace (create) or reap a workspace's terminals (closeWorkspace). The terminal is a core feature (a built-in DockKind like the editor); its tabs render from the workspace's records, and PTY sessions live on ExtensionContext.process.
panels
readonly panels: PanelService;Defined in: packages/sdk/src/types.ts:1046
Tab chrome (icon / highlight / indicator / activity) for a dock panel tab of any DockPanelKind — the Chat transcript, a web viewer, a third-party panel. The same TabAdornmentMethods contract ExtensionContext.editors and ExtensionContext.terminals offer for their own kind, so a panel tab isn't a special case. See PanelService.
files
readonly files: FileService;Defined in: packages/sdk/src/types.ts:1052
Host-mediated filesystem access — read / write / list / watch, all routed through the host rather than raw Tauri. The single privileged chokepoint for the filesystem; watcher lifecycle is host-owned (see FileService).
search
readonly search: SearchService;Defined in: packages/sdk/src/types.ts:1059
Cross-file content search over the workspace — the core primitive under the Search panel (and future quick-open / find-references). Runs a native search engine in the host (off the UI thread), honoring .gitignore, and resolves with matches grouped by file. See SearchService.
theme
readonly theme: ThemeService;Defined in: packages/sdk/src/types.ts:1066
Consumer API for the theme domain — read the merged preset set + active theme, switch themes, and manage custom themes. Read via getState / subscribe; contribute a new preset via ExtensionContext.registerThemePreset.
dnd
readonly dnd: DndService;Defined in: packages/sdk/src/types.ts:1073
Drag-and-drop — be a drag source (DndService.beginDrag) and a drop target (DndService.registerDropTarget), with typed payloads (DND_MIME) that interoperate across extensions. The host owns the drag affordance and the modifier-mode resolution.
ui
readonly ui: UiService;Defined in: packages/sdk/src/types.ts:1080
User-interaction — the only sanctioned way to talk to the user (the host renders the chrome). Native file/folder pickers (UiService.pickFolder, UiService.pickFile, UiService.savePath) and transient toast notifications (UiService.notify). Mirrors VS Code's window.show*.
net
readonly net: NetworkService;Defined in: packages/sdk/src/types.ts:1088
Server-side HTTP client — makes requests from the Rust backend, bypassing the browser's CORS policy. Use when browser fetch is insufficient: reading response headers from cross-origin requests, probing localhost services without CORS headers, or checking iframe embeddability before loading a URL. See NetworkService for the full API.
webview
readonly webview: WebviewService;Defined in: packages/sdk/src/types.ts:1095
Real DOM access, navigation control, and native pixel capture inside an <iframe> you own — including cross-origin content the browser's same-origin policy would otherwise fully sandbox. Requires the "webview" Permission. See WebviewService.
system
readonly system: SystemService;Defined in: packages/sdk/src/types.ts:1103
Static host-platform metadata — the OS, CPU architecture, and running Silo version. Values are baked into the binary at build time and never change during a session. Use to make platform-specific decisions at activation time (e.g. register a macOS-only command, show an arch-specific download URL). See SystemService for the full API.
log
readonly log: LogService;Defined in: packages/sdk/src/types.ts:1116
Write-only structured logger scoped to this extension. Entries appear in the Output panel under the extension's display name. A channel is created automatically at activation and removed at deactivation — no setup required.
ctx.log.info("Extension activated");
ctx.log.warn("Unexpected state", { detail: 42 });
ctx.log.show(); // open the Output panel, select this extension's channelMethods
registerEditor()
registerEditor(editor): Disposable;Defined in: packages/sdk/src/types.ts:912
Register an Editor (a presenter for a file type's editor tab).
Parameters
editor
Returns
registerFileType()
registerFileType(type): Disposable;Defined in: packages/sdk/src/types.ts:914
Register a FileType (declarative file metadata).
Parameters
type
Returns
registerCommand()
registerCommand(cmd): Disposable;Defined in: packages/sdk/src/types.ts:916
Register a Command (a named, invokable action).
Parameters
cmd
Returns
registerMenuItem()
registerMenuItem(item): Disposable;Defined in: packages/sdk/src/types.ts:918
Register a MenuItemContribution (place a command in a menu).
Parameters
item
Returns
registerContextMenuItem()
registerContextMenuItem<S>(item): Disposable;Defined in: packages/sdk/src/types.ts:924
Register a ContextMenuContribution (add a command to a built-in surface's right-click context menu). The invoked command receives the surface's MenuContext target as its first argument.
Type Parameters
S
S extends MenuSurface
Parameters
item
Returns
registerToolbarItem()
registerToolbarItem<S>(item): Disposable;Defined in: packages/sdk/src/types.ts:936
Register a ToolbarItemContribution (icon-only, text-only, icon+text, or dropdown) in the trailing cluster of a host-drawn toolbar — the editor breadcrumb, the Navigator header, or a dock panel's strip (the terminal included). Independent of ExtensionContext.registerContextMenuItem — register either, both, or neither. Hosts only show items while that surface's breadcrumbs setting is on. See ExtensionContext.invalidateToolbarItems.
Type Parameters
S
S extends ToolbarSurface
Parameters
item
Returns
invalidateToolbarItems()
invalidateToolbarItems(): void;Defined in: packages/sdk/src/types.ts:944
Signal that toolbar-item when / checked data changed. Causes every toolbar surface — the editor breadcrumb, the Navigator header, and every dock panel strip — to re-query contributions and re-render.
Returns
void
registerKeybinding()
registerKeybinding(binding): Disposable;Defined in: packages/sdk/src/types.ts:946
Register a Keybinding (bind a shortcut to a command).
Parameters
binding
Returns
registerSidePanel()
registerSidePanel(panel): Disposable;Defined in: packages/sdk/src/types.ts:948
Register a SidePanel (a left/right column panel).
Parameters
panel
Returns
registerNavigatorView()
registerNavigatorView(view): Disposable;Defined in: packages/sdk/src/types.ts:954
Register a NavigatorView — a projection the user can switch the Navigator panel to. Prefer this over a second side panel when your surface is another way to navigate the app.
Parameters
view
Returns
registerDockPanelKind()
registerDockPanelKind<T>(kind): Disposable;Defined in: packages/sdk/src/types.ts:960
Register a DockPanelKind (a center-dock tab kind). The params generic T is inferred from the component's DockPanelProps annotation, so kinds with typed params register without casts.
Type Parameters
T
T extends object = Record<string, unknown>
Parameters
kind
Returns
registerStatusItem()
registerStatusItem(item): Disposable;Defined in: packages/sdk/src/types.ts:964
Register a StatusItem (a status-bar widget).
Parameters
item
Returns
registerSettingsPage()
registerSettingsPage(page): Disposable;Defined in: packages/sdk/src/types.ts:966
Register a SettingsPage (a page in the Settings dialog).
Parameters
page
Returns
registerThemePreset()
registerThemePreset(preset): Disposable;Defined in: packages/sdk/src/types.ts:972
Register a ThemePreset (a selectable theme in the picker).
Parameters
preset
Returns
Deprecated
Use ctx.theme.registerPreset() instead. This method will be removed in a future release.
executeCommand()
executeCommand<T>(id, ...args): Promise<T>;Defined in: packages/sdk/src/types.ts:987
Invoke a registered command by id — including commands contributed by other extensions. The minimal "operate" primitive; pairs with the typed services for read access.
Optional positional args are forwarded to the command's Command.run function. The returned Promise resolves with the command's return value, or rejects if the command throws, is async and rejects, or the id is not registered. Sync commands dispatch synchronously before the promise settles, so callers that read state the command mutates immediately after await executeCommand(…) see the updated state.
Type Parameters
T
T = unknown
Expected return type of the command (defaults to unknown).
Parameters
id
string
args
...unknown[]
Returns
Promise<T>
getExtension()
getExtension<API>(id): ExtensionHandle<API> | undefined;Defined in: packages/sdk/src/types.ts:1130
Resolve a handle to another extension in order to consume the API it published (the value its Extension.activate returned). This is how features that live outside core — git, terminal, themes — expose capabilities to other extensions.
Returns undefined if no extension with that id is known. Even when known, the handle's api is undefined until that extension has activated — so always handle absence; the provider may be disabled or activate after you. Call this at use time, not in activate.
Type Parameters
API
API = unknown
the provider's published API type (import its types package).
Parameters
id
string
Returns
ExtensionHandle<API> | undefined