@arbidocs/sdk 0.5.60 → 0.5.62

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/browser.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createArbiClient, base64ToBytes, unwrapWorkspaceKey, sealKeyForSession, buildWebSocketUrl, createAuthMessage, parseServerMessage, isMessageType, createContentHash, encryptFile, initSodium, encryptionKeypairFromSigningKey, sealedBoxDecrypt, bytesToBase64, encryptWithChatKey, decryptWithChatKey, decryptFile, deriveDirectChatKey, openSealedChatKey, generateChatKey, sealChatKey, sealCallKey, encryptMessage, decodeSecureMailKey, openSecureMail, secureMailClaim, createSessionManager, authRequestError, changePassword, openCallKeyOf, decryptCallTitle, generateCallKey, encryptCallTitle, sealCallKeyForPeers, openSealedCallKey, readSessionClaims, isAbortError } from '@arbidocs/client';
1
+ import { createArbiClient, base64ToBytes, unwrapWorkspaceKey, sealKeyForSession, buildWebSocketUrl, createAuthMessage, parseServerMessage, isMessageType, createContentHash, encryptFile, initSodium, encryptionKeypairFromSigningKey, sealedBoxDecrypt, bytesToBase64, encryptWithChatKey, decryptWithChatKey, decryptFile, deriveDirectChatKey, openSealedChatKey, generateChatKey, sealChatKey, sealCallKey, encryptMessage, decodeSecureMailKey, openSecureMail, secureMailClaim, createSessionManager, authRequestError, isAbortError, changePassword, openCallKeyOf, decryptCallTitle, generateCallKey, encryptCallTitle, sealCallKeyForPeers, openSealedCallKey, readSessionClaims } from '@arbidocs/client';
2
2
 
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -3511,6 +3511,22 @@ var ArbiWorkspaceChangedError = class extends ArbiError {
3511
3511
  }
3512
3512
  workspaceId;
3513
3513
  };
