@pstdio/sdk 0.7.0 → 0.9.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 (74) hide show
  1. package/README.md +27 -188
  2. package/dist/api/extensions.d.ts +1 -1
  3. package/dist/api/index.d.ts +2 -2
  4. package/dist/api/settings.d.ts +1 -0
  5. package/dist/api/statuses.d.ts +1 -0
  6. package/dist/api/tags.d.ts +1 -0
  7. package/dist/api/tickets.d.ts +3 -0
  8. package/dist/api/workspaces.d.ts +10 -1
  9. package/dist/client/client.d.ts +7 -2
  10. package/dist/client/index.d.ts +5 -3
  11. package/dist/client/index.js +285 -31
  12. package/dist/client/projects.d.ts +0 -11
  13. package/dist/client/request.d.ts +9 -0
  14. package/dist/client/sessions.d.ts +25 -3
  15. package/dist/client/settings.d.ts +7 -0
  16. package/dist/client/sse.d.ts +15 -0
  17. package/dist/client/statuses.d.ts +2 -0
  18. package/dist/client/sync.d.ts +35 -0
  19. package/dist/client/tags.d.ts +2 -0
  20. package/dist/client/tickets.d.ts +6 -1
  21. package/dist/client/workspaces.d.ts +2 -0
  22. package/dist/extensions/define-command.d.ts +1 -1
  23. package/dist/extensions/define-extension.d.ts +50 -7
  24. package/dist/extensions/index.d.ts +3 -2
  25. package/dist/extensions/index.js +151 -11
  26. package/dist/extensions/kernel-slots.d.ts +131 -10
  27. package/dist/extensions/params.d.ts +19 -12
  28. package/dist/extensions/refs.d.ts +3 -3
  29. package/dist/extensions/slots.d.ts +1 -9
  30. package/dist/extensions/types/commands.d.ts +8 -0
  31. package/dist/extensions/types/context.d.ts +225 -18
  32. package/dist/extensions/types/contributions.d.ts +183 -10
  33. package/dist/extensions/types/extension.d.ts +16 -10
  34. package/dist/extensions/types/params.d.ts +43 -29
  35. package/dist/extensions/types/slots.d.ts +1 -1
  36. package/dist/extensions/types/webview-capabilities.d.ts +12 -2
  37. package/dist/extensions/workbench-targets.d.ts +134 -0
  38. package/dist/hooks/attempt.d.ts +2 -0
  39. package/dist/hooks/entities.d.ts +2 -0
  40. package/dist/hooks/ticket.d.ts +3 -0
  41. package/dist/resources/index.d.ts +3 -0
  42. package/dist/resources/index.js +26 -0
  43. package/dist/resources/known-agents.d.ts +12 -0
  44. package/dist/resources/settings.d.ts +1 -0
  45. package/dist/resources/status.d.ts +1 -0
  46. package/dist/resources/tag.d.ts +1 -0
  47. package/dist/resources/ticket.d.ts +1 -0
  48. package/dist/resources/workspace.d.ts +4 -1
  49. package/package.json +2 -6
  50. package/dist/api/actions.d.ts +0 -13
  51. package/dist/client/actions.d.ts +0 -8
  52. package/dist/plugins/define-plugin.d.ts +0 -2
  53. package/dist/plugins/helpers/context.d.ts +0 -24
  54. package/dist/plugins/helpers/create-attempt.d.ts +0 -5
  55. package/dist/plugins/helpers/create-session.d.ts +0 -21
  56. package/dist/plugins/helpers/create-workspace.d.ts +0 -5
  57. package/dist/plugins/helpers/find-ticket-by-ref.d.ts +0 -6
  58. package/dist/plugins/helpers/find-workspace-by-ref.d.ts +0 -5
  59. package/dist/plugins/helpers/followup-session.d.ts +0 -29
  60. package/dist/plugins/helpers/get-attempts-for-ticket.d.ts +0 -17
  61. package/dist/plugins/helpers/index.d.ts +0 -16
  62. package/dist/plugins/helpers/remove-all-worktrees-for-ticket.d.ts +0 -2
  63. package/dist/plugins/helpers/run-command.d.ts +0 -10
  64. package/dist/plugins/helpers/save-ticket.d.ts +0 -14
  65. package/dist/plugins/helpers/set-ticket-status.d.ts +0 -7
  66. package/dist/plugins/helpers/set-workspace-attempt-status.d.ts +0 -7
  67. package/dist/plugins/helpers/ticket-pull.d.ts +0 -18
  68. package/dist/plugins/helpers/update-ticket-when-all-attempts-match.d.ts +0 -7
  69. package/dist/plugins/helpers/workspaces-for-ticket.d.ts +0 -17
  70. package/dist/plugins/helpers/worktree-bootstrap.d.ts +0 -8
  71. package/dist/plugins/hooks.d.ts +0 -42
  72. package/dist/plugins/index.d.ts +0 -5
  73. package/dist/plugins/index.js +0 -739
  74. package/dist/plugins/types.d.ts +0 -112
