@pstdio/sdk 0.47.0 → 0.48.0-nightly.20261116135425

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.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { $ as LocalizableString, As as TerminalSessionResult, At as ListAutomationTokensResponse, B as InstallExtensionRequest, Bf as ApprovalInput, Bh as NotificationOrigin$1, Cs as TerminalHostEvent, Ct as AutomationRunEvent, Dt as IssueAutomationTokenInput, Es as TerminalSessionExit, Et as CreateAutomationRunInput, F as UpdateExtensionSettingRequest, Fg as ProjectExtensionInstance, Fh as Notification$1, G as CommandExecuteResponse, Gf as ResolveSessionIdInput, H as InstalledExtensionSource, Hf as FollowUpInput, Hh as NotificationStatus$1, I as ExtensionKeybindingRecord, Ig as UpgradeProjectExtensionResponse, Ih as NotificationAction$1, J as ConfigureExtensionConnectionInput, Jf as SessionAttachment, K as CommandExecutionResult, Kf as ResolveSessionIdResponse, L as ExtensionCommandPaletteResourceRecord, Lh as NotificationActorType$1, M as ExtensionSettingValueRecord, Mg as InstallMarketplaceExtensionResponse, Mh as CreateNotificationInput$1, Ms as TerminalViewOpenRequest, N as ExtensionSettingsPanelRecord, Ng as ListProjectExtensionsResponse, Nh as ListNotificationsQuery$1, Os as TerminalSessionOperation, Ot as IssueAutomationTokenResponse, P as ListExtensionSettingsResponse, Pg as MarketplaceExtension, Ph as ListNotificationsResponse$1, Q as ExtensionRecord, Qf as SessionConversationSources, Qo as RenameWorkspaceInput$1, R as WorkbenchExtensionCommandPaletteResourceRecord, St as AutomationRunError, Ts as TerminalSessionError, Tt as AutomationTokenRecord, V as InstallExtensionResponse, Vf as CreateSessionInput, Vh as NotificationPriority$1, W as CommandExecuteRequest, Wh as UpdateNotificationInput$1, X as ListExtensionConnectionsResponse, Xf as SessionAttachmentRef, Xo as ListWorkspaceFilesInput$1, Y as ExtensionConnectionRecord, Z as ExtensionDiagnostic, Zf as SessionConversationResponse, Zo as RemoveWorktreeResponse$1, _h as ProjectFolderSourceRef, a as SessionImportError, ap as SessionQueuedMessagesResponse, at as viewFilterValueKind, b as RestoreProjectInput, bs as UpdateSkillInput, bt as DeviceCommand, c as SessionImportPreview, cp as PendingQueuedFollowUpsResponse, cs as BoardField, ct as WorkbenchExtensionHarnessRecord, dp as QueuedSteeringResult, ds as BoardViewCreate, dt as WorkbenchExtensionViewRecord, et as ExtensionCommandPaletteContribution, f as CreateProjectInput, fh as ProjectSyncStatus, fp as SteerQueuedFollowUpInput, fs as BoardViewUpdate, gh as ProjectFolderSource, hh as ProjectFolderRecoveryStatus, i as SessionSteeringInput, is as WorkspaceProviderDescriptor, it as findViewFilterProblem, j as ExtensionSettingDefinitionRecord, js as TerminalViewBinding, k as LinkIcon, kg as AddLocalExtensionFolderResponse, ks as TerminalSessionRequest, kt as ListAutomationRunEventsResponse, l as SessionImportSource, lh as ProjectSyncFile, lp as QueuedFollowUpRequest, ls as BoardSummary, lt as WorkbenchExtensionMetadata, mh as FolderRecoveryErrorCode, n as Settings, ns as WorkspaceFileEntry$1, nt as ExtensionMenuContribution, o as SessionImportErrors, os as WriteWorkspaceFileInput$1, ot as ListExtensionAppearanceResponse, ph as FolderRecoveryError, pp as UpdateQueuedFollowUpInput, ps as BoardViews, qo as CreateWorkspaceInput$1, qs as ResourceRef, r as UpdateSettingsInput, rs as WorkspaceFilesResponse$1, rt as WorkbenchExtensionAutomationRecord, s as SessionImportJob, sp as CombineQueuedFollowUpsInput, st as ListExtensionCommandsResponse, ts as WorkspaceFileContent$1, tt as ExtensionCommandRecord, u as sessionAttachmentMimeTypesByExtension, uh as ProjectSyncSource, up as QueuedFollowUpUpdateResponse, us as BoardView, ut as WorkbenchExtensionViewBody, v as UpdateProjectInput, vh as RestoreProjectFolderInput, ws as TerminalSessionAdapter, wt as AutomationRunStatus, x as RestoreProjectResult, xs as TerminalBridge, xt as AutomationRun, y as ProjectRecoveryPoint, z as ExtensionDiagnosticsResponse, zh as NotificationKind$1 } from "./index-BAGJA9cS.js";
2
- import "./sessions-CRb7hEW1.js";
3
- import "./skills-CRb7hEW1.js";
1
+ import { $ as ListExtensionConnectionsResponse, $g as UpgradeProjectExtensionResponse, $h as ProjectFolderRecoveryStatus, As as TerminalSessionAdapter, At as IssueAutomationTokenInput, B as ExtensionCommandPaletteResourceRecord, Bf as ResolveSessionIdInput, Ct as DeviceCommand, Ds as TerminalBridge, Dt as AutomationRunStatus, E as ResourceOpener, Es as UpdateSkillInput, Et as AutomationRunEvent, F as ExtensionSettingValueRecord, Ff as ApprovalInput, Fs as TerminalSessionRequest, G as InstalledExtensionSource, Gf as SessionAttachmentRef, H as ExtensionDiagnosticsResponse, I as ExtensionSettingsPanelRecord, If as CreateSessionInput, Is as TerminalSessionResult, J as CommandExecuteResponse, Jh as ProjectSyncSource, Kf as SessionConversationResponse, Kg as AddLocalExtensionFolderResponse, L as ListExtensionSettingsResponse, Lf as FollowUpInput, Ls as TerminalViewBinding, M as LinkIcon, Ms as TerminalSessionExit, Mt as ListAutomationRunEventsResponse, Nt as ListAutomationTokensResponse, Ot as AutomationTokenRecord, P as ExtensionSettingDefinitionRecord, Ps as TerminalSessionOperation, Q as ExtensionConnectionRecord, Qg as ProjectExtensionInstance, Qh as FolderRecoveryErrorCode, R as UpdateExtensionSettingRequest, Rs as TerminalViewOpenRequest, T as ProjectCompositionInput, Tt as AutomationRunError, U as InstallExtensionRequest, Uf as SessionAttachment, V as WorkbenchExtensionCommandPaletteResourceRecord, Vf as ResolveSessionIdResponse, W as InstallExtensionResponse, Xg as ListProjectExtensionsResponse, Xh as ProjectSyncStatus, Y as CommandExecutionResult, Yg as InstallMarketplaceExtensionResponse, Z as ConfigureExtensionConnectionInput, Zg as MarketplaceExtension, Zh as FolderRecoveryError, Zo as CreateWorkspaceInput$1, _s as BoardViewUpdate, a as SessionImportError, ah as NotificationAction$1, ap as QueuedFollowUpUpdateResponse, as as WorkspaceFileContent$1, at as ExtensionMenuContribution, b as RestoreProjectInput, c as SessionImportPreview, ch as NotificationKind$1, cp as UpdateQueuedFollowUpInput, cs as WorkspaceProviderDescriptor, ct as viewFilterValueKind, dh as NotificationStatus$1, dt as WorkbenchExtensionHarnessRecord, ec as ResourceRef, eg as ProjectFolderSource, ep as SessionQueuedMessagesResponse, es as ListWorkspaceFilesInput$1, et as ExtensionDiagnostic, f as CreateProjectInput, ft as WorkbenchExtensionMetadata, gs as BoardViewCreate, hs as BoardView, i as SessionSteeringInput, ih as Notification$1, ip as QueuedFollowUpRequest, it as ExtensionCommandRecord, js as TerminalSessionError, jt as IssueAutomationTokenResponse, ks as TerminalHostEvent, kt as CreateAutomationRunInput, l as SessionImportSource, lh as NotificationOrigin$1, lt as ListExtensionAppearanceResponse, ms as BoardSummary, mt as WorkbenchExtensionViewRecord, n as Settings, ng as RestoreProjectFolderInput, nh as ListNotificationsQuery$1, np as CombineQueuedFollowUpsInput, ns as RenameWorkspaceInput$1, nt as LocalizableString, o as SessionImportErrors, oh as NotificationActorType$1, op as QueuedSteeringResult, os as WorkspaceFileEntry$1, ot as WorkbenchExtensionAutomationRecord, ph as UpdateNotificationInput$1, ps as BoardField, pt as WorkbenchExtensionViewBody, q as CommandExecuteRequest, qf as SessionConversationSources, qh as ProjectSyncFile, r as UpdateSettingsInput, rh as ListNotificationsResponse$1, rp as PendingQueuedFollowUpsResponse, rt as ExtensionCommandPaletteContribution, s as SessionImportJob, sp as SteerQueuedFollowUpInput, ss as WorkspaceFilesResponse$1, st as findViewFilterProblem, tg as ProjectFolderSourceRef, th as CreateNotificationInput$1, ts as RemoveWorktreeResponse$1, tt as ExtensionRecord, u as sessionAttachmentMimeTypesByExtension, uh as NotificationPriority$1, us as WriteWorkspaceFileInput$1, ut as ListExtensionCommandsResponse, v as UpdateProjectInput, vs as BoardViews, w as ProjectComposition, wt as AutomationRun, x as RestoreProjectResult, y as ProjectRecoveryPoint, z as ExtensionKeybindingRecord } from "./index-CEtXTtY_.js";
2
+ import "./sessions-BrjES4wq.js";
3
+ import "./skills-BrjES4wq.js";
4
4
  /** @deprecated Import `CreateNotificationInput` from `@pstdio/sdk/resources`. */
