@pstdio/sdk 0.13.2 → 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.
@@ -1,3 +1,4 @@
1
+ export type { CreateNotificationInput, ListNotificationsQuery, ListNotificationsResponse, Notification, NotificationAction, NotificationActionResult, NotificationActorType, NotificationKind, NotificationOrigin, NotificationPriority, NotificationStatus, ResourceRef, UpdateNotificationInput, } from "pstdio-api-contracts";
1
2
  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";
2
3
  export type { CreateProjectInput, RegisterRepoInput } from "./projects";
3
4
  export type { ApprovalInput, CreateSessionInput, FollowUpInput, ResolveSessionIdInput, ResolveSessionIdResponse, SessionAttachment, SessionAttachmentRef, SessionConversationResponse, } from "./sessions";
package/dist/api/index.js CHANGED
@@ -13669,6 +13669,9 @@ var WEBVIEW_DECLARABLE_CAPABILITIES = [
13669
13669
  "commands.execute",
13670
13670
  "resource.open",
13671
13671
  "notification.show",
13672
+ "notification.action",
13673
+ "notification.resolve",
13674
+ "notification.dismiss",
13672
13675
  "preferences.get",
13673
13676
  "preferences.set",
13674
13677
  "extension.settings.all",
@@ -14130,6 +14133,7 @@ var workbenchExtensionSettingsPanelRecordSchema = extensionSettingsPanelRecordSc
14130
14133
  // ../pstdio-api-contracts/src/extensions/views.ts
14131
14134
  var hasSingleViewBody = (value) => [value.webview, value.treeRendererId, value.fileRendererId].filter(Boolean).length === 1;
14132
14135
  var singleViewBodyMessage = "Extension views must declare exactly one body: webview, treeRendererId, or fileRendererId";
14136
+ var hostTreeDefaultSchema = exports_external.enum(["default", "none"]);
14133
14137
  var extensionViewRecordBaseSchema = exports_external.object({
14134
14138
  id: exports_external.string(),
14135
14139
  extensionId: exports_external.string(),
@@ -14142,7 +14146,9 @@ var extensionViewRecordBaseSchema = exports_external.object({
14142
14146
  surface: exports_external.enum(["panel", "modal"]).optional(),
14143
14147
  webview: extensionWebviewContributionSchema.optional(),
14144
14148
  treeRendererId: exports_external.string().optional(),
14145
- fileRendererId: exports_external.string().optional()
14149
+ fileRendererId: exports_external.string().optional(),
14150
+ hostTreeHeader: hostTreeDefaultSchema.optional(),
14151
+ hostTreeFooter: hostTreeDefaultSchema.optional()
14146
14152
  });
14147
14153
  var extensionViewRecordSchema = extensionViewRecordBaseSchema.refine(hasSingleViewBody, {
14148
14154
  message: singleViewBodyMessage
@@ -14339,6 +14345,10 @@ var commandExecuteBodySchema = exports_external.object({
14339
14345
  source: commandSourceSchema.optional(),
14340
14346
  metadata: jsonObjectSchema.optional()
14341
14347
  });
14348
+ var dispatchExtensionEventBodySchema = exports_external.object({
14349
+ eventId: exports_external.string().min(1),
14350
+ payload: jsonObjectSchema
14351
+ }).strict();
14342
14352
  var serializedErrorSchema = exports_external.object({
14343
14353
  name: exports_external.string().optional(),
14344
14354
  message: exports_external.string(),
@@ -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;
@@ -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";
@@ -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
@@ -497,6 +541,7 @@ var createClient = (options = {}) => {
497
541
  templates: createTemplateClient(request),
498
542
  skills: createSkillClient(request),
499
543
  agents: createAgentClient(request),
544
+ notifications: createNotificationsClient(request),
500
545
  extensions: createExtensionClient(request),
501
546
  settings: createSettingsClient(request),
502
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,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";
@@ -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",
@@ -13669,6 +13669,9 @@ var WEBVIEW_DECLARABLE_CAPABILITIES = [
13669
13669
  "commands.execute",
13670
13670
  "resource.open",
13671
13671
  "notification.show",
13672
+ "notification.action",
13673
+ "notification.resolve",
13674
+ "notification.dismiss",
13672
13675
  "preferences.get",
13673
13676
  "preferences.set",
13674
13677
  "extension.settings.all",
@@ -14130,6 +14133,7 @@ var workbenchExtensionSettingsPanelRecordSchema = extensionSettingsPanelRecordSc
14130
14133
  // ../pstdio-api-contracts/src/extensions/views.ts
14131
14134
  var hasSingleViewBody = (value) => [value.webview, value.treeRendererId, value.fileRendererId].filter(Boolean).length === 1;
14132
14135
  var singleViewBodyMessage = "Extension views must declare exactly one body: webview, treeRendererId, or fileRendererId";
14136
+ var hostTreeDefaultSchema = exports_external.enum(["default", "none"]);
14133
14137
  var extensionViewRecordBaseSchema = exports_external.object({
14134
14138
  id: exports_external.string(),
14135
14139
  extensionId: exports_external.string(),
@@ -14142,7 +14146,9 @@ var extensionViewRecordBaseSchema = exports_external.object({
14142
14146
  surface: exports_external.enum(["panel", "modal"]).optional(),
14143
14147
  webview: extensionWebviewContributionSchema.optional(),
14144
14148
  treeRendererId: exports_external.string().optional(),
14145
- fileRendererId: exports_external.string().optional()
14149
+ fileRendererId: exports_external.string().optional(),
14150
+ hostTreeHeader: hostTreeDefaultSchema.optional(),
14151
+ hostTreeFooter: hostTreeDefaultSchema.optional()
14146
14152
  });
14147
14153
  var extensionViewRecordSchema = extensionViewRecordBaseSchema.refine(hasSingleViewBody, {
14148
14154
  message: singleViewBodyMessage
@@ -14339,6 +14345,10 @@ var commandExecuteBodySchema = exports_external.object({
14339
14345
  source: commandSourceSchema.optional(),
14340
14346
  metadata: jsonObjectSchema.optional()
14341
14347
  });
14348
+ var dispatchExtensionEventBodySchema = exports_external.object({
14349
+ eventId: exports_external.string().min(1),
14350
+ payload: jsonObjectSchema
14351
+ }).strict();
14342
14352
  var serializedErrorSchema = exports_external.object({
14343
14353
  name: exports_external.string().optional(),
14344
14354
  message: exports_external.string(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pstdio/sdk",
3
- "version": "0.13.2",
3
+ "version": "0.14.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/pufflyai/prompt-studio"