@pstdio/sdk 0.41.0 → 0.42.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/dist/api/index.js CHANGED
@@ -6284,7 +6284,10 @@ var harnessParamsSchema = record(string2(), harnessParamDescriptorSchema);
6284
6284
  var agentInfoSchema = object({
6285
6285
  id: string2(),
6286
6286
  name: string2(),
6287
- availability: object({ type: agentAvailabilityTypeSchema }),
6287
+ availability: object({
6288
+ type: agentAvailabilityTypeSchema,
6289
+ reason: string2().optional()
6290
+ }),
6288
6291
  skills: agentSkillsLayoutSchema.optional(),
6289
6292
  params: harnessParamsSchema.optional()
6290
6293
  });
@@ -6479,6 +6482,10 @@ var extensionCommandRecordSchema = object({
6479
6482
  examples: array(string2()).optional(),
6480
6483
  automation: boolean2().optional(),
6481
6484
  mutating: boolean2().optional(),
6485
+ resourceMutation: discriminatedUnion("kind", [
6486
+ object({ kind: literal("rename"), resourceType: string2(), idParam: string2(), labelParam: string2() }),
6487
+ object({ kind: literal("remove"), resourceType: string2(), idParam: string2() })
6488
+ ]).optional(),
6482
6489
  params: record(string2(), object({ type: string2() }).catchall(unknown())).optional()
6483
6490
  });
6484
6491
  var extensionParamObjectSchema = record(string2(), object({ type: string2() }).catchall(unknown()));
@@ -6943,6 +6950,7 @@ var extensionTreeRendererRecordSchema = extensionRendererRecordBaseSchema.extend
6943
6950
  headerHandlerId: string2().optional(),
6944
6951
  bodyHandlerId: string2(),
6945
6952
  childrenHandlerId: string2().optional(),
6953
+ moveHandlerId: string2().optional(),
6946
6954
  footerHandlerId: string2().optional(),
6947
6955
  defaultExpandedSectionIds: array(string2()).optional(),
6948
6956
  defaultExpandedNodeIds: array(string2()).optional()
