@silo-code/sdk 0.9.0 → 0.10.1

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/index.d.ts CHANGED
@@ -11,11 +11,11 @@
11
11
  */
12
12
  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
13
  export type { Workspace, EditorMode, EditorRecord, SidePanelSlot, } from "./domain-types";
14
- export type { WorkspaceService, WorkspaceState, CreateWorkspaceInput, } from "./workspace-service";
14
+ export type { WorkspaceService, WorkspaceState, CreateWorkspaceInput, WorkspaceStatusRow, WorkspaceDecorationProvider, } from "./workspace-service";
15
15
  export type { EditorService, EditorSaveHandlers, OpenFileOptions, EditorViewInfo, OpenDiffSpec, DiffContent, DiffContentRequest, DiffContentProvider, } from "./editor-service";
16
16
  export type { LayoutService, LayoutState, SidePanelColumnState, SideLocation, } from "./layout-service";
17
17
  export type { ProcessService, ProcessSession, ProcessSpawnOptions, ProcessExecOptions, ProcessExecResult, } from "./process-service";
18
- export type { TerminalService, CreateTerminalInput, TerminalKind, TerminalRecord, } from "./terminal-service";
18
+ export type { TerminalService, CreateTerminalInput, TerminalKind, TerminalRecord, TerminalTabDecoration, TerminalTabDecorationProvider, } from "./terminal-service";
19
19
  export type { FileService, FileMeta, FileChangeEvent } from "./file-service";
20
20
  export type { SearchService, SearchOptions, SearchMatch, SearchFileResult, SearchResponse, } from "./search-service";
21
21
  export type { Permission } from "./permissions";
@@ -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,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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,YAAY,EACV,cAAc,EACd,qBAAqB,EACrB,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAG3B,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAK3D,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACvE,YAAY,EACV,UAAU,EACV,iBAAiB,EACjB,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC"}
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,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U,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,YAAY,EACV,cAAc,EACd,qBAAqB,EACrB,eAAe,GAChB,MAAM,mBAAmB,CAAC;AAG3B,YAAY,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAIlD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAK3D,OAAO,EAAE,aAAa,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACvE,YAAY,EACV,UAAU,EACV,iBAAiB,EACjB,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,mBAAmB,CAAC"}
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAqFH,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AA0BhD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AA8BzC,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;;;;;;;;;;GAUG;AAyFH,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AA0BhD,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AA8BzC,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,5 +1,47 @@
1
+ import type React from "react";
2
+ import type { Disposable } from "./types";
1
3
  import type { TerminalKind, TerminalRecord } from "./domain-types";
2
4
  export type { TerminalKind, TerminalRecord } from "./domain-types";
5
+ /**
6
+ * A decoration that an extension can attach to a terminal tab — a small icon
7
+ * with an optional tooltip and semantic color. Registered via
8
+ * {@link TerminalService.registerTabDecoration}.
9
+ *
10
+ * @category Consumer Services
11
+ * @public
12
+ */
13
+ export interface TerminalTabDecoration {
14
+ /**
15
+ * Small React node rendered as a decoration badge on the tab (≤16 px).
16
+ * The extension supplies the shape; the host applies `color` via a CSS
17
+ * data attribute mapped to design tokens.
18
+ */
19
+ icon: React.ReactNode;
20
+ /** Tooltip shown when hovering the decoration icon. */
21
+ tooltip?: string;
22
+ /**
23
+ * Semantic color applied to the icon element. The host maps this to the
24
+ * matching `--silo-color-*` design token so themes control the exact shade.
25
+ */
26
+ color?: "accent" | "warn" | "ok" | "error" | "muted";
27
+ }
28
+ /**
29
+ * A decoration provider for terminal tabs. Register via
30
+ * {@link TerminalService.registerTabDecoration}.
31
+ *
32
+ * @category Consumer Services
33
+ * @public
34
+ */
35
+ export interface TerminalTabDecorationProvider {
36
+ /** Unique id — conventionally `"<extension-id>.tab-decoration"`. */
37
+ id: string;
38
+ /**
39
+ * Called synchronously for each terminal tab during render. Return `null`
40
+ * to contribute nothing for this terminal. When multiple providers are
41
+ * registered, the first non-null result wins.
42
+ */
43
+ provide(terminalId: string): TerminalTabDecoration | null;
44
+ }
3
45
  /**
4
46
  * Input for {@link TerminalService.create}.
5
47
  *
@@ -34,5 +76,33 @@ export interface TerminalService {
34
76
  create(input?: CreateTerminalInput): TerminalRecord | undefined;
35
77
  /** Close and kill every terminal in a workspace (e.g. on workspace delete). */