@@ -1,15 +1,58 @@
1
- import type { ExtensionDefinition } from "./types/extension";
2
- type ExactExtensionDefinition<TExtension extends ExtensionDefinition> = TExtension & Record<Exclude<keyof TExtension, keyof ExtensionDefinition>, never>;
1
+ import type { ExtensionSettingProperty, ExtensionSettingsContribution } from "./types/contributions";
2
+ import type { CommandDefinition, ExtensionDefinition, HookDefinition, MiddlewareDefinition, ScheduleContribution } from "./types/extension";
3
+ import type { Struct } from "./types/json";
4
+ import type { ParamObjectSchema } from "./types/params";
5
+ type CommandSchemas = Record<string, ParamObjectSchema | undefined>;
6
+ type MiddlewareParams = Record<string, Struct>;
7
+ type MiddlewareResults = Record<string, unknown>;
8
+ type HookPayloads = Record<string, Struct>;
9
+ type EmptyMap = Record<string, never>;
10
+ type SettingProperties = Record<string, ExtensionSettingProperty>;
11
+ type EmptySettings = Record<string, never>;
12
+ type SettingValue<TProperty> = TProperty extends {
13
+ type: "boolean";
14
+ } ? boolean : TProperty extends {
15
+ type: "number";
16
+ } ? number : TProperty extends {
17
+ type: "string";
18
+ } ? string : TProperty extends {
19
+ type: "array";
20
+ } ? unknown[] : TProperty extends {
21
+ type: "object";
22
+ } ? Record<string, unknown> : unknown;
23
+ type SettingsMap<TSettings> = TSettings extends {
24
+ properties: infer TProperties;
25
+ } ? {
26
+ [K in keyof TProperties & string]: SettingValue<TProperties[K]>;
27
+ } : EmptySettings;
28
+ type CommandDefinitions<TSchemas extends CommandSchemas, TSettings extends Record<string, unknown>> = {
29
+ [K in keyof TSchemas]: CommandDefinition<TSchemas[K], unknown, TSettings>;
30
+ };
31
+ type MiddlewareDefinitions<TParams extends MiddlewareParams, TResults extends MiddlewareResults> = {
32
+ [K in keyof TParams]: MiddlewareDefinition<TParams[K], K extends keyof TResults ? TResults[K] : unknown>;
33
+ };
34
+ type HookDefinitions<TPayloads extends HookPayloads> = {
35
+ [K in keyof TPayloads]: HookDefinition<TPayloads[K]>;
36
+ };
37
+ type ExtensionAuthoringDefinition<TCommandSchemas extends CommandSchemas, TMiddlewareParams extends MiddlewareParams, TMiddlewareResults extends MiddlewareResults, THookPayloads extends HookPayloads, TScheduleParams extends MiddlewareParams, TSettings extends ExtensionSettingsContribution<SettingProperties> | undefined> = Omit<ExtensionDefinition, "commands" | "middlewares" | "hooks" | "schedules" | "settings"> & {
38
+ settings?: TSettings;
39
+ commands?: CommandDefinitions<TCommandSchemas, SettingsMap<TSettings>>;
40
+ middlewares?: MiddlewareDefinitions<TMiddlewareParams, TMiddlewareResults>;
41
+ hooks?: HookDefinitions<THookPayloads>;
42
+ schedules?: {
43
+ [K in keyof TScheduleParams]: ScheduleContribution<TScheduleParams[K]>;
44
+ };
45
+ };
3
46
  /**
4
- * Identity helper that preserves the literal type of the passed contributions. Authors
5
- * get full autocomplete on contributions, and `commandsOf(packageName, ext)` can derive typed refs
6
- * from the returned definition. Extension identity (id, name, version, description,
7
- * publisher, engines.pstdio) lives in package.json.
47
+ * Identity helper that types the passed contributions. Authors get autocomplete on
48
+ * contributions, and `commandsOf(packageName, ext)` can derive typed refs from the
49
+ * returned definition. Extension identity (id, name, version, description, publisher,
50
+ * engines.pstdio) lives in package.json.
8
51
  *
9
52
  * @example
10
53
  * export default defineExtension({
11
54
  * commands: { ... },
12
55
  * });
13
56
  */
14
- export declare const defineExtension: <const TExtension extends ExtensionDefinition>(extension: ExactExtensionDefinition<TExtension>) => TExtension;
57
+ export declare const defineExtension: <const TCommandSchemas extends CommandSchemas = EmptyMap, const TMiddlewareParams extends MiddlewareParams = EmptyMap, const TMiddlewareResults extends MiddlewareResults = MiddlewareResults, const THookPayloads extends HookPayloads = EmptyMap, const TScheduleParams extends MiddlewareParams = EmptyMap, const TSettings extends ExtensionSettingsContribution<SettingProperties> | undefined = undefined>(extension: ExtensionAuthoringDefinition<TCommandSchemas, TMiddlewareParams, TMiddlewareResults, THookPayloads, TScheduleParams, TSettings>) => ExtensionAuthoringDefinition<TCommandSchemas, TMiddlewareParams, TMiddlewareResults, THookPayloads, TScheduleParams, TSettings> & ExtensionDefinition;
15
58
  export {};