5
5
  type CreateNotificationInput = CreateNotificationInput$1;
6
6
  /** @deprecated Import `ListNotificationsQuery` from `@pstdio/sdk/resources`. */
@@ -32,5 +32,5 @@ type WorkspaceFileContent = WorkspaceFileContent$1;
32
32
  type WorkspaceFileEntry = WorkspaceFileEntry$1;
33
33
  type WorkspaceFilesResponse = WorkspaceFilesResponse$1;
34
34
  type WriteWorkspaceFileInput = WriteWorkspaceFileInput$1;
35
- 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 CommandExecutionResult, type ConfigureExtensionConnectionInput, type CreateAutomationRunInput, type CreateNotificationInput, type CreateProjectInput, type CreateSessionInput, type CreateWorkspaceInput, type DeviceCommand, 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 FolderRecoveryError, type FolderRecoveryErrorCode, type FollowUpInput, type InstallExtensionRequest, type InstallExtensionResponse, type InstallMarketplaceExtensionResponse, type InstalledExtensionSource, type IssueAutomationTokenInput, type IssueAutomationTokenResponse, type LinkIcon, 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 ProjectFolderRecoveryStatus, type ProjectFolderSource, type ProjectFolderSourceRef, type ProjectRecoveryPoint, type ProjectSyncFile, type ProjectSyncSource, type ProjectSyncStatus, type QueuedFollowUpRequest, type QueuedFollowUpUpdateResponse, type QueuedSteeringResult, type RemoveWorktreeResponse, type RenameWorkspaceInput, type ResolveSessionIdInput, type ResolveSessionIdResponse, type ResourceRef, type RestoreProjectFolderInput, type RestoreProjectInput, type RestoreProjectResult, type SessionAttachment, type SessionAttachmentRef, type SessionConversationResponse, type SessionConversationSources, type SessionImportError, type SessionImportErrors, type SessionImportJob, type SessionImportPreview, type SessionImportSource, type SessionQueuedMessagesResponse, type SessionSteeringInput, type Settings, type SteerQueuedFollowUpInput, type TerminalBridge, type TerminalHostEvent, type TerminalSessionAdapter, type TerminalSessionError, type TerminalSessionExit, type TerminalSessionOperation, type TerminalSessionRequest, type TerminalSessionResult, type TerminalViewBinding, type TerminalViewOpenRequest, 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 };
35
+ 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 CommandExecutionResult, type ConfigureExtensionConnectionInput, type CreateAutomationRunInput, type CreateNotificationInput, type CreateProjectInput, type CreateSessionInput, type CreateWorkspaceInput, type DeviceCommand, 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 FolderRecoveryError, type FolderRecoveryErrorCode, type FollowUpInput, type InstallExtensionRequest, type InstallExtensionResponse, type InstallMarketplaceExtensionResponse, type InstalledExtensionSource, type IssueAutomationTokenInput, type IssueAutomationTokenResponse, type LinkIcon, 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 ProjectComposition, type ProjectCompositionInput, type ProjectExtensionInstance, type ProjectFolderRecoveryStatus, type ProjectFolderSource, type ProjectFolderSourceRef, type ProjectRecoveryPoint, type ProjectSyncFile, type ProjectSyncSource, type ProjectSyncStatus, type QueuedFollowUpRequest, type QueuedFollowUpUpdateResponse, type QueuedSteeringResult, type RemoveWorktreeResponse, type RenameWorkspaceInput, type ResolveSessionIdInput, type ResolveSessionIdResponse, type ResourceOpener, type ResourceRef, type RestoreProjectFolderInput, type RestoreProjectInput, type RestoreProjectResult, type SessionAttachment, type SessionAttachmentRef, type SessionConversationResponse, type SessionConversationSources, type SessionImportError, type SessionImportErrors, type SessionImportJob, type SessionImportPreview, type SessionImportSource, type SessionQueuedMessagesResponse, type SessionSteeringInput, type Settings, type SteerQueuedFollowUpInput, type TerminalBridge, type TerminalHostEvent, type TerminalSessionAdapter, type TerminalSessionError, type TerminalSessionExit, type TerminalSessionOperation, type TerminalSessionRequest, type TerminalSessionResult, type TerminalViewBinding, type TerminalViewOpenRequest, 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 };
36
36
  export {};
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  hashAssetSource
3
- } from "../index-27em78vf.js";
3
+ } from "../index-fqkeqnc0.js";
4
4
  import {
5
5
  textEditingFailure,
6
6
  textEditingError
@@ -10,16 +10,14 @@ import {
10
10
  extensionResourceRefSchema,
11
11
  pageParamValueSchema,
12
12
  viewRefSchema,
13
+ bytesToHex,
14
+ sha256,
13
15
  localContributionIdPattern2,
14
16
  createStreamBuffer,
15
17
  streamError,
16
18
  jsonBytes,
17
19
  createCommandStreamController
18
- } from "../index-44tjd79p.js";
19
- import {
20
- bytesToHex,
21
- sha256
22
- } from "../index-d7bk56nd.js";
20
+ } from "../index-m4f3wzks.js";
23
21
  import {
24
22
  PstdioApiError2,
25
23
  PstdioConnectionError2,
@@ -48,6 +46,10 @@ import {
48
46
  } from "../index-8p8wjwbf.js";
49
47
 
50
48
  // src/client/account.ts
49
+ var expectedIdentityQuery = (expected) => {
50
+ const query = new URLSearchParams(expected === null ? { local: "true" } : expected);
51
+ return query.size ? "?" + query.toString() : "";
52
+ };
51
53
  var createAccountClient = (request) => {
52
54
  const device = (id) => `/v1/account/devices/${encodeURIComponent(id)}`;
53
55
  const project = (id) => `/v1/account/projects/${encodeURIComponent(id)}`;
@@ -57,12 +59,16 @@ var createAccountClient = (request) => {
57
59
  login: (managerOrigin) => request("/v1/account/login", { method: "POST", body: { managerOrigin } }),
58
60
  loginStatus: (id) => request(login(id)),
59
61
  cancelLogin: (id) => request(login(id), { method: "DELETE" }),
60
- projectSyncStatus: (projectId, options) => request(`${project(projectId)}/sync`, options),
62
+ projectSyncStatus: (projectId, options) => request(`${project(projectId)}/sync${expectedIdentityQuery(options?.expected)}`, {
63
+ signal: options?.signal
64
+ }),
61
65
  retryProjectSyncSource: (projectId, sourceId) => request(`${project(projectId)}/sync/sources/${encodeURIComponent(sourceId)}/retry`, { method: "POST" }),
62
66
  retryProjectSync: (projectId) => request(`${project(projectId)}/retry`, { method: "POST" }),
63
67
  status: (options) => request("/v1/account", options),
64
68
  logout: () => request("/v1/account/logout", { method: "POST" }),
65
- devices: (options) => request("/v1/account/devices", options),
69
+ devices: (options) => request("/v1/account/devices" + expectedIdentityQuery(options?.expected), {
70
+ signal: options?.signal
71
+ }),
66
72
  renameDevice: (id, name) => request(`${device(id)}/rename`, { method: "POST", body: { name } }),
67
73
  removeDevice: (id) => request(`${device(id)}/remove`, { method: "POST" }),
68
74
  syncProject: (projectId) => request(project(projectId), { method: "PUT" }),
@@ -821,6 +827,13 @@ var createNotificationsClient = (request) => ({
821
827
 
822
828
  // src/client/projects.ts
823
829
  var createProjectClient = (request) => ({
830
+ resolveResourceOpenings: (projectId, resources, options) => request(`/v1/projects/${encodeURIComponent(projectId)}/resource-openings`, {
831
+ method: "POST",
832
+ body: { resources },
833
+ signal: options?.signal
834
+ }),
835
+ composition: (projectId) => request(`/v1/projects/${encodeURIComponent(projectId)}/composition`),
836
+ setComposition: (projectId, input) => request(`/v1/projects/${encodeURIComponent(projectId)}/composition`, { method: "PUT", body: input }),
824
837
  recoveryPoints: (projectId) => request(`/v1/projects/${encodeURIComponent(projectId)}/recovery-points`),
825
838
  restore: (projectId, input) => request(`/v1/projects/${encodeURIComponent(projectId)}/restore`, { method: "POST", body: input }),
826
839
  query: (input) => request(`/v1/projects/query${pageQuery(input)}`),
@@ -843,8 +856,75 @@ var createProjectClient = (request) => ({
843
856
  delete: (projectId) => request(`/v1/projects/${projectId}`, { method: "DELETE" })
844
857
  });
845
858
 
859
+ // src/client/resource-activity.ts
860
+ var encode2 = (bytes) => {
861
+ let text = "";
862
+ for (const byte of bytes)
863
+ text += String.fromCharCode(byte);
864
+ return btoa(text);
865
+ };
866
+ var createResourceActivityClient = (request, transport) => {
867
+ const post = (resource, operation, body = {}) => {
868
+ if (!resource.projectId)
869
+ throw new Error("Activity requires a project ID.");
870
+ return request(`/v1/projects/${encodeURIComponent(resource.projectId)}/activity/${operation}`, {
871
+ method: "POST",
872
+ body: { resource, ...body }
873
+ });
874
+ };
875
+ return {
876
+ capabilities: (resource) => post(resource, "capabilities"),
877
+ query: ({ resource, ...options }) => post(resource, "query", options),
878
+ get: (resource, id) => post(resource, "get", { id }),
879
+ publish: (resource, entry, options) => post(resource, "publish", { entry, ...options }),
880
+ resolve: (resource, id, resolved) => post(resource, "resolve", { id, resolved }),
881
+ handoff: (resource, id, options) => post(resource, "handoff", { id, ...options }),
882
+ attach: (resource, file) => post(resource, "attach", { key: file.key, name: file.name, mimeType: file.mimeType, base64: encode2(file.data) }),
883
+ readAttachment: async (resource, id) => {
884
+ const result = await post(resource, "attachment", { id });
885
+ return {
886
+ attachment: result.attachment,
887
+ data: Uint8Array.from(atob(result.base64), (char) => char.charCodeAt(0))
888
+ };
889
+ },
890
+ watch: (resource, input) => new Promise((resolve, reject) => {
891
+ if (input.signal.aborted)
892
+ return resolve();
893
+ let subscription;
894
+ const cleanup = () => {
895
+ input.signal.removeEventListener("abort", close);
896
+ subscription?.close();
897
+ };
898
+ const close = () => {
899
+ cleanup();
900
+ resolve();
901
+ };
902
+ input.signal.addEventListener("abort", close, { once: true });
903
+ subscription = transport.subscribe({ resource_activity: { project_id: resource.projectId, resource } }, {
904
+ onEvent: (event) => {
905
+ if (input.signal.aborted)
906
+ return;
907
+ if (event === "activity_ready")
908
+ input.onReady?.();
909
+ else if (event === "activity_changed")
910
+ input.onChange();
911
+ else if (event === "end")
912
+ close();
913
+ },
914
+ onError: (error) => {
915
+ cleanup();
916
+ reject(error);
917
+ }
918
+ });
919
+ if (input.signal.aborted)
920
+ subscription.close();
921
+ })
922
+ };
923
+ };
924
+
846
925
  // src/client/resource-anchors.ts
847
926
  var createResourceAnchorsClient = (request) => ({
927
+ queryRelated: (projectId, input) => request(`/v1/projects/${encodeURIComponent(projectId)}/resource-anchors/related`, { method: "POST", body: input }),
848
928
  addAnchors: async (projectId, resource, anchors) => {
849
929
  await request(`/v1/projects/${encodeURIComponent(projectId)}/resource-anchors/add`, {
850
930
  method: "POST",
@@ -1095,6 +1175,7 @@ var encodeQuery = (input) => {
1095
1175
  if (input.status !== undefined)
1096
1176
  params.set("status", input.status.join(","));
1097
1177
  for (const key of [
1178
+ "search",
1098
1179
  "agent",
1099
1180
  "workspaceId",
1100
1181
  "createdFrom",
@@ -1103,6 +1184,7 @@ var encodeQuery = (input) => {
1103
1184
  "cursor",
1104
1185
  "limit",
1105
1186
  "includeArchived",
1187
+ "includeWorkspaceAnchors",
1106
1188
  "orderBy"
1107
1189
  ]) {
1108
1190
  if (input[key] !== undefined)
@@ -1846,7 +1928,7 @@ var createTextTransportClient = (request, transport) => ({
1846
1928
  });
1847
1929
 
1848
1930
  // src/client/workspace-diff-stream.ts
1849
- var watchWorkspaceDiff = (transport, workspaceId, input) => new Promise((resolve, reject) => {
1931
+ var watchWorkspaceChanges = (transport, workspaceId, input, kind) => new Promise((resolve, reject) => {
1850
1932
  if (input.signal.aborted)
1851
1933
  return resolve();
1852
1934
  let subscription;
@@ -1864,16 +1946,16 @@ var watchWorkspaceDiff = (transport, workspaceId, input) => new Promise((resolve
1864
1946
  };
1865
1947
  const aborted = () => finish();
1866
1948
  input.signal.addEventListener("abort", aborted, { once: true });
1867
- subscription = transport.subscribe({ workspace_diff: { project_id: input.projectId, workspace_id: workspaceId } }, {
1949
+ subscription = transport.subscribe(kind === "diff" ? { workspace_diff: { project_id: input.projectId, workspace_id: workspaceId } } : { workspace_files: { project_id: input.projectId, workspace_id: workspaceId } }, {
1868
1950
  onEvent(event) {
1869
1951
  if (settled || input.signal.aborted)
1870
1952
  return;
1871
1953
  try {
1872
1954
  if (event === "end")
1873
1955
  finish();
1874
- else if (event === "diff_ready")
1956
+ else if (event === `${kind}_ready`)
1875
1957
  input.onReady();
1876
- else if (event === "diff_changed")
1958
+ else if (event === `${kind}_changed`)
1877
1959
  input.onChange();
1878
1960
  } catch (error) {
1879
1961
  finish({ error });
@@ -1884,6 +1966,8 @@ var watchWorkspaceDiff = (transport, workspaceId, input) => new Promise((resolve
1884
1966
  if (settled)
1885
1967
  subscription.close();
1886
1968
  });
1969
+ var watchWorkspaceDiff = (transport, workspaceId, input) => watchWorkspaceChanges(transport, workspaceId, input, "diff");
1970
+ var watchWorkspaceFiles = (transport, workspaceId, input) => watchWorkspaceChanges(transport, workspaceId, input, "files");
1887
1971
 
1888
1972
  // src/client/workspace-diffs.ts
1889
1973
  var createWorkspaceDiffClient = (request) => {
@@ -1912,6 +1996,7 @@ var createWorkspaceDiffClient = (request) => {
1912
1996
  // src/client/workspaces.ts
1913
1997
  var createWorkspaceClient = (request, streams) => ({
1914
1998
  watchDiff: (id, input) => watchWorkspaceDiff(streams, id, input),
1999
+ watchFiles: (id, input) => watchWorkspaceFiles(streams, id, input),
1915
2000
  ...createWorkspaceDiffClient(request),
1916
2001
  resolveEntry: (workspaceId, path) => request(`/v1/workspaces/${encodeURIComponent(workspaceId)}/entry?${new URLSearchParams({ path })}`),
1917
2002
  getCapacity: () => request("/v1/workspaces/capacity"),
@@ -1984,7 +2069,12 @@ var createWorkspaceClient = (request, streams) => ({
1984
2069
  const query = params.toString();
1985
2070
  return request(`/v1/workspaces/${workspaceId}/activity${query ? `?${query}` : ""}`);
1986
2071
  },
1987
- query: (projectId, input) => request(`/v1/projects/${encodeURIComponent(projectId)}/workspaces${pageQuery(input)}`),
2072
+ query: (projectId, input) => {
2073
+ const query = new URLSearchParams(pageQuery(input).replace(/^\?/, ""));
2074
+ if (input?.anchors !== undefined)
2075
+ query.set("anchors", JSON.stringify(input.anchors));
2076
+ return request(`/v1/projects/${encodeURIComponent(projectId)}/workspaces?${query}`);
2077
+ },
1988
2078
  list: (projectId) => request(`/v1/workspaces?projectId=${encodeURIComponent(projectId)}`),
1989
2079
  getByShorthand: (projectId, shorthand) => request(`/v1/workspaces/by-shorthand?projectId=${encodeURIComponent(projectId)}&shorthand=${encodeURIComponent(shorthand)}`),
1990
2080
  create: (projectOrInput, input) => request("/v1/workspaces", {
@@ -2005,6 +2095,7 @@ var createClient = (options = {}) => {
2005
2095
  return {
2006
2096
  account: createAccountClient(request),
2007
2097
  assets: createAssetsClient(request),
2098
+ activity: createResourceActivityClient(request, streams),
2008
2099
  resources: createResourceAnchorsClient(request),
2009
2100
  views: createBoardViewsClient(request),
2010
2101
  projects: createProjectClient(request),
package/dist/client.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { $m as HarnessAuthenticationPrompt, Ch as DeviceLogin, Qm as HarnessAuthenticationInput, Sh as AccountStatus, Xm as HarnessAuthentication, dh as ProjectSyncState, fh as ProjectSyncStatus, lh as ProjectSyncFile, t as TextEditingConnectionInput, th as HarnessAuthenticationQuestion, uh as ProjectSyncSource, yh as AccountDevice } from "./index-BAGJA9cS.js";
2
- import { A as NativeDocumentsClient, B as AssetUploadInput, C as RuntimeClient, D as NotificationsClient, E as ProjectClient, F as ExtensionClient, G as ClientOptions, H as AgentClient, I as CommandStreamClientEvent, J as RequestFn, K as PstdioApiError, L as BoardViewsClient, M as DirectoryEntry, N as FilesystemClient, O as NativeDocumentJoined, P as FilesystemDrive, R as AutomationClient, S as SseEvent, T as ResourceAnchorsClient, U as AgentAuthenticationOptions, V as AssetsClient, W as AccountClient, X as createRequest, Y as RequestOptions, _ as SettingsClient, a as WorkspaceClient, b as SessionStreamConnection, c as StartSyncInput, d as SyncRow, f as SyncWriter, g as SkillClient, h as parseSyncDeleteEvent, i as createClient, j as LinkIconsClient, k as NativeDocumentSnapshot, l as SyncClient, m as applySyncEvent, n as AssetTransfer, o as TextEditingConnection, p as SyncWriterProvider, q as PstdioConnectionError, r as PstdioClient, s as TextEditingTransportClient, t as AssetReference, u as SyncConnection, v as ListSessionsInput, w as createRuntimeClient, x as SessionStreamHandlers, y as SessionClient, z as AssetClientOwner } from "./index-C2HKbxKz.js";
1
+ import { Gm as HarnessAuthentication, Jh as ProjectSyncSource, Jm as HarnessAuthenticationPrompt, Xh as ProjectSyncStatus, Xm as HarnessAuthenticationQuestion, Yh as ProjectSyncState, og as AccountStatus, qh as ProjectSyncFile, qm as HarnessAuthenticationInput, rg as AccountDevice, sg as DeviceLogin, t as TextEditingConnectionInput } from "./index-CEtXTtY_.js";
2
+ import { A as NativeDocumentsClient, B as AssetUploadInput, C as RuntimeClient, D as NotificationsClient, E as ProjectClient, F as ExtensionClient, G as ClientOptions, H as AgentClient, I as CommandStreamClientEvent, J as RequestFn, K as PstdioApiError, L as BoardViewsClient, M as DirectoryEntry, N as FilesystemClient, O as NativeDocumentJoined, P as FilesystemDrive, R as AutomationClient, S as SseEvent, T as ResourceAnchorsClient, U as AgentAuthenticationOptions, V as AssetsClient, W as AccountClient, X as createRequest, Y as RequestOptions, _ as SettingsClient, a as WorkspaceClient, b as SessionStreamConnection, c as StartSyncInput, d as SyncRow, f as SyncWriter, g as SkillClient, h as parseSyncDeleteEvent, i as createClient, j as LinkIconsClient, k as NativeDocumentSnapshot, l as SyncClient, m as applySyncEvent, n as AssetTransfer, o as TextEditingConnection, p as SyncWriterProvider, q as PstdioConnectionError, r as PstdioClient, s as TextEditingTransportClient, t as AssetReference, u as SyncConnection, v as ListSessionsInput, w as createRuntimeClient, x as SessionStreamHandlers, y as SessionClient, z as AssetClientOwner } from "./index-DYf2KSDY.js";
3
3
  export { type AccountClient, type AccountDevice, type AccountStatus, type AgentAuthenticationOptions, type AgentClient, type AssetClientOwner, type AssetReference, type AssetTransfer, type AssetUploadInput, type AssetsClient, type AutomationClient, type BoardViewsClient, type ClientOptions, type CommandStreamClientEvent, type DeviceLogin, type DirectoryEntry, type ExtensionClient, type FilesystemClient, type FilesystemDrive, type HarnessAuthentication, type HarnessAuthenticationInput, type HarnessAuthenticationPrompt, type HarnessAuthenticationQuestion, type LinkIconsClient, type ListSessionsInput, type NativeDocumentJoined, type NativeDocumentSnapshot, type NativeDocumentsClient, type NotificationsClient, type ProjectClient, type ProjectSyncFile, type ProjectSyncSource, type ProjectSyncState, type ProjectSyncStatus, 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 TextEditingConnection, type TextEditingConnectionInput, type TextEditingTransportClient, type WorkspaceClient, applySyncEvent, createClient, createRequest, createRuntimeClient, parseSyncDeleteEvent };
4
4
  export {};
@@ -1,3 +1,85 @@
1
+ import {
2
+ canonicalJson
3
+ } from "../index-z55j8gx2.js";
4
+ import {
5
+ DEFAULT_COLLECTION_PAGE_SIZE2
6
+ } from "../index-e3fywmkh.js";
7
+
8
+ // src/data/collection-page.ts
9
+ var together = (...predicates) => {
10
+ const all = predicates.filter((predicate) => predicate !== undefined);
11
+ return all.length ? { all } : undefined;
12
+ };
13
+ var readCollectionPage = async (storage, selection) => {
14
+ const { index, fields, orderBy, where, search, visible, groups = [], page } = selection;
15
+ if (page?.search && !search)
16
+ throw new Error("A nonempty search needs an indexed search predicate");
17
+ if (page?.collapsedGroups?.length && !visible)
18
+ throw new Error("Collapsed groups need an indexed collapsed-group predicate");
19
+ if (groups.length > 2 || new Set(groups.map((group) => group.field)).size !== groups.length)
20
+ throw new Error("Collection pages support at most two different grouping fields");
21
+ const total = await storage.records.aggregate({ index, where });
22
+ const revision = total.revision;
23
+ const sameRevision = (actual) => {
24
+ if (actual !== revision)
25
+ throw new Error("Collection query revision is stale; restart the query");
26
+ };
27
+ if (page?.revision !== undefined)
28
+ sameRevision(page.revision);
29
+ const filtered = search || groups.length ? await storage.records.aggregate({
30
+ index,
31
+ where: together(where, search),
32
+ ...groups.length ? { groupBy: groups.map((group) => group.indexField), groupLimit: 500 } : {}
33
+ }) : total;
34
+ sameRevision(filtered.revision);
35
+ const counts = visible ? await storage.records.aggregate({ index, where: together(where, search, visible) }) : filtered;
36
+ sameRevision(counts.revision);
37
+ const selected = await storage.records.query({
38
+ index,
39
+ where: together(where, search, visible),
40
+ fields,
41
+ orderBy,
42
+ limit: page?.limit ?? DEFAULT_COLLECTION_PAGE_SIZE2,
43
+ cursor: page?.cursor,
44
+ offset: page?.cursor ? undefined : page?.offset,
45
+ revision
46
+ });
47
+ sameRevision(selected.revision);
48
+ const groupCounts = [];
49
+ const parents = new Map;
50
+ for (const group of filtered.groups) {
51
+ const values = group.value;
52
+ const parent = { field: groups[0].field, value: values[0] };
53
+ const key = canonicalJson(parent.value);
54
+ const count = parents.get(key) ?? { ...parent, count: 0 };
55
+ count.count += group.count;
56
+ parents.set(key, count);
57
+ if (groups.length === 2)
58
+ groupCounts.push({
59
+ field: groups[1].field,
60
+ value: values[1],
61
+ count: group.count,
62
+ parent
63
+ });
64
+ }
65
+ const result = {
66
+ revision,
67
+ cursor: selected.cursor,
68
+ total: total.count,
69
+ filteredTotal: counts.count,
70
+ groups: [...parents.values(), ...groupCounts]
71
+ };
72
+ return { records: selected.records, page: result };
73
+ };
74
+ // src/data/collection-records.ts
75
+ var readCollectionRecords = async (storage, recordIds) => (await storage.records.readMany(recordIds)).map((record) => record.exists && !record.deleted ? record.value.value : undefined);
76
+ var patchCollectionRecords = (storage, selected, fields) => {
77
+ const set = Object.fromEntries(Object.entries(fields).map(([key, value]) => [`/value/${key.replaceAll("~", "~0").replaceAll("/", "~1")}`, value]));
78
+ return storage.records.commitIfCurrent({
79
+ operationId: storage.ids.create(),
80
+ edits: selected.map(({ recordId, revision }) => ({ recordId, expectedRevision: revision, set }))
81
+ });
82
+ };
1
83
  // src/data/draft-layout.ts
2
84
  var assertSafePathSegment = (value) => {
3
85
  if (!value || value === "." || value === ".." || /[/\\\0]/.test(value))
@@ -91,7 +173,10 @@ export {
91
173
  assertSafePathSegment,
92
174
  createDraftLayout,
93
175
  findClosingFrontmatterDelimiter,
176
+ patchCollectionRecords,
94
177
  quoteYamlScalar,
178
+ readCollectionPage,
179
+ readCollectionRecords,
95
180
  requireRepoFiles,
96
181
  resolveByIdOrName,
97
182
  sameName,
package/dist/data.d.ts CHANGED
@@ -1,4 +1,33 @@
1
- import { do as ArtifactMount } from "./index-BAGJA9cS.js";
1
+ import { Nv as StorageSaveOutcome, Sd as CollectionPage, Sm as ExtensionStorageApi, a_ as JsonObject, bv as StorageRecordQueries, gv as StoragePredicate, ho as ArtifactMount, vv as StorageQueryRecord, wd as CollectionPageRequest, xv as StorageRecordQuery } from "./index-CEtXTtY_.js";
2
+ interface CollectionPageSelection {
3
+ index: string;
4
+ /** The complete view filter, translated to declared index fields. */
5
+ where?: StoragePredicate;
6
+ /** Search is separate so total retains the count before search. */
7
+ search?: StoragePredicate;
8
+ /** Predicate excluding collapsed groups, applied before paging. */
9
+ visible?: StoragePredicate;
10
+ fields?: string[];
11
+ orderBy?: StorageRecordQuery["orderBy"];
12
+ groups?: {
13
+ field: string;
14
+ indexField: string;
15
+ }[];
16
+ page?: CollectionPageRequest;
17
+ }
18
+ /** Select only a bounded page of projections, with global counts from the same revision.
19
+ * Callers translate their view semantics to predicates; unsupported controls must fail before this call.
20
+ */
21
+ export declare const readCollectionPage: (storage: {
22
+ records: Pick<StorageRecordQueries, "query" | "aggregate">;
23
+ }, selection: CollectionPageSelection) => Promise<{
24
+ records: StorageQueryRecord[];
25
+ page: CollectionPage;
26
+ }>;
27
+ /** Read at most 100 collection rows selected by an index, preserving order and missing rows. */
28
+ export declare const readCollectionRecords: <T>(storage: Pick<ExtensionStorageApi, "records">, recordIds: string[]) => Promise<(T | undefined)[]>;
29
+ /** Patch selected collection fields in one bounded save. Null means the selected revisions changed; query again. */
30
+ export declare const patchCollectionRecords: (storage: Pick<ExtensionStorageApi, "records" | "ids">, selected: StorageQueryRecord[], fields: JsonObject) => Promise<StorageSaveOutcome | null>;
2
31
  export declare const assertSafePathSegment: (value: string) => void;
3
32
  /** @deprecated Use the named file handle from the extension file API (PRD 0009). Removed in 0.45 after Planner and Reports adopt that API. */
4
33
  export declare const requireRepoFiles: (projectFiles: ArtifactMount | undefined) => ArtifactMount;
@@ -19,4 +48,5 @@ export declare const sameName: (a: string, b: string) => boolean;
19
48
  export declare const resolveByIdOrName: <TItem extends {
20
49
  id: string;
21
50
  }>(items: TItem[], value: string, nameOf: (item: TItem) => string, label: string) => string;
51
+ export type { CollectionPageSelection };
22
52
  export {};