@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,10 +1,5 @@
1
- import type { ExtensionTicket, ExtensionWorkspace, SetAttemptStatusInput, SetAttemptStatusResult } from "./types/context";
1
+ import type { ExtensionWorkspace } 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
3
  export interface WorktreeCreatedEventPayload {
9
4
  projectId: string;
10
5
  repoPath: string;
@@ -12,33 +7,7 @@ export interface WorktreeCreatedEventPayload {
12
7
  branch: string;
13
8
  workspace: string;
14
9
  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;
10
+ anchors?: ResourceAnchor[];
42
11
  }
43
12
  export interface SessionLifecyclePayload {
44
13
  projectId: string;
@@ -49,9 +18,7 @@ export interface SessionLifecyclePayload {
49
18
  workspaceId?: string;
50
19
  worktreePath?: string;
51
20
  branch?: string;
52
- /** @deprecated Legacy ticket session linkage. Ticket data is owned by the pstdio tickets extension. */
53
- ticket?: ExtensionTicket;
54
- attemptStatus?: string;
21
+ anchors?: ResourceAnchor[];
55
22
  }
56
23
  export interface WorktreeRemovedPayload {
57
24
  projectId: string;
@@ -59,8 +26,7 @@ export interface WorktreeRemovedPayload {
59
26
  worktreePath: string;
60
27
  workspace?: ExtensionWorkspace;
61
28
  workspaceId?: string;
62
- /** @deprecated Legacy ticket worktree linkage. Ticket data is owned by the pstdio tickets extension. */
63
- ticket?: ExtensionTicket | string;
29
+ anchors?: ResourceAnchor[];
64
30
  }
65
31
  export interface CommitPayload {
66
32
  projectId: string;
@@ -69,8 +35,7 @@ export interface CommitPayload {
69
35
  branch?: string;
70
36
  commitSha?: string;
71
37
  workspace?: ExtensionWorkspace;
72
- /** @deprecated Legacy ticket git linkage. Ticket data is owned by the pstdio tickets extension. */
73
- ticket?: ExtensionTicket | string;
38
+ anchors?: ResourceAnchor[];
74
39
  }
75
40
  export interface RebasePayload {
76
41
  projectId: string;
@@ -78,7 +43,7 @@ export interface RebasePayload {
78
43
  worktreePath?: string;
79
44
  branch?: string;
80
45
  workspace?: ExtensionWorkspace;
81
- ticket?: ExtensionTicket | string;
46
+ anchors?: ResourceAnchor[];
82
47
  }
83
48
  export interface MergePayload extends CommitPayload {
84
49
  }
@@ -89,14 +54,12 @@ export interface ConflictPayload {
89
54
  worktreePath?: string;
90
55
  branch?: string;
91
56
  workspace?: ExtensionWorkspace;
92
- /** @deprecated Legacy ticket git linkage. Ticket data is owned by the pstdio tickets extension. */
93
- ticket?: ExtensionTicket | string;
57
+ anchors?: ResourceAnchor[];
94
58
  }
95
59
  export declare const projectSlots: {
96
60
  sidebar: import("./types").SlotRef<object, "view">;
97
61
  headerPrimary: import("./types").SlotRef<object, "menu">;
98
62
  headerOverflow: import("./types").SlotRef<object, "menu">;
99
- commandPanel: import("./types").SlotRef<object, "menu">;
100
63
  settingsPanels: import("./types").SlotRef<object, "settings">;
101
64
  };
102
65
  export declare const sessionSlots: {
@@ -104,11 +67,6 @@ export declare const sessionSlots: {
104
67
  headerOverflow: import("./types").SlotRef<object, "menu">;
105
68
  transcriptActions: import("./types").SlotRef<object, "menu">;
106
69
  };
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
- };
112
70
  export declare const workspaceSlots: {
113
71
  headerPrimary: import("./types").SlotRef<object, "menu">;
114
72
  headerOverflow: import("./types").SlotRef<object, "menu">;
@@ -131,13 +89,6 @@ export declare const sessionEvents: {
131
89
  anchors?: ResourceAnchor[];
132
90
  }>;
133
91
  };
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
- };
141
92
  export declare const workspaceEvents: {
142
93
  created: import("./types").EventRef<{
143
94
  workspace: ExtensionWorkspace;
@@ -159,10 +110,3 @@ export declare const gitEvents: {
159
110
  merged: import("./types").EventRef<MergePayload>;
160
111
  conflicted: import("./types").EventRef<ConflictPayload>;
161
112
  };
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
- };
@@ -0,0 +1,10 @@
1
+ export interface LocalizedString {
2
+ readonly $l10n: string;
3
+ readonly default?: string;
4
+ }
5
+ export type Localizable<T extends string = string> = T | LocalizedString;
6
+ export declare const l10n: (key: string, defaultValue?: string) => {
7
+ default?: string | undefined;
8
+ $l10n: string;
9
+ };
10
+ export declare const isLocalizedString: (value: unknown) => value is LocalizedString;
@@ -1,4 +1,4 @@
1
- import type { BooleanParam, HarnessParam, JsonParam, LongTextParam, MultiSelectParam, NumberParam, RepoParam, ResourceParam, SelectParam, TemplateParam, TextParam } from "./types/params";
1
+ import type { BooleanParam, HarnessParam, JsonParam, ListParam, LongTextParam, MultiSelectParam, NumberParam, RepoParam, ResourceParam, SelectParam, TemplateParam, TextParam } from "./types/params";
2
2
  type RequiredOf<TOptions> = TOptions extends {
3
3
  required: infer TRequired extends boolean;
4
4
  } ? TRequired : undefined;
@@ -29,5 +29,6 @@ export declare const params: {
29
29
  }>(options: TOptions) => TemplateParam<RequiredOf<TOptions>>;
30
30
  resource: <const TOptions extends ParamOptions<ResourceParam>>(options: TOptions) => ResourceParam<RequiredOf<TOptions>>;
31
31
  json: <T = unknown, const TOptions extends ParamOptions<JsonParam<T>> | undefined = undefined>(options?: TOptions) => JsonParam<T, RequiredOf<TOptions>>;
32
+ list: <const TOptions extends ParamOptions<ListParam> | undefined = undefined>(options?: TOptions) => ListParam<RequiredOf<TOptions>>;
32
33
  };
33
34
  export {};
@@ -1,3 +1,4 @@
1
+ import type { SessionStatus } from "pstdio-api-contracts";
1
2
  import type { CommandHelpersApi, CommandInvocation, CommandMiddlewareResult, CommandNotice, CommandSource, WorkbenchAttachmentInvocationContext } from "./commands";
2
3
  import type { EventDeliveryResult, EventRef } from "./events";
3
4
  import type { JsonObject, MaybePromise, Struct } from "./json";
@@ -11,26 +12,51 @@ export interface ExtensionStorageCollectionApi<TItem = unknown> {
11
12
  id: string;
12
13
  }>;
13
14
  delete(id: string): Promise<void>;
15
+ attachments(itemId: string): ExtensionBlobsApi;
14
16
  }
15
17
  export type StorageScope = {
16
18
  type: "project";
17
19
  } | {
18
20
  type: "repo";
19
- repoId?: string;
21
+ repoId: string;
20
22
  } | {
21
23
  type: "resource";
22
- resource?: ResourceRef;
24
+ resource: ResourceRef;
23
25
  } | {
24
26
  type: string;
25
- id?: string;
27
+ id: string;
26
28
  };
27
29
  export interface ExtensionStorageApi {
28
30
  scope(scope: StorageScope): ExtensionStorageApi;
31
+ files: ExtensionBlobsApi;
29
32
  get<T = unknown>(key: string): Promise<T | undefined>;
30
33
  set<T = unknown>(key: string, value: T): Promise<void>;
31
34
  delete(key: string): Promise<void>;
32
35
  collection<TItem = unknown>(name: string): ExtensionStorageCollectionApi<TItem>;
33
36
  }
37
+ export interface ExtensionBlobRef {
38
+ id: string;
39
+ name: string;
40
+ mimeType: string | null;
41
+ size: number;
42
+ hash: string | null;
43
+ url: string;
44
+ createdAt: string;
45
+ updatedAt: string;
46
+ }
47
+ export interface ExtensionBlobInput {
48
+ name: string;
49
+ data: Uint8Array | ArrayBuffer;
50
+ mimeType?: string | null;
51
+ }
52
+ export interface ExtensionBlobsApi {
53
+ put(input: ExtensionBlobInput): Promise<ExtensionBlobRef>;
54
+ get(id: string): Promise<ExtensionBlobRef | undefined>;
55
+ getBytes(id: string): Promise<Uint8Array>;
56
+ list(): Promise<ExtensionBlobRef[]>;
57
+ delete(id: string): Promise<void>;
58
+ urlFor(id: string): string;
59
+ }
34
60
  export interface ArtifactFile {
35
61
  path: string;
36
62
  size?: number;
@@ -61,7 +87,21 @@ export interface ExtensionFilesApi {
61
87
  }>;
62
88
  delete(fileId: string): Promise<void>;
63
89
  }
90
+ export interface ExtensionSessionResource {
91
+ type: "session";
92
+ id: string;
93
+ title: string;
94
+ status: SessionStatus;
95
+ }
64
96
  export interface ExtensionSessionsApi {
97
+ get(id: string): Promise<{
98
+ id: string;
99
+ title: string;
100
+ status?: string;
101
+ original_session_id?: string | null;
102
+ cwd?: string | null;
103
+ anchors_json?: ResourceAnchor[];
104
+ } | null>;
65
105
  create(input: {
66
106
  title: string;
67
107
  prompt?: string;
@@ -72,9 +112,7 @@ export interface ExtensionSessionsApi {
72
112
  repoId?: string;
73
113
  anchors?: ResourceAnchor[];
74
114
  originalSessionId?: string;
75
- }): Promise<{
76
- id: string;
77
- }>;
115
+ }): Promise<ExtensionSessionResource>;
78
116
  followup(input: {
79
117
  sessionId: string;
80
118
  prompt?: string;
@@ -86,204 +124,32 @@ export interface ExtensionHarnessInput {
86
124
  harnessId: string;
87
125
  model?: string;
88
126
  }
89
- /** @deprecated Legacy core ticket extension API. Ticket data is owned by the pstdio tickets extension. */
90
- export interface ExtensionTicket {
91
- id: string;
92
- shorthand: string;
93
- created_at?: string;
94
- updated_at?: string;
95
- display_title?: string | null;
96
- displayTitle?: string | null;
97
- user_prompt?: string | null;
98
- userPrompt?: string | null;
99
- parent_id?: string | null;
100
- parentId?: string | null;
101
- draft?: boolean;
102
- archived?: boolean;
103
- status_id?: string | null;
104
- status?: string | null;
105
- status_name?: string | null;
106
- tag_ids?: string[];
107
- tag_names?: string[];
108
- tagIds?: string[];
109
- tagNames?: string[];
110
- file_id?: string | null;
111
- fileId?: string | null;
112
- fileIds?: string[];
113
- }
114
- /** @deprecated Legacy core ticket extension API. Ticket data is owned by the pstdio tickets extension. */
115
- export interface ExtensionTicketFile {
116
- id: string;
117
- file_name?: string | null;
118
- fileName?: string | null;
119
- file_kind?: string | null;
120
- fileKind?: string | null;
121
- mime_type?: string | null;
122
- mimeType?: string | null;
123
- created_at?: string;
124
- updated_at?: string;
125
- }
126
- /** @deprecated Legacy core ticket extension API. Ticket data is owned by the pstdio tickets extension. */
127
- export interface ExtensionTicketListInput {
128
- status?: string;
129
- tag?: string | string[];
130
- archived?: boolean;
131
- draft?: boolean;
132
- parentId?: string;
133
- shorthand?: string;
134
- search?: string;
135
- }
136
127
  export interface ExtensionWorkspace {
137
128
  id: string;
129
+ name?: string;
138
130
  project_id?: string;
139
131
  workspace_shorthand?: string;
140
- /** @deprecated Legacy ticket-workspace linkage. Ticket data is owned by the pstdio tickets extension. */
141
- ticket_id?: string | null;
142
- /** @deprecated Legacy ticket-workspace linkage. Ticket data is owned by the pstdio tickets extension. */
143
- ticket_shorthand?: string | null;
144
132
  branch?: string | null;
145
133
  worktree_path?: string | null;
146
- attempt_status_id?: string | null;
147
- attempt_status_name?: string | null;
134
+ anchors_json?: ResourceAnchor[];
148
135
  initializing?: boolean;
149
- }
150
- /** @deprecated Legacy core ticket extension API. Ticket data is owned by the pstdio tickets extension. */
151
- export interface ExtensionTicketsApi {
152
- list(input?: ExtensionTicketListInput): Promise<ExtensionTicket[]>;
153
- get(ref: string): Promise<ExtensionTicket>;
154
- update(input: {
155
- ticket: string;
156
- content?: string;
157
- }): Promise<ExtensionTicket>;
158
- listFiles(ref: string): Promise<ExtensionTicketFile[]>;
159
- createAttempt(input: {
160
- ticket: string;
161
- agent?: string;
162
- branch?: string;
163
- repoId?: string;
164
- repoPath?: string;
165
- mode?: "worktree" | "current_branch";
166
- model?: string;
167
- prompt?: string;
168
- base?: string;
169
- startSession?: boolean;
170
- }): Promise<unknown>;
171
- setStatus(input: {
172
- ticket: string;
173
- status: string;
174
- }): Promise<void>;
175
- updateWhenAllAttemptsMatch(input: {
176
- ticket: string;
177
- allAttemptsStatus: string;
178
- setStatus: string;
179
- }): Promise<{
180
- updated: boolean;
181
- }>;
182
- }
183
- /** @deprecated Legacy core ticket status extension API. Ticket statuses are owned by the pstdio tickets extension. */
184
- export interface ExtensionTicketStatus {
185
- id: string;
186
- name: string;
187
- color: string;
188
- sortOrder: number;
189
- isDefault: boolean;
190
- canCreate: boolean;
191
- canDragIn: boolean;
192
- canDragOut: boolean;
193
- columnActions: string[];
194
- }
195
- /** @deprecated Legacy core ticket status extension API. Ticket statuses are owned by the pstdio tickets extension. */
196
- export interface ExtensionTicketStatusesApi {
197
- list(): Promise<ExtensionTicketStatus[]>;
198
- create(input: {
199
- name: string;
200
- color: string;
201
- sortOrder?: number;
202
- isDefault?: boolean;
203
- canCreate?: boolean;
204
- canDragIn?: boolean;
205
- canDragOut?: boolean;
206
- columnActions?: string[];
207
- }): Promise<ExtensionTicketStatus>;
208
- update(input: {
209
- statusId: string;
210
- name?: string;
211
- color?: string;
212
- sortOrder?: number;
213
- canCreate?: boolean;
214
- canDragIn?: boolean;
215
- canDragOut?: boolean;
216
- columnActions?: string[];
217
- }): Promise<ExtensionTicketStatus>;
218
- setDefault(input: {
219
- statusId: string;
220
- }): Promise<void>;
221
- delete(input: {
222
- statusId: string;
223
- }): Promise<void>;
224
- }
225
- /** @deprecated Legacy ticket attempt status extension API. Workspace status automation is extension-owned. */
226
- export interface ExtensionAttemptStatus {
227
- id: string;
228
- name: string;
229
- color: string;
230
- sortOrder: number;
231
- isDefault: boolean;
232
- }
233
- /** @deprecated Legacy ticket attempt status extension API. Workspace status automation is extension-owned. */
234
- export interface ExtensionAttemptStatusesApi {
235
- list(): Promise<ExtensionAttemptStatus[]>;
236
- create(input: {
237
- name: string;
238
- color: string;
239
- sortOrder?: number;
240
- isDefault?: boolean;
241
- }): Promise<ExtensionAttemptStatus>;
242
- update(input: {
243
- statusId: string;
244
- name?: string;
245
- color?: string;
246
- sortOrder?: number;
247
- isDefault?: boolean;
248
- }): Promise<ExtensionAttemptStatus>;
249
- delete(input: {
250
- statusId: string;
251
- }): Promise<void>;
252
- }
253
- export interface SetAttemptStatusInput {
254
- workspaceId: string;
255
- status: string;
256
- sessionId?: string;
257
- }
258
- export interface SetAttemptStatusResult {
259
- id: string;
260
- attempt_status_id: string | null;
261
- from_status: string | null;
262
- to_status: string;
263
- status_change_id: string;
136
+ created_at?: string;
137
+ updated_at?: string;
264
138
  }
265
139
  export interface ExtensionWorkspacesApi {
140
+ list(): Promise<ExtensionWorkspace[]>;
266
141
  get(id: string): Promise<ExtensionWorkspace | null>;
267
142
  getByShorthand(shorthand: string): Promise<ExtensionWorkspace | null>;
268
143
  create(input: JsonObject): Promise<ExtensionWorkspace>;
269
144
  archive(id: string): Promise<void>;
270
145
  delete(id: string): Promise<void>;
271
- setAttemptStatus(input: SetAttemptStatusInput): Promise<SetAttemptStatusResult>;
272
146
  }
273
147
  export interface BootstrapWorktreeInput {
274
148
  repoPath: string;
275
149
  worktreePath: string;
276
- /** @deprecated Legacy ticket worktree bootstrap. Ticket worktree setup is owned by the pstdio tickets extension. */
277
- ticketId?: string;
278
- }
279
- /** @deprecated Legacy ticket worktree cleanup. Ticket worktree setup is owned by the pstdio tickets extension. */
280
- export interface RemoveWorktreesForTicketInput {
281
- ticketId?: string;
282
150
  }
283
151
  export interface ExtensionWorktreesApi {
284
152
  bootstrap(input: BootstrapWorktreeInput): Promise<void>;
285
- /** @deprecated Legacy ticket worktree cleanup. Ticket worktree setup is owned by the pstdio tickets extension. */
286
- removeAllForTicket(input: RemoveWorktreesForTicketInput): Promise<number>;
287
153
  }
288
154
  export interface ExtensionReposApi {
289
155
  list(): Promise<RepoContext[]>;
@@ -356,13 +222,9 @@ export interface ExtensionContextBase<TSettings extends Record<string, unknown>
356
222
  source?: CommandSource;
357
223
  storage: ExtensionStorageApi;
358
224
  artifacts: ExtensionArtifactApi;
225
+ /** Working tree of the invocation's repo, scoped to its root. Absent for non-repo (event/hook) invocations. */
226
+ repoFiles?: ArtifactMount;
359
227
  files: ExtensionFilesApi;
360
- /** @deprecated Legacy core ticket extension API. Ticket data is owned by the pstdio tickets extension. */
361
- tickets: ExtensionTicketsApi;
362
- /** @deprecated Legacy core ticket status extension API. Ticket statuses are owned by the pstdio tickets extension. */
363
- ticketStatuses: ExtensionTicketStatusesApi;
364
- /** @deprecated Legacy ticket attempt status extension API. Workspace status automation is extension-owned. */
365
- attemptStatuses: ExtensionAttemptStatusesApi;
366
228
  sessions: ExtensionSessionsApi;
367
229
  workspaces: ExtensionWorkspacesApi;
368
230
  worktrees: ExtensionWorktreesApi;