@pstdio/sdk 0.13.1 → 0.14.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 +3 -1
- package/dist/api/index.d.ts +3 -1
- package/dist/api/index.js +14855 -0
- package/dist/api/sessions.d.ts +2 -1
- package/dist/client/client.d.ts +2 -0
- package/dist/client/extensions.d.ts +2 -1
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.js +57 -1
- package/dist/client/notifications.d.ts +23 -0
- package/dist/client/sessions.d.ts +7 -1
- package/dist/extensions/index.d.ts +1 -0
- package/dist/extensions/index.js +3 -0
- package/dist/resources/index.js +327 -227
- package/package.json +1 -1
package/dist/api/sessions.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export type { ApprovalInput, CreateSessionInput, FollowUpDecision, FollowUpInput, FollowUpResponse, ListSessionActivityInput, ListSessionActivityResponse, ResolveSessionIdInput, ResolveSessionIdResponse, SessionConversationResponse, } from "pstdio-api-contracts";
|
|
1
|
+
export type { ApprovalInput, CreateSessionInput, FollowUpDecision, FollowUpInput, FollowUpResponse, ListSessionActivityInput, ListSessionActivityResponse, ResolveSessionIdInput, ResolveSessionIdResponse, SessionAttachment, SessionAttachmentRef, SessionConversationResponse, } from "pstdio-api-contracts";
|
|
2
|
+
export { sessionAttachmentMimeTypesByExtension } from "pstdio-api-contracts";
|
package/dist/client/client.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type AgentClient } from "./agents";
|
|
2
2
|
import { type ExtensionClient } from "./extensions";
|
|
3
|
+
import { type NotificationsClient } from "./notifications";
|
|
3
4
|
import { type ProjectClient } from "./projects";
|
|
4
5
|
import type { ClientOptions } from "./request";
|
|
5
6
|
import { type SessionClient } from "./sessions";
|
|
@@ -15,6 +16,7 @@ export type PstdioClient = {
|
|
|
15
16
|
templates: TemplateClient;
|
|
16
17
|
skills: SkillClient;
|
|
17
18
|
agents: AgentClient;
|
|
19
|
+
notifications: NotificationsClient;
|
|
18
20
|
extensions: ExtensionClient;
|
|
19
21
|
settings: SettingsClient;
|
|
20
22
|
sync: SyncClient;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CommandExecuteRequest, CommandExecuteResponse, EnableInstalledExtensionRequest, EnableInstalledExtensionResponse, ListExtensionAppearanceResponse, ListExtensionCommandsResponse, UpdateInstalledExtensionTemplateInput, UpdateInstalledExtensionTemplateResponse } from "pstdio-api-contracts";
|
|
1
|
+
import type { CommandExecuteRequest, CommandExecuteResponse, DispatchExtensionEventInput, EnableInstalledExtensionRequest, EnableInstalledExtensionResponse, ListExtensionAppearanceResponse, ListExtensionCommandsResponse, UpdateInstalledExtensionTemplateInput, UpdateInstalledExtensionTemplateResponse } from "pstdio-api-contracts";
|
|
2
2
|
import type { RequestFn } from "./request";
|
|
3
3
|
export type ExtensionClient = {
|
|
4
4
|
enableInstalled(projectId: string, installName: string, request: EnableInstalledExtensionRequest): Promise<EnableInstalledExtensionResponse>;
|
|
@@ -6,5 +6,6 @@ export type ExtensionClient = {
|
|
|
6
6
|
listAppearance(projectId: string): Promise<ListExtensionAppearanceResponse>;
|
|
7
7
|
listCommands(projectId: string): Promise<ListExtensionCommandsResponse>;
|
|
8
8
|
execute(commandId: string, request: CommandExecuteRequest): Promise<CommandExecuteResponse>;
|
|
9
|
+
dispatchEvent(projectId: string, input: DispatchExtensionEventInput): Promise<void>;
|
|
9
10
|
};
|
|
10
11
|
export declare const createExtensionClient: (request: RequestFn) => ExtensionClient;
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type { AgentClient } from "./agents";
|
|
2
2
|
export { createClient, type PstdioClient } from "./client";
|
|
3
3
|
export type { ExtensionClient } from "./extensions";
|
|
4
|
+
export type { NotificationsClient } from "./notifications";
|
|
4
5
|
export type { ProjectClient } from "./projects";
|
|
5
6
|
export { type ClientOptions, createRequest, PstdioApiError, type RequestFn, type RequestOptions, } from "./request";
|
|
6
7
|
export type { ListSessionsInput, SessionClient, SessionStreamConnection, SessionStreamHandlers } from "./sessions";
|
package/dist/client/index.js
CHANGED
|
@@ -37,7 +37,51 @@ var createExtensionClient = (request) => ({
|
|
|
37
37
|
method: "POST",
|
|
38
38
|
body
|
|
39
39
|
});
|
|
40
|
-
}
|
|
40
|
+
},
|
|
41
|
+
dispatchEvent: (projectId, body) => request(`/v1/projects/${projectId}/extensions/events/dispatch`, {
|
|
42
|
+
method: "POST",
|
|
43
|
+
body
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// src/client/notifications.ts
|
|
48
|
+
var appendArrayOrValue = (params, key, value) => {
|
|
49
|
+
if (value === undefined)
|
|
50
|
+
return;
|
|
51
|
+
params.set(key, Array.isArray(value) ? value.join(",") : value);
|
|
52
|
+
};
|
|
53
|
+
var buildQuery = (query = {}) => {
|
|
54
|
+
const params = new URLSearchParams;
|
|
55
|
+
appendArrayOrValue(params, "status", query.status);
|
|
56
|
+
appendArrayOrValue(params, "priority", query.priority);
|
|
57
|
+
if (query.sourceExtensionId)
|
|
58
|
+
params.set("sourceExtensionId", query.sourceExtensionId);
|
|
59
|
+
if (query.resourceType)
|
|
60
|
+
params.set("resourceType", query.resourceType);
|
|
61
|
+
if (query.resourceId)
|
|
62
|
+
params.set("resourceId", query.resourceId);
|
|
63
|
+
if (query.cursor)
|
|
64
|
+
params.set("cursor", query.cursor);
|
|
65
|
+
if (query.limit !== undefined)
|
|
66
|
+
params.set("limit", String(query.limit));
|
|
67
|
+
const value = params.toString();
|
|
68
|
+
return value ? `?${value}` : "";
|
|
69
|
+
};
|
|
70
|
+
var notificationPath = (projectId, suffix = "") => `/v1/projects/${encodeURIComponent(projectId)}/notifications${suffix}`;
|
|
71
|
+
var createNotificationsClient = (request) => ({
|
|
72
|
+
list: (projectId, query) => request(notificationPath(projectId, buildQuery(query))),
|
|
73
|
+
count: (projectId, query) => request(notificationPath(projectId, `/count${buildQuery(query)}`)),
|
|
74
|
+
get: (projectId, id) => request(notificationPath(projectId, `/${encodeURIComponent(id)}`)),
|
|
75
|
+
create: (input) => {
|
|
76
|
+
const { projectId, ...body } = input;
|
|
77
|
+
return request(notificationPath(projectId), { method: "POST", body });
|
|
78
|
+
},
|
|
79
|
+
update: (projectId, id, input) => request(notificationPath(projectId, `/${encodeURIComponent(id)}`), { method: "PATCH", body: input }),
|
|
80
|
+
markRead: (projectId, id) => request(notificationPath(projectId, `/${encodeURIComponent(id)}/read`), { method: "POST" }),
|
|
81
|
+
dismiss: (projectId, id) => request(notificationPath(projectId, `/${encodeURIComponent(id)}/dismiss`), { method: "POST" }),
|
|
82
|
+
markDone: (projectId, id) => request(notificationPath(projectId, `/${encodeURIComponent(id)}/done`), { method: "POST" }),
|
|
83
|
+
snooze: (projectId, id, until) => request(notificationPath(projectId, `/${encodeURIComponent(id)}/snooze`), { method: "POST", body: { until } }),
|
|
84
|
+
resolveByDedupeKey: (projectId, input) => request(notificationPath(projectId, "/resolve-by-dedupe-key"), { method: "POST", body: input })
|
|
41
85
|
});
|
|
42
86
|
|
|
43
87
|
// src/client/projects.ts
|
|
@@ -273,6 +317,17 @@ var createSessionClient = (request, clientOptions) => ({
|
|
|
273
317
|
},
|
|
274
318
|
list: (projectId, input) => request(`/v1/sessions?${buildSessionsQuery(projectId, input)}`),
|
|
275
319
|
get: (sessionId) => request(`/v1/sessions/${sessionId}`),
|
|
320
|
+
uploadAttachment: (projectId, input) => request(`/v1/projects/${encodeURIComponent(projectId)}/session-attachments`, {
|
|
321
|
+
method: "POST",
|
|
322
|
+
body: input.data,
|
|
323
|
+
headers: {
|
|
324
|
+
"content-type": input.mimeType || "application/octet-stream",
|
|
325
|
+
"x-file-name": encodeURIComponent(input.name)
|
|
326
|
+
}
|
|
327
|
+
}),
|
|
328
|
+
deleteAttachment: (projectId, fileId) => request(`/v1/projects/${encodeURIComponent(projectId)}/session-attachments/${encodeURIComponent(fileId)}`, {
|
|
329
|
+
method: "DELETE"
|
|
330
|
+
}),
|
|
276
331
|
create: (input) => request("/v1/sessions", { method: "POST", body: input }),
|
|
277
332
|
archive: (sessionId) => request(`/v1/sessions/${sessionId}/archive`, { method: "POST" }),
|
|
278
333
|
followUp: (sessionId, input) => request(`/v1/sessions/${sessionId}/follow-up`, { method: "POST", body: input }),
|
|
@@ -486,6 +541,7 @@ var createClient = (options = {}) => {
|
|
|
486
541
|
templates: createTemplateClient(request),
|
|
487
542
|
skills: createSkillClient(request),
|
|
488
543
|
agents: createAgentClient(request),
|
|
544
|
+
notifications: createNotificationsClient(request),
|
|
489
545
|
extensions: createExtensionClient(request),
|
|
490
546
|
settings: createSettingsClient(request),
|
|
491
547
|
sync: createSyncClient(options)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { CreateNotificationInput, ListNotificationsQuery, ListNotificationsResponse, Notification, NotificationStatus, UpdateNotificationInput } from "pstdio-api-contracts";
|
|
2
|
+
import type { RequestFn } from "./request";
|
|
3
|
+
export type NotificationsClient = {
|
|
4
|
+
list(projectId: string, query?: ListNotificationsQuery): Promise<ListNotificationsResponse>;
|
|
5
|
+
count(projectId: string, query?: Pick<ListNotificationsQuery, "status" | "priority" | "sourceExtensionId">): Promise<{
|
|
6
|
+
count: number;
|
|
7
|
+
}>;
|
|
8
|
+
get(projectId: string, id: string): Promise<Notification>;
|
|
9
|
+
create(input: CreateNotificationInput): Promise<Notification>;
|
|
10
|
+
update(projectId: string, id: string, input: UpdateNotificationInput): Promise<Notification>;
|
|
11
|
+
markRead(projectId: string, id: string): Promise<Notification>;
|
|
12
|
+
dismiss(projectId: string, id: string): Promise<Notification>;
|
|
13
|
+
markDone(projectId: string, id: string): Promise<Notification>;
|
|
14
|
+
snooze(projectId: string, id: string, until: string): Promise<Notification>;
|
|
15
|
+
resolveByDedupeKey(projectId: string, input: {
|
|
16
|
+
dedupeKey: string;
|
|
17
|
+
status?: Extract<NotificationStatus, "done" | "dismissed" | "expired">;
|
|
18
|
+
}): Promise<{
|
|
19
|
+
resolved: number;
|
|
20
|
+
notifications: Notification[];
|
|
21
|
+
}>;
|
|
22
|
+
};
|
|
23
|
+
export declare const createNotificationsClient: (request: RequestFn) => NotificationsClient;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ApprovalInput, CreateSessionInput, FollowUpInput, FollowUpResponse, ListSessionActivityInput, ListSessionActivityResponse, ResolveSessionIdInput, ResolveSessionIdResponse, SessionConversationResponse } from "pstdio-api-contracts";
|
|
1
|
+
import type { ApprovalInput, CreateSessionInput, FollowUpInput, FollowUpResponse, ListSessionActivityInput, ListSessionActivityResponse, ResolveSessionIdInput, ResolveSessionIdResponse, SessionAttachment, SessionConversationResponse } from "pstdio-api-contracts";
|
|
2
2
|
import type { Session } from "../resources";
|
|
3
3
|
import { type ClientOptions, type RequestFn } from "./request";
|
|
4
4
|
import { type SseEvent } from "./sse";
|
|
@@ -10,6 +10,12 @@ export type ListSessionsInput = {
|
|
|
10
10
|
export type SessionClient = {
|
|
11
11
|
list(projectId: string, input?: ListSessionsInput): Promise<Session[]>;
|
|
12
12
|
get(sessionId: string): Promise<Session>;
|
|
13
|
+
uploadAttachment(projectId: string, input: {
|
|
14
|
+
name: string;
|
|
15
|
+
data: Uint8Array | ArrayBuffer;
|
|
16
|
+
mimeType?: string | null;
|
|
17
|
+
}): Promise<SessionAttachment>;
|
|
18
|
+
deleteAttachment(projectId: string, fileId: string): Promise<void>;
|
|
13
19
|
create(input: CreateSessionInput): Promise<Session>;
|
|
14
20
|
archive(sessionId: string): Promise<void>;
|
|
15
21
|
followUp(sessionId: string, input: FollowUpInput): Promise<FollowUpResponse>;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export type { CreateNotificationInput, ListNotificationsQuery, ListNotificationsResponse, Notification, NotificationAction, NotificationActionResult, NotificationActorType, NotificationKind, NotificationOrigin, NotificationPriority, NotificationStatus, UpdateNotificationInput, } from "pstdio-api-contracts";
|
|
1
2
|
export type * from "pstdio-api-contracts/extension-kernel";
|
|
2
3
|
export type { CommitPayload, ConflictPayload, MergePayload, RebasePayload, SessionLifecyclePayload, WorktreeCreatedEventPayload, WorktreeRemovedPayload, } from "pstdio-api-contracts/extension-kernel";
|
|
3
4
|
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";
|
package/dist/extensions/index.js
CHANGED
|
@@ -89,6 +89,9 @@ var WEBVIEW_DECLARABLE_CAPABILITIES = [
|
|
|
89
89
|
"commands.execute",
|
|
90
90
|
"resource.open",
|
|
91
91
|
"notification.show",
|
|
92
|
+
"notification.action",
|
|
93
|
+
"notification.resolve",
|
|
94
|
+
"notification.dismiss",
|
|
92
95
|
"preferences.get",
|
|
93
96
|
"preferences.set",
|
|
94
97
|
"extension.settings.all",
|