36
78
  closeWorkspace(workspaceId: string): void;
79
+ /**
80
+ * Switch to the workspace containing this terminal and activate its tab in
81
+ * the center dock. No-ops if the terminal id is unknown.
82
+ */
83
+ focus(terminalId: string): void;
84
+ /**
85
+ * Register a decoration provider for terminal tabs. The first registered
86
+ * provider that returns a non-null decoration for a terminal wins; subsequent
87
+ * providers are not consulted. Returns a {@link Disposable} that unregisters
88
+ * the provider.
89
+ */
90
+ registerTabDecoration(provider: TerminalTabDecorationProvider): Disposable;
91
+ /**
92
+ * Get the current decoration for a terminal tab. Returns the first non-null
93
+ * result from registered providers, or `null` if none apply.
94
+ */
95
+ getTabDecoration(terminalId: string): TerminalTabDecoration | null;
96
+ /**
97
+ * Signal that tab decoration data has changed. Fires all listeners registered
98
+ * via {@link TerminalService.subscribeTabDecorations}, causing terminal tabs
99
+ * to re-query providers and re-render their decoration.
100
+ */
101
+ invalidateTabDecorations(): void;
102
+ /**
103
+ * Subscribe to tab decoration invalidations. Returns a {@link Disposable}
104
+ * that cancels the subscription.
105
+ */
106
+ subscribeTabDecorations(listener: () => void): Disposable;
37
107
  }
38
108
  //# sourceMappingURL=terminal-service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"terminal-service.d.ts","sourceRoot":"","sources":["../src/terminal-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGnE,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEnE;;;;;GAKG;AACH,MAAM,WAAW,mBAAmB;IAClC,kEAAkE;IAClE,IAAI,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0DAA0D;IAC1D,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,MAAM,CAAC,KAAK,CAAC,EAAE,mBAAmB,GAAG,cAAc,GAAG,SAAS,CAAC;IAChE,+EAA+E;IAC/E,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAE1C;;;OAGG;IACH,KAAK,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAEhC;;;;;OAKG;IACH,qBAAqB,CAAC,QAAQ,EAAE,6BAA6B,GAAG,UAAU,CAAC;IAE3E;;;OAGG;IACH,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,qBAAqB,GAAG,IAAI,CAAC;IAEnE;;;;OAIG;IACH,wBAAwB,IAAI,IAAI,CAAC;IAEjC;;;OAGG;IACH,uBAAuB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,UAAU,CAAC;CAC3D"}
@@ -1,6 +1,44 @@
1
1
  import type { Disposable } from "./types";
2
2
  import type { Workspace } from "./domain-types";
3
3
  export type { Workspace, TerminalRecord } from "./domain-types";
4
+ /**
5
+ * A single status row contributed by a {@link WorkspaceDecorationProvider}.
6
+ * Rows appear below the path line in the Workspaces side panel.
7
+ *
8
+ * @category Consumer Services
9
+ * @public
10
+ */
11
+ export interface WorkspaceStatusRow {
12
+ /** Stable key unique within this provider's results; used for reconciliation. */
13
+ id: string;
14
+ /** Semantic status dot shown to the left of the label. */
15
+ status?: "ok" | "warn" | "busy" | "error";
16
+ /** Short label — the host truncates with an ellipsis when space is tight. */
17
+ label: string;
18
+ /**
19
+ * ISO timestamp for when this row started. The host renders it as elapsed
20
+ * time using the same `formatElapsed` helper as workspace uptime ("6h", "2d",
21
+ * "just now").
22
+ */
23
+ startedAt?: string;
24
+ }
25
+ /**
26
+ * A decoration provider that contributes {@link WorkspaceStatusRow}s to
27
+ * workspace rows in the Workspaces side panel. Register via
28
+ * {@link WorkspaceService.registerDecoration}.
29
+ *
30
+ * @category Consumer Services
31
+ * @public
32
+ */
33
+ export interface WorkspaceDecorationProvider {
34
+ /** Unique id for this provider — conventionally `"<extension-id>.decoration"`. */
35
+ id: string;
36
+ /**
37
+ * Called synchronously for each workspace during render. Return an empty
38
+ * array to contribute nothing for this workspace.
39
+ */
40
+ provide(workspaceId: string): WorkspaceStatusRow[];
41
+ }
4
42
  /**
5
43
  * An immutable, frozen view of workspace state, returned by
6
44
  * {@link WorkspaceService.getState} and delivered to subscribers — read
@@ -68,5 +106,49 @@ export interface WorkspaceService {
68
106
  removeFolder(id: string, folder: string): void;
69
107
  /** Hard delete — permanent removal. */