@@ -1,11 +1,12 @@
1
1
  export { defineCommand, defineHook, defineMiddleware } from "./define-command";
2
2
  export { defineExtension } from "./define-extension";
3
3
  export { defineExtensionView, type ExtensionViewModule, type ExtensionViewRender, type ExtensionViewRenderContext, type GuestHost, type PropsStore, } from "./define-extension-view";
4
- export { projectEvents, projectSlots, sessionEvents, sessionSlots, workspaceEvents, workspaceSlots, } from "./kernel-slots";
4
+ export type { AttemptStatusChangePayload, CommitPayload, ConflictPayload, MergePayload, RebasePayload, SessionLifecyclePayload, TicketArchivedEventPayload, TicketLifecyclePayload, TicketStatusChangePayload, WorktreeCreatedEventPayload, WorktreeRemovedPayload, } from "./kernel-slots";
5
+ export { attemptStatusEvents, gitEvents, projectEvents, projectSlots, sessionEvents, sessionSlots, ticketEvents, ticketSlots, workspaceCommands, workspaceEvents, workspaceSlots, worktreeEvents, } from "./kernel-slots";
5
6
  export { packageAsset } from "./package-asset";
6
7
  export { params } from "./params";
7
8
  export { commandEvent, commandRef, commandsOf, eventRef } from "./refs";
8
- export { defineSlot } from "./slots";
9
9
  export type * from "./types";
10
10
  export { EXTENSION_API_VERSION } from "./types/extension";
11
11
  export { ALWAYS_AVAILABLE_WEBVIEW_CAPABILITIES, WEBVIEW_DECLARABLE_CAPABILITIES, WEBVIEW_HOST_CAPABILITIES, WEBVIEW_HOST_CAPABILITY_VERSION, } from "./types/webview-capabilities";
