@silo-code/sdk 0.20.0 → 0.22.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.
Files changed (62) hide show
  1. package/dist/context-keys.d.ts +18 -3
  2. package/dist/context-keys.d.ts.map +1 -1
  3. package/dist/domain-types.d.ts +8 -32
  4. package/dist/domain-types.d.ts.map +1 -1
  5. package/dist/editor-service.d.ts +135 -3
  6. package/dist/editor-service.d.ts.map +1 -1
  7. package/dist/event.d.ts +28 -0
  8. package/dist/event.d.ts.map +1 -0
  9. package/dist/event.js +2 -0
  10. package/dist/event.js.map +1 -0
  11. package/dist/extension-storage.d.ts +7 -3
  12. package/dist/extension-storage.d.ts.map +1 -1
  13. package/dist/file-service.d.ts +48 -4
  14. package/dist/file-service.d.ts.map +1 -1
  15. package/dist/index.d.ts +17 -8
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +17 -5
  18. package/dist/index.js.map +1 -1
  19. package/dist/layout-service.d.ts +13 -13
  20. package/dist/layout-service.d.ts.map +1 -1
  21. package/dist/network-service.d.ts +70 -4
  22. package/dist/network-service.d.ts.map +1 -1
  23. package/dist/network-service.js +35 -1
  24. package/dist/network-service.js.map +1 -1
  25. package/dist/path.d.ts +62 -0
  26. package/dist/path.d.ts.map +1 -0
  27. package/dist/path.js +150 -0
  28. package/dist/path.js.map +1 -0
  29. package/dist/process-service.d.ts +24 -4
  30. package/dist/process-service.d.ts.map +1 -1
  31. package/dist/processes-service.d.ts +1 -1
  32. package/dist/search-service.d.ts +11 -0
  33. package/dist/search-service.d.ts.map +1 -1
  34. package/dist/system-service.d.ts +2 -2
  35. package/dist/terminal-service.d.ts +66 -0
  36. package/dist/terminal-service.d.ts.map +1 -1
  37. package/dist/theme-service.d.ts +23 -7
  38. package/dist/theme-service.d.ts.map +1 -1
  39. package/dist/types.d.ts +102 -24
  40. package/dist/types.d.ts.map +1 -1
  41. package/dist/workspace-service.d.ts +13 -0
  42. package/dist/workspace-service.d.ts.map +1 -1
  43. package/package.json +2 -4
  44. package/src/context-keys.ts +18 -3
  45. package/src/domain-types.ts +8 -29
  46. package/src/editor-service.ts +141 -5
  47. package/src/event.ts +28 -0
  48. package/src/extension-storage.ts +8 -3
  49. package/src/file-service.ts +49 -4
  50. package/src/index.ts +31 -6
  51. package/src/layout-service.ts +15 -13
  52. package/src/network-service.ts +85 -4
  53. package/src/path.test.ts +135 -0
  54. package/src/path.ts +188 -0
  55. package/src/process-service.ts +24 -4
  56. package/src/processes-service.ts +1 -1
  57. package/src/search-service.ts +11 -0
  58. package/src/system-service.ts +2 -2
  59. package/src/terminal-service.ts +71 -0
  60. package/src/theme-service.ts +23 -7
  61. package/src/types.ts +104 -25
  62. package/src/workspace-service.ts +13 -0
@@ -11,9 +11,24 @@
11
11
  * @public
12
12
  */