70
108
  delete(id: string): void;
109
+ /**
110
+ * Register a decoration provider that contributes status rows to workspace
111
+ * rows in the Workspaces side panel. Multiple providers may be registered;
112
+ * their rows are concatenated in registration order. Returns a
113
+ * {@link Disposable} that unregisters the provider.
114
+ *
115
+ * @example
116
+ * ```ts
117
+ * ctx.subscriptions.push(
118
+ * ctx.workspaces.registerDecoration({
119
+ * id: "my-ext.decoration",
120
+ * provide(workspaceId) {
121
+ * const running = getRunningTasks(workspaceId);
122
+ * return running.map(t => ({ id: t.id, status: "busy", label: t.name, startedAt: t.startedAt }));
123
+ * },
124
+ * }),
125
+ * ctx.workspaces.subscribeDecorations(() => ctx.workspaces.invalidateDecorations()),
126
+ * );
127
+ * ```
128
+ */
129
+ registerDecoration(provider: WorkspaceDecorationProvider): Disposable;
130
+ /**
131
+ * Concatenate all registered providers' rows for one workspace (in
132
+ * registration order). Called synchronously during panel render — providers
133
+ * must be fast and side-effect-free.
134
+ */
135
+ getDecorations(workspaceId: string): WorkspaceStatusRow[];
136
+ /**
137
+ * Signal that decoration data has changed. Fires all listeners registered
138
+ * via {@link WorkspaceService.subscribeDecorations}, causing the Workspaces
139
+ * panel to re-query providers and re-render the status rows.
140
+ *
141
+ * Call this after any mutation to the state your `provide` function reads.
142
+ */
143
+ invalidateDecorations(): void;
144
+ /**
145
+ * Subscribe to decoration invalidations. The listener is called whenever
146
+ * {@link WorkspaceService.invalidateDecorations} is invoked. Returns a
147
+ * {@link Disposable} that cancels the subscription.
148
+ *
149
+ * The Workspaces panel subscribes internally; extensions may also subscribe
150
+ * to observe invalidations.
151
+ */
152
+ subscribeDecorations(listener: () => void): Disposable;
71
153
  }
72
154
  //# sourceMappingURL=workspace-service.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workspace-service.d.ts","sourceRoot":"","sources":["../src/workspace-service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGhD,YAAY,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAEhE;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC7B,6CAA6C;IAC7C,GAAG,EAAE,SAAS,SAAS,EAAE,CAAC;IAC1B,0EAA0E;IAC1E,IAAI,EAAE,SAAS,SAAS,EAAE,CAAC;IAC3B,uEAAuE;IACvE,MAAM,EAAE,SAAS,SAAS,EAAE,CAAC;IAC7B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,oEAAoE;IACpE,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,sCAAsC;IACtC,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,gBAAgB;IAC/B,8CAA8C;IAC9C,QAAQ,IAAI,cAAc,CAAC;IAC3B,SAAS,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,cAAc,KAAK,IAAI,GAAG,UAAU,CAAC;IAC7D;;;OAGG;IACH,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAAC;IACvC,0E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,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,GAAG,IAAI,CAAC;IACtE,uCAAuC;IACvC,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,6EAA6E;IAC7E,KAAK,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,wBAAwB;IACxB,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,uFAAuF;IACvF,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5C,+CAA+C;IAC/C,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/C,uCAAuC;IACvC,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,CAAC;IAEzB;;;;;;;;;;;;;;;;;;;OAmBG;IACH,kBAAkB,CAAC,QAAQ,EAAE,2BAA2B,GAAG,UAAU,CAAC;IAEtE;;;;OAIG;IACH,cAAc,CAAC,WAAW,EAAE,MAAM,GAAG,kBAAkB,EAAE,CAAC;IAE1D;;;;;;OAMG;IACH,qBAAqB,IAAI,IAAI,CAAC;IAE9B;;;;;;;OAOG;IACH,oBAAoB,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,UAAU,CAAC;CACxD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silo-code/sdk",