12
+ export { getWorkbenchTargetDefinition, type WorkbenchAttachmentTarget, type WorkbenchContributionKind, type WorkbenchLayoutTarget, type WorkbenchMenuTarget, type WorkbenchModeLayoutTarget, type WorkbenchSettingsScope, type WorkbenchSettingsTarget, type WorkbenchTargetDefinition, type WorkbenchTargetGranularity, type WorkbenchTreeTarget, type WorkbenchViewTarget, workbenchMenuTargets, workbenchModeLayoutTargets, workbenchSettingsScopes, workbenchSettingsTargets, workbenchTargets, workbenchTreeTargets, workbenchViewTargets, } from "./workbench-targets";
@@ -37,7 +37,6 @@ var defineSlot = (id, options) => ({
37
37
 
38
38
  // src/extensions/kernel-slots.ts
39
39
  var projectSlots = {
40
- sidebarNav: defineSlot("project.sidebarNav", { kind: "navigation" }),
41
40
  sidebar: defineSlot("project.sidebar", { kind: "view" }),
42
41
  headerPrimary: defineSlot("project.headerPrimary", { kind: "menu" }),
43
42
  headerOverflow: defineSlot("project.headerOverflow", { kind: "menu" }),
@@ -49,10 +48,13 @@ var sessionSlots = {
49
48
  headerOverflow: defineSlot("session.headerOverflow", { kind: "menu" }),
50
49
  transcriptActions: defineSlot("session.transcriptActions", { kind: "menu" })
51
50
  };
51
+ var ticketSlots = {
52
+ headerPrimary: defineSlot("ticket.headerPrimary", { kind: "menu" }),
53
+ headerOverflow: defineSlot("ticket.headerOverflow", { kind: "menu" })
54
+ };
52
55
  var workspaceSlots = {
53
56
  headerPrimary: defineSlot("workspace.headerPrimary", { kind: "menu" }),
54
57
  headerOverflow: defineSlot("workspace.headerOverflow", { kind: "menu" }),
55
- tabs: defineSlot("workspace.tabs", { kind: "navigation" }),
56
58
  sidebar: defineSlot("workspace.sidebar", { kind: "view" })
57
59
  };
58
60
  var projectEvents = {
@@ -60,13 +62,39 @@ var projectEvents = {
60
62
  };
61
63
  var sessionEvents = {
62
64
  started: eventRef("session.started"),
65
+ resumed: eventRef("session.resumed"),
66
+ awaitingInput: eventRef("session.awaitingInput"),
67
+ succeeded: eventRef("session.succeeded"),
68
+ failed: eventRef("session.failed"),
63
69
  completed: eventRef("session.completed")
64
70
  };
71
+ var ticketEvents = {
72
+ created: eventRef("ticket.created"),
73
+ statusChanged: eventRef("ticket.statusChanged"),
74
+ archived: eventRef("ticket.archived"),
75
+ deleted: eventRef("ticket.deleted")
76
+ };
65
77
  var workspaceEvents = {
66
78
  created: eventRef("workspace.created"),
67
79
  archived: eventRef("workspace.archived"),
68
80
  deleted: eventRef("workspace.deleted")
69
81
  };
82
+ var worktreeEvents = {
83
+ created: eventRef("worktree.created"),
84
+ removed: eventRef("worktree.removed")
85
+ };
86
+ var gitEvents = {
87
+ committed: eventRef("git.committed"),
88
+ rebased: eventRef("git.rebased"),
89
+ merged: eventRef("git.merged"),
90
+ conflicted: eventRef("git.conflicted")
91
+ };
92
+ var attemptStatusEvents = {
93
+ changed: eventRef("attemptStatus.changed")
94
+ };
95
+ var workspaceCommands = {
96
+ setAttemptStatus: commandRef("kernel.workspace.setAttemptStatus")
97
+ };
70
98
  // src/extensions/package-asset.ts
71
99
  var packageAsset = (path, baseUrl) => ({
72
100
  kind: "package-asset",
@@ -75,17 +103,17 @@ var packageAsset = (path, baseUrl) => ({
75
103
  });
76
104
  // src/extensions/params.ts
77
105
  var params = {
78
- text: (options = {}) => ({ type: "text", ...options }),
79
- longText: (options = {}) => ({ type: "longtext", ...options }),
80
- number: (options = {}) => ({ type: "number", ...options }),
81
- boolean: (options = {}) => ({ type: "boolean", ...options }),
106
+ text: (options) => ({ type: "text", ...options }),
107
+ longText: (options) => ({ type: "longtext", ...options }),
108
+ number: (options) => ({ type: "number", ...options }),
109
+ boolean: (options) => ({ type: "boolean", ...options }),
82
110
  select: (options) => ({ type: "select", ...options }),
83
111
  multiSelect: (options) => ({
84
112
  type: "multi-select",
85
113
  ...options
86
114
  }),
87
- repo: (options = {}) => ({ type: "repo", ...options }),
88
- harness: (options = {}) => ({ type: "harness", ...options }),
115
+ repo: (options) => ({ type: "repo", ...options }),
116
+ harness: (options) => ({ type: "harness", ...options }),
89
117
  template: (options) => ({
90
118
  label: options.label,
91
119
  description: options.description,
@@ -96,7 +124,7 @@ var params = {
96
124
  templateType: options.type
97
125
  }),
98
126
  resource: (options) => ({ type: "resource", ...options }),
99
- json: (options = {}) => ({ type: "json", ...options })
127
+ json: (options) => ({ type: "json", ...options })
100
128
  };
101
129
  // src/extensions/types/extension.ts
102
130
  var EXTENSION_API_VERSION = "1.0.0";
@@ -107,24 +135,135 @@ var WEBVIEW_DECLARABLE_CAPABILITIES = [
107
135
  "resource.open",
108
136
  "notification.show",
109
137
  "preferences.get",
110
- "preferences.set"
138
+ "preferences.set",
139
+ "extension.settings.all",
140
+ "extension.settings.get",
141
+ "extension.settings.set",
142
+ "extension.settings.delete"
111
143
  ];
112
144
  var ALWAYS_AVAILABLE_WEBVIEW_CAPABILITIES = ["host.dispatchKeyboardEvent"];
113
145
  var WEBVIEW_HOST_CAPABILITIES = [
114
146
  ...WEBVIEW_DECLARABLE_CAPABILITIES,
115
147
  ...ALWAYS_AVAILABLE_WEBVIEW_CAPABILITIES
116
148
  ];
149
+ // src/extensions/workbench-targets.ts
150
+ var workbenchMenuTargets = [
151
+ "workbench.top.actions",
152
+ "workbench.top.overflow",
153
+ "workbench.commandPalette"
154
+ ];
155
+ var workbenchTreeTargets = [
156
+ "workbench.left.tree",
157
+ "workbench.main.left.tree",
158
+ "workbench.main.right.tree"
159
+ ];
160
+ var workbenchViewTargets = [
161
+ "workbench.main",
162
+ "workbench.main.left",
163
+ "workbench.main.right",
164
+ "workbench.main.bottom"
165
+ ];
166
+ var workbenchSettingsTargets = ["workbench.settings"];
167
+ var workbenchSettingsScopes = ["project", "global"];
168
+ var workbenchModeLayoutTargets = [
169
+ "workbench.left",
170
+ "workbench.main.left",
171
+ "workbench.main",
172
+ "workbench.main.right",
173
+ "workbench.main.bottom"
174
+ ];
175
+ var workbenchTargets = [
176
+ {
177
+ id: "workbench.top.actions",
178
+ allowedKinds: ["menu"],
179
+ granularity: "surface",
180
+ rationale: "Primary command surface in the host-owned top workbench chrome."
181
+ },
182
+ {
183
+ id: "workbench.top.overflow",
184
+ allowedKinds: ["menu"],
185
+ granularity: "surface",
186
+ rationale: "Secondary command surface in the host-owned top workbench chrome."
187
+ },
188
+ {
189
+ id: "workbench.commandPalette",
190
+ allowedKinds: ["menu"],
191
+ granularity: "surface",
192
+ rationale: "Global command discovery surface owned by the workbench."
193
+ },
194
+ {
195
+ id: "workbench.left.tree",
196
+ allowedKinds: ["treeItem"],
197
+ granularity: "areaTree",
198
+ rationale: "Tree entries for the active tree renderer mounted in the left area."
199
+ },
200
+ {
201
+ id: "workbench.main.left.tree",
202
+ allowedKinds: ["treeItem"],
203
+ granularity: "areaTree",
204
+ rationale: "Tree entries for the active tree renderer mounted in the main-left area."
205
+ },
206
+ {
207
+ id: "workbench.main.right.tree",
208
+ allowedKinds: ["treeItem"],
209
+ granularity: "areaTree",
210
+ rationale: "Tree entries for the active tree renderer mounted in the main-right area."
211
+ },
212
+ {
213
+ id: "workbench.main",
214
+ allowedKinds: ["view"],
215
+ granularity: "area",
216
+ rationale: "Direct extension view placement in the main area."
217
+ },
218
+ {
219
+ id: "workbench.main.left",
220
+ allowedKinds: ["view"],
221
+ granularity: "area",
222
+ rationale: "Direct extension view placement in the main-left area."
223
+ },
224
+ {
225
+ id: "workbench.main.right",
226
+ allowedKinds: ["view"],
227
+ granularity: "area",
228
+ rationale: "Direct extension view placement in the main-right area."
229
+ },
230
+ {
231
+ id: "workbench.main.bottom",
232
+ allowedKinds: ["view"],
233
+ granularity: "area",
234
+ rationale: "Direct extension view placement in the main-bottom area."
235
+ },
236
+ {
237
+ id: "workbench.settings",
238
+ allowedKinds: ["settings"],
239
+ granularity: "surface",
240
+ rationale: "Settings panel placement in host-owned settings navigation."
241
+ }
242
+ ];
243
+ var getWorkbenchTargetDefinition = (id) => workbenchTargets.find((target) => target.id === id);
117
244
  export {
245
+ worktreeEvents,
118
246
  workspaceSlots,
119
247
  workspaceEvents,
248
+ workspaceCommands,
249
+ workbenchViewTargets,
250
+ workbenchTreeTargets,
251
+ workbenchTargets,
252
+ workbenchSettingsTargets,
253
+ workbenchSettingsScopes,
254
+ workbenchModeLayoutTargets,
255
+ workbenchMenuTargets,
256
+ ticketSlots,
257
+ ticketEvents,
120
258
  sessionSlots,
121
259
  sessionEvents,
122
260
  projectSlots,
123
261
  projectEvents,
124
262
  params,
125
263
  packageAsset,
264
+ gitEvents,
265
+ getWorkbenchTargetDefinition,
126
266
  eventRef,
127
- defineSlot,
128
267
  defineMiddleware,
129
268
  defineHook,
130
269
  defineExtensionView,
@@ -133,6 +272,7 @@ export {
133
272
  commandsOf,
134
273
  commandRef,
135
274
  commandEvent,
275
+ attemptStatusEvents,
136
276
  WEBVIEW_HOST_CAPABILITY_VERSION,
137
277
  WEBVIEW_HOST_CAPABILITIES,
138
278
  WEBVIEW_DECLARABLE_CAPABILITIES,
@@ -1,7 +1,98 @@
1
- import type { JsonObject } from "./types/json";
1
+ import type { ExtensionTicket, ExtensionWorkspace, SetAttemptStatusInput, SetAttemptStatusResult } from "./types/context";
2
2
  import type { ResourceAnchor } from "./types/resources";
3
+ /** @deprecated Legacy core ticket event payload. Ticket events are owned by the pstdio tickets extension. */
4
+ export interface TicketArchivedEventPayload {
5
+ projectId: string;
6
+ ticket: ExtensionTicket;
7
+ }
8
+ export interface WorktreeCreatedEventPayload {
9
+ projectId: string;
10
+ repoPath: string;
11
+ worktreePath: string;
12
+ branch: string;
13
+ workspace: string;
14
+ workspaceId: string;
15
+ /** @deprecated Legacy ticket worktree linkage. Ticket worktree setup is owned by the pstdio tickets extension. */
16
+ ticket: string;
17
+ }
18
+ /** @deprecated Legacy core ticket event payload. Ticket events are owned by the pstdio tickets extension. */
19
+ export interface TicketLifecyclePayload {
20
+ projectId: string;
21
+ ticket: ExtensionTicket;
22
+ }
23
+ /** @deprecated Legacy core ticket event payload. Ticket events are owned by the pstdio tickets extension. */
24
+ export interface TicketStatusChangePayload {
25
+ projectId: string;
26
+ ticket: ExtensionTicket;
27
+ fromStatus: string | null;
28
+ toStatus: string | null;
29
+ }
30
+ export interface AttemptStatusChangePayload {
31
+ projectId: string;
32
+ workspaceId: string;
33
+ /** @deprecated Legacy ticket attempt linkage. Ticket data is owned by the pstdio tickets extension. */
34
+ ticket: ExtensionTicket | null;
35
+ fromStatus: string | null;
36
+ toStatus: string;
37
+ statusChangeId?: string;
38
+ sessionId: string | null;
39
+ originalSessionId: string | null;
40
+ worktreePath: string | null;
41
+ workspace: ExtensionWorkspace;
42
+ }
43
+ export interface SessionLifecyclePayload {
44
+ projectId: string;
45
+ sessionId: string;
46
+ sessionStatus?: string;
47
+ originalSessionId?: string;
48
+ workspace?: ExtensionWorkspace;
49
+ workspaceId?: string;
50
+ worktreePath?: string;
51
+ branch?: string;
52
+ /** @deprecated Legacy ticket session linkage. Ticket data is owned by the pstdio tickets extension. */
53
+ ticket?: ExtensionTicket;
54
+ attemptStatus?: string;
55
+ }
56
+ export interface WorktreeRemovedPayload {
57
+ projectId: string;
58
+ repoPath?: string;
59
+ worktreePath: string;
60
+ workspace?: ExtensionWorkspace;
61
+ workspaceId?: string;
62
+ /** @deprecated Legacy ticket worktree linkage. Ticket data is owned by the pstdio tickets extension. */
63
+ ticket?: ExtensionTicket | string;
64
+ }
65
+ export interface CommitPayload {
66
+ projectId: string;
67
+ repoPath?: string;
68
+ worktreePath?: string;
69
+ branch?: string;
70
+ commitSha?: string;
71
+ workspace?: ExtensionWorkspace;
72
+ /** @deprecated Legacy ticket git linkage. Ticket data is owned by the pstdio tickets extension. */
73
+ ticket?: ExtensionTicket | string;
74
+ }
75
+ export interface RebasePayload {
76
+ projectId: string;
77
+ repoPath?: string;
78
+ worktreePath?: string;
79
+ branch?: string;
80
+ workspace?: ExtensionWorkspace;
81
+ ticket?: ExtensionTicket | string;
82
+ }
83
+ export interface MergePayload extends CommitPayload {
84
+ }
85
+ export interface ConflictPayload {
86
+ projectId: string;
87
+ operation: "rebase" | "merge";
88
+ repoPath?: string;
89
+ worktreePath?: string;
90
+ branch?: string;
91
+ workspace?: ExtensionWorkspace;
92
+ /** @deprecated Legacy ticket git linkage. Ticket data is owned by the pstdio tickets extension. */
93
+ ticket?: ExtensionTicket | string;
94
+ }
3
95
  export declare const projectSlots: {
4
- sidebarNav: import("./types").SlotRef<object, "navigation">;
5
96
  sidebar: import("./types").SlotRef<object, "view">;
6
97
  headerPrimary: import("./types").SlotRef<object, "menu">;
7
98
  headerOverflow: import("./types").SlotRef<object, "menu">;
@@ -13,10 +104,14 @@ export declare const sessionSlots: {
13
104
  headerOverflow: import("./types").SlotRef<object, "menu">;
14
105
  transcriptActions: import("./types").SlotRef<object, "menu">;
15
106
  };
107
+ /** @deprecated Legacy core ticket slots. Ticket UI contributions are owned by the pstdio tickets extension. */
108
+ export declare const ticketSlots: {
109
+ headerPrimary: import("./types").SlotRef<object, "menu">;
110
+ headerOverflow: import("./types").SlotRef<object, "menu">;
111
+ };
16
112
  export declare const workspaceSlots: {
17
113
  headerPrimary: import("./types").SlotRef<object, "menu">;
18
114
  headerOverflow: import("./types").SlotRef<object, "menu">;
19
- tabs: import("./types").SlotRef<object, "navigation">;
20
115
  sidebar: import("./types").SlotRef<object, "view">;
21
116
  };
22
117
  export declare const projectEvents: {
@@ -25,23 +120,49 @@ export declare const projectEvents: {
25
120
  }>;
26
121
  };
27
122
  export declare const sessionEvents: {
28
- started: import("./types").EventRef<{
29
- sessionId: string;
123
+ started: import("./types").EventRef<SessionLifecyclePayload & {
30
124
  anchors?: ResourceAnchor[];
31
125
  }>;
32
- completed: import("./types").EventRef<{
33
- sessionId: string;
126
+ resumed: import("./types").EventRef<SessionLifecyclePayload>;
127
+ awaitingInput: import("./types").EventRef<SessionLifecyclePayload>;
128
+ succeeded: import("./types").EventRef<SessionLifecyclePayload>;
129
+ failed: import("./types").EventRef<SessionLifecyclePayload>;
130
+ completed: import("./types").EventRef<SessionLifecyclePayload & {
34
131
  anchors?: ResourceAnchor[];
35
132
  }>;
36
133
  };
134
+ /** @deprecated Legacy core ticket events. Ticket events are owned by the pstdio tickets extension. */
135
+ export declare const ticketEvents: {
136
+ created: import("./types").EventRef<TicketLifecyclePayload>;
137
+ statusChanged: import("./types").EventRef<TicketStatusChangePayload>;
138
+ archived: import("./types").EventRef<TicketArchivedEventPayload>;
139
+ deleted: import("./types").EventRef<TicketLifecyclePayload>;
140
+ };
37
141
  export declare const workspaceEvents: {
38
142
  created: import("./types").EventRef<{
39
- workspace: JsonObject;
143
+ workspace: ExtensionWorkspace;
40
144
  }>;
41
145
  archived: import("./types").EventRef<{
42
- workspace: JsonObject;
146
+ workspace: ExtensionWorkspace;
43
147
  }>;
44
148
  deleted: import("./types").EventRef<{
45
- workspace: JsonObject;
149
+ workspace: ExtensionWorkspace;
46
150
  }>;
47
151
  };
152
+ export declare const worktreeEvents: {
153
+ created: import("./types").EventRef<WorktreeCreatedEventPayload>;
154
+ removed: import("./types").EventRef<WorktreeRemovedPayload>;
155
+ };
156
+ export declare const gitEvents: {
157
+ committed: import("./types").EventRef<CommitPayload>;
158
+ rebased: import("./types").EventRef<RebasePayload>;
159
+ merged: import("./types").EventRef<MergePayload>;
160
+ conflicted: import("./types").EventRef<ConflictPayload>;
161
+ };
162
+ /** @deprecated Legacy ticket attempt status events. Workspace status automation is extension-owned. */
163
+ export declare const attemptStatusEvents: {
164
+ changed: import("./types").EventRef<AttemptStatusChangePayload>;
165
+ };
166
+ export declare const workspaceCommands: {
167
+ setAttemptStatus: import("./types").CommandRef<SetAttemptStatusInput, SetAttemptStatusResult>;
168
+ };
@@ -1,4 +1,10 @@
1
1
  import type { BooleanParam, HarnessParam, JsonParam, LongTextParam, MultiSelectParam, NumberParam, RepoParam, ResourceParam, SelectParam, TemplateParam, TextParam } from "./types/params";
2
+ type RequiredOf<TOptions> = TOptions extends {
3
+ required: infer TRequired extends boolean;
4
+ } ? TRequired : undefined;
5
+ type ParamOptions<TParam extends {
6
+ type: string;
7
+ }> = Omit<TParam, "type">;
2
8
  /**
3
9
  * Builders for typed parameter descriptors. Each builder produces a discriminated
4
10
  * `ParamDescriptor` so the runtime and editor only see fields valid for that type.
@@ -10,17 +16,18 @@ import type { BooleanParam, HarnessParam, JsonParam, LongTextParam, MultiSelectP
10
16
  * }
11
17
  */
12
18
  export declare const params: {
13
- text: (options?: Omit<TextParam, "type">) => TextParam;
14
- longText: (options?: Omit<LongTextParam, "type">) => LongTextParam;
15
- number: (options?: Omit<NumberParam, "type">) => NumberParam;
16
- boolean: (options?: Omit<BooleanParam, "type">) => BooleanParam;
17
- select: (options: Omit<SelectParam, "type">) => SelectParam;
18
- multiSelect: (options: Omit<MultiSelectParam, "type">) => MultiSelectParam;
19
- repo: (options?: Omit<RepoParam, "type">) => RepoParam;
20
- harness: (options?: Omit<HarnessParam, "type">) => HarnessParam;
21
- template: (options: Omit<TemplateParam, "type" | "templateType"> & {
19
+ text: <const TOptions extends ParamOptions<TextParam> | undefined = undefined>(options?: TOptions) => TextParam<RequiredOf<TOptions>>;
20
+ longText: <const TOptions extends ParamOptions<LongTextParam> | undefined = undefined>(options?: TOptions) => LongTextParam<RequiredOf<TOptions>>;
21
+ number: <const TOptions extends ParamOptions<NumberParam> | undefined = undefined>(options?: TOptions) => NumberParam<RequiredOf<TOptions>>;
22
+ boolean: <const TOptions extends ParamOptions<BooleanParam> | undefined = undefined>(options?: TOptions) => BooleanParam<RequiredOf<TOptions>>;
23
+ select: <const TOptions extends ParamOptions<SelectParam>>(options: TOptions) => SelectParam<RequiredOf<TOptions>>;
24
+ multiSelect: <const TOptions extends ParamOptions<MultiSelectParam>>(options: TOptions) => MultiSelectParam<RequiredOf<TOptions>>;
25
+ repo: <const TOptions extends ParamOptions<RepoParam> | undefined = undefined>(options?: TOptions) => RepoParam<RequiredOf<TOptions>>;
26
+ harness: <const TOptions extends ParamOptions<HarnessParam> | undefined = undefined>(options?: TOptions) => HarnessParam<RequiredOf<TOptions>>;
27
+ template: <const TOptions extends Omit<TemplateParam, "type" | "templateType"> & {
22
28
  type: string;
23
- }) => TemplateParam;
24
- resource: (options: Omit<ResourceParam, "type">) => ResourceParam;
25
- json: <T = unknown>(options?: Omit<JsonParam<T>, "type">) => JsonParam<T>;
29
+ }>(options: TOptions) => TemplateParam<RequiredOf<TOptions>>;
30
+ resource: <const TOptions extends ParamOptions<ResourceParam>>(options: TOptions) => ResourceParam<RequiredOf<TOptions>>;
31
+ json: <T = unknown, const TOptions extends ParamOptions<JsonParam<T>> | undefined = undefined>(options?: TOptions) => JsonParam<T, RequiredOf<TOptions>>;
26
32
  };
33
+ export {};
@@ -17,8 +17,8 @@ export declare const eventRef: <TPayload extends Struct = Struct>(id: string) =>
17
17
  * the correct shape.
18
18
  */
19
19
  export declare const commandEvent: <TPhase extends CommandLifecyclePhase, TParams extends Struct = Struct, TResult = unknown>(command: CommandRef<TParams, TResult>, phase: TPhase) => EventRef<CommandLifecycleEventPayload<TPhase, TParams, TResult>>;
20
- type CommandsRecord = Record<string, CommandDefinition<any, any>>;
21
- type CommandRefFromDefinition<TDefinition> = TDefinition extends CommandDefinition<infer TSchema, infer TResult> ? CommandRef<TSchema extends ParamObjectSchema ? ParamsOf<TSchema> : Struct, TResult> : never;
20
+ type CommandsRecord = Record<string, CommandDefinition<any, any, any>>;
21
+ type CommandRefFromDefinition<TDefinition> = TDefinition extends CommandDefinition<infer TSchema, infer TResult, infer _TSettings> ? CommandRef<TSchema extends ParamObjectSchema ? ParamsOf<TSchema> : Struct, TResult> : never;
22
22
  type CommandsRefMap<TCommands extends CommandsRecord> = {
23
23
  [K in keyof TCommands]: CommandRefFromDefinition<TCommands[K]>;
24
24
  };
@@ -32,7 +32,7 @@ type CommandsRefMap<TCommands extends CommandsRecord> = {
32
32
  * @example
33
33
  * const ext = defineExtension({ commands: { ... } });
34
34
  * const labCommands = commandsOf("extension-lab", ext);
35
- * labCommands.awaken; // CommandRef<{ title: string }, ...>
35
+ * labCommands.awaken; // CommandRef<{ title?: string }, ...>
36
36
  */
37
37
  export declare const commandsOf: <TExtension extends {
38
38
  commands?: CommandsRecord;
@@ -1,14 +1,6 @@
1
1
  import type { Struct } from "./types/json";
2
2
  import type { SlotOptions, SlotRef, UiSlotKind } from "./types/slots";
3
3
  /**
4
- * Define a UI slot that contributions can target. The `TContext` parameter constrains
5
- * the data passed to renderers/menus invoked through the slot, and `TKind` picks the
6
- * contribution shape (`menu`, `navigation`, `view`, `settings`, `renderer`).
7
- *
8
- * @example
9
- * export const projectHeader = defineSlot<{ projectId: string }, "menu">("project.header", {
10
- * kind: "menu",
11
- * label: "Project header",
12
- * });
4
+ * Define a host-owned UI slot that extension contributions can target.
13
5
  */
14
6
  export declare const defineSlot: <TContext extends Struct = Struct, TKind extends UiSlotKind = UiSlotKind>(id: string, options: SlotOptions<TKind>) => SlotRef<TContext, TKind>;
@@ -1,3 +1,4 @@
1
+ import type { WorkbenchAttachmentTarget } from "../workbench-targets";
1
2
  import type { JsonObject, JsonValue, Struct } from "./json";
2
3
  import type { RepoContext, ResourceRef } from "./resources";
3
4
  import type { SlotInvocationContext } from "./slots";
@@ -13,11 +14,18 @@ export interface SerializedError {
13
14
  stack?: string;
14
15
  cause?: JsonValue;
15
16
  }
17
+ export interface WorkbenchAttachmentInvocationContext {
18
+ target: WorkbenchAttachmentTarget;
19
+ mode?: string;
20
+ projectId?: string;
21
+ resource?: ResourceRef;
22
+ }
16
23
  export interface CommandInvocation<TParams extends Struct = Struct> {
17
24
  params: TParams;
18
25
  resource?: ResourceRef;
19
26
  repoId?: string;
20
27
  repoPath?: string;
28
+ attachment?: WorkbenchAttachmentInvocationContext;
21
29
  slot?: SlotInvocationContext;
22
30
  metadata?: JsonObject;
23
31
  }