13
13
  export interface ContextKeys {
14
- /** id of the viewer rendered by the dock's active panel, or null. */
15
- activeViewerId: string | null;
16
- /** editorId of the active dock panel if it's an editor panel, or null. */
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,qEAAqE;IACrE,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,0EAA0E;IAC1E,cAAc,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B"}
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"}
@@ -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
- /** Per-workspace side panel state — saved/restored on workspace switch. */
136
- sidePanelLocations?: Record<string, SidePanelSlot>;
137
- sidePanelOrder?: Record<string, number>;
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,CA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;IAC9B,0BAA0B,EAAE,MAAM,CAAC;IAEnC,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,2BAA2B,EAAE,MAAM,CAAC;IACpC,oBAAoB,EAAE,MAAM,CAAC;IAE7B,iBAAiB,EAAE,MAAM,CAAC;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,4 +1,6 @@
1
1
  import type { Disposable } from "./types";
2
+ import type { Event } from "./event";
3
+ import type { EditorMode } from "./domain-types";
2
4
  /**
3
5
  * Options for the editor open methods.
4
6
  *
@@ -58,7 +60,7 @@ export interface EditorViewInfo {
58
60
  isDefault: boolean;
59
61
  }
60
62
  /**
61
- * Save callbacks an editor viewer registers via
63
+ * Save callbacks an editor registers via
62
64
  * {@link EditorService.registerSaveHandler}, so the active-editor `save` /
63
65
  * `saveAs` commands can dispatch to whichever editor is focused.
64
66
  *
@@ -129,11 +131,75 @@ export interface DiffContentRequest {
129
131
  * @public
130
132
  */
131
133
  export type DiffContentProvider = (request: DiffContentRequest) => Promise<DiffContent>;
134
+ /**
135
+ * A point-in-time snapshot of the focused editor tab. Part of
136
+ * {@link EditorsState}, returned by {@link EditorService.getState} and
137
+ * delivered to {@link EditorService.subscribe} listeners.
138
+ *
139
+ * @category Consumer Services
140
+ * @public
141
+ */
142
+ export interface ActiveEditorInfo {
143
+ /** The focused editor tab's record id — matches {@link EditorRecord.id}. */
144
+ editorId: string;
145
+ /**
146
+ * The absolute file path of the focused tab, or `null` for an untitled
147
+ * buffer.
148
+ */
149
+ filePath: string | null;
150
+ /**
151
+ * The {@link Editor.id} of the presenter rendering the tab
152
+ * (e.g. `"core.text-editor"`, `"silo.markdown-preview"`). Empty string
153
+ * when the presenter could not be resolved (rare: editor registered after
154
+ * the tab was opened).
155
+ */
156
+ viewId: string;
157
+ /** Whether the tab is in text or diff mode. */
158
+ mode: EditorMode;
159
+ }
160
+ /**
161
+ * A frozen, referentially-stable snapshot of editor domain state. Returned by
162
+ * {@link EditorService.getState} and delivered to
163
+ * {@link EditorService.subscribe} listeners.
164
+ *
165
+ * Compatible with `useServiceState` — just pass `ctx.editors` directly.
166
+ *
167
+ * @category Consumer Services
168
+ * @public
169
+ */
170
+ export interface EditorsState {
171
+ /**
172
+ * The focused editor tab, or `null` when the active dock panel is not an
173
+ * editor tab (e.g. a terminal, a dock panel kind, or nothing at all).
174
+ */
175
+ active: ActiveEditorInfo | null;
176
+ /**
177
+ * `true` once the persisted workspace state has loaded from disk. Matches
178
+ * `WorkspaceState.hydrated` — guard state-restoring code on this flag.
179
+ */
180
+ hydrated: boolean;
181
+ }
182
+ /**
183
+ * Payload delivered to {@link EditorService.onDidSave} listeners after an
184
+ * editor tab's contents are written to disk.
185
+ *
186
+ * @category Consumer Services
187
+ * @public
188
+ */
189
+ export interface EditorSaveEvent {
190
+ /** The saved tab's editor record id — matches {@link EditorRecord.id}. */
191
+ editorId: string;
192
+ /**
193
+ * Absolute path the contents were written to. For a save-as (or first save
194
+ * of an untitled buffer) this is the newly chosen path, not the old one.
195
+ */
196
+ filePath: string;
197
+ }
132
198
  /**
133
199
  * The editor & document domain, exposed as {@link ExtensionContext.editors}.
134
200
  * Open files into editor tabs, drive the active editor (save / close), and let
135
- * editor viewers register save handlers. The single entry point for opening
136
- * editors — prefer it over reaching into workspace/editor state.
201
+ * editors register save handlers. The single entry point for opening editors —
202
+ * prefer it over reaching into workspace/editor state.
137
203
  *
138
204
  * @category Consumer Services
139
205
  * @public
@@ -189,5 +255,71 @@ export interface EditorService {
189
255
  * through this provider, on every mount. Dispose to unregister.
190
256
  */
191
257
  registerDiffContentProvider(providerId: string, provider: DiffContentProvider): Disposable;
258
+ /**
259
+ * The current buffer text of an open editor tab, including unsaved edits.
260
+ *
261
+ * Resolves `undefined` when the tab isn't text-backed (e.g. the image
262
+ * viewer) or hasn't mounted yet — a lazy-mounted dock panel is **not**
263
+ * force-mounted to read its text. It is async precisely because the text
264
+ * lives in the mounted editor component, not in host state.
265
+ *
266
+ * @example
267
+ * ```ts
268
+ * const text = await ctx.editors.getText(editorId);
269
+ * if (text !== undefined) ctx.log.info(`${text.length} chars`);
270
+ * ```
271
+ */
272
+ getText(editorId: string): Promise<string | undefined>;
273
+ /**
274
+ * Whether an open editor tab has unsaved changes. Returns `false` for an
275
+ * unknown id or a tab that isn't mounted / text-backed.
276
+ */
277
+ isDirty(editorId: string): boolean;
278
+ /**
279
+ * Fires after an editor tab's contents are saved to disk — a formatter,
280
+ * linter, or build-on-save extension's entry point. See {@link Event}.
281
+ *
282
+ * @example
283
+ * ```ts
284
+ * ctx.subscriptions.push(
285
+ * ctx.editors.onDidSave(({ editorId, filePath }) => {
286
+ * ctx.log.info(`saved ${filePath}`);
287
+ * }),
288
+ * );
289
+ * ```
290
+ */
291
+ onDidSave: Event<EditorSaveEvent>;
292
+ /**
293
+ * Current frozen snapshot of editor state. The returned object is
294
+ * referentially stable between renders — `getState() === getState()` when
295
+ * nothing has changed, which satisfies `useSyncExternalStore`'s contract and
296
+ * means `useServiceState(ctx.editors)` works without extra memoization.
297
+ *
298
+ * @example
299
+ * ```ts
300
+ * const { active } = ctx.editors.getState();
301
+ * if (active) ctx.log.info(`Active file: ${active.filePath ?? "(untitled)"}`);
302
+ * ```
303
+ */
304
+ getState(): EditorsState;
305
+ /**
306
+ * Subscribe to changes in the active editor. The listener is called whenever
307
+ * `active` changes (tab focus moves, workspace switches, editor opens or
308
+ * closes) or `hydrated` flips. Returns a {@link Disposable} that cancels the
309
+ * subscription.
310
+ *
311
+ * Use `useServiceState(ctx.editors)` in React components instead of calling
312
+ * `subscribe` directly — it wraps `getState` + `subscribe` for you.
313
+ *
314
+ * @example
315
+ * ```ts
316
+ * ctx.subscriptions.push(
317
+ * ctx.editors.subscribe(({ active }) => {
318
+ * statusItem.setTitle(active?.filePath ?? "No file");
319
+ * }),
320
+ * );
321
+ * ```
322
+ */
323
+ subscribe(listener: (state: EditorsState) => void): Disposable;
192
324
  }