3
- "version": "0.9.0",
3
+ "version": "0.10.1",
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",
package/src/index.ts CHANGED
@@ -50,6 +50,8 @@ export type {
50
50
  WorkspaceService,
51
51
  WorkspaceState,
52
52
  CreateWorkspaceInput,
53
+ WorkspaceStatusRow,
54
+ WorkspaceDecorationProvider,
53
55
  } from "./workspace-service";
54
56
  export type {
55
57
  EditorService,
@@ -79,6 +81,8 @@ export type {
79
81
  CreateTerminalInput,
80
82
  TerminalKind,
81
83
  TerminalRecord,
84
+ TerminalTabDecoration,
85
+ TerminalTabDecorationProvider,
82
86
  } from "./terminal-service";
83
87
  export type { FileService, FileMeta, FileChangeEvent } from "./file-service";
84
88
  // Cross-file content search exposed on the ExtensionContext as `ctx.search`.
@@ -1,8 +1,52 @@
1
+ import type React from "react";
2
+ import type { Disposable } from "./types";
1
3
  import type { TerminalKind, TerminalRecord } from "./domain-types";
2
4
 
3
5
  // Re-export the terminal domain types so consumers can name them from the SDK.
4
6
  export type { TerminalKind, TerminalRecord } from "./domain-types";
5
7
 
8
+ /**
9
+ * A decoration that an extension can attach to a terminal tab — a small icon
10
+ * with an optional tooltip and semantic color. Registered via
11
+ * {@link TerminalService.registerTabDecoration}.
12
+ *
13
+ * @category Consumer Services
14
+ * @public
15
+ */
16
+ export interface TerminalTabDecoration {
17
+ /**
18
+ * Small React node rendered as a decoration badge on the tab (≤16 px).
19
+ * The extension supplies the shape; the host applies `color` via a CSS
20
+ * data attribute mapped to design tokens.
21
+ */
22
+ icon: React.ReactNode;
23
+ /** Tooltip shown when hovering the decoration icon. */
24
+ tooltip?: string;
25
+ /**
26
+ * Semantic color applied to the icon element. The host maps this to the
27
+ * matching `--silo-color-*` design token so themes control the exact shade.
28
+ */
29
+ color?: "accent" | "warn" | "ok" | "error" | "muted";
30
+ }
31
+
32
+ /**
33
+ * A decoration provider for terminal tabs. Register via
34
+ * {@link TerminalService.registerTabDecoration}.
35
+ *
36
+ * @category Consumer Services
37
+ * @public
38
+ */
39
+ export interface TerminalTabDecorationProvider {
40
+ /** Unique id — conventionally `"<extension-id>.tab-decoration"`. */
41
+ id: string;
42
+ /**
43
+ * Called synchronously for each terminal tab during render. Return `null`
44
+ * to contribute nothing for this terminal. When multiple providers are
45
+ * registered, the first non-null result wins.
46
+ */
47
+ provide(terminalId: string): TerminalTabDecoration | null;
48
+ }
49
+
6
50
  /**
7
51
  * Input for {@link TerminalService.create}.
8
52
  *
@@ -38,4 +82,37 @@ export interface TerminalService {
38
82
  create(input?: CreateTerminalInput): TerminalRecord | undefined;
39
83
  /** Close and kill every terminal in a workspace (e.g. on workspace delete). */
40
84
  closeWorkspace(workspaceId: string): void;
85
+
86
+ /**
87
+ * Switch to the workspace containing this terminal and activate its tab in
88
+ * the center dock. No-ops if the terminal id is unknown.
89
+ */
90
+ focus(terminalId: string): void;
91
+
92
+ /**
93
+ * Register a decoration provider for terminal tabs. The first registered
94
+ * provider that returns a non-null decoration for a terminal wins; subsequent
95
+ * providers are not consulted. Returns a {@link Disposable} that unregisters
96
+ * the provider.
97
+ */
98
+ registerTabDecoration(provider: TerminalTabDecorationProvider): Disposable;
99
+
100
+ /**
101
+ * Get the current decoration for a terminal tab. Returns the first non-null
102
+ * result from registered providers, or `null` if none apply.
103
+ */
104
+ getTabDecoration(terminalId: string): TerminalTabDecoration | null;
105
+
106
+ /**
107
+ * Signal that tab decoration data has changed. Fires all listeners registered
108
+ * via {@link TerminalService.subscribeTabDecorations}, causing terminal tabs
109
+ * to re-query providers and re-render their decoration.
110
+ */
111
+ invalidateTabDecorations(): void;
112
+
113
+ /**
114
+ * Subscribe to tab decoration invalidations. Returns a {@link Disposable}
115
+ * that cancels the subscription.
116
+ */
117
+ subscribeTabDecorations(listener: () => void): Disposable;
41
118
  }
