@silo-code/sdk 0.31.0 → 0.33.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/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 +7 -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 +242 -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 +15 -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/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 +35 -1
- package/src/phosphor-icon.ts +14 -0
- package/src/tab-adornment.ts +261 -0
- package/src/terminal-service.ts +21 -35
- package/src/toolbar-items.ts +190 -0
- package/src/types.ts +17 -0
- package/src/workspace-service.ts +72 -45
package/src/workspace-service.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Disposable } from "./types";
|
|
2
2
|
import type { Workspace } from "./domain-types";
|
|
3
|
+
import type { Activity } from "./activity";
|
|
3
4
|
|
|
4
5
|
// Re-export the workspace domain types so consumers can name them from the SDK.
|
|
5
6
|
export type { Workspace, TerminalRecord } from "./domain-types";
|
|
@@ -14,8 +15,11 @@ export type { Workspace, TerminalRecord } from "./domain-types";
|
|
|
14
15
|
export interface WorkspaceStatusRow {
|
|
15
16
|
/** Stable key unique within this provider's results; used for reconciliation. */
|
|
16
17
|
id: string;
|
|
17
|
-
/**
|
|
18
|
-
|
|
18
|
+
/**
|
|
19
|
+
* Host-owned {@link Activity} glyph to the left of the label. Omit for the
|
|
20
|
+
* neutral gray fallback (same as today’s omitted `status`). See ADR 0030.
|
|
21
|
+
*/
|
|
22
|
+
activity?: Activity;
|
|
19
23
|
/** Short label — the host truncates with an ellipsis when space is tight. */
|
|
20
24
|
label: string;
|
|
21
25
|
/**
|
|
@@ -72,22 +76,23 @@ export interface WorkspaceBadge {
|
|
|
72
76
|
/** Short text rendered inside the badge. */
|
|
73
77
|
text: string;
|
|
74
78
|
/**
|
|
75
|
-
*
|
|
76
|
-
* muted
|
|
79
|
+
* Solid chip fill color. Text paints white on top for contrast. Falls back
|
|
80
|
+
* to a muted solid background + hi text when omitted.
|
|
77
81
|
*/
|
|
78
82
|
color?: string;
|
|
79
83
|
}
|
|
80
84
|
|
|
81
85
|
/**
|
|
82
|
-
* A badge
|
|
83
|
-
* workspace name in the Workspaces side panel.
|
|
84
|
-
* {@link WorkspaceService.registerBadge}
|
|
86
|
+
* A badge binder that contributes {@link WorkspaceBadge}s next to the
|
|
87
|
+
* workspace name in the Workspaces side panel. Prefer
|
|
88
|
+
* {@link WorkspaceService.bindBadge}; {@link WorkspaceService.registerBadge}
|
|
89
|
+
* remains as a deprecated alias.
|
|
85
90
|
*
|
|
86
91
|
* @category Consumer Services
|
|
87
92
|
* @public
|
|
88
93
|
*/
|
|
89
94
|
export interface WorkspaceBadgeProvider {
|
|
90
|
-
/** Unique id for this
|
|
95
|
+
/** Unique id for this binder — conventionally `"<extension-id>.badges"`. */
|
|
91
96
|
id: string;
|
|
92
97
|
/**
|
|
93
98
|
* Called synchronously for each workspace during render. Return an empty
|
|
@@ -97,15 +102,19 @@ export interface WorkspaceBadgeProvider {
|
|
|
97
102
|
}
|
|
98
103
|
|
|
99
104
|
/**
|
|
100
|
-
* A status
|
|
101
|
-
* workspace rows in the Workspaces side panel.
|
|
102
|
-
* {@link WorkspaceService.registerStatus}
|
|
105
|
+
* A status binder that contributes {@link WorkspaceStatusRow}s to
|
|
106
|
+
* workspace rows in the Workspaces side panel. Prefer
|
|
107
|
+
* {@link WorkspaceService.bindStatus}; {@link WorkspaceService.registerStatus}
|
|
108
|
+
* remains as a deprecated alias.
|
|
109
|
+
*
|
|
110
|
+
* Unlike CenterDock tab `bindIndicator` (single adornment | null), status
|
|
111
|
+
* and badge binders return an **array** — one projection may emit many rows.
|
|
103
112
|
*
|
|
104
113
|
* @category Consumer Services
|
|
105
114
|
* @public
|
|
106
115
|
*/
|
|
107
116
|
export interface WorkspaceStatusProvider {
|
|
108
|
-
/** Unique id for this
|
|
117
|
+
/** Unique id for this binder — conventionally `"<extension-id>.status"`. */
|
|
109
118
|
id: string;
|
|
110
119
|
/**
|
|
111
120
|
* Called synchronously for each workspace during render. Return an empty
|
|
@@ -260,50 +269,62 @@ export interface WorkspaceService {
|
|
|
260
269
|
delete(id: string): Promise<void>;
|
|
261
270
|
|
|
262
271
|
/**
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
|
|
266
|
-
|
|
272
|
+
* Imperatively adorn a workspace row with a status line. `row.id` is the
|
|
273
|
+
* adornment key for {@link WorkspaceService.clearStatus}.
|
|
274
|
+
*/
|
|
275
|
+
setStatus(workspaceId: string, row: WorkspaceStatusRow): void;
|
|
276
|
+
|
|
277
|
+
/** Remove an imperative status row previously set via {@link WorkspaceService.setStatus}. */
|
|
278
|
+
clearStatus(workspaceId: string, rowId: string): void;
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* Keep a status projection in sync for every workspace. `provide` returns
|
|
282
|
+
* an array of rows (may be empty). Prefer this over repeatedly calling
|
|
283
|
+
* {@link WorkspaceService.setStatus}.
|
|
267
284
|
*
|
|
268
285
|
* @example
|
|
269
286
|
* ```ts
|
|
270
287
|
* ctx.subscriptions.push(
|
|
271
|
-
* ctx.workspaces.
|
|
288
|
+
* ctx.workspaces.bindStatus({
|
|
272
289
|
* id: "my-ext.status",
|
|
273
290
|
* provide(workspaceId) {
|
|
274
291
|
* const running = getRunningTasks(workspaceId);
|
|
275
|
-
* return running.map(t => ({ id: t.id,
|
|
292
|
+
* return running.map(t => ({ id: t.id, activity: "working", label: t.name, startedAt: t.startedAt }));
|
|
276
293
|
* },
|
|
277
294
|
* }),
|
|
278
|
-
* ctx.workspaces.subscribeStatus(() => ctx.workspaces.invalidateStatus()),
|
|
279
295
|
* );
|
|
280
296
|
* ```
|
|
281
297
|
*/
|
|
298
|
+
bindStatus(binder: WorkspaceStatusProvider): Disposable;
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* @deprecated Prefer {@link WorkspaceService.bindStatus}.
|
|
302
|
+
*/
|
|
282
303
|
registerStatus(provider: WorkspaceStatusProvider): Disposable;
|
|
283
304
|
|
|
284
305
|
/**
|
|
285
|
-
* Concatenate all
|
|
286
|
-
* registration order). Called synchronously during panel render —
|
|
287
|
-
* must be fast and side-effect-free.
|
|
306
|
+
* Concatenate imperative rows and all binders' rows for one workspace (in
|
|
307
|
+
* binder registration order). Called synchronously during panel render —
|
|
308
|
+
* binders must be fast and side-effect-free.
|
|
288
309
|
*/
|
|
289
310
|
getStatus(workspaceId: string): WorkspaceStatusRow[];
|
|
290
311
|
|
|
291
312
|
/**
|
|
292
|
-
* Signal that
|
|
313
|
+
* Signal that binder data has changed. Fires all listeners registered
|
|
293
314
|
* via {@link WorkspaceService.subscribeStatus}, causing the Workspaces
|
|
294
|
-
* panel to re-query
|
|
315
|
+
* panel to re-query binders and re-render the status rows.
|
|
295
316
|
*
|
|
296
317
|
* Call this after any mutation to the state your `provide` function reads.
|
|
318
|
+
* Imperative {@link WorkspaceService.setStatus} / {@link WorkspaceService.clearStatus}
|
|
319
|
+
* already notify listeners.
|
|
297
320
|
*/
|
|
298
321
|
invalidateStatus(): void;
|
|
299
322
|
|
|
300
323
|
/**
|
|
301
324
|
* Subscribe to status invalidations. The listener is called whenever
|
|
302
|
-
* {@link WorkspaceService.invalidateStatus} is invoked
|
|
303
|
-
* {@link Disposable} that cancels the
|
|
304
|
-
*
|
|
305
|
-
* The Workspaces panel subscribes internally; extensions may also subscribe
|
|
306
|
-
* to observe invalidations.
|
|
325
|
+
* {@link WorkspaceService.invalidateStatus} is invoked (or imperative
|
|
326
|
+
* set/clear runs). Returns a {@link Disposable} that cancels the
|
|
327
|
+
* subscription.
|
|
307
328
|
*/
|
|
308
329
|
subscribeStatus(listener: () => void): Disposable;
|
|
309
330
|
|
|
@@ -374,15 +395,22 @@ export interface WorkspaceService {
|
|
|
374
395
|
registerPropertyPage(page: WorkspacePropertyPage): Disposable;
|
|
375
396
|
|
|
376
397
|
/**
|
|
377
|
-
*
|
|
378
|
-
*
|
|
379
|
-
|
|
380
|
-
|
|
398
|
+
* Imperatively adorn a workspace name with a badge. `badge.id` is the
|
|
399
|
+
* adornment key for {@link WorkspaceService.clearBadge}.
|
|
400
|
+
*/
|
|
401
|
+
setBadge(workspaceId: string, badge: WorkspaceBadge): void;
|
|
402
|
+
|
|
403
|
+
/** Remove an imperative badge previously set via {@link WorkspaceService.setBadge}. */
|
|
404
|
+
clearBadge(workspaceId: string, badgeId: string): void;
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Keep a badge projection in sync for every workspace. `provide` returns
|
|
408
|
+
* an array of badges (may be empty).
|
|
381
409
|
*
|
|
382
410
|
* @example
|
|
383
411
|
* ```ts
|
|
384
412
|
* ctx.subscriptions.push(
|
|
385
|
-
* ctx.workspaces.
|
|
413
|
+
* ctx.workspaces.bindBadge({
|
|
386
414
|
* id: "my-ext.badges",
|
|
387
415
|
* provide(workspaceId) {
|
|
388
416
|
* const status = getStatus(workspaceId);
|
|
@@ -393,28 +421,27 @@ export interface WorkspaceService {
|
|
|
393
421
|
* );
|
|
394
422
|
* ```
|
|
395
423
|
*/
|
|
424
|
+
bindBadge(binder: WorkspaceBadgeProvider): Disposable;
|
|
425
|
+
|
|
426
|
+
/**
|
|
427
|
+
* @deprecated Prefer {@link WorkspaceService.bindBadge}.
|
|
428
|
+
*/
|
|
396
429
|
registerBadge(provider: WorkspaceBadgeProvider): Disposable;
|
|
397
430
|
|
|
398
431
|
/**
|
|
399
|
-
* Concatenate all
|
|
400
|
-
* registration order).
|
|
401
|
-
* must be fast and side-effect-free.
|
|
432
|
+
* Concatenate imperative badges and all binders' badges for one workspace
|
|
433
|
+
* (in binder registration order).
|
|
402
434
|
*/
|
|
403
435
|
getBadges(workspaceId: string): WorkspaceBadge[];
|
|
404
436
|
|
|
405
437
|
/**
|
|
406
|
-
* Signal that badge data has changed.
|
|
407
|
-
*
|
|
408
|
-
* re-query providers and re-render the name row.
|
|
409
|
-
*
|
|
410
|
-
* Call this after any mutation to the state your `provide` function reads.
|
|
438
|
+
* Signal that badge binder data has changed. Imperative set/clear already
|
|
439
|
+
* notify listeners.
|
|
411
440
|
*/
|
|
412
441
|
invalidateBadges(): void;
|
|
413
442
|
|
|
414
443
|
/**
|
|
415
|
-
* Subscribe to badge invalidations.
|
|
416
|
-
* {@link WorkspaceService.invalidateBadges} is invoked. Returns a
|
|
417
|
-
* {@link Disposable} that cancels the subscription.
|
|
444
|
+
* Subscribe to badge invalidations.
|
|
418
445
|
*/
|
|
419
446
|
subscribeBadges(listener: () => void): Disposable;
|
|
420
447
|
}
|