@silo-code/sdk 0.20.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/context-keys.d.ts +18 -3
- package/dist/context-keys.d.ts.map +1 -1
- package/dist/domain-types.d.ts +8 -32
- package/dist/domain-types.d.ts.map +1 -1
- package/dist/extension-storage.d.ts +7 -3
- package/dist/extension-storage.d.ts.map +1 -1
- package/dist/file-service.d.ts +15 -2
- package/dist/file-service.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/layout-service.d.ts +13 -13
- package/dist/layout-service.d.ts.map +1 -1
- package/dist/network-service.d.ts +24 -2
- package/dist/network-service.d.ts.map +1 -1
- package/dist/network-service.js +35 -1
- package/dist/network-service.js.map +1 -1
- package/dist/terminal-service.d.ts +29 -0
- package/dist/terminal-service.d.ts.map +1 -1
- package/dist/theme-service.d.ts +23 -7
- package/dist/theme-service.d.ts.map +1 -1
- package/dist/types.d.ts +90 -19
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -4
- package/src/context-keys.ts +18 -3
- package/src/domain-types.ts +8 -29
- package/src/extension-storage.ts +8 -3
- package/src/file-service.ts +16 -2
- package/src/index.ts +7 -1
- package/src/layout-service.ts +15 -13
- package/src/network-service.ts +34 -2
- package/src/terminal-service.ts +31 -0
- package/src/theme-service.ts +23 -7
- package/src/types.ts +92 -20
package/dist/context-keys.d.ts
CHANGED
|
@@ -11,9 +11,24 @@
|
|
|
11
11
|
* @public
|
|
12
12
|
*/
|
|
13
13
|
export interface ContextKeys {
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
/**
|
|
15
|
+
* The {@link Editor.id} of the presenter currently rendering the active dock
|
|
16
|
+
* panel (e.g. `"core.text-editor"`, `"silo.markdown-preview"`), or `null`
|
|
17
|
+
* when the active panel is not an editor. Identifies the *view type*, not the
|
|
18
|
+
* tab instance — see {@link ContextKeys.activeEditorId} for the tab record id.
|
|
19
|
+
*/
|
|
20
|
+
activeEditorViewId: string | null;
|
|
21
|
+
/**
|
|
22
|
+
* The `editorId` of the active editor tab record, or `null` when the active
|
|
23
|
+
* dock panel is not an editor tab. Identifies the *tab instance* — see
|
|
24
|
+
* {@link ContextKeys.activeEditorViewId} for the view-type (presenter) id.
|
|
25
|
+
*/
|
|
17
26
|
activeEditorId: string | null;
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated Use {@link ContextKeys.activeEditorViewId} instead.
|
|
29
|
+
* Kept for one release so extensions compiled against the old SDK continue
|
|
30
|
+
* to receive the correct value at runtime without a silent break.
|
|
31
|
+
*/
|
|
32
|
+
activeViewerId: string | null;
|
|
18
33
|
}
|
|
19
34
|
//# sourceMappingURL=context-keys.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context-keys.d.ts","sourceRoot":"","sources":["../src/context-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,WAAW;IAC1B,
|
|
1
|
+
{"version":3,"file":"context-keys.d.ts","sourceRoot":"","sources":["../src/context-keys.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,WAAW;IAC1B;;;;;OAKG;IACH,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC;;;;OAIG;IACH,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B;;;;OAIG;IACH,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B"}
|
package/dist/domain-types.d.ts
CHANGED
|
@@ -98,6 +98,11 @@ export type SidePanelSlot = "left" | "right" | "left-bottom" | "right-bottom";
|
|
|
98
98
|
* A workspace — the unit Silo switches between, keeping its terminals, editors,
|
|
99
99
|
* and layout alive. Read via {@link WorkspaceService}.
|
|
100
100
|
*
|
|
101
|
+
* This is the public surface: it carries the fields an extension needs to read
|
|
102
|
+
* (name, folder, open tabs). Layout, scroll, and panel-state fields are
|
|
103
|
+
* host-internal (`WorkspaceInternal` in `@silo-code/extension-host`) and are
|
|
104
|
+
* intentionally absent here.
|
|
105
|
+
*
|
|
101
106
|
* @category Core Types
|
|
102
107
|
* @public
|
|
103
108
|
*/
|
|
@@ -109,44 +114,15 @@ export interface Workspace {
|
|
|
109
114
|
extraFolders?: string[];
|
|
110
115
|
createdAt: string;
|
|
111
116
|
lastOpenedAt: string;
|
|
112
|
-
terminals: TerminalRecord[];
|
|
113
|
-
/** Editor tabs — text editors and diffs alike (a diff is a record with `mode: "diff"`). */
|
|
114
|
-
editors: EditorRecord[];
|
|
115
|
-
dockLayout: unknown | null;
|
|
116
|
-
/** Scroll positions keyed by editor record ID: { top, left } in pixels. */
|
|
117
|
-
editorScrollPositions?: Record<string, {
|
|
118
|
-
top: number;
|
|
119
|
-
left: number;
|
|
120
|
-
}>;
|
|
121
|
-
/**
|
|
122
|
-
* Monaco view states keyed by editor record ID. Each value is the opaque
|
|
123
|
-
* JSON produced by `editor.saveViewState()` — captures cursor position,
|
|
124
|
-
* selection, scroll, and folded regions. Supersedes
|
|
125
|
-
* {@link Workspace.editorScrollPositions} for editors that support it;
|
|
126
|
-
* scroll-only data is kept as a fallback for older persisted workspaces.
|
|
127
|
-
*/
|
|
128
|
-
editorViewStates?: Record<string, unknown>;
|
|
129
117
|
/**
|
|
130
118
|
* ISO timestamp of when the workspace was soft-closed, or null/undefined
|
|
131
119
|
* if the workspace is open. Closed workspaces are hidden from the main
|
|
132
120
|
* list and surfaced in a "reopen" picker.
|
|
133
121
|
*/
|
|
134
122
|
closedAt?: string | null;
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
activeSidePanelTabs?: Record<string, string>;
|
|
139
|
-
sidePanelScrollPositions?: Record<string, number>;
|
|
140
|
-
/** Hidden side panels, keyed by panel id; only an explicit `false` (hidden)
|
|
141
|
-
* is stored, so an absent key means visible (the default). */
|
|
142
|
-
sidePanelVisibility?: Record<string, boolean>;
|
|
143
|
-
extensionState?: Record<string, Record<string, unknown>>;
|
|
144
|
-
/** Whether the left side column is collapsed. Per-workspace. */
|
|
145
|
-
leftPanelCollapsed?: boolean;
|
|
146
|
-
/** Whether the right side column is collapsed. Per-workspace. */
|
|
147
|
-
rightPanelCollapsed?: boolean;
|
|
148
|
-
/** ID of the current preview (temporary) editor, if any. */
|
|
149
|
-
previewEditorId?: string | null;
|
|
123
|
+
terminals: readonly TerminalRecord[];
|
|
124
|
+
/** Editor tabs — text editors and diffs alike (a diff is a record with `mode: "diff"`). */
|
|
125
|
+
editors: readonly EditorRecord[];
|
|
150
126
|
}
|
|
151
127
|
/**
|
|
152
128
|
* Light or dark theme base.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domain-types.d.ts","sourceRoot":"","sources":["../src/domain-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,QAAQ,GAAG,IAAI,CAAC;AAErD;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,YAAY,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uEAAuE;IACvE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,mGAAmG;IACnG,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,8DAA8D;IAC9D,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,kGAAkG;IAClG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IAC1B,qBAAqB,EAAE,MAAM,CAAC;IAE9B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,uBAAuB,EAAE,MAAM,CAAC;CACjC;AAED;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX;;;OAGG;IACH,OAAO,EAAE,CAAC,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,SAAS,CAAC;IAChB,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;IAC9B,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Disposable } from "./types";
|
|
1
2
|
/**
|
|
2
3
|
* Namespaced, persisted key/value storage handed to extensions. Two scopes are
|
|
3
4
|
* exposed on {@link ExtensionContext.storage} ({@link ExtensionStorageScopes}):
|
|
@@ -24,10 +25,13 @@ export interface ExtensionStorage {
|
|
|
24
25
|
/**
|
|
25
26
|
* Subscribe to changes in this namespace. Called when a value in this
|
|
26
27
|
* namespace changes, when the underlying app state finishes hydrating, and
|
|
27
|
-
* (for the workspace scope) when the active workspace changes.
|
|
28
|
-
*
|
|
28
|
+
* (for the workspace scope) when the active workspace changes.
|
|
29
|
+
*
|
|
30
|
+
* Returns a {@link Disposable} — call `.dispose()` to unsubscribe, or push
|
|
31
|
+
* it onto `ctx.subscriptions` for automatic teardown. Consistent with every
|
|
32
|
+
* other subscription in the SDK.
|
|
29
33
|
*/
|
|
30
|
-
subscribe(listener: () => void):
|
|
34
|
+
subscribe(listener: () => void): Disposable;
|
|
31
35
|
}
|
|
32
36
|
/**
|
|
33
37
|
* The two persisted-storage scopes available to an extension, exposed as
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension-storage.d.ts","sourceRoot":"","sources":["../src/extension-storage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,gBAAgB;IAC/B,8DAA8D;IAC9D,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC;IACnC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC;IACpC,kDAAkD;IAClD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IACvC,gDAAgD;IAChD,IAAI,IAAI,MAAM,EAAE,CAAC;IACjB
|
|
1
|
+
{"version":3,"file":"extension-storage.d.ts","sourceRoot":"","sources":["../src/extension-storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,gBAAgB;IAC/B,8DAA8D;IAC9D,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAAC;IACnC,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC;IACpC,kDAAkD;IAClD,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAAC;IACvC,gDAAgD;IAChD,IAAI,IAAI,MAAM,EAAE,CAAC;IACjB;;;;;;;;OAQG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,UAAU,CAAC;CAC7C;AAED;;;;;;GAMG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAClC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC;CACtC"}
|
package/dist/file-service.d.ts
CHANGED
|
@@ -18,6 +18,15 @@ export interface FileMeta {
|
|
|
18
18
|
/** Last-modified time, milliseconds since the Unix epoch. */
|
|
19
19
|
modifiedMs: number;
|
|
20
20
|
}
|
|
21
|
+
/**
|
|
22
|
+
* The normalized kind of a filesystem change, as delivered in
|
|
23
|
+
* {@link FileChangeEvent.kind}. Backend-specific event kinds that don't map to
|
|
24
|
+
* one of the three meaningful values are surfaced as `"other"`.
|
|
25
|
+
*
|
|
26
|
+
* @category Core Types
|
|
27
|
+
* @public
|
|
28
|
+
*/
|
|
29
|
+
export type FileChangeKind = "create" | "modify" | "remove" | "other";
|
|
21
30
|
/**
|
|
22
31
|
* A filesystem change event delivered to a {@link FileService.watch} listener,
|
|
23
32
|
* for changes under that watch's path.
|
|
@@ -28,8 +37,12 @@ export interface FileMeta {
|
|
|
28
37
|
export interface FileChangeEvent {
|
|
29
38
|
/** The paths that changed in this event. */
|
|
30
39
|
paths: string[];
|
|
31
|
-
/**
|
|
32
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Normalized change kind. The host maps the backend's vocabulary to this
|
|
42
|
+
* closed union; backend-specific kinds that don't match arrive as `"other"`.
|
|
43
|
+
* Always compare against the union values — never against raw backend strings.
|
|
44
|
+
*/
|
|
45
|
+
kind: FileChangeKind;
|
|
33
46
|
}
|
|
34
47
|
/**
|
|
35
48
|
* The filesystem domain, exposed as {@link ExtensionContext.files}. All access
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-service.d.ts","sourceRoot":"","sources":["../src/file-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAM1C;;;;;;GAMG;AACH,MAAM,WAAW,QAAQ;IACvB,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,KAAK,EAAE,OAAO,CAAC;IACf,yCAAyC;IACzC,IA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CAAC;IAC3C,8DAA8D;IAC9D,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,oDAAoD;IACpD,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC,yCAAyC;IACzC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,kCAAkC;IAClC,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,gEAAgE;IAChE,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC;;;;;OAKG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,GAAG,UAAU,CAAC;CAC7E"}
|
package/dist/index.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ export type { LayoutService, LayoutState, SidePanelColumnState, SideLocation, }
|
|
|
17
17
|
export type { ProcessService, ProcessSession, ProcessSpawnOptions, ProcessExecOptions, ProcessExecResult, } from "./process-service";
|
|
18
18
|
export type { ProcessesService, ProcessInfo, ProcessStats, } from "./processes-service";
|
|
19
19
|
export type { TerminalService, CreateTerminalInput, TerminalKind, TerminalRecord, TerminalTabDecoration, TerminalTabDecorationProvider, OscEvent, } from "./terminal-service";
|
|
20
|
-
export type { FileService, FileMeta, FileChangeEvent } from "./file-service";
|
|
20
|
+
export type { FileService, FileMeta, FileChangeKind, FileChangeEvent, } from "./file-service";
|
|
21
21
|
export type { SearchService, SearchOptions, SearchMatch, SearchFileResult, SearchResponse, } from "./search-service";
|
|
22
22
|
export type { Permission } from "./permissions";
|
|
23
23
|
export { PathDeniedError } from "./permissions";
|
|
@@ -26,6 +26,7 @@ export type { ExtensionStorage, ExtensionStorageScopes, } from "./extension-stor
|
|
|
26
26
|
export type { DndService, DndItem, DndMime, DragInit, DndMode, DropContext, DropTargetHandlers, } from "./dnd-service";
|
|
27
27
|
export { DND_MIME } from "./dnd-service";
|
|
28
28
|
export type { UiService, FileFilter, MenuItem, MenuItemTrailing, MenuSeparator, MenuHeader, MenuEntry, ShowMenuOptions, ConfirmOptions, PromptOptions, ModalOptions, NotifyAction, NotifyOptions, } from "./ui-service";
|
|
29
|
+
export { NetworkError } from "./network-service";
|
|
29
30
|
export type { NetworkService, NetworkRequestOptions, NetworkResponse, } from "./network-service";
|
|
30
31
|
export type { SystemService, SystemInfo } from "./system-service";
|
|
31
32
|
export type { LogService, LogLevel } from "./output-service";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,YAAY,EACV,UAAU,EACV,YAAY,EACZ,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,MAAM,EACN,eAAe,EACf,QAAQ,EACR,OAAO,EACP,MAAM,EACN,oBAAoB,EACpB,UAAU,EACV,cAAc,EACd,SAAS,EACT,aAAa,EACb,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,eAAe,GAChB,MAAM,SAAS,CAAC;AAKjB,YAAY,EACV,SAAS,EACT,UAAU,EACV,YAAY,EACZ,aAAa,GACd,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,cAAc,EACd,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,aAAa,EACb,WAAW,EACX,oBAAoB,EACpB,YAAY,GACb,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EACV,gBAAgB,EAChB,WAAW,EACX,YAAY,GACb,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,cAAc,EACd,qBAAqB,EACrB,6BAA6B,EAC7B,QAAQ,GACT,MAAM,oBAAoB,CAAC;AAC5B,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,YAAY,EACV,UAAU,EACV,YAAY,EACZ,cAAc,EACd,WAAW,EACX,kBAAkB,EAClB,MAAM,EACN,eAAe,EACf,QAAQ,EACR,OAAO,EACP,MAAM,EACN,oBAAoB,EACpB,UAAU,EACV,cAAc,EACd,SAAS,EACT,aAAa,EACb,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,eAAe,GAChB,MAAM,SAAS,CAAC;AAKjB,YAAY,EACV,SAAS,EACT,UAAU,EACV,YAAY,EACZ,aAAa,GACd,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,cAAc,EACd,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EACV,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,WAAW,EACX,kBAAkB,EAClB,mBAAmB,GACpB,MAAM,kBAAkB,CAAC;AAC1B,YAAY,EACV,aAAa,EACb,WAAW,EACX,oBAAoB,EACpB,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,EACd,qBAAqB,EACrB,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAG3B,YAAY,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAKlE,YAAY,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG7D,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAK3D,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACvE,YAAY,EACV,UAAU,EACV,iBAAiB,EACjB,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
*/
|
|
12
12
|
export { PathDeniedError } from "./permissions";
|
|
13
13
|
export { DND_MIME } from "./dnd-service";
|
|
14
|
+
// Server-side HTTP client — bypasses CORS, readable response headers.
|
|
15
|
+
export { NetworkError } from "./network-service";
|
|
14
16
|
// Tooltip — the same styled hover popup the host uses in the status bar.
|
|
15
17
|
// Extensions use this instead of native `title` attributes to match host chrome.
|
|
16
18
|
export { Tooltip } from "./Tooltip";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAwGH,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AA6BhD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAoBzC,sEAAsE;AACtE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAkBjD,yEAAyE;AACzE,iFAAiF;AACjF,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,wEAAwE;AACxE,iFAAiF;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEtD,8EAA8E;AAC9E,4EAA4E;AAC5E,8EAA8E;AAC9E,8EAA8E;AAC9E,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/layout-service.d.ts
CHANGED
|
@@ -56,21 +56,21 @@ export interface LayoutService {
|
|
|
56
56
|
* web-viewer tab). No-op when the center dock has no active workspace.
|
|
57
57
|
*
|
|
58
58
|
* @param kindId - The {@link DockPanelKind.id} to instantiate.
|
|
59
|
-
* @param params - Arbitrary params forwarded to the panel
|
|
60
|
-
*
|
|
61
|
-
*
|
|
59
|
+
* @param params - Arbitrary params forwarded to the panel component.
|
|
60
|
+
* Serialized into `ws.dockLayout` so state survives workspace
|
|
61
|
+
* close/reopen.
|
|
62
|
+
* @param options - `singleton: true` opens at most one instance at a time:
|
|
63
|
+
* if a panel with `kindId` already exists, it is focused instead of
|
|
64
|
+
* creating a new one. The panel's id equals `kindId` (not UUID-based) when
|
|
65
|
+
* singleton is set.
|
|
62
66
|
*/
|
|
63
|
-
openPanel(kindId: string, params?: Record<string, unknown
|
|
67
|
+
openPanel(kindId: string, params?: Record<string, unknown>, options?: {
|
|
68
|
+
singleton?: boolean;
|
|
69
|
+
}): void;
|
|
64
70
|
/**
|
|
65
|
-
* Open a **singleton** dock panel
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
* at most one can exist). Use for utility panels like Output that don't
|
|
69
|
-
* benefit from multiple instances.
|
|
70
|
-
*
|
|
71
|
-
* @param kindId - The {@link DockPanelKind.id} to open or focus.
|
|
72
|
-
* @param params - Forwarded to the panel when creating; ignored when
|
|
73
|
-
* focusing an existing instance.
|
|
71
|
+
* Open a **singleton** dock panel.
|
|
72
|
+
* @deprecated Use `openPanel(kindId, params, { singleton: true })` instead.
|
|
73
|
+
* This method will be removed in a future release.
|
|
74
74
|
*/
|
|
75
75
|
openSingletonPanel(kindId: string, params?: Record<string, unknown>): void;
|
|
76
76
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout-service.d.ts","sourceRoot":"","sources":["../src/layout-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,kDAAkD;IAClD,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,oBAAoB,CAAC;IAC3B,KAAK,EAAE,oBAAoB,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,mCAAmC;IACnC,QAAQ,IAAI,WAAW,CAAC;IACxB,oDAAoD;IACpD,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,WAAW,KAAK,IAAI,GAAG,UAAU,CAAC;IAC1D,2DAA2D;IAC3D,eAAe,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAC;IAC9C,sDAAsD;IACtD,qBAAqB,CAAC,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,GAAG,IAAI,CAAC;IACxE;;;;;OAKG;IACH,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC
|
|
1
|
+
{"version":3,"file":"layout-service.d.ts","sourceRoot":"","sources":["../src/layout-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC;AAE5C;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,kDAAkD;IAClD,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,oBAAoB,CAAC;IAC3B,KAAK,EAAE,oBAAoB,CAAC;CAC7B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,mCAAmC;IACnC,QAAQ,IAAI,WAAW,CAAC;IACxB,oDAAoD;IACpD,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,WAAW,KAAK,IAAI,GAAG,UAAU,CAAC;IAC1D,2DAA2D;IAC3D,eAAe,CAAC,QAAQ,EAAE,YAAY,GAAG,IAAI,CAAC;IAC9C,sDAAsD;IACtD,qBAAqB,CAAC,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,GAAG,IAAI,CAAC;IACxE;;;;;OAKG;IACH,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC;;;;;;;;;;;;;;OAcG;IACH,SAAS,CACP,MAAM,EAAE,MAAM,EACd,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,OAAO,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,OAAO,CAAA;KAAE,GAChC,IAAI,CAAC;IACR;;;;OAIG;IACH,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC;CAC5E"}
|
|
@@ -1,3 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thrown by {@link NetworkService.fetch} and {@link NetworkService.fetchHeaders}
|
|
3
|
+
* when a request fails (network error, DNS failure, TLS error, timeout, etc.).
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* try {
|
|
7
|
+
* const res = await ctx.net.fetch("https://api.example.com/data");
|
|
8
|
+
* } catch (err) {
|
|
9
|
+
* if (err instanceof NetworkError) {
|
|
10
|
+
* console.error(`Request to ${err.url} failed: ${err.message}`);
|
|
11
|
+
* }
|
|
12
|
+
* }
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @category Core Types
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export declare class NetworkError extends Error {
|
|
19
|
+
/** The URL that was requested when the error occurred. */
|
|
20
|
+
readonly url: string;
|
|
21
|
+
constructor(url: string, message: string);
|
|
22
|
+
}
|
|
1
23
|
/**
|
|
2
24
|
* Options for {@link NetworkService.fetch} and {@link NetworkService.fetchHeaders}.
|
|
3
25
|
*
|
|
@@ -60,7 +82,7 @@ export interface NetworkService {
|
|
|
60
82
|
*
|
|
61
83
|
* @param url - The URL to fetch.
|
|
62
84
|
* @param options - Method, headers, body, redirect and timeout controls.
|
|
63
|
-
* @throws
|
|
85
|
+
* @throws {@link NetworkError} if the request fails (network error, DNS
|
|
64
86
|
* failure, TLS error, etc.).
|
|
65
87
|
*
|
|
66
88
|
* @example
|
|
@@ -80,7 +102,7 @@ export interface NetworkService {
|
|
|
80
102
|
* @param url - The URL to probe.
|
|
81
103
|
* @param options - Redirect and timeout controls (`method` and `body` are
|
|
82
104
|
* ignored — this is always a HEAD request).
|
|
83
|
-
* @throws
|
|
105
|
+
* @throws {@link NetworkError} if the request fails.
|
|
84
106
|
*
|
|
85
107
|
* @example
|
|
86
108
|
* ```ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network-service.d.ts","sourceRoot":"","sources":["../src/network-service.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,MAAM,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;IAC9D,+BAA+B;IAC/B,OAAO,CAAC,EAAE,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,QAAQ,GAAG,OAAO,CAAC;IAC9D,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,4EAA4E;IAC5E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,iDAAiD;IACjD,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,8EAA8E;IAC9E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,wBAAwB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC;IAE9E;;;;;;;;;;;;;;;;;;OAkBG;IACH,YAAY,CACV,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE,IAAI,CAAC,qBAAqB,EAAE,iBAAiB,GAAG,WAAW,CAAC,GACrE,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACpC"}
|
package/dist/network-service.js
CHANGED
|
@@ -1,2 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Thrown by {@link NetworkService.fetch} and {@link NetworkService.fetchHeaders}
|
|
3
|
+
* when a request fails (network error, DNS failure, TLS error, timeout, etc.).
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* try {
|
|
7
|
+
* const res = await ctx.net.fetch("https://api.example.com/data");
|
|
8
|
+
* } catch (err) {
|
|
9
|
+
* if (err instanceof NetworkError) {
|
|
10
|
+
* console.error(`Request to ${err.url} failed: ${err.message}`);
|
|
11
|
+
* }
|
|
12
|
+
* }
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @category Core Types
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export class NetworkError extends Error {
|
|
19
|
+
constructor(url, message) {
|
|
20
|
+
super(message);
|
|
21
|
+
/** The URL that was requested when the error occurred. */
|
|
22
|
+
Object.defineProperty(this, "url", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
configurable: true,
|
|
25
|
+
writable: true,
|
|
26
|
+
value: void 0
|
|
27
|
+
});
|
|
28
|
+
this.name = "NetworkError";
|
|
29
|
+
this.url = url;
|
|
30
|
+
// Restore the prototype chain so `instanceof` works across the down-leveled
|
|
31
|
+
// class output the SDK ships (and across the host↔extension boundary, where
|
|
32
|
+
// there's a single shared SDK instance).
|
|
33
|
+
Object.setPrototypeOf(this, NetworkError.prototype);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
2
36
|
//# sourceMappingURL=network-service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network-service.js","sourceRoot":"","sources":["../src/network-service.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"network-service.js","sourceRoot":"","sources":["../src/network-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,YAAa,SAAQ,KAAK;IAIrC,YAAY,GAAW,EAAE,OAAe;QACtC,KAAK,CAAC,OAAO,CAAC,CAAC;QAJjB,0DAA0D;QACjD;;;;;WAAY;QAInB,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,4EAA4E;QAC5E,4EAA4E;QAC5E,yCAAyC;QACzC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACtD,CAAC;CACF"}
|
|
@@ -152,5 +152,34 @@ export interface TerminalService {
|
|
|
152
152
|
* ```
|
|
153
153
|
*/
|
|
154
154
|
subscribeOsc(terminalId: string, handler: (event: OscEvent) => void): Disposable;
|
|
155
|
+
/**
|
|
156
|
+
* The record id of the terminal tab that is currently active in the active
|
|
157
|
+
* workspace's center dock, or `null` when an editor tab (or nothing) is
|
|
158
|
+
* active. "Active" is the dock's single active panel — the tab the user is
|
|
159
|
+
* looking at and typing into — so a terminal merely visible in a non-active
|
|
160
|
+
* split does not count.
|
|
161
|
+
*/
|
|
162
|
+
getActive(): string | null;
|
|
163
|
+
/**
|
|
164
|
+
* Subscribe to active-terminal changes. The listener receives the terminal
|
|
165
|
+
* record id whenever a terminal tab becomes the active center-dock panel,
|
|
166
|
+
* and `null` when activation moves elsewhere (an editor tab, or no panel —
|
|
167
|
+
* including transiently during a workspace switch, before the incoming
|
|
168
|
+
* workspace's active tab is published).
|
|
169
|
+
*
|
|
170
|
+
* Fires on tab activation, group activation, and workspace switches.
|
|
171
|
+
* Returns a {@link Disposable} that cancels the subscription.
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```ts
|
|
175
|
+
* // Clear a "needs attention" marker once the user views the terminal.
|
|
176
|
+
* ctx.subscriptions.push(
|
|
177
|
+
* ctx.terminals.subscribeActive((terminalId) => {
|
|
178
|
+
* if (terminalId) attention.delete(terminalId);
|
|
179
|
+
* }),
|
|
180
|
+
* );
|
|
181
|
+
* ```
|
|
182
|
+
*/
|
|
183
|
+
subscribeActive(listener: (terminalId: string | null) => void): Disposable;
|
|
155
184
|
}
|
|
156
185
|
//# sourceMappingURL=terminal-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"terminal-service.d.ts","sourceRoot":"","sources":["../src/terminal-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;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";
|
|
|
2
2
|
import type { ThemeBase, ThemeVars, CustomTheme, ThemeExport } from "./domain-types";
|
|
3
3
|
export type { ThemeBase, ThemeVars, CustomTheme, ThemeExport, } from "./domain-types";
|
|
4
4
|
/**
|
|
5
|
-
* A selectable theme contributed via
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
5
|
+
* A selectable theme contributed via {@link ThemeService.registerPreset}.
|
|
6
|
+
* Built-in presets (Tokyo Night, Solarized Light, Gruvbox Dark, …) are
|
|
7
|
+
* registered by the `theme-presets` extension; core ships only Dark and Light.
|
|
8
|
+
* A preset's {@link ThemePreset.vars} are injected as CSS custom properties
|
|
9
|
+
* when it is the active theme.
|
|
10
10
|
*
|
|
11
11
|
* @category Registration
|
|
12
12
|
* @public
|
|
@@ -58,8 +58,7 @@ export interface ThemeState {
|
|
|
58
58
|
* Read via {@link ThemeService.getState | getState} /
|
|
59
59
|
* {@link ThemeService.subscribe | subscribe} (e.g. with `useSyncExternalStore`);
|
|
60
60
|
* drive via {@link ThemeService.setActive | setActive} and the custom-theme
|
|
61
|
-
* methods.
|
|
62
|
-
* {@link ExtensionContext.registerThemePreset}.
|
|
61
|
+
* methods. Contribute a new preset via {@link ThemeService.registerPreset}.
|
|
63
62
|
*
|
|
64
63
|
* @category Consumer Services
|
|
65
64
|
* @public
|
|
@@ -83,5 +82,22 @@ export interface ThemeService {
|
|
|
83
82
|
exportTheme(theme: CustomTheme): ThemeExport;
|
|
84
83
|
/** Validate/parse imported JSON into a custom theme (assigns a fresh id). */
|
|
85
84
|
importTheme(data: unknown): CustomTheme;
|
|
85
|
+
/**
|
|
86
|
+
* Register a {@link ThemePreset} (a selectable theme in the picker). The
|
|
87
|
+
* preset appears immediately and is removed when the returned
|
|
88
|
+
* {@link Disposable} is disposed (typically when the extension deactivates).
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```ts
|
|
92
|
+
* ctx.theme.registerPreset({
|
|
93
|
+
* id: "my-theme",
|
|
94
|
+
* name: "My Theme",
|
|
95
|
+
* base: "dark",
|
|
96
|
+
* colorScheme: "dark",
|
|
97
|
+
* vars: { "--silo-color-bg": "#1a1a2e" },
|
|
98
|
+
* });
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
registerPreset(preset: ThemePreset): Disposable;
|
|
86
102
|
}
|
|
87
103
|
//# sourceMappingURL=theme-service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme-service.d.ts","sourceRoot":"","sources":["../src/theme-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EACV,SAAS,EACT,SAAS,EACT,WAAW,EACX,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAGxB,YAAY,EACV,SAAS,EACT,SAAS,EACT,WAAW,EACX,WAAW,GACZ,MAAM,gBAAgB,CAAC;AAExB;;;;;;;;;GASG;AACH,MAAM,WAAW,WAAW;IAC1B,oEAAoE;IACpE,EAAE,EAAE,MAAM,CAAC;IACX,8CAA8C;IAC9C,IAAI,EAAE,MAAM,CAAC;IACb,mFAAmF;IACnF,IAAI,EAAE,SAAS,CAAC;IAChB,kDAAkD;IAClD,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;IAC9B,gFAAgF;IAChF,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;CAC1B;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,SAAS,CAAC;IAChB,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;IAC9B,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;CAC1B;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,UAAU;IACzB,gEAAgE;IAChE,QAAQ,EAAE,MAAM,CAAC;IACjB,kFAAkF;IAClF,OAAO,EAAE,SAAS,WAAW,EAAE,CAAC;IAChC,kDAAkD;IACl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oFAAoF;IACpF,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,+EAA+E;IAC/E,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,aAAa,CAAC;IACnC,qEAAqE;IACrE,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C,sEAAsE;IACtE,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxC,qDAAqD;IACrD,YAAY,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9B,kEAAkE;IAClE,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,CAAC;IAC7C,6EAA6E;IAC7E,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,WAAW,CAAC;IACxC;;;;;;;;;;;;;;;OAeG;IACH,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,UAAU,CAAC;CACjD"}
|
package/dist/types.d.ts
CHANGED
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
* @packageDocumentation
|
|
19
19
|
*/
|
|
20
20
|
import type React from "react";
|
|
21
|
-
import type { IDockviewPanelProps } from "dockview";
|
|
22
21
|
import type { ContextKeys } from "./context-keys";
|
|
23
22
|
import type { WorkspaceService } from "./workspace-service";
|
|
24
23
|
import type { EditorService } from "./editor-service";
|
|
@@ -49,24 +48,69 @@ export interface Disposable {
|
|
|
49
48
|
dispose(): void;
|
|
50
49
|
}
|
|
51
50
|
/**
|
|
52
|
-
* The
|
|
53
|
-
* drive the panel's own tab (title, close, focus)
|
|
54
|
-
*
|
|
51
|
+
* The panel API handed to a {@link DockPanelKind} component. Use these methods
|
|
52
|
+
* to drive the panel's own tab (title, close, focus) and update its stored
|
|
53
|
+
* parameters. The host provides the implementation; extensions never construct
|
|
54
|
+
* this object directly.
|
|
55
55
|
*
|
|
56
56
|
* @category Core Types
|
|
57
57
|
* @public
|
|
58
58
|
*/
|
|
59
|
-
export
|
|
59
|
+
export interface DockPanelApi {
|
|
60
|
+
/** Update the title shown in the panel's tab. */
|
|
61
|
+
setTitle(title: string): void;
|
|
62
|
+
/** Programmatically close this panel. */
|
|
63
|
+
close(): void;
|
|
64
|
+
/** Bring this panel to focus (make it the active panel in its group). */
|
|
65
|
+
setActive(): void;
|
|
66
|
+
/** `true` while this panel is the active one in its dock group. */
|
|
67
|
+
readonly isActive: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Subscribe to active-state transitions. The listener is called whenever
|
|
70
|
+
* the panel gains or loses active status, with an event carrying the new
|
|
71
|
+
* state. Returns a {@link Disposable} that cancels the subscription.
|
|
72
|
+
*/
|
|
73
|
+
onDidActiveChange(listener: (event: {
|
|
74
|
+
readonly isActive: boolean;
|
|
75
|
+
}) => void): Disposable;
|
|
76
|
+
/**
|
|
77
|
+
* `true` while this panel is visible — its tab is the selected one in its
|
|
78
|
+
* group. Distinct from {@link DockPanelApi.isActive | isActive}: with split
|
|
79
|
+
* groups, every group's selected tab is visible but only one panel in the
|
|
80
|
+
* whole dock is active.
|
|
81
|
+
*/
|
|
82
|
+
readonly isVisible: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Subscribe to visibility transitions (the panel's tab being selected or
|
|
85
|
+
* deselected in its group). Use to pause expensive work while hidden, or to
|
|
86
|
+
* re-measure on reveal (e.g. the terminal refits xterm when its tab becomes
|
|
87
|
+
* visible again). Returns a {@link Disposable} that cancels the subscription.
|
|
88
|
+
*/
|
|
89
|
+
onDidVisibilityChange(listener: (event: {
|
|
90
|
+
readonly isVisible: boolean;
|
|
91
|
+
}) => void): Disposable;
|
|
92
|
+
/**
|
|
93
|
+
* Shallow-merge `params` into this panel's stored parameters. Keys absent
|
|
94
|
+
* from `params` are left unchanged. Useful for keeping tabs-serializable
|
|
95
|
+
* state (e.g. the open URL in a web-viewer panel) consistent with the UI.
|
|
96
|
+
*/
|
|
97
|
+
updateParameters(params: object): void;
|
|
98
|
+
}
|
|
60
99
|
/**
|
|
61
100
|
* Props handed to a {@link DockPanelKind} component. Use this type to annotate
|
|
62
|
-
* your component instead of importing
|
|
63
|
-
* directly — the SDK
|
|
64
|
-
*
|
|
101
|
+
* your component instead of importing from the underlying dock framework
|
|
102
|
+
* directly — the SDK owns this surface so extensions remain insulated from
|
|
103
|
+
* host implementation details. The optional generic `T` narrows `params`.
|
|
65
104
|
*
|
|
66
105
|
* @category Core Types
|
|
67
106
|
* @public
|
|
68
107
|
*/
|
|
69
|
-
export
|
|
108
|
+
export interface DockPanelProps<T extends object = Record<string, unknown>> {
|
|
109
|
+
/** The panel API — drives the tab (title, close, focus, params). */
|
|
110
|
+
api: DockPanelApi;
|
|
111
|
+
/** Serializable parameters forwarded to the panel at open time. */
|
|
112
|
+
params: T;
|
|
113
|
+
}
|
|
70
114
|
/**
|
|
71
115
|
* Props passed to an {@link Editor} component. An editor renders the contents of
|
|
72
116
|
* one editor tab (a presenter for a file type — distinct from
|
|
@@ -183,8 +227,15 @@ export interface Command {
|
|
|
183
227
|
id: string;
|
|
184
228
|
/** Human-readable label (shown where the command surfaces in UI). */
|
|
185
229
|
label: string;
|
|
186
|
-
/**
|
|
187
|
-
|
|
230
|
+
/**
|
|
231
|
+
* The action. May accept arguments passed through from
|
|
232
|
+
* {@link ExtensionContext.executeCommand} and may return a value (sync or
|
|
233
|
+
* async); `executeCommand` resolves with whatever this returns.
|
|
234
|
+
*
|
|
235
|
+
* Zero-argument, void-returning commands are still valid — `() => void`
|
|
236
|
+
* satisfies this type, so existing registrations compile unchanged.
|
|
237
|
+
*/
|
|
238
|
+
run: (...args: unknown[]) => unknown | Promise<unknown>;
|
|
188
239
|
}
|
|
189
240
|
/**
|
|
190
241
|
* The top-level application menus a {@link MenuItemContribution} can target.
|
|
@@ -306,16 +357,19 @@ export interface SidePanel {
|
|
|
306
357
|
}
|
|
307
358
|
/**
|
|
308
359
|
* Registers a kind of dock panel (a tab that can live in the center dock area,
|
|
309
|
-
* e.g. the terminal). Workspaces open panels of registered kinds by id.
|
|
360
|
+
* e.g. the terminal). Workspaces open panels of registered kinds by id. The
|
|
361
|
+
* optional generic `T` is the shape of the params this kind's panels are
|
|
362
|
+
* opened with — annotate your component with `DockPanelProps<T>` and
|
|
363
|
+
* {@link ExtensionContext.registerDockPanelKind} infers it, no casts needed.
|
|
310
364
|
*
|
|
311
365
|
* @category Registration
|
|
312
366
|
* @public
|
|
313
367
|
*/
|
|
314
|
-
export interface DockPanelKind {
|
|
368
|
+
export interface DockPanelKind<T extends object = Record<string, unknown>> {
|
|
315
369
|
/** Unique id for this panel kind. */
|
|
316
370
|
id: string;
|
|
317
|
-
/** The React component
|
|
318
|
-
component: React.ComponentType<
|
|
371
|
+
/** The React component that renders this panel; receives {@link DockPanelProps}. */
|
|
372
|
+
component: React.ComponentType<DockPanelProps<T>>;
|
|
319
373
|
/**
|
|
320
374
|
* When set, this kind appears as an entry in the center dock's **+** add
|
|
321
375
|
* menu (the per-group header button). Omit to keep the kind internal.
|
|
@@ -442,20 +496,37 @@ export interface ExtensionContext {
|
|
|
442
496
|
registerKeybinding(binding: Keybinding): Disposable;
|
|
443
497
|
/** Register a {@link SidePanel} (a left/right column panel). */
|
|
444
498
|
registerSidePanel(panel: SidePanel): Disposable;
|
|
445
|
-
/**
|
|
446
|
-
|
|
499
|
+
/**
|
|
500
|
+
* Register a {@link DockPanelKind} (a center-dock tab kind). The params
|
|
501
|
+
* generic `T` is inferred from the component's {@link DockPanelProps}
|
|
502
|
+
* annotation, so kinds with typed params register without casts.
|
|
503
|
+
*/
|
|
504
|
+
registerDockPanelKind<T extends object = Record<string, unknown>>(kind: DockPanelKind<T>): Disposable;
|
|
447
505
|
/** Register a {@link StatusItem} (a status-bar widget). */
|
|
448
506
|
registerStatusItem(item: StatusItem): Disposable;
|
|
449
507
|
/** Register a {@link SettingsPage} (a page in the Settings dialog). */
|
|
450
508
|
registerSettingsPage(page: SettingsPage): Disposable;
|
|
451
|
-
/**
|
|
509
|
+
/**
|
|
510
|
+
* Register a {@link ThemePreset} (a selectable theme in the picker).
|
|
511
|
+
* @deprecated Use {@link ThemeService.registerPreset | ctx.theme.registerPreset()} instead.
|
|
512
|
+
* This method will be removed in a future release.
|
|
513
|
+
*/
|
|
452
514
|
registerThemePreset(preset: ThemePreset): Disposable;
|
|
453
515
|
/**
|
|
454
516
|
* Invoke a registered command by id — including commands contributed by
|
|
455
517
|
* other extensions. The minimal "operate" primitive; pairs with the typed
|
|
456
518
|
* services for read access.
|
|
519
|
+
*
|
|
520
|
+
* Optional positional `args` are forwarded to the command's
|
|
521
|
+
* {@link Command.run} function. The returned `Promise` resolves with the
|
|
522
|
+
* command's return value, or rejects if the command throws, is async and
|
|
523
|
+
* rejects, or the id is not registered. Sync commands dispatch synchronously
|
|
524
|
+
* before the promise settles, so callers that read state the command mutates
|
|
525
|
+
* immediately after `await executeCommand(…)` see the updated state.
|
|
526
|
+
*
|
|
527
|
+
* @typeParam T - Expected return type of the command (defaults to `unknown`).
|
|
457
528
|
*/
|
|
458
|
-
executeCommand(id: string):
|
|
529
|
+
executeCommand<T = unknown>(id: string, ...args: unknown[]): Promise<T>;
|
|
459
530
|
/**
|
|
460
531
|
* Consumer API for driving workspace state — create, rename, reorder,
|
|
461
532
|
* activate, soft close/reopen, and hard delete. Subscribe to a frozen
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAA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IAC7B;;;;;OAKG;IACH,QAAQ,CAAC,GAAG,EAAE,gBAAgB,GAAG,GAAG,GAAG,IAAI,CAAC;IAC5C,gEAAgE;IAChE,UAAU,CAAC,IAAI,IAAI,CAAC;CACrB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@silo-code/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "The public, types-first SDK for building Silo extensions — the only surface third-party extensions import.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Dave Weaver",
|
|
@@ -36,9 +36,7 @@
|
|
|
36
36
|
"react": "^19.1.0",
|
|
37
37
|
"react-dom": "^19.1.0"
|
|
38
38
|
},
|
|
39
|
-
"dependencies": {
|
|
40
|
-
"dockview": "~6.3.0"
|
|
41
|
-
},
|
|
39
|
+
"dependencies": {},
|
|
42
40
|
"devDependencies": {
|
|
43
41
|
"@types/react": "^19.1.8",
|
|
44
42
|
"@types/react-dom": "^19.1.0",
|
package/src/context-keys.ts
CHANGED
|
@@ -11,8 +11,23 @@
|
|
|
11
11
|
* @public
|
|
12
12
|
*/
|
|
13
13
|
export interface ContextKeys {
|
|
14
|
-
/**
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
/**
|
|
15
|
+
* The {@link Editor.id} of the presenter currently rendering the active dock
|
|
16
|
+
* panel (e.g. `"core.text-editor"`, `"silo.markdown-preview"`), or `null`
|
|
17
|
+
* when the active panel is not an editor. Identifies the *view type*, not the
|
|
18
|
+
* tab instance — see {@link ContextKeys.activeEditorId} for the tab record id.
|
|
19
|
+
*/
|
|
20
|
+
activeEditorViewId: string | null;
|
|
21
|
+
/**
|
|
22
|
+
* The `editorId` of the active editor tab record, or `null` when the active
|
|
23
|
+
* dock panel is not an editor tab. Identifies the *tab instance* — see
|
|
24
|
+
* {@link ContextKeys.activeEditorViewId} for the view-type (presenter) id.
|
|
25
|
+
*/
|
|
17
26
|
activeEditorId: string | null;
|
|
27
|
+
/**
|
|
28
|
+
* @deprecated Use {@link ContextKeys.activeEditorViewId} instead.
|
|
29
|
+
* Kept for one release so extensions compiled against the old SDK continue
|
|
30
|
+
* to receive the correct value at runtime without a silent break.
|
|
31
|
+
*/
|
|
32
|
+
activeViewerId: string | null;
|
|
18
33
|
}
|
package/src/domain-types.ts
CHANGED
|
@@ -104,6 +104,11 @@ export type SidePanelSlot = "left" | "right" | "left-bottom" | "right-bottom";
|
|
|
104
104
|
* A workspace — the unit Silo switches between, keeping its terminals, editors,
|
|
105
105
|
* and layout alive. Read via {@link WorkspaceService}.
|
|
106
106
|
*
|
|
107
|
+
* This is the public surface: it carries the fields an extension needs to read
|
|
108
|
+
* (name, folder, open tabs). Layout, scroll, and panel-state fields are
|
|
109
|
+
* host-internal (`WorkspaceInternal` in `@silo-code/extension-host`) and are
|
|
110
|
+
* intentionally absent here.
|
|
111
|
+
*
|
|
107
112
|
* @category Core Types
|
|
108
113
|
* @public
|
|
109
114
|
*/
|
|
@@ -115,41 +120,15 @@ export interface Workspace {
|
|
|
115
120
|
extraFolders?: string[];
|
|
116
121
|
createdAt: string;
|
|
117
122
|
lastOpenedAt: string;
|
|
118
|
-
terminals: TerminalRecord[];
|
|
119
|
-
/** Editor tabs — text editors and diffs alike (a diff is a record with `mode: "diff"`). */
|
|
120
|
-
editors: EditorRecord[];
|
|
121
|
-
dockLayout: unknown | null;
|
|
122
|
-
/** Scroll positions keyed by editor record ID: { top, left } in pixels. */
|
|
123
|
-
editorScrollPositions?: Record<string, { top: number; left: number }>;
|
|
124
|
-
/**
|
|
125
|
-
* Monaco view states keyed by editor record ID. Each value is the opaque
|
|
126
|
-
* JSON produced by `editor.saveViewState()` — captures cursor position,
|
|
127
|
-
* selection, scroll, and folded regions. Supersedes
|
|
128
|
-
* {@link Workspace.editorScrollPositions} for editors that support it;
|
|
129
|
-
* scroll-only data is kept as a fallback for older persisted workspaces.
|
|
130
|
-
*/
|
|
131
|
-
editorViewStates?: Record<string, unknown>;
|
|
132
123
|
/**
|
|
133
124
|
* ISO timestamp of when the workspace was soft-closed, or null/undefined
|
|
134
125
|
* if the workspace is open. Closed workspaces are hidden from the main
|
|
135
126
|
* list and surfaced in a "reopen" picker.
|
|
136
127
|
*/
|
|
137
128
|
closedAt?: string | null;
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
activeSidePanelTabs?: Record<string, string>;
|
|
142
|
-
sidePanelScrollPositions?: Record<string, number>;
|
|
143
|
-
/** Hidden side panels, keyed by panel id; only an explicit `false` (hidden)
|
|
144
|
-
* is stored, so an absent key means visible (the default). */
|
|
145
|
-
sidePanelVisibility?: Record<string, boolean>;
|
|
146
|
-
extensionState?: Record<string, Record<string, unknown>>;
|
|
147
|
-
/** Whether the left side column is collapsed. Per-workspace. */
|
|
148
|
-
leftPanelCollapsed?: boolean;
|
|
149
|
-
/** Whether the right side column is collapsed. Per-workspace. */
|
|
150
|
-
rightPanelCollapsed?: boolean;
|
|
151
|
-
/** ID of the current preview (temporary) editor, if any. */
|
|
152
|
-
previewEditorId?: string | null;
|
|
129
|
+
terminals: readonly TerminalRecord[];
|
|
130
|
+
/** Editor tabs — text editors and diffs alike (a diff is a record with `mode: "diff"`). */
|
|
131
|
+
editors: readonly EditorRecord[];
|
|
153
132
|
}
|
|
154
133
|
|
|
155
134
|
/**
|
package/src/extension-storage.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Disposable } from "./types";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Namespaced, persisted key/value storage handed to extensions. Two scopes are
|
|
3
5
|
* exposed on {@link ExtensionContext.storage} ({@link ExtensionStorageScopes}):
|
|
@@ -24,10 +26,13 @@ export interface ExtensionStorage {
|
|
|
24
26
|
/**
|
|
25
27
|
* Subscribe to changes in this namespace. Called when a value in this
|
|
26
28
|
* namespace changes, when the underlying app state finishes hydrating, and
|
|
27
|
-
* (for the workspace scope) when the active workspace changes.
|
|
28
|
-
*
|
|
29
|
+
* (for the workspace scope) when the active workspace changes.
|
|
30
|
+
*
|
|
31
|
+
* Returns a {@link Disposable} — call `.dispose()` to unsubscribe, or push
|
|
32
|
+
* it onto `ctx.subscriptions` for automatic teardown. Consistent with every
|
|
33
|
+
* other subscription in the SDK.
|
|
29
34
|
*/
|
|
30
|
-
subscribe(listener: () => void):
|
|
35
|
+
subscribe(listener: () => void): Disposable;
|
|
31
36
|
}
|
|
32
37
|
|
|
33
38
|
/**
|
package/src/file-service.ts
CHANGED
|
@@ -24,6 +24,16 @@ export interface FileMeta {
|
|
|
24
24
|
modifiedMs: number;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
/**
|
|
28
|
+
* The normalized kind of a filesystem change, as delivered in
|
|
29
|
+
* {@link FileChangeEvent.kind}. Backend-specific event kinds that don't map to
|
|
30
|
+
* one of the three meaningful values are surfaced as `"other"`.
|
|
31
|
+
*
|
|
32
|
+
* @category Core Types
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
35
|
+
export type FileChangeKind = "create" | "modify" | "remove" | "other";
|
|
36
|
+
|
|
27
37
|
/**
|
|
28
38
|
* A filesystem change event delivered to a {@link FileService.watch} listener,
|
|
29
39
|
* for changes under that watch's path.
|
|
@@ -34,8 +44,12 @@ export interface FileMeta {
|
|
|
34
44
|
export interface FileChangeEvent {
|
|
35
45
|
/** The paths that changed in this event. */
|
|
36
46
|
paths: string[];
|
|
37
|
-
/**
|
|
38
|
-
|
|
47
|
+
/**
|
|
48
|
+
* Normalized change kind. The host maps the backend's vocabulary to this
|
|
49
|
+
* closed union; backend-specific kinds that don't match arrive as `"other"`.
|
|
50
|
+
* Always compare against the union values — never against raw backend strings.
|
|
51
|
+
*/
|
|
52
|
+
kind: FileChangeKind;
|
|
39
53
|
}
|
|
40
54
|
|
|
41
55
|
/**
|
package/src/index.ts
CHANGED
|
@@ -94,7 +94,12 @@ export type {
|
|
|
94
94
|
TerminalTabDecorationProvider,
|
|
95
95
|
OscEvent,
|
|
96
96
|
} from "./terminal-service";
|
|
97
|
-
export type {
|
|
97
|
+
export type {
|
|
98
|
+
FileService,
|
|
99
|
+
FileMeta,
|
|
100
|
+
FileChangeKind,
|
|
101
|
+
FileChangeEvent,
|
|
102
|
+
} from "./file-service";
|
|
98
103
|
// Cross-file content search exposed on the ExtensionContext as `ctx.search`.
|
|
99
104
|
export type {
|
|
100
105
|
SearchService,
|
|
@@ -157,6 +162,7 @@ export type {
|
|
|
157
162
|
} from "./ui-service";
|
|
158
163
|
|
|
159
164
|
// Server-side HTTP client — bypasses CORS, readable response headers.
|
|
165
|
+
export { NetworkError } from "./network-service";
|
|
160
166
|
export type {
|
|
161
167
|
NetworkService,
|
|
162
168
|
NetworkRequestOptions,
|
package/src/layout-service.ts
CHANGED
|
@@ -60,21 +60,23 @@ export interface LayoutService {
|
|
|
60
60
|
* web-viewer tab). No-op when the center dock has no active workspace.
|
|
61
61
|
*
|
|
62
62
|
* @param kindId - The {@link DockPanelKind.id} to instantiate.
|
|
63
|
-
* @param params - Arbitrary params forwarded to the panel
|
|
64
|
-
*
|
|
65
|
-
*
|
|
63
|
+
* @param params - Arbitrary params forwarded to the panel component.
|
|
64
|
+
* Serialized into `ws.dockLayout` so state survives workspace
|
|
65
|
+
* close/reopen.
|
|
66
|
+
* @param options - `singleton: true` opens at most one instance at a time:
|
|
67
|
+
* if a panel with `kindId` already exists, it is focused instead of
|
|
68
|
+
* creating a new one. The panel's id equals `kindId` (not UUID-based) when
|
|
69
|
+
* singleton is set.
|
|
66
70
|
*/
|
|
67
|
-
openPanel(
|
|
71
|
+
openPanel(
|
|
72
|
+
kindId: string,
|
|
73
|
+
params?: Record<string, unknown>,
|
|
74
|
+
options?: { singleton?: boolean },
|
|
75
|
+
): void;
|
|
68
76
|
/**
|
|
69
|
-
* Open a **singleton** dock panel
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
* at most one can exist). Use for utility panels like Output that don't
|
|
73
|
-
* benefit from multiple instances.
|
|
74
|
-
*
|
|
75
|
-
* @param kindId - The {@link DockPanelKind.id} to open or focus.
|
|
76
|
-
* @param params - Forwarded to the panel when creating; ignored when
|
|
77
|
-
* focusing an existing instance.
|
|
77
|
+
* Open a **singleton** dock panel.
|
|
78
|
+
* @deprecated Use `openPanel(kindId, params, { singleton: true })` instead.
|
|
79
|
+
* This method will be removed in a future release.
|
|
78
80
|
*/
|
|
79
81
|
openSingletonPanel(kindId: string, params?: Record<string, unknown>): void;
|
|
80
82
|
}
|
package/src/network-service.ts
CHANGED
|
@@ -1,3 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Thrown by {@link NetworkService.fetch} and {@link NetworkService.fetchHeaders}
|
|
3
|
+
* when a request fails (network error, DNS failure, TLS error, timeout, etc.).
|
|
4
|
+
*
|
|
5
|
+
* ```ts
|
|
6
|
+
* try {
|
|
7
|
+
* const res = await ctx.net.fetch("https://api.example.com/data");
|
|
8
|
+
* } catch (err) {
|
|
9
|
+
* if (err instanceof NetworkError) {
|
|
10
|
+
* console.error(`Request to ${err.url} failed: ${err.message}`);
|
|
11
|
+
* }
|
|
12
|
+
* }
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* @category Core Types
|
|
16
|
+
* @public
|
|
17
|
+
*/
|
|
18
|
+
export class NetworkError extends Error {
|
|
19
|
+
/** The URL that was requested when the error occurred. */
|
|
20
|
+
readonly url: string;
|
|
21
|
+
|
|
22
|
+
constructor(url: string, message: string) {
|
|
23
|
+
super(message);
|
|
24
|
+
this.name = "NetworkError";
|
|
25
|
+
this.url = url;
|
|
26
|
+
// Restore the prototype chain so `instanceof` works across the down-leveled
|
|
27
|
+
// class output the SDK ships (and across the host↔extension boundary, where
|
|
28
|
+
// there's a single shared SDK instance).
|
|
29
|
+
Object.setPrototypeOf(this, NetworkError.prototype);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
1
33
|
/**
|
|
2
34
|
* Options for {@link NetworkService.fetch} and {@link NetworkService.fetchHeaders}.
|
|
3
35
|
*
|
|
@@ -62,7 +94,7 @@ export interface NetworkService {
|
|
|
62
94
|
*
|
|
63
95
|
* @param url - The URL to fetch.
|
|
64
96
|
* @param options - Method, headers, body, redirect and timeout controls.
|
|
65
|
-
* @throws
|
|
97
|
+
* @throws {@link NetworkError} if the request fails (network error, DNS
|
|
66
98
|
* failure, TLS error, etc.).
|
|
67
99
|
*
|
|
68
100
|
* @example
|
|
@@ -83,7 +115,7 @@ export interface NetworkService {
|
|
|
83
115
|
* @param url - The URL to probe.
|
|
84
116
|
* @param options - Redirect and timeout controls (`method` and `body` are
|
|
85
117
|
* ignored — this is always a HEAD request).
|
|
86
|
-
* @throws
|
|
118
|
+
* @throws {@link NetworkError} if the request fails.
|
|
87
119
|
*
|
|
88
120
|
* @example
|
|
89
121
|
* ```ts
|
package/src/terminal-service.ts
CHANGED
|
@@ -168,4 +168,35 @@ export interface TerminalService {
|
|
|
168
168
|
terminalId: string,
|
|
169
169
|
handler: (event: OscEvent) => void,
|
|
170
170
|
): Disposable;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* The record id of the terminal tab that is currently active in the active
|
|
174
|
+
* workspace's center dock, or `null` when an editor tab (or nothing) is
|
|
175
|
+
* active. "Active" is the dock's single active panel — the tab the user is
|
|
176
|
+
* looking at and typing into — so a terminal merely visible in a non-active
|
|
177
|
+
* split does not count.
|
|
178
|
+
*/
|
|
179
|
+
getActive(): string | null;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Subscribe to active-terminal changes. The listener receives the terminal
|
|
183
|
+
* record id whenever a terminal tab becomes the active center-dock panel,
|
|
184
|
+
* and `null` when activation moves elsewhere (an editor tab, or no panel —
|
|
185
|
+
* including transiently during a workspace switch, before the incoming
|
|
186
|
+
* workspace's active tab is published).
|
|
187
|
+
*
|
|
188
|
+
* Fires on tab activation, group activation, and workspace switches.
|
|
189
|
+
* Returns a {@link Disposable} that cancels the subscription.
|
|
190
|
+
*
|
|
191
|
+
* @example
|
|
192
|
+
* ```ts
|
|
193
|
+
* // Clear a "needs attention" marker once the user views the terminal.
|
|
194
|
+
* ctx.subscriptions.push(
|
|
195
|
+
* ctx.terminals.subscribeActive((terminalId) => {
|
|
196
|
+
* if (terminalId) attention.delete(terminalId);
|
|
197
|
+
* }),
|
|
198
|
+
* );
|
|
199
|
+
* ```
|
|
200
|
+
*/
|
|
201
|
+
subscribeActive(listener: (terminalId: string | null) => void): Disposable;
|
|
171
202
|
}
|
package/src/theme-service.ts
CHANGED
|
@@ -15,11 +15,11 @@ export type {
|
|
|
15
15
|
} from "./domain-types";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* A selectable theme contributed via
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
18
|
+
* A selectable theme contributed via {@link ThemeService.registerPreset}.
|
|
19
|
+
* Built-in presets (Tokyo Night, Solarized Light, Gruvbox Dark, …) are
|
|
20
|
+
* registered by the `theme-presets` extension; core ships only Dark and Light.
|
|
21
|
+
* A preset's {@link ThemePreset.vars} are injected as CSS custom properties
|
|
22
|
+
* when it is the active theme.
|
|
23
23
|
*
|
|
24
24
|
* @category Registration
|
|
25
25
|
* @public
|
|
@@ -74,8 +74,7 @@ export interface ThemeState {
|
|
|
74
74
|
* Read via {@link ThemeService.getState | getState} /
|
|
75
75
|
* {@link ThemeService.subscribe | subscribe} (e.g. with `useSyncExternalStore`);
|
|
76
76
|
* drive via {@link ThemeService.setActive | setActive} and the custom-theme
|
|
77
|
-
* methods.
|
|
78
|
-
* {@link ExtensionContext.registerThemePreset}.
|
|
77
|
+
* methods. Contribute a new preset via {@link ThemeService.registerPreset}.
|
|
79
78
|
*
|
|
80
79
|
* @category Consumer Services
|
|
81
80
|
* @public
|
|
@@ -99,4 +98,21 @@ export interface ThemeService {
|
|
|
99
98
|
exportTheme(theme: CustomTheme): ThemeExport;
|
|
100
99
|
/** Validate/parse imported JSON into a custom theme (assigns a fresh id). */
|
|
101
100
|
importTheme(data: unknown): CustomTheme;
|
|
101
|
+
/**
|
|
102
|
+
* Register a {@link ThemePreset} (a selectable theme in the picker). The
|
|
103
|
+
* preset appears immediately and is removed when the returned
|
|
104
|
+
* {@link Disposable} is disposed (typically when the extension deactivates).
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* ctx.theme.registerPreset({
|
|
109
|
+
* id: "my-theme",
|
|
110
|
+
* name: "My Theme",
|
|
111
|
+
* base: "dark",
|
|
112
|
+
* colorScheme: "dark",
|
|
113
|
+
* vars: { "--silo-color-bg": "#1a1a2e" },
|
|
114
|
+
* });
|
|
115
|
+
* ```
|
|
116
|
+
*/
|
|
117
|
+
registerPreset(preset: ThemePreset): Disposable;
|
|
102
118
|
}
|
package/src/types.ts
CHANGED
|
@@ -18,7 +18,6 @@
|
|
|
18
18
|
* @packageDocumentation
|
|
19
19
|
*/
|
|
20
20
|
import type React from "react";
|
|
21
|
-
import type { IDockviewPanelProps } from "dockview";
|
|
22
21
|
import type { ContextKeys } from "./context-keys";
|
|
23
22
|
import type { WorkspaceService } from "./workspace-service";
|
|
24
23
|
import type { EditorService } from "./editor-service";
|
|
@@ -54,26 +53,70 @@ export interface Disposable {
|
|
|
54
53
|
}
|
|
55
54
|
|
|
56
55
|
/**
|
|
57
|
-
* The
|
|
58
|
-
* drive the panel's own tab (title, close, focus)
|
|
59
|
-
*
|
|
56
|
+
* The panel API handed to a {@link DockPanelKind} component. Use these methods
|
|
57
|
+
* to drive the panel's own tab (title, close, focus) and update its stored
|
|
58
|
+
* parameters. The host provides the implementation; extensions never construct
|
|
59
|
+
* this object directly.
|
|
60
60
|
*
|
|
61
61
|
* @category Core Types
|
|
62
62
|
* @public
|
|
63
63
|
*/
|
|
64
|
-
export
|
|
64
|
+
export interface DockPanelApi {
|
|
65
|
+
/** Update the title shown in the panel's tab. */
|
|
66
|
+
setTitle(title: string): void;
|
|
67
|
+
/** Programmatically close this panel. */
|
|
68
|
+
close(): void;
|
|
69
|
+
/** Bring this panel to focus (make it the active panel in its group). */
|
|
70
|
+
setActive(): void;
|
|
71
|
+
/** `true` while this panel is the active one in its dock group. */
|
|
72
|
+
readonly isActive: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Subscribe to active-state transitions. The listener is called whenever
|
|
75
|
+
* the panel gains or loses active status, with an event carrying the new
|
|
76
|
+
* state. Returns a {@link Disposable} that cancels the subscription.
|
|
77
|
+
*/
|
|
78
|
+
onDidActiveChange(
|
|
79
|
+
listener: (event: { readonly isActive: boolean }) => void,
|
|
80
|
+
): Disposable;
|
|
81
|
+
/**
|
|
82
|
+
* `true` while this panel is visible — its tab is the selected one in its
|
|
83
|
+
* group. Distinct from {@link DockPanelApi.isActive | isActive}: with split
|
|
84
|
+
* groups, every group's selected tab is visible but only one panel in the
|
|
85
|
+
* whole dock is active.
|
|
86
|
+
*/
|
|
87
|
+
readonly isVisible: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Subscribe to visibility transitions (the panel's tab being selected or
|
|
90
|
+
* deselected in its group). Use to pause expensive work while hidden, or to
|
|
91
|
+
* re-measure on reveal (e.g. the terminal refits xterm when its tab becomes
|
|
92
|
+
* visible again). Returns a {@link Disposable} that cancels the subscription.
|
|
93
|
+
*/
|
|
94
|
+
onDidVisibilityChange(
|
|
95
|
+
listener: (event: { readonly isVisible: boolean }) => void,
|
|
96
|
+
): Disposable;
|
|
97
|
+
/**
|
|
98
|
+
* Shallow-merge `params` into this panel's stored parameters. Keys absent
|
|
99
|
+
* from `params` are left unchanged. Useful for keeping tabs-serializable
|
|
100
|
+
* state (e.g. the open URL in a web-viewer panel) consistent with the UI.
|
|
101
|
+
*/
|
|
102
|
+
updateParameters(params: object): void;
|
|
103
|
+
}
|
|
65
104
|
|
|
66
105
|
/**
|
|
67
106
|
* Props handed to a {@link DockPanelKind} component. Use this type to annotate
|
|
68
|
-
* your component instead of importing
|
|
69
|
-
* directly — the SDK
|
|
70
|
-
*
|
|
107
|
+
* your component instead of importing from the underlying dock framework
|
|
108
|
+
* directly — the SDK owns this surface so extensions remain insulated from
|
|
109
|
+
* host implementation details. The optional generic `T` narrows `params`.
|
|
71
110
|
*
|
|
72
111
|
* @category Core Types
|
|
73
112
|
* @public
|
|
74
113
|
*/
|
|
75
|
-
export
|
|
76
|
-
|
|
114
|
+
export interface DockPanelProps<T extends object = Record<string, unknown>> {
|
|
115
|
+
/** The panel API — drives the tab (title, close, focus, params). */
|
|
116
|
+
api: DockPanelApi;
|
|
117
|
+
/** Serializable parameters forwarded to the panel at open time. */
|
|
118
|
+
params: T;
|
|
119
|
+
}
|
|
77
120
|
|
|
78
121
|
/**
|
|
79
122
|
* Props passed to an {@link Editor} component. An editor renders the contents of
|
|
@@ -196,8 +239,15 @@ export interface Command {
|
|
|
196
239
|
id: string;
|
|
197
240
|
/** Human-readable label (shown where the command surfaces in UI). */
|
|
198
241
|
label: string;
|
|
199
|
-
/**
|
|
200
|
-
|
|
242
|
+
/**
|
|
243
|
+
* The action. May accept arguments passed through from
|
|
244
|
+
* {@link ExtensionContext.executeCommand} and may return a value (sync or
|
|
245
|
+
* async); `executeCommand` resolves with whatever this returns.
|
|
246
|
+
*
|
|
247
|
+
* Zero-argument, void-returning commands are still valid — `() => void`
|
|
248
|
+
* satisfies this type, so existing registrations compile unchanged.
|
|
249
|
+
*/
|
|
250
|
+
run: (...args: unknown[]) => unknown | Promise<unknown>;
|
|
201
251
|
}
|
|
202
252
|
|
|
203
253
|
/**
|
|
@@ -325,16 +375,19 @@ export interface SidePanel {
|
|
|
325
375
|
|
|
326
376
|
/**
|
|
327
377
|
* Registers a kind of dock panel (a tab that can live in the center dock area,
|
|
328
|
-
* e.g. the terminal). Workspaces open panels of registered kinds by id.
|
|
378
|
+
* e.g. the terminal). Workspaces open panels of registered kinds by id. The
|
|
379
|
+
* optional generic `T` is the shape of the params this kind's panels are
|
|
380
|
+
* opened with — annotate your component with `DockPanelProps<T>` and
|
|
381
|
+
* {@link ExtensionContext.registerDockPanelKind} infers it, no casts needed.
|
|
329
382
|
*
|
|
330
383
|
* @category Registration
|
|
331
384
|
* @public
|
|
332
385
|
*/
|
|
333
|
-
export interface DockPanelKind {
|
|
386
|
+
export interface DockPanelKind<T extends object = Record<string, unknown>> {
|
|
334
387
|
/** Unique id for this panel kind. */
|
|
335
388
|
id: string;
|
|
336
|
-
/** The React component
|
|
337
|
-
component: React.ComponentType<
|
|
389
|
+
/** The React component that renders this panel; receives {@link DockPanelProps}. */
|
|
390
|
+
component: React.ComponentType<DockPanelProps<T>>;
|
|
338
391
|
/**
|
|
339
392
|
* When set, this kind appears as an entry in the center dock's **+** add
|
|
340
393
|
* menu (the per-group header button). Omit to keep the kind internal.
|
|
@@ -464,20 +517,39 @@ export interface ExtensionContext {
|
|
|
464
517
|
registerKeybinding(binding: Keybinding): Disposable;
|
|
465
518
|
/** Register a {@link SidePanel} (a left/right column panel). */
|
|
466
519
|
registerSidePanel(panel: SidePanel): Disposable;
|
|
467
|
-
/**
|
|
468
|
-
|
|
520
|
+
/**
|
|
521
|
+
* Register a {@link DockPanelKind} (a center-dock tab kind). The params
|
|
522
|
+
* generic `T` is inferred from the component's {@link DockPanelProps}
|
|
523
|
+
* annotation, so kinds with typed params register without casts.
|
|
524
|
+
*/
|
|
525
|
+
registerDockPanelKind<T extends object = Record<string, unknown>>(
|
|
526
|
+
kind: DockPanelKind<T>,
|
|
527
|
+
): Disposable;
|
|
469
528
|
/** Register a {@link StatusItem} (a status-bar widget). */
|
|
470
529
|
registerStatusItem(item: StatusItem): Disposable;
|
|
471
530
|
/** Register a {@link SettingsPage} (a page in the Settings dialog). */
|
|
472
531
|
registerSettingsPage(page: SettingsPage): Disposable;
|
|
473
|
-
/**
|
|
532
|
+
/**
|
|
533
|
+
* Register a {@link ThemePreset} (a selectable theme in the picker).
|
|
534
|
+
* @deprecated Use {@link ThemeService.registerPreset | ctx.theme.registerPreset()} instead.
|
|
535
|
+
* This method will be removed in a future release.
|
|
536
|
+
*/
|
|
474
537
|
registerThemePreset(preset: ThemePreset): Disposable;
|
|
475
538
|
/**
|
|
476
539
|
* Invoke a registered command by id — including commands contributed by
|
|
477
540
|
* other extensions. The minimal "operate" primitive; pairs with the typed
|
|
478
541
|
* services for read access.
|
|
542
|
+
*
|
|
543
|
+
* Optional positional `args` are forwarded to the command's
|
|
544
|
+
* {@link Command.run} function. The returned `Promise` resolves with the
|
|
545
|
+
* command's return value, or rejects if the command throws, is async and
|
|
546
|
+
* rejects, or the id is not registered. Sync commands dispatch synchronously
|
|
547
|
+
* before the promise settles, so callers that read state the command mutates
|
|
548
|
+
* immediately after `await executeCommand(…)` see the updated state.
|
|
549
|
+
*
|
|
550
|
+
* @typeParam T - Expected return type of the command (defaults to `unknown`).
|
|
479
551
|
*/
|
|
480
|
-
executeCommand(id: string):
|
|
552
|
+
executeCommand<T = unknown>(id: string, ...args: unknown[]): Promise<T>;
|
|
481
553
|
/**
|
|
482
554
|
* Consumer API for driving workspace state — create, rename, reorder,
|
|
483
555
|
* activate, soft close/reopen, and hard delete. Subscribe to a frozen
|