@pstdio/sdk 0.41.0 → 0.43.0-nightly.20261011183426

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
@@ -6255,6 +6255,15 @@ var listActivityResponseSchema = object({
6255
6255
  events: array(activityEventSchema),
6256
6256
  next_cursor: string2().nullable()
6257
6257
  });
6258
+ // ../pstdio-api-contracts/src/harness.ts
6259
+ var AGENT_CAPABILITIES = [
6260
+ "SessionFork",
6261
+ "ContextUsage",
6262
+ "Approvals",
6263
+ "SessionReattach",
6264
+ "Attachments"
6265
+ ];
6266
+
6258
6267
  // ../pstdio-api-contracts/src/agents.ts
6259
6268
  var agentAvailabilityTypeSchema = _enum(["INSTALLED", "NOT_FOUND"]);
6260
6269
  var agentSkillsLayoutSchema = object({
@@ -6284,9 +6293,14 @@ var harnessParamsSchema = record(string2(), harnessParamDescriptorSchema);
6284
6293
  var agentInfoSchema = object({
6285
6294
  id: string2(),
6286
6295
  name: string2(),
6287
- availability: object({ type: agentAvailabilityTypeSchema }),
6296
+ availability: object({
6297
+ type: agentAvailabilityTypeSchema,
6298
+ reason: string2().optional()
6299
+ }),
6288
6300
  skills: agentSkillsLayoutSchema.optional(),
6289
- params: harnessParamsSchema.optional()
6301
+ params: harnessParamsSchema.optional(),
6302
+ capabilities: array(_enum(AGENT_CAPABILITIES)),
6303
+ supportsModels: boolean2()
6290
6304
  });
6291
6305
  var agentModelSchema = object({
6292
6306
  id: string2(),
@@ -6415,7 +6429,8 @@ var extensionArtifactMountSchema = object({
6415
6429
  extensionId: string2(),
6416
6430
  relativePath: string2(),
6417
6431
  fullPath: string2(),
6418
- label: localizableStringSchema
6432
+ label: localizableStringSchema,
6433
+ watch: boolean2()
6419
6434
  });
6420
6435
  // ../pstdio-api-contracts/src/extension-kernel/workbench-targets.ts
6421
6436
  var workbenchMenuTargets = ["workbench.nav.actions", "workbench.nav.overflow"];
@@ -6479,6 +6494,10 @@ var extensionCommandRecordSchema = object({
6479
6494
  examples: array(string2()).optional(),
6480
6495
  automation: boolean2().optional(),
6481
6496
  mutating: boolean2().optional(),
6497
+ resourceMutation: discriminatedUnion("kind", [
6498
+ object({ kind: literal("rename"), resourceType: string2(), idParam: string2(), labelParam: string2() }),
6499
+ object({ kind: literal("remove"), resourceType: string2(), idParam: string2() })
6500
+ ]).optional(),
6482
6501
  params: record(string2(), object({ type: string2() }).catchall(unknown())).optional()
6483
6502
  });
6484
6503
  var extensionParamObjectSchema = record(string2(), object({ type: string2() }).catchall(unknown()));
@@ -6772,6 +6791,11 @@ var base = { id: string2(), name: string2(), description: string2().optional(),
6772
6791
  var numeric = { min: number2().optional(), max: number2().optional(), step: number2().optional() };
6773
6792
  var vector = strictObject({ x: number2(), y: number2() });
6774
6793
  var range = tuple([number2(), number2()]);
6794
+ var harness = strictObject({
6795
+ harnessId: string2().min(1),
6796
+ model: string2().optional(),
6797
+ params: record(string2(), union([string2(), boolean2()])).optional()
6798
+ });
6775
6799
  var selectionValue = union([string2(), array(string2())]);
6776
6800
  var selectionOption = strictObject({
6777
6801
  id: string2(),
@@ -6796,9 +6820,10 @@ var readOnlyContent = union([
6796
6820
  image.extend({ type: literal("image") }),
6797
6821
  strictObject({ type: literal("image-gallery"), images: array(image) })
6798
6822
  ]);
6799
- var controlValueSchema = union([primitive, array(string2()), range, vector]);
6823
+ var controlValueSchema = union([primitive, array(string2()), range, vector, harness]);
6800
6824
  var controlValuesSchema = record(string2(), controlValueSchema);
6801
6825
  var controlParamSchema = discriminatedUnion("type", [
6826
+ strictObject({ ...base, type: literal("harness"), defaultValue: harness }),
6802
6827
  strictObject({ ...base, ...numeric, type: literal("number"), defaultValue: number2() }),
6803
6828
  strictObject({ ...base, type: literal("boolean"), defaultValue: boolean2() }),
6804
6829
  strictObject({ ...base, type: literal("text"), defaultValue: string2(), singleLine: boolean2().optional() }),
@@ -6943,6 +6968,7 @@ var extensionTreeRendererRecordSchema = extensionRendererRecordBaseSchema.extend
6943
6968
  headerHandlerId: string2().optional(),
6944
6969
  bodyHandlerId: string2(),
6945
6970
  childrenHandlerId: string2().optional(),
6971
+ moveHandlerId: string2().optional(),
6946
6972
  footerHandlerId: string2().optional(),
6947
6973
  defaultExpandedSectionIds: array(string2()).optional(),
6948
6974
  defaultExpandedNodeIds: array(string2()).optional()
@@ -7538,6 +7564,7 @@ var workbenchExtensionResourceKindRecordSchema = object({
7538
7564
  label: localizableStringSchema.optional(),
7539
7565
  icon: string2().optional(),
7540
7566
  resolveCommand: string2().optional(),
7567
+ resolveManyCommand: string2().optional(),
7541
7568
  menuSlots: array(object({
7542
7569
  id: string2(),
7543
7570
  placement: _enum(["header-primary", "header-overflow", "context-menu"]),
@@ -7791,6 +7818,57 @@ var setupProjectExtensionResponseSchema = object({
7791
7818
  installedAgents: array(string2())
7792
7819
  }))
7793
7820
  });
7821
+ // ../pstdio-api-contracts/src/extensions/installation.ts
7822
+ var installNameSchema = string2().min(1).refine((name) => name !== "." && name !== ".." && !/[\\/:]/.test(name) && name.trim().length > 0, "Install name must be one folder name.");
7823
+ var installExtensionRequestSchema = object({
7824
+ source: discriminatedUnion("kind", [
7825
+ object({ kind: literal("catalog"), name: string2().min(1), ref: string2().min(1).optional() }).strict(),
7826
+ object({ kind: literal("project-folder"), path: string2().min(1), development: boolean2().optional() }).strict()
7827
+ ]),
7828
+ installName: installNameSchema.optional(),
7829
+ force: boolean2().optional(),
7830
+ skipInstall: boolean2().optional()
7831
+ }).strict();
7832
+ var formBoolean = _enum(["true", "false"]).optional().transform((value) => value === "true");
7833
+ var uploadExtensionRequestSchema = object({
7834
+ kind: literal("upload"),
7835
+ installName: installNameSchema.optional(),
7836
+ folderName: installNameSchema,
7837
+ files: preprocess((value) => Array.isArray(value) ? value : [value], array(_instanceof(File).meta({ type: "string", format: "binary" })).min(1)),
7838
+ force: formBoolean,
7839
+ skipInstall: formBoolean,
7840
+ development: formBoolean
7841
+ }).strict();
7842
+ var installedExtensionSourceSchema = object({
7843
+ check: extensionsCheckResponseSchema,
7844
+ installName: string2(),
7845
+ manifest: record(string2(), unknown()),
7846
+ metadata: object({
7847
+ id: string2(),
7848
+ name: string2(),
7849
+ displayName: string2(),
7850
+ version: string2(),
7851
+ description: string2().optional(),
7852
+ enginesPstdio: string2()
7853
+ }),
7854
+ source: discriminatedUnion("kind", [
7855
+ object({ kind: literal("local"), path: string2(), ref: string2().optional() }),
7856
+ object({ kind: literal("named"), name: string2(), ref: string2() })
7857
+ ]),
7858
+ sourceHash: string2(),
7859
+ targetPath: string2()
7860
+ });
7861
+ var installExtensionResponseSchema = object({
7862
+ source: installedExtensionSourceSchema,
7863
+ extension: projectExtensionInstanceSchema
7864
+ });
7865
+ var extensionDiagnosticsResponseSchema = object({
7866
+ roots: array(object({
7867
+ scope: _enum(["repo", "user"]),
7868
+ path: string2(),
7869
+ check: extensionsCheckResponseSchema
7870
+ }))
7871
+ });
7794
7872
  // ../pstdio-api-contracts/src/automation.ts
7795
7873
  var automationRunStatusSchema = _enum(["queued", "running", "succeeded", "failed", "cancelled", "rejected"]);
7796
7874
  var issueAutomationTokenInputSchema = object({
@@ -8059,6 +8137,8 @@ var projectEvents = {
8059
8137
  opened: hostEventRef("project.opened")
8060
8138
  };
8061
8139
  var viewDataEvents = {
8140
+ boardViewsChanged: hostEventRef("view.board-views.changed"),
8141
+ resourceAnchorsChanged: hostEventRef("view.resource-anchors.changed"),
8062
8142
  sessionsChanged: hostEventRef("view.sessions.changed"),
8063
8143
  workspacesChanged: hostEventRef("view.workspaces.changed"),
8064
8144
  repositoriesChanged: hostEventRef("view.repositories.changed")
@@ -8182,12 +8262,13 @@ var packageAsset = (path, baseUrl) => ({
8182
8262
  baseUrl
8183
8263
  });
8184
8264
  // ../pstdio-api-contracts/src/extension-kernel/types/extension.ts
8185
- var EXTENSION_API_VERSION = "0.1.2";
8265
+ var EXTENSION_API_VERSION = "0.1.3";
8186
8266
  // ../pstdio-api-contracts/src/extension-kernel/types/webview-capabilities.ts
8187
8267
  var WEBVIEW_HOST_CAPABILITY_VERSION = 1;
8188
8268
  var WEBVIEW_DECLARABLE_CAPABILITIES = [
8189
8269
  "clipboard.write",
8190
8270
  "commands.execute",
8271
+ "commands.stream",
8191
8272
  "navigation.open",
8192
8273
  "placement.close",
8193
8274
  "notification.show",
@@ -8541,6 +8622,64 @@ var updateProjectInputSchema = object({
8541
8622
  }).refine((value) => Object.keys(value).length > 0, {
8542
8623
  message: "At least one field must be provided"
8543
8624
  });
8625
+ // ../pstdio-api-contracts/src/session-request-values.ts
8626
+ var harnessParamValueSchema = union([string2(), boolean2()]);
8627
+ var harnessParamsInputSchema = record(string2(), harnessParamValueSchema);
8628
+ var sessionAttachmentRefSchema = object({ file_id: string2().min(1) });
8629
+
8630
+ // ../pstdio-api-contracts/src/queued-follow-ups.ts
8631
+ var queuedFollowUpSchema = object({
8632
+ queuePosition: number2().int().positive(),
8633
+ revision: string2().min(1),
8634
+ prompt: string2(),
8635
+ steeringUnavailableReason: string2().nullable().optional(),
8636
+ steeringDelivery: object({ id: string2(), runStartedAt: string2() }).nullable(),
8637
+ model: string2().nullable(),
8638
+ params: harnessParamsInputSchema,
8639
+ attachments: array(sessionAttachmentRefSchema)
8640
+ });
8641
+ var updateQueuedFollowUpInputSchema = object({
8642
+ prompt: string2().trim().min(1),
8643
+ expectedRevision: string2().min(1).optional(),
8644
+ model: string2().min(1).nullable().optional(),
8645
+ params: harnessParamsInputSchema.nullable().optional(),
8646
+ attachments: array(sessionAttachmentRefSchema).optional()
8647
+ });
8648
+ var combineQueuedFollowUpsInputSchema = object({
8649
+ sourcePosition: number2().int().positive(),
8650
+ sourceRevision: string2().min(1),
8651
+ targetRevision: string2().min(1)
8652
+ });
8653
+ var queuedFollowUpUpdateResponseSchema = object({ ok: literal(true), request: queuedFollowUpSchema });
8654
+ var pendingQueuedFollowUpsResponseSchema = object({
8655
+ requests: array(queuedFollowUpSchema),
8656
+ activeRunStartedAt: string2().nullable(),
8657
+ steeringAvailable: boolean2(),
8658
+ steeringUnavailableReason: string2().nullable()
8659
+ });
8660
+ var steerQueuedFollowUpInputSchema = object({
8661
+ expectedRevision: string2().min(1),
8662
+ expectedRunStartedAt: string2().min(1)
8663
+ });
8664
+ var queuedSteeringResultSchema = discriminatedUnion("status", [
8665
+ object({ status: literal("accepted"), deliveryId: string2() }),
8666
+ object({
8667
+ status: literal("rejected"),
8668
+ reason: _enum([
8669
+ "unsupported",
8670
+ "inactive",
8671
+ "stale_run",
8672
+ "blocking_input",
8673
+ "missing",
8674
+ "stale_revision",
8675
+ "different_settings",
8676
+ "delivery_failed",
8677
+ "invalid_attachments"
8678
+ ]),
8679
+ message: string2()
8680
+ }),
8681
+ object({ status: literal("uncertain"), deliveryId: string2(), message: string2() })
8682
+ ]);
8544
8683
  // ../pstdio-api-contracts/src/resource-anchors.ts
8545
8684
  var resourceLinkRefSchema = extensionResourceRefSchema.extend({
8546
8685
  type: string2().min(1),
@@ -8721,8 +8860,12 @@ var sessionStatusSchema = _enum([
8721
8860
  "cancelled",
8722
8861
  "disconnected"
8723
8862
  ]);
8724
- var harnessParamValueSchema = union([string2(), boolean2()]);
8725
- var harnessParamsInputSchema = record(string2(), harnessParamValueSchema);
8863
+ var sessionUsageSchema = object({
8864
+ input_tokens: number2(),
8865
+ output_tokens: number2(),
8866
+ cache_read_tokens: number2(),
8867
+ cache_write_tokens: number2()
8868
+ });
8726
8869
  var sessionSchema = object({
8727
8870
  id: string2(),
8728
8871
  project_id: string2().nullable(),
@@ -8738,13 +8881,12 @@ var sessionSchema = object({
8738
8881
  original_session_id: string2().nullable(),
8739
8882
  cwd: string2().nullable(),
8740
8883
  params_json: harnessParamsInputSchema.nullable(),
8884
+ usage_json: sessionUsageSchema.nullable().optional(),
8885
+ workspace_id: string2().nullable().optional(),
8741
8886
  anchors_json: array(extensionResourceRefSchema),
8742
8887
  created_at: string2(),
8743
8888
  updated_at: string2()
8744
8889
  });
8745
- var sessionAttachmentRefSchema = object({
8746
- file_id: string2().min(1)
8747
- });
8748
8890
  var createSessionResponseSchema = sessionSchema.extend({
8749
8891
  operation_result: harnessOperationResponseSchema.optional()
8750
8892
  });
@@ -8761,7 +8903,7 @@ var sessionAttachmentSchema = object({
8761
8903
  var createSessionInputSchema = object({
8762
8904
  project_id: string2().min(1),
8763
8905
  title: string2().min(1),
8764
- prompt: string2().min(1).optional(),
8906
+ prompt: string2().optional(),
8765
8907
  operation: harnessOperationSchema.optional(),
8766
8908
  agent: string2().min(1).optional(),
8767
8909
  workspace_id: string2().optional(),
@@ -8797,7 +8939,10 @@ var followUpDecisionSchema = union([
8797
8939
  var followUpResponseSchema = sessionSchema.extend({
8798
8940
  follow_up: followUpDecisionSchema
8799
8941
  });
8800
- var sessionQueuedMessagesResponseSchema = object({ messages: array(sessionMessageSchema) });
8942
+ var sessionQueuedMessagesResponseSchema = object({
8943
+ messages: array(sessionMessageSchema),
8944
+ queue: pendingQueuedFollowUpsResponseSchema.optional()
8945
+ });
8801
8946
  var sessionConversationSourcesSchema = object({
8802
8947
  checkpoint: array(sessionMessageSchema).nullable(),
8803
8948
  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, $d as NotificationOrigin, A as InstallExtensionRequest, Ad as BoardViewUpdate, B as UpgradeProjectExtensionResponse, C as ExtensionSettingsPanelRecord, Cd as SteerQueuedFollowUpInput, Cf as TerminalSessionExit, D as ExtensionCommandPaletteResourceRecord, Dd as BoardSummary, Df as TerminalSessionResult, E as ExtensionKeybindingRecord, Ed as BoardField, Ef as TerminalSessionRequest, G as ExtensionConnectionRecord, Gd as UpdateSkillInput, H as CommandExecuteResponse, I as InstallMarketplaceExtensionResponse, J as ExtensionRecord, Jd as ListNotificationsResponse, K as ListExtensionConnectionsResponse, Kd as CreateNotificationInput, L as ListProjectExtensionsResponse, M as InstalledExtensionSource, N as AddLocalExtensionFolderResponse, O as WorkbenchExtensionCommandPaletteResourceRecord, Od as BoardView, Q as ExtensionMenuContribution, Qd as NotificationKind, R as MarketplaceExtension, S as ExtensionSettingValueRecord, Sd as QueuedSteeringResult, Sf as TerminalSessionError, T as UpdateExtensionSettingRequest, Tf as TerminalSessionOperation, V as CommandExecuteRequest, W as ConfigureExtensionConnectionInput, X as ExtensionCommandPaletteContribution, Xd as NotificationAction, Y as LocalizableString, Yd as Notification, Z as ExtensionCommandRecord, Zd as NotificationActorType, _ as CreateProjectInput, _t as ListAutomationTokensResponse, a as RemoveWorktreeResponse$1, ad as FollowUpInput, at as WorkbenchExtensionMetadata, bd as QueuedFollowUpRequest, bf as TerminalHostEvent, c as WorkspaceFileContent$1, ct as AutomationRun, dt as AutomationRunStatus, ef as NotificationPriority, et as findViewFilterProblem, f as WorkspaceProviderDescriptor, fd as SessionAttachment, ft as AutomationTokenRecord, g as sessionAttachmentMimeTypesByExtension, gd as SessionQueuedMessagesResponse, gt as ListAutomationRunEventsResponse, h as UpdateSettingsInput, hd as SessionConversationSources, ht as IssueAutomationTokenResponse, i as ListWorkspaceFilesInput$1, it as WorkbenchExtensionHarnessRecord, j as InstallExtensionResponse, jd as BoardViews, k as ExtensionDiagnosticsResponse, kd as BoardViewCreate, l as WorkspaceFileEntry$1, ld as ResolveSessionIdInput, lt as AutomationRunError, m as Settings, md as SessionConversationResponse, mt as IssueAutomationTokenInput, nd as ApprovalInput, nf as UpdateNotificationInput, nt as ListExtensionAppearanceResponse, o as RenameWorkspaceInput$1, ot as WorkbenchExtensionViewBody, p as WriteWorkspaceFileInput$1, pd as SessionAttachmentRef, pf as ResourceRef, pt as CreateAutomationRunInput, q as ExtensionDiagnostic, qd as ListNotificationsQuery, rd as CreateSessionInput, rt as ListExtensionCommandsResponse, st as WorkbenchExtensionViewRecord, t as CreateWorkspaceInput$1, tf as NotificationStatus, tt as viewFilterValueKind, u as WorkspaceFilesResponse$1, ud as ResolveSessionIdResponse, ut as AutomationRunEvent, vd as CombineQueuedFollowUpsInput, vf as TerminalBridge, w as ListExtensionSettingsResponse, wd as UpdateQueuedFollowUpInput, x as ExtensionSettingDefinitionRecord, xd as QueuedFollowUpUpdateResponse, xf as TerminalSessionAdapter, y as UpdateProjectInput, yd as PendingQueuedFollowUpsResponse, z as ProjectExtensionInstance } from "./index-DFH7DRmX.js";
2
+ import "./sessions-ujovA_9i.js";
3
+ import "./skills-ujovA_9i.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)
@@ -432,6 +563,16 @@ var buildSessionsQuery = (projectId, input = {}) => {
432
563
  params.append("workspace_id", input.workspaceId);
433
564
  if (input.archived)
434
565
  params.append("archived", "true");
566
+ if (input.createdFrom)
567
+ params.append("created_from", input.createdFrom);
568
+ if (input.createdTo)
569
+ params.append("created_to", input.createdTo);
570
+ if (input.updatedFrom)
571
+ params.append("updated_from", input.updatedFrom);
572
+ if (input.anchorType)
573
+ params.append("anchor_type", input.anchorType);
574
+ if (input.anchorId)
575
+ params.append("anchor_id", input.anchorId);
435
576
  return params.toString();
436
577
  };
437
578
  var dispatchSessionStreamEvent = (event, data, handlers) => {
@@ -455,8 +596,7 @@ var dispatchSessionStreamEvent = (event, data, handlers) => {
455
596
  handlers.onEnd?.(data);
456
597
  }
457
598
  };
458
- var createSessionClient = (request, clientOptions) => {
459
- const streams = createSessionStreamTransport(request, clientOptions);
599
+ var createSessionClient = (request, clientOptions, streams = createSessionStreamTransport(request, clientOptions)) => {
460
600
  return {
461
601
  getDraftHarnessCommands: (input, signal) => request("/v1/sessions/harness-command-state", { method: "POST", body: input, signal }),
462
602
  listActivity: (sessionId, input = {}) => {
@@ -496,6 +636,10 @@ var createSessionClient = (request, clientOptions) => {
496
636
  getConversation: (sessionId, signal) => request(`/v1/sessions/${sessionId}/conversation`, { signal }),
497
637
  getConversationSources: (sessionId, signal) => request(`/v1/sessions/${sessionId}/conversation/sources`, { signal }),
498
638
  getQueuedMessages: (sessionId, options) => request(`/v1/sessions/${sessionId}/queued-messages`, options),
639
+ steerQueuedFollowUp: (sessionId, queuePosition, input) => request(`/v1/sessions/${sessionId}/queued-follow-ups/${queuePosition}/steer`, { method: "POST", body: input }),
640
+ getQueuedFollowUps: (sessionId) => request(`/v1/sessions/${sessionId}/queued-follow-ups`),
641
+ updateQueuedFollowUp: (sessionId, queuePosition, input) => request(`/v1/sessions/${sessionId}/queued-follow-ups/${queuePosition}`, { method: "PATCH", body: input }),
642
+ combineQueuedFollowUps: (sessionId, queuePosition, input) => request(`/v1/sessions/${sessionId}/queued-follow-ups/${queuePosition}/combine`, { method: "POST", body: input }),
499
643
  resolveSessionId: (input) => request("/v1/sessions/resolve-session-id", { method: "POST", body: input }),
500
644
  updateStatus: (sessionId, status) => request(`/v1/sessions/${sessionId}/status`, { method: "PATCH", body: { status } }),
501
645
  rename: (sessionId, title) => request(`/v1/sessions/${sessionId}/title`, { method: "PATCH", body: { title } }),
@@ -754,18 +898,19 @@ var createWorkspaceClient = (request) => ({
754
898
  // src/client/client.ts
755
899
  var createClient = (options = {}) => {
756
900
  const request = createRequest(options);
901
+ const streams = createSessionStreamTransport(request, options);
757
902
  return {
758
903
  resources: createResourceAnchorsClient(request),
759
904
  views: createBoardViewsClient(request),
760
905
  projects: createProjectClient(request),
761
906
  filesystem: createFilesystemClient(request),
762
907
  workspaces: createWorkspaceClient(request),
763
- sessions: createSessionClient(request, options),
908
+ sessions: createSessionClient(request, options, streams),
764
909
  skills: createSkillClient(request),
765
910
  agents: createAgentClient(request),
766
911
  automation: createAutomationClient(request),
767
912
  notifications: createNotificationsClient(request),
768
- extensions: createExtensionClient(request),
913
+ extensions: createExtensionClient(request, streams),
769
914
  settings: createSettingsClient(request),
770
915
  sync: createSyncClient(options),
771
916
  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-BXsW08Xq.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 { Ai as ArtifactMount } from "./index-DFH7DRmX.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;