3514
+ var ArbiWorkspaceUnavailableError = class extends ArbiError {
3515
+ constructor(workspaceId, cause, message = `Workspace ${workspaceId} can't be opened in this session, so nothing was sent`) {
3516
+ super(message, { code: "WORKSPACE_UNAVAILABLE", cause });
3517
+ this.workspaceId = workspaceId;
3518
+ this.name = "ArbiWorkspaceUnavailableError";
3519
+ }
3520
+ workspaceId;
3521
+ };
3522
+ function workspaceConflictOf(error) {
3523
+ const body = error instanceof ArbiApiError ? error.apiError : error instanceof Error ? void 0 : error;
3524
+ const detail = errorRecord(errorRecord(body)?.detail);
3525
+ const code = detail?.code;
3526
+ const workspaceId = detail?.workspace_ext_id;
3527
+ if (code !== "workspace_key_required" && code !== "workspace_mismatch") return null;
3528
+ return typeof workspaceId === "string" && workspaceId ? { code, workspaceId } : null;
3529
+ }
3514
3530
  function detailText(detail) {
3515
3531
  if (typeof detail === "string") return detail || void 0;
3516
3532
  if (Array.isArray(detail)) {
@@ -3648,6 +3664,19 @@ function getDeepestCause(err) {
3648
3664
  }
3649
3665
  return current;
3650
3666
  }
3667
+ function getErrorCode(err) {
3668
+ if (!(err instanceof Error)) return void 0;
3669
+ let current = err;
3670
+ const seen = /* @__PURE__ */ new Set();
3671
+ while (current && !seen.has(current)) {
3672
+ seen.add(current);
3673
+ const code = current.code;
3674
+ if (typeof code === "string" && !(current instanceof ArbiTransportError && current.cause instanceof Error))
3675
+ return code;
3676
+ current = current.cause instanceof Error ? current.cause : void 0;
3677
+ }
3678
+ return void 0;
3679
+ }
3651
3680
 
3652
3681
  // src/fetch.ts
3653
3682
  var STATUS_FALLBACKS = {
@@ -4607,6 +4636,228 @@ function buildChunkLookup(tools) {
4607
4636
  return lookup;
4608
4637
  }
4609
4638
 
4639
+ // src/operations/responses.ts
4640
+ var responses_exports = {};
4641
+ __export(responses_exports, {
4642
+ extractResponseText: () => extractResponseText,
4643
+ getResponse: () => getResponse,
4644
+ submitBackgroundQuery: () => submitBackgroundQuery
4645
+ });
4646
+ async function submitBackgroundQuery(options) {
4647
+ const {
4648
+ workspaceId,
4649
+ question,
4650
+ docIds,
4651
+ previousResponseId,
4652
+ model,
4653
+ text: text2,
4654
+ task,
4655
+ conversationId,
4656
+ mentions,
4657
+ activeArtifactExtId,
4658
+ fullContext = true,
4659
+ ...auth
4660
+ } = options;
4661
+ const tools = {};
4662
+ if (docIds.length > 0) {
4663
+ tools.retrieval_chunk = {
4664
+ name: "retrieval_chunk",
4665
+ description: "retrieval chunk",
4666
+ tool_args: { doc_ext_ids: docIds },
4667
+ tool_responses: {}
4668
+ };
4669
+ if (fullContext)
4670
+ tools.retrieval_full_context = {
4671
+ name: "retrieval_full_context",
4672
+ description: "retrieval full context",
4673
+ tool_args: { doc_ext_ids: docIds },
4674
+ tool_responses: {}
4675
+ };
4676
+ }
4677
+ const body = {
4678
+ input: question,
4679
+ workspace_ext_id: workspaceId,
4680
+ stream: false,
4681
+ background: true,
4682
+ store: true,
4683
+ tools,
4684
+ ...task !== void 0 ? { task } : {},
4685
+ ...conversationId ? { conversation_ext_id: conversationId } : {},
4686
+ ...mentions !== void 0 ? { mentions } : {},
4687
+ ...activeArtifactExtId ? { active_artifact_ext_id: activeArtifactExtId } : {},
4688
+ ...previousResponseId ? { previous_response_id: previousResponseId } : {},
4689
+ ...model ? { model } : {},
4690
+ ...text2 ? { text: text2 } : {}
4691
+ };
4692
+ const res = await authenticatedFetch({
4693
+ ...auth,
4694
+ path: "/v1/responses",
4695
+ method: "POST",
4696
+ body: JSON.stringify(body),
4697
+ headers: { "Content-Type": "application/json" }
4698
+ });
4699
+ return await res.json();
4700
+ }
4701
+ async function getResponse(auth, responseId) {
4702
+ const res = await authenticatedFetch({
4703
+ ...auth,
4704
+ path: `/v1/responses/${responseId}`,
4705
+ method: "GET"
4706
+ });
4707
+ return await res.json();
4708
+ }
4709
+ function extractResponseText(response) {
4710
+ const parts = [];
4711
+ for (const msg of Array.isArray(response.output) ? response.output : []) {
4712
+ if (msg.type !== "message" || !Array.isArray(msg.content)) continue;
4713
+ for (const item of msg.content) {
4714
+ if (item?.type === "output_text" && typeof item.text === "string") parts.push(item.text);
4715
+ }
4716
+ }
4717
+ return parts.join("");
4718
+ }
4719
+
4720
+ // src/responses-resource.ts
4721
+ function withOutputText(response, requestId) {
4722
+ return {
4723
+ ...response,
4724
+ output_text: extractResponseText(response),
4725
+ ...requestId ? { _request_id: requestId } : {}
4726
+ };
4727
+ }
4728
+ var ResponseStream = class {
4729
+ constructor(handle) {
4730
+ this.handle = handle;
4731
+ }
4732
+ handle;
4733
+ async *[Symbol.asyncIterator]() {
4734
+ try {
4735
+ for await (const frame of this.handle.events()) {
4736
+ const data = frame.data && typeof frame.data === "object" && !Array.isArray(frame.data) ? frame.data : { data: frame.data };
4737
+ yield {
4738
+ ...data,
4739
+ type: typeof data.type === "string" ? data.type : frame.event
4740
+ };
4741
+ }
4742
+ const outcome = await this.handle.outcome;
4743
+ if (outcome.status === "disconnected")
4744
+ throw outcome.error ?? new ArbiTransportError(new Error("The response stream disconnected."), this.handle.id);
4745
+ } finally {
4746
+ this.handle.detach();
4747
+ }
4748
+ }
4749
+ };
4750
+
4751
+ // src/structured-output.ts
4752
+ var ArbiStructuredOutputError = class extends ArbiError {
4753
+ constructor(message, response, options) {
4754
+ const id = response && typeof response === "object" && "id" in response && typeof response.id === "string" ? response.id : void 0;
4755
+ super(message, { responseId: id, ...options });
4756
+ this.response = response;
4757
+ this.name = "ArbiStructuredOutputError";
4758
+ }
4759
+ response;
4760
+ };
4761
+ function localReferences(value) {
4762
+ if (Array.isArray(value)) {
4763
+ value.forEach(localReferences);
4764
+ return;
4765
+ }
4766
+ if (!value || typeof value !== "object") return;
4767
+ for (const [key, child] of Object.entries(value)) {
4768
+ if ((key === "$ref" || key === "$dynamicRef") && (typeof child !== "string" || !child.startsWith("#")))
4769
+ throw new Error("Only local schema references are supported.");
4770
+ if (!["enum", "const", "default", "examples"].includes(key)) localReferences(child);
4771
+ }
4772
+ }
4773
+ async function createStructuredParser(format) {
4774
+ let validate;
4775
+ let Constructor;
4776
+ try {
4777
+ Constructor = (await import('ajv/dist/2020.js')).default;
4778
+ } catch (cause) {
4779
+ throw new ArbiStructuredOutputError(
4780
+ "The JSON Schema validator could not be loaded.",
4781
+ void 0,
4782
+ { code: "STRUCTURED_OUTPUT_VALIDATOR_UNAVAILABLE", cause }
4783
+ );
4784
+ }
4785
+ try {
4786
+ if (format.type !== "json_schema" || typeof format.name !== "string" || !/^[a-zA-Z0-9_-]{1,64}$/.test(format.name) || !format.schema || typeof format.schema !== "object" || Array.isArray(format.schema))
4787
+ throw new Error("Invalid structured output format.");
4788
+ if (format.schema.$schema !== void 0 && format.schema.$schema !== "https://json-schema.org/draft/2020-12/schema")
4789
+ throw new Error("Expected JSON Schema draft 2020-12.");
4790
+ localReferences(format.schema);
4791
+ validate = new Constructor({
4792
+ strict: false,
4793
+ logger: false,
4794
+ validateFormats: false,
4795
+ strictNumbers: true,
4796
+ addUsedSchema: false
4797
+ }).compile(format.schema);
4798
+ } catch (cause) {
4799
+ const unavailable = cause instanceof EvalError;
4800
+ throw new ArbiStructuredOutputError(
4801
+ unavailable ? "This runtime cannot compile JSON Schema validators." : "Invalid or unsupported output schema.",
4802
+ void 0,
4803
+ {
4804
+ code: unavailable ? "STRUCTURED_OUTPUT_VALIDATOR_UNAVAILABLE" : "STRUCTURED_OUTPUT_SCHEMA_INVALID",
4805
+ cause
4806
+ }
4807
+ );
4808
+ }
4809
+ return (response, options = {}) => {
4810
+ const fail = (code, message, cause) => {
4811
+ throw new ArbiStructuredOutputError(message, response, { ...options, code, cause });
4812
+ };
4813
+ if (!response || typeof response !== "object")
4814
+ fail("RESPONSE_INVALID_ENVELOPE", "Expected a Responses JSON object.");
4815
+ if (response.status === "incomplete")
4816
+ fail("RESPONSE_INCOMPLETE", "The response is incomplete; no validated data is available.");
4817
+ if (response.status === "cancelled")
4818
+ fail("RESPONSE_CANCELLED", "The response was cancelled; no validated data is available.");
4819
+ if (response.status === "failed")
4820
+ fail(
4821
+ typeof response.error?.code === "string" ? response.error.code : "RESPONSE_FAILED",
4822
+ typeof response.error?.message === "string" ? response.error.message : "The response failed."
4823
+ );
4824
+ if (response.status !== "completed")
4825
+ fail(
4826
+ "RESPONSE_NOT_COMPLETED",
4827
+ "Wait for a completed response before parsing structured output."
4828
+ );
4829
+ const messages = Array.isArray(response.output) ? response.output.filter(
4830
+ (item) => item && typeof item === "object" && item.type === "message" && item.role === "assistant"
4831
+ ) : [];
4832
+ if (messages.some(
4833
+ (message) => !Array.isArray(message.content) || message.content.some((part) => !part || typeof part !== "object")
4834
+ ))
4835
+ fail("RESPONSE_INVALID_ENVELOPE", "Invalid assistant output content.");
4836
+ if (messages.some((message) => message.content.some((part) => part.type === "refusal")))
4837
+ fail("RESPONSE_REFUSED", "The model refused this response.");
4838
+ const answers = messages.map(
4839
+ (message) => message.content.filter((part) => part.type === "output_text" && typeof part.text === "string").map((part) => part.text).join("")
4840
+ ).filter((answer) => answer.length > 0);
4841
+ if (answers.length !== 1)
4842
+ fail(
4843
+ "STRUCTURED_OUTPUT_AMBIGUOUS",
4844
+ "Expected one final assistant output message; narrative and answer text are not joined."
4845
+ );
4846
+ let data;
4847
+ try {
4848
+ data = JSON.parse(answers[0]);
4849
+ } catch (cause) {
4850
+ fail("STRUCTURED_OUTPUT_INVALID_JSON", "The response is not valid JSON.", cause);
4851
+ }
4852
+ if (!validate(data))
4853
+ fail("STRUCTURED_OUTPUT_INVALID", "The response did not match the requested JSON schema.");
4854
+ return { data, response };
4855
+ };
4856
+ }
4857
+ async function parseStructuredResponse(response, format) {
4858
+ return (await createStructuredParser(format))(response);
4859
+ }
4860
+
4610
4861
  // src/response-handle.ts
4611
4862
  var object = (value) => value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
4612
4863
  var text = (value) => typeof value === "string" ? value : void 0;
@@ -4703,12 +4954,17 @@ function consumeResponse(response, controller, cancel, options = {}) {
4703
4954
  let acknowledgement;
4704
4955
  const listeners = /* @__PURE__ */ new Set();
4705
4956
  const queue = [];
4957
+ let capacityAvailable;
4958
+ const releaseCapacity = () => {
4959
+ capacityAvailable?.();
4960
+ capacityAvailable = void 0;
4961
+ };
4706
4962
  let claimed = false;
4707
4963
  let iteratorClosed = false;
4708
4964
  let iteratorError;
4709
4965
  let pending;
4710
4966
  const emit = (event) => {
4711
- if (!claimed || iteratorClosed) return;
4967
+ if (!claimed && !options.bufferEvents || iteratorClosed) return;
4712
4968
  if (pending) {
4713
4969
  pending.resolve({ value: immutable(event), done: false });
4714
4970
  pending = void 0;
@@ -4737,6 +4993,7 @@ function consumeResponse(response, controller, cancel, options = {}) {
4737
4993
  const finish = (value, detached = false) => {
4738
4994
  if (finished) return;
4739
4995
  finished = true;
4996
+ releaseCapacity();
4740
4997
  controller.signal.removeEventListener("abort", abort);
4741
4998
  options.cleanup?.();
4742
4999
  update({ connection: detached ? "detached" : "closed", outcome: immutable(value) });
@@ -4784,6 +5041,7 @@ function consumeResponse(response, controller, cancel, options = {}) {
4784
5041
  const close = () => {
4785
5042
  iteratorClosed = true;
4786
5043
  queue.length = 0;
5044
+ releaseCapacity();
4787
5045
  if (pending) {
4788
5046
  pending.resolve({ value: void 0, done: true });
4789
5047
  pending = void 0;
@@ -4795,7 +5053,11 @@ function consumeResponse(response, controller, cancel, options = {}) {
4795
5053
  },
4796
5054
  next() {
4797
5055
  if (iteratorError) return Promise.reject(iteratorError);
4798
- if (queue.length) return Promise.resolve({ value: queue.shift(), done: false });
5056
+ if (queue.length) {
5057
+ const value = queue.shift();
5058
+ releaseCapacity();
5059
+ return Promise.resolve({ value, done: false });
5060
+ }
4799
5061
  if (finished || iteratorClosed)
4800
5062
  return Promise.resolve({ value: void 0, done: true });
4801
5063
  if (pending)
@@ -4956,8 +5218,13 @@ function consumeResponse(response, controller, cancel, options = {}) {
4956
5218
  try {
4957
5219
  while (!finished) {
4958
5220
  const { value, done } = await reader.read();
4959
- for (const frame of frames.push(decoder.decode(value, { stream: !done }), done))
5221
+ for (const frame of frames.push(decoder.decode(value, { stream: !done }), done)) {
4960
5222
  process(frame);
5223
+ if (options.bufferEvents && bound && !finished && !iteratorClosed && queue.length >= 256)
5224
+ await new Promise((resolve) => {
5225
+ capacityAvailable = resolve;
5226
+ });
5227
+ }
4961
5228
  if (done) break;
4962
5229
  }
4963
5230
  if (!finished) {
@@ -5421,9 +5688,12 @@ async function uploadDocumentsDirect(arbi, workspaceKey, files, options) {
5421
5688
  folder: options?.folder ? sanitizeFolderPath(options.folder) : null,
5422
5689
  presign_expires_in: options?.presignExpiresIn ?? 3600
5423
5690
  };
5424
- const initResult = requireData(
5425
- await arbi.fetch.POST("/v1/document/upload-init", { body: initBody }),
5426
- "Failed to initialize direct upload"
5691
+ const guarded = options?.inWorkspace ?? ((send) => send());
5692
+ const initResult = await guarded(
5693
+ async () => requireData(
5694
+ await arbi.fetch.POST("/v1/document/upload-init", { body: initBody }),
5695
+ "Failed to initialize direct upload"
5696
+ )
5427
5697
  );
5428
5698
  const items = initResult.items ?? [];
5429
5699
  const bytesByName = /* @__PURE__ */ new Map();
@@ -5480,14 +5750,16 @@ async function uploadDocumentsDirect(arbi, workspaceKey, files, options) {
5480
5750
  if (toCommit.length === 0) {
5481
5751
  return { doc_ext_ids: [], skipped };
5482
5752
  }
5483
- const commitResult = requireData(
5484
- await arbi.fetch.POST("/v1/document/upload-commit", {
5485
- body: {
5486
- doc_ext_ids: toCommit,
5487
- tag_ext_id: options?.tagExtId ?? null
5488
- }
5489
- }),
5490
- "Failed to commit direct upload"
5753
+ const commitResult = await guarded(
5754
+ async () => requireData(
5755
+ await arbi.fetch.POST("/v1/document/upload-commit", {
5756
+ body: {
5757
+ doc_ext_ids: toCommit,
5758
+ tag_ext_id: options?.tagExtId ?? null
5759
+ }
5760
+ }),
5761
+ "Failed to commit direct upload"
5762
+ )
5491
5763
  );
5492
5764
  return {
5493
5765
  doc_ext_ids: commitResult.doc_ext_ids ?? [],
@@ -5982,6 +6254,7 @@ __export(assistant_exports, {
5982
6254
  AssistantTurnRefused: () => AssistantTurnRefused,
5983
6255
  MAX_RETRIEVE_DOC_IDS: () => MAX_RETRIEVE_DOC_IDS,
5984
6256
  SESSION_EXPIRED_MESSAGE: () => SESSION_EXPIRED_MESSAGE,
6257
+ WORKSPACE_CONFLICT_MESSAGES: () => WORKSPACE_CONFLICT_MESSAGES,
5985
6258
  cancelRun: () => cancelRun,
5986
6259
  filterSkills: () => filterSkills,
5987
6260
  interject: () => interject,
@@ -6084,6 +6357,7 @@ function buildTurnRequest(request) {
6084
6357
  ...request.previousResponseId ? { previous_response_id: request.previousResponseId } : {},
6085
6358
  ...request.conversationId ? { conversation_ext_id: request.conversationId } : {},
6086
6359
  ...request.model && !pa2 ? { model: request.model } : {},
6360
+ ...request.text ? { text: request.text } : {},
6087
6361
  ...activeArtifactExtId ? { active_artifact_ext_id: activeArtifactExtId } : {},
6088
6362
  ...request.bindDocumentId && !request.previousResponseId && !pa2 ? { bound_document_ext_id: request.bindDocumentId } : {},
6089
6363
  ...request.mentions && request.mentions.length > 0 ? { mentions: request.mentions } : {},
@@ -6214,11 +6488,29 @@ function quotaFromStreamError(error) {
6214
6488
  if (!Number.isFinite(spend) || !Number.isFinite(budget)) return null;
6215
6489
  return { spend, budget, projectExtId: match.groups.project ?? null };
6216
6490
  }
6491
+ var WORKSPACE_CONFLICT_MESSAGES = {
6492
+ workspace_mismatch: "This conversation belongs to another workspace, so the reply was not sent. Open that workspace to continue it.",
6493
+ workspace_key_required: "This chat's workspace isn't open in this session, so the message was not sent. Open the workspace and try again."
6494
+ };
6217
6495
  async function refusal(response) {
6218
6496
  const { status } = response;
6219
6497
  const parsed = await apiErrorFromResponse(response, `HTTP error! status: ${status}`);
6220
6498
  const detail = parsed.apiError?.detail;
6221
6499
  const quota = status === 402 ? quotaExceededFrom(detail) : null;
6500
+ const conflict = status === 409 ? workspaceConflictOf(parsed.apiError) : null;
6501
+ if (conflict) {
6502
+ return new AssistantTurnRefused(
6503
+ WORKSPACE_CONFLICT_MESSAGES[conflict.code],
6504
+ status,
6505
+ null,
6506
+ parsed.apiError,
6507
+ {
6508
+ code: conflict.code,
6509
+ requestId: parsed.requestId,
6510
+ responseId: parsed.responseId
6511
+ }
6512
+ );
6513
+ }
6222
6514
  const fallback = status === 409 ? "This message has failed. Please retry from the previous message." : status === 503 ? "The selected LLM is not responding. Please retry again in a minute or select another model." : status === 402 ? "This project's AI usage for this month is used up." : parsed.message;
6223
6515
  return new AssistantTurnRefused(
6224
6516
  quota?.message || parsed.detail || fallback,
@@ -6357,86 +6649,6 @@ async function cancelRun(auth, responseId) {
6357
6649
  });
6358
6650
  }
6359
6651
 
6360
- // src/operations/responses.ts
6361
- var responses_exports = {};
6362
- __export(responses_exports, {
6363
- extractResponseText: () => extractResponseText,
6364
- getResponse: () => getResponse,
6365
- submitBackgroundQuery: () => submitBackgroundQuery
6366
- });
6367
- async function submitBackgroundQuery(options) {
6368
- const {
6369
- workspaceId,
6370
- question,
6371
- docIds,
6372
- previousResponseId,
6373
- model,
6374
- task,
6375
- conversationId,
6376
- mentions,
6377
- activeArtifactExtId,
6378
- fullContext = true,
6379
- ...auth
6380
- } = options;
6381
- const tools = {};
6382
- if (docIds.length > 0) {
6383
- tools.retrieval_chunk = {
6384
- name: "retrieval_chunk",
6385
- description: "retrieval chunk",
6386
- tool_args: { doc_ext_ids: docIds },
6387
- tool_responses: {}
6388
- };
6389
- if (fullContext)
6390
- tools.retrieval_full_context = {
6391
- name: "retrieval_full_context",
6392
- description: "retrieval full context",
6393
- tool_args: { doc_ext_ids: docIds },
6394
- tool_responses: {}
6395
- };
6396
- }
6397
- const body = {
6398
- input: question,
6399
- workspace_ext_id: workspaceId,
6400
- stream: false,
6401
- background: true,
6402
- store: true,
6403
- tools,
6404
- ...task !== void 0 ? { task } : {},
6405
- ...conversationId ? { conversation_ext_id: conversationId } : {},
6406
- ...mentions !== void 0 ? { mentions } : {},
6407
- ...activeArtifactExtId ? { active_artifact_ext_id: activeArtifactExtId } : {},
6408
- ...previousResponseId ? { previous_response_id: previousResponseId } : {},
6409
- ...model ? { model } : {}
6410
- };
6411
- const res = await authenticatedFetch({
6412
- ...auth,
6413
- path: "/v1/responses",
6414
- method: "POST",
6415
- body: JSON.stringify(body),
6416
- headers: { "Content-Type": "application/json" }
6417
- });
6418
- return await res.json();
6419
- }
6420
- async function getResponse(auth, responseId) {
6421
- const res = await authenticatedFetch({
6422
- ...auth,
6423
- path: `/v1/responses/${responseId}`,
6424
- method: "GET"
6425
- });
6426
- return await res.json();
6427
- }
6428
- function extractResponseText(response) {
6429
- const parts = [];
6430
- for (const msg of response.output) {
6431
- for (const item of msg.content) {
6432
- if ("type" in item && item.type === "output_text" && "text" in item) {
6433
- parts.push(item.text);
6434
- }
6435
- }
6436
- }
6437
- return parts.join("");
6438
- }
6439
-
6440
6652
  // src/operations/tags.ts
6441
6653
  var tags_exports = {};
6442
6654
  __export(tags_exports, {
@@ -10852,11 +11064,57 @@ var Arbi = class {
10852
11064
  * Make a workspace usable for requests that name it, WITHOUT changing the current workspace (on
10853
11065
  * the server or here): its key, sealed to this server session, is deposited with `/prime-key`
10854
11066
  * (the client's `workspaceKeys.prime`: once per server session). The current workspace is open.
11067
+ * A workspace the user holds no key for (a public one, or a temporary grant whose key the server
11068
+ * session already holds) has nothing to deposit: the server answers for it as it is.
10855
11069
  */
10856
- openWorkspace(workspaceId) {
10857
- if (workspaceId === this.currentWorkspaceId) return Promise.resolve();
11070
+ async openWorkspace(workspaceId) {
11071
+ if (workspaceId === this.currentWorkspaceId) return;
10858
11072
  this.requireLogin();
10859
- return this.requireClient().workspaceKeys.prime(workspaceId);
11073
+ const keys = this.requireClient().workspaceKeys;
11074
+ const { wrappedKey } = await keys.wrappedKey(workspaceId).catch(keyLookupFailed);
11075
+ if (!wrappedKey) return;
11076
+ return keys.prime(workspaceId);
11077
+ }
11078
+ /**
11079
+ * {@link openWorkspace} (or, with `force`, deposit the key again even for the current workspace:
11080
+ * the server said it lacks it), failing with {@link ArbiWorkspaceUnavailableError} when the key
11081
+ * cannot be deposited. Then nothing is sent, so nothing can land in another workspace.
11082
+ */
11083
+ async primeOrFail(workspaceId, options = {}) {
11084
+ try {
11085
+ if (options.force) {
11086
+ this.requireLogin();
11087
+ await this.requireClient().workspaceKeys.prime(workspaceId, { force: true });
11088
+ } else await this.openWorkspace(workspaceId);
11089
+ } catch (error) {
11090
+ if (isAbortError(error) || error instanceof ArbiSessionExpiredError) throw error;
11091
+ throw new ArbiWorkspaceUnavailableError(workspaceId, error);
11092
+ }
11093
+ }
11094
+ /**
11095
+ * Open a chat turn's stream in `workspaceId` (captured by the caller when the turn started): the
11096
+ * workspace is opened for this session first if it is not the current one, and the body names
11097
+ * it, so a switch meanwhile cannot move the turn. A follow-up refused with 409
11098
+ * `workspace_mismatch` (its thread is in another workspace: nothing was written) is sent once
11099
+ * more in the thread's workspace, which is where the server stores a follow-up anyway.
11100
+ * `onWorkspace` hears the workspace the turn was accepted in.
11101
+ */
11102
+ async openTurn(request, workspaceId, open, onWorkspace) {
11103
+ let target = workspaceId;
11104
+ for (let attempt = 0; ; attempt++) {
11105
+ await this.primeOrFail(target);
11106
+ const body = buildTurnRequest({ ...request, workspaceId: target });
11107
+ try {
11108
+ const response = await this.recovering(() => open(body));
11109
+ onWorkspace?.(target);
11110
+ return response;
11111
+ } catch (error) {
11112
+ const conflict = workspaceConflictOf(error);
11113
+ const retryInThread = attempt === 0 && !!request.previousResponseId && conflict?.code === "workspace_mismatch" && conflict.workspaceId !== target;
11114
+ if (!retryInThread) throw error;
11115
+ target = conflict.workspaceId;
11116
+ }
11117
+ }
10860
11118
  }
10861
11119
  /**
10862
11120
  * Create a tag in `workspaceId`, named on the request: a switch while it is sent cannot move it to the workspace
@@ -11013,6 +11271,11 @@ var Arbi = class {
11013
11271
  try {
11014
11272
  return await run();
11015
11273
  } catch (error) {
11274
+ const conflict = workspaceConflictOf(error);
11275
+ if (conflict?.code === "workspace_key_required") {
11276
+ await this.primeOrFail(conflict.workspaceId, { force: true });
11277
+ return run();
11278
+ }
11016
11279
  const message = error instanceof Error ? error.message : "";
11017
11280
  const noWorkspace = /no active workspace/i.test(message);
11018
11281
  const unauthorised = /\b401\b|token has expired/i.test(message);
@@ -11520,6 +11783,23 @@ var Arbi = class {
11520
11783
  });
11521
11784
  });
11522
11785
  },
11786
+ /**
11787
+ * Upload files straight to storage, encrypted here with `workspaceKey` (`uploadDocumentsDirect`),
11788
+ * into `workspaceId`, which must be the workspace open NOW. `upload-init` and `upload-commit`
11789
+ * name no workspace yet (they act on the session's open one), so each runs under
11790
+ * `readInWorkspace`: it is not sent, or its answer not kept, unless `workspaceId` is open when
11791
+ * it is sent and still when it returns. A switch refuses the upload
11792
+ * (`ArbiWorkspaceChangedError`) instead of storing files encrypted with one workspace's key in
11793
+ * another. For any other workspace use `upload` with `workspaceExtId`, which names it.
11794
+ */
11795
+ uploadDirect: (workspaceId, workspaceKey, files, options) => {
11796
+ if (this.currentWorkspaceId !== workspaceId)
11797
+ return Promise.reject(new ArbiWorkspaceChangedError(workspaceId, "uploading to"));
11798
+ return uploadDocumentsDirect(this.requireClient(), workspaceKey, files, {
11799
+ ...options,
11800
+ inWorkspace: (send) => this.readInWorkspace(workspaceId, send)
11801
+ });
11802
+ },
11523
11803
  /** Download a document's original file — its current version, or `version`. */
11524
11804
  download: (docId, version) => this.recovering(() => downloadDocument(this.getAuthHeaders(), docId, version)),
11525
11805
  getParsedContent: (docId, stage, version) => this.recovering(
@@ -11575,8 +11855,13 @@ var Arbi = class {
11575
11855
  const first = await runConversation(client, conversationId);
11576
11856
  if (!first.pending_auth_request_id) return first;
11577
11857
  const pending = await getPendingAuth(client, conversationId);
11858
+ if (!pending.workspace_ext_id)
11859
+ throw new ArbiError(
11860
+ "The run is waiting for access, but the server did not say to which workspace",
11861
+ { code: "PENDING_AUTH_WITHOUT_WORKSPACE" }
11862
+ );
11578
11863
  await this.workspaces.grantTemporaryAccess({
11579
- workspaceId: pending.workspace_ext_id ?? this.getWorkspaceId(),
11864
+ workspaceId: pending.workspace_ext_id,
11580
11865
  emails: [pending.agent_email],
11581
11866
  sessionPubkeyB64: pending.session_pubkey
11582
11867
  });
@@ -11669,7 +11954,7 @@ var Arbi = class {
11669
11954
  });
11670
11955
  }
11671
11956
  };
11672
- async openResponseHandle(open, options, id) {
11957
+ async openResponseHandle(open, options, id, bufferEvents = false) {
11673
11958
  const controller = new AbortController();
11674
11959
  const abort = () => controller.abort();
11675
11960
  options.signal?.addEventListener("abort", abort, { once: true });
@@ -11681,7 +11966,7 @@ var Arbi = class {
11681
11966
  response,
11682
11967
  controller,
11683
11968
  (responseId) => this.assistant.cancel(responseId),
11684
- { id, cleanup }
11969
+ { id, cleanup, bufferEvents }
11685
11970
  );
11686
11971
  } catch (error) {
11687
11972
  cleanup();
@@ -11689,16 +11974,143 @@ var Arbi = class {
11689
11974
  throw error;
11690
11975
  }
11691
11976
  }
11977
+ /** Canonical Responses-shaped requests; existing assistant convenience helpers remain supported. */
11978
+ responses = {
11979
+ create: async (request, options = {}) => {
11980
+ if (request.stream) {
11981
+ if (request.background)
11982
+ throw new ArbiError(
11983
+ "Streaming background creation is not supported yet. Create in background mode, then attach to the returned response.",
11984
+ { code: "RESPONSES_UNSUPPORTED_OPTION" }
11985
+ );
11986
+ const body2 = {
11987
+ ...request,
11988
+ workspace_ext_id: request.workspace_ext_id ?? this.requireWorkspace(),
11989
+ stream: true,
11990
+ background: false,
11991
+ store: request.store ?? true
11992
+ };
11993
+ const started = await this.openResponseHandle(
11994
+ (signal) => openTurnStream(this.getAuthHeaders(), body2, signal),
11995
+ options,
11996
+ void 0,
11997
+ true
11998
+ );
11999
+ if (started.kind !== "response")
12000
+ throw new ArbiError("The control command was acknowledged without creating a response.", {
12001
+ code: "RESPONSE_CONTROL_ACKNOWLEDGED",
12002
+ cause: started.acknowledgement
12003
+ });
12004
+ return new ResponseStream(started.handle);
12005
+ }
12006
+ const requestBody = {
12007
+ ...request,
12008
+ workspace_ext_id: request.workspace_ext_id ?? this.requireWorkspace(),
12009
+ stream: false,
12010
+ background: request.background ?? false,
12011
+ store: request.store ?? true
12012
+ };
12013
+ const response = await this.recovering(
12014
+ () => openTurnStream(this.getAuthHeaders(), requestBody, options.signal)
12015
+ );
12016
+ let body;
12017
+ try {
12018
+ body = await response.text();
12019
+ } catch (cause) {
12020
+ throw transportError(cause);
12021
+ }
12022
+ try {
12023
+ return withOutputText(
12024
+ JSON.parse(body),
12025
+ response.headers.get("x-request-id") ?? void 0
12026
+ );
12027
+ } catch (cause) {
12028
+ throw new ArbiError("Expected a Responses JSON object.", {
12029
+ code: "RESPONSE_INVALID_ENVELOPE",
12030
+ cause,
12031
+ requestId: response.headers.get("x-request-id") ?? void 0
12032
+ });
12033
+ }
12034
+ },
12035
+ parse: async (request, options = {}) => {
12036
+ if (request.stream || request.background)
12037
+ throw new ArbiError(
12038
+ "Parse a synchronous response, or validate a completed stored response separately.",
12039
+ { code: "RESPONSES_UNSUPPORTED_OPTION" }
12040
+ );
12041
+ const workspaceId = request.workspace_ext_id ?? this.requireWorkspace();
12042
+ const parse = await createStructuredParser(request.text.format);
12043
+ const response = await this.responses.create(
12044
+ { ...request, workspace_ext_id: workspaceId, stream: false, background: false },
12045
+ options
12046
+ );
12047
+ return {
12048
+ ...response,
12049
+ output_parsed: parse(response, { requestId: response._request_id }).data
12050
+ };
12051
+ },
12052
+ stream: (request, options = {}) => this.openResponseHandle(
12053
+ (signal) => openTurnStream(
12054
+ this.getAuthHeaders(),
12055
+ {
12056
+ ...request,
12057
+ workspace_ext_id: request.workspace_ext_id ?? this.requireWorkspace(),
12058
+ stream: true,
12059
+ background: false,
12060
+ store: request.store ?? true
12061
+ },
12062
+ signal
12063
+ ),
12064
+ options
12065
+ ),
12066
+ retrieve: async (id) => withOutputText(await this.assistant.getResponse(id)),
12067
+ cancel: (id) => this.assistant.cancel(id),
12068
+ attach: (id, options = {}) => this.assistant.attachResponse(id, options)
12069
+ };
11692
12070
  // ── Assistant ─────────────────────────────────────────────────────────
11693
12071
  assistant = {
12072
+ /** Create one synchronous Responses result and return validated JSON alongside the raw response. */
12073
+ parseResponse: async (request, options = {}) => {
12074
+ const parse = await createStructuredParser(request.text.format);
12075
+ const body = {
12076
+ ...buildTurnRequest({
12077
+ ...request,
12078
+ workspaceId: request.workspaceId ?? this.requireWorkspace()
12079
+ }),
12080
+ stream: false,
12081
+ background: false
12082
+ };
12083
+ const response = await this.recovering(
12084
+ () => openTurnStream(this.getAuthHeaders(), body, options.signal)
12085
+ );
12086
+ let rawText;
12087
+ try {
12088
+ rawText = await response.text();
12089
+ } catch (cause) {
12090
+ throw transportError(cause);
12091
+ }
12092
+ let raw;
12093
+ try {
12094
+ raw = JSON.parse(rawText);
12095
+ } catch (cause) {
12096
+ throw new ArbiStructuredOutputError("Expected a Responses JSON object.", rawText, {
12097
+ code: "RESPONSE_INVALID_ENVELOPE",
12098
+ cause,
12099
+ requestId: response.headers.get("x-request-id") ?? void 0
12100
+ });
12101
+ }
12102
+ return parse(raw, { requestId: response.headers.get("x-request-id") ?? void 0 });
12103
+ },
11694
12104
  /** Start one response with a composable observer; existing ask callbacks remain unchanged. */
11695
12105
  startResponse: async (request, options = {}) => {
11696
- const body = buildTurnRequest({
11697
- ...request,
11698
- workspaceId: request.workspaceId ?? this.requireWorkspace()
11699
- });
12106
+ const workspaceId = request.workspaceId ?? this.requireWorkspace();
11700
12107
  return this.openResponseHandle(
11701
- (signal) => openTurnStream(this.getAuthHeaders(), body, signal),
12108
+ (signal) => this.openTurn(
12109
+ request,
12110
+ workspaceId,
12111
+ (body) => openTurnStream(this.getAuthHeaders(), body, signal),
12112
+ options.onWorkspace
12113
+ ),
11702
12114
  options
11703
12115
  );
11704
12116
  },
@@ -11726,22 +12138,29 @@ var Arbi = class {
11726
12138
  * with it; an abort just rejects.
11727
12139
  */
11728
12140
  ask: async (request, handlers = {}) => {
11729
- const { signal, onError, onQuotaExceeded, ...callbacks } = handlers;
11730
- const body = buildTurnRequest({
11731
- ...request,
11732
- workspaceId: request.workspaceId ?? this.requireWorkspace()
11733
- });
12141
+ const { signal, onError, onQuotaExceeded, onWorkspace, ...callbacks } = handlers;
12142
+ const workspaceId = request.workspaceId ?? this.requireWorkspace();
11734
12143
  const refuse = (message, error = new Error(message)) => {
11735
12144
  onError?.(message);
11736
12145
  throw error;
11737
12146
  };
11738
12147
  let response;
11739
12148
  try {
11740
- response = await this.recovering(
11741
- () => openTurnStream(this.getAuthHeaders(), body, signal)
12149
+ response = await this.openTurn(
12150
+ request,
12151
+ workspaceId,
12152
+ (body) => openTurnStream(this.getAuthHeaders(), body, signal),
12153
+ onWorkspace
11742
12154
  );
11743
12155
  } catch (error) {
11744
12156
  if (isAbort(error)) throw error;
12157
+ if (error instanceof ArbiWorkspaceUnavailableError) {
12158
+ callbacks.onErrorDetails?.(error);
12159
+ return refuse(
12160
+ "This chat's workspace can't be opened in this session, so the message was not sent.",
12161
+ error
12162
+ );
12163
+ }
11745
12164
  if (error instanceof AssistantTurnRefused) {
11746
12165
  if (error.quota) onQuotaExceeded?.(error.quota);
11747
12166
  callbacks.onErrorDetails?.(error);
@@ -11799,14 +12218,16 @@ var Arbi = class {
11799
12218
  transcribe: (audio) => transcribe(this.requireClient(), audio),
11800
12219
  /** Start a durable background turn; task options make its thread a work item. */
11801
12220
  submit: (question, options) => {
11802
- const workspaceId = this.requireWorkspace();
11803
- return this.recovering(
11804
- () => submitBackgroundQuery({
11805
- ...this.getAuthHeaders(),
11806
- ...options,
11807
- workspaceId,
11808
- question
11809
- })
12221
+ const workspaceId = options.workspaceId ?? this.requireWorkspace();
12222
+ return this.primeOrFail(workspaceId).then(
12223
+ () => this.recovering(
12224
+ () => submitBackgroundQuery({
12225
+ ...this.getAuthHeaders(),
12226
+ ...options,
12227
+ workspaceId,
12228
+ question
12229
+ })
12230
+ )
11810
12231
  );
11811
12232
  },
11812
12233
  /** Read the status of a background turn. */
@@ -11827,13 +12248,19 @@ var Arbi = class {
11827
12248
  * Search documents without LLM generation (retrieval only). No `docIds` searches the whole
11828
12249
  * workspace; `searchChunks(result)` ranks the passages found.
11829
12250
  */
11830
- retrieve: (query2, docIds, options) => retrieve({
11831
- arbi: this.requireClient(),
11832
- workspaceId: this.requireWorkspace(),
11833
- query: query2,
11834
- docIds,
11835
- ...options
11836
- })
12251
+ retrieve: (query2, docIds, options) => {
12252
+ const { workspaceId: named, ...rest } = options ?? {};
12253
+ const workspaceId = named ?? this.requireWorkspace();
12254
+ return this.primeOrFail(workspaceId).then(
12255
+ () => retrieve({
12256
+ arbi: this.requireClient(),
12257
+ workspaceId,
12258
+ query: query2,
12259
+ docIds,
12260
+ ...rest
12261
+ })
12262
+ );
12263
+ }
11837
12264
  };
11838
12265
  // ── Tags ──────────────────────────────────────────────────────────────
11839
12266
  tags = {
@@ -13255,6 +13682,55 @@ function getRunToAttach(localGeneration, messages) {
13255
13682
  return getAttachableRunId(messages);
13256
13683
  }
13257
13684
 
13258
- export { ACCOUNT_VENDOR, Arbi, ArbiApiError, ArbiError, ArbiTransportError, ArbiWorkspaceChangedError, ArbiWorkspaceSupersededError, CallApiError, DEFAULT_AI_USD_PER_GBP, DRIVE_SYNC_VENDORS, DuplicateContactError, ENTITY_KINDS, FLAT_TAG_KINDS, GOOGLE_VENDORS, IMANAGE_VENDORS, MAILBOX_SYNC_VENDORS, MAX_RETRIEVE_DOC_IDS, MICROSOFT_VENDORS, PRESENCE_KINDS, PROMPT_CONTEXT_CHARS, PlanStepsError, PublicBookingError, SHAREPOINT_VENDORS, STOP_ID_WAIT_MS, STOP_REPEAT_WINDOW_MS, TAG_KINDS, TAG_NESTING_MAX_DEPTH, WebSocketAuthError, account_exports as account, agentconfig_exports as agentconfig, appendTranscriptionHints, assistant_exports as assistant, authenticatedFetch, bookPublicSlot, buildCitationChunkData, buildDocumentTools, buildFactsContextTool, buildRetrievalChunkTool, buildRetrievalFullContextTool, buildRetrievalTocTool, buildTurnRequest, calendar_exports as calendar, calls_exports as calls, canTagHaveParent, cancelPublicBooking, chats_exports as chats, computeRunStats, connectErrorMessage, connectWebSocket, connectWithReconnect, connectors_exports as connectors, contacts_exports as contacts, continuityPrompt, conversations_exports as conversations, countCitations, createAuthenticatedClient, createIndexAssigner, databases_exports as databases, defaultKindForFormat, doctags_exports as doctags, documents_exports as documents, estimateDraftTokens, extractDocumentIdsFromMessages, extractFactIdsFromMessages, extractSubagentLanes, facts_exports as facts, files_exports as files, filterDocumentTags, filterSkills, findLeafForTaskMessage, findMainSiblingLeaf, findReplyTarget, findSubagentRunId, flattenTagTree, formatAgentStepLabel, formatFileSize, formatGbp, formatGbpPerMillionTokens, formatItemLabel, formatTokens, formatUserName, formatWorkspaceChoices, getAgentStepLabel, getAttachableRunId, getChildTags, getContextRemainingPercent, getContextUsedPercent, getContextUsedTokens, getCurrentStep, getEligibleParentTags, getErrorMessage, getPublicBookingPage, getRawWorkspaceKey, getRunToAttach, getRunToCancel, getStepDisplay, getStepTool, getSubagentBranchRecord, getTagDescendantIds, health_exports as health, house_template_exports as houseTemplates, hydrateAgentSteps, identityErrorCode, identity_exports as identityVerification, isAnnotationTag, isConnectorVendorVisible, isDriveSyncVendor, isEntityTag, isFlatKind, isLabelTag, isMailboxSyncVendor, isNearAiUsageBudget, isPresenceTag, isSharePointVendor, isSharedSkill, isTraceItem, mail_exports as mail, mergeAgentSteps, notifications_exports as notifications, parseSSEEvents, parseSlashCommand, parseSlashTokenInProgress, performPasswordLogin, pickMainThread, profile_exports as profile, progressFetch, projects_exports as projects, quotaExceededFrom, quotaFromStreamError, reduceOutputItem, refusalReason, requireData, requireOk, resolveAuth, resolveCitations, resolveSummary, resolveWorkspace, responses_exports as responses, searchChunks, selectFullContextDocument, selectWorkspace, selectWorkspaceById, sessions_exports as sessions, settings_exports as settings, sliceToSubagentThread, streamSSE, stripCitationMarkdown, subagentJobLabel, summarizeCitations, tagUseCount, tags_exports as tags, tagsForScope, tagsOfGroup, topLevelAgentSteps, usdToGbp, work_exports as work, workflow_steps_exports as workflowSteps, workflows_exports as workflows, workspaces_exports as workspaces, wouldCreateTagCycle };
13685
+ // src/configuration.ts
13686
+ function composeConfiguration(base, ...patches) {
13687
+ const result = structuredClone(base);
13688
+ for (const patch of patches) {
13689
+ for (const [key, value] of Object.entries(patch)) {
13690
+ if (value === void 0) continue;
13691
+ result[key] = value && typeof value === "object" && !Array.isArray(value) ? { ...result[key] ?? {}, ...structuredClone(value) } : structuredClone(value);
13692
+ }
13693
+ }
13694
+ return result;
13695
+ }
13696
+ function instructions(text2) {
13697
+ return { QueryLLM: { SYSTEM_INSTRUCTION: text2 }, Agents: { PERSONA: text2 } };
13698
+ }
13699
+ function capabilities(options) {
13700
+ const flags = {
13701
+ webSearch: "WEB_SEARCH_ENABLED",
13702
+ codeExecution: "RUN_CODE_ENABLED",
13703
+ planning: "PLANNING_ENABLED",
13704
+ deepResearch: "DEEP_RESEARCH_ENABLED",
13705
+ subagents: "SUBAGENTS_ENABLED",
13706
+ humanInput: "HUMAN_IN_THE_LOOP"
13707
+ };
13708
+ const Agents = {};
13709
+ for (const key of Object.keys(flags)) {
13710
+ if (options[key] !== void 0) Agents[flags[key]] = options[key];
13711
+ }
13712
+ return { Agents };
13713
+ }
13714
+ function mcpTools(base, names, mode) {
13715
+ return {
13716
+ Agents: {
13717
+ MCP_TOOLS: [
13718
+ .../* @__PURE__ */ new Set([...mode === "add" ? base.Agents?.MCP_TOOLS ?? [] : [], ...names])
13719
+ ]
13720
+ }
13721
+ };
13722
+ }
13723
+ function documentTools(options) {
13724
+ return {
13725
+ ...options.search ? { retrieval_chunk: buildRetrievalChunkTool([...options.search]) } : {},
13726
+ ...options.fullContext ? { retrieval_full_context: buildRetrievalFullContextTool([...options.fullContext]) } : {},
13727
+ ...options.tableOfContents ? { retrieval_toc: buildRetrievalTocTool([...options.tableOfContents]) } : {}
13728
+ };
13729
+ }
13730
+ function composeTools(base, next, mode) {
13731
+ return structuredClone(mode === "add" ? { ...base, ...next } : next);
13732
+ }
13733
+
13734
+ export { ACCOUNT_VENDOR, Arbi, ArbiApiError, ArbiError, ArbiSessionExpiredError, ArbiStructuredOutputError, ArbiTransportError, ArbiWorkspaceChangedError, ArbiWorkspaceSupersededError, ArbiWorkspaceUnavailableError, CallApiError, DEFAULT_AI_USD_PER_GBP, DRIVE_SYNC_VENDORS, DuplicateContactError, ENTITY_KINDS, FLAT_TAG_KINDS, GOOGLE_VENDORS, IMANAGE_VENDORS, MAILBOX_SYNC_VENDORS, MAX_RETRIEVE_DOC_IDS, MICROSOFT_VENDORS, PRESENCE_KINDS, PROMPT_CONTEXT_CHARS, PlanStepsError, PublicBookingError, ResponseStream, SHAREPOINT_VENDORS, STOP_ID_WAIT_MS, STOP_REPEAT_WINDOW_MS, TAG_KINDS, TAG_NESTING_MAX_DEPTH, WebSocketAuthError, account_exports as account, agentconfig_exports as agentconfig, appendTranscriptionHints, assistant_exports as assistant, authenticatedFetch, bookPublicSlot, buildCitationChunkData, buildDocumentTools, buildFactsContextTool, buildRetrievalChunkTool, buildRetrievalFullContextTool, buildRetrievalTocTool, buildTurnRequest, calendar_exports as calendar, calls_exports as calls, canTagHaveParent, cancelPublicBooking, capabilities, chats_exports as chats, composeConfiguration, composeTools, computeRunStats, connectErrorMessage, connectWebSocket, connectWithReconnect, connectors_exports as connectors, contacts_exports as contacts, continuityPrompt, conversations_exports as conversations, countCitations, createAuthenticatedClient, createIndexAssigner, databases_exports as databases, defaultKindForFormat, doctags_exports as doctags, documentTools, documents_exports as documents, estimateDraftTokens, extractDocumentIdsFromMessages, extractFactIdsFromMessages, extractSubagentLanes, facts_exports as facts, files_exports as files, filterDocumentTags, filterSkills, findLeafForTaskMessage, findMainSiblingLeaf, findReplyTarget, findSubagentRunId, flattenTagTree, formatAgentStepLabel, formatFileSize, formatGbp, formatGbpPerMillionTokens, formatItemLabel, formatTokens, formatUserName, formatWorkspaceChoices, getAgentStepLabel, getAttachableRunId, getChildTags, getContextRemainingPercent, getContextUsedPercent, getContextUsedTokens, getCurrentStep, getEligibleParentTags, getErrorCode, getErrorMessage, getPublicBookingPage, getRawWorkspaceKey, getRunToAttach, getRunToCancel, getStepDisplay, getStepTool, getSubagentBranchRecord, getTagDescendantIds, health_exports as health, house_template_exports as houseTemplates, hydrateAgentSteps, identityErrorCode, identity_exports as identityVerification, instructions, isAnnotationTag, isConnectorVendorVisible, isDriveSyncVendor, isEntityTag, isFlatKind, isLabelTag, isMailboxSyncVendor, isNearAiUsageBudget, isPresenceTag, isSharePointVendor, isSharedSkill, isTraceItem, mail_exports as mail, mcpTools, mergeAgentSteps, notifications_exports as notifications, parseSSEEvents, parseSlashCommand, parseSlashTokenInProgress, parseStructuredResponse, performPasswordLogin, pickMainThread, profile_exports as profile, progressFetch, projects_exports as projects, quotaExceededFrom, quotaFromStreamError, reduceOutputItem, refusalReason, requireData, requireOk, resolveAuth, resolveCitations, resolveSummary, resolveWorkspace, responses_exports as responses, searchChunks, selectFullContextDocument, selectWorkspace, selectWorkspaceById, sessions_exports as sessions, settings_exports as settings, sliceToSubagentThread, streamSSE, stripCitationMarkdown, subagentJobLabel, summarizeCitations, tagUseCount, tags_exports as tags, tagsForScope, tagsOfGroup, topLevelAgentSteps, usdToGbp, work_exports as work, workflow_steps_exports as workflowSteps, workflows_exports as workflows, workspaceConflictOf, workspaces_exports as workspaces, wouldCreateTagCycle };
13259
13735
  //# sourceMappingURL=browser.js.map
13260
13736
  //# sourceMappingURL=browser.js.map