@pstdio/sdk 0.8.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 +1 -2
- 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 +3 -2
- package/dist/client/index.d.ts +0 -1
- package/dist/client/index.js +0 -12
- package/dist/client/projects.d.ts +0 -11
- package/dist/client/statuses.d.ts +2 -0
- package/dist/client/tags.d.ts +2 -0
- package/dist/client/tickets.d.ts +2 -0
- 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 +120 -11
- package/dist/extensions/kernel-slots.d.ts +36 -35
- 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 +191 -12
- 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.js +2 -2
- 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
package/README.md
CHANGED
|
@@ -7,7 +7,7 @@ This package is the public integration surface for:
|
|
|
7
7
|
- calling the Prompt Studio HTTP API
|
|
8
8
|
- importing shared request and resource types
|
|
9
9
|
- rendering prompt templates
|
|
10
|
-
- authoring Prompt Studio
|
|
10
|
+
- authoring Prompt Studio extensions
|
|
11
11
|
|
|
12
12
|
The package is ESM-only and is published through subpath exports. Import from the entrypoint you need, not from `@pstdio/sdk` directly.
|
|
13
13
|
|
|
@@ -19,14 +19,13 @@ bun add @pstdio/sdk
|
|
|
19
19
|
|
|
20
20
|
## Entry Points
|
|
21
21
|
|
|
22
|
-
| Import path
|
|
23
|
-
|
|
|
24
|
-
| `@pstdio/sdk/client`
|
|
25
|
-
| `@pstdio/sdk/api`
|
|
26
|
-
| `@pstdio/sdk/resources`
|
|
27
|
-
| `@pstdio/sdk/
|
|
28
|
-
| `@pstdio/sdk/
|
|
29
|
-
| `@pstdio/sdk/hooks` | Hook context and hook client types |
|
|
22
|
+
| Import path | Purpose |
|
|
23
|
+
| ------------------------ | ------------------------------------- |
|
|
24
|
+
| `@pstdio/sdk/client` | Runtime HTTP client for Prompt Studio |
|
|
25
|
+
| `@pstdio/sdk/api` | Request and response payload types |
|
|
26
|
+
| `@pstdio/sdk/resources` | Shared resource/entity types |
|
|
27
|
+
| `@pstdio/sdk/prompts` | Prompt rendering helpers |
|
|
28
|
+
| `@pstdio/sdk/extensions` | Extension authoring types |
|
|
30
29
|
|
|
31
30
|
Example:
|
|
32
31
|
|
|
@@ -34,9 +33,8 @@ Example:
|
|
|
34
33
|
import { createClient, PstdioApiError } from "@pstdio/sdk/client";
|
|
35
34
|
import type { CreateTicketInput } from "@pstdio/sdk/api";
|
|
36
35
|
import type { TicketDetail } from "@pstdio/sdk/resources";
|
|
37
|
-
import { createSession, definePlugin } from "@pstdio/sdk/plugins";
|
|
38
36
|
import { renderPrompt } from "@pstdio/sdk/prompts";
|
|
39
|
-
import type {
|
|
37
|
+
import type { ExtensionDefinition } from "@pstdio/sdk/extensions";
|
|
40
38
|
```
|
|
41
39
|
|
|
42
40
|
## HTTP Client
|
|
@@ -71,7 +69,6 @@ The request layer throws `PstdioApiError` for non-2xx responses.
|
|
|
71
69
|
|
|
72
70
|
- `error.message`: API error message
|
|
73
71
|
- `error.status`: HTTP status code
|
|
74
|
-
- when the API returns `hook_output`, it is appended to `message`
|
|
75
72
|
|
|
76
73
|
```ts
|
|
77
74
|
import { PstdioApiError, createClient } from "@pstdio/sdk/client";
|
|
@@ -105,7 +102,6 @@ try {
|
|
|
105
102
|
| `templates` | `list`, `get`, `create`, `update`, `delete` |
|
|
106
103
|
| `skills` | `list`, `get`, `update` |
|
|
107
104
|
| `agents` | `list`, `info`, `models`, `setup`, `setupAvailable`, `update`, `delete` |
|
|
108
|
-
| `actions` | `list`, `execute` |
|
|
109
105
|
|
|
110
106
|
Notes:
|
|
111
107
|
|
|
@@ -125,18 +121,11 @@ import type {
|
|
|
125
121
|
} from "@pstdio/sdk/api";
|
|
126
122
|
```
|
|
127
123
|
|
|
128
|
-
Most of these types come from `pstdio-api-contracts`.
|
|
129
|
-
|
|
130
|
-
- `ListTicketsInput`
|
|
131
|
-
- `TicketAttemptResponse`
|
|
132
|
-
- `ActionResult`
|
|
133
|
-
- `ExecuteActionInput`
|
|
134
|
-
|
|
135
|
-
Use `import type` for this entrypoint. It does not expose runtime helpers.
|
|
124
|
+
Most of these types come from `pstdio-api-contracts`. Use `import type` for this entrypoint. It does not expose runtime helpers.
|
|
136
125
|
|
|
137
126
|
## Resource Types
|
|
138
127
|
|
|
139
|
-
`@pstdio/sdk/resources` re-exports the shared Prompt Studio entities used across the API and
|
|
128
|
+
`@pstdio/sdk/resources` re-exports the shared Prompt Studio entities used across the API and extension system.
|
|
140
129
|
|
|
141
130
|
Common exports include `Project`, `Repo`, `Ticket`, `TicketDetail`, `TicketListItem`, `TicketFile`, `Workspace`,
|
|
142
131
|
`WorkspaceListItem`, `Session`, `SessionStatus`, `Status`, `AttemptStatus`, `Tag`, `TagOption`, `Template`,
|
|
@@ -163,179 +152,29 @@ const prompt = renderPrompt("Implement ticket {{ticket}}", {
|
|
|
163
152
|
});
|
|
164
153
|
```
|
|
165
154
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
## Plugins
|
|
169
|
-
|
|
170
|
-
Prompt Studio plugins export a default `definePlugin(...)` result from a TypeScript or JavaScript module.
|
|
171
|
-
|
|
172
|
-
Plugins can provide:
|
|
155
|
+
## Extensions
|
|
173
156
|
|
|
174
|
-
|
|
175
|
-
- `hooks`: lifecycle handlers that run before or after Prompt Studio events
|
|
176
|
-
|
|
177
|
-
### Action example
|
|
157
|
+
Prompt Studio extensions are packaged integrations that can contribute commands, middleware, lifecycle event handlers, menu entries, and webviews. Use `@pstdio/sdk/extensions` for the extension authoring types.
|
|
178
158
|
|
|
179
159
|
```ts
|
|
180
|
-
import {
|
|
181
|
-
|
|
182
|
-
export default definePlugin({
|
|
183
|
-
actions: [
|
|
184
|
-
{
|
|
185
|
-
key: "refine-ticket",
|
|
186
|
-
label: "Refine ticket",
|
|
187
|
-
targetType: "ticket",
|
|
188
|
-
placement: "overflow",
|
|
189
|
-
params: [
|
|
190
|
-
{
|
|
191
|
-
key: "context",
|
|
192
|
-
label: "Additional context",
|
|
193
|
-
type: "longtext",
|
|
194
|
-
required: false,
|
|
195
|
-
},
|
|
196
|
-
],
|
|
197
|
-
async trigger(ctx) {
|
|
198
|
-
const context = ctx.params.context as string | undefined;
|
|
199
|
-
|
|
200
|
-
const parts = [`Refine ticket: ${ctx.target.shorthand}`];
|
|
201
|
-
if (context) parts.push(`Additional context:\n${context}`);
|
|
202
|
-
|
|
203
|
-
await createSession(ctx, {
|
|
204
|
-
title: `Refine ticket: ${ctx.target.shorthand}`,
|
|
205
|
-
prompt: parts.join("\n\n"),
|
|
206
|
-
});
|
|
207
|
-
},
|
|
208
|
-
},
|
|
209
|
-
],
|
|
210
|
-
});
|
|
211
|
-
```
|
|
160
|
+
import type { ExtensionDefinition } from "@pstdio/sdk/extensions";
|
|
212
161
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
"bun",
|
|
226
|
-
"run",
|
|
227
|
-
"validate",
|
|
228
|
-
]);
|
|
229
|
-
if (validation.exitCode === 0) return;
|
|
230
|
-
|
|
231
|
-
const output = [validation.stdout, validation.stderr]
|
|
232
|
-
.filter(Boolean)
|
|
233
|
-
.join("\n\n");
|
|
234
|
-
|
|
235
|
-
return {
|
|
236
|
-
reject: true,
|
|
237
|
-
reason: output || "bun run validate failed",
|
|
238
|
-
};
|
|
239
|
-
},
|
|
162
|
+
const extension: ExtensionDefinition = {
|
|
163
|
+
manifest: {
|
|
164
|
+
id: "example-extension",
|
|
165
|
+
name: "Example extension",
|
|
166
|
+
version: "0.0.0",
|
|
167
|
+
},
|
|
168
|
+
activate(ctx) {
|
|
169
|
+
ctx.commands.register({
|
|
170
|
+
id: "example-extension.say-hello",
|
|
171
|
+
title: "Say hello",
|
|
172
|
+
handler: () => ({ ok: true }),
|
|
173
|
+
});
|
|
240
174
|
},
|
|
241
|
-
});
|
|
242
|
-
```
|
|
243
|
-
|
|
244
|
-
### Plugin types
|
|
245
|
-
|
|
246
|
-
The plugin entrypoint exports the core types used by plugin authors, including `PluginDefinition`, `PluginHooks`,
|
|
247
|
-
`PrePluginHooks`, `PostPluginHooks`, `HookResponse`, `PreHookReturn`, `PostHookReturn`, `ActionDefinition`,
|
|
248
|
-
`ActionDescriptor`, `ActionInput`, `ActionTriggerContext`, `ActionParamDef`, `TargetType`, and `ActionPlacement`.
|
|
249
|
-
|
|
250
|
-
Action parameter definitions support `text`, `longtext`, `select`, `template-select`, `agent`, and `repo`.
|
|
251
|
-
Action targets support `ticket`, `workspace`, and `session`. Action placement supports `primary`, `secondary`,
|
|
252
|
-
and `overflow`.
|
|
253
|
-
|
|
254
|
-
`definePlugin()` is intentionally small. Today it mainly validates that every declared action has a `trigger(ctx)` function and then returns the plugin definition unchanged.
|
|
255
|
-
|
|
256
|
-
### Lifecycle hooks
|
|
257
|
-
|
|
258
|
-
Pre hooks may return `{ reject, reason, data }` to stop an operation. Post hooks return `void`.
|
|
259
|
-
|
|
260
|
-
Available pre hooks:
|
|
261
|
-
|
|
262
|
-
- `preTicketCreation`
|
|
263
|
-
- `preTicketStatusChange`
|
|
264
|
-
- `preTicketArchive`
|
|
265
|
-
- `preTicketDeletion`
|
|
266
|
-
- `preWorktreeCreate`
|
|
267
|
-
- `preWorktreeRemove`
|
|
268
|
-
- `preCommit`
|
|
269
|
-
- `preRebase`
|
|
270
|
-
- `preMerge`
|
|
271
|
-
- `preAttemptStatusChange`
|
|
272
|
-
|
|
273
|
-
Available post hooks:
|
|
274
|
-
|
|
275
|
-
- `postTicketCreation`
|
|
276
|
-
- `postTicketStatusChange`
|
|
277
|
-
- `postTicketArchive`
|
|
278
|
-
- `postTicketDeletion`
|
|
279
|
-
- `postSessionStart`
|
|
280
|
-
- `postSessionSuccess`
|
|
281
|
-
- `postSessionFail`
|
|
282
|
-
- `postSessionResume`
|
|
283
|
-
- `postSessionAwaitInput`
|
|
284
|
-
- `postWorktreeCreate`
|
|
285
|
-
- `postWorktreeRemove`
|
|
286
|
-
- `postCommit`
|
|
287
|
-
- `postRebase`
|
|
288
|
-
- `postMerge`
|
|
289
|
-
- `onConflict`
|
|
290
|
-
- `postAttemptStatusChange`
|
|
291
|
-
|
|
292
|
-
### Plugin helpers
|
|
293
|
-
|
|
294
|
-
`@pstdio/sdk/plugins` also exports helper functions for common workflow automation:
|
|
295
|
-
|
|
296
|
-
| Helper | Purpose |
|
|
297
|
-
| ---------------------------------- | -------------------------------------------------------------------------------------------- |
|
|
298
|
-
| `createAttempt` | Create a ticket attempt and start a session |
|
|
299
|
-
| `createWorkspace` | Create a ticket attempt without starting a session |
|
|
300
|
-
| `createSession` | Create a session using `ctx.projectId` automatically |
|
|
301
|
-
| `followupSession` | Send a follow-up message using an explicit or contextual session id |
|
|
302
|
-
| `findTicketByRef` | Resolve a ticket by id or shorthand |
|
|
303
|
-
| `findWorkspaceByRef` | Resolve a workspace by id or shorthand |
|
|
304
|
-
| `getAttemptsForTicket` | List workspaces for a ticket |
|
|
305
|
-
| `workspacesForTicket` | List workspaces for a ticket |
|
|
306
|
-
| `setTicketStatus` | Resolve a status by name and update the ticket |
|
|
307
|
-
| `setWorkspaceAttemptStatus` | Update a workspace attempt status by name |
|
|
308
|
-
| `updateTicketWhenAllAttemptsMatch` | Update a ticket when all attempts share a target attempt status |
|
|
309
|
-
| `removeAllWorktreesForTicket` | Remove every worktree currently attached to a ticket |
|
|
310
|
-
| `bootstrapWorktree` | Copy Prompt Studio and agent metadata into a worktree and optionally pull the ticket locally |
|
|
311
|
-
| `pullTickets` | Write ticket markdown and attachments into `.pstdio/tickets/...` |
|
|
312
|
-
| `runCommand` | Run a command array in a working directory and capture `stdout`, `stderr`, and `exitCode` |
|
|
313
|
-
|
|
314
|
-
These helpers accept action or hook context and resolve project-scoped ids for you where possible.
|
|
315
|
-
|
|
316
|
-
## Hook Context Types
|
|
317
|
-
|
|
318
|
-
`@pstdio/sdk/hooks` exposes the shared context types used by hooks and hook runtimes:
|
|
319
|
-
|
|
320
|
-
`BaseHookContext`, `HookClient`, `HookPayload`, `SessionFollowupInput`, `AttemptStatusChangeContext`,
|
|
321
|
-
`SessionHookContext`, `TicketContext`, `TicketCreationContext`, `TicketStatusChangeContext`, `WorktreeContext`,
|
|
322
|
-
and `WorktreeCreateContext`.
|
|
323
|
-
|
|
324
|
-
Import from this entrypoint when you want to annotate hook code explicitly:
|
|
325
|
-
|
|
326
|
-
```ts
|
|
327
|
-
import type {
|
|
328
|
-
SessionHookContext,
|
|
329
|
-
TicketStatusChangeContext,
|
|
330
|
-
} from "@pstdio/sdk/hooks";
|
|
331
|
-
|
|
332
|
-
const logStatusChange = (ctx: TicketStatusChangeContext) => {
|
|
333
|
-
console.log(ctx.shorthand, ctx.fromStatus, ctx.toStatus);
|
|
334
175
|
};
|
|
335
176
|
|
|
336
|
-
|
|
337
|
-
console.log(ctx.sessionId, ctx.sessionStatus);
|
|
338
|
-
};
|
|
177
|
+
export default extension;
|
|
339
178
|
```
|
|
340
179
|
|
|
341
180
|
## Package Development
|
package/dist/api/extensions.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export type { CommandExecuteRequest, CommandExecuteResponse,
|
|
1
|
+
export type { CommandExecuteRequest, CommandExecuteResponse, ExtensionCommandRecord, ExtensionDataRendererRecord, ExtensionDiagnostic, ExtensionMenuContribution, ExtensionModeRecord, ExtensionNavigationRecord, ExtensionRecord, ExtensionRouteRecord, ExtensionSettingDefinitionRecord, ExtensionSettingsPanelRecord, ExtensionSettingValueRecord, ExtensionTreeItemContribution, ExtensionViewRecord, ListExtensionAppearanceResponse, ListExtensionCommandsResponse, ListExtensionSettingsResponse, ListProjectExtensionsResponse, ModeLayoutContributionRecord, ProjectExtensionInstance, UpdateExtensionSettingRequest, UpdateInstalledExtensionTemplateInput, UpdateInstalledExtensionTemplateResponse, WorkbenchExtensionDataRendererRecord, WorkbenchExtensionMetadata, } from "pstdio-api-contracts";
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
export type { ActionResult, ExecuteActionInput } from "./actions";
|
|
2
1
|
export type { SetupAgentInput, SetupAvailableAgentsInput, UpdateAgentInput } from "./agents";
|
|
3
|
-
export type { CommandExecuteRequest, CommandExecuteResponse,
|
|
2
|
+
export type { CommandExecuteRequest, CommandExecuteResponse, ExtensionCommandRecord, ExtensionDataRendererRecord, ExtensionDiagnostic, ExtensionMenuContribution, ExtensionModeRecord, ExtensionNavigationRecord, ExtensionRecord, ExtensionRouteRecord, ExtensionSettingDefinitionRecord, ExtensionSettingsPanelRecord, ExtensionSettingValueRecord, ExtensionTreeItemContribution, ExtensionViewRecord, ListExtensionAppearanceResponse, ListExtensionCommandsResponse, ListExtensionSettingsResponse, ListProjectExtensionsResponse, ProjectExtensionInstance, UpdateExtensionSettingRequest, UpdateInstalledExtensionTemplateInput, UpdateInstalledExtensionTemplateResponse, WorkbenchExtensionDataRendererRecord, WorkbenchExtensionMetadata, } from "./extensions";
|
|
4
3
|
export type { CreateProjectInput, RegisterRepoInput } from "./projects";
|
|
5
4
|
export type { ApprovalInput, CreateSessionInput, FollowUpInput, ResolveSessionIdInput, ResolveSessionIdResponse, SessionConversationResponse, } from "./sessions";
|
|
6
5
|
export type { Settings, UpdateSettingsInput } from "./settings";
|
package/dist/api/statuses.d.ts
CHANGED
package/dist/api/tags.d.ts
CHANGED
package/dist/api/tickets.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
/** @deprecated Legacy core ticket API. Ticket data is owned by the pstdio tickets extension. */
|
|
1
2
|
export type { CreateTicketAttemptInput, CreateTicketInput, ListProjectActivityForTicketsInput, ListTicketActivityInput, ListTicketActivityResponse, TicketAttemptMode, UpdateTicketInput, UpdateWhenAttemptStatusInput, UpdateWhenAttemptStatusResponse, UploadTicketFileInput, } from "pstdio-api-contracts";
|
|
2
3
|
import type { Ticket, Workspace } from "../resources";
|
|
4
|
+
/** @deprecated Legacy core ticket API. Ticket data is owned by the pstdio tickets extension. */
|
|
3
5
|
export type ListTicketsInput = {
|
|
4
6
|
status?: string;
|
|
5
7
|
tag?: string | string[];
|
|
@@ -9,6 +11,7 @@ export type ListTicketsInput = {
|
|
|
9
11
|
shorthand?: string;
|
|
10
12
|
search?: string;
|
|
11
13
|
};
|
|
14
|
+
/** @deprecated Legacy core ticket attempts. Ticket attempts are owned by the pstdio tickets extension. */
|
|
12
15
|
export type TicketAttemptResponse = {
|
|
13
16
|
mode: "worktree" | "current_branch";
|
|
14
17
|
ticket: Ticket;
|
package/dist/api/workspaces.d.ts
CHANGED
|
@@ -1 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
import type { CreateWorkspaceInput as ContractCreateWorkspaceInput, ListWorkspaceActivityInput as ContractListWorkspaceActivityInput, ListWorkspaceActivityResponse as ContractListWorkspaceActivityResponse, RemoveWorktreeResponse as ContractRemoveWorktreeResponse, UpdateAttemptStatusInput as ContractUpdateAttemptStatusInput, UpdateAttemptStatusResponse as ContractUpdateAttemptStatusResponse } from "pstdio-api-contracts";
|
|
2
|
+
/** @deprecated Requires legacy ticket-workspace linkage. Ticket ownership is moving to the pstdio tickets extension. */
|
|
3
|
+
export type CreateWorkspaceInput = ContractCreateWorkspaceInput;
|
|
4
|
+
export type ListWorkspaceActivityInput = ContractListWorkspaceActivityInput;
|
|
5
|
+
export type ListWorkspaceActivityResponse = ContractListWorkspaceActivityResponse;
|
|
6
|
+
export type RemoveWorktreeResponse = ContractRemoveWorktreeResponse;
|
|
7
|
+
/** @deprecated Legacy ticket attempt status mutation. Workspace status automation is extension-owned. */
|
|
8
|
+
export type UpdateAttemptStatusInput = ContractUpdateAttemptStatusInput;
|
|
9
|
+
/** @deprecated Legacy ticket attempt status mutation. Workspace status automation is extension-owned. */
|
|
10
|
+
export type UpdateAttemptStatusResponse = ContractUpdateAttemptStatusResponse;
|
package/dist/client/client.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type ActionClient } from "./actions";
|
|
2
1
|
import { type AgentClient } from "./agents";
|
|
3
2
|
import { type ExtensionClient } from "./extensions";
|
|
4
3
|
import { type ProjectClient } from "./projects";
|
|
@@ -14,15 +13,17 @@ import { type TicketClient } from "./tickets";
|
|
|
14
13
|
import { type WorkspaceClient } from "./workspaces";
|
|
15
14
|
export type PstdioClient = {
|
|
16
15
|
projects: ProjectClient;
|
|
16
|
+
/** @deprecated Legacy core ticket client. Ticket data is owned by the pstdio tickets extension. */
|
|
17
17
|
tickets: TicketClient;
|
|
18
18
|
workspaces: WorkspaceClient;
|
|
19
19
|
sessions: SessionClient;
|
|
20
|
+
/** @deprecated Legacy core ticket status client. Ticket statuses are owned by the pstdio tickets extension. */
|
|
20
21
|
statuses: StatusClient;
|
|
22
|
+
/** @deprecated Legacy core ticket tag client. Ticket tags are owned by the pstdio tickets extension. */
|
|
21
23
|
tags: TagClient;
|
|
22
24
|
templates: TemplateClient;
|
|
23
25
|
skills: SkillClient;
|
|
24
26
|
agents: AgentClient;
|
|
25
|
-
actions: ActionClient;
|
|
26
27
|
extensions: ExtensionClient;
|
|
27
28
|
settings: SettingsClient;
|
|
28
29
|
sync: SyncClient;
|
package/dist/client/index.d.ts
CHANGED
package/dist/client/index.js
CHANGED
|
@@ -1,12 +1,3 @@
|
|
|
1
|
-
// src/client/actions.ts
|
|
2
|
-
var createActionClient = (request) => ({
|
|
3
|
-
list: (projectId, targetType) => request(targetType ? `/v1/projects/${projectId}/actions?targetType=${targetType}` : `/v1/projects/${projectId}/actions`),
|
|
4
|
-
execute: (projectId, actionKey, input) => request(`/v1/projects/${projectId}/actions/${encodeURIComponent(actionKey)}/execute`, {
|
|
5
|
-
method: "POST",
|
|
6
|
-
body: input
|
|
7
|
-
})
|
|
8
|
-
});
|
|
9
|
-
|
|
10
1
|
// src/client/agents.ts
|
|
11
2
|
var createAgentClient = (request) => ({
|
|
12
3
|
list: () => request("/v1/agents"),
|
|
@@ -62,8 +53,6 @@ var createProjectClient = (request) => ({
|
|
|
62
53
|
const query = params.toString();
|
|
63
54
|
return request(`/v1/projects/${projectId}/activity${query ? `?${query}` : ""}`);
|
|
64
55
|
},
|
|
65
|
-
listPlugins: (projectId) => request(`/v1/projects/${projectId}/plugins`),
|
|
66
|
-
registerPlugins: (projectId) => request(`/v1/projects/${projectId}/plugins/register`, { method: "POST" }),
|
|
67
56
|
listRepos: (projectId) => request(`/v1/projects/${projectId}/repos`),
|
|
68
57
|
registerRepo: (projectId, input) => request(`/v1/projects/${projectId}/repos`, { method: "POST", body: input }),
|
|
69
58
|
removeRepo: (projectId, repoId) => request(`/v1/projects/${projectId}/repos/${repoId}`, { method: "DELETE" })
|
|
@@ -581,7 +570,6 @@ var createClient = (options = {}) => {
|
|
|
581
570
|
templates: createTemplateClient(request),
|
|
582
571
|
skills: createSkillClient(request),
|
|
583
572
|
agents: createAgentClient(request),
|
|
584
|
-
actions: createActionClient(request),
|
|
585
573
|
extensions: createExtensionClient(request),
|
|
586
574
|
settings: createSettingsClient(request),
|
|
587
575
|
sync: createSyncClient(options)
|
|
@@ -1,25 +1,14 @@
|
|
|
1
1
|
import type { CreateProjectInput, ListProjectActivityForTicketsInput, ListTicketActivityResponse, RegisterRepoInput, Repo } from "pstdio-api-contracts";
|
|
2
2
|
import type { Project } from "../resources";
|
|
3
3
|
import type { RequestFn } from "./request";
|
|
4
|
-
type RegisteredPlugin = {
|
|
5
|
-
identity: string;
|
|
6
|
-
filePath: string;
|
|
7
|
-
};
|
|
8
|
-
type RegisteredPluginsResponse = {
|
|
9
|
-
plugins: RegisteredPlugin[];
|
|
10
|
-
pluginsDir: string | null;
|
|
11
|
-
};
|
|
12
4
|
export type ProjectClient = {
|
|
13
5
|
list(): Promise<Project[]>;
|
|
14
6
|
get(projectId: string): Promise<Project>;
|
|
15
7
|
create(input: CreateProjectInput): Promise<Project>;
|
|
16
8
|
delete(projectId: string): Promise<void>;
|
|
17
|
-
listPlugins(projectId: string): Promise<RegisteredPluginsResponse>;
|
|
18
|
-
registerPlugins(projectId: string): Promise<RegisteredPluginsResponse>;
|
|
19
9
|
listActivity(projectId: string, input?: ListProjectActivityForTicketsInput): Promise<ListTicketActivityResponse>;
|
|
20
10
|
listRepos(projectId: string): Promise<Repo[]>;
|
|
21
11
|
registerRepo(projectId: string, input: RegisterRepoInput): Promise<Repo>;
|
|
22
12
|
removeRepo(projectId: string, repoId: string): Promise<void>;
|
|
23
13
|
};
|
|
24
14
|
export declare const createProjectClient: (request: RequestFn) => ProjectClient;
|
|
25
|
-
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AttemptStatus, CreateAttemptStatusInput, CreateStatusInput } from "pstdio-api-contracts";
|
|
2
2
|
import type { Status } from "../resources";
|
|
3
3
|
import type { RequestFn } from "./request";
|
|
4
|
+
/** @deprecated Legacy core ticket status client. Ticket statuses are owned by the pstdio tickets extension. */
|
|
4
5
|
export type StatusClient = {
|
|
5
6
|
list(projectId: string): Promise<Status[]>;
|
|
6
7
|
create(projectId: string, input: CreateStatusInput): Promise<Status>;
|
|
@@ -19,4 +20,5 @@ export type StatusClient = {
|
|
|
19
20
|
}): Promise<AttemptStatus>;
|
|
20
21
|
deleteAttemptStatus(projectId: string, statusId: string): Promise<void>;
|
|
21
22
|
};
|
|
23
|
+
/** @deprecated Legacy core ticket status client. Ticket statuses are owned by the pstdio tickets extension. */
|
|
22
24
|
export declare const createStatusClient: (request: RequestFn) => StatusClient;
|
package/dist/client/tags.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CreateTagInput, CreateTagOptionInput, UpdateTagInput, UpdateTagOptionInput } from "../api/tags";
|
|
2
2
|
import type { Tag, TagOption } from "../resources";
|
|
3
3
|
import type { RequestFn } from "./request";
|
|
4
|
+
/** @deprecated Legacy core ticket tag client. Ticket tags are owned by the pstdio tickets extension. */
|
|
4
5
|
export type TagClient = {
|
|
5
6
|
list(projectId: string): Promise<Tag[]>;
|
|
6
7
|
create(projectId: string, input: CreateTagInput): Promise<Tag>;
|
|
@@ -10,4 +11,5 @@ export type TagClient = {
|
|
|
10
11
|
updateOption(projectId: string, tagId: string, optionId: string, input: UpdateTagOptionInput): Promise<TagOption>;
|
|
11
12
|
deleteOption(projectId: string, tagId: string, optionId: string): Promise<void>;
|
|
12
13
|
};
|
|
14
|
+
/** @deprecated Legacy core ticket tag client. Ticket tags are owned by the pstdio tickets extension. */
|
|
13
15
|
export declare const createTagClient: (request: RequestFn) => TagClient;
|
package/dist/client/tickets.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CreateTicketAttemptInput, CreateTicketInput, ListProjectActivityForTicketsInput, ListTicketActivityInput, ListTicketActivityResponse, ListTicketsInput, TicketAttemptResponse, UpdateTicketInput, UpdateWhenAttemptStatusInput, UpdateWhenAttemptStatusResponse, UploadTicketFileInput } from "../api/tickets";
|
|
2
2
|
import type { Ticket, TicketDetail, TicketFile, TicketListItem } from "../resources";
|
|
3
3
|
import { type ClientOptions, type RequestFn } from "./request";
|
|
4
|
+
/** @deprecated Legacy core ticket client. Ticket data is owned by the pstdio tickets extension. */
|
|
4
5
|
export type TicketClient = {
|
|
5
6
|
list(projectId: string, input?: ListTicketsInput): Promise<TicketListItem[]>;
|
|
6
7
|
get(ticketId: string): Promise<TicketDetail>;
|
|
@@ -19,4 +20,5 @@ export type TicketClient = {
|
|
|
19
20
|
uploadFile(ticketId: string, input: UploadTicketFileInput): Promise<TicketFile>;
|
|
20
21
|
deleteFile(ticketId: string, fileId: string): Promise<void>;
|
|
21
22
|
};
|
|
23
|
+
/** @deprecated Legacy core ticket client. Ticket data is owned by the pstdio tickets extension. */
|
|
22
24
|
export declare const createTicketClient: (request: RequestFn, options?: ClientOptions) => TicketClient;
|
|
@@ -4,7 +4,9 @@ import type { RequestFn } from "./request";
|
|
|
4
4
|
export type WorkspaceClient = {
|
|
5
5
|
list(projectId: string): Promise<WorkspaceListItem[]>;
|
|
6
6
|
getByShorthand(projectId: string, shorthand: string): Promise<Workspace>;
|
|
7
|
+
/** @deprecated Requires legacy ticket-workspace linkage. Ticket ownership is moving to the pstdio tickets extension. */
|
|
7
8
|
create(input: CreateWorkspaceInput): Promise<Workspace>;
|
|
9
|
+
/** @deprecated Legacy ticket attempt status mutation. Workspace status automation is extension-owned. */
|
|
8
10
|
updateAttemptStatus(workspaceId: string, input: UpdateAttemptStatusInput): Promise<UpdateAttemptStatusResponse>;
|
|
9
11
|
listActivity(workspaceId: string, input?: ListWorkspaceActivityInput): Promise<ListWorkspaceActivityResponse>;
|
|
10
12
|
removeWorktree(workspaceId: string): Promise<RemoveWorktreeResponse>;
|
|
@@ -9,7 +9,7 @@ import type { ParamObjectSchema } from "./types/params";
|
|
|
9
9
|
* @example
|
|
10
10
|
* export const sayHello = defineCommand({
|
|
11
11
|
* title: "Say hello",
|
|
12
|
-
* params: { name: params.text() },
|
|
12
|
+
* params: { name: params.text({ required: true }) },
|
|
13
13
|
* async run(ctx) {
|
|
14
14
|
* ctx.params.name; // string
|
|
15
15
|
* },
|
|
@@ -1,15 +1,58 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
type
|
|
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
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
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
|
|
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 {
|
|
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";
|