193
325
  //# sourceMappingURL=editor-service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"editor-service.d.ts","sourceRoot":"","sources":["../src/editor-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAM1C;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,0DAA0D;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE;QACV,4BAA4B;QAC5B,IAAI,EAAE,MAAM,CAAC;QACb,6CAA6C;QAC7C,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,8CAA8C;QAC9C,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,kDAAkD;QAClD,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC7B,uEAAuE;IACvE,EAAE,EAAE,MAAM,CAAC;IACX,oEAAoE;IACpE,KAAK,EAAE,MAAM,CAAC;IACd,2EAA2E;IAC3E,SAAS,E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,EAChB,IAAI,CAAC,EAAE;QAAE,WAAW,CAAC,EAAE,MAAM,CAAA;KAAE,GAC9B,IAAI,CAAC;IACR;;;;OAIG;IACH,mBAAmB,CACjB,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,kBAAkB,GAC3B,UAAU,CAAC;IACd;;;;OAIG;IACH,2BAA2B,CACzB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,mBAAmB,GAC5B,UAAU,CAAC;IACd;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACvD;;;OAGG;IACH,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC;IACnC;;;;;;;;;;;;OAYG;IACH,SAAS,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;IAClC;;;;;;;;;;;OAWG;IACH,QAAQ,IAAI,YAAY,CAAC;IACzB;;;;;;;;;;;;;;;;;OAiBG;IACH,SAAS,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI,GAAG,UAAU,CAAC;CAChE"}