@@ -4,6 +4,46 @@ import type { Workspace } from "./domain-types";
4
4
  // Re-export the workspace domain types so consumers can name them from the SDK.
5
5
  export type { Workspace, TerminalRecord } from "./domain-types";
6
6
 
7
+ /**
8
+ * A single status row contributed by a {@link WorkspaceDecorationProvider}.
9
+ * Rows appear below the path line in the Workspaces side panel.
10
+ *
11
+ * @category Consumer Services
12
+ * @public
13
+ */
14
+ export interface WorkspaceStatusRow {
15
+ /** Stable key unique within this provider's results; used for reconciliation. */
16
+ id: string;
17
+ /** Semantic status dot shown to the left of the label. */
18
+ status?: "ok" | "warn" | "busy" | "error";
19
+ /** Short label — the host truncates with an ellipsis when space is tight. */
20
+ label: string;
21
+ /**
22
+ * ISO timestamp for when this row started. The host renders it as elapsed
23
+ * time using the same `formatElapsed` helper as workspace uptime ("6h", "2d",
24
+ * "just now").
25
+ */
26
+ startedAt?: string;
27
+ }
28
+
29
+ /**
30
+ * A decoration provider that contributes {@link WorkspaceStatusRow}s to
31
+ * workspace rows in the Workspaces side panel. Register via
32
+ * {@link WorkspaceService.registerDecoration}.
33
+ *
34
+ * @category Consumer Services
35
+ * @public
36
+ */
37
+ export interface WorkspaceDecorationProvider {
38
+ /** Unique id for this provider — conventionally `"<extension-id>.decoration"`. */
39
+ id: string;
40
+ /**
41
+ * Called synchronously for each workspace during render. Return an empty
42
+ * array to contribute nothing for this workspace.
43
+ */
44
+ provide(workspaceId: string): WorkspaceStatusRow[];
45
+ }
46
+
7
47
  /**
8
48
  * An immutable, frozen view of workspace state, returned by
9
49
  * {@link WorkspaceService.getState} and delivered to subscribers — read
@@ -73,4 +113,52 @@ export interface WorkspaceService {
73
113
  removeFolder(id: string, folder: string): void;
74
114
  /** Hard delete — permanent removal. */
75
115
  delete(id: string): void;
116
+
117
+ /**
118
+ * Register a decoration provider that contributes status rows to workspace
119
+ * rows in the Workspaces side panel. Multiple providers may be registered;
120
+ * their rows are concatenated in registration order. Returns a
121
+ * {@link Disposable} that unregisters the provider.
122
+ *
123
+ * @example
124
+ * ```ts
125
+ * ctx.subscriptions.push(
126
+ * ctx.workspaces.registerDecoration({
127
+ * id: "my-ext.decoration",
128
+ * provide(workspaceId) {
129
+ * const running = getRunningTasks(workspaceId);
130
+ * return running.map(t => ({ id: t.id, status: "busy", label: t.name, startedAt: t.startedAt }));
131
+ * },
132
+ * }),
133
+ * ctx.workspaces.subscribeDecorations(() => ctx.workspaces.invalidateDecorations()),
134
+ * );
135
+ * ```
136
+ */
137
+ registerDecoration(provider: WorkspaceDecorationProvider): Disposable;
138
+
139
+ /**
140
+ * Concatenate all registered providers' rows for one workspace (in
141
+ * registration order). Called synchronously during panel render — providers
142
+ * must be fast and side-effect-free.
143
+ */
144
+ getDecorations(workspaceId: string): WorkspaceStatusRow[];
145
+
146
+ /**
147
+ * Signal that decoration data has changed. Fires all listeners registered
148
+ * via {@link WorkspaceService.subscribeDecorations}, causing the Workspaces
149
+ * panel to re-query providers and re-render the status rows.
150
+ *
151
+ * Call this after any mutation to the state your `provide` function reads.
152
+ */
153
+ invalidateDecorations(): void;
154
+
155
+ /**
156
+ * Subscribe to decoration invalidations. The listener is called whenever
157
+ * {@link WorkspaceService.invalidateDecorations} is invoked. Returns a
158
+ * {@link Disposable} that cancels the subscription.
159
+ *
160
+ * The Workspaces panel subscribes internally; extensions may also subscribe
161
+ * to observe invalidations.
162
+ */
163
+ subscribeDecorations(listener: () => void): Disposable;
76
164
  }