@pstdio/sdk 0.10.0 → 0.11.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 (43) hide show
  1. package/README.md +1 -4
  2. package/dist/api/extensions.d.ts +1 -1
  3. package/dist/api/index.d.ts +2 -5
  4. package/dist/api/workspaces.d.ts +2 -6
  5. package/dist/client/client.d.ts +0 -9
  6. package/dist/client/index.d.ts +0 -3
  7. package/dist/client/index.js +16 -110
  8. package/dist/client/projects.d.ts +2 -2
  9. package/dist/client/workspaces.d.ts +2 -4
  10. package/dist/extensions/command-outcome.d.ts +5 -0
  11. package/dist/extensions/define-extension-view.d.ts +25 -0
  12. package/dist/extensions/index.d.ts +6 -3
  13. package/dist/extensions/index.js +90 -35
  14. package/dist/extensions/kernel-slots.d.ts +7 -63
  15. package/dist/extensions/l10n.d.ts +10 -0
  16. package/dist/extensions/params.d.ts +2 -1
  17. package/dist/extensions/types/context.d.ts +51 -189
  18. package/dist/extensions/types/contributions.d.ts +133 -34
  19. package/dist/extensions/types/extension.d.ts +15 -6
  20. package/dist/extensions/types/index.d.ts +1 -0
  21. package/dist/extensions/types/params.d.ts +5 -2
  22. package/dist/extensions/types/tree-renderer.d.ts +89 -0
  23. package/dist/extensions/types/webview-capabilities.d.ts +30 -2
  24. package/dist/extensions/when.d.ts +9 -0
  25. package/dist/extensions/workbench-targets.d.ts +1 -11
  26. package/dist/hooks/entities.d.ts +7 -9
  27. package/dist/hooks/index.d.ts +0 -2
  28. package/dist/hooks/session.d.ts +2 -3
  29. package/dist/hooks/worktree.d.ts +4 -3
  30. package/dist/resources/index.d.ts +0 -3
  31. package/dist/resources/workspace.d.ts +0 -1
  32. package/package.json +1 -1
  33. package/dist/api/statuses.d.ts +0 -2
  34. package/dist/api/tags.d.ts +0 -2
  35. package/dist/api/tickets.d.ts +0 -26
  36. package/dist/client/statuses.d.ts +0 -24
  37. package/dist/client/tags.d.ts +0 -15
  38. package/dist/client/tickets.d.ts +0 -24
  39. package/dist/hooks/attempt.d.ts +0 -16
  40. package/dist/hooks/ticket.d.ts +0 -26
  41. package/dist/resources/status.d.ts +0 -2
  42. package/dist/resources/tag.d.ts +0 -2
  43. package/dist/resources/ticket.d.ts +0 -2
@@ -1,14 +1,16 @@
1
+ import type { Localizable } from "../l10n";
1
2
  import type { WorkbenchMenuTarget, WorkbenchModeLayoutTarget, WorkbenchSettingsScope, WorkbenchSettingsTarget, WorkbenchTreeTarget, WorkbenchViewTarget } from "../workbench-targets";
2
3
  import type { CommandRef, CommandSource } from "./commands";
4
+ import type { EventRef } from "./events";
3
5
  import type { JsonObject, JsonValue, Struct } from "./json";
4
6
  import type { ParamObjectSchema } from "./params";
5
- import type { PackageAssetDescriptor } from "./resources";
7
+ import type { PackageAssetDescriptor, ResourceRef } from "./resources";
6
8
  import type { SlotRef } from "./slots";
7
9
  import type { WebviewCapabilityDeclaration } from "./webview-capabilities";
8
10
  export interface CliContribution {
9
11
  path?: string[];
10
12
  globalAliases?: string[][];
11
- description?: string;
13
+ description?: Localizable<string>;
12
14
  examples?: string[];
13
15
  hidden?: boolean;
14
16
  }
