@pstdio/sdk 0.38.0 → 0.40.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 CHANGED
@@ -118,8 +118,8 @@ Directory creation accepts one child name under an existing parent.
118
118
  Webviews can set `workspaceId` in `createWebviewClient(host, { workspaceId })`
119
119
  to run commands in that workspace. The host validates project ownership.
120
120
 
121
- The current host API version is `1.0.0-alpha.14`. Extensions that also work with the
122
- previous contract can declare `1.0.0-alpha.13 || 1.0.0-alpha.14` in `engines.pstdio`.
123
- General version ranges and wildcards remain unsupported.
124
- The compatible extension release must precede the host cutover.
125
- See [the staged release ADR](../../documentation/adrs/0030-temporary-workspace-contract-release-bridge.md).
121
+ `EXTENSION_API_VERSION` is the current host API version, such as `0.1.0`. Declare a caret
122
+ range in `engines.pstdio`, such as `^0.1.0`, so the extension keeps loading across additive
123
+ host releases. Raise the minimum only when the extension uses a newer API. On `0.x`, a new
124
+ minor is a breaking release. See
125
+ [API versioning](../../documentation/references/extensions/0014-api-versioning.md).
package/dist/api/index.js CHANGED
@@ -6781,6 +6781,7 @@ var controlParamSchema = discriminatedUnion("type", [
6781
6781
  ...base,
6782
6782
  ...selection,
6783
6783
  type: literal("selection"),
6784
+ allowCustomValues: boolean2().optional(),
6784
6785
  defaultValue: selectionValue,
6785
6786
  options: array(selectionOption),
6786
6787
  multiSelect: boolean2().optional(),
@@ -6929,6 +6930,20 @@ var extensionControlsRendererRecordSchema = extensionRendererRecordBaseSchema.ex
6929
6930
  defaultValues: controlValuesSchema.optional()
6930
6931
  });
6931
6932
 
6933
+ // ../pstdio-api-contracts/src/extensions/view-toolbar-action.ts
6934
+ var viewToolbarActionSchema = object({
6935
+ id: string2(),
6936
+ label: localizableStringSchema,
6937
+ icon: string2().optional(),
6938
+ presentation: _enum(["primary", "secondary"]).optional(),
6939
+ params: jsonObjectSchema.optional(),
6940
+ input: extensionParamObjectSchema.optional(),
6941
+ submitLabel: string2().optional(),
6942
+ when: string2().optional(),
6943
+ disabled: boolean2().optional()
6944
+ });
6945
+ var viewToolbarActionRecordSchema = viewToolbarActionSchema.extend({ commandId: string2() });
6946
+
6932
6947
  // ../pstdio-api-contracts/src/extensions/data-table-renderer.ts
6933
6948
  var themeColorSchema = object({
6934
6949
  light: string2(),
@@ -6975,6 +6990,7 @@ var selectionActionSchema = object({
6975
6990
  commandId: string2()
6976
6991
  });
6977
6992
  var extensionDataTableRendererRecordSchema = extensionRendererRecordBaseSchema.extend({
6993
+ toolbarActions: array(viewToolbarActionRecordSchema).optional(),
6978
6994
  columns: array(dataTableRendererColumnSchema).optional(),
6979
6995
  queryHandlerId: string2(),
6980
6996
  selectionMode: _enum(["none", "multiple"]).optional(),
@@ -7067,6 +7083,7 @@ var extensionKanbanRendererRowActionSchema = object({
7067
7083
  destructive: boolean2().optional()
7068
7084
  });
7069
7085
  var extensionKanbanRendererRecordSchema = extensionRendererRecordBaseSchema.extend({
7086
+ toolbarActions: array(viewToolbarActionRecordSchema).optional(),
7070
7087
  extensionInstanceId: string2().optional(),
7071
7088
  attributes: array(kanbanRendererAttributeSchema).optional(),
7072
7089
  queryHandlerId: string2(),
@@ -7275,15 +7292,17 @@ var webviewBodySchema = object({ kind: literal("webview"), webview: workbenchExt
7275
7292
  var treeBodySchema = extensionTreeRendererRecordSchema.omit(rendererBaseOmissions).extend({ kind: literal("tree") });
7276
7293
  var fileBodySchema = extensionFileRendererRecordSchema.omit(rendererBaseOmissions).extend({ kind: literal("file") });
7277
7294
  var controlsBodySchema = extensionControlsRendererRecordSchema.omit(rendererBaseOmissions).extend({ kind: literal("controls") });
7278
- var kanbanBodySchema = extensionKanbanRendererRecordSchema.omit({ ...rendererBaseOmissions, createRow: true, rowActions: true }).extend({
7295
+ var kanbanBodySchema = extensionKanbanRendererRecordSchema.omit({ ...rendererBaseOmissions, createRow: true, rowActions: true, toolbarActions: true }).extend({
7279
7296
  kind: literal("kanban"),
7280
7297
  createRow: kanbanCreateRowSchema.optional(),
7281
- rowActions: array(commandActionSchema).optional()
7298
+ rowActions: array(commandActionSchema).optional(),
7299
+ toolbarActions: array(viewToolbarActionSchema.extend({ command: commandRefSchema })).optional()
7282
7300
  });
7283
- var dataTableBodySchema = extensionDataTableRendererRecordSchema.omit({ ...rendererBaseOmissions, selectionActions: true, rowActions: true }).extend({
7301
+ var dataTableBodySchema = extensionDataTableRendererRecordSchema.omit({ ...rendererBaseOmissions, selectionActions: true, rowActions: true, toolbarActions: true }).extend({
7284
7302
  kind: literal("dataTable"),
7285
7303
  selectionActions: array(commandActionSchema).optional(),
7286
- rowActions: array(commandActionSchema).optional()
7304
+ rowActions: array(commandActionSchema).optional(),
7305
+ toolbarActions: array(viewToolbarActionSchema.extend({ command: commandRefSchema })).optional()
7287
7306
  });
7288
7307
  var workbenchExtensionViewBodySchema = discriminatedUnion("kind", [
7289
7308
  webviewBodySchema,
@@ -7359,6 +7378,7 @@ var workbenchExtensionResourceKindRecordSchema = object({
7359
7378
  extensionId: string2(),
7360
7379
  label: localizableStringSchema.optional(),
7361
7380
  icon: string2().optional(),
7381
+ resolveCommand: string2().optional(),
7362
7382
  menuSlots: array(object({
7363
7383
  id: string2(),
7364
7384
  placement: _enum(["header-primary", "header-overflow", "context-menu"]),
@@ -7659,10 +7679,45 @@ var automationRunEventSchema = object({
7659
7679
  createdAt: string2()
7660
7680
  });
7661
7681
  var listAutomationRunEventsResponseSchema = object({ events: array(automationRunEventSchema) });
7682
+ // ../pstdio-api-contracts/src/board-views.ts
7683
+ var boardFieldSchema = object({
7684
+ id: string2(),
7685
+ label: string2(),
7686
+ kind: _enum(["enum", "enum-multi", "status", "string", "date", "number", "user"]),
7687
+ filterable: boolean2(),
7688
+ groupable: boolean2(),
7689
+ sortable: boolean2(),
7690
+ displayable: boolean2(),
7691
+ options: array(object({ value: string2(), label: string2() })).optional()
7692
+ });
7693
+ var boardSummarySchema = object({
7694
+ id: string2(),
7695
+ title: string2(),
7696
+ extensionId: string2(),
7697
+ fields: array(boardFieldSchema)
7698
+ });
7699
+ var boardFiltersSchema = record(string2(), array(string2()));
7700
+ var boardViewSchema = object({
7701
+ id: string2(),
7702
+ boardId: string2(),
7703
+ title: string2(),
7704
+ settings: kanbanRendererSettingsSchema,
7705
+ filters: boardFiltersSchema,
7706
+ builtIn: boolean2()
7707
+ });
7708
+ var boardViewsSchema = object({ views: array(boardViewSchema), defaultViewId: string2() });
7709
+ var boardViewUpdateSchema = object({
7710
+ title: string2().trim().min(1).optional(),
7711
+ settings: kanbanRendererSettingsSchema.partial().optional(),
7712
+ filters: boardFiltersSchema.optional()
7713
+ }).strict();
7714
+ var boardViewCreateSchema = boardViewUpdateSchema.extend({
7715
+ title: string2().trim().min(1),
7716
+ copyFrom: string2().optional()
7717
+ });
7662
7718
  // ../pstdio-api-contracts/src/extension-kernel/api-versions.ts
7663
7719
  var numericIdentifier = "(?:0|[1-9]\\d*)";
7664
- var prereleaseIdentifier = `(?:${numericIdentifier}|\\d*[A-Za-z-][0-9A-Za-z-]*)`;
7665
- var exactVersion = new RegExp(`^${numericIdentifier}\\.${numericIdentifier}\\.${numericIdentifier}(?:-${prereleaseIdentifier}(?:\\.${prereleaseIdentifier})*)?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$`);
7720
+ var caretTerm = new RegExp(`^\\^(${numericIdentifier}\\.${numericIdentifier}\\.${numericIdentifier})$`);
7666
7721
  // ../pstdio-api-contracts/src/extension-kernel/builtin-refs.ts
7667
7722
  var hostRef = (kind, id) => ({ extensionId: "pstdio", kind, id });
7668
7723
  var workbenchModes = {
@@ -7916,7 +7971,7 @@ var packageAsset = (path, baseUrl) => ({
7916
7971
  baseUrl
7917
7972
  });
7918
7973
  // ../pstdio-api-contracts/src/extension-kernel/types/extension.ts
7919
- var EXTENSION_API_VERSION = "1.0.0-alpha.14";
7974
+ var EXTENSION_API_VERSION = "0.1.1";
7920
7975
  // ../pstdio-api-contracts/src/extension-kernel/types/webview-capabilities.ts
7921
7976
  var WEBVIEW_HOST_CAPABILITY_VERSION = 1;
7922
7977
  var WEBVIEW_DECLARABLE_CAPABILITIES = [
@@ -8413,7 +8468,8 @@ var createSessionInputSchema = object({
8413
8468
  original_session_id: string2().optional()
8414
8469
  });
8415
8470
  var questionResponseSchema = object({
8416
- answers: array(array(string2()))
8471
+ answers: array(array(string2())),
8472
+ callId: string2().min(1).optional()
8417
8473
  });
8418
8474
  var followUpInputSchema = object({
8419
8475
  prompt: string2().min(1).optional(),
package/dist/api.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { $ as WorkbenchExtensionMetadata, $a as FollowUpInput, At as TerminalHostEvent, B as ConfigureExtensionConnectionInput, C as ExtensionSettingsPanelRecord, D as ExtensionCommandPaletteResourceRecord, E as ExtensionKeybindingRecord, F as ProjectExtensionInstance, G as LocalizableString, H as ListExtensionConnectionsResponse, I as UpgradeProjectExtensionResponse, J as ExtensionMenuContribution, K as ExtensionCommandPaletteContribution, L as CommandExecuteRequest, M as InstallMarketplaceExtensionResponse, Mt as TerminalSessionRequest, N as ListProjectExtensionsResponse, Nt as TerminalSessionResult, O as WorkbenchExtensionCommandPaletteResourceRecord, P as MarketplaceExtension, Q as WorkbenchExtensionHarnessRecord, Qa as CreateSessionInput, R as CommandExecuteResponse, S as ExtensionSettingValueRecord, So as UpdateNotificationInput, T as UpdateExtensionSettingRequest, U as ExtensionDiagnostic, V as ExtensionConnectionRecord, W as ExtensionRecord, X as ListExtensionAppearanceResponse, Xa as UpdateSkillInput, Xu as ResourceRef, Y as WorkbenchExtensionAutomationRecord, Z as ListExtensionCommandsResponse, Za as ApprovalInput, _ as CreateProjectInput, _o as NotificationActorType, a as RemoveWorktreeResponse$1, at as AutomationRunStatus, bo as NotificationPriority, c as WorkspaceFileContent$1, co as SessionConversationResponse, ct as IssueAutomationTokenInput, dt as ListAutomationTokensResponse, et as WorkbenchExtensionViewBody, f as WorkspaceProviderDescriptor, fo as CreateNotificationInput, g as sessionAttachmentMimeTypesByExtension, go as NotificationAction, h as UpdateSettingsInput, ho as Notification, i as ListWorkspaceFilesInput$1, io as ResolveSessionIdResponse, it as AutomationRunEvent, jt as TerminalSessionOperation, k as AddLocalExtensionFolderResponse, l as WorkspaceFileEntry$1, lo as SessionConversationSources, lt as IssueAutomationTokenResponse, m as Settings, mo as ListNotificationsResponse, nt as AutomationRun, o as RenameWorkspaceInput$1, oo as SessionAttachment, ot as AutomationTokenRecord, p as WriteWorkspaceFileInput$1, po as ListNotificationsQuery, q as ExtensionCommandRecord, ro as ResolveSessionIdInput, rt as AutomationRunError, so as SessionAttachmentRef, st as CreateAutomationRunInput, t as CreateWorkspaceInput$1, tt as WorkbenchExtensionViewRecord, u as WorkspaceFilesResponse$1, uo as SessionQueuedMessagesResponse, ut as ListAutomationRunEventsResponse, vo as NotificationKind, w as ListExtensionSettingsResponse, x as ExtensionSettingDefinitionRecord, xo as NotificationStatus, y as UpdateProjectInput, yo as NotificationOrigin } from "./index-BCK94Mon.js";
2
- import "./sessions-DIT92e3v.js";
3
- import "./skills-DIT92e3v.js";
1
+ import { $ as WorkbenchExtensionMetadata, $u as CreateNotificationInput, B as ConfigureExtensionConnectionInput, Bu as FollowUpInput, C as ExtensionSettingsPanelRecord, D as ExtensionCommandPaletteResourceRecord, E as ExtensionKeybindingRecord, F as ProjectExtensionInstance, G as LocalizableString, Gu as ResolveSessionIdResponse, H as ListExtensionConnectionsResponse, I as UpgradeProjectExtensionResponse, It as TerminalHostEvent, J as ExtensionMenuContribution, Ju as SessionAttachmentRef, K as ExtensionCommandPaletteContribution, L as CommandExecuteRequest, Lt as TerminalSessionOperation, Lu as UpdateSkillInput, M as InstallMarketplaceExtensionResponse, N as ListProjectExtensionsResponse, O as WorkbenchExtensionCommandPaletteResourceRecord, P as MarketplaceExtension, Q as WorkbenchExtensionHarnessRecord, R as CommandExecuteResponse, Rt as TerminalSessionRequest, Ru as ApprovalInput, S as ExtensionSettingValueRecord, T as UpdateExtensionSettingRequest, U as ExtensionDiagnostic, V as ExtensionConnectionRecord, W as ExtensionRecord, Wu as ResolveSessionIdInput, X as ListExtensionAppearanceResponse, Xu as SessionConversationSources, Y as WorkbenchExtensionAutomationRecord, Yu as SessionConversationResponse, Z as ListExtensionCommandsResponse, Zu as SessionQueuedMessagesResponse, _ as CreateProjectInput, _t as ListAutomationTokensResponse, a as RemoveWorktreeResponse$1, ad as NotificationKind, at as BoardViewCreate, c as WorkspaceFileContent$1, cd as NotificationStatus, ct as AutomationRun, dt as AutomationRunStatus, ed as ListNotificationsQuery, et as WorkbenchExtensionViewBody, f as WorkspaceProviderDescriptor, ft as AutomationTokenRecord, g as sessionAttachmentMimeTypesByExtension, gt as ListAutomationRunEventsResponse, h as UpdateSettingsInput, hd as ResourceRef, ht as IssueAutomationTokenResponse, i as ListWorkspaceFilesInput$1, id as NotificationActorType, it as BoardView, k as AddLocalExtensionFolderResponse, l as WorkspaceFileEntry$1, ld as UpdateNotificationInput, lt as AutomationRunError, m as Settings, mt as IssueAutomationTokenInput, nd as Notification, nt as BoardField, o as RenameWorkspaceInput$1, od as NotificationOrigin, ot as BoardViewUpdate, p as WriteWorkspaceFileInput$1, pt as CreateAutomationRunInput, q as ExtensionCommandRecord, qu as SessionAttachment, rd as NotificationAction, rt as BoardSummary, sd as NotificationPriority, st as BoardViews, t as CreateWorkspaceInput$1, td as ListNotificationsResponse, tt as WorkbenchExtensionViewRecord, u as WorkspaceFilesResponse$1, ut as AutomationRunEvent, w as ListExtensionSettingsResponse, x as ExtensionSettingDefinitionRecord, y as UpdateProjectInput, zt as TerminalSessionResult, zu as CreateSessionInput } from "./index-Cbt2YiR-.js";
2
+ import "./sessions-46B897Gi.js";
3
+ import "./skills-46B897Gi.js";
4
4
  //#region src/api/workspaces.d.ts
5
5
  type CreateWorkspaceInput = CreateWorkspaceInput$1;
6
6
  type RemoveWorktreeResponse = RemoveWorktreeResponse$1;
@@ -11,5 +11,5 @@ type WorkspaceFileEntry = WorkspaceFileEntry$1;
11
11
  type WorkspaceFilesResponse = WorkspaceFilesResponse$1;
12
12
  type WriteWorkspaceFileInput = WriteWorkspaceFileInput$1;
13
13
  //#endregion
14
- export { type AddLocalExtensionFolderResponse, type ApprovalInput, type AutomationRun, type AutomationRunError, type AutomationRunEvent, type AutomationRunStatus, type AutomationTokenRecord, type CommandExecuteRequest, type CommandExecuteResponse, type ConfigureExtensionConnectionInput, type CreateAutomationRunInput, type CreateNotificationInput, type CreateProjectInput, type CreateSessionInput, type CreateWorkspaceInput, type ExtensionCommandPaletteContribution, type ExtensionCommandPaletteResourceRecord, type ExtensionCommandRecord, type ExtensionConnectionRecord, type ExtensionDiagnostic, type ExtensionKeybindingRecord, type ExtensionMenuContribution, type ExtensionRecord, type ExtensionSettingDefinitionRecord, type ExtensionSettingValueRecord, type ExtensionSettingsPanelRecord, type FollowUpInput, type InstallMarketplaceExtensionResponse, type IssueAutomationTokenInput, type IssueAutomationTokenResponse, type ListAutomationRunEventsResponse, type ListAutomationTokensResponse, type ListExtensionAppearanceResponse, type ListExtensionCommandsResponse, type ListExtensionConnectionsResponse, type ListExtensionSettingsResponse, type ListNotificationsQuery, type ListNotificationsResponse, type ListProjectExtensionsResponse, type ListWorkspaceFilesInput, type LocalizableString, type MarketplaceExtension, type Notification, type NotificationAction, type NotificationActorType, type NotificationKind, type NotificationOrigin, type NotificationPriority, type NotificationStatus, type ProjectExtensionInstance, type RemoveWorktreeResponse, type RenameWorkspaceInput, type ResolveSessionIdInput, type ResolveSessionIdResponse, type ResourceRef, type SessionAttachment, type SessionAttachmentRef, type SessionConversationResponse, type SessionConversationSources, type SessionQueuedMessagesResponse, type Settings, type TerminalHostEvent, type TerminalSessionOperation, type TerminalSessionRequest, type TerminalSessionResult, type UpdateExtensionSettingRequest, type UpdateNotificationInput, type UpdateProjectInput, type UpdateSettingsInput, type UpdateSkillInput, type UpgradeProjectExtensionResponse, type WorkbenchExtensionAutomationRecord, type WorkbenchExtensionCommandPaletteResourceRecord, type WorkbenchExtensionHarnessRecord, type WorkbenchExtensionMetadata, type WorkbenchExtensionViewBody, type WorkbenchExtensionViewRecord, type WorkspaceFileContent, type WorkspaceFileEntry, type WorkspaceFilesResponse, type WorkspaceProviderDescriptor, type WriteWorkspaceFileInput, sessionAttachmentMimeTypesByExtension };
14
+ export { type AddLocalExtensionFolderResponse, type ApprovalInput, type AutomationRun, type AutomationRunError, type AutomationRunEvent, type AutomationRunStatus, type AutomationTokenRecord, type BoardField, type BoardSummary, type BoardView, type BoardViewCreate, type BoardViewUpdate, type BoardViews, type CommandExecuteRequest, type CommandExecuteResponse, type ConfigureExtensionConnectionInput, type CreateAutomationRunInput, type CreateNotificationInput, type CreateProjectInput, type CreateSessionInput, type CreateWorkspaceInput, type ExtensionCommandPaletteContribution, type ExtensionCommandPaletteResourceRecord, type ExtensionCommandRecord, type ExtensionConnectionRecord, type ExtensionDiagnostic, type ExtensionKeybindingRecord, type ExtensionMenuContribution, type ExtensionRecord, type ExtensionSettingDefinitionRecord, type ExtensionSettingValueRecord, type ExtensionSettingsPanelRecord, type FollowUpInput, type InstallMarketplaceExtensionResponse, type IssueAutomationTokenInput, type IssueAutomationTokenResponse, type ListAutomationRunEventsResponse, type ListAutomationTokensResponse, type ListExtensionAppearanceResponse, type ListExtensionCommandsResponse, type ListExtensionConnectionsResponse, type ListExtensionSettingsResponse, type ListNotificationsQuery, type ListNotificationsResponse, type ListProjectExtensionsResponse, type ListWorkspaceFilesInput, type LocalizableString, type MarketplaceExtension, type Notification, type NotificationAction, type NotificationActorType, type NotificationKind, type NotificationOrigin, type NotificationPriority, type NotificationStatus, type ProjectExtensionInstance, type RemoveWorktreeResponse, type RenameWorkspaceInput, type ResolveSessionIdInput, type ResolveSessionIdResponse, type ResourceRef, type SessionAttachment, type SessionAttachmentRef, type SessionConversationResponse, type SessionConversationSources, type SessionQueuedMessagesResponse, type Settings, type TerminalHostEvent, type TerminalSessionOperation, type TerminalSessionRequest, type TerminalSessionResult, type UpdateExtensionSettingRequest, type UpdateNotificationInput, type UpdateProjectInput, type UpdateSettingsInput, type UpdateSkillInput, type UpgradeProjectExtensionResponse, type WorkbenchExtensionAutomationRecord, type WorkbenchExtensionCommandPaletteResourceRecord, type WorkbenchExtensionHarnessRecord, type WorkbenchExtensionMetadata, type WorkbenchExtensionViewBody, type WorkbenchExtensionViewRecord, type WorkspaceFileContent, type WorkspaceFileEntry, type WorkspaceFilesResponse, type WorkspaceProviderDescriptor, type WriteWorkspaceFileInput, sessionAttachmentMimeTypesByExtension };
15
15
  export {};
@@ -19,6 +19,23 @@ var createAutomationClient = (request) => ({
19
19
  cancelRun: (projectId, runId) => request(`/v1/projects/${projectId}/automation-runs/${encodeURIComponent(runId)}/cancel`, { method: "POST" })
20
20
  });
21
21
 
22
+ // src/client/board-views.ts
23
+ var projectPath = (id) => `/v1/projects/${encodeURIComponent(id)}`;
24
+ var boardPath = (projectId, boardId) => `${projectPath(projectId)}/boards/${encodeURIComponent(boardId)}/views`;
25
+ var viewPath = (projectId, id) => `${projectPath(projectId)}/board-views/${encodeURIComponent(id)}`;
26
+ var createBoardViewsClient = (request) => ({
27
+ board: (projectId, boardId) => request(`${projectPath(projectId)}/boards/${encodeURIComponent(boardId)}`),
28
+ get: (projectId, id) => request(viewPath(projectId, id)),
29
+ boards: (projectId) => request(`${projectPath(projectId)}/boards`),
30
+ list: (projectId, boardId) => request(boardPath(projectId, boardId)),
31
+ orphaned: (projectId) => request(`${projectPath(projectId)}/board-views?orphaned=true`),
32
+ create: (projectId, boardId, input) => request(boardPath(projectId, boardId), { method: "POST", body: input }),
33
+ update: (projectId, id, input) => request(viewPath(projectId, id), { method: "PATCH", body: input }),
34
+ delete: (projectId, id) => request(viewPath(projectId, id), { method: "DELETE" }),
35
+ reorder: (projectId, boardId, viewIds) => request(`${boardPath(projectId, boardId)}/order`, { method: "PUT", body: { viewIds } }),
36
+ setDefault: (projectId, boardId, viewId) => request(`${boardPath(projectId, boardId)}/default`, { method: "PUT", body: { viewId } })
37
+ });
38
+
22
39
  // src/client/extensions.ts
23
40
  var createExtensionClient = (request) => ({
24
41
  enableInstalled: (projectId, installName, body) => request(`/v1/projects/${projectId}/extensions/installed/${encodeURIComponent(installName)}/enable`, {
@@ -281,6 +298,97 @@ var readSseStream = async (body, onEvent, options = {}) => {
281
298
  }
282
299
  };
283
300
 
301
+ // src/client/session-stream.ts
302
+ var createSessionStreamTransport = (request, clientOptions) => {
303
+ const subscriptions = new Map;
304
+ let connection;
305
+ const subscribe = (connectionId, id, subscription) => {
306
+ subscription.started = request(`/v1/session-stream/${connectionId}/subscriptions`, {
307
+ method: "POST",
308
+ body: { subscription_id: id, session_id: subscription.sessionId }
309
+ }).then(() => {}, (error) => {
310
+ if (subscriptions.get(id) !== subscription)
311
+ return;
312
+ release(id, false);
313
+ subscription.onError(error);
314
+ });
315
+ };
316
+ const release = (id, notifyServer) => {
317
+ const started = subscriptions.get(id)?.started;
318
+ subscriptions.delete(id);
319
+ if (!connection)
320
+ return;
321
+ if (subscriptions.size === 0) {
322
+ connection.controller.abort();
323
+ connection = undefined;
324
+ return;
325
+ }
326
+ if (!notifyServer || !started)
327
+ return;
328
+ const path = `/v1/session-stream/${connection.id}/subscriptions/${id}`;
329
+ started.then(() => request(path, { method: "DELETE" })).catch(() => {});
330
+ };
331
+ const dispatch = (current, event, payload) => {
332
+ if (event === "connected") {
333
+ current.id = payload.connection_id;
334
+ for (const [id, subscription] of subscriptions)
335
+ subscribe(current.id, id, subscription);
336
+ return;
337
+ }
338
+ const subscription = subscriptions.get(payload.subscription_id ?? "");
339
+ if (!subscription)
340
+ return;
341
+ if (event === "end" || event === "error")
342
+ release(payload.subscription_id, false);
343
+ if (event === "error")
344
+ subscription.onError(new Error(payload.data.message));
345
+ else
346
+ subscription.onEvent(event, payload.data);
347
+ };
348
+ const fail = (current, error) => {
349
+ if (connection !== current)
350
+ return;
351
+ connection = undefined;
352
+ const failed = [...subscriptions.values()];
353
+ subscriptions.clear();
354
+ for (const subscription of failed)
355
+ subscription.onError(error);
356
+ };
357
+ const open = () => {
358
+ const current = { controller: new AbortController };
359
+ const { signal } = current.controller;
360
+ connection = current;
361
+ const read = async () => {
362
+ const response = await resolveFetch(clientOptions)(resolveClientUrl(resolveBaseUrl(clientOptions), "/v1/session-stream"), { headers: Object.fromEntries(createRequestHeaders(clientOptions).entries()), signal });
363
+ if (!response.ok || !response.body)
364
+ throw new Error(`Connection failed: ${response.status}`);
365
+ await readSseStream(response.body, ({ event, data }) => dispatch(current, event, JSON.parse(data)), { signal });
366
+ throw new Error("Session stream closed");
367
+ };
368
+ read().catch((error) => {
369
+ if (!signal.aborted)
370
+ fail(current, error);
371
+ });
372
+ return current;
373
+ };
374
+ return {
375
+ subscribe(sessionId, listener) {
376
+ const id = crypto.randomUUID();
377
+ const subscription = { ...listener, sessionId };
378
+ subscriptions.set(id, subscription);
379
+ const current = connection ?? open();
380
+ if (current.id)
381
+ subscribe(current.id, id, subscription);
382
+ return {
383
+ close: () => {
384
+ if (subscriptions.get(id) === subscription)
385
+ release(id, true);
386
+ }
387
+ };
388
+ }
389
+ };
390
+ };
391
+
284
392
  // src/client/sessions.ts
285
393
  var buildSessionsQuery = (projectId, input = {}) => {
286
394
  const params = new URLSearchParams({ project_id: projectId });
@@ -294,100 +402,87 @@ var buildSessionsQuery = (projectId, input = {}) => {
294
402
  params.append("archived", "true");
295
403
  return params.toString();
296
404
  };
297
- var buildSessionStreamPath = (sessionId, attempt) => {
298
- const path = `/v1/sessions/${sessionId}/stream`;
299
- return attempt === undefined ? path : `${path}?attempt=${attempt}`;
300
- };
301
- var parseEventData = (data) => {
302
- if (data.length === 0)
303
- return null;
304
- return JSON.parse(data);
305
- };
306
- var streamSessionEvents = async (clientOptions, path, onEvent, options = {}) => {
307
- const response = await resolveFetch(clientOptions)(resolveClientUrl(resolveBaseUrl(clientOptions), path), {
308
- headers: Object.fromEntries(createRequestHeaders(clientOptions).entries()),
309
- signal: options.signal
310
- });
311
- if (!response.ok || !response.body)
312
- throw new Error(`Connection failed: ${response.status}`);
313
- await readSseStream(response.body, onEvent, { signal: options.signal });
314
- };
315
- var dispatchSessionStreamEvent = (event, handlers) => {
316
- if (event.event === "ready") {
317
- handlers.onReady?.(parseEventData(event.data));
405
+ var dispatchSessionStreamEvent = (event, data, handlers) => {
406
+ if (event === "ready") {
407
+ handlers.onReady?.(data);
318
408
  return;
319
409
  }
320
- if (event.event === "patch") {
321
- handlers.onPatch?.(parseEventData(event.data));
410
+ if (event === "patch") {
411
+ handlers.onPatch?.(data);
322
412
  return;
323
413
  }
324
- if (event.event === "approval_request") {
325
- handlers.onApprovalRequest?.(parseEventData(event.data));
414
+ if (event === "approval_request") {
415
+ handlers.onApprovalRequest?.(data);
326
416
  return;
327
417
  }
328
- if (event.event === "queued_messages") {
329
- handlers.onQueuedMessages?.(parseEventData(event.data));
418
+ if (event === "queued_messages") {
419
+ handlers.onQueuedMessages?.(data);
330
420
  return;
331
421
  }
332
- if (event.event === "end") {
333
- handlers.onEnd?.(parseEventData(event.data));
422
+ if (event === "end") {
423
+ handlers.onEnd?.(data);
334
424
  }
335
425
  };
336
- var createSessionClient = (request, clientOptions) => ({
337
- listActivity: (sessionId, input = {}) => {
338
- const params = new URLSearchParams;
339
- if (input.event_type)
340
- params.append("event_type", input.event_type);
341
- if (input.from)
342
- params.append("from", input.from);
343
- if (input.to)
344
- params.append("to", input.to);
345
- if (input.cursor)
346
- params.append("cursor", input.cursor);
347
- if (input.limit !== undefined)
348
- params.append("limit", String(input.limit));
349
- const query = params.toString();
350
- return request(`/v1/sessions/${sessionId}/activity${query ? `?${query}` : ""}`);
351
- },
352
- list: (projectId, input) => request(`/v1/sessions?${buildSessionsQuery(projectId, input)}`),
353
- get: (sessionId) => request(`/v1/sessions/${sessionId}`),
354
- uploadAttachment: (projectId, input) => request(`/v1/projects/${encodeURIComponent(projectId)}/session-attachments`, {
355
- method: "POST",
356
- body: input.data,
357
- headers: {
358
- "content-type": input.mimeType || "application/octet-stream",
359
- "x-file-name": encodeURIComponent(input.name)
360
- }
361
- }),
362
- deleteAttachment: (projectId, fileId) => request(`/v1/projects/${encodeURIComponent(projectId)}/session-attachments/${encodeURIComponent(fileId)}`, {
363
- method: "DELETE"
364
- }),
365
- create: (input) => request("/v1/sessions", { method: "POST", body: input }),
366
- archive: (sessionId) => request(`/v1/sessions/${sessionId}/archive`, { method: "POST" }),
367
- followUp: (sessionId, input) => request(`/v1/sessions/${sessionId}/follow-up`, { method: "POST", body: input }),
368
- approve: (sessionId, input) => request(`/v1/sessions/${sessionId}/approve`, { method: "POST", body: input }),
369
- getConversation: (sessionId, signal) => request(`/v1/sessions/${sessionId}/conversation`, { signal }),
370
- getConversationSources: (sessionId, signal) => request(`/v1/sessions/${sessionId}/conversation/sources`, { signal }),
371
- getQueuedMessages: (sessionId, options) => request(`/v1/sessions/${sessionId}/queued-messages`, options),
372
- resolveSessionId: (input) => request("/v1/sessions/resolve-session-id", { method: "POST", body: input }),
373
- updateStatus: (sessionId, status) => request(`/v1/sessions/${sessionId}/status`, { method: "PATCH", body: { status } }),
374
- stream: (sessionId, onEvent, options = {}) => streamSessionEvents(clientOptions, buildSessionStreamPath(sessionId), onEvent, options),
375
- connectStream: (sessionId, handlers, options = {}) => {
376
- const abortController = new AbortController;
377
- let closed = false;
378
- streamSessionEvents(clientOptions, buildSessionStreamPath(sessionId, options.attempt), (event) => dispatchSessionStreamEvent(event, handlers), { signal: abortController.signal }).catch((error) => {
379
- if (closed || error.name === "AbortError")
380
- return;
381
- handlers.onError?.(error);
382
- });
383
- return {
384
- close: () => {
385
- closed = true;
386
- abortController.abort();
426
+ var createSessionClient = (request, clientOptions) => {
427
+ const streams = createSessionStreamTransport(request, clientOptions);
428
+ return {
429
+ listActivity: (sessionId, input = {}) => {
430
+ const params = new URLSearchParams;
431
+ if (input.event_type)
432
+ params.append("event_type", input.event_type);
433
+ if (input.from)
434
+ params.append("from", input.from);
435
+ if (input.to)
436
+ params.append("to", input.to);
437
+ if (input.cursor)
438
+ params.append("cursor", input.cursor);
439
+ if (input.limit !== undefined)
440
+ params.append("limit", String(input.limit));
441
+ const query = params.toString();
442
+ return request(`/v1/sessions/${sessionId}/activity${query ? `?${query}` : ""}`);
443
+ },
444
+ list: (projectId, input) => request(`/v1/sessions?${buildSessionsQuery(projectId, input)}`),
445
+ get: (sessionId) => request(`/v1/sessions/${sessionId}`),
446
+ uploadAttachment: (projectId, input) => request(`/v1/projects/${encodeURIComponent(projectId)}/session-attachments`, {
447
+ method: "POST",
448
+ body: input.data,
449
+ headers: {
450
+ "content-type": input.mimeType || "application/octet-stream",
451
+ "x-file-name": encodeURIComponent(input.name)
387
452
  }
388
- };
389
- }
390
- });
453
+ }),
454
+ deleteAttachment: (projectId, fileId) => request(`/v1/projects/${encodeURIComponent(projectId)}/session-attachments/${encodeURIComponent(fileId)}`, {
455
+ method: "DELETE"
456
+ }),
457
+ create: (input) => request("/v1/sessions", { method: "POST", body: input }),
458
+ archive: (sessionId) => request(`/v1/sessions/${sessionId}/archive`, { method: "POST" }),
459
+ followUp: (sessionId, input) => request(`/v1/sessions/${sessionId}/follow-up`, { method: "POST", body: input }),
460
+ approve: (sessionId, input) => request(`/v1/sessions/${sessionId}/approve`, { method: "POST", body: input }),
461
+ getConversation: (sessionId, signal) => request(`/v1/sessions/${sessionId}/conversation`, { signal }),
462
+ getConversationSources: (sessionId, signal) => request(`/v1/sessions/${sessionId}/conversation/sources`, { signal }),
463
+ getQueuedMessages: (sessionId, options) => request(`/v1/sessions/${sessionId}/queued-messages`, options),
464
+ resolveSessionId: (input) => request("/v1/sessions/resolve-session-id", { method: "POST", body: input }),
465
+ updateStatus: (sessionId, status) => request(`/v1/sessions/${sessionId}/status`, { method: "PATCH", body: { status } }),
466
+ stream: (sessionId, onEvent, options = {}) => new Promise((resolve, reject) => {
467
+ const subscription = streams.subscribe(sessionId, {
468
+ onEvent: (event, data) => {
469
+ onEvent({ event, data: JSON.stringify(data) });
470
+ if (event === "end")
471
+ resolve();
472
+ },
473
+ onError: reject
474
+ });
475
+ options.signal?.addEventListener("abort", () => {
476
+ subscription.close();
477
+ resolve();
478
+ }, { once: true });
479
+ }),
480
+ connectStream: (sessionId, handlers) => streams.subscribe(sessionId, {
481
+ onEvent: (event, data) => dispatchSessionStreamEvent(event, data, handlers),
482
+ onError: (error) => handlers.onError?.(error)
483
+ })
484
+ };
485
+ };
391
486
 
392
487
  // src/client/settings.ts
393
488
  var createSettingsClient = (request) => ({
@@ -618,6 +713,7 @@ var createWorkspaceClient = (request) => ({
618
713
  var createClient = (options = {}) => {
619
714
  const request = createRequest(options);
620
715
  return {
716
+ views: createBoardViewsClient(request),
621
717
  projects: createProjectClient(request),
622
718
  filesystem: createFilesystemClient(request),
623
719
  workspaces: createWorkspaceClient(request),
package/dist/client.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { A as RequestFn, C as DirectoryEntry, D as AgentClient, E as AutomationClient, M as createRequest, O as ClientOptions, S as NotificationsClient, T as ExtensionClient, _ as SessionStreamHandlers, a as SyncClient, b as createRuntimeClient, c as SyncWriter, d as parseSyncDeleteEvent, f as SkillClient, g as SessionStreamConnection, h as SessionClient, i as StartSyncInput, j as RequestOptions, k as PstdioApiError, l as SyncWriterProvider, m as ListSessionsInput, n as createClient, o as SyncConnection, p as SettingsClient, r as WorkspaceClient, s as SyncRow, t as PstdioClient, u as applySyncEvent, v as SseEvent, w as FilesystemClient, x as ProjectClient, y as RuntimeClient } from "./index-C-BhIXyz.js";
2
- export { type AgentClient, type AutomationClient, type ClientOptions, type DirectoryEntry, type ExtensionClient, type FilesystemClient, type ListSessionsInput, type NotificationsClient, type ProjectClient, PstdioApiError, type PstdioClient, type RequestFn, type RequestOptions, type RuntimeClient, type SessionClient, type SessionStreamConnection, type SessionStreamHandlers, type SettingsClient, type SkillClient, type SseEvent, type StartSyncInput, type SyncClient, type SyncConnection, type SyncRow, type SyncWriter, type SyncWriterProvider, type WorkspaceClient, applySyncEvent, createClient, createRequest, createRuntimeClient, parseSyncDeleteEvent };
1
+ import { A as PstdioApiError, C as DirectoryEntry, D as AutomationClient, E as BoardViewsClient, M as RequestOptions, N as createRequest, O as AgentClient, S as NotificationsClient, T as ExtensionClient, _ as SessionStreamHandlers, a as SyncClient, b as createRuntimeClient, c as SyncWriter, d as parseSyncDeleteEvent, f as SkillClient, g as SessionStreamConnection, h as SessionClient, i as StartSyncInput, j as RequestFn, k as ClientOptions, l as SyncWriterProvider, m as ListSessionsInput, n as createClient, o as SyncConnection, p as SettingsClient, r as WorkspaceClient, s as SyncRow, t as PstdioClient, u as applySyncEvent, v as SseEvent, w as FilesystemClient, x as ProjectClient, y as RuntimeClient } from "./index-1twOhV2h.js";
2
+ export { type AgentClient, type AutomationClient, type BoardViewsClient, type ClientOptions, type DirectoryEntry, type ExtensionClient, type FilesystemClient, type ListSessionsInput, type NotificationsClient, type ProjectClient, PstdioApiError, type PstdioClient, type RequestFn, type RequestOptions, type RuntimeClient, type SessionClient, type SessionStreamConnection, type SessionStreamHandlers, type SettingsClient, type SkillClient, type SseEvent, type StartSyncInput, type SyncClient, type SyncConnection, type SyncRow, type SyncWriter, type SyncWriterProvider, type WorkspaceClient, applySyncEvent, createClient, createRequest, createRuntimeClient, parseSyncDeleteEvent };
3
3
  export {};
package/dist/data.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Ir as ArtifactMount } from "./index-BCK94Mon.js";
1
+ import { Ti as ArtifactMount } from "./index-Cbt2YiR-.js";
2
2
  //#region src/data/draft-layout.d.ts
3
3
  export declare const assertSafePathSegment: (value: string) => void;
4
4
  export declare const requireRepoFiles: (projectFiles: ArtifactMount | undefined) => ArtifactMount;
@@ -1,7 +1,6 @@
1
1
  // ../pstdio-api-contracts/src/extension-kernel/api-versions.ts
2
2
  var numericIdentifier = "(?:0|[1-9]\\d*)";
3
- var prereleaseIdentifier = `(?:${numericIdentifier}|\\d*[A-Za-z-][0-9A-Za-z-]*)`;
4
- var exactVersion = new RegExp(`^${numericIdentifier}\\.${numericIdentifier}\\.${numericIdentifier}(?:-${prereleaseIdentifier}(?:\\.${prereleaseIdentifier})*)?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$`);
3
+ var caretTerm = new RegExp(`^\\^(${numericIdentifier}\\.${numericIdentifier}\\.${numericIdentifier})$`);
5
4
  // ../pstdio-api-contracts/src/extension-kernel/types/composition.ts
6
5
  var dockedWorkbenchRegions = ["sidenav", "main", "secondary", "side"];
7
6
  var extensionPanelRegions = ["main", "secondary", "side"];
@@ -271,7 +270,7 @@ var packageAsset = (path, baseUrl) => ({
271
270
  baseUrl
272
271
  });
273
272
  // ../pstdio-api-contracts/src/extension-kernel/types/extension.ts
274
- var EXTENSION_API_VERSION = "1.0.0-alpha.14";
273
+ var EXTENSION_API_VERSION = "0.1.1";
275
274
  // ../pstdio-api-contracts/src/extension-kernel/types/webview-capabilities.ts
276
275
  var WEBVIEW_HOST_CAPABILITY_VERSION = 1;
277
276
  var WEBVIEW_DECLARABLE_CAPABILITIES = [
@@ -524,7 +523,7 @@ var reconcileMessageHistory = (input, projection = {}) => {
524
523
  }
525
524
  };
526
525
  // package.json
527
- var version = "0.38.0";
526
+ var version = "0.40.0";
528
527
 
529
528
  // src/version.ts
530
529
  var SDK_VERSION = version;
@@ -830,6 +829,7 @@ var parsePageUrl = (input) => {
830
829
  };
831
830
  // src/extensions/params.ts
832
831
  var params = {
832
+ valueOf: (key) => ({ kind: "param-value", key }),
833
833
  text: (options) => ({ type: "text", ...options }),
834
834
  longText: (options) => ({ type: "longtext", ...options }),
835
835
  markdown: (options) => ({ type: "markdown", ...options }),
@@ -837,10 +837,7 @@ var params = {
837
837
  number: (options) => ({ type: "number", ...options }),
838
838
  boolean: (options) => ({ type: "boolean", ...options }),
839
839
  select: (options) => ({ type: "select", ...options }),
840
- multiSelect: (options) => ({
841
- type: "multi-select",
842
- ...options
843
- }),
840
+ multiSelect: (options) => ({ type: "multi-select", ...options }),
844
841
  harness: (options) => ({ type: "harness", ...options }),
845
842
  workspace: (options) => ({ type: "workspace", ...options }),
846
843
  template: (options) => {