@arbidocs/sdk 0.5.129 → 0.5.130

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/index.cjs CHANGED
@@ -6365,6 +6365,7 @@ __export(documents_exports, {
6365
6365
  listVersions: () => listVersions,
6366
6366
  mimeFromName: () => mimeFromName,
6367
6367
  presignedPut: () => presignedPut,
6368
+ restoreVersion: () => restoreVersion,
6368
6369
  sanitizeFolderPath: () => sanitizeFolderPath,
6369
6370
  similarDocuments: () => similarDocuments,
6370
6371
  updateDocuments: () => updateDocuments,
@@ -6534,6 +6535,19 @@ async function listVersions(arbi, docId) {
6534
6535
  "Failed to fetch document versions"
6535
6536
  );
6536
6537
  }
6538
+ async function restoreVersion(arbi, docId, version, expectedCurrentVersion, workspaceExtId, signal) {
6539
+ const query2 = {
6540
+ expected_current_version: expectedCurrentVersion,
6541
+ workspace_ext_id: workspaceExtId
6542
+ };
6543
+ return requireData(
6544
+ await arbi.fetch.POST("/v1/document/{document_ext_id}/versions/{n}/restore", {
6545
+ params: { path: { document_ext_id: docId, n: version }, query: query2 },
6546
+ signal
6547
+ }),
6548
+ "Failed to restore document version"
6549
+ );
6550
+ }
6537
6551
  async function finaliseTranslation(arbi, docId) {
6538
6552
  return requireData(
6539
6553
  await arbi.fetch.POST("/v1/document/{document_ext_id}/finalise-translation", {
@@ -7099,6 +7113,62 @@ async function unlockModelConnections(arbi, keys, onlyId) {
7099
7113
  }
7100
7114
  }
7101
7115
 
7116
+ // src/operations/workspace-assistant.ts
7117
+ var workspace_assistant_exports = {};
7118
+ __export(workspace_assistant_exports, {
7119
+ getBrief: () => getBrief,
7120
+ getStatus: () => getStatus,
7121
+ listArrivals: () => listArrivals,
7122
+ markArrivalWrong: () => markArrivalWrong,
7123
+ markMessageDraftSent: () => markMessageDraftSent,
7124
+ updateBrief: () => updateBrief
7125
+ });
7126
+ var FAILED2 = "Could not update the workspace Assistant";
7127
+ async function getBrief(arbi, workspaceExtId) {
7128
+ return requireData(
7129
+ await arbi.fetch.GET("/v1/workspace-assistant/brief", {
7130
+ params: { query: { workspace_ext_id: workspaceExtId } }
7131
+ }),
7132
+ FAILED2
7133
+ );
7134
+ }
7135
+ async function updateBrief(arbi, body) {
7136
+ return requireData(await arbi.fetch.PUT("/v1/workspace-assistant/brief", { body }), FAILED2);
7137
+ }
7138
+ async function listArrivals(arbi, workspaceExtId, limit = 50) {
7139
+ return requireData(
7140
+ await arbi.fetch.GET("/v1/workspace-assistant/arrivals", {
7141
+ params: { query: { workspace_ext_id: workspaceExtId, limit } }
7142
+ }),
7143
+ FAILED2
7144
+ );
7145
+ }
7146
+ async function markArrivalWrong(arbi, arrivalExtId) {
7147
+ return requireData(
7148
+ await arbi.fetch.POST("/v1/workspace-assistant/arrivals/{arrival_ext_id}/wrong", {
7149
+ params: { path: { arrival_ext_id: arrivalExtId } }
7150
+ }),
7151
+ FAILED2
7152
+ );
7153
+ }
7154
+ async function markMessageDraftSent(arbi, arrivalExtId, index) {
7155
+ requireOk(
7156
+ await arbi.fetch.POST(
7157
+ "/v1/workspace-assistant/arrivals/{arrival_ext_id}/message-drafts/{index}/sent",
7158
+ { params: { path: { arrival_ext_id: arrivalExtId, index } } }
7159
+ ),
7160
+ FAILED2
7161
+ );
7162
+ }
7163
+ async function getStatus(arbi, workspaceExtId) {
7164
+ return requireData(
7165
+ await arbi.fetch.GET("/v1/workspace-assistant/status", {
7166
+ params: { query: { workspace_ext_id: workspaceExtId } }
7167
+ }),
7168
+ FAILED2
7169
+ );
7170
+ }
7171
+
7102
7172
  // src/operations/secure-mail.ts
7103
7173
  var secure_mail_exports = {};
7104
7174
  __export(secure_mail_exports, {
@@ -9272,7 +9342,7 @@ async function requestDeletion(arbi) {
9272
9342
  var identity_exports = {};
9273
9343
  __export(identity_exports, {
9274
9344
  acceptName: () => acceptName,
9275
- getStatus: () => getStatus,
9345
+ getStatus: () => getStatus2,
9276
9346
  identityErrorCode: () => identityErrorCode,
9277
9347
  purchase: () => purchase,
9278
9348
  refresh: () => refresh,
@@ -9304,7 +9374,7 @@ function unwrap(result, fallback) {
9304
9374
  }
9305
9375
  return result.data;
9306
9376
  }
9307
- async function getStatus(arbi) {
9377
+ async function getStatus2(arbi) {
9308
9378
  return unwrap(await arbi.fetch.GET("/v1/user/identity"), "Failed to load identity verification");
9309
9379
  }
9310
9380
  async function purchase(arbi, projectExtId) {
@@ -12821,7 +12891,7 @@ var Arbi = class {
12821
12891
  // ── Identity verification ─────────────────────────────────────────────
12822
12892
  identity = {
12823
12893
  /** Whether the ID check is offered (Pro plans), its price, and where the user's check stands. */
12824
- status: () => getStatus(this.requireClient()),
12894
+ status: () => getStatus2(this.requireClient()),
12825
12895
  /** Charge the one-time fee to an own Pro project; `requires_action` carries a payment URL. */
12826
12896
  purchase: (projectExtId) => purchase(this.requireClient(), projectExtId),
12827
12897
  /** The Didit session URL to run the web SDK on. */
@@ -12835,7 +12905,7 @@ var Arbi = class {
12835
12905
  /** Take the name on the document as the account name; the profile follows. */
12836
12906
  acceptName: async () => {
12837
12907
  const client = this.requireClient();
12838
- const offered = await getStatus(client);
12908
+ const offered = await getStatus2(client);
12839
12909
  const status = await acceptName(client);
12840
12910
  if (this.userProfile && offered.document_given_name) {
12841
12911
  this.setUserProfile({
@@ -13063,6 +13133,25 @@ var Arbi = class {
13063
13133
  get: (externalIds) => getDocuments(this.requireClient(), externalIds),
13064
13134
  /** Every version of a document, oldest first; `is_current` marks the current one. */
13065
13135
  versions: (docId) => listVersions(this.requireClient(), docId),
13136
+ /** Restore an earlier snapshot as a new version, retaining history and rejecting concurrent edits. */
13137
+ restoreVersion: (docId, version, expectedCurrentVersion) => {
13138
+ const workspaceExtId = this.requireWorkspace();
13139
+ const signal = this.requireClient().auth.sessionSignal();
13140
+ return this.recovering(() => {
13141
+ signal.throwIfAborted();
13142
+ if (this.currentWorkspaceId !== workspaceExtId) {
13143
+ throw new ArbiWorkspaceChangedError(workspaceExtId, "restoring a document in");
13144
+ }
13145
+ return restoreVersion(
13146
+ this.requireClient(),
13147
+ docId,
13148
+ version,
13149
+ expectedCurrentVersion,
13150
+ workspaceExtId,
13151
+ signal
13152
+ );
13153
+ });
13154
+ },
13066
13155
  /** Save a translation's current version as a new PDF document linked to its original. */
13067
13156
  finaliseTranslation: (docId) => finaliseTranslation(this.requireClient(), docId),
13068
13157
  delete: (externalIds) => deleteDocuments(this.requireClient(), externalIds),
@@ -14437,6 +14526,17 @@ var Arbi = class {
14437
14526
  /** The documents the open workspace may use as its house template. */
14438
14527
  candidates: () => listHouseTemplateCandidates(this.requireClient())
14439
14528
  };
14529
+ // ── Workspace Assistant ─────────────────────────────────────────────
14530
+ /** The workspace's standing instructions for its Assistant, and what it did with each arrival. */
14531
+ workspaceAssistant = {
14532
+ brief: (workspaceExtId) => getBrief(this.requireClient(), workspaceExtId),
14533
+ updateBrief: (body) => updateBrief(this.requireClient(), body),
14534
+ arrivals: (workspaceExtId, limit) => listArrivals(this.requireClient(), workspaceExtId, limit),
14535
+ status: (workspaceExtId) => getStatus(this.requireClient(), workspaceExtId),
14536
+ markWrong: (arrivalExtId) => markArrivalWrong(this.requireClient(), arrivalExtId),
14537
+ /** Record that a message the Assistant drafted was sent, so it is not offered again. */
14538
+ markMessageSent: (arrivalExtId, index) => markMessageDraftSent(this.requireClient(), arrivalExtId, index)
14539
+ };
14440
14540
  // ── Model connections ───────────────────────────────────────────────
14441
14541
  /**
14442
14542
  * The main agent's OpenAI-compatible endpoints: the box's and the user's own. A personal key is
@@ -16565,6 +16665,7 @@ exports.usdToGbp = usdToGbp;
16565
16665
  exports.work = work_exports;
16566
16666
  exports.workflowSteps = workflow_steps_exports;
16567
16667
  exports.workflows = workflows_exports;
16668
+ exports.workspaceAssistant = workspace_assistant_exports;
16568
16669
  exports.workspaceConflictOf = workspaceConflictOf;
16569
16670
  exports.workspaces = workspaces_exports;
16570
16671
  exports.wouldCreateTagCycle = wouldCreateTagCycle;