@@ -21,7 +23,7 @@ export interface WhenExpression {
21
23
  export interface MenuContribution<TSlotContext extends Struct = Struct, TParams extends Struct = Struct> {
22
24
  target?: WorkbenchMenuTarget;
23
25
  slot?: SlotRef<TSlotContext, "menu"> | string;
24
- label?: string;
26
+ label?: Localizable<string>;
25
27
  group?: string;
26
28
  placement?: "first" | "default" | "last";
27
29
  icon?: string;
@@ -30,9 +32,17 @@ export interface MenuContribution<TSlotContext extends Struct = Struct, TParams
30
32
  params?: Partial<TParams>;
31
33
  presentation?: "menu-item" | "button" | "icon-button";
32
34
  }
35
+ export interface CommandPaletteContribution<TParams extends Struct = Struct> {
36
+ label?: Localizable<string>;
37
+ group?: string;
38
+ placement?: "first" | "default" | "last";
39
+ icon?: string;
40
+ when?: WhenExpression;
41
+ params?: Partial<TParams>;
42
+ }
33
43
  export interface TreeItemContribution<TParams extends Struct = Struct> {
34
44
  target: WorkbenchTreeTarget;
35
- label: string;
45
+ label: Localizable<string>;
36
46
  group?: string;
37
47
  placement?: "first" | "default" | "last";
38
48
  icon?: string;
@@ -56,14 +66,14 @@ export type WorkbenchLayoutTarget = WorkbenchModeLayoutTarget;
56
66
  export type ModeTargetContribution = {
57
67
  target: WorkbenchLayoutTarget;
58
68
  view: string;
59
- title?: string;
69
+ title?: Localizable<string>;
60
70
  resource?: string;
61
71
  pinned?: boolean;
62
72
  } | {
63
73
  target: WorkbenchLayoutTarget;
64
74
  resource: string;
65
75
  widget?: string;
66
- title?: string;
76
+ title?: Localizable<string>;
67
77
  pinned?: boolean;
68
78
  };
69
79
  export interface ModeLayoutContribution {
@@ -72,30 +82,49 @@ export interface ModeLayoutContribution {
72
82
  }
73
83
  export interface ModeContribution {
74
84
  id?: string;
75
- label: string;
85
+ label: Localizable<string>;
76
86
  icon?: string;
77
87
  layout?: ModeLayoutContribution;
78
88
  }
79
89
  export interface WebviewContribution {
80
90
  entry: PackageAssetDescriptor;
81
- title?: string;
91
+ title?: Localizable<string>;
82
92
  capabilities?: WebviewCapabilityDeclaration[];
83
93
  }
84
- export interface ViewContribution<TSlotContext extends Struct = Struct> {
85
- title: string;
94
+ export interface ViewContributionBase<TSlotContext extends Struct = Struct> {
95
+ title: Localizable<string>;
86
96
  target?: WorkbenchViewTarget;
87
97
  slot?: SlotRef<TSlotContext, "view"> | string;
88
98
  group?: string;
89
99
  placement?: "first" | "default" | "last";
90
- webview: WebviewContribution;
100
+ /**
101
+ * Marks this view as the editor for resources of the given kind. The host opens
102
+ * the view's webview as a widget (bound to the resource) whenever a resource of
103
+ * this kind is opened — e.g. a `ticket` data-renderer row opening the editor.
104
+ */
105
+ resourceKind?: string;
106
+ /**
107
+ * Where the host mounts the view. `panel` (default) docks it in a workbench area;
108
+ * `modal` mounts it as an overlay dialog — used by data-renderer create flows where
109
+ * a row's create button opens the matching `resourceKind` modal instead of the
110
+ * inline create command.
111
+ */
112
+ surface?: "panel" | "modal";
91
113
  }
114
+ export type ViewContribution<TSlotContext extends Struct = Struct> = ViewContributionBase<TSlotContext> & ({
115
+ webview: WebviewContribution;
116
+ treeRenderer?: never;
117
+ } | {
118
+ treeRenderer: string;
119
+ webview?: never;
120
+ });
92
121
  export interface RouteContribution {
93
122
  path: string;
94
- label: string;
123
+ label: Localizable<string>;
95
124
  webview: WebviewContribution;
96
125
  }
97
126
  export interface SettingsPanelContribution<TSlotContext extends Struct = Struct> {
98
- title: string;
127
+ title: Localizable<string>;
99
128
  target?: WorkbenchSettingsTarget;
100
129
  scope?: WorkbenchSettingsScope;
101
130
  slot?: SlotRef<TSlotContext, "settings"> | string;
@@ -105,7 +134,7 @@ export type DataRendererViewMode = "board" | "list";
105
134
  export type DataRendererSortDirection = "asc" | "desc";
106
135
  export interface DataRendererEnumOption {
107
136
  value: string;
108
- label: string;
137
+ label: Localizable<string>;
109
138
  color?: string;
110
139
  icon?: string | null;
111
140
  }
@@ -126,7 +155,7 @@ export type DataRendererAttributeType = {
126
155
  };
127
156
  export interface DataRendererAttributeDescriptor {
128
157
  id: string;
129
- label: string;
158
+ label: Localizable<string>;
130
159
  type: DataRendererAttributeType;
131
160
  filterable?: boolean;
132
161
  groupable?: boolean;
@@ -165,7 +194,7 @@ export interface DataRendererRow {
165
194
  }
166
195
  export interface DataRendererColumnAction {
167
196
  id: string;
168
- label: string;
197
+ label: Localizable<string>;
169
198
  icon?: string;
170
199
  }
171
200
  export interface DataRendererBoardColumnConfig {
@@ -182,8 +211,8 @@ export interface DataRendererQueryResult {
182
211
  }
183
212
  export interface DataRendererCreateRowContribution<TParams extends ParamObjectSchema = ParamObjectSchema> {
184
213
  command: CommandRef<Struct, unknown> | string;
185
- title?: string;
186
- submitLabel?: string;
214
+ title?: Localizable<string>;
215
+ submitLabel?: Localizable<string>;
187
216
  columnParam?: string;
188
217
  params?: TParams;
189
218
  }
@@ -191,8 +220,16 @@ export interface DataRendererSavedViewsContribution {
191
220
  resourceKind: string;
192
221
  scope?: "project" | "user";
193
222
  }
223
+ export interface DataRendererRowAction<TParams extends Struct = Struct> {
224
+ id: string;
225
+ label: Localizable<string>;
226
+ icon?: string;
227
+ /** Invoked with `{ rowId }` when the row's context-menu action is chosen. */
228
+ command: CommandRef<TParams, unknown> | string;
229
+ destructive?: boolean;
230
+ }
194
231
  export interface DataRendererContribution {
195
- title: string;
232
+ title: Localizable<string>;
196
233
  resourceKind?: string;
197
234
  attributes?: DataRendererAttributeDescriptor[];
198
235
  queryCommand: CommandRef<DataRendererQueryParams, DataRendererQueryResult> | string;
@@ -210,13 +247,53 @@ export interface DataRendererContribution {
210
247
  actionId: string;
211
248
  }, unknown> | string;
212
249
  createRow?: DataRendererCreateRowContribution;
250
+ rowActions?: DataRendererRowAction[];
213
251
  defaultSettings?: Partial<DataRendererSettings>;
214
252
  defaultFilters?: DataRendererFilterState;
215
- emptyTitle?: string;
216
- emptyDescription?: string;
253
+ emptyTitle?: Localizable<string>;
254
+ emptyDescription?: Localizable<string>;
217
255
  hideToolbar?: boolean;
218
256
  savedViews?: DataRendererSavedViewsContribution;
219
257
  }
258
+ /**
259
+ * Command palette resource providers contribute dynamic, searchable palette results
260
+ * (e.g. slides in a presentation) backed by an extension `queryCommand`, instead of
261
+ * static command entries generated at module load. The host queries matching providers
262
+ * as the user types and refreshes results when a declared `refreshEvent` fires.
263
+ */
264
+ export interface CommandPaletteResourceQueryParams {
265
+ projectId?: string;
266
+ modeId?: string;
267
+ activeResource?: ResourceRef;
268
+ providerId: string;
269
+ query: string;
270
+ limit: number;
271
+ }
272
+ export type CommandPaletteResourceTarget = {
273
+ kind: "command";
274
+ command: CommandRef<Struct, unknown> | string;
275
+ params?: Struct;
276
+ } | {
277
+ kind: "resource";
278
+ resource: ResourceRef;
279
+ };
280
+ export interface CommandPaletteResourceItem {
281
+ id: string;
282
+ label: string;
283
+ description?: string;
284
+ icon?: string;
285
+ keywords?: string[];
286
+ target: CommandPaletteResourceTarget;
287
+ }
288
+ export interface CommandPaletteResourceQueryResult {
289
+ items: CommandPaletteResourceItem[];
290
+ }
291
+ export interface CommandPaletteResourceContribution {
292
+ title: Localizable<string>;
293
+ resourceKind?: string;
294
+ queryCommand: CommandRef<CommandPaletteResourceQueryParams, CommandPaletteResourceQueryResult> | string;
295
+ refreshEvents?: (EventRef | string)[];
296
+ }
220
297
  export type ExtensionSettingScope = "global" | "project";
221
298
  export type ExtensionSettingValueType = "boolean" | "number" | "string" | "array" | "object";
222
299
  export type ExtensionSettingValueForType<TType extends ExtensionSettingValueType> = TType extends "boolean" ? boolean : TType extends "number" ? number : TType extends "string" ? string : TType extends "array" ? JsonValue[] : JsonObject;
@@ -226,8 +303,8 @@ export type ExtensionSettingProperty<TType extends ExtensionSettingValueType = E
226
303
  scope: ExtensionSettingScope;
227
304
  default?: ExtensionSettingValueForType<TSettingType>;
228
305
  enum?: ExtensionSettingValueForType<TSettingType>[];
229
- title?: string;
230
- description?: string;
306
+ title?: Localizable<string>;
307
+ description?: Localizable<string>;
231
308
  };
232
309
  }[TType];
233
310
  export interface ExtensionSettingsContribution<TProperties extends Record<string, ExtensionSettingProperty> = Record<string, ExtensionSettingProperty>> {
@@ -241,35 +318,57 @@ export interface RendererContribution<TSlotContext extends Struct = Struct> {
241
318
  export interface ArtifactMountContribution {
242
319
  /** Relative path under .pstdio/<extension.name>/. */
243
320
  path: string;
244
- label: string;
321
+ label: Localizable<string>;
245
322
  repoRole?: "default" | "selected" | "workspace";
246
323
  }
247
324
  export interface TemplateTypeContribution {
248
- label: string;
249
- description?: string;
325
+ label: Localizable<string>;
326
+ description?: Localizable<string>;
250
327
  }
251
328
  export interface TemplateContribution {
252
- title: string;
329
+ title: Localizable<string>;
253
330
  type: string;
254
331
  source: PackageAssetDescriptor;
255
- description?: string;
332
+ description?: Localizable<string>;
256
333
  }
257
334
  export interface SkillContribution {
258
- title: string;
335
+ title: Localizable<string>;
259
336
  source: PackageAssetDescriptor;
260
- description?: string;
337
+ description?: Localizable<string>;
261
338
  }
262
339
  export type ThemeMode = "light" | "dark";
263
340
  export interface ThemeContribution {
264
- title: string;
341
+ title: Localizable<string>;
265
342
  source: PackageAssetDescriptor;
266
343
  format: "vscode-color-theme";
267
344
  mode?: ThemeMode;
268
- description?: string;
345
+ description?: Localizable<string>;
269
346
  }
270
347
  export interface FileIconThemeContribution {
271
- title: string;
348
+ title: Localizable<string>;
272
349
  source: PackageAssetDescriptor;
273
350
  format: "vscode-file-icon-theme";
274
- description?: string;
351
+ description?: Localizable<string>;
352
+ }
353
+ /**
354
+ * Chord string in TanStack Hotkeys syntax (e.g. "mod+shift+p"). `mod` is
355
+ * Cmd on macOS and Ctrl elsewhere. Parsing, validation, canonicalization,
356
+ * and display labels are all delegated to `@tanstack/hotkeys`.
357
+ */
358
+ export type KeybindingChord = string;
359
+ export interface KeybindingContribution<TParams extends Struct = Struct> {
360
+ /** Default chord. Used on every platform unless an override is provided. */
361
+ key: KeybindingChord;
362
+ /** macOS override. */
363
+ mac?: KeybindingChord;
364
+ /** Linux override. */
365
+ linux?: KeybindingChord;
366
+ /** Windows override. */
367
+ win?: KeybindingChord;
368
+ /** Command this chord executes. */
369
+ command: CommandRef<TParams, unknown> | string;
370
+ /** Optional command params. */
371
+ args?: Partial<TParams>;
372
+ /** Optional gating predicate. The host evaluates it at dispatch time. */
373
+ when?: WhenExpression;
275
374
  }
@@ -1,9 +1,12 @@
1
+ import type { Localizable } from "../l10n";
1
2
  import type { CommandRef } from "./commands";
2
3
  import type { CommandMiddlewareHandler, CommandRunHandler, EventContext, ExtensionContextBase, MigrationContext, SetupContext } from "./context";
3
- import type { ArtifactMountContribution, CliContribution, DataRendererContribution, ExtensionSettingsContribution, FileIconThemeContribution, MenuContribution, ModeContribution, RendererContribution, RouteContribution, SettingsPanelContribution, SkillContribution, TemplateContribution, TemplateTypeContribution, ThemeContribution, TreeItemContribution, ViewContribution } from "./contributions";
4
+ import type { ArtifactMountContribution, CliContribution, CommandPaletteContribution, CommandPaletteResourceContribution, DataRendererContribution, ExtensionSettingsContribution, FileIconThemeContribution, KeybindingContribution, MenuContribution, ModeContribution, RendererContribution, RouteContribution, SettingsPanelContribution, SkillContribution, TemplateContribution, TemplateTypeContribution, ThemeContribution, TreeItemContribution, ViewContribution } from "./contributions";
4
5
  import type { EventRef } from "./events";
5
6
  import type { JsonObject, MaybePromise, Struct } from "./json";
6
7
  import type { ParamObjectSchema, ParamsOf } from "./params";
8
+ import type { PackageAssetDescriptor } from "./resources";
9
+ import type { TreeRendererContribution } from "./tree-renderer";
7
10
  /** Current host extension API version. `engines.pstdio` in package.json is a semver range checked against this. */
8
11
  export declare const EXTENSION_API_VERSION = "1.0.0";
9
12
  type SchemaParams<TSchema extends ParamObjectSchema | undefined> = TSchema extends ParamObjectSchema ? ParamsOf<TSchema> : Struct;
@@ -12,10 +15,11 @@ type SchemaParams<TSchema extends ParamObjectSchema | undefined> = TSchema exten
12
15
  * the inferred shape of `ctx.params` in `run`.
13
16
  */
14
17
  export interface CommandDefinition<TSchema extends ParamObjectSchema | undefined = ParamObjectSchema | undefined, TResult = unknown, TSettings extends Record<string, unknown> = Record<string, unknown>> {
15
- title: string;
16
- description?: string;
18
+ title: Localizable<string>;
19
+ description?: Localizable<string>;
17
20
  params?: TSchema;
18
21
  menus?: MenuContribution[];
22
+ palette?: boolean | CommandPaletteContribution<SchemaParams<TSchema>> | CommandPaletteContribution<SchemaParams<TSchema>>[];
19
23
  cli?: boolean | CliContribution;
20
24
  run: CommandRunHandler<SchemaParams<TSchema>, TResult, TSettings>;
21
25
  }
@@ -38,7 +42,7 @@ export interface HookDefinition<TPayload extends Struct = Struct> {
38
42
  handler(ctx: EventContext, payload: TPayload): MaybePromise<void>;
39
43
  }
40
44
  export interface ScheduleContribution<TParams extends Struct = Struct> {
41
- title: string;
45
+ title: Localizable<string>;
42
46
  cron: string;
43
47
  command?: CommandRef<TParams, unknown>;
44
48
  commandId?: string;
@@ -59,7 +63,7 @@ export interface HarnessRun {
59
63
  }
60
64
  export interface HarnessProvider {
61
65
  id: string;
62
- label: string;
66
+ label: Localizable<string>;
63
67
  detect?(ctx: ExtensionContextBase): MaybePromise<HarnessDetectionResult>;
64
68
  start(ctx: ExtensionContextBase, input: {
65
69
  workspacePath: string;
@@ -76,7 +80,7 @@ export interface HarnessProvider {
76
80
  }
77
81
  export interface WorkspaceTypeProvider {
78
82
  id: string;
79
- label: string;
83
+ label: Localizable<string>;
80
84
  create(ctx: ExtensionContextBase, input: JsonObject): MaybePromise<JsonObject>;
81
85
  resolve(ctx: ExtensionContextBase, workspace: JsonObject): MaybePromise<{
82
86
  rootPath: string;
@@ -131,8 +135,11 @@ export interface UiContributions {
131
135
  routes?: Record<string, RouteContribution>;
132
136
  views?: Record<string, ViewContribution>;
133
137
  treeItems?: Record<string, TreeItemContribution>;
138
+ treeRenderers?: Record<string, TreeRendererContribution>;
134
139
  settingsPanels?: Record<string, SettingsPanelContribution>;
135
140
  dataRenderers?: Record<string, DataRendererContribution>;
141
+ commandPaletteResources?: Record<string, CommandPaletteResourceContribution>;
142
+ keybindings?: Record<string, KeybindingContribution<any>>;
136
143
  activityRenderers?: Record<string, RendererContribution>;
137
144
  sessionAnchorRenderers?: Record<string, RendererContribution>;
138
145
  }
@@ -151,6 +158,8 @@ export interface AssetContributions {
151
158
  skills?: Record<string, SkillContribution>;
152
159
  themes?: Record<string, ThemeContribution>;
153
160
  fileIconThemes?: Record<string, FileIconThemeContribution>;
161
+ translations?: Record<string, PackageAssetDescriptor>;
162
+ defaultLocale?: string;
154
163
  }
155
164
  /** Provider contributions: harnesses, workspace types. */
156
165
  export interface ProviderContributions {
@@ -7,4 +7,5 @@ export type * from "./json";
7
7
  export type * from "./params";
8
8
  export type * from "./resources";
9
9
  export type * from "./slots";
10
+ export type * from "./tree-renderer";
10
11
  export * from "./webview-capabilities";
@@ -1,6 +1,6 @@
1
1
  import type { JsonObject } from "./json";
2
2
  import type { ResourceRef } from "./resources";
3
- export type ParamType = "text" | "longtext" | "number" | "boolean" | "select" | "multi-select" | "repo" | "harness" | "template" | "resource" | "json";
3
+ export type ParamType = "text" | "longtext" | "number" | "boolean" | "select" | "multi-select" | "repo" | "harness" | "template" | "resource" | "json" | "list";
4
4
  type ParamRequired<TRequired extends boolean | undefined> = TRequired extends true ? {
5
5
  required: true;
6
6
  } : TRequired extends false ? {
@@ -63,7 +63,10 @@ export type ResourceParam<TRequired extends boolean | undefined = boolean | unde
63
63
  export type JsonParam<T = unknown, TRequired extends boolean | undefined = boolean | undefined> = ParamBase<T, TRequired> & {
64
64
  type: "json";
65
65
  };
66
- export type ParamDescriptor<TValue = unknown, TRequired extends boolean | undefined = boolean | undefined> = TextParam<TRequired> | LongTextParam<TRequired> | NumberParam<TRequired> | BooleanParam<TRequired> | SelectParam<TRequired> | MultiSelectParam<TRequired> | RepoParam<TRequired> | HarnessParam<TRequired> | TemplateParam<TRequired> | ResourceParam<TRequired> | JsonParam<TValue, TRequired>;
66
+ export type ListParam<TRequired extends boolean | undefined = boolean | undefined> = ParamBase<string[], TRequired> & {
67
+ type: "list";
68
+ };
69
+ export type ParamDescriptor<TValue = unknown, TRequired extends boolean | undefined = boolean | undefined> = TextParam<TRequired> | LongTextParam<TRequired> | NumberParam<TRequired> | BooleanParam<TRequired> | SelectParam<TRequired> | MultiSelectParam<TRequired> | RepoParam<TRequired> | HarnessParam<TRequired> | TemplateParam<TRequired> | ResourceParam<TRequired> | JsonParam<TValue, TRequired> | ListParam<TRequired>;
67
70
  export type ParamObjectSchema = Record<string, ParamDescriptor>;
68
71
  export type ParamValue<TDescriptor extends ParamDescriptor> = TDescriptor extends ParamDescriptor<infer V> ? V : never;
69
72
  type RequiredParamKeys<TSchema extends ParamObjectSchema> = {
@@ -0,0 +1,89 @@
1
+ import type { Localizable } from "../l10n";
2
+ import type { CommandRef } from "./commands";
3
+ import type { JsonObject, JsonValue } from "./json";
4
+ import type { ParamObjectSchema } from "./params";
5
+ export interface TreeRendererResourceRef {
6
+ type: string;
7
+ id: string;
8
+ projectId?: string;
9
+ label?: string;
10
+ extensionId?: string;
11
+ metadata?: JsonObject;
12
+ }
13
+ export interface TreeRendererState {
14
+ expandedNodeIds: string[];
15
+ expandedSectionIds: string[];
16
+ selectedNodeId?: string;
17
+ }
18
+ export interface TreeRendererQueryParams {
19
+ projectId?: string;
20
+ modeId?: string;
21
+ resource?: TreeRendererResourceRef;
22
+ treeId: string;
23
+ state?: TreeRendererState;
24
+ filter?: string;
25
+ }
26
+ export interface TreeRendererChildrenParams extends TreeRendererQueryParams {
27
+ node: TreeNode;
28
+ }
29
+ export interface TreeRendererActionParams extends TreeRendererQueryParams {
30
+ actionId: string;
31
+ node?: TreeNode;
32
+ }
33
+ export type TreeNodeTarget = {
34
+ kind: "command";
35
+ commandId: string;
36
+ args?: JsonObject;
37
+ } | {
38
+ kind: "resource";
39
+ resource: TreeRendererResourceRef;
40
+ } | {
41
+ kind: "view";
42
+ widgetId: string;
43
+ };
44
+ export interface TreeAction {
45
+ id: string;
46
+ label?: Localizable<string>;
47
+ icon?: string;
48
+ commandId?: string;
49
+ args?: JsonObject;
50
+ params?: ParamObjectSchema;
51
+ when?: string;
52
+ disabled?: boolean;
53
+ }
54
+ export interface TreeNode {
55
+ id: string;
56
+ label: Localizable<string>;
57
+ icon?: string;
58
+ iconColor?: string;
59
+ iconTooltip?: string;
60
+ resource?: TreeRendererResourceRef;
61
+ target?: TreeNodeTarget;
62
+ actions?: TreeAction[];
63
+ contextMenuActions?: TreeAction[];
64
+ collapsible?: boolean;
65
+ disabled?: boolean;
66
+ children?: TreeNode[];
67
+ description?: string;
68
+ contextValue?: string;
69
+ hiddenByDefault?: boolean;
70
+ metadata?: JsonObject;
71
+ }
72
+ export interface TreeViewSection {
73
+ id: string;
74
+ label?: Localizable<string>;
75
+ actions?: TreeAction[];
76
+ collapsible?: boolean;
77
+ nodes: TreeNode[];
78
+ hiddenByDefault?: boolean;
79
+ }
80
+ export interface TreeRendererContribution {
81
+ title: Localizable<string>;
82
+ icon?: string;
83
+ bodyCommand: CommandRef<TreeRendererQueryParams, TreeViewSection[]> | string;
84
+ childrenCommand?: CommandRef<TreeRendererChildrenParams, TreeNode[]> | string;
85
+ footerCommand?: CommandRef<TreeRendererQueryParams, TreeNode[]> | string;
86
+ defaultExpandedSectionIds?: string[];
87
+ defaultExpandedNodeIds?: string[];
88
+ }
89
+ export type TreeRendererCommandResult = TreeViewSection[] | TreeNode[] | JsonValue;
@@ -1,9 +1,10 @@
1
1
  import type { JsonObject } from "./json";
2
2
  import type { RepoContext, ResourceRef } from "./resources";
3
+ export type { ExtensionBlobRef } from "./context";
3
4
  export declare const WEBVIEW_HOST_CAPABILITY_VERSION = 1;
4
- export declare const WEBVIEW_DECLARABLE_CAPABILITIES: readonly ["commands.execute", "resource.open", "notification.show", "preferences.get", "preferences.set", "extension.settings.all", "extension.settings.get", "extension.settings.set", "extension.settings.delete"];
5
+ export declare const WEBVIEW_DECLARABLE_CAPABILITIES: readonly ["commands.execute", "resource.open", "notification.show", "preferences.get", "preferences.set", "extension.settings.all", "extension.settings.get", "extension.settings.set", "extension.settings.delete", "files.upload", "files.list", "files.delete"];
5
6
  export declare const ALWAYS_AVAILABLE_WEBVIEW_CAPABILITIES: readonly ["host.dispatchKeyboardEvent"];
6
- export declare const WEBVIEW_HOST_CAPABILITIES: readonly ["commands.execute", "resource.open", "notification.show", "preferences.get", "preferences.set", "extension.settings.all", "extension.settings.get", "extension.settings.set", "extension.settings.delete", "host.dispatchKeyboardEvent"];
7
+ export declare const WEBVIEW_HOST_CAPABILITIES: readonly ["commands.execute", "resource.open", "notification.show", "preferences.get", "preferences.set", "extension.settings.all", "extension.settings.get", "extension.settings.set", "extension.settings.delete", "files.upload", "files.list", "files.delete", "host.dispatchKeyboardEvent"];
7
8
  export type WebviewHostCapability = (typeof WEBVIEW_HOST_CAPABILITIES)[number];
8
9
  export type WebviewDeclarableCapability = (typeof WEBVIEW_DECLARABLE_CAPABILITIES)[number];
9
10
  export type WebviewCapabilityDeclaration = WebviewDeclarableCapability | `${WebviewDeclarableCapability}@${typeof WEBVIEW_HOST_CAPABILITY_VERSION}`;
@@ -42,6 +43,30 @@ export interface WebviewExtensionSettingKeyParams {
42
43
  export interface WebviewExtensionSettingSetParams extends WebviewExtensionSettingKeyParams {
43
44
  value: unknown;
44
45
  }
46
+ export type WebviewFileScope = {
47
+ type: "project";
48
+ } | {
49
+ type: "repo";
50
+ id: string;
51
+ } | {
52
+ type: "resource";
53
+ id: string;
54
+ } | {
55
+ type: string;
56
+ id?: string;
57
+ };
58
+ export interface WebviewFilesUploadParams {
59
+ name: string;
60
+ data: Uint8Array | ArrayBuffer;
61
+ mimeType?: string;
62
+ scope?: WebviewFileScope;
63
+ }
64
+ export interface WebviewFilesListParams {
65
+ scope?: WebviewFileScope;
66
+ }
67
+ export interface WebviewFilesDeleteParams {
68
+ id: string;
69
+ }
45
70
  export interface WebviewKeyboardEventParams {
46
71
  key?: string;
47
72
  code?: string;
@@ -61,5 +86,8 @@ export interface WebviewHostCapabilityParams {
61
86
  "extension.settings.get": WebviewExtensionSettingKeyParams;
62
87
  "extension.settings.set": WebviewExtensionSettingSetParams;
63
88
  "extension.settings.delete": WebviewExtensionSettingKeyParams;
89
+ "files.upload": WebviewFilesUploadParams;
90
+ "files.list": WebviewFilesListParams;
91
+ "files.delete": WebviewFilesDeleteParams;
64
92
  "host.dispatchKeyboardEvent": WebviewKeyboardEventParams;
65
93
  }
@@ -0,0 +1,9 @@
1
+ import type { WhenExpression } from "./types/contributions";
2
+ /**
3
+ * Resource-scoped visibility for command-palette contributions. Both the workbench host and the
4
+ * dashboard palette gate the same way, so the rule lives here once instead of being re-derived per
5
+ * surface. Only `resourceType` is evaluated: it is the sole `when` field a palette surface can
6
+ * resolve from the active resource alone (`mode`/`source`/`metadata` require execution context the
7
+ * palette does not have).
8
+ */
9
+ export declare const matchesResourceWhen: (when: Pick<WhenExpression, "resourceType"> | undefined, resourceType: string | undefined) => boolean;
@@ -1,4 +1,4 @@
1
- export declare const workbenchMenuTargets: readonly ["workbench.nav.actions", "workbench.nav.overflow", "workbench.commandPalette"];
1
+ export declare const workbenchMenuTargets: readonly ["workbench.nav.actions", "workbench.nav.overflow"];
2
2
  export declare const workbenchTreeTargets: readonly ["workbench.left.tree", "workbench.main.left.tree", "workbench.main.right.tree"];
3
3
  export declare const workbenchViewTargets: readonly ["workbench.main", "workbench.main.left", "workbench.main.right", "workbench.secondary"];
4
4
  export declare const workbenchSettingsTargets: readonly ["workbench.settings"];
@@ -30,11 +30,6 @@ export declare const workbenchTargets: readonly [{
30
30
  readonly allowedKinds: readonly ["menu"];
31
31
  readonly granularity: "surface";
32
32
  readonly rationale: "Secondary command surface in the host-owned nav (top) workbench chrome.";
33
- }, {
34
- readonly id: "workbench.commandPalette";
35
- readonly allowedKinds: readonly ["menu"];
36
- readonly granularity: "surface";
37
- readonly rationale: "Global command discovery surface owned by the workbench.";
38
33
  }, {
39
34
  readonly id: "workbench.left.tree";
40
35
  readonly allowedKinds: readonly ["treeItem"];
@@ -86,11 +81,6 @@ export declare const getWorkbenchTargetDefinition: (id: string) => {
86
81
  readonly allowedKinds: readonly ["menu"];
87
82
  readonly granularity: "surface";
88
83
  readonly rationale: "Secondary command surface in the host-owned nav (top) workbench chrome.";
89
- } | {
90
- readonly id: "workbench.commandPalette";
91
- readonly allowedKinds: readonly ["menu"];
92
- readonly granularity: "surface";
93
- readonly rationale: "Global command discovery surface owned by the workbench.";
94
84
  } | {
95
85
  readonly id: "workbench.left.tree";
96
86
  readonly allowedKinds: readonly ["treeItem"];
@@ -1,10 +1,8 @@
1
- import type { Ticket, Workspace } from "../resources";
2
- /** @deprecated Legacy core ticket hook entity. Ticket data is owned by the pstdio tickets extension. */
3
- export type HookTicket = Ticket & {
4
- status_name: string | null;
5
- };
6
- export type HookWorkspace = Workspace & {
7
- /** @deprecated Legacy ticket-workspace linkage. Ticket data is owned by the pstdio tickets extension. */
8
- ticket_shorthand: string;
9
- attempt_status_name: string | null;
1
+ import type { Workspace } from "../resources";
2
+ export type HookResourceAnchor = {
3
+ type: string;
4
+ id: string;
5
+ label?: string;
6
+ metadata?: Record<string, unknown>;
10
7
  };
8
+ export type HookWorkspace = Workspace;
@@ -1,5 +1,3 @@
1
- export type { AttemptStatusChangeContext } from "./attempt";
2
1
  export type { BaseHookContext, HookClient, HookPayload, SessionFollowupInput } from "./base";
3
2
  export type { SessionHookContext } from "./session";
4
- export type { TicketContext, TicketCreationContext, TicketStatusChangeContext } from "./ticket";
5
3
  export type { CommitContext, ConflictContext, MergeContext, RebaseContext, WorktreeContext, WorktreeCreateContext, WorktreeRemoveContext, } from "./worktree";
@@ -1,5 +1,5 @@
1
1
  import type { BaseHookContext } from "./base";
2
- import type { HookTicket, HookWorkspace } from "./entities";
2
+ import type { HookResourceAnchor, HookWorkspace } from "./entities";
3
3
  export type SessionHookContext = BaseHookContext & {
4
4
  sessionId: string;
5
5
  sessionStatus: "in_progress" | "awaiting_input" | "queued" | "completed" | "failed" | "cancelled" | "disconnected";
@@ -8,6 +8,5 @@ export type SessionHookContext = BaseHookContext & {
8
8
  workspaceId?: string;
9
9
  worktreePath?: string;
10
10
  branch?: string;
11
- ticket?: HookTicket;
12
- attemptStatus?: string;
11
+ anchors?: HookResourceAnchor[];
13
12
  };