@silo-code/sdk 0.6.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 (89) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +69 -0
  3. package/dist/context-keys.d.ts +19 -0
  4. package/dist/context-keys.d.ts.map +1 -0
  5. package/dist/context-keys.js +2 -0
  6. package/dist/context-keys.js.map +1 -0
  7. package/dist/dnd-service.d.ts +140 -0
  8. package/dist/dnd-service.d.ts.map +1 -0
  9. package/dist/dnd-service.js +17 -0
  10. package/dist/dnd-service.js.map +1 -0
  11. package/dist/domain-types.d.ts +237 -0
  12. package/dist/domain-types.d.ts.map +1 -0
  13. package/dist/domain-types.js +11 -0
  14. package/dist/domain-types.js.map +1 -0
  15. package/dist/editor-service.d.ts +175 -0
  16. package/dist/editor-service.d.ts.map +1 -0
  17. package/dist/editor-service.js +2 -0
  18. package/dist/editor-service.js.map +1 -0
  19. package/dist/extension-storage.d.ts +26 -0
  20. package/dist/extension-storage.d.ts.map +1 -0
  21. package/dist/extension-storage.js +2 -0
  22. package/dist/extension-storage.js.map +1 -0
  23. package/dist/file-service.d.ts +84 -0
  24. package/dist/file-service.d.ts.map +1 -0
  25. package/dist/file-service.js +2 -0
  26. package/dist/file-service.js.map +1 -0
  27. package/dist/index.d.ts +32 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +22 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/layout-service.d.ts +46 -0
  32. package/dist/layout-service.d.ts.map +1 -0
  33. package/dist/layout-service.js +2 -0
  34. package/dist/layout-service.js.map +1 -0
  35. package/dist/permissions.d.ts +41 -0
  36. package/dist/permissions.d.ts.map +1 -0
  37. package/dist/permissions.js +40 -0
  38. package/dist/permissions.js.map +1 -0
  39. package/dist/process-service.d.ts +132 -0
  40. package/dist/process-service.d.ts.map +1 -0
  41. package/dist/process-service.js +2 -0
  42. package/dist/process-service.js.map +1 -0
  43. package/dist/terminal-service.d.ts +38 -0
  44. package/dist/terminal-service.d.ts.map +1 -0
  45. package/dist/terminal-service.js +2 -0
  46. package/dist/terminal-service.js.map +1 -0
  47. package/dist/theme-service.d.ts +87 -0
  48. package/dist/theme-service.d.ts.map +1 -0
  49. package/dist/theme-service.js +2 -0
  50. package/dist/theme-service.js.map +1 -0
  51. package/dist/types.d.ts +495 -0
  52. package/dist/types.d.ts.map +1 -0
  53. package/dist/types.js +2 -0
  54. package/dist/types.js.map +1 -0
  55. package/dist/ui-service.d.ts +469 -0
  56. package/dist/ui-service.d.ts.map +1 -0
  57. package/dist/ui-service.js +2 -0
  58. package/dist/ui-service.js.map +1 -0
  59. package/dist/use-focus-group.d.ts +202 -0
  60. package/dist/use-focus-group.d.ts.map +1 -0
  61. package/dist/use-focus-group.js +236 -0
  62. package/dist/use-focus-group.js.map +1 -0
  63. package/dist/use-service-state.d.ts +36 -0
  64. package/dist/use-service-state.d.ts.map +1 -0
  65. package/dist/use-service-state.js +25 -0
  66. package/dist/use-service-state.js.map +1 -0
  67. package/dist/workspace-service.d.ts +72 -0
  68. package/dist/workspace-service.d.ts.map +1 -0
  69. package/dist/workspace-service.js +2 -0
  70. package/dist/workspace-service.js.map +1 -0
  71. package/package.json +54 -0
  72. package/src/context-keys.ts +18 -0
  73. package/src/dnd-service.ts +151 -0
  74. package/src/domain-types.ts +252 -0
  75. package/src/editor-service.ts +196 -0
  76. package/src/extension-storage.ts +25 -0
  77. package/src/file-service.ts +90 -0
  78. package/src/index.ts +151 -0
  79. package/src/layout-service.ts +49 -0
  80. package/src/permissions.ts +55 -0
  81. package/src/process-service.ts +143 -0
  82. package/src/terminal-service.ts +41 -0
  83. package/src/theme-service.ts +102 -0
  84. package/src/types.ts +513 -0
  85. package/src/ui-service.ts +487 -0
  86. package/src/use-focus-group.test.ts +168 -0
  87. package/src/use-focus-group.ts +382 -0
  88. package/src/use-service-state.ts +43 -0
  89. package/src/workspace-service.ts +76 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Dave Weaver
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,69 @@
1
+ # @silo-code/sdk
2
+
3
+ The public, **types-first** SDK for building [Silo](https://github.com/silo-code/silo)
4
+ extensions. It is the single curated entry point an extension author imports
5
+ from — everything re-exported here is a blessed, permanently supported part of
6
+ the extension contract. Anything not exported is host-internal and may change
7
+ without notice.
8
+
9
+ ## Install
10
+
11
+ ```sh
12
+ npm i -D @silo-code/sdk
13
+ ```
14
+
15
+ Install it as a **devDependency**: an extension never bundles the SDK. At build
16
+ time you mark `@silo-code/sdk` (and `react`) as **external**, and the Silo host
17
+ resolves them to its own instances at load time — so there is a single React and
18
+ a single SDK across the host↔extension boundary.
19
+
20
+ ## Usage
21
+
22
+ An extension is an [`Extension`](https://github.com/silo-code/silo) object
23
+ with an `activate(ctx)` method. Everything you contribute goes through `ctx`:
24
+
25
+ ```tsx
26
+ import type { Extension } from "@silo-code/sdk";
27
+
28
+ export const extension: Extension = {
29
+ id: "acme.hello",
30
+ activate(ctx) {
31
+ ctx.registerCommand({
32
+ id: "hello.greet",
33
+ label: "Hello: Greet",
34
+ run: () => ctx.ui.notify({ message: "Hello from an extension!" }),
35
+ });
36
+ },
37
+ };
38
+ ```
39
+
40
+ Read a reactive `ctx` service's state in a React component with
41
+ `useServiceState` — the one blessed way to subscribe, replacing hand-rolled
42
+ `useSyncExternalStore`:
43
+
44
+ ```tsx
45
+ import { useServiceState } from "@silo-code/sdk";
46
+
47
+ function Panel({ ctx }: { ctx: ExtensionContext }) {
48
+ const ws = useServiceState(ctx.workspaces);
49
+ return <span>{ws.open.length} open workspaces</span>;
50
+ }
51
+ ```
52
+
53
+ ## Stability
54
+
55
+ Every exported symbol is marked `@public` and documented. The published API
56
+ reference is generated directly from this package's source, so the docs are
57
+ exactly this surface — no more, no less.
58
+
59
+ ## Docs
60
+
61
+ - **Guide:** [Your first extension](https://github.com/silo-code/silo/blob/main/apps/docs/guide/getting-started.md)
62
+ · [Publishing an extension](https://github.com/silo-code/silo/blob/main/apps/docs/guide/publishing-an-extension.md)
63
+ - **API reference:** generated from this package — see the
64
+ [docs site](https://github.com/silo-code/silo/tree/main/apps/docs).
65
+ - **Examples:** [`examples/extensions`](https://github.com/silo-code/silo/tree/main/examples/extensions).
66
+
67
+ ## License
68
+
69
+ MIT
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Minimal context-keys store. Menu items, keybindings, and (later) view
3
+ * contributions can declare `when` clauses that read these values; the host
4
+ * re-evaluates the clauses whenever a key changes and updates UI state
5
+ * (enabled/disabled menu items, etc.).
6
+ *
7
+ * Keys are added as needed. Start narrow: only the keys we have a real use
8
+ * for. Avoid the temptation to mirror every piece of app state into here.
9
+ *
10
+ * @category Core Types
11
+ * @public
12
+ */
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. */
17
+ activeEditorId: string | null;
18
+ }
19
+ //# sourceMappingURL=context-keys.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=context-keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-keys.js","sourceRoot":"","sources":["../src/context-keys.ts"],"names":[],"mappings":""}
@@ -0,0 +1,140 @@
1
+ import type React from "react";
2
+ import type { Disposable } from "./types";
3
+ /**
4
+ * Well-known MIME types for Silo drag payloads. Use these constants (rather than
5
+ * raw strings) so drags interoperate across extensions and built-ins.
6
+ *
7
+ * @category Core Types
8
+ * @public
9
+ */
10
+ export declare const DND_MIME: {
11
+ /** Absolute filesystem path of a file or directory being dragged. */
12
+ readonly filePath: "application/x-silo-file-path";
13
+ /** Plain-text payload (mirrors the path today). */
14
+ readonly text: "text/plain";
15
+ };
16
+ /**
17
+ * A MIME type from the {@link DND_MIME} vocabulary.
18
+ *
19
+ * @category Core Types
20
+ * @public
21
+ */
22
+ export type DndMime = (typeof DND_MIME)[keyof typeof DND_MIME];
23
+ /**
24
+ * One typed item carried by a drag — a MIME type plus its string payload.
25
+ *
26
+ * @category Core Types
27
+ * @public
28
+ */
29
+ export interface DndItem {
30
+ /** The item's MIME type; use a {@link DND_MIME} constant for interop. */
31
+ mime: string;
32
+ /** The string payload (e.g. an absolute path for {@link DND_MIME.filePath}). */
33
+ value: string;
34
+ }
35
+ /**
36
+ * What a drag carries and how its chip should read, passed to
37
+ * {@link DndService.beginDrag}.
38
+ *
39
+ * @category Core Types
40
+ * @public
41
+ */
42
+ export interface DragInit {
43
+ /** Typed payload items written onto the native `dataTransfer`. */
44
+ items: DndItem[];
45
+ /** Label shown in the floating drag chip (e.g. the file name). */
46
+ label: string;
47
+ /** `dataTransfer.effectAllowed`; defaults to `"copyMove"`. */
48
+ effect?: "copy" | "move" | "copyMove";
49
+ }
50
+ /**
51
+ * The interaction mode resolved from held modifiers at hover/drop time:
52
+ * `"copy"` is the default (e.g. open / split); `"paste"` is Shift-held (e.g.
53
+ * insert path at caret / paste into the terminal). Resolved robustly even when
54
+ * WebKit suppresses key events mid-drag.
55
+ *
56
+ * @category Core Types
57
+ * @public
58
+ */
59
+ export type DndMode = "copy" | "paste";
60
+ /**
61
+ * Context delivered to a {@link DropTargetHandlers} callback for a drag over or
62
+ * drop on a registered target.
63
+ *
64
+ * @category Core Types
65
+ * @public
66
+ */
67
+ export interface DropContext {
68
+ /**
69
+ * Typed items read from the native `dataTransfer`. Populated on `drop`;
70
+ * during `dragover` the browser exposes only MIME *types* (not values), so
71
+ * this may be empty there — branch on {@link DropContext.mode} / the target's
72
+ * `accepts` instead.
73
+ */
74
+ items: DndItem[];
75
+ /** The resolved modifier mode (Shift ⇒ `"paste"`). */
76
+ mode: DndMode;
77
+ /** Pointer X in client coordinates. */
78
+ clientX: number;
79
+ /** Pointer Y in client coordinates. */
80
+ clientY: number;
81
+ /** The underlying native event (escape hatch for advanced callers). */
82
+ nativeEvent: DragEvent;
83
+ }
84
+ /**
85
+ * Handlers for a target registered via {@link DndService.registerDropTarget}.
86
+ *
87
+ * @category Core Types
88
+ * @public
89
+ */
90
+ export interface DropTargetHandlers {
91
+ /** MIME types this target consumes; a drag is accepted if it carries one. */
92
+ accepts: string[];
93
+ /**
94
+ * Called on a matching drop. Return `true` if you handled it — the host then
95
+ * calls `preventDefault()` + `stopPropagation()` so the drop does **not**
96
+ * fall through to other targets (e.g. the center dock opening a new pane).
97
+ */
98
+ onDrop(ctx: DropContext): boolean | void;
99
+ /**
100
+ * Optional: called on each accepted drag-over (drive hover styling). Return a
101
+ * drop effect to set the cursor, or nothing to leave it. The host already
102
+ * calls `preventDefault()` so the drop is allowed.
103
+ */
104
+ onDragOver?(ctx: DropContext): "copy" | "move" | "none" | void;
105
+ /**
106
+ * Optional: the pointer left the target (clear hover styling). Receives the
107
+ * native event so callers can ignore leaves into a descendant
108
+ * (`el.contains(e.relatedTarget)`).
109
+ */
110
+ onDragLeave?(e: DragEvent): void;
111
+ /**
112
+ * Attach listeners in the capture phase so this target intercepts before
113
+ * bubble-phase handlers (e.g. the center dock). Defaults to `false`.
114
+ */
115
+ capture?: boolean;
116
+ }
117
+ /**
118
+ * The drag-and-drop domain, exposed as {@link ExtensionContext.dnd}. Be a drag
119
+ * source with {@link DndService.beginDrag} and a drop target with
120
+ * {@link DndService.registerDropTarget}; payloads are typed via {@link DND_MIME}.
121
+ *
122
+ * @category Consumer Services
123
+ * @public
124
+ */
125
+ export interface DndService {
126
+ /**
127
+ * Begin a drag from inside a `dragstart` handler: writes the typed
128
+ * {@link DragInit.items} onto the native `dataTransfer`, hides the native
129
+ * drag preview, and starts the floating chip + paste-mode overlay affordance.
130
+ * Must be called synchronously within the `dragstart` event.
131
+ */
132
+ beginDrag(event: DragEvent | React.DragEvent, init: DragInit): void;
133
+ /**
134
+ * Register `el` as a drop target. The host attaches the drag listeners,
135
+ * resolves the modifier {@link DndMode}, and delivers a {@link DropContext}.
136
+ * Returns a {@link Disposable} that removes the listeners.
137
+ */
138
+ registerDropTarget(el: HTMLElement, handlers: DropTargetHandlers): Disposable;
139
+ }
140
+ //# sourceMappingURL=dnd-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dnd-service.d.ts","sourceRoot":"","sources":["../src/dnd-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAM1C;;;;;;GAMG;AACH,eAAO,MAAM,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G;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;OAKG;IACH,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,KAAK,CAAC,SAAS,EAAE,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;IACpE;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,kBAAkB,GAAG,UAAU,CAAC;CAC/E"}
@@ -0,0 +1,17 @@
1
+ // `ctx.dnd` — first-class drag-and-drop for extensions (public contract). The
2
+ // host owns the affordance (the floating drag chip + paste-mode overlay) and
3
+ // the modifier-mode resolution; the implementation lives in the extension host.
4
+ /**
5
+ * Well-known MIME types for Silo drag payloads. Use these constants (rather than
6
+ * raw strings) so drags interoperate across extensions and built-ins.
7
+ *
8
+ * @category Core Types
9
+ * @public
10
+ */
11
+ export const DND_MIME = {
12
+ /** Absolute filesystem path of a file or directory being dragged. */
13
+ filePath: "application/x-silo-file-path",
14
+ /** Plain-text payload (mirrors the path today). */
15
+ text: "text/plain",
16
+ };
17
+ //# sourceMappingURL=dnd-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dnd-service.js","sourceRoot":"","sources":["../src/dnd-service.ts"],"names":[],"mappings":"AAGA,8EAA8E;AAC9E,6EAA6E;AAC7E,gFAAgF;AAEhF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,qEAAqE;IACrE,QAAQ,EAAE,8BAA8B;IACxC,mDAAmD;IACnD,IAAI,EAAE,YAAY;CACV,CAAC"}
@@ -0,0 +1,237 @@
1
+ /**
2
+ * Public domain types shared across the `ctx` services. These describe the
3
+ * persisted, user-facing shapes an extension sees through the consumer services
4
+ * (e.g. {@link WorkspaceService}, {@link TerminalService}, {@link ThemeService}).
5
+ * The host's internal state module re-exports these so app code names a single
6
+ * source of truth.
7
+ *
8
+ * @packageDocumentation
9
+ */
10
+ /**
11
+ * The kind of a terminal session.
12
+ *
13
+ * @category Core Types
14
+ * @public
15
+ */
16
+ export type TerminalKind = "shell" | "claude" | "pi";
17
+ /**
18
+ * A terminal tab record in a workspace.
19
+ *
20
+ * @category Core Types
21
+ * @public
22
+ */
23
+ export interface TerminalRecord {
24
+ id: string;
25
+ sessionId: string;
26
+ kind: TerminalKind;
27
+ title: string;
28
+ /**
29
+ * A user-assigned name (via the tab's "Rename…" menu). When set, it wins over
30
+ * the PTY-derived {@link TerminalRecord.title} and stays put until the user
31
+ * renames again or the terminal is closed. Cleared by renaming to an empty
32
+ * string, which hands the title back to PTY auto-derivation.
33
+ */
34
+ customName?: string;
35
+ /** Working directory override. Falls back to ws.folder when absent. */
36
+ cwd?: string;
37
+ /** ISO timestamp of the last output we observed; used to pick a workspace's "primary" terminal. */
38
+ lastActiveAt?: string;
39
+ }
40
+ /**
41
+ * The two modes of the one editor surface: a read-write text editor, or a
42
+ * read-only two-model diff. Absent on a record means `"text"`.
43
+ *
44
+ * @category Core Types
45
+ * @public
46
+ */
47
+ export type EditorMode = "text" | "diff";
48
+ /**
49
+ * An editor tab record in a workspace — a text editor or a diff.
50
+ *
51
+ * @category Core Types
52
+ * @public
53
+ */
54
+ export interface EditorRecord {
55
+ id: string;
56
+ /** null for an untitled buffer that hasn't been saved yet. */
57
+ filePath: string | null;
58
+ title: string;
59
+ /** When true, the tab is a temporary preview that gets replaced by the next single-click open. */
60
+ isPreview?: boolean;
61
+ /**
62
+ * Which mode this record renders in. Absent ⇒ `"text"`. A `"diff"` record
63
+ * additionally carries {@link EditorRecord.providerId}/{@link EditorRecord.args}
64
+ * and always has a non-null `filePath`.
65
+ */
66
+ mode?: EditorMode;
67
+ /**
68
+ * Diff mode only: which registered diff-content provider resolves the two
69
+ * sides (e.g. "silo.git"). The diff is content-agnostic — the provider owns
70
+ * what the two sides contain.
71
+ */
72
+ providerId?: string;
73
+ /**
74
+ * Diff mode only: serializable args the provider needs to (re)compute content
75
+ * on mount / restart.
76
+ */
77
+ args?: Record<string, unknown>;
78
+ /**
79
+ * The chosen editor *view* for this tab, referencing an {@link Editor.id}
80
+ * (e.g. `"text"`, `"silo.markdown-preview"`). Absent ⇒ the host renders the
81
+ * highest-priority matching editor (the default). Honored only when the
82
+ * referenced editor is still registered **and** still matches the file;
83
+ * otherwise the host falls back to priority resolution (so a stale value left
84
+ * by an uninstalled extension never breaks the tab). Orthogonal to
85
+ * {@link EditorRecord.mode}: `viewType` selects among `"text"`-mode editors; a
86
+ * `"diff"` record ignores it.
87
+ */
88
+ viewType?: string;
89
+ }
90
+ /**
91
+ * Which slot a side panel renders in.
92
+ *
93
+ * @category Core Types
94
+ * @public
95
+ */
96
+ export type SidePanelSlot = "left" | "right" | "left-bottom" | "right-bottom";
97
+ /**
98
+ * A workspace — the unit Silo switches between, keeping its terminals, editors,
99
+ * and layout alive. Read via {@link WorkspaceService}.
100
+ *
101
+ * @category Core Types
102
+ * @public
103
+ */
104
+ export interface Workspace {
105
+ id: string;
106
+ name: string;
107
+ folder: string;
108
+ /** Additional folders beyond the primary one. */
109
+ extraFolders?: string[];
110
+ createdAt: string;
111
+ 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
+ * ISO timestamp of when the workspace was soft-closed, or null/undefined
123
+ * if the workspace is open. Closed workspaces are hidden from the main
124
+ * list and surfaced in a "reopen" picker.
125
+ */
126
+ closedAt?: string | null;
127
+ /** Per-workspace side panel state — saved/restored on workspace switch. */
128
+ sidePanelLocations?: Record<string, SidePanelSlot>;
129
+ sidePanelOrder?: Record<string, number>;
130
+ activeSidePanelTabs?: Record<string, string>;
131
+ sidePanelScrollPositions?: Record<string, number>;
132
+ extensionState?: Record<string, Record<string, unknown>>;
133
+ leftPanelCollapsed?: boolean;
134
+ rightPanelCollapsed?: boolean;
135
+ /** ID of the current preview (temporary) editor, if any. */
136
+ previewEditorId?: string | null;
137
+ }
138
+ /**
139
+ * Light or dark theme base.
140
+ *
141
+ * @category Core Types
142
+ * @public
143
+ */
144
+ export type ThemeBase = "dark" | "light";
145
+ /**
146
+ * The full theme-override surface, in type form: every `--silo-*` token a theme
147
+ * preset's `vars` may recolor. Per the theming contract it spans **the design
148
+ * tokens' generic colors + font families** _and_ **all the component tokens**.
149
+ * The keys are the literal CSS custom-property names; renaming a key here
150
+ * renames the token in `theme.css` in lockstep. Font-sizes and the radius scale
151
+ * are intentionally absent (not theme-overridable).
152
+ *
153
+ * @see docs/architecture-audit/theming-contract.md
154
+ * @category Core Types
155
+ * @public
156
+ */
157
+ export interface ThemeVars {
158
+ "--silo-color-bg": string;
159
+ "--silo-color-bg-hover": string;
160
+ "--silo-color-bg-active": string;
161
+ "--silo-color-text": string;
162
+ "--silo-color-text-hi": string;
163
+ "--silo-color-text-lo": string;
164
+ "--silo-color-accent": string;
165
+ "--silo-color-accent-2": string;
166
+ "--silo-color-border": string;
167
+ "--silo-color-border-strong": string;
168
+ "--silo-color-ok": string;
169
+ "--silo-color-warn": string;
170
+ "--silo-color-err": string;
171
+ "--silo-color-input-bg": string;
172
+ "--silo-color-input-text": string;
173
+ "--silo-color-button-bg": string;
174
+ "--silo-color-button-text": string;
175
+ "--silo-font-ui"?: string;
176
+ "--silo-font-mono"?: string;
177
+ "--silo-content-text": string;
178
+ "--silo-content-terminal-bg": string;
179
+ "--silo-content-editor-bg": string;
180
+ "--silo-content-editor-selection": string;
181
+ "--silo-content-editor-selection-inactive": string;
182
+ "--silo-content-editor-text-dim": string;
183
+ "--silo-content-editor-text-faint": string;
184
+ "--silo-content-tab-bg": string;
185
+ "--silo-content-tab-tray-bg": string;
186
+ "--silo-content-tab-tray-text": string;
187
+ "--silo-content-tab-text": string;
188
+ "--silo-content-tab-text-inactive": string;
189
+ "--silo-content-tab-text-active": string;
190
+ "--silo-breadcrumb-bg": string;
191
+ "--silo-breadcrumb-text": string;
192
+ "--silo-breadcrumb-text-active": string;
193
+ "--silo-breadcrumb-icon": string;
194
+ "--silo-statusbar-bg": string;
195
+ "--silo-statusbar-text": string;
196
+ "--silo-statusbar-bg-hover": string;
197
+ "--silo-tab-text": string;
198
+ "--silo-tab-text-active": string;
199
+ "--silo-tab-bg-hover": string;
200
+ "--silo-tab-border-active": string;
201
+ "--silo-menu-bg": string;
202
+ "--silo-menu-text": string;
203
+ "--silo-menu-item-hover-bg": string;
204
+ "--silo-menu-border": string;
205
+ "--silo-modal-bg": string;
206
+ "--silo-modal-border": string;
207
+ "--silo-notify-bg": string;
208
+ "--silo-notify-text": string;
209
+ "--silo-notify-text-hi": string;
210
+ }
211
+ /**
212
+ * A persisted custom theme.
213
+ *
214
+ * @category Core Types
215
+ * @public
216
+ */
217
+ export interface CustomTheme {
218
+ id: string;
219
+ /**
220
+ * `2` since the `--silo-*` token rename (theming-contract.md › Migration).
221
+ * v1 themes used the legacy bare names (`--bg`, `--text-hi`, …).
222
+ */
223
+ version: 2;
224
+ name: string;
225
+ base: ThemeBase;
226
+ colorScheme: "dark" | "light";
227
+ vars: Partial<ThemeVars>;
228
+ }
229
+ /**
230
+ * A {@link CustomTheme} without its `id` — the shape exported/imported as a
231
+ * shareable theme file.
232
+ *
233
+ * @category Core Types
234
+ * @public
235
+ */
236
+ export type ThemeExport = Omit<CustomTheme, "id">;
237
+ //# sourceMappingURL=domain-types.d.ts.map
@@ -0,0 +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,M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AE,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"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Public domain types shared across the `ctx` services. These describe the
3
+ * persisted, user-facing shapes an extension sees through the consumer services
4
+ * (e.g. {@link WorkspaceService}, {@link TerminalService}, {@link ThemeService}).
5
+ * The host's internal state module re-exports these so app code names a single
6
+ * source of truth.
7
+ *
8
+ * @packageDocumentation
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=domain-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domain-types.js","sourceRoot":"","sources":["../src/domain-types.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}