@@ -0,0 +1,28 @@
1
+ import type { Disposable } from "./types";
2
+ /**
3
+ * A subscribable event: call it with a listener and receive a
4
+ * {@link Disposable} that cancels the subscription. Modeled on VS Code's
5
+ * `Event<T>` convention.
6
+ *
7
+ * Services that emit events expose a member typed as `Event<T>` — the
8
+ * consuming extension calls it directly and pushes the returned disposable
9
+ * onto `ctx.subscriptions`:
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * ctx.subscriptions.push(
14
+ * ctx.editors.onDidSave(({ editorId, filePath }) => {
15
+ * console.log("saved", filePath);
16
+ * }),
17
+ * );
18
+ * ```
19
+ *
20
+ * **Host-side:** the matching emitter (`EventEmitter<T>`) lives in the
21
+ * extension-host package (not the SDK). Only the subscribable `Event<T>` type
22
+ * is public — extensions never construct emitters.
23
+ *
24
+ * @category Core Types
25
+ * @public
26
+ */
27
+ export type Event<T> = (listener: (e: T) => void) => Disposable;
28
+ //# sourceMappingURL=event.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event.d.ts","sourceRoot":"","sources":["../src/event.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,MAAM,KAAK,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,IAAI,KAAK,UAAU,CAAC"}
package/dist/event.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=event.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event.js","sourceRoot":"","sources":["../src/event.ts"],"names":[],"mappings":""}
@@ -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. Returns an
28
- * unsubscribe function.
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): () => 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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AQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;IAClC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,gBAAgB,CAAC;CACtC"}
@@ -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
- /** The backend's change kind (e.g. `"create"`, `"modify"`, `"remove"`). */
32
- kind: string;
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
@@ -61,15 +74,46 @@ export interface FileService {
61
74
  readBytes(path: string): Promise<ArrayBuffer>;
62
75
  /** List a directory's immediate entries. */
63
76
  readDir(path: string): Promise<FileMeta[]>;
64
- /** Resolve true if a file or directory exists at `path`. */
77
+ /**
78
+ * Resolve true if a file or directory exists at `path`. Prefer
79
+ * {@link FileService.stat} when you also need the entry's metadata — `stat`
80
+ * returning non-`null` subsumes this check in one call.
81
+ */
65
82
  pathExists(path: string): Promise<boolean>;
83
+ /**
84
+ * Metadata for a single path, following symlinks, or `null` if nothing
85
+ * exists there. Resolving `null` (rather than rejecting) for an absent path
86
+ * is deliberate — it makes `stat` a one-call replacement for
87
+ * {@link FileService.pathExists} that also returns size / mtime / type.
88
+ * Rejects only on a real I/O error (e.g. a permission failure).
89
+ */
90
+ stat(path: string): Promise<FileMeta | null>;
66
91
  /** Write UTF-8 text to a file, creating or overwriting it. */
67
92
  writeText(path: string, content: string): Promise<void>;
93
+ /**
94
+ * Write raw bytes to a file, creating or overwriting it (and creating any
95
+ * missing parent directories). The byte-oriented counterpart to
96
+ * {@link FileService.writeText} / {@link FileService.readBytes} — use it for
97
+ * binary assets (images, archives) where `writeText` would corrupt the data.
98
+ */
99
+ writeBytes(path: string, data: ArrayBuffer | Uint8Array): Promise<void>;
68
100
  /** Create a directory (and any missing parents). */
69
101
  createDir(path: string): Promise<void>;
102
+ /**
103
+ * Copy a file or directory from `src` to `dest`, recursively for
104
+ * directories, creating any missing parent directories. Requires read access
105
+ * to `src` and write access to `dest` (both are workspace-scoped). Overwrites
106
+ * existing files at the destination.
107
+ */
108
+ copy(src: string, dest: string): Promise<void>;
70
109
  /** Rename / move a file or directory. */
71
110
  rename(oldPath: string, newPath: string): Promise<void>;
72
- /** Delete a file or directory. */
111
+ /**
112
+ * **Permanently** delete a file or directory (directories are removed
113
+ * recursively). This does **not** move the entry to the OS trash/recycle
114
+ * bin — the delete is irreversible, so confirm destructive removals with the
115
+ * user first. Rejects if the path does not exist.
116
+ */
73
117
  delete(path: string): Promise<void>;
74
118
  /** Reveal a path in the OS file manager (Finder / Explorer). */
75
119
  reveal(path: string): Promise<void>;
@@ -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,IAAI,EAAE,M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AE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD;;;;;OAKG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE,oDAAoD;IACpD,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACvC;;;;;OAKG;IACH,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,yCAAyC;IACzC,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD;;;;;OAKG;IACH,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
@@ -1,10 +1,16 @@
1
1
  /**
2
- * The public Silo extension API surface — the single curated entry point an
3
- * extension author imports from. This is the seed of the future `@silo-code/sdk`
4
- * package: it re-exports **only** the blessed, permanently supported types.
5
- * Anything not re-exported here is host-internal and may change without notice.
2
+ * The `@silo-code/sdk` public surface — the single curated entry point an
3
+ * extension author imports from. Re-exports **only** the blessed, permanently
4
+ * supported types and runtime helpers. Anything not re-exported here is
5
+ * host-internal and may change without notice.
6
6
  *
7
- * It is also the entry point the API-reference generator (TypeDoc) reads, so
7
+ * **What's here:** the types-first extension contract (see `types.ts`) plus a
8
+ * small set of blessed runtime helpers (`Tooltip`, `useFocusGroup`,
9
+ * `useServiceState`, `DND_MIME`, `PathDeniedError`, `NetworkError`). The SDK
10
+ * peer-depends on React 19; changes to the runtime helpers can be breaking
11
+ * even when the types are unchanged.
12
+ *
13
+ * This is also the entry point the API-reference generator (TypeDoc) reads, so
8
14
  * the published reference is exactly this surface — no more, no less.
9
15
  *
10
16
  * @packageDocumentation
@@ -12,12 +18,12 @@
12
18
  export type { Disposable, DockPanelApi, DockPanelProps, EditorProps, EditorCapabilities, Editor, NewFileTemplate, FileType, Command, MenuId, MenuItemContribution, Keybinding, SidePanelProps, SidePanel, DockPanelKind, StatusItem, SettingsPage, ExtensionContext, Extension, ExtensionManifest, ExtensionHandle, } from "./types";
13
19
  export type { Workspace, EditorMode, EditorRecord, SidePanelSlot, } from "./domain-types";
14
20
  export type { WorkspaceService, WorkspaceState, CreateWorkspaceInput, WorkspaceStatusRow, WorkspaceStatusProvider, WorkspaceSectionProps, WorkspaceSectionProvider, WorkspaceBadge, WorkspaceBadgeProvider, } from "./workspace-service";
15
- export type { EditorService, EditorSaveHandlers, OpenFileOptions, EditorViewInfo, OpenDiffSpec, DiffContent, DiffContentRequest, DiffContentProvider, } from "./editor-service";
21
+ export type { EditorService, EditorSaveHandlers, OpenFileOptions, EditorViewInfo, OpenDiffSpec, DiffContent, DiffContentRequest, DiffContentProvider, ActiveEditorInfo, EditorsState, EditorSaveEvent, } from "./editor-service";
16
22
  export type { LayoutService, LayoutState, SidePanelColumnState, SideLocation, } from "./layout-service";
17
23
  export type { ProcessService, ProcessSession, ProcessSpawnOptions, ProcessExecOptions, ProcessExecResult, } from "./process-service";
18
24
  export type { ProcessesService, ProcessInfo, ProcessStats, } from "./processes-service";
19
25
  export type { TerminalService, CreateTerminalInput, TerminalKind, TerminalRecord, TerminalTabDecoration, TerminalTabDecorationProvider, OscEvent, } from "./terminal-service";
20
- export type { FileService, FileMeta, FileChangeEvent } from "./file-service";
26
+ export type { FileService, FileMeta, FileChangeKind, FileChangeEvent, } from "./file-service";
21
27
  export type { SearchService, SearchOptions, SearchMatch, SearchFileResult, SearchResponse, } from "./search-service";
22
28
  export type { Permission } from "./permissions";
23
29
  export { PathDeniedError } from "./permissions";
@@ -26,10 +32,13 @@ export type { ExtensionStorage, ExtensionStorageScopes, } from "./extension-stor
26
32
  export type { DndService, DndItem, DndMime, DragInit, DndMode, DropContext, DropTargetHandlers, } from "./dnd-service";
27
33
  export { DND_MIME } from "./dnd-service";
28
34
  export type { UiService, FileFilter, MenuItem, MenuItemTrailing, MenuSeparator, MenuHeader, MenuEntry, ShowMenuOptions, ConfirmOptions, PromptOptions, ModalOptions, NotifyAction, NotifyOptions, } from "./ui-service";
29
- export type { NetworkService, NetworkRequestOptions, NetworkResponse, } from "./network-service";
35
+ export { NetworkError } from "./network-service";
36
+ export type { NetworkService, NetworkRequestOptions, NetworkResponse, NetworkBytesResponse, } from "./network-service";
30
37
  export type { SystemService, SystemInfo } from "./system-service";
31
38
  export type { LogService, LogLevel } from "./output-service";
32
39
  export type { ContextKeys } from "./context-keys";
40
+ export type { Event } from "./event";
41
+ export { path } from "./path";
33
42
  export { Tooltip } from "./Tooltip";
34
43
  export { useServiceState } from "./use-service-state";
35
44
  export type { ReactiveService } from "./use-service-state";
@@ -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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gBAAgB,EAChB,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAG7B,YAAY,EACV,UAAU,EACV,OAAO,EACP,OAAO,EACP,QAAQ,EACR,OAAO,EACP,WAAW,EACX,kBAAkB,GACnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAIzC,YAAY,EACV,SAAS,EACT,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,SAAS,EACT,eAAe,EACf,cAAc,EACd,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,aAAa,GACd,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EACV,cAAc,EACd,qBAAqB,EACrB,eAAe,EACf,oBAAoB,GACrB,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,YAAY,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAKrC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAI9B,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
@@ -1,16 +1,28 @@
1
1
  /**
2
- * The public Silo extension API surface — the single curated entry point an
3
- * extension author imports from. This is the seed of the future `@silo-code/sdk`
4
- * package: it re-exports **only** the blessed, permanently supported types.
5
- * Anything not re-exported here is host-internal and may change without notice.
2
+ * The `@silo-code/sdk` public surface — the single curated entry point an
3
+ * extension author imports from. Re-exports **only** the blessed, permanently
4
+ * supported types and runtime helpers. Anything not re-exported here is
5
+ * host-internal and may change without notice.
6
6
  *
7
- * It is also the entry point the API-reference generator (TypeDoc) reads, so
7
+ * **What's here:** the types-first extension contract (see `types.ts`) plus a
8
+ * small set of blessed runtime helpers (`Tooltip`, `useFocusGroup`,
9
+ * `useServiceState`, `DND_MIME`, `PathDeniedError`, `NetworkError`). The SDK
10
+ * peer-depends on React 19; changes to the runtime helpers can be breaking
11
+ * even when the types are unchanged.
12
+ *
13
+ * This is also the entry point the API-reference generator (TypeDoc) reads, so
8
14
  * the published reference is exactly this surface — no more, no less.
9
15
  *
10
16
  * @packageDocumentation
11
17
  */
12
18
  export { PathDeniedError } from "./permissions";
13
19
  export { DND_MIME } from "./dnd-service";
20
+ // Server-side HTTP client — bypasses CORS, readable response headers.
21
+ export { NetworkError } from "./network-service";
22
+ // Pure path utilities — cross-platform replacement for `node:path` (banned in
23
+ // extensions). All outputs use forward-slash separators. Both "/" and "\" are
24
+ // accepted as input. Exported as a namespaced `path` object.
25
+ export { path } from "./path";
14
26
  // Tooltip — the same styled hover popup the host uses in the status bar.
15
27
  // Extensions use this instead of native `title` attributes to match host chrome.
16
28
  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;AAmGH,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AA6BhD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAsCzC,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"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AA2GH,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;AAuBjD,8EAA8E;AAC9E,8EAA8E;AAC9E,6DAA6D;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B,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"}
@@ -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's
60
- * `IDockviewPanelProps`. Serialized into `ws.dockLayout` so URL/state
61
- * survives workspace close/reopen.
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>): void;
67
+ openPanel(kindId: string, params?: Record<string, unknown>, options?: {
68
+ singleton?: boolean;
69
+ }): void;
64
70
  /**
65
- * Open a **singleton** dock panel — a panel that should only ever have one
66
- * instance at a time. If a panel with `kindId` already exists, focuses it;
67
- * otherwise creates it. The panel's id equals `kindId` (not UUID-based, so
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,sD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