@pstdio/sdk 0.10.0 → 0.12.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 +1 -4
- package/dist/api/extensions.d.ts +1 -1
- package/dist/api/index.d.ts +2 -6
- package/dist/api/workspaces.d.ts +2 -6
- package/dist/client/agents.d.ts +2 -7
- package/dist/client/client.d.ts +0 -9
- package/dist/client/index.d.ts +0 -3
- package/dist/client/index.js +17 -116
- package/dist/client/projects.d.ts +2 -2
- package/dist/client/workspaces.d.ts +2 -4
- package/dist/extensions/command-outcome.d.ts +5 -0
- package/dist/extensions/define-command.d.ts +1 -3
- package/dist/extensions/define-extension-view.d.ts +25 -0
- package/dist/extensions/define-extension.d.ts +1 -4
- package/dist/extensions/index.d.ts +6 -8
- package/dist/extensions/index.js +145 -89
- package/dist/extensions/params.d.ts +2 -1
- package/dist/extensions/refs.d.ts +2 -14
- package/dist/extensions/when.d.ts +9 -0
- package/dist/hooks/entities.d.ts +7 -9
- package/dist/hooks/index.d.ts +0 -2
- package/dist/hooks/session.d.ts +2 -3
- package/dist/hooks/worktree.d.ts +4 -3
- package/dist/resources/agent.d.ts +1 -1
- package/dist/resources/index.d.ts +2 -5
- package/dist/resources/index.js +3 -1
- package/dist/resources/known-agents.d.ts +2 -0
- package/dist/resources/workspace.d.ts +0 -1
- package/package.json +2 -2
- package/dist/api/agents.d.ts +0 -1
- package/dist/api/statuses.d.ts +0 -2
- package/dist/api/tags.d.ts +0 -2
- package/dist/api/tickets.d.ts +0 -26
- package/dist/client/statuses.d.ts +0 -24
- package/dist/client/tags.d.ts +0 -15
- package/dist/client/tickets.d.ts +0 -24
- package/dist/extensions/kernel-slots.d.ts +0 -168
- package/dist/extensions/package-asset.d.ts +0 -10
- package/dist/extensions/slots.d.ts +0 -6
- package/dist/extensions/types/commands.d.ts +0 -125
- package/dist/extensions/types/context.d.ts +0 -396
- package/dist/extensions/types/contributions.d.ts +0 -275
- package/dist/extensions/types/events.d.ts +0 -10
- package/dist/extensions/types/extension.d.ts +0 -174
- package/dist/extensions/types/index.d.ts +0 -10
- package/dist/extensions/types/json.d.ts +0 -7
- package/dist/extensions/types/params.d.ts +0 -80
- package/dist/extensions/types/resources.d.ts +0 -25
- package/dist/extensions/types/slots.d.ts +0 -22
- package/dist/extensions/types/webview-capabilities.d.ts +0 -65
- package/dist/extensions/workbench-targets.d.ts +0 -134
- package/dist/hooks/attempt.d.ts +0 -16
- package/dist/hooks/ticket.d.ts +0 -26
- package/dist/resources/status.d.ts +0 -2
- package/dist/resources/tag.d.ts +0 -2
- package/dist/resources/ticket.d.ts +0 -2
package/README.md
CHANGED
|
@@ -51,10 +51,7 @@ const client = createClient({
|
|
|
51
51
|
token: process.env.PSTDIO_API_TOKEN,
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
-
const
|
|
55
|
-
status: "wip",
|
|
56
|
-
tag: ["backend", "bug"],
|
|
57
|
-
});
|
|
54
|
+
const projects = await client.projects.list();
|
|
58
55
|
```
|
|
59
56
|
|
|
60
57
|
### Client options
|
package/dist/api/extensions.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
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";
|
|
1
|
+
export type { CommandExecuteRequest, CommandExecuteResponse, ExtensionCommandPaletteContribution, ExtensionCommandPaletteResourceRecord, ExtensionCommandRecord, ExtensionDataRendererRecord, ExtensionDiagnostic, ExtensionKeybindingRecord, ExtensionMenuContribution, ExtensionModeRecord, ExtensionNavigationRecord, ExtensionRecord, ExtensionRouteRecord, ExtensionSettingDefinitionRecord, ExtensionSettingsPanelRecord, ExtensionSettingValueRecord, ExtensionTreeItemContribution, ExtensionTreeRendererRecord, ExtensionViewRecord, ListExtensionAppearanceResponse, ListExtensionCommandsResponse, ListExtensionSettingsResponse, ListProjectExtensionsResponse, LocalizableString, ModeLayoutContributionRecord, ProjectExtensionInstance, UpdateExtensionSettingRequest, UpdateInstalledExtensionTemplateInput, UpdateInstalledExtensionTemplateResponse, WorkbenchExtensionCommandPaletteResourceRecord, WorkbenchExtensionDataRendererRecord, WorkbenchExtensionMetadata, WorkbenchExtensionTreeRendererRecord, } from "pstdio-api-contracts";
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
export type {
|
|
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";
|
|
1
|
+
export type { CommandExecuteRequest, CommandExecuteResponse, ExtensionCommandPaletteContribution, ExtensionCommandPaletteResourceRecord, ExtensionCommandRecord, ExtensionDataRendererRecord, ExtensionDiagnostic, ExtensionKeybindingRecord, ExtensionMenuContribution, ExtensionModeRecord, ExtensionNavigationRecord, ExtensionRecord, ExtensionRouteRecord, ExtensionSettingDefinitionRecord, ExtensionSettingsPanelRecord, ExtensionSettingValueRecord, ExtensionTreeItemContribution, ExtensionTreeRendererRecord, ExtensionViewRecord, ListExtensionAppearanceResponse, ListExtensionCommandsResponse, ListExtensionSettingsResponse, ListProjectExtensionsResponse, LocalizableString, ProjectExtensionInstance, UpdateExtensionSettingRequest, UpdateInstalledExtensionTemplateInput, UpdateInstalledExtensionTemplateResponse, WorkbenchExtensionCommandPaletteResourceRecord, WorkbenchExtensionDataRendererRecord, WorkbenchExtensionMetadata, WorkbenchExtensionTreeRendererRecord, } from "./extensions";
|
|
3
2
|
export type { CreateProjectInput, RegisterRepoInput } from "./projects";
|
|
4
3
|
export type { ApprovalInput, CreateSessionInput, FollowUpInput, ResolveSessionIdInput, ResolveSessionIdResponse, SessionConversationResponse, } from "./sessions";
|
|
5
4
|
export type { Settings, UpdateSettingsInput } from "./settings";
|
|
6
5
|
export type { UpdateSkillInput } from "./skills";
|
|
7
|
-
export type { CreateAttemptStatusInput, CreateStatusInput } from "./statuses";
|
|
8
|
-
export type { CreateTagInput, CreateTagOptionInput, UpdateTagInput, UpdateTagOptionInput } from "./tags";
|
|
9
6
|
export type { CreateTemplateInput, UpdateTemplateInput } from "./templates";
|
|
10
|
-
export type {
|
|
11
|
-
export type { CreateWorkspaceInput, RemoveWorktreeResponse, UpdateAttemptStatusInput, UpdateAttemptStatusResponse, } from "./workspaces";
|
|
7
|
+
export type { CreateWorkspaceInput, RemoveWorktreeResponse, RenameWorkspaceInput } from "./workspaces";
|
package/dist/api/workspaces.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import type { CreateWorkspaceInput as ContractCreateWorkspaceInput, ListWorkspaceActivityInput as ContractListWorkspaceActivityInput, ListWorkspaceActivityResponse as ContractListWorkspaceActivityResponse, RemoveWorktreeResponse as ContractRemoveWorktreeResponse,
|
|
2
|
-
/** @deprecated Requires legacy ticket-workspace linkage. Ticket ownership is moving to the pstdio tickets extension. */
|
|
1
|
+
import type { CreateWorkspaceInput as ContractCreateWorkspaceInput, ListWorkspaceActivityInput as ContractListWorkspaceActivityInput, ListWorkspaceActivityResponse as ContractListWorkspaceActivityResponse, RemoveWorktreeResponse as ContractRemoveWorktreeResponse, RenameWorkspaceInput as ContractRenameWorkspaceInput } from "pstdio-api-contracts";
|
|
3
2
|
export type CreateWorkspaceInput = ContractCreateWorkspaceInput;
|
|
4
3
|
export type ListWorkspaceActivityInput = ContractListWorkspaceActivityInput;
|
|
5
4
|
export type ListWorkspaceActivityResponse = ContractListWorkspaceActivityResponse;
|
|
6
5
|
export type RemoveWorktreeResponse = ContractRemoveWorktreeResponse;
|
|
7
|
-
|
|
8
|
-
export type UpdateAttemptStatusInput = ContractUpdateAttemptStatusInput;
|
|
9
|
-
/** @deprecated Legacy ticket attempt status mutation. Workspace status automation is extension-owned. */
|
|
10
|
-
export type UpdateAttemptStatusResponse = ContractUpdateAttemptStatusResponse;
|
|
6
|
+
export type RenameWorkspaceInput = ContractRenameWorkspaceInput;
|
package/dist/client/agents.d.ts
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import type { AgentModel
|
|
2
|
-
import type {
|
|
1
|
+
import type { AgentModel } from "pstdio-api-contracts";
|
|
2
|
+
import type { AgentInfo } from "../resources";
|
|
3
3
|
import type { RequestFn } from "./request";
|
|
4
4
|
export type AgentClient = {
|
|
5
|
-
list(): Promise<AgentConfig[]>;
|
|
6
5
|
info(): Promise<AgentInfo[]>;
|
|
7
6
|
models(agentId: string): Promise<AgentModel[]>;
|
|
8
|
-
setup(input: SetupAgentInput): Promise<AgentConfig>;
|
|
9
|
-
setupAvailable(input: SetupAvailableAgentsInput): Promise<AgentConfig[]>;
|
|
10
|
-
update(agentId: string, input: UpdateAgentInput): Promise<AgentConfig>;
|
|
11
|
-
delete(agentId: string): Promise<void>;
|
|
12
7
|
};
|
|
13
8
|
export declare const createAgentClient: (request: RequestFn) => AgentClient;
|
package/dist/client/client.d.ts
CHANGED
|
@@ -5,22 +5,13 @@ import type { ClientOptions } from "./request";
|
|
|
5
5
|
import { type SessionClient } from "./sessions";
|
|
6
6
|
import { type SettingsClient } from "./settings";
|
|
7
7
|
import { type SkillClient } from "./skills";
|
|
8
|
-
import { type StatusClient } from "./statuses";
|
|
9
8
|
import { type SyncClient } from "./sync";
|
|
10
|
-
import { type TagClient } from "./tags";
|
|
11
9
|
import { type TemplateClient } from "./templates";
|
|
12
|
-
import { type TicketClient } from "./tickets";
|
|
13
10
|
import { type WorkspaceClient } from "./workspaces";
|
|
14
11
|
export type PstdioClient = {
|
|
15
12
|
projects: ProjectClient;
|
|
16
|
-
/** @deprecated Legacy core ticket client. Ticket data is owned by the pstdio tickets extension. */
|
|
17
|
-
tickets: TicketClient;
|
|
18
13
|
workspaces: WorkspaceClient;
|
|
19
14
|
sessions: SessionClient;
|
|
20
|
-
/** @deprecated Legacy core ticket status client. Ticket statuses are owned by the pstdio tickets extension. */
|
|
21
|
-
statuses: StatusClient;
|
|
22
|
-
/** @deprecated Legacy core ticket tag client. Ticket tags are owned by the pstdio tickets extension. */
|
|
23
|
-
tags: TagClient;
|
|
24
15
|
templates: TemplateClient;
|
|
25
16
|
skills: SkillClient;
|
|
26
17
|
agents: AgentClient;
|
package/dist/client/index.d.ts
CHANGED
|
@@ -7,9 +7,6 @@ export type { ListSessionsInput, SessionClient, SessionStreamConnection, Session
|
|
|
7
7
|
export type { SettingsClient } from "./settings";
|
|
8
8
|
export type { SkillClient } from "./skills";
|
|
9
9
|
export type { SseEvent } from "./sse";
|
|
10
|
-
export type { StatusClient } from "./statuses";
|
|
11
10
|
export { applySyncEvent, parseSyncDeleteEvent, type StartSyncInput, type SyncClient, type SyncConnection, type SyncRow, type SyncWriter, type SyncWriterProvider, } from "./sync";
|
|
12
|
-
export type { TagClient } from "./tags";
|
|
13
11
|
export type { TemplateClient } from "./templates";
|
|
14
|
-
export type { TicketClient } from "./tickets";
|
|
15
12
|
export type { WorkspaceClient } from "./workspaces";
|
package/dist/client/index.js
CHANGED
|
@@ -1,12 +1,7 @@
|
|
|
1
1
|
// src/client/agents.ts
|
|
2
2
|
var createAgentClient = (request) => ({
|
|
3
|
-
list: () => request("/v1/agents"),
|
|
4
3
|
info: () => request("/v1/agents/info"),
|
|
5
|
-
models: (agentId) => request(`/v1/agents/${agentId}/models`)
|
|
6
|
-
setup: (input) => request("/v1/agents", { method: "POST", body: input }),
|
|
7
|
-
setupAvailable: (input) => request("/v1/agents/setup-available", { method: "POST", body: input }),
|
|
8
|
-
update: (agentId, input) => request(`/v1/agents/${agentId}`, { method: "PATCH", body: input }),
|
|
9
|
-
delete: (agentId) => request(`/v1/agents/${agentId}`, { method: "DELETE" })
|
|
4
|
+
models: (agentId) => request(`/v1/agents/${agentId}/models`)
|
|
10
5
|
});
|
|
11
6
|
|
|
12
7
|
// src/client/extensions.ts
|
|
@@ -107,19 +102,32 @@ var createRequestHeaders = (options, reqOpts = {}) => {
|
|
|
107
102
|
headers.set("authorization", `Bearer ${options.token}`);
|
|
108
103
|
return headers;
|
|
109
104
|
};
|
|
105
|
+
var isBinaryBody = (body) => body instanceof ArrayBuffer || ArrayBuffer.isView(body);
|
|
106
|
+
var serializeRequestBody = (body) => {
|
|
107
|
+
if (body instanceof ArrayBuffer)
|
|
108
|
+
return body;
|
|
109
|
+
if (ArrayBuffer.isView(body)) {
|
|
110
|
+
if (body.buffer instanceof ArrayBuffer)
|
|
111
|
+
return body;
|
|
112
|
+
const copy = new Uint8Array(body.byteLength);
|
|
113
|
+
copy.set(new Uint8Array(body.buffer, body.byteOffset, body.byteLength));
|
|
114
|
+
return copy;
|
|
115
|
+
}
|
|
116
|
+
return JSON.stringify(body);
|
|
117
|
+
};
|
|
110
118
|
var createRequest = (options) => {
|
|
111
119
|
const baseUrl = resolveBaseUrl(options);
|
|
112
120
|
const fetchFn = resolveFetch(options);
|
|
113
121
|
return async (path, reqOpts = {}) => {
|
|
114
122
|
const headers = createRequestHeaders(options, {
|
|
115
123
|
headers: reqOpts.headers,
|
|
116
|
-
hasJsonBody: reqOpts.body !== undefined
|
|
124
|
+
hasJsonBody: reqOpts.body !== undefined && !isBinaryBody(reqOpts.body)
|
|
117
125
|
});
|
|
118
126
|
const url = resolveClientUrl(baseUrl, path);
|
|
119
127
|
const response = await fetchFn(url, {
|
|
120
128
|
method: reqOpts.method ?? "GET",
|
|
121
129
|
headers: Object.fromEntries(headers.entries()),
|
|
122
|
-
body: reqOpts.body !== undefined ?
|
|
130
|
+
body: reqOpts.body !== undefined ? serializeRequestBody(reqOpts.body) : undefined,
|
|
123
131
|
signal: reqOpts.signal,
|
|
124
132
|
cache: reqOpts.cache
|
|
125
133
|
});
|
|
@@ -288,19 +296,6 @@ var createSkillClient = (request) => ({
|
|
|
288
296
|
updatePreferences: (projectId, skillName, input) => request(`/v1/projects/${projectId}/skills/${skillName}`, { method: "PUT", body: input })
|
|
289
297
|
});
|
|
290
298
|
|
|
291
|
-
// src/client/statuses.ts
|
|
292
|
-
var createStatusClient = (request) => ({
|
|
293
|
-
list: (projectId) => request(`/v1/projects/${projectId}/statuses`),
|
|
294
|
-
create: (projectId, input) => request(`/v1/projects/${projectId}/statuses`, { method: "POST", body: input }),
|
|
295
|
-
update: (projectId, statusId, input) => request(`/v1/projects/${projectId}/statuses/${statusId}`, { method: "PATCH", body: input }),
|
|
296
|
-
setDefault: (projectId, statusId) => request(`/v1/projects/${projectId}/statuses/${statusId}/set-default`, { method: "PATCH" }),
|
|
297
|
-
delete: (projectId, statusId) => request(`/v1/projects/${projectId}/statuses/${statusId}`, { method: "DELETE" }),
|
|
298
|
-
listAttemptStatuses: (projectId) => request(`/v1/projects/${projectId}/attempt-statuses`),
|
|
299
|
-
createAttemptStatus: (projectId, input) => request(`/v1/projects/${projectId}/attempt-statuses`, { method: "POST", body: input }),
|
|
300
|
-
updateAttemptStatus: (projectId, statusId, input) => request(`/v1/projects/${projectId}/attempt-statuses/${statusId}`, { method: "PATCH", body: input }),
|
|
301
|
-
deleteAttemptStatus: (projectId, statusId) => request(`/v1/projects/${projectId}/attempt-statuses/${statusId}`, { method: "DELETE" })
|
|
302
|
-
});
|
|
303
|
-
|
|
304
299
|
// src/client/sync.ts
|
|
305
300
|
var DEFAULT_HEARTBEAT_INTERVAL_MS = 1e4;
|
|
306
301
|
var DEFAULT_HEARTBEAT_THRESHOLD = 3;
|
|
@@ -432,17 +427,6 @@ var createSyncClient = (clientOptions) => ({
|
|
|
432
427
|
}
|
|
433
428
|
});
|
|
434
429
|
|
|
435
|
-
// src/client/tags.ts
|
|
436
|
-
var createTagClient = (request) => ({
|
|
437
|
-
list: (projectId) => request(`/v1/projects/${projectId}/ticket-tags`),
|
|
438
|
-
create: (projectId, input) => request(`/v1/projects/${projectId}/ticket-tags`, { method: "POST", body: input }),
|
|
439
|
-
update: (projectId, tagId, input) => request(`/v1/projects/${projectId}/ticket-tags/${tagId}`, { method: "PATCH", body: input }),
|
|
440
|
-
delete: (projectId, tagId) => request(`/v1/projects/${projectId}/ticket-tags/${tagId}`, { method: "DELETE" }),
|
|
441
|
-
createOption: (projectId, tagId, input) => request(`/v1/projects/${projectId}/ticket-tags/${tagId}/options`, { method: "POST", body: input }),
|
|
442
|
-
updateOption: (projectId, tagId, optionId, input) => request(`/v1/projects/${projectId}/ticket-tags/${tagId}/options/${optionId}`, { method: "PATCH", body: input }),
|
|
443
|
-
deleteOption: (projectId, tagId, optionId) => request(`/v1/projects/${projectId}/ticket-tags/${tagId}/options/${optionId}`, { method: "DELETE" })
|
|
444
|
-
});
|
|
445
|
-
|
|
446
430
|
// src/client/templates.ts
|
|
447
431
|
var createTemplateClient = (request) => ({
|
|
448
432
|
list: (projectId) => request(`/v1/projects/${projectId}/templates`),
|
|
@@ -452,86 +436,6 @@ var createTemplateClient = (request) => ({
|
|
|
452
436
|
delete: (projectId, templateId) => request(`/v1/projects/${projectId}/templates/${templateId}`, { method: "DELETE" })
|
|
453
437
|
});
|
|
454
438
|
|
|
455
|
-
// src/client/tickets.ts
|
|
456
|
-
var resolveBaseUrl2 = (options) => options.baseUrl ?? (typeof process !== "undefined" ? process.env.PSTDIO_API_URL : undefined) ?? "http://localhost:19840";
|
|
457
|
-
var readErrorMessage2 = async (response) => {
|
|
458
|
-
const errorBody = await response.json().catch(() => null);
|
|
459
|
-
if (errorBody && typeof errorBody === "object" && errorBody !== null && "error" in errorBody) {
|
|
460
|
-
return String(errorBody.error);
|
|
461
|
-
}
|
|
462
|
-
return `Request failed: ${response.status}`;
|
|
463
|
-
};
|
|
464
|
-
var buildTicketsQuery = (projectId, input = {}) => {
|
|
465
|
-
const params = new URLSearchParams({ project_id: projectId });
|
|
466
|
-
if (input.status)
|
|
467
|
-
params.append("status", input.status);
|
|
468
|
-
if (Array.isArray(input.tag)) {
|
|
469
|
-
for (const tag of input.tag)
|
|
470
|
-
params.append("tag", tag);
|
|
471
|
-
} else if (input.tag) {
|
|
472
|
-
params.append("tag", input.tag);
|
|
473
|
-
}
|
|
474
|
-
if (input.archived !== undefined)
|
|
475
|
-
params.append("archived", String(input.archived));
|
|
476
|
-
if (input.draft !== undefined)
|
|
477
|
-
params.append("draft", String(input.draft));
|
|
478
|
-
if (input.parent_id)
|
|
479
|
-
params.append("parent_id", input.parent_id);
|
|
480
|
-
if (input.shorthand)
|
|
481
|
-
params.append("shorthand", input.shorthand);
|
|
482
|
-
if (input.search)
|
|
483
|
-
params.append("search", input.search);
|
|
484
|
-
return params.toString();
|
|
485
|
-
};
|
|
486
|
-
var buildActivityQuery = (input = {}) => {
|
|
487
|
-
const params = new URLSearchParams;
|
|
488
|
-
if (input.resource_type)
|
|
489
|
-
params.append("resource_type", input.resource_type);
|
|
490
|
-
if (input.event_type)
|
|
491
|
-
params.append("event_type", input.event_type);
|
|
492
|
-
if (input.from)
|
|
493
|
-
params.append("from", input.from);
|
|
494
|
-
if (input.to)
|
|
495
|
-
params.append("to", input.to);
|
|
496
|
-
if (input.cursor)
|
|
497
|
-
params.append("cursor", input.cursor);
|
|
498
|
-
if (input.limit !== undefined)
|
|
499
|
-
params.append("limit", String(input.limit));
|
|
500
|
-
return params.toString();
|
|
501
|
-
};
|
|
502
|
-
var createTicketClient = (request, options = {}) => ({
|
|
503
|
-
list: (projectId, input) => request(`/v1/tickets?${buildTicketsQuery(projectId, input)}`),
|
|
504
|
-
get: (ticketId) => request(`/v1/tickets/${ticketId}`),
|
|
505
|
-
create: (input) => request("/v1/tickets", { method: "POST", body: input }),
|
|
506
|
-
update: (ticketId, input) => request(`/v1/tickets/${ticketId}`, { method: "PATCH", body: input }),
|
|
507
|
-
delete: (ticketId) => request(`/v1/tickets/${ticketId}`, { method: "DELETE" }),
|
|
508
|
-
createAttempt: (ticketId, input) => request(`/v1/tickets/${ticketId}/attempts`, { method: "POST", body: input }),
|
|
509
|
-
listActivity: (ticketId, input) => {
|
|
510
|
-
const query = buildActivityQuery(input);
|
|
511
|
-
return request(`/v1/tickets/${ticketId}/activity${query ? `?${query}` : ""}`);
|
|
512
|
-
},
|
|
513
|
-
listProjectActivity: (projectId, input) => {
|
|
514
|
-
const query = buildActivityQuery(input);
|
|
515
|
-
return request(`/v1/projects/${projectId}/activity${query ? `?${query}` : ""}`);
|
|
516
|
-
},
|
|
517
|
-
updateWhenAttemptStatus: (ticketId, input) => request(`/v1/tickets/${ticketId}/update-when-attempt-status`, { method: "POST", body: input }),
|
|
518
|
-
listFiles: (ticketId) => request(`/v1/tickets/${ticketId}/files`),
|
|
519
|
-
getFileContent: async (ticketId, fileId, requestOptions = {}) => {
|
|
520
|
-
const baseUrl = resolveBaseUrl2(options);
|
|
521
|
-
const fetchFn = options.fetch ?? globalThis.fetch;
|
|
522
|
-
const headers = {};
|
|
523
|
-
if (options.token)
|
|
524
|
-
headers.authorization = `Bearer ${options.token}`;
|
|
525
|
-
const response = await fetchFn(`${baseUrl}/v1/tickets/${encodeURIComponent(ticketId)}/files/${encodeURIComponent(fileId)}/content`, { cache: requestOptions.cache, headers, signal: requestOptions.signal });
|
|
526
|
-
if (!response.ok) {
|
|
527
|
-
throw new PstdioApiError(await readErrorMessage2(response), response.status);
|
|
528
|
-
}
|
|
529
|
-
return new Uint8Array(await response.arrayBuffer());
|
|
530
|
-
},
|
|
531
|
-
uploadFile: (ticketId, input) => request(`/v1/tickets/${ticketId}/files`, { method: "POST", body: input }),
|
|
532
|
-
deleteFile: (ticketId, fileId) => request(`/v1/tickets/${ticketId}/files/${fileId}`, { method: "DELETE" })
|
|
533
|
-
});
|
|
534
|
-
|
|
535
439
|
// src/client/workspaces.ts
|
|
536
440
|
var createWorkspaceClient = (request) => ({
|
|
537
441
|
listActivity: (workspaceId, input = {}) => {
|
|
@@ -552,7 +456,7 @@ var createWorkspaceClient = (request) => ({
|
|
|
552
456
|
list: (projectId) => request(`/v1/workspaces?project_id=${projectId}`),
|
|
553
457
|
getByShorthand: (projectId, shorthand) => request(`/v1/workspaces/by-shorthand?project_id=${encodeURIComponent(projectId)}&shorthand=${encodeURIComponent(shorthand)}`),
|
|
554
458
|
create: (input) => request("/v1/workspaces", { method: "POST", body: input }),
|
|
555
|
-
|
|
459
|
+
rename: (workspaceId, input) => request(`/v1/workspaces/${workspaceId}`, { method: "PATCH", body: input }),
|
|
556
460
|
removeWorktree: (workspaceId) => request(`/v1/workspaces/${workspaceId}/remove-worktree`, { method: "POST" }),
|
|
557
461
|
delete: (workspaceId) => request(`/v1/workspaces/${workspaceId}`, { method: "DELETE" })
|
|
558
462
|
});
|
|
@@ -562,11 +466,8 @@ var createClient = (options = {}) => {
|
|
|
562
466
|
const request = createRequest(options);
|
|
563
467
|
return {
|
|
564
468
|
projects: createProjectClient(request),
|
|
565
|
-
tickets: createTicketClient(request, options),
|
|
566
469
|
workspaces: createWorkspaceClient(request),
|
|
567
470
|
sessions: createSessionClient(request, options),
|
|
568
|
-
statuses: createStatusClient(request),
|
|
569
|
-
tags: createTagClient(request),
|
|
570
471
|
templates: createTemplateClient(request),
|
|
571
472
|
skills: createSkillClient(request),
|
|
572
473
|
agents: createAgentClient(request),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CreateProjectInput,
|
|
1
|
+
import type { CreateProjectInput, ListActivityResponse, ListProjectActivityInput, RegisterRepoInput, Repo } from "pstdio-api-contracts";
|
|
2
2
|
import type { Project } from "../resources";
|
|
3
3
|
import type { RequestFn } from "./request";
|
|
4
4
|
export type ProjectClient = {
|
|
@@ -6,7 +6,7 @@ export type ProjectClient = {
|
|
|
6
6
|
get(projectId: string): Promise<Project>;
|
|
7
7
|
create(input: CreateProjectInput): Promise<Project>;
|
|
8
8
|
delete(projectId: string): Promise<void>;
|
|
9
|
-
listActivity(projectId: string, input?:
|
|
9
|
+
listActivity(projectId: string, input?: ListProjectActivityInput): Promise<ListActivityResponse>;
|
|
10
10
|
listRepos(projectId: string): Promise<Repo[]>;
|
|
11
11
|
registerRepo(projectId: string, input: RegisterRepoInput): Promise<Repo>;
|
|
12
12
|
removeRepo(projectId: string, repoId: string): Promise<void>;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import type { CreateWorkspaceInput, ListWorkspaceActivityInput, ListWorkspaceActivityResponse, RemoveWorktreeResponse,
|
|
1
|
+
import type { CreateWorkspaceInput, ListWorkspaceActivityInput, ListWorkspaceActivityResponse, RemoveWorktreeResponse, RenameWorkspaceInput } from "pstdio-api-contracts";
|
|
2
2
|
import type { Workspace, WorkspaceListItem } from "../resources";
|
|
3
3
|
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. */
|
|
8
7
|
create(input: CreateWorkspaceInput): Promise<Workspace>;
|
|
9
|
-
|
|
10
|
-
updateAttemptStatus(workspaceId: string, input: UpdateAttemptStatusInput): Promise<UpdateAttemptStatusResponse>;
|
|
8
|
+
rename(workspaceId: string, input: RenameWorkspaceInput): Promise<Workspace>;
|
|
11
9
|
listActivity(workspaceId: string, input?: ListWorkspaceActivityInput): Promise<ListWorkspaceActivityResponse>;
|
|
12
10
|
removeWorktree(workspaceId: string): Promise<RemoveWorktreeResponse>;
|
|
13
11
|
delete(workspaceId: string): Promise<void>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { CommandOutcome } from "pstdio-api-contracts/extension-kernel";
|
|
2
|
+
export type CommandResponse<TResult = unknown> = {
|
|
3
|
+
outcome: CommandOutcome<TResult>;
|
|
4
|
+
};
|
|
5
|
+
export declare const unwrapCommandOutcome: <TResult>(response: CommandResponse<TResult>, fallbackReason?: string) => TResult;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type { CommandDefinition, HookDefinition, MiddlewareDefinition } from "
|
|
2
|
-
import type { Struct } from "./types/json";
|
|
3
|
-
import type { ParamObjectSchema } from "./types/params";
|
|
1
|
+
import type { CommandDefinition, HookDefinition, MiddlewareDefinition, ParamObjectSchema, Struct } from "pstdio-api-contracts/extension-kernel";
|
|
4
2
|
/**
|
|
5
3
|
* Define a single command outside an extension's object literal. Use this when commands
|
|
6
4
|
* grow large enough to split into separate files, or when you need to share a command
|
|
@@ -15,10 +15,35 @@ export type PropsStore<TProps = unknown> = {
|
|
|
15
15
|
get: () => TProps;
|
|
16
16
|
subscribe: (listener: (props: TProps) => void) => () => void;
|
|
17
17
|
};
|
|
18
|
+
export interface WebviewFilesClient {
|
|
19
|
+
pick(opts?: {
|
|
20
|
+
accept?: string;
|
|
21
|
+
multiple?: boolean;
|
|
22
|
+
}): Promise<File[]>;
|
|
23
|
+
upload(input: {
|
|
24
|
+
name: string;
|
|
25
|
+
data: Uint8Array | ArrayBuffer;
|
|
26
|
+
mimeType?: string;
|
|
27
|
+
scope?: {
|
|
28
|
+
type: string;
|
|
29
|
+
id?: string;
|
|
30
|
+
};
|
|
31
|
+
}): Promise<import("pstdio-api-contracts/extension-kernel").ExtensionBlobRef>;
|
|
32
|
+
list(input?: {
|
|
33
|
+
scope?: {
|
|
34
|
+
type: string;
|
|
35
|
+
id?: string;
|
|
36
|
+
};
|
|
37
|
+
}): Promise<import("pstdio-api-contracts/extension-kernel").ExtensionBlobRef[]>;
|
|
38
|
+
delete(id: string): Promise<void>;
|
|
39
|
+
}
|
|
18
40
|
export type ExtensionViewRenderContext<TProps = unknown> = {
|
|
19
41
|
mount: HTMLElement;
|
|
20
42
|
host: GuestHost;
|
|
43
|
+
files: WebviewFilesClient;
|
|
21
44
|
propsStore: PropsStore<TProps>;
|
|
45
|
+
locale: string;
|
|
46
|
+
t: (key: string, defaultValue?: string, args?: Record<string, unknown>) => string;
|
|
22
47
|
};
|
|
23
48
|
export type ExtensionViewRender<TProps = unknown> = (context: ExtensionViewRenderContext<TProps>) => void | (() => void) | Promise<void | (() => void)>;
|
|
24
49
|
export type ExtensionViewModule<TProps = unknown> = {
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import type { ExtensionSettingProperty, ExtensionSettingsContribution } from "
|
|
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";
|
|
1
|
+
import type { CommandDefinition, ExtensionDefinition, ExtensionSettingProperty, ExtensionSettingsContribution, HookDefinition, MiddlewareDefinition, ParamObjectSchema, ScheduleContribution, Struct } from "pstdio-api-contracts/extension-kernel";
|
|
5
2
|
type CommandSchemas = Record<string, ParamObjectSchema | undefined>;
|
|
6
3
|
type MiddlewareParams = Record<string, Struct>;
|
|
7
4
|
type MiddlewareResults = Record<string, unknown>;
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
+
export type * from "pstdio-api-contracts/extension-kernel";
|
|
2
|
+
export type { CommitPayload, ConflictPayload, MergePayload, RebasePayload, SessionLifecyclePayload, WorktreeCreatedEventPayload, WorktreeRemovedPayload, } from "pstdio-api-contracts/extension-kernel";
|
|
3
|
+
export { ALWAYS_AVAILABLE_WEBVIEW_CAPABILITIES, EXTENSION_API_VERSION, getWorkbenchTargetDefinition, gitEvents, isLocalizedString, type Localizable, type LocalizedString, l10n, packageAsset, projectEvents, projectSlots, sessionEvents, sessionSlots, WEBVIEW_DECLARABLE_CAPABILITIES, WEBVIEW_HOST_CAPABILITIES, WEBVIEW_HOST_CAPABILITY_VERSION, 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, workspaceEvents, workspaceSlots, worktreeEvents, } from "pstdio-api-contracts/extension-kernel";
|
|
4
|
+
export { type CommandResponse, unwrapCommandOutcome } from "./command-outcome";
|
|
1
5
|
export { defineCommand, defineHook, defineMiddleware } from "./define-command";
|
|
2
6
|
export { defineExtension } from "./define-extension";
|
|
3
|
-
export { defineExtensionView, type ExtensionViewModule, type ExtensionViewRender, type ExtensionViewRenderContext, type GuestHost, type PropsStore, } from "./define-extension-view";
|
|
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";
|
|
6
|
-
export { packageAsset } from "./package-asset";
|
|
7
|
+
export { defineExtensionView, type ExtensionViewModule, type ExtensionViewRender, type ExtensionViewRenderContext, type GuestHost, type PropsStore, type WebviewFilesClient, } from "./define-extension-view";
|
|
7
8
|
export { params } from "./params";
|
|
8
9
|
export { commandEvent, commandRef, commandsOf, eventRef } from "./refs";
|
|
9
|
-
export
|
|
10
|
-
export { EXTENSION_API_VERSION } from "./types/extension";
|
|
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";
|
|
10
|
+
export { matchesResourceWhen } from "./when";
|