@silo-code/sdk 0.30.0 → 0.32.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/ActivityGlyph.d.ts +25 -0
- package/dist/ActivityGlyph.d.ts.map +1 -0
- package/dist/ActivityGlyph.js +25 -0
- package/dist/ActivityGlyph.js.map +1 -0
- package/dist/IconButton.d.ts +23 -6
- package/dist/IconButton.d.ts.map +1 -1
- package/dist/IconButton.js +14 -5
- package/dist/IconButton.js.map +1 -1
- package/dist/activity.d.ts +36 -0
- package/dist/activity.d.ts.map +1 -0
- package/dist/activity.js +33 -0
- package/dist/activity.js.map +1 -0
- package/dist/agents-service.d.ts +174 -0
- package/dist/agents-service.d.ts.map +1 -0
- package/dist/agents-service.js +2 -0
- package/dist/agents-service.js.map +1 -0
- package/dist/editor-service.d.ts +5 -1
- package/dist/editor-service.d.ts.map +1 -1
- package/dist/icon-button-classes.d.ts +10 -2
- package/dist/icon-button-classes.d.ts.map +1 -1
- package/dist/icon-button-classes.js +9 -5
- package/dist/icon-button-classes.js.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/phosphor-icon.d.ts +15 -0
- package/dist/phosphor-icon.d.ts.map +1 -0
- package/dist/phosphor-icon.js +2 -0
- package/dist/phosphor-icon.js.map +1 -0
- package/dist/tab-adornment.d.ts +193 -0
- package/dist/tab-adornment.d.ts.map +1 -0
- package/dist/tab-adornment.js +2 -0
- package/dist/tab-adornment.js.map +1 -0
- package/dist/terminal-service.d.ts +18 -35
- package/dist/terminal-service.d.ts.map +1 -1
- package/dist/toolbar-items.d.ts +171 -0
- package/dist/toolbar-items.d.ts.map +1 -0
- package/dist/toolbar-items.js +2 -0
- package/dist/toolbar-items.js.map +1 -0
- package/dist/types.d.ts +26 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/workspace-service.d.ts +66 -45
- package/dist/workspace-service.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ActivityGlyph.tsx +43 -0
- package/src/IconButton.tsx +28 -6
- package/src/activity.test.ts +35 -0
- package/src/activity.ts +57 -0
- package/src/agents-service.ts +181 -0
- package/src/editor-service.ts +5 -1
- package/src/icon-button-classes.test.ts +10 -0
- package/src/icon-button-classes.ts +18 -5
- package/src/index.ts +33 -1
- package/src/phosphor-icon.ts +14 -0
- package/src/tab-adornment.ts +208 -0
- package/src/terminal-service.ts +21 -35
- package/src/toolbar-items.ts +190 -0
- package/src/types.ts +28 -0
- package/src/workspace-service.ts +72 -45
|
@@ -5,9 +5,19 @@ describe("iconButtonClass", () => {
|
|
|
5
5
|
it("defaults to silo-icon-button", () => {
|
|
6
6
|
expect(iconButtonClass()).toBe("silo-icon-button");
|
|
7
7
|
expect(iconButtonClass("normal")).toBe("silo-icon-button");
|
|
8
|
+
expect(iconButtonClass("normal", "normal")).toBe("silo-icon-button");
|
|
8
9
|
});
|
|
9
10
|
|
|
10
11
|
it("adds the sm modifier", () => {
|
|
11
12
|
expect(iconButtonClass("sm")).toBe("silo-icon-button silo-icon-button-sm");
|
|
12
13
|
});
|
|
14
|
+
|
|
15
|
+
it("adds the toolbar variant", () => {
|
|
16
|
+
expect(iconButtonClass("normal", "toolbar")).toBe(
|
|
17
|
+
"silo-icon-button silo-icon-button-toolbar",
|
|
18
|
+
);
|
|
19
|
+
expect(iconButtonClass("sm", "toolbar")).toBe(
|
|
20
|
+
"silo-icon-button silo-icon-button-sm silo-icon-button-toolbar",
|
|
21
|
+
);
|
|
22
|
+
});
|
|
13
23
|
});
|
|
@@ -6,14 +6,27 @@
|
|
|
6
6
|
*/
|
|
7
7
|
export type IconButtonSize = "normal" | "sm";
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* Visual tone for {@link IconButton}. `"toolbar"` matches the local-web-viewer
|
|
11
|
+
* bar buttons (toolbar-text icons, hover fill only, no press-scale).
|
|
12
|
+
*
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export type IconButtonVariant = "normal" | "toolbar";
|
|
16
|
+
|
|
9
17
|
/**
|
|
10
18
|
* Resolve the host `.silo-icon-button*` class string for an IconButton's
|
|
11
|
-
* `size`. Default is the
|
|
19
|
+
* `size` + `variant`. Default is the standalone size; `sm` adds the compact
|
|
20
|
+
* modifier; `toolbar` swaps in the breadcrumb/panel-toolbar tone.
|
|
12
21
|
*
|
|
13
22
|
* @internal
|
|
14
23
|
*/
|
|
15
|
-
export function iconButtonClass(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
24
|
+
export function iconButtonClass(
|
|
25
|
+
size: IconButtonSize = "normal",
|
|
26
|
+
variant: IconButtonVariant = "normal",
|
|
27
|
+
): string {
|
|
28
|
+
const parts = ["silo-icon-button"];
|
|
29
|
+
if (size === "sm") parts.push("silo-icon-button-sm");
|
|
30
|
+
if (variant === "toolbar") parts.push("silo-icon-button-toolbar");
|
|
31
|
+
return parts.join(" ");
|
|
19
32
|
}
|
package/src/index.ts
CHANGED
|
@@ -100,6 +100,7 @@ export type {
|
|
|
100
100
|
ProcessStats,
|
|
101
101
|
ProcessTreeNode,
|
|
102
102
|
} from "./processes-service";
|
|
103
|
+
export type { AgentsService, AgentInfo, AgentActivity } from "./agents-service";
|
|
103
104
|
export type {
|
|
104
105
|
TerminalService,
|
|
105
106
|
CreateTerminalInput,
|
|
@@ -109,6 +110,37 @@ export type {
|
|
|
109
110
|
TerminalTabDecorationProvider,
|
|
110
111
|
OscEvent,
|
|
111
112
|
} from "./terminal-service";
|
|
113
|
+
export type {
|
|
114
|
+
TabAdornmentColor,
|
|
115
|
+
TabIconAdornment,
|
|
116
|
+
TabIndicatorAdornment,
|
|
117
|
+
TabIndicatorFlash,
|
|
118
|
+
TabActivityAdornment,
|
|
119
|
+
TabActivityFlash,
|
|
120
|
+
TabIconContribution,
|
|
121
|
+
TabIndicatorContribution,
|
|
122
|
+
TabActivityContribution,
|
|
123
|
+
TabIconBinder,
|
|
124
|
+
TabIndicatorBinder,
|
|
125
|
+
TabActivityBinder,
|
|
126
|
+
TabAdornmentMethods,
|
|
127
|
+
} from "./tab-adornment";
|
|
128
|
+
export type { Activity, ActivitySize } from "./activity";
|
|
129
|
+
export { activityFromAgent } from "./activity";
|
|
130
|
+
export { ActivityGlyph } from "./ActivityGlyph";
|
|
131
|
+
export type { PhosphorIconName } from "./phosphor-icon";
|
|
132
|
+
export type {
|
|
133
|
+
ToolbarSurface,
|
|
134
|
+
ToolbarItemContext,
|
|
135
|
+
ToolbarItemFields,
|
|
136
|
+
ToolbarCommandItemContribution,
|
|
137
|
+
ToolbarMenuItemContribution,
|
|
138
|
+
ToolbarChromeFields,
|
|
139
|
+
ToolbarSeparatorContribution,
|
|
140
|
+
ToolbarSpacerSize,
|
|
141
|
+
ToolbarSpacerContribution,
|
|
142
|
+
ToolbarItemContribution,
|
|
143
|
+
} from "./toolbar-items";
|
|
112
144
|
export type {
|
|
113
145
|
FileService,
|
|
114
146
|
FileMeta,
|
|
@@ -225,7 +257,7 @@ export { Tooltip } from "./Tooltip";
|
|
|
225
257
|
export { Button } from "./Button";
|
|
226
258
|
export type { ButtonVariant, ButtonSize } from "./Button";
|
|
227
259
|
export { IconButton } from "./IconButton";
|
|
228
|
-
export type { IconButtonSize } from "./IconButton";
|
|
260
|
+
export type { IconButtonSize, IconButtonVariant } from "./IconButton";
|
|
229
261
|
export { Input } from "./Input";
|
|
230
262
|
export { Textarea } from "./Textarea";
|
|
231
263
|
export { SearchInput } from "./SearchInput";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Export name of an icon from `@phosphor-icons/react` — e.g. `"Flag"`,
|
|
3
|
+
* `"ArrowClockwise"`, `"PushPin"`. The host resolves the name and paints it:
|
|
4
|
+
* toolbar chrome uses `weight="bold"`; tab decorations use `weight="regular"`
|
|
5
|
+
* by default (`filled: true` → `weight="fill"`); both use `size="1em"` so
|
|
6
|
+
* glyphs track UI zoom.
|
|
7
|
+
*
|
|
8
|
+
* Use the PascalCase component name from
|
|
9
|
+
* [Phosphor](https://phosphoricons.com), not a kebab-case path.
|
|
10
|
+
*
|
|
11
|
+
* @category Registration
|
|
12
|
+
* @public
|
|
13
|
+
*/
|
|
14
|
+
export type PhosphorIconName = string;
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { Activity } from "./activity";
|
|
3
|
+
import type { PhosphorIconName } from "./phosphor-icon";
|
|
4
|
+
import type { Disposable } from "./types";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Semantic color for a CenterDock tab trailing {@link TabIndicatorAdornment}
|
|
8
|
+
* (and optional chip background).
|
|
9
|
+
*
|
|
10
|
+
* @category Consumer Services
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
13
|
+
export type TabAdornmentColor = "accent" | "warn" | "ok" | "error" | "muted";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Leading identity adornment on a CenterDock tab — arbitrary React artwork
|
|
17
|
+
* (e.g. an app logo). Set via {@link EditorService.setIcon} /
|
|
18
|
+
* {@link TerminalService.setIcon}.
|
|
19
|
+
*
|
|
20
|
+
* @category Consumer Services
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export interface TabIconAdornment {
|
|
24
|
+
/** Extension-owned key; stacking + {@link EditorService.clearIcon} target. */
|
|
25
|
+
id: string;
|
|
26
|
+
/** Leading glyph / logo rendered before the tab title. */
|
|
27
|
+
icon: ReactNode;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Trailing status adornment on a CenterDock tab — static Phosphor glyph.
|
|
32
|
+
* For busy/ready/warn/error chrome use {@link TabActivityAdornment} instead
|
|
33
|
+
* (ADR 0030).
|
|
34
|
+
*
|
|
35
|
+
* Set via {@link EditorService.setIndicator} /
|
|
36
|
+
* {@link TerminalService.setIndicator}.
|
|
37
|
+
*
|
|
38
|
+
* @category Consumer Services
|
|
39
|
+
* @public
|
|
40
|
+
*/
|
|
41
|
+
export interface TabIndicatorAdornment {
|
|
42
|
+
/** Extension-owned key; stacking + clear target. */
|
|
43
|
+
id: string;
|
|
44
|
+
/**
|
|
45
|
+
* Glyph as a {@link PhosphorIconName} (e.g. `"Flag"`). The host resolves
|
|
46
|
+
* and paints it at 1em in regular weight by default. Set
|
|
47
|
+
* {@link TabIndicatorAdornment.filled | filled} for Phosphor fill weight;
|
|
48
|
+
* {@link TabIndicatorAdornment.color | color} tints the glyph; set
|
|
49
|
+
* {@link TabIndicatorAdornment.chip | chip} for a soft tinted background.
|
|
50
|
+
*/
|
|
51
|
+
icon: PhosphorIconName;
|
|
52
|
+
/** Tooltip shown when hovering the indicator. */
|
|
53
|
+
tooltip?: string;
|
|
54
|
+
/** Semantic color for the glyph (and chip fill). */
|
|
55
|
+
color?: TabAdornmentColor;
|
|
56
|
+
/**
|
|
57
|
+
* When true, paint a soft tinted chip behind the icon. Default is
|
|
58
|
+
* glyph-only — no background.
|
|
59
|
+
*/
|
|
60
|
+
chip?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* When true, paint the glyph with Phosphor `weight="fill"`. Default is
|
|
63
|
+
* regular weight (outline).
|
|
64
|
+
*/
|
|
65
|
+
filled?: boolean;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Host-owned {@link Activity} on a CenterDock tab. Extensions pick the kind
|
|
70
|
+
* (+ optional tooltip); never an icon or color (ADR 0030).
|
|
71
|
+
*
|
|
72
|
+
* @category Consumer Services
|
|
73
|
+
* @public
|
|
74
|
+
*/
|
|
75
|
+
export interface TabActivityAdornment {
|
|
76
|
+
/** Extension-owned key; stacking + clear target. */
|
|
77
|
+
id: string;
|
|
78
|
+
activity: Activity;
|
|
79
|
+
tooltip?: string;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Payload for {@link EditorService.flashIndicator} /
|
|
84
|
+
* {@link TerminalService.flashIndicator} — timed one-shot; no stable `id`
|
|
85
|
+
* (auto-cleared after `durationMs`).
|
|
86
|
+
*
|
|
87
|
+
* @category Consumer Services
|
|
88
|
+
* @public
|
|
89
|
+
*/
|
|
90
|
+
export type TabIndicatorFlash = TabIndicatorContribution & {
|
|
91
|
+
/** How long to show the flash. Defaults to host choice (typically ~800ms). */
|
|
92
|
+
durationMs?: number;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Payload for {@link EditorService.flashActivity} /
|
|
97
|
+
* {@link TerminalService.flashActivity}.
|
|
98
|
+
*
|
|
99
|
+
* @category Consumer Services
|
|
100
|
+
* @public
|
|
101
|
+
*/
|
|
102
|
+
export type TabActivityFlash = TabActivityContribution & {
|
|
103
|
+
durationMs?: number;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* Fields contributed by a {@link TabIconBinder.provide} call (the binder’s
|
|
108
|
+
* own `id` is applied by the host).
|
|
109
|
+
*
|
|
110
|
+
* @category Consumer Services
|
|
111
|
+
* @public
|
|
112
|
+
*/
|
|
113
|
+
export type TabIconContribution = Omit<TabIconAdornment, "id">;
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Fields contributed by a {@link TabIndicatorBinder.provide} call.
|
|
117
|
+
*
|
|
118
|
+
* @category Consumer Services
|
|
119
|
+
* @public
|
|
120
|
+
*/
|
|
121
|
+
export type TabIndicatorContribution = Omit<TabIndicatorAdornment, "id">;
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Fields contributed by a {@link TabActivityBinder.provide} call.
|
|
125
|
+
*
|
|
126
|
+
* @category Consumer Services
|
|
127
|
+
* @public
|
|
128
|
+
*/
|
|
129
|
+
export type TabActivityContribution = Omit<TabActivityAdornment, "id">;
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Keep a leading-icon projection in sync for every editor/terminal tab.
|
|
133
|
+
* Prefer over repeatedly calling {@link EditorService.setIcon}.
|
|
134
|
+
*
|
|
135
|
+
* @category Consumer Services
|
|
136
|
+
* @public
|
|
137
|
+
*/
|
|
138
|
+
export interface TabIconBinder {
|
|
139
|
+
/** Extension-owned key — conventionally `"<extension-id>.tab-icon"`. */
|
|
140
|
+
id: string;
|
|
141
|
+
/**
|
|
142
|
+
* Called synchronously per tab during render. Return `null` to contribute
|
|
143
|
+
* nothing for this target id (editor id or terminal session id).
|
|
144
|
+
*/
|
|
145
|
+
provide(targetId: string): TabIconContribution | null;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Keep a trailing-indicator projection in sync for every editor/terminal tab.
|
|
150
|
+
*
|
|
151
|
+
* @category Consumer Services
|
|
152
|
+
* @public
|
|
153
|
+
*/
|
|
154
|
+
export interface TabIndicatorBinder {
|
|
155
|
+
/** Extension-owned key — conventionally `"<extension-id>.tab-indicator"`. */
|
|
156
|
+
id: string;
|
|
157
|
+
/**
|
|
158
|
+
* Called synchronously per tab during render. Return `null` to contribute
|
|
159
|
+
* nothing for this target id.
|
|
160
|
+
*/
|
|
161
|
+
provide(targetId: string): TabIndicatorContribution | null;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Keep a trailing-activity projection in sync for every editor/terminal tab.
|
|
166
|
+
*
|
|
167
|
+
* @category Consumer Services
|
|
168
|
+
* @public
|
|
169
|
+
*/
|
|
170
|
+
export interface TabActivityBinder {
|
|
171
|
+
/** Extension-owned key — conventionally `"<extension-id>.tab-activity"`. */
|
|
172
|
+
id: string;
|
|
173
|
+
provide(targetId: string): TabActivityContribution | null;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Shared adorn verbs for CenterDock editor and terminal tabs. Implemented by
|
|
178
|
+
* {@link EditorService} and {@link TerminalService} (target id is the editor
|
|
179
|
+
* or terminal session id respectively).
|
|
180
|
+
*
|
|
181
|
+
* @category Consumer Services
|
|
182
|
+
* @public
|
|
183
|
+
*/
|
|
184
|
+
export interface TabAdornmentMethods {
|
|
185
|
+
setIcon(targetId: string, adornment: TabIconAdornment): void;
|
|
186
|
+
clearIcon(targetId: string, adornmentId: string): void;
|
|
187
|
+
bindIcon(binder: TabIconBinder): Disposable;
|
|
188
|
+
|
|
189
|
+
setIndicator(targetId: string, adornment: TabIndicatorAdornment): void;
|
|
190
|
+
clearIndicator(targetId: string, adornmentId: string): void;
|
|
191
|
+
flashIndicator(targetId: string, flash: TabIndicatorFlash): void;
|
|
192
|
+
bindIndicator(binder: TabIndicatorBinder): Disposable;
|
|
193
|
+
|
|
194
|
+
setActivity(targetId: string, adornment: TabActivityAdornment): void;
|
|
195
|
+
clearActivity(targetId: string, adornmentId: string): void;
|
|
196
|
+
flashActivity(targetId: string, flash: TabActivityFlash): void;
|
|
197
|
+
bindActivity(binder: TabActivityBinder): Disposable;
|
|
198
|
+
|
|
199
|
+
/** All leading icons for `targetId`, in set/bind order. */
|
|
200
|
+
getIcons(targetId: string): TabIconAdornment[];
|
|
201
|
+
/** All trailing indicators for `targetId`, in set/bind/flash order. */
|
|
202
|
+
getIndicators(targetId: string): TabIndicatorAdornment[];
|
|
203
|
+
/** All trailing activities for `targetId`, in set/bind/flash order. */
|
|
204
|
+
getActivities(targetId: string): TabActivityAdornment[];
|
|
205
|
+
/** Signal that binder data changed — re-query `provide` and re-render. */
|
|
206
|
+
invalidateTabAdornments(): void;
|
|
207
|
+
subscribeTabAdornments(listener: () => void): Disposable;
|
|
208
|
+
}
|
package/src/terminal-service.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import type React from "react";
|
|
2
1
|
import type { Disposable } from "./types";
|
|
3
2
|
import type { TerminalKind, TerminalRecord } from "./domain-types";
|
|
3
|
+
import type {
|
|
4
|
+
TabAdornmentMethods,
|
|
5
|
+
TabIndicatorContribution,
|
|
6
|
+
} from "./tab-adornment";
|
|
4
7
|
|
|
5
8
|
/**
|
|
6
9
|
* A parsed OSC (Operating System Command) escape sequence emitted by a
|
|
@@ -26,32 +29,18 @@ export interface OscEvent {
|
|
|
26
29
|
export type { TerminalKind, TerminalRecord } from "./domain-types";
|
|
27
30
|
|
|
28
31
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
+
* @deprecated Prefer {@link TerminalService.setIndicator} /
|
|
33
|
+
* {@link TerminalService.bindIndicator}. Alias for a trailing indicator
|
|
34
|
+
* contribution (no `id` — the provider id supplies it).
|
|
32
35
|
*
|
|
33
36
|
* @category Consumer Services
|
|
34
37
|
* @public
|
|
35
38
|
*/
|
|
36
|
-
export
|
|
37
|
-
/**
|
|
38
|
-
* Small React node rendered as a decoration badge on the tab (≤16 px).
|
|
39
|
-
* The extension supplies the shape; the host applies `color` via a CSS
|
|
40
|
-
* data attribute mapped to design tokens.
|
|
41
|
-
*/
|
|
42
|
-
icon: React.ReactNode;
|
|
43
|
-
/** Tooltip shown when hovering the decoration icon. */
|
|
44
|
-
tooltip?: string;
|
|
45
|
-
/**
|
|
46
|
-
* Semantic color applied to the icon element. The host maps this to the
|
|
47
|
-
* matching `--silo-color-*` design token so themes control the exact shade.
|
|
48
|
-
*/
|
|
49
|
-
color?: "accent" | "warn" | "ok" | "error" | "muted";
|
|
50
|
-
}
|
|
39
|
+
export type TerminalTabDecoration = TabIndicatorContribution;
|
|
51
40
|
|
|
52
41
|
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
42
|
+
* @deprecated Prefer {@link TerminalService.bindIndicator}. Terminal-only
|
|
43
|
+
* trailing-indicator provider kept as a shim over the adornment registry.
|
|
55
44
|
*
|
|
56
45
|
* @category Consumer Services
|
|
57
46
|
* @public
|
|
@@ -61,8 +50,7 @@ export interface TerminalTabDecorationProvider {
|
|
|
61
50
|
id: string;
|
|
62
51
|
/**
|
|
63
52
|
* Called synchronously for each terminal tab during render. Return `null`
|
|
64
|
-
* to contribute nothing for this terminal.
|
|
65
|
-
* registered, the first non-null result wins.
|
|
53
|
+
* to contribute nothing for this terminal.
|
|
66
54
|
*/
|
|
67
55
|
provide(terminalId: string): TerminalTabDecoration | null;
|
|
68
56
|
}
|
|
@@ -92,10 +80,13 @@ export interface CreateTerminalInput {
|
|
|
92
80
|
* deleting the workspace. The tab itself is rendered by the core dock from the
|
|
93
81
|
* workspace's terminal records.
|
|
94
82
|
*
|
|
83
|
+
* Tab chrome adornments (`setIcon` / `setIndicator` / …) take a **terminal
|
|
84
|
+
* session id** as the target — see {@link TabAdornmentMethods}.
|
|
85
|
+
*
|
|
95
86
|
* @category Consumer Services
|
|
96
87
|
* @public
|
|
97
88
|
*/
|
|
98
|
-
export interface TerminalService {
|
|
89
|
+
export interface TerminalService extends TabAdornmentMethods {
|
|
99
90
|
/**
|
|
100
91
|
* Open a new terminal in a workspace (defaults to the active one). Returns the
|
|
101
92
|
* created {@link TerminalRecord}; the PTY session spawns lazily when its tab
|
|
@@ -156,29 +147,24 @@ export interface TerminalService {
|
|
|
156
147
|
focus(terminalId: string): void;
|
|
157
148
|
|
|
158
149
|
/**
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
* providers are not consulted. Returns a {@link Disposable} that unregisters
|
|
162
|
-
* the provider.
|
|
150
|
+
* @deprecated Prefer {@link TerminalService.bindIndicator}. Thin shim that
|
|
151
|
+
* registers a trailing-indicator binder for terminal tabs only.
|
|
163
152
|
*/
|
|
164
153
|
registerTabDecoration(provider: TerminalTabDecorationProvider): Disposable;
|
|
165
154
|
|
|
166
155
|
/**
|
|
167
|
-
*
|
|
168
|
-
*
|
|
156
|
+
* @deprecated Prefer {@link TerminalService.getIndicators}. Returns the first
|
|
157
|
+
* trailing indicator for a terminal tab, or `null`.
|
|
169
158
|
*/
|
|
170
159
|
getTabDecoration(terminalId: string): TerminalTabDecoration | null;
|
|
171
160
|
|
|
172
161
|
/**
|
|
173
|
-
*
|
|
174
|
-
* via {@link TerminalService.subscribeTabDecorations}, causing terminal tabs
|
|
175
|
-
* to re-query providers and re-render their decoration.
|
|
162
|
+
* @deprecated Prefer {@link TerminalService.invalidateTabAdornments}.
|
|
176
163
|
*/
|
|
177
164
|
invalidateTabDecorations(): void;
|
|
178
165
|
|
|
179
166
|
/**
|
|
180
|
-
*
|
|
181
|
-
* that cancels the subscription.
|
|
167
|
+
* @deprecated Prefer {@link TerminalService.subscribeTabAdornments}.
|
|
182
168
|
*/
|
|
183
169
|
subscribeTabDecorations(listener: () => void): Disposable;
|
|
184
170
|
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import type { ContextKeys } from "./context-keys";
|
|
2
|
+
import type { PhosphorIconName } from "./phosphor-icon";
|
|
3
|
+
import type { MenuEntry } from "./ui-service";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Built-in CenterDock surfaces that accept
|
|
7
|
+
* {@link ToolbarItemContribution}s. One surface per registration.
|
|
8
|
+
*
|
|
9
|
+
* @category Registration
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export type ToolbarSurface = "editor" | "terminal";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* The typed target each {@link ToolbarSurface} passes to an invoked command
|
|
16
|
+
* and to `when` / `checked` / {@link ToolbarMenuItemContribution.menu} builders.
|
|
17
|
+
*
|
|
18
|
+
* @category Registration
|
|
19
|
+
* @public
|
|
20
|
+
*/
|
|
21
|
+
export interface ToolbarItemContext {
|
|
22
|
+
editor: { editorId: string };
|
|
23
|
+
terminal: { terminalId: string };
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Shared fields for interactive toolbar contributions. Render chrome is driven
|
|
28
|
+
* by {@link ToolbarItemFields.icon | icon} + {@link ToolbarItemFields.title | title}:
|
|
29
|
+
*
|
|
30
|
+
* | icon | title | Control |
|
|
31
|
+
* | ---- | ----- | -------------- |
|
|
32
|
+
* | ✓ | — | icon-only |
|
|
33
|
+
* | — | ✓ | text-only |
|
|
34
|
+
* | ✓ | ✓ | icon + text |
|
|
35
|
+
*
|
|
36
|
+
* Icons are Phosphor export names ({@link PhosphorIconName}); the host
|
|
37
|
+
* resolves and paints them bold at 1em so they match local-web-viewer and
|
|
38
|
+
* track UI zoom. Pass a React node is no longer supported — use the name.
|
|
39
|
+
*
|
|
40
|
+
* @category Registration
|
|
41
|
+
* @public
|
|
42
|
+
*/
|
|
43
|
+
export interface ToolbarItemFields<S extends ToolbarSurface = ToolbarSurface> {
|
|
44
|
+
/** Unique id for this contribution. */
|
|
45
|
+
id: string;
|
|
46
|
+
/** Which toolbar to contribute to. */
|
|
47
|
+
surface: S;
|
|
48
|
+
/**
|
|
49
|
+
* Leading glyph as a {@link PhosphorIconName} (e.g. `"Flag"`). Omit for a
|
|
50
|
+
* text-only control (requires {@link ToolbarItemFields.title | title}).
|
|
51
|
+
*/
|
|
52
|
+
icon?: PhosphorIconName;
|
|
53
|
+
/**
|
|
54
|
+
* Visible label painted in the control. Omit for icon-only. When both
|
|
55
|
+
* `icon` and `title` are set, the host renders icon + text.
|
|
56
|
+
*/
|
|
57
|
+
title?: string;
|
|
58
|
+
/** Hover tooltip (falls back to title / label / command label). */
|
|
59
|
+
tooltip?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Accessible name (falls back to title / the command's label). Always used
|
|
62
|
+
* for `aria-label`; not painted unless {@link ToolbarItemFields.title | title}
|
|
63
|
+
* is also set.
|
|
64
|
+
*/
|
|
65
|
+
label?: string;
|
|
66
|
+
/** Ordering within the trailing cluster; lower sorts first. */
|
|
67
|
+
order?: number;
|
|
68
|
+
/**
|
|
69
|
+
* Visibility predicate. Returning false hides the item for this target.
|
|
70
|
+
*/
|
|
71
|
+
when?: (ctx: ContextKeys, target: ToolbarItemContext[S]) => boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Toggle-state predicate for command items. When provided, the host renders
|
|
74
|
+
* the control in a pressed/checked visual state whenever this returns true.
|
|
75
|
+
* Menu items put checks on individual {@link MenuEntry} rows instead.
|
|
76
|
+
*/
|
|
77
|
+
checked?: (ctx: ContextKeys, target: ToolbarItemContext[S]) => boolean;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Command-backed toolbar control — click runs {@link ToolbarCommandItemContribution.command}.
|
|
82
|
+
*
|
|
83
|
+
* @category Registration
|
|
84
|
+
* @public
|
|
85
|
+
*/
|
|
86
|
+
export interface ToolbarCommandItemContribution<
|
|
87
|
+
S extends ToolbarSurface = ToolbarSurface,
|
|
88
|
+
> extends ToolbarItemFields<S> {
|
|
89
|
+
/** The command to run; receives {@link ToolbarItemContext}[S] as its first arg. */
|
|
90
|
+
command: string;
|
|
91
|
+
menu?: undefined;
|
|
92
|
+
type?: undefined;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Menu-backed toolbar control — click opens a host dropdown via
|
|
97
|
+
* {@link UiService.showMenu} with entries from
|
|
98
|
+
* {@link ToolbarMenuItemContribution.menu}.
|
|
99
|
+
*
|
|
100
|
+
* @category Registration
|
|
101
|
+
* @public
|
|
102
|
+
*/
|
|
103
|
+
export interface ToolbarMenuItemContribution<
|
|
104
|
+
S extends ToolbarSurface = ToolbarSurface,
|
|
105
|
+
> extends ToolbarItemFields<S> {
|
|
106
|
+
/**
|
|
107
|
+
* Build the dropdown for this target. May be sync or async. The host
|
|
108
|
+
* anchors the menu on the toolbar control (`align: "end"`, toggle on).
|
|
109
|
+
*/
|
|
110
|
+
menu: (target: ToolbarItemContext[S]) => MenuEntry[] | Promise<MenuEntry[]>;
|
|
111
|
+
command?: undefined;
|
|
112
|
+
type?: undefined;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* Shared placement fields for non-interactive toolbar chrome
|
|
117
|
+
* ({@link ToolbarSeparatorContribution} / {@link ToolbarSpacerContribution}).
|
|
118
|
+
*
|
|
119
|
+
* @category Registration
|
|
120
|
+
* @public
|
|
121
|
+
*/
|
|
122
|
+
export interface ToolbarChromeFields<
|
|
123
|
+
S extends ToolbarSurface = ToolbarSurface,
|
|
124
|
+
> {
|
|
125
|
+
id: string;
|
|
126
|
+
surface: S;
|
|
127
|
+
order?: number;
|
|
128
|
+
when?: (ctx: ContextKeys, target: ToolbarItemContext[S]) => boolean;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* A light vertical rule between toolbar controls. Softer than the Text |
|
|
133
|
+
* Preview pipe — host paints it with a low-opacity mix of toolbar text, not
|
|
134
|
+
* `--silo-color-toolbar-text-disabled`.
|
|
135
|
+
*
|
|
136
|
+
* @category Registration
|
|
137
|
+
* @public
|
|
138
|
+
*/
|
|
139
|
+
export interface ToolbarSeparatorContribution<
|
|
140
|
+
S extends ToolbarSurface = ToolbarSurface,
|
|
141
|
+
> extends ToolbarChromeFields<S> {
|
|
142
|
+
type: "separator";
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Gap size for {@link ToolbarSpacerContribution}. Maps to em of the toolbar
|
|
147
|
+
* font (`sm` 0.25em / `md` 0.5em / `lg` 0.75em).
|
|
148
|
+
*
|
|
149
|
+
* @category Registration
|
|
150
|
+
* @public
|
|
151
|
+
*/
|
|
152
|
+
export type ToolbarSpacerSize = "sm" | "md" | "lg";
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* An empty gap between toolbar controls (no rule). Use to group without a
|
|
156
|
+
* hard split; prefer {@link ToolbarSeparatorContribution} when a hairline helps.
|
|
157
|
+
*
|
|
158
|
+
* @category Registration
|
|
159
|
+
* @public
|
|
160
|
+
*/
|
|
161
|
+
export interface ToolbarSpacerContribution<
|
|
162
|
+
S extends ToolbarSurface = ToolbarSurface,
|
|
163
|
+
> extends ToolbarChromeFields<S> {
|
|
164
|
+
type: "spacer";
|
|
165
|
+
/** Default `"md"`. */
|
|
166
|
+
size?: ToolbarSpacerSize;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Adds a control or chrome element to the trailing cluster of a built-in
|
|
171
|
+
* editor or terminal toolbar. Register via
|
|
172
|
+
* {@link ExtensionContext.registerToolbarItem}.
|
|
173
|
+
*
|
|
174
|
+
* Interactive items set exactly one of
|
|
175
|
+
* {@link ToolbarCommandItemContribution.command | command} or
|
|
176
|
+
* {@link ToolbarMenuItemContribution.menu | menu}. Separators and spacers use
|
|
177
|
+
* `type: "separator" | "spacer"`.
|
|
178
|
+
*
|
|
179
|
+
* Contributions are independent of context-menu items — an extension may
|
|
180
|
+
* register either, both, or neither. Hosts only render items while that
|
|
181
|
+
* surface's breadcrumbs setting is on.
|
|
182
|
+
*
|
|
183
|
+
* @category Registration
|
|
184
|
+
* @public
|
|
185
|
+
*/
|
|
186
|
+
export type ToolbarItemContribution<S extends ToolbarSurface = ToolbarSurface> =
|
|
187
|
+
| ToolbarCommandItemContribution<S>
|
|
188
|
+
| ToolbarMenuItemContribution<S>
|
|
189
|
+
| ToolbarSeparatorContribution<S>
|
|
190
|
+
| ToolbarSpacerContribution<S>;
|
package/src/types.ts
CHANGED
|
@@ -32,6 +32,7 @@ import type { EditorService } from "./editor-service";
|
|
|
32
32
|
import type { LayoutService } from "./layout-service";
|
|
33
33
|
import type { ProcessService } from "./process-service";
|
|
34
34
|
import type { ProcessesService } from "./processes-service";
|
|
35
|
+
import type { AgentsService } from "./agents-service";
|
|
35
36
|
import type { TerminalService } from "./terminal-service";
|
|
36
37
|
import type { FileService } from "./file-service";
|
|
37
38
|
import type { SearchService } from "./search-service";
|
|
@@ -46,6 +47,7 @@ import type {
|
|
|
46
47
|
ExtensionStorage,
|
|
47
48
|
ExtensionStorageScopes,
|
|
48
49
|
} from "./extension-storage";
|
|
50
|
+
import type { ToolbarItemContribution, ToolbarSurface } from "./toolbar-items";
|
|
49
51
|
|
|
50
52
|
/**
|
|
51
53
|
* The teardown handle returned by every `register*` call on
|
|
@@ -629,6 +631,22 @@ export interface ExtensionContext {
|
|
|
629
631
|
registerContextMenuItem<S extends MenuSurface>(
|
|
630
632
|
item: ContextMenuContribution<S>,
|
|
631
633
|
): Disposable;
|
|
634
|
+
/**
|
|
635
|
+
* Register a {@link ToolbarItemContribution} (icon-only, text-only,
|
|
636
|
+
* icon+text, or dropdown) in the trailing cluster of an editor or terminal
|
|
637
|
+
* toolbar. Independent of {@link ExtensionContext.registerContextMenuItem}
|
|
638
|
+
* — register either, both, or neither. Hosts only show items while that
|
|
639
|
+
* surface's breadcrumbs setting is on. See
|
|
640
|
+
* {@link ExtensionContext.invalidateToolbarItems}.
|
|
641
|
+
*/
|
|
642
|
+
registerToolbarItem<S extends ToolbarSurface>(
|
|
643
|
+
item: ToolbarItemContribution<S>,
|
|
644
|
+
): Disposable;
|
|
645
|
+
/**
|
|
646
|
+
* Signal that toolbar-item `when` / `checked` data changed. Causes editor
|
|
647
|
+
* and terminal toolbars to re-query contributions and re-render.
|
|
648
|
+
*/
|
|
649
|
+
invalidateToolbarItems(): void;
|
|
632
650
|
/** Register a {@link Keybinding} (bind a shortcut to a command). */
|
|
633
651
|
registerKeybinding(binding: Keybinding): Disposable;
|
|
634
652
|
/** Register a {@link SidePanel} (a left/right column panel). */
|
|
@@ -698,6 +716,16 @@ export interface ExtensionContext {
|
|
|
698
716
|
* See {@link ProcessesService} for the full API.
|
|
699
717
|
*/
|
|
700
718
|
readonly processes: ProcessesService;
|
|
719
|
+
/**
|
|
720
|
+
* Host-computed coding-agent activity and resume-identity observability —
|
|
721
|
+
* a live, read-only view of what each terminal's agent is doing
|
|
722
|
+
* (`none`/`working`/`idle`/`error`/`dead`) and, once a terminal's
|
|
723
|
+
* backend is confirmed dead after an unclean shutdown, a resume hint for
|
|
724
|
+
* it. Detection is fully sealed in the host implementation; there is no
|
|
725
|
+
* registration API. **@beta** — the shape may still change. See
|
|
726
|
+
* {@link AgentsService} for the full API.
|
|
727
|
+
*/
|
|
728
|
+
readonly agents: AgentsService;
|
|
701
729
|
/**
|
|
702
730
|
* Consumer API for the terminal domain — open a terminal tab in a workspace
|
|
703
731
|
* (`create`) or reap a workspace's terminals (`closeWorkspace`). The terminal
|