@@ -7538,6 +7546,7 @@ var workbenchExtensionResourceKindRecordSchema = object({
7538
7546
  label: localizableStringSchema.optional(),
7539
7547
  icon: string2().optional(),
7540
7548
  resolveCommand: string2().optional(),
7549
+ resolveManyCommand: string2().optional(),
7541
7550
  menuSlots: array(object({
7542
7551
  id: string2(),
7543
7552
  placement: _enum(["header-primary", "header-overflow", "context-menu"]),
@@ -7791,6 +7800,57 @@ var setupProjectExtensionResponseSchema = object({
7791
7800
  installedAgents: array(string2())
7792
7801
  }))
7793
7802
  });
7803
+ // ../pstdio-api-contracts/src/extensions/installation.ts
7804
+ var installNameSchema = string2().min(1).refine((name) => name !== "." && name !== ".." && !/[\\/:]/.test(name) && name.trim().length > 0, "Install name must be one folder name.");
7805
+ var installExtensionRequestSchema = object({
7806
+ source: discriminatedUnion("kind", [
7807
+ object({ kind: literal("catalog"), name: string2().min(1), ref: string2().min(1).optional() }).strict(),
7808
+ object({ kind: literal("project-folder"), path: string2().min(1), development: boolean2().optional() }).strict()
7809
+ ]),
7810
+ installName: installNameSchema.optional(),
7811
+ force: boolean2().optional(),
7812
+ skipInstall: boolean2().optional()
7813
+ }).strict();
7814
+ var formBoolean = _enum(["true", "false"]).optional().transform((value) => value === "true");
7815
+ var uploadExtensionRequestSchema = object({
7816
+ kind: literal("upload"),
7817
+ installName: installNameSchema.optional(),
7818
+ folderName: installNameSchema,
7819
+ files: preprocess((value) => Array.isArray(value) ? value : [value], array(_instanceof(File).meta({ type: "string", format: "binary" })).min(1)),
7820
+ force: formBoolean,
7821
+ skipInstall: formBoolean,
7822
+ development: formBoolean
7823
+ }).strict();
7824
+ var installedExtensionSourceSchema = object({
7825
+ check: extensionsCheckResponseSchema,
7826
+ installName: string2(),
7827
+ manifest: record(string2(), unknown()),
7828
+ metadata: object({
7829
+ id: string2(),
7830
+ name: string2(),
7831
+ displayName: string2(),
7832
+ version: string2(),
7833
+ description: string2().optional(),
7834
+ enginesPstdio: string2()
7835
+ }),
7836
+ source: discriminatedUnion("kind", [
7837
+ object({ kind: literal("local"), path: string2(), ref: string2().optional() }),
7838
+ object({ kind: literal("named"), name: string2(), ref: string2() })
7839
+ ]),
7840
+ sourceHash: string2(),
7841
+ targetPath: string2()
7842
+ });
7843
+ var installExtensionResponseSchema = object({
7844
+ source: installedExtensionSourceSchema,
7845
+ extension: projectExtensionInstanceSchema
7846
+ });
7847
+ var extensionDiagnosticsResponseSchema = object({
7848
+ roots: array(object({
7849
+ scope: _enum(["repo", "user"]),
7850
+ path: string2(),
7851
+ check: extensionsCheckResponseSchema
7852
+ }))
7853
+ });
7794
7854
  // ../pstdio-api-contracts/src/automation.ts
7795
7855
  var automationRunStatusSchema = _enum(["queued", "running", "succeeded", "failed", "cancelled", "rejected"]);
7796
7856
  var issueAutomationTokenInputSchema = object({
@@ -8059,6 +8119,8 @@ var projectEvents = {
8059
8119
  opened: hostEventRef("project.opened")
8060
8120
  };
8061
8121
  var viewDataEvents = {
8122
+ boardViewsChanged: hostEventRef("view.board-views.changed"),
8123
+ resourceAnchorsChanged: hostEventRef("view.resource-anchors.changed"),
8062
8124
  sessionsChanged: hostEventRef("view.sessions.changed"),
8063
8125
  workspacesChanged: hostEventRef("view.workspaces.changed"),
8064
8126
  repositoriesChanged: hostEventRef("view.repositories.changed")
@@ -8188,6 +8250,7 @@ var WEBVIEW_HOST_CAPABILITY_VERSION = 1;
8188
8250
  var WEBVIEW_DECLARABLE_CAPABILITIES = [
8189
8251
  "clipboard.write",
8190
8252
  "commands.execute",
8253
+ "commands.stream",
8191
8254
  "navigation.open",
8192
8255
  "placement.close",
8193
8256
  "notification.show",
@@ -8541,6 +8604,64 @@ var updateProjectInputSchema = object({
8541
8604
  }).refine((value) => Object.keys(value).length > 0, {
8542
8605
  message: "At least one field must be provided"
8543
8606
  });
8607
+ // ../pstdio-api-contracts/src/session-request-values.ts
8608
+ var harnessParamValueSchema = union([string2(), boolean2()]);
8609
+ var harnessParamsInputSchema = record(string2(), harnessParamValueSchema);
8610
+ var sessionAttachmentRefSchema = object({ file_id: string2().min(1) });
8611
+
8612
+ // ../pstdio-api-contracts/src/queued-follow-ups.ts
8613
+ var queuedFollowUpSchema = object({
8614
+ queuePosition: number2().int().positive(),
8615
+ revision: string2().min(1),
8616
+ prompt: string2(),
8617
+ steeringUnavailableReason: string2().nullable().optional(),
8618
+ steeringDelivery: object({ id: string2(), runStartedAt: string2() }).nullable(),
8619
+ model: string2().nullable(),
8620
+ params: harnessParamsInputSchema,
8621
+ attachments: array(sessionAttachmentRefSchema)
8622
+ });
8623
+ var updateQueuedFollowUpInputSchema = object({
8624
+ prompt: string2().trim().min(1),
8625
+ expectedRevision: string2().min(1).optional(),
8626
+ model: string2().min(1).nullable().optional(),
8627
+ params: harnessParamsInputSchema.nullable().optional(),
8628
+ attachments: array(sessionAttachmentRefSchema).optional()
8629
+ });
8630
+ var combineQueuedFollowUpsInputSchema = object({
8631
+ sourcePosition: number2().int().positive(),
8632
+ sourceRevision: string2().min(1),
8633
+ targetRevision: string2().min(1)
8634
+ });
8635
+ var queuedFollowUpUpdateResponseSchema = object({ ok: literal(true), request: queuedFollowUpSchema });
8636
+ var pendingQueuedFollowUpsResponseSchema = object({
8637
+ requests: array(queuedFollowUpSchema),
8638
+ activeRunStartedAt: string2().nullable(),
8639
+ steeringAvailable: boolean2(),
8640
+ steeringUnavailableReason: string2().nullable()
8641
+ });
8642
+ var steerQueuedFollowUpInputSchema = object({
8643
+ expectedRevision: string2().min(1),
8644
+ expectedRunStartedAt: string2().min(1)
8645
+ });
8646
+ var queuedSteeringResultSchema = discriminatedUnion("status", [
8647
+ object({ status: literal("accepted"), deliveryId: string2() }),
8648
+ object({
8649
+ status: literal("rejected"),
8650
+ reason: _enum([
8651
+ "unsupported",
8652
+ "inactive",
8653
+ "stale_run",
8654
+ "blocking_input",
8655
+ "missing",
8656
+ "stale_revision",
8657
+ "different_settings",
8658
+ "delivery_failed",
8659
+ "invalid_attachments"
8660
+ ]),
8661
+ message: string2()
8662
+ }),
8663
+ object({ status: literal("uncertain"), deliveryId: string2(), message: string2() })
8664
+ ]);
8544
8665
  // ../pstdio-api-contracts/src/resource-anchors.ts
8545
8666
  var resourceLinkRefSchema = extensionResourceRefSchema.extend({
8546
8667
  type: string2().min(1),
@@ -8721,8 +8842,6 @@ var sessionStatusSchema = _enum([
8721
8842
  "cancelled",
8722
8843
  "disconnected"
8723
8844
  ]);
8724
- var harnessParamValueSchema = union([string2(), boolean2()]);
8725
- var harnessParamsInputSchema = record(string2(), harnessParamValueSchema);
8726
8845
  var sessionSchema = object({
8727
8846
  id: string2(),
8728
8847
  project_id: string2().nullable(),
@@ -8742,9 +8861,6 @@ var sessionSchema = object({
8742
8861
  created_at: string2(),
8743
8862
  updated_at: string2()
8744
8863
  });
8745
- var sessionAttachmentRefSchema = object({
8746
- file_id: string2().min(1)
8747
- });
8748
8864
  var createSessionResponseSchema = sessionSchema.extend({
8749
8865
  operation_result: harnessOperationResponseSchema.optional()
8750
8866
  });
@@ -8797,7 +8913,10 @@ var followUpDecisionSchema = union([
8797
8913
  var followUpResponseSchema = sessionSchema.extend({
8798
8914
  follow_up: followUpDecisionSchema
8799
8915
  });
8800
- var sessionQueuedMessagesResponseSchema = object({ messages: array(sessionMessageSchema) });
8916
+ var sessionQueuedMessagesResponseSchema = object({
8917
+ messages: array(sessionMessageSchema),
8918
+ queue: pendingQueuedFollowUpsResponseSchema.optional()
8919
+ });
8801
8920
  var sessionConversationSourcesSchema = object({
8802
8921
  checkpoint: array(sessionMessageSchema).nullable(),
8803
8922
  native: array(sessionMessageSchema).nullable(),
package/dist/api.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { $ as ListExtensionCommandsResponse, $u as ApprovalInput, B as ConfigureExtensionConnectionInput, Bd as TerminalBridge, C as ExtensionSettingsPanelRecord, Cd as NotificationPriority, D as ExtensionCommandPaletteResourceRecord, E as ExtensionKeybindingRecord, F as ProjectExtensionInstance, G as LocalizableString, Gd as TerminalSessionExit, H as ListExtensionConnectionsResponse, Hd as TerminalHostEvent, I as UpgradeProjectExtensionResponse, Id as ResourceRef, J as ExtensionMenuContribution, Jd as TerminalSessionRequest, K as ExtensionCommandPaletteContribution, L as CommandExecuteRequest, M as InstallMarketplaceExtensionResponse, N as ListProjectExtensionsResponse, O as WorkbenchExtensionCommandPaletteResourceRecord, P as MarketplaceExtension, Q as ListExtensionAppearanceResponse, Qu as UpdateSkillInput, R as CommandExecuteResponse, S as ExtensionSettingValueRecord, Sd as NotificationOrigin, T as UpdateExtensionSettingRequest, Td as UpdateNotificationInput, U as ExtensionDiagnostic, Ud as TerminalSessionAdapter, V as ExtensionConnectionRecord, W as ExtensionRecord, Wd as TerminalSessionError, X as findViewFilterProblem, Y as WorkbenchExtensionAutomationRecord, Yd as TerminalSessionResult, Z as viewFilterValueKind, _ as CreateProjectInput, _d as ListNotificationsResponse, _t as IssueAutomationTokenResponse, a as RemoveWorktreeResponse$1, at as BoardSummary, bd as NotificationActorType, c as WorkspaceFileContent$1, ct as BoardViewUpdate, dd as SessionConversationResponse, dt as AutomationRunError, ed as CreateSessionInput, et as WorkbenchExtensionHarnessRecord, f as WorkspaceProviderDescriptor, fd as SessionConversationSources, ft as AutomationRunEvent, g as sessionAttachmentMimeTypesByExtension, gd as ListNotificationsQuery, gt as IssueAutomationTokenInput, h as UpdateSettingsInput, hd as CreateNotificationInput, ht as CreateAutomationRunInput, i as ListWorkspaceFilesInput$1, it as BoardField, k as AddLocalExtensionFolderResponse, l as WorkspaceFileEntry$1, ld as SessionAttachment, lt as BoardViews, m as Settings, mt as AutomationTokenRecord, nd as FollowUpInput, nt as WorkbenchExtensionViewBody, o as RenameWorkspaceInput$1, od as ResolveSessionIdInput, ot as BoardView, p as WriteWorkspaceFileInput$1, pd as SessionQueuedMessagesResponse, pt as AutomationRunStatus, q as ExtensionCommandRecord, qd as TerminalSessionOperation, rt as WorkbenchExtensionViewRecord, sd as ResolveSessionIdResponse, st as BoardViewCreate, t as CreateWorkspaceInput$1, tt as WorkbenchExtensionMetadata, u as WorkspaceFilesResponse$1, ud as SessionAttachmentRef, ut as AutomationRun, vd as Notification, vt as ListAutomationRunEventsResponse, w as ListExtensionSettingsResponse, wd as NotificationStatus, x as ExtensionSettingDefinitionRecord, xd as NotificationKind, y as UpdateProjectInput, yd as NotificationAction, yt as ListAutomationTokensResponse } from "./index-BvsVU-eX.js";
2
- import "./sessions-BtOnRpZy.js";
3
- import "./skills-BtOnRpZy.js";
1
+ import { $ as WorkbenchExtensionAutomationRecord, A as InstallExtensionRequest, B as UpgradeProjectExtensionResponse, Bd as ListNotificationsResponse, C as ExtensionSettingsPanelRecord, Cd as BoardViewUpdate, D as ExtensionCommandPaletteResourceRecord, E as ExtensionKeybindingRecord, G as ExtensionConnectionRecord, Gd as NotificationOrigin, H as CommandExecuteResponse, Hd as NotificationAction, I as InstallMarketplaceExtensionResponse, J as ExtensionRecord, Jd as UpdateNotificationInput, K as ListExtensionConnectionsResponse, Kd as NotificationPriority, L as ListProjectExtensionsResponse, Ld as UpdateSkillInput, M as InstalledExtensionSource, N as AddLocalExtensionFolderResponse, O as WorkbenchExtensionCommandPaletteResourceRecord, Q as ExtensionMenuContribution, Qu as FollowUpInput, R as MarketplaceExtension, Rd as CreateNotificationInput, S as ExtensionSettingValueRecord, Sd as BoardViewCreate, T as UpdateExtensionSettingRequest, Ud as NotificationActorType, V as CommandExecuteRequest, Vd as Notification, W as ConfigureExtensionConnectionInput, Wd as NotificationKind, X as ExtensionCommandPaletteContribution, Xu as CreateSessionInput, Y as LocalizableString, Yu as ApprovalInput, Z as ExtensionCommandRecord, _ as CreateProjectInput, _d as UpdateQueuedFollowUpInput, _f as TerminalSessionOperation, _t as ListAutomationTokensResponse, a as RemoveWorktreeResponse$1, ad as SessionAttachment, af as ResourceRef, at as WorkbenchExtensionMetadata, bd as BoardSummary, c as WorkspaceFileContent$1, cd as SessionConversationSources, ct as AutomationRun, dd as CombineQueuedFollowUpsInput, dt as AutomationRunStatus, et as findViewFilterProblem, f as WorkspaceProviderDescriptor, fd as PendingQueuedFollowUpsResponse, ff as TerminalHostEvent, ft as AutomationTokenRecord, g as sessionAttachmentMimeTypesByExtension, gd as SteerQueuedFollowUpInput, gt as ListAutomationRunEventsResponse, h as UpdateSettingsInput, hd as QueuedSteeringResult, hf as TerminalSessionExit, ht as IssueAutomationTokenResponse, i as ListWorkspaceFilesInput$1, it as WorkbenchExtensionHarnessRecord, j as InstallExtensionResponse, k as ExtensionDiagnosticsResponse, l as WorkspaceFileEntry$1, ld as SessionQueuedMessagesResponse, lt as AutomationRunError, m as Settings, md as QueuedFollowUpUpdateResponse, mf as TerminalSessionError, mt as IssueAutomationTokenInput, nd as ResolveSessionIdInput, nt as ListExtensionAppearanceResponse, o as RenameWorkspaceInput$1, od as SessionAttachmentRef, ot as WorkbenchExtensionViewBody, p as WriteWorkspaceFileInput$1, pd as QueuedFollowUpRequest, pf as TerminalSessionAdapter, pt as CreateAutomationRunInput, q as ExtensionDiagnostic, qd as NotificationStatus, rd as ResolveSessionIdResponse, rt as ListExtensionCommandsResponse, sd as SessionConversationResponse, st as WorkbenchExtensionViewRecord, t as CreateWorkspaceInput$1, tt as viewFilterValueKind, u as WorkspaceFilesResponse$1, uf as TerminalBridge, ut as AutomationRunEvent, vf as TerminalSessionRequest, w as ListExtensionSettingsResponse, wd as BoardViews, x as ExtensionSettingDefinitionRecord, xd as BoardView, y as UpdateProjectInput, yd as BoardField, yf as TerminalSessionResult, z as ProjectExtensionInstance, zd as ListNotificationsQuery } from "./index-DKb6w-4h.js";
2
+ import "./sessions-D3MhZWKe.js";
3
+ import "./skills-D3MhZWKe.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 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 TerminalBridge, type TerminalHostEvent, type TerminalSessionAdapter, type TerminalSessionError, type TerminalSessionExit, 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, findViewFilterProblem, sessionAttachmentMimeTypesByExtension, viewFilterValueKind };
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 CombineQueuedFollowUpsInput, 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 ExtensionDiagnosticsResponse, type ExtensionKeybindingRecord, type ExtensionMenuContribution, type ExtensionRecord, type ExtensionSettingDefinitionRecord, type ExtensionSettingValueRecord, type ExtensionSettingsPanelRecord, type FollowUpInput, type InstallExtensionRequest, type InstallExtensionResponse, type InstallMarketplaceExtensionResponse, type InstalledExtensionSource, 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 PendingQueuedFollowUpsResponse, type ProjectExtensionInstance, type QueuedFollowUpRequest, type QueuedFollowUpUpdateResponse, type QueuedSteeringResult, type RemoveWorktreeResponse, type RenameWorkspaceInput, type ResolveSessionIdInput, type ResolveSessionIdResponse, type ResourceRef, type SessionAttachment, type SessionAttachmentRef, type SessionConversationResponse, type SessionConversationSources, type SessionQueuedMessagesResponse, type Settings, type SteerQueuedFollowUpInput, type TerminalBridge, type TerminalHostEvent, type TerminalSessionAdapter, type TerminalSessionError, type TerminalSessionExit, type TerminalSessionOperation, type TerminalSessionRequest, type TerminalSessionResult, type UpdateExtensionSettingRequest, type UpdateNotificationInput, type UpdateProjectInput, type UpdateQueuedFollowUpInput, 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, findViewFilterProblem, sessionAttachmentMimeTypesByExtension, viewFilterValueKind };
15
15
  export {};
@@ -36,8 +36,132 @@ var createBoardViewsClient = (request) => ({
36
36
  setDefault: (projectId, boardId, viewId) => request(`${boardPath(projectId, boardId)}/default`, { method: "PUT", body: { viewId } })
37
37
  });
38
38
 
39
+ // src/internal/stream-buffer.ts
40
+ var createStreamBuffer = (input) => {
41
+ const queue = [];
42
+ let bytes = 0;
43
+ let ended = false;
44
+ let error;
45
+ let wake = () => {};
46
+ let consumed = false;
47
+ const finish = (reason) => {
48
+ ended = true;
49
+ error = reason;
50
+ if (reason) {
51
+ queue.length = 0;
52
+ bytes = 0;
53
+ }
54
+ wake();
55
+ };
56
+ return {
57
+ push(value) {
58
+ if (ended)
59
+ return true;
60
+ const size = input.size(value);
61
+ if (bytes + size > input.limit)
62
+ return false;
63
+ queue.push({ value, bytes: size });
64
+ bytes += size;
65
+ wake();
66
+ return true;
67
+ },
68
+ finish,
69
+ clear() {
70
+ queue.length = 0;
71
+ bytes = 0;
72
+ finish();
73
+ },
74
+ iterable: {
75
+ [Symbol.asyncIterator]() {
76
+ if (consumed)
77
+ throw new Error("Command streams support one consumer");
78
+ consumed = true;
79
+ return {
80
+ async next() {
81
+ while (!queue.length && !ended)
82
+ await new Promise((resolve) => {
83
+ wake = resolve;
84
+ });
85
+ const item = queue.shift();
86
+ if (item) {
87
+ bytes -= item.bytes;
88
+ input.onConsume?.(item.bytes);
89
+ return { done: false, value: item.value };
90
+ }
91
+ if (error)
92
+ throw error;
93
+ return { done: true, value: undefined };
94
+ },
95
+ async return() {
96
+ queue.length = 0;
97
+ bytes = 0;
98
+ await input.onCancel();
99
+ finish();
100
+ return { done: true, value: undefined };
101
+ }
102
+ };
103
+ }
104
+ }
105
+ };
106
+ };
107
+ var streamError = (code, message = code) => Object.assign(new Error(message), { code });
108
+ var jsonBytes = (value) => new TextEncoder().encode(JSON.stringify(value)).byteLength;
109
+
110
+ // src/client/extension-stream.ts
111
+ var streamExtensionCommand = (transport, commandId, input, options) => {
112
+ let close = () => {};
113
+ const cleanup = () => {
114
+ close();
115
+ options?.signal?.removeEventListener("abort", abort);
116
+ };
117
+ const fail = (error) => {
118
+ cleanup();
119
+ buffer.finish(error);
120
+ };
121
+ const abort = () => fail(streamError("command_stream_cancelled"));
122
+ const buffer = createStreamBuffer({
123
+ size: jsonBytes,
124
+ limit: 8 * 1024 * 1024,
125
+ onCancel: cleanup
126
+ });
127
+ if (options?.signal?.aborted) {
128
+ abort();
129
+ return buffer.iterable;
130
+ }
131
+ const { projectId, ...body } = input;
132
+ const subscription = transport.subscribe({ command: { project_id: projectId, command_id: commandId, body } }, {
133
+ onEvent(event, data) {
134
+ if (event === "chunk") {
135
+ if (!buffer.push({ type: "data", data }))
136
+ fail(streamError("command_stream_overflow"));
137
+ } else if (event === "end") {
138
+ if (!buffer.push({ type: "end", response: data })) {
139
+ fail(streamError("command_stream_overflow"));
140
+ return;
141
+ }
142
+ cleanup();
143
+ buffer.finish();
144
+ }
145
+ },
146
+ onError(error) {
147
+ const code = error?.code ?? "command_stream_disconnected";
148
+ fail(streamError(code, error instanceof Error ? error.message : String(error)));
149
+ }
150
+ });
151
+ close = subscription.close;
152
+ options?.signal?.addEventListener("abort", abort, { once: true });
153
+ return buffer.iterable;
154
+ };
155
+
39
156
  // src/client/extensions.ts
40
- var createExtensionClient = (request) => ({
157
+ var createExtensionClient = (request, streams) => ({
158
+ install: (projectId, input, options) => request(`/v1/projects/${projectId}/extensions/install`, {
159
+ method: "POST",
160
+ body: "upload" in input ? input.upload : input,
161
+ signal: options?.signal
162
+ }),
163
+ diagnostics: (projectId, options) => request(`/v1/projects/${projectId}/extensions/diagnostics${options?.scope ? `?scope=${options.scope}` : ""}`),
164
+ stream: (commandId, input, options) => streamExtensionCommand(streams, commandId, input, options),
41
165
  enableInstalled: (projectId, installName, body) => request(`/v1/projects/${projectId}/extensions/installed/${encodeURIComponent(installName)}/enable`, {
42
166
  method: "POST",
43
167
  body
@@ -139,9 +263,11 @@ var createProjectClient = (request) => ({
139
263
 
140
264
  // src/client/request.ts
141
265
  class PstdioApiError extends Error {
266
+ code;
142
267
  status;
143
- constructor(message, status) {
268
+ constructor(message, status, code) {
144
269
  super(message);
270
+ this.code = code;
145
271
  this.name = "PstdioApiError";
146
272
  this.status = status;
147
273
  }
@@ -242,7 +368,8 @@ var createRequest = (options) => {
242
368
  if (!response.ok) {
243
369
  const errorBody = await response.json().catch(() => null);
244
370
  const message = readErrorMessage(errorBody, response.status);
245
- throw new PstdioApiError(message, response.status);
371
+ const code = errorBody && typeof errorBody === "object" && "code" in errorBody && typeof errorBody.code === "string" ? errorBody.code : undefined;
372
+ throw new PstdioApiError(message, response.status, code);
246
373
  }
247
374
  if (response.status === 204)
248
375
  return;
@@ -337,7 +464,7 @@ var createSessionStreamTransport = (request, clientOptions) => {
337
464
  const subscribe = (connectionId, id, subscription) => {
338
465
  subscription.started = request(`/v1/session-stream/${connectionId}/subscriptions`, {
339
466
  method: "POST",
340
- body: { subscription_id: id, session_id: subscription.sessionId }
467
+ body: { subscription_id: id, ...subscription.input }
341
468
  }).then(() => {}, (error) => {
342
469
  if (subscriptions.get(id) !== subscription)
343
470
  return;
@@ -361,6 +488,8 @@ var createSessionStreamTransport = (request, clientOptions) => {
361
488
  started.then(() => request(path, { method: "DELETE" })).catch(() => {});
362
489
  };
363
490
  const dispatch = (current, event, payload) => {
491
+ if (connection !== current)
492
+ return;
364
493
  if (event === "connected") {
365
494
  current.id = payload.connection_id;
366
495
  for (const [id, subscription] of subscriptions)
@@ -373,7 +502,9 @@ var createSessionStreamTransport = (request, clientOptions) => {
373
502
  if (event === "end" || event === "error")
374
503
  release(payload.subscription_id, false);
375
504
  if (event === "error")
376
- subscription.onError(new Error(payload.data.message));
505
+ subscription.onError(Object.assign(new Error(payload.data.message), {
506
+ code: payload.data.code
507
+ }));
377
508
  else
378
509
  subscription.onEvent(event, payload.data);
379
510
  };
@@ -404,9 +535,9 @@ var createSessionStreamTransport = (request, clientOptions) => {
404
535
  return current;
405
536
  };
406
537
  return {
407
- subscribe(sessionId, listener) {
538
+ subscribe(input, listener) {
408
539
  const id = crypto.randomUUID();
409
- const subscription = { ...listener, sessionId };
540
+ const subscription = { ...listener, input: typeof input === "string" ? { session_id: input } : input };
410
541
  subscriptions.set(id, subscription);
411
542
  const current = connection ?? open();
412
543
  if (current.id)
@@ -455,8 +586,7 @@ var dispatchSessionStreamEvent = (event, data, handlers) => {
455
586
  handlers.onEnd?.(data);
456
587
  }
457
588
  };
458
- var createSessionClient = (request, clientOptions) => {
459
- const streams = createSessionStreamTransport(request, clientOptions);
589
+ var createSessionClient = (request, clientOptions, streams = createSessionStreamTransport(request, clientOptions)) => {
460
590
  return {
461
591
  getDraftHarnessCommands: (input, signal) => request("/v1/sessions/harness-command-state", { method: "POST", body: input, signal }),
462
592
  listActivity: (sessionId, input = {}) => {
@@ -496,6 +626,10 @@ var createSessionClient = (request, clientOptions) => {
496
626
  getConversation: (sessionId, signal) => request(`/v1/sessions/${sessionId}/conversation`, { signal }),
497
627
  getConversationSources: (sessionId, signal) => request(`/v1/sessions/${sessionId}/conversation/sources`, { signal }),
498
628
  getQueuedMessages: (sessionId, options) => request(`/v1/sessions/${sessionId}/queued-messages`, options),
629
+ steerQueuedFollowUp: (sessionId, queuePosition, input) => request(`/v1/sessions/${sessionId}/queued-follow-ups/${queuePosition}/steer`, { method: "POST", body: input }),
630
+ getQueuedFollowUps: (sessionId) => request(`/v1/sessions/${sessionId}/queued-follow-ups`),
631
+ updateQueuedFollowUp: (sessionId, queuePosition, input) => request(`/v1/sessions/${sessionId}/queued-follow-ups/${queuePosition}`, { method: "PATCH", body: input }),
632
+ combineQueuedFollowUps: (sessionId, queuePosition, input) => request(`/v1/sessions/${sessionId}/queued-follow-ups/${queuePosition}/combine`, { method: "POST", body: input }),
499
633
  resolveSessionId: (input) => request("/v1/sessions/resolve-session-id", { method: "POST", body: input }),
500
634
  updateStatus: (sessionId, status) => request(`/v1/sessions/${sessionId}/status`, { method: "PATCH", body: { status } }),
501
635
  rename: (sessionId, title) => request(`/v1/sessions/${sessionId}/title`, { method: "PATCH", body: { title } }),
@@ -754,18 +888,19 @@ var createWorkspaceClient = (request) => ({
754
888
  // src/client/client.ts
755
889
  var createClient = (options = {}) => {
756
890
  const request = createRequest(options);
891
+ const streams = createSessionStreamTransport(request, options);
757
892
  return {
758
893
  resources: createResourceAnchorsClient(request),
759
894
  views: createBoardViewsClient(request),
760
895
  projects: createProjectClient(request),
761
896
  filesystem: createFilesystemClient(request),
762
897
  workspaces: createWorkspaceClient(request),
763
- sessions: createSessionClient(request, options),
898
+ sessions: createSessionClient(request, options, streams),
764
899
  skills: createSkillClient(request),
765
900
  agents: createAgentClient(request),
766
901
  automation: createAutomationClient(request),
767
902
  notifications: createNotificationsClient(request),
768
- extensions: createExtensionClient(request),
903
+ extensions: createExtensionClient(request, streams),
769
904
  settings: createSettingsClient(request),
770
905
  sync: createSyncClient(options),
771
906
  runtime: createRuntimeClient(request)
package/dist/client.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { A as ClientOptions, C as NotificationsClient, D as BoardViewsClient, E as ExtensionClient, F as createRequest, M as PstdioConnectionError, N as RequestFn, O as AutomationClient, P as RequestOptions, S as ProjectClient, T as FilesystemClient, _ 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 PstdioApiError, k as AgentClient, 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 DirectoryEntry, x as ResourceAnchorsClient, y as RuntimeClient } from "./index-B8kqMxoR.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, PstdioConnectionError, type RequestFn, type RequestOptions, type ResourceAnchorsClient, 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 AgentClient, C as NotificationsClient, D as CommandStreamClientEvent, E as ExtensionClient, F as RequestOptions, I as createRequest, M as PstdioApiError, N as PstdioConnectionError, O as BoardViewsClient, P as RequestFn, S as ProjectClient, T as FilesystemClient, _ 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 ClientOptions, k as AutomationClient, 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 DirectoryEntry, x as ResourceAnchorsClient, y as RuntimeClient } from "./index-COPyc9eO.js";
2
+ export { type AgentClient, type AutomationClient, type BoardViewsClient, type ClientOptions, type CommandStreamClientEvent, type DirectoryEntry, type ExtensionClient, type FilesystemClient, type ListSessionsInput, type NotificationsClient, type ProjectClient, PstdioApiError, type PstdioClient, PstdioConnectionError, type RequestFn, type RequestOptions, type ResourceAnchorsClient, 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 { Di as ArtifactMount } from "./index-BvsVU-eX.js";
1
+ import { ki as ArtifactMount } from "./index-DKb6w-4h.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;