@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.
- package/README.md +27 -188
- package/dist/api/extensions.d.ts +1 -1
- package/dist/api/index.d.ts +2 -2
- package/dist/api/settings.d.ts +1 -0
- package/dist/api/statuses.d.ts +1 -0
- package/dist/api/tags.d.ts +1 -0
- package/dist/api/tickets.d.ts +3 -0
- package/dist/api/workspaces.d.ts +10 -1
- package/dist/client/client.d.ts +7 -2
- package/dist/client/index.d.ts +5 -3
- package/dist/client/index.js +285 -31
- package/dist/client/projects.d.ts +0 -11
- package/dist/client/request.d.ts +9 -0
- package/dist/client/sessions.d.ts +25 -3
- package/dist/client/settings.d.ts +7 -0
- package/dist/client/sse.d.ts +15 -0
- package/dist/client/statuses.d.ts +2 -0
- package/dist/client/sync.d.ts +35 -0
- package/dist/client/tags.d.ts +2 -0
- package/dist/client/tickets.d.ts +6 -1
- package/dist/client/workspaces.d.ts +2 -0
- package/dist/extensions/define-command.d.ts +1 -1
- package/dist/extensions/define-extension.d.ts +50 -7
- package/dist/extensions/index.d.ts +3 -2
- package/dist/extensions/index.js +151 -11
- package/dist/extensions/kernel-slots.d.ts +131 -10
- package/dist/extensions/params.d.ts +19 -12
- package/dist/extensions/refs.d.ts +3 -3
- package/dist/extensions/slots.d.ts +1 -9
- package/dist/extensions/types/commands.d.ts +8 -0
- package/dist/extensions/types/context.d.ts +225 -18
- package/dist/extensions/types/contributions.d.ts +183 -10
- package/dist/extensions/types/extension.d.ts +16 -10
- package/dist/extensions/types/params.d.ts +43 -29
- package/dist/extensions/types/slots.d.ts +1 -1
- package/dist/extensions/types/webview-capabilities.d.ts +12 -2
- package/dist/extensions/workbench-targets.d.ts +134 -0
- package/dist/hooks/attempt.d.ts +2 -0
- package/dist/hooks/entities.d.ts +2 -0
- package/dist/hooks/ticket.d.ts +3 -0
- package/dist/resources/index.d.ts +3 -0
- package/dist/resources/index.js +26 -0
- package/dist/resources/known-agents.d.ts +12 -0
- package/dist/resources/settings.d.ts +1 -0
- package/dist/resources/status.d.ts +1 -0
- package/dist/resources/tag.d.ts +1 -0
- package/dist/resources/ticket.d.ts +1 -0
- package/dist/resources/workspace.d.ts +4 -1
- package/package.json +2 -6
- package/dist/api/actions.d.ts +0 -13
- package/dist/client/actions.d.ts +0 -8
- package/dist/plugins/define-plugin.d.ts +0 -2
- package/dist/plugins/helpers/context.d.ts +0 -24
- package/dist/plugins/helpers/create-attempt.d.ts +0 -5
- package/dist/plugins/helpers/create-session.d.ts +0 -21
- package/dist/plugins/helpers/create-workspace.d.ts +0 -5
- package/dist/plugins/helpers/find-ticket-by-ref.d.ts +0 -6
- package/dist/plugins/helpers/find-workspace-by-ref.d.ts +0 -5
- package/dist/plugins/helpers/followup-session.d.ts +0 -29
- package/dist/plugins/helpers/get-attempts-for-ticket.d.ts +0 -17
- package/dist/plugins/helpers/index.d.ts +0 -16
- package/dist/plugins/helpers/remove-all-worktrees-for-ticket.d.ts +0 -2
- package/dist/plugins/helpers/run-command.d.ts +0 -10
- package/dist/plugins/helpers/save-ticket.d.ts +0 -14
- package/dist/plugins/helpers/set-ticket-status.d.ts +0 -7
- package/dist/plugins/helpers/set-workspace-attempt-status.d.ts +0 -7
- package/dist/plugins/helpers/ticket-pull.d.ts +0 -18
- package/dist/plugins/helpers/update-ticket-when-all-attempts-match.d.ts +0 -7
- package/dist/plugins/helpers/workspaces-for-ticket.d.ts +0 -17
- package/dist/plugins/helpers/worktree-bootstrap.d.ts +0 -8
- package/dist/plugins/hooks.d.ts +0 -42
- package/dist/plugins/index.d.ts +0 -5
- package/dist/plugins/index.js +0 -739
- package/dist/plugins/types.d.ts +0 -112
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CommandHelpersApi, CommandInvocation, CommandMiddlewareResult, CommandNotice, CommandSource } from "./commands";
|
|
1
|
+
import type { CommandHelpersApi, CommandInvocation, CommandMiddlewareResult, CommandNotice, CommandSource, WorkbenchAttachmentInvocationContext } from "./commands";
|
|
2
2
|
import type { EventDeliveryResult, EventRef } from "./events";
|
|
3
3
|
import type { JsonObject, MaybePromise, Struct } from "./json";
|
|
4
4
|
import type { RepoContext, ResourceAnchor, ResourceRef } from "./resources";
|
|
@@ -67,7 +67,7 @@ export interface ExtensionSessionsApi {
|
|
|
67
67
|
prompt?: string;
|
|
68
68
|
template?: string;
|
|
69
69
|
vars?: JsonObject;
|
|
70
|
-
harness?:
|
|
70
|
+
harness?: ExtensionHarnessInput;
|
|
71
71
|
workspaceId?: string;
|
|
72
72
|
repoId?: string;
|
|
73
73
|
anchors?: ResourceAnchor[];
|
|
@@ -82,11 +82,208 @@ export interface ExtensionSessionsApi {
|
|
|
82
82
|
vars?: JsonObject;
|
|
83
83
|
}): Promise<void>;
|
|
84
84
|
}
|
|
85
|
+
export interface ExtensionHarnessInput {
|
|
86
|
+
harnessId: string;
|
|
87
|
+
model?: string;
|
|
88
|
+
}
|
|
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
|
+
export interface ExtensionWorkspace {
|
|
137
|
+
id: string;
|
|
138
|
+
project_id?: string;
|
|
139
|
+
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
|
+
branch?: string | null;
|
|
145
|
+
worktree_path?: string | null;
|
|
146
|
+
attempt_status_id?: string | null;
|
|
147
|
+
attempt_status_name?: string | null;
|
|
148
|
+
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;
|
|
264
|
+
}
|
|
85
265
|
export interface ExtensionWorkspacesApi {
|
|
86
|
-
get(id: string): Promise<
|
|
87
|
-
|
|
266
|
+
get(id: string): Promise<ExtensionWorkspace | null>;
|
|
267
|
+
getByShorthand(shorthand: string): Promise<ExtensionWorkspace | null>;
|
|
268
|
+
create(input: JsonObject): Promise<ExtensionWorkspace>;
|
|
88
269
|
archive(id: string): Promise<void>;
|
|
89
270
|
delete(id: string): Promise<void>;
|
|
271
|
+
setAttemptStatus(input: SetAttemptStatusInput): Promise<SetAttemptStatusResult>;
|
|
272
|
+
}
|
|
273
|
+
export interface BootstrapWorktreeInput {
|
|
274
|
+
repoPath: string;
|
|
275
|
+
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
|
+
}
|
|
283
|
+
export interface ExtensionWorktreesApi {
|
|
284
|
+
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>;
|
|
90
287
|
}
|
|
91
288
|
export interface ExtensionReposApi {
|
|
92
289
|
list(): Promise<RepoContext[]>;
|
|
@@ -117,13 +314,15 @@ export interface ProcessRunResult {
|
|
|
117
314
|
stdout: string;
|
|
118
315
|
stderr: string;
|
|
119
316
|
}
|
|
317
|
+
export interface ProcessRunInput {
|
|
318
|
+
command: string[];
|
|
319
|
+
cwd?: string;
|
|
320
|
+
env?: Record<string, string>;
|
|
321
|
+
timeoutMs?: number;
|
|
322
|
+
}
|
|
120
323
|
export interface ExtensionProcessApi {
|
|
121
|
-
run(input:
|
|
122
|
-
|
|
123
|
-
cwd?: string;
|
|
124
|
-
env?: Record<string, string>;
|
|
125
|
-
timeoutMs?: number;
|
|
126
|
-
}): Promise<ProcessRunResult>;
|
|
324
|
+
run(input: ProcessRunInput): Promise<ProcessRunResult>;
|
|
325
|
+
runOrThrow(input: ProcessRunInput): Promise<ProcessRunResult>;
|
|
127
326
|
spawnDetached(input: {
|
|
128
327
|
command: string[];
|
|
129
328
|
cwd?: string;
|
|
@@ -142,13 +341,13 @@ export interface ExtensionLoggerApi {
|
|
|
142
341
|
warn(message: string, metadata?: JsonObject): void;
|
|
143
342
|
error(message: string, metadata?: JsonObject): void;
|
|
144
343
|
}
|
|
145
|
-
export interface ExtensionSettingsApi<TSettings extends
|
|
344
|
+
export interface ExtensionSettingsApi<TSettings extends Record<string, unknown> = Record<string, unknown>> {
|
|
146
345
|
all(): Promise<Partial<TSettings>>;
|
|
147
|
-
get<TKey extends keyof TSettings>(key: TKey): Promise<TSettings[TKey] | undefined>;
|
|
148
|
-
set<TKey extends keyof TSettings>(key: TKey, value: TSettings[TKey]): Promise<void>;
|
|
149
|
-
delete<TKey extends keyof TSettings>(key: TKey): Promise<void>;
|
|
346
|
+
get<TKey extends keyof TSettings & string>(key: TKey): Promise<TSettings[TKey] | undefined>;
|
|
347
|
+
set<TKey extends keyof TSettings & string>(key: TKey, value: TSettings[TKey]): Promise<void>;
|
|
348
|
+
delete<TKey extends keyof TSettings & string>(key: TKey): Promise<void>;
|
|
150
349
|
}
|
|
151
|
-
export interface ExtensionContextBase {
|
|
350
|
+
export interface ExtensionContextBase<TSettings extends Record<string, unknown> = Record<string, unknown>> {
|
|
152
351
|
projectId: string;
|
|
153
352
|
extensionId: string;
|
|
154
353
|
/** Extension package name. Used for grouping/prefixing user-facing references. */
|
|
@@ -158,8 +357,15 @@ export interface ExtensionContextBase {
|
|
|
158
357
|
storage: ExtensionStorageApi;
|
|
159
358
|
artifacts: ExtensionArtifactApi;
|
|
160
359
|
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;
|
|
161
366
|
sessions: ExtensionSessionsApi;
|
|
162
367
|
workspaces: ExtensionWorkspacesApi;
|
|
368
|
+
worktrees: ExtensionWorktreesApi;
|
|
163
369
|
repos: ExtensionReposApi;
|
|
164
370
|
commands: CommandHelpersApi;
|
|
165
371
|
events: ExtensionEventsApi;
|
|
@@ -168,19 +374,20 @@ export interface ExtensionContextBase {
|
|
|
168
374
|
process: ExtensionProcessApi;
|
|
169
375
|
net: ExtensionNetApi;
|
|
170
376
|
logger: ExtensionLoggerApi;
|
|
171
|
-
settings: ExtensionSettingsApi
|
|
377
|
+
settings: ExtensionSettingsApi<TSettings>;
|
|
172
378
|
}
|
|
173
|
-
export interface CommandContext<TParams extends Struct = Struct> extends ExtensionContextBase {
|
|
379
|
+
export interface CommandContext<TParams extends Struct = Struct, TSettings extends Record<string, unknown> = Record<string, unknown>> extends ExtensionContextBase<TSettings> {
|
|
174
380
|
commandId: string;
|
|
175
381
|
invocationId: string;
|
|
176
382
|
invocation: CommandInvocation<TParams>;
|
|
177
383
|
resource?: ResourceRef;
|
|
384
|
+
attachment?: WorkbenchAttachmentInvocationContext;
|
|
178
385
|
slot?: SlotInvocationContext;
|
|
179
386
|
params: TParams;
|
|
180
387
|
}
|
|
181
388
|
export type CommandMiddlewareContext<TParams extends Struct = Struct> = CommandContext<TParams>;
|
|
182
389
|
export type CommandMiddlewareHandler<TParams extends Struct = Struct> = (ctx: CommandMiddlewareContext<TParams>) => MaybePromise<CommandMiddlewareResult<TParams>>;
|
|
183
|
-
export type CommandRunHandler<TParams extends Struct = Struct, TResult = unknown> = (ctx: CommandContext<TParams>) => MaybePromise<TResult>;
|
|
390
|
+
export type CommandRunHandler<TParams extends Struct = Struct, TResult = unknown, TSettings extends Record<string, unknown> = Record<string, unknown>> = (ctx: CommandContext<TParams, TSettings>) => MaybePromise<TResult>;
|
|
184
391
|
export interface EventContext extends ExtensionContextBase {
|
|
185
392
|
eventId: string;
|
|
186
393
|
deliveryId: string;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { WorkbenchMenuTarget, WorkbenchModeLayoutTarget, WorkbenchSettingsScope, WorkbenchSettingsTarget, WorkbenchTreeTarget, WorkbenchViewTarget } from "../workbench-targets";
|
|
1
2
|
import type { CommandRef, CommandSource } from "./commands";
|
|
2
|
-
import type { JsonObject, Struct } from "./json";
|
|
3
|
+
import type { JsonObject, JsonValue, Struct } from "./json";
|
|
4
|
+
import type { ParamObjectSchema } from "./params";
|
|
3
5
|
import type { PackageAssetDescriptor } from "./resources";
|
|
4
6
|
import type { SlotRef } from "./slots";
|
|
5
7
|
import type { WebviewCapabilityDeclaration } from "./webview-capabilities";
|
|
@@ -11,12 +13,14 @@ export interface CliContribution {
|
|
|
11
13
|
hidden?: boolean;
|
|
12
14
|
}
|
|
13
15
|
export interface WhenExpression {
|
|
16
|
+
mode?: string | string[];
|
|
14
17
|
source?: CommandSource[];
|
|
15
18
|
resourceType?: string[];
|
|
16
19
|
metadata?: JsonObject;
|
|
17
20
|
}
|
|
18
21
|
export interface MenuContribution<TSlotContext extends Struct = Struct, TParams extends Struct = Struct> {
|
|
19
|
-
|
|
22
|
+
target?: WorkbenchMenuTarget;
|
|
23
|
+
slot?: SlotRef<TSlotContext, "menu"> | string;
|
|
20
24
|
label?: string;
|
|
21
25
|
group?: string;
|
|
22
26
|
placement?: "first" | "default" | "last";
|
|
@@ -26,17 +30,51 @@ export interface MenuContribution<TSlotContext extends Struct = Struct, TParams
|
|
|
26
30
|
params?: Partial<TParams>;
|
|
27
31
|
presentation?: "menu-item" | "button" | "icon-button";
|
|
28
32
|
}
|
|
29
|
-
export interface
|
|
30
|
-
|
|
33
|
+
export interface TreeItemContribution<TParams extends Struct = Struct> {
|
|
34
|
+
target: WorkbenchTreeTarget;
|
|
31
35
|
label: string;
|
|
32
36
|
group?: string;
|
|
33
37
|
placement?: "first" | "default" | "last";
|
|
34
|
-
route?: string;
|
|
35
|
-
href?: string;
|
|
36
|
-
command?: CommandRef<TParams, unknown> | string;
|
|
37
|
-
params?: Partial<TParams>;
|
|
38
38
|
icon?: string;
|
|
39
39
|
when?: WhenExpression;
|
|
40
|
+
action: {
|
|
41
|
+
kind: "command";
|
|
42
|
+
command: CommandRef<TParams, unknown> | string;
|
|
43
|
+
params?: Partial<TParams>;
|
|
44
|
+
} | {
|
|
45
|
+
kind: "dataRenderer";
|
|
46
|
+
dataRenderer: string;
|
|
47
|
+
} | {
|
|
48
|
+
kind: "route";
|
|
49
|
+
route: string;
|
|
50
|
+
} | {
|
|
51
|
+
kind: "href";
|
|
52
|
+
href: string;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export type WorkbenchLayoutTarget = WorkbenchModeLayoutTarget;
|
|
56
|
+
export type ModeTargetContribution = {
|
|
57
|
+
target: WorkbenchLayoutTarget;
|
|
58
|
+
view: string;
|
|
59
|
+
title?: string;
|
|
60
|
+
resource?: string;
|
|
61
|
+
pinned?: boolean;
|
|
62
|
+
} | {
|
|
63
|
+
target: WorkbenchLayoutTarget;
|
|
64
|
+
resource: string;
|
|
65
|
+
widget?: string;
|
|
66
|
+
title?: string;
|
|
67
|
+
pinned?: boolean;
|
|
68
|
+
};
|
|
69
|
+
export interface ModeLayoutContribution {
|
|
70
|
+
reset?: boolean | WorkbenchLayoutTarget[];
|
|
71
|
+
open?: ModeTargetContribution[];
|
|
72
|
+
}
|
|
73
|
+
export interface ModeContribution {
|
|
74
|
+
id?: string;
|
|
75
|
+
label: string;
|
|
76
|
+
icon?: string;
|
|
77
|
+
layout?: ModeLayoutContribution;
|
|
40
78
|
}
|
|
41
79
|
export interface WebviewContribution {
|
|
42
80
|
entry: PackageAssetDescriptor;
|
|
@@ -45,7 +83,8 @@ export interface WebviewContribution {
|
|
|
45
83
|
}
|
|
46
84
|
export interface ViewContribution<TSlotContext extends Struct = Struct> {
|
|
47
85
|
title: string;
|
|
48
|
-
|
|
86
|
+
target?: WorkbenchViewTarget;
|
|
87
|
+
slot?: SlotRef<TSlotContext, "view"> | string;
|
|
49
88
|
group?: string;
|
|
50
89
|
placement?: "first" | "default" | "last";
|
|
51
90
|
webview: WebviewContribution;
|
|
@@ -57,9 +96,143 @@ export interface RouteContribution {
|
|
|
57
96
|
}
|
|
58
97
|
export interface SettingsPanelContribution<TSlotContext extends Struct = Struct> {
|
|
59
98
|
title: string;
|
|
60
|
-
|
|
99
|
+
target?: WorkbenchSettingsTarget;
|
|
100
|
+
scope?: WorkbenchSettingsScope;
|
|
101
|
+
slot?: SlotRef<TSlotContext, "settings"> | string;
|
|
61
102
|
webview: WebviewContribution;
|
|
62
103
|
}
|
|
104
|
+
export type DataRendererViewMode = "board" | "list";
|
|
105
|
+
export type DataRendererSortDirection = "asc" | "desc";
|
|
106
|
+
export interface DataRendererEnumOption {
|
|
107
|
+
value: string;
|
|
108
|
+
label: string;
|
|
109
|
+
color?: string;
|
|
110
|
+
icon?: string | null;
|
|
111
|
+
}
|
|
112
|
+
export type DataRendererAttributeType = {
|
|
113
|
+
kind: "enum";
|
|
114
|
+
options: DataRendererEnumOption[];
|
|
115
|
+
} | {
|
|
116
|
+
kind: "enum-multi";
|
|
117
|
+
options: DataRendererEnumOption[];
|
|
118
|
+
} | {
|
|
119
|
+
kind: "string";
|
|
120
|
+
} | {
|
|
121
|
+
kind: "date";
|
|
122
|
+
} | {
|
|
123
|
+
kind: "number";
|
|
124
|
+
} | {
|
|
125
|
+
kind: "user";
|
|
126
|
+
};
|
|
127
|
+
export interface DataRendererAttributeDescriptor {
|
|
128
|
+
id: string;
|
|
129
|
+
label: string;
|
|
130
|
+
type: DataRendererAttributeType;
|
|
131
|
+
filterable?: boolean;
|
|
132
|
+
groupable?: boolean;
|
|
133
|
+
sortable?: boolean;
|
|
134
|
+
displayable?: boolean;
|
|
135
|
+
editable?: boolean;
|
|
136
|
+
}
|
|
137
|
+
export interface DataRendererSettings {
|
|
138
|
+
viewMode: DataRendererViewMode;
|
|
139
|
+
columnGrouping: string;
|
|
140
|
+
rowGrouping: string;
|
|
141
|
+
ordering: {
|
|
142
|
+
attributeId: string;
|
|
143
|
+
direction: DataRendererSortDirection;
|
|
144
|
+
};
|
|
145
|
+
displayProperties: string[];
|
|
146
|
+
}
|
|
147
|
+
export type DataRendererFilterState = Record<string, string[]>;
|
|
148
|
+
export interface DataRendererQueryParams {
|
|
149
|
+
settings: DataRendererSettings;
|
|
150
|
+
filters: DataRendererFilterState;
|
|
151
|
+
}
|
|
152
|
+
export interface DataRendererResourceRef {
|
|
153
|
+
type: string;
|
|
154
|
+
id: string;
|
|
155
|
+
projectId?: string;
|
|
156
|
+
label?: string;
|
|
157
|
+
extensionId?: string;
|
|
158
|
+
metadata?: JsonObject;
|
|
159
|
+
}
|
|
160
|
+
export interface DataRendererRow {
|
|
161
|
+
id: string;
|
|
162
|
+
title: string;
|
|
163
|
+
resource?: DataRendererResourceRef;
|
|
164
|
+
attributes: Record<string, unknown>;
|
|
165
|
+
}
|
|
166
|
+
export interface DataRendererColumnAction {
|
|
167
|
+
id: string;
|
|
168
|
+
label: string;
|
|
169
|
+
icon?: string;
|
|
170
|
+
}
|
|
171
|
+
export interface DataRendererBoardColumnConfig {
|
|
172
|
+
color?: string;
|
|
173
|
+
canDragIn?: boolean;
|
|
174
|
+
canDragOut?: boolean;
|
|
175
|
+
canCreate?: boolean;
|
|
176
|
+
actions?: DataRendererColumnAction[];
|
|
177
|
+
}
|
|
178
|
+
export interface DataRendererQueryResult {
|
|
179
|
+
rows: DataRendererRow[];
|
|
180
|
+
attributes?: DataRendererAttributeDescriptor[];
|
|
181
|
+
boardColumnConfigs?: Record<string, DataRendererBoardColumnConfig>;
|
|
182
|
+
}
|
|
183
|
+
export interface DataRendererCreateRowContribution<TParams extends ParamObjectSchema = ParamObjectSchema> {
|
|
184
|
+
command: CommandRef<Struct, unknown> | string;
|
|
185
|
+
title?: string;
|
|
186
|
+
submitLabel?: string;
|
|
187
|
+
columnParam?: string;
|
|
188
|
+
params?: TParams;
|
|
189
|
+
}
|
|
190
|
+
export interface DataRendererSavedViewsContribution {
|
|
191
|
+
resourceKind: string;
|
|
192
|
+
scope?: "project" | "user";
|
|
193
|
+
}
|
|
194
|
+
export interface DataRendererContribution {
|
|
195
|
+
title: string;
|
|
196
|
+
resourceKind?: string;
|
|
197
|
+
attributes?: DataRendererAttributeDescriptor[];
|
|
198
|
+
queryCommand: CommandRef<DataRendererQueryParams, DataRendererQueryResult> | string;
|
|
199
|
+
updateAttributeCommand?: CommandRef<{
|
|
200
|
+
rowId: string;
|
|
201
|
+
attributeId: string;
|
|
202
|
+
value: unknown;
|
|
203
|
+
}, unknown> | string;
|
|
204
|
+
reorderCommand?: CommandRef<{
|
|
205
|
+
rowId: string;
|
|
206
|
+
beforeRowId?: string;
|
|
207
|
+
}, unknown> | string;
|
|
208
|
+
columnActionCommand?: CommandRef<{
|
|
209
|
+
columnId: string;
|
|
210
|
+
actionId: string;
|
|
211
|
+
}, unknown> | string;
|
|
212
|
+
createRow?: DataRendererCreateRowContribution;
|
|
213
|
+
defaultSettings?: Partial<DataRendererSettings>;
|
|
214
|
+
defaultFilters?: DataRendererFilterState;
|
|
215
|
+
emptyTitle?: string;
|
|
216
|
+
emptyDescription?: string;
|
|
217
|
+
hideToolbar?: boolean;
|
|
218
|
+
savedViews?: DataRendererSavedViewsContribution;
|
|
219
|
+
}
|
|
220
|
+
export type ExtensionSettingScope = "global" | "project";
|
|
221
|
+
export type ExtensionSettingValueType = "boolean" | "number" | "string" | "array" | "object";
|
|
222
|
+
export type ExtensionSettingValueForType<TType extends ExtensionSettingValueType> = TType extends "boolean" ? boolean : TType extends "number" ? number : TType extends "string" ? string : TType extends "array" ? JsonValue[] : JsonObject;
|
|
223
|
+
export type ExtensionSettingProperty<TType extends ExtensionSettingValueType = ExtensionSettingValueType> = {
|
|
224
|
+
[TSettingType in TType]: {
|
|
225
|
+
type: TSettingType;
|
|
226
|
+
scope: ExtensionSettingScope;
|
|
227
|
+
default?: ExtensionSettingValueForType<TSettingType>;
|
|
228
|
+
enum?: ExtensionSettingValueForType<TSettingType>[];
|
|
229
|
+
title?: string;
|
|
230
|
+
description?: string;
|
|
231
|
+
};
|
|
232
|
+
}[TType];
|
|
233
|
+
export interface ExtensionSettingsContribution<TProperties extends Record<string, ExtensionSettingProperty> = Record<string, ExtensionSettingProperty>> {
|
|
234
|
+
properties: TProperties;
|
|
235
|
+
}
|
|
63
236
|
export interface RendererContribution<TSlotContext extends Struct = Struct> {
|
|
64
237
|
slot: SlotRef<TSlotContext, "renderer"> | string;
|
|
65
238
|
for: string;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { CommandRef } from "./commands";
|
|
2
2
|
import type { CommandMiddlewareHandler, CommandRunHandler, EventContext, ExtensionContextBase, MigrationContext, SetupContext } from "./context";
|
|
3
|
-
import type { ArtifactMountContribution, CliContribution, FileIconThemeContribution, MenuContribution,
|
|
3
|
+
import type { ArtifactMountContribution, CliContribution, DataRendererContribution, ExtensionSettingsContribution, FileIconThemeContribution, MenuContribution, ModeContribution, RendererContribution, RouteContribution, SettingsPanelContribution, SkillContribution, TemplateContribution, TemplateTypeContribution, ThemeContribution, TreeItemContribution, ViewContribution } from "./contributions";
|
|
4
4
|
import type { EventRef } from "./events";
|
|
5
5
|
import type { JsonObject, MaybePromise, Struct } from "./json";
|
|
6
6
|
import type { ParamObjectSchema, ParamsOf } from "./params";
|
|
7
|
-
import type { SlotRef } from "./slots";
|
|
8
7
|
/** Current host extension API version. `engines.pstdio` in package.json is a semver range checked against this. */
|
|
9
8
|
export declare const EXTENSION_API_VERSION = "1.0.0";
|
|
10
9
|
type SchemaParams<TSchema extends ParamObjectSchema | undefined> = TSchema extends ParamObjectSchema ? ParamsOf<TSchema> : Struct;
|
|
@@ -12,13 +11,13 @@ type SchemaParams<TSchema extends ParamObjectSchema | undefined> = TSchema exten
|
|
|
12
11
|
* A command exposed by an extension. The `params` schema (typed via `params.*`) drives
|
|
13
12
|
* the inferred shape of `ctx.params` in `run`.
|
|
14
13
|
*/
|
|
15
|
-
export interface CommandDefinition<TSchema extends ParamObjectSchema | undefined = ParamObjectSchema | undefined, TResult = unknown> {
|
|
14
|
+
export interface CommandDefinition<TSchema extends ParamObjectSchema | undefined = ParamObjectSchema | undefined, TResult = unknown, TSettings extends Record<string, unknown> = Record<string, unknown>> {
|
|
16
15
|
title: string;
|
|
17
16
|
description?: string;
|
|
18
17
|
params?: TSchema;
|
|
19
18
|
menus?: MenuContribution[];
|
|
20
19
|
cli?: boolean | CliContribution;
|
|
21
|
-
run: CommandRunHandler<SchemaParams<TSchema>, TResult>;
|
|
20
|
+
run: CommandRunHandler<SchemaParams<TSchema>, TResult, TSettings>;
|
|
22
21
|
}
|
|
23
22
|
/**
|
|
24
23
|
* Middleware that runs before a command. Use `command` for a typed `CommandRef`; use
|
|
@@ -101,6 +100,7 @@ export interface ProjectExtensionInstance {
|
|
|
101
100
|
enabled: boolean;
|
|
102
101
|
config: JsonObject;
|
|
103
102
|
}
|
|
103
|
+
export type ExtensionLoadScope = "user" | "repo";
|
|
104
104
|
/** Validated view of an extension's package.json identity fields. */
|
|
105
105
|
export interface PackageManifest {
|
|
106
106
|
/** Extension package name. Matches `^[a-z][a-z0-9-]*$`. */
|
|
@@ -117,22 +117,28 @@ export interface PackageManifest {
|
|
|
117
117
|
main: string;
|
|
118
118
|
/** Semver range checked against the host extension API version. */
|
|
119
119
|
enginesPstdio: string;
|
|
120
|
+
/** Prompt Studio-specific package metadata. */
|
|
121
|
+
pstdio?: {
|
|
122
|
+
/** Install/load scope. Defaults to "user" when omitted. */
|
|
123
|
+
scope?: ExtensionLoadScope;
|
|
124
|
+
};
|
|
120
125
|
/** Derived `${publisher}.${name}`. */
|
|
121
126
|
id: string;
|
|
122
127
|
}
|
|
123
|
-
/** UI surface contributions:
|
|
128
|
+
/** UI surface contributions: modes, routes, panels, renderers. */
|
|
124
129
|
export interface UiContributions {
|
|
125
|
-
|
|
130
|
+
modes?: Record<string, ModeContribution>;
|
|
126
131
|
routes?: Record<string, RouteContribution>;
|
|
127
132
|
views?: Record<string, ViewContribution>;
|
|
128
|
-
|
|
133
|
+
treeItems?: Record<string, TreeItemContribution>;
|
|
129
134
|
settingsPanels?: Record<string, SettingsPanelContribution>;
|
|
135
|
+
dataRenderers?: Record<string, DataRendererContribution>;
|
|
130
136
|
activityRenderers?: Record<string, RendererContribution>;
|
|
131
137
|
sessionAnchorRenderers?: Record<string, RendererContribution>;
|
|
132
138
|
}
|
|
133
139
|
/** Behavioural surface: commands, middleware, hooks, schedules. */
|
|
134
140
|
export interface BehaviourContributions {
|
|
135
|
-
commands?: Record<string, CommandDefinition<any, any>>;
|
|
141
|
+
commands?: Record<string, CommandDefinition<any, any, any>>;
|
|
136
142
|
middlewares?: Record<string, MiddlewareDefinition<any, any>>;
|
|
137
143
|
hooks?: Record<string, HookDefinition<any>>;
|
|
138
144
|
schedules?: Record<string, ScheduleContribution<any>>;
|
|
@@ -162,7 +168,7 @@ export interface ExtensionLifecycle {
|
|
|
162
168
|
* contribution surfaces.
|
|
163
169
|
*/
|
|
164
170
|
export interface ExtensionDefinition extends UiContributions, BehaviourContributions, AssetContributions, ProviderContributions, ExtensionLifecycle {
|
|
165
|
-
settings?:
|
|
171
|
+
settings?: ExtensionSettingsContribution;
|
|
166
172
|
}
|
|
167
|
-
export type ExtensionSourceKind = "
|
|
173
|
+
export type ExtensionSourceKind = "local_path" | "git" | "registry";
|
|
168
174
|
export {};
|