@silo-code/sdk 0.19.1 → 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 +3 -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 +16 -4
- 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/output-service.d.ts +42 -0
- package/dist/output-service.d.ts.map +1 -0
- package/dist/output-service.js +10 -0
- package/dist/output-service.js.map +1 -0
- 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 +124 -21
- 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 +12 -1
- package/src/layout-service.ts +18 -4
- package/src/network-service.ts +34 -2
- package/src/output-service.ts +43 -0
- package/src/terminal-service.ts +31 -0
- package/src/theme-service.ts +23 -7
- package/src/types.ts +126 -22
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";
|
|
@@ -33,6 +32,7 @@ import type { DndService } from "./dnd-service";
|
|
|
33
32
|
import type { UiService } from "./ui-service";
|
|
34
33
|
import type { NetworkService } from "./network-service";
|
|
35
34
|
import type { SystemService } from "./system-service";
|
|
35
|
+
import type { LogService } from "./output-service";
|
|
36
36
|
import type { ExtensionStorage, ExtensionStorageScopes } from "./extension-storage";
|
|
37
37
|
/**
|
|
38
38
|
* The teardown handle returned by every `register*` call on
|
|
@@ -48,24 +48,69 @@ export interface Disposable {
|
|
|
48
48
|
dispose(): void;
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
51
|
-
* The
|
|
52
|
-
* drive the panel's own tab (title, close, focus)
|
|
53
|
-
*
|
|
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.
|
|
54
55
|
*
|
|
55
56
|
* @category Core Types
|
|
56
57
|
* @public
|
|
57
58
|
*/
|
|
58
|
-
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
|
+
}
|
|
59
99
|
/**
|
|
60
100
|
* Props handed to a {@link DockPanelKind} component. Use this type to annotate
|
|
61
|
-
* your component instead of importing
|
|
62
|
-
* directly — the SDK
|
|
63
|
-
*
|
|
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`.
|
|
64
104
|
*
|
|
65
105
|
* @category Core Types
|
|
66
106
|
* @public
|
|
67
107
|
*/
|
|
68
|
-
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
|
+
}
|
|
69
114
|
/**
|
|
70
115
|
* Props passed to an {@link Editor} component. An editor renders the contents of
|
|
71
116
|
* one editor tab (a presenter for a file type — distinct from
|
|
@@ -182,8 +227,15 @@ export interface Command {
|
|
|
182
227
|
id: string;
|
|
183
228
|
/** Human-readable label (shown where the command surfaces in UI). */
|
|
184
229
|
label: string;
|
|
185
|
-
/**
|
|
186
|
-
|
|
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>;
|
|
187
239
|
}
|
|
188
240
|
/**
|
|
189
241
|
* The top-level application menus a {@link MenuItemContribution} can target.
|
|
@@ -218,7 +270,13 @@ export interface MenuItemContribution {
|
|
|
218
270
|
* Defaults to "9_default" so unspecified items land at the bottom.
|
|
219
271
|
*/
|
|
220
272
|
group?: string;
|
|
221
|
-
/**
|
|
273
|
+
/**
|
|
274
|
+
* Sort order within a group. Defaults to 0.
|
|
275
|
+
*
|
|
276
|
+
* **Convention:** built-in (core) items use negative values; extensions
|
|
277
|
+
* should use `0` or greater so they appear after built-in items within
|
|
278
|
+
* the same group by default.
|
|
279
|
+
*/
|
|
222
280
|
order?: number;
|
|
223
281
|
/**
|
|
224
282
|
* Optional predicate against current context keys. Items whose `when`
|
|
@@ -299,16 +357,19 @@ export interface SidePanel {
|
|
|
299
357
|
}
|
|
300
358
|
/**
|
|
301
359
|
* Registers a kind of dock panel (a tab that can live in the center dock area,
|
|
302
|
-
* 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.
|
|
303
364
|
*
|
|
304
365
|
* @category Registration
|
|
305
366
|
* @public
|
|
306
367
|
*/
|
|
307
|
-
export interface DockPanelKind {
|
|
368
|
+
export interface DockPanelKind<T extends object = Record<string, unknown>> {
|
|
308
369
|
/** Unique id for this panel kind. */
|
|
309
370
|
id: string;
|
|
310
|
-
/** The React component
|
|
311
|
-
component: React.ComponentType<
|
|
371
|
+
/** The React component that renders this panel; receives {@link DockPanelProps}. */
|
|
372
|
+
component: React.ComponentType<DockPanelProps<T>>;
|
|
312
373
|
/**
|
|
313
374
|
* When set, this kind appears as an entry in the center dock's **+** add
|
|
314
375
|
* menu (the per-group header button). Omit to keep the kind internal.
|
|
@@ -344,7 +405,19 @@ export interface StatusItem {
|
|
|
344
405
|
id: string;
|
|
345
406
|
/** Which end of the status bar this item sits at. */
|
|
346
407
|
alignment: "left" | "right";
|
|
347
|
-
/**
|
|
408
|
+
/**
|
|
409
|
+
* Sort order within its alignment group. Defaults to 0.
|
|
410
|
+
*
|
|
411
|
+
* The sort direction mirrors the alignment so that **negative values always
|
|
412
|
+
* anchor an item toward the nearest edge**:
|
|
413
|
+
* - **Left items** sort ascending — lower priority = closer to the left edge.
|
|
414
|
+
* - **Right items** sort descending — lower priority = closer to the right edge.
|
|
415
|
+
*
|
|
416
|
+
* **Convention:** built-in (core) items use negative values so they are
|
|
417
|
+
* anchored to their respective edges. Extensions should use `0` or greater,
|
|
418
|
+
* which places them between the two built-in zones by default. An extension
|
|
419
|
+
* may still choose a negative value intentionally to interleave with built-ins.
|
|
420
|
+
*/
|
|
348
421
|
priority?: number;
|
|
349
422
|
/**
|
|
350
423
|
* Tooltip shown on hover over the entire status item. The host renders a
|
|
@@ -423,20 +496,37 @@ export interface ExtensionContext {
|
|
|
423
496
|
registerKeybinding(binding: Keybinding): Disposable;
|
|
424
497
|
/** Register a {@link SidePanel} (a left/right column panel). */
|
|
425
498
|
registerSidePanel(panel: SidePanel): Disposable;
|
|
426
|
-
/**
|
|
427
|
-
|
|
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;
|
|
428
505
|
/** Register a {@link StatusItem} (a status-bar widget). */
|
|
429
506
|
registerStatusItem(item: StatusItem): Disposable;
|
|
430
507
|
/** Register a {@link SettingsPage} (a page in the Settings dialog). */
|
|
431
508
|
registerSettingsPage(page: SettingsPage): Disposable;
|
|
432
|
-
/**
|
|
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
|
+
*/
|
|
433
514
|
registerThemePreset(preset: ThemePreset): Disposable;
|
|
434
515
|
/**
|
|
435
516
|
* Invoke a registered command by id — including commands contributed by
|
|
436
517
|
* other extensions. The minimal "operate" primitive; pairs with the typed
|
|
437
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`).
|
|
438
528
|
*/
|
|
439
|
-
executeCommand(id: string):
|
|
529
|
+
executeCommand<T = unknown>(id: string, ...args: unknown[]): Promise<T>;
|
|
440
530
|
/**
|
|
441
531
|
* Consumer API for driving workspace state — create, rename, reorder,
|
|
442
532
|
* activate, soft close/reopen, and hard delete. Subscribe to a frozen
|
|
@@ -527,6 +617,19 @@ export interface ExtensionContext {
|
|
|
527
617
|
* See {@link SystemService} for the full API.
|
|
528
618
|
*/
|
|
529
619
|
readonly system: SystemService;
|
|
620
|
+
/**
|
|
621
|
+
* Write-only structured logger scoped to this extension. Entries appear in
|
|
622
|
+
* the **Output** panel under the extension's display name. A channel is
|
|
623
|
+
* created automatically at activation and removed at deactivation — no setup
|
|
624
|
+
* required.
|
|
625
|
+
*
|
|
626
|
+
* ```ts
|
|
627
|
+
* ctx.log.info("Extension activated");
|
|
628
|
+
* ctx.log.warn("Unexpected state", { detail: 42 });
|
|
629
|
+
* ctx.log.show(); // open the Output panel, select this extension's channel
|
|
630
|
+
* ```
|
|
631
|
+
*/
|
|
632
|
+
readonly log: LogService;
|
|
530
633
|
/**
|
|
531
634
|
* Resolve a handle to another extension in order to consume the API it
|
|
532
635
|
* published (the value its {@link Extension.activate} returned). This is how
|
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,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACtD,OAAO,KAA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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,
|
|
@@ -166,6 +172,11 @@ export type {
|
|
|
166
172
|
// Static host-platform metadata: OS, CPU arch, and Silo version.
|
|
167
173
|
export type { SystemService, SystemInfo } from "./system-service";
|
|
168
174
|
|
|
175
|
+
// Structured output logging — the write-only channel extensions receive as
|
|
176
|
+
// `ctx.log`. LogLevel is also used by the Output panel's built-in channels
|
|
177
|
+
// (e.g. `silo:notifications`).
|
|
178
|
+
export type { LogService, LogLevel } from "./output-service";
|
|
179
|
+
|
|
169
180
|
// Context keys referenced by `when` predicates on menu items / keybindings.
|
|
170
181
|
export type { ContextKeys } from "./context-keys";
|
|
171
182
|
|
package/src/layout-service.ts
CHANGED
|
@@ -60,9 +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;
|
|
76
|
+
/**
|
|
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.
|
|
80
|
+
*/
|
|
81
|
+
openSingletonPanel(kindId: string, params?: Record<string, unknown>): void;
|
|
68
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
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output channel logging — the write-only structured logger extensions receive
|
|
3
|
+
* as {@link ExtensionContext.log}. Each extension gets one channel
|
|
4
|
+
* auto-created at activation and auto-removed at deactivation; no setup is
|
|
5
|
+
* required from the extension author.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Log severity levels, ordered debug < info < warn < error.
|
|
12
|
+
*
|
|
13
|
+
* @category Consumer Services
|
|
14
|
+
* @public
|
|
15
|
+
*/
|
|
16
|
+
export type LogLevel = "debug" | "info" | "warn" | "error";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Write-only structured logger automatically scoped to the calling extension.
|
|
20
|
+
* A channel is created for the extension at activation time and removed when
|
|
21
|
+
* the extension deactivates — no setup needed; just call `ctx.log.info("...")`.
|
|
22
|
+
*
|
|
23
|
+
* All entries appear in the **Output** panel (`core.openOutput`) under the
|
|
24
|
+
* extension's display name. Use {@link LogService.show} to focus the panel and
|
|
25
|
+
* select this extension's channel.
|
|
26
|
+
*
|
|
27
|
+
* @category Consumer Services
|
|
28
|
+
* @public
|
|
29
|
+
*/
|
|
30
|
+
export interface LogService {
|
|
31
|
+
/** Append a debug-level entry. Use for verbose diagnostic output. */
|
|
32
|
+
debug(message: string, data?: unknown): void;
|
|
33
|
+
/** Append an info-level entry. The default level for routine progress. */
|
|
34
|
+
info(message: string, data?: unknown): void;
|
|
35
|
+
/** Append a warn-level entry. Something unexpected but recoverable. */
|
|
36
|
+
warn(message: string, data?: unknown): void;
|
|
37
|
+
/** Append an error-level entry. A failure the user should know about. */
|
|
38
|
+
error(message: string, data?: unknown): void;
|
|
39
|
+
/** Open (or focus) the Output panel and select this extension's channel. */
|
|
40
|
+
show(): void;
|
|
41
|
+
/** Clear this extension's output channel entries. */
|
|
42
|
+
clear(): void;
|
|
43
|
+
}
|
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
|
}
|