@arbidocs/sdk 0.4.5 → 0.4.7

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.
@@ -1,2 +1,2 @@
1
- export { A as AgentControlStateEvent, a as AgentStepDeltaEvent, b as AgentStepEvent, c as Arbi, d as ArbiApiError, e as ArbiError, f as ArbiErrorEvent, g as ArbiOptions, i as ArtifactEvent, j as AuthContext, k as AuthHeaders, l as AuthenticatedClient, C as ChatSession, m as CitationSummary, n as CliConfig, o as CliCredentials, p as CommandDescriptor, q as ConfigStore, r as ConnectOptions, s as CreateFactRequest, t as CreateFactsRequest, u as CreateTaskRequest, v as DeferredInterjectionEvent, F as FactResponse, G as FactSearchRequest, H as FactSearchResponse, J as ListFactsOptions, N as MessageMetadataPayload, O as MessageQueuedEvent, P as OutputTokensDetails, Q as ParsedSlashCommand, R as ProbeAnswerEvent, S as ProjectInvoicesResponse, T as ProjectUsageResponse, U as QueryOptions, V as ReconnectOptions, W as ReconnectableWsConnection, X as ResolvedCitation, Z as ResponseCompletedEvent, _ as ResponseContentPartAddedEvent, $ as ResponseCreatedEvent, a0 as ResponseFailedEvent, a1 as ResponseOutputItemAddedEvent, a2 as ResponseOutputItemDoneEvent, a3 as ResponseOutputTextDeltaEvent, a4 as ResponseOutputTextDoneEvent, a5 as ResponseUsage, a6 as SSEEvent, a7 as SSEStreamCallbacks, a8 as SSEStreamResult, a9 as SSEStreamStartData, ab as SkillSummary, ad as TaskResponse, ae as TokenBudgetContext, af as UpdateFactRequest, ag as UpdateTaskRequest, am as UserDailyUsageResponse, an as UserInfo, ao as UserInputRequestEvent, ap as UserMessageEvent, aq as WebSocketAuthError, ar as WorkspaceContext, as as WsConnection, at as agentconfig, au as assistant, av as authenticatedFetch, ax as buildRetrievalChunkTool, ay as buildRetrievalFullContextTool, az as buildRetrievalTocTool, aA as connectWebSocket, aB as connectWithReconnect, aC as consumeSSEStream, aD as contacts, aE as conversations, aF as countCitations, aG as createAuthenticatedClient, aI as dm, aJ as doctags, aK as documents, aL as facts, aM as files, aN as filterSkills, aO as formatAgentStepLabel, aP as formatFileSize, aQ as formatItemLabel, aS as formatUserName, aT as formatWorkspaceChoices, aY as getErrorMessage, aZ as getRawWorkspaceKey, a_ as health, a$ as parseSSEEvents, b0 as parseSlashCommand, b1 as parseSlashTokenInProgress, b2 as performPasswordLogin, b5 as projects, b6 as requireData, b7 as requireOk, b8 as resolveAuth, b9 as resolveCitations, ba as resolveWorkspace, bb as responses, bc as selectWorkspace, bd as selectWorkspaceById, be as settings, bf as streamSSE, bg as stripCitationMarkdown, bh as summarizeCitations, bi as tags, bj as tasks, bk as workspaces } from './browser-5spRium9.cjs';
2
- import '@arbidocs/client';
1
+ export { A as AgentControlStateEvent, a as AgentStepDeltaEvent, b as AgentStepEvent, c as Arbi, d as ArbiApiError, e as ArbiError, f as ArbiErrorEvent, g as ArbiOptions, i as ArtifactEvent, j as AuthContext, k as AuthHeaders, l as AuthenticatedClient, C as ChatSession, m as CitationSummary, n as CliConfig, o as CliCredentials, p as CommandDescriptor, q as ConfigStore, r as ConnectOptions, s as CreateFactRequest, t as CreateFactsRequest, u as CreateTaskRequest, v as DeferredInterjectionEvent, F as FactResponse, G as FactSearchRequest, H as FactSearchResponse, J as ListFactsOptions, N as MessageMetadataPayload, O as MessageQueuedEvent, P as OutputTokensDetails, Q as ParsedSlashCommand, R as ProbeAnswerEvent, S as ProjectInvoicesResponse, T as ProjectUsageResponse, U as QueryOptions, V as ReconnectOptions, W as ReconnectableWsConnection, X as ResolvedCitation, Z as ResponseCompletedEvent, _ as ResponseContentPartAddedEvent, $ as ResponseCreatedEvent, a0 as ResponseFailedEvent, a1 as ResponseOutputItemAddedEvent, a2 as ResponseOutputItemDoneEvent, a3 as ResponseOutputTextDeltaEvent, a4 as ResponseOutputTextDoneEvent, a5 as ResponseUsage, a6 as SSEEvent, a7 as SSEStreamCallbacks, a8 as SSEStreamResult, a9 as SSEStreamStartData, ab as SkillSummary, ad as TaskResponse, ae as TokenBudgetContext, af as UpdateFactRequest, ag as UpdateTaskRequest, am as UserDailyUsageResponse, an as UserInfo, ao as UserInputRequestEvent, ap as UserMessageEvent, aq as WebSocketAuthError, ar as WorkspaceContext, as as WsConnection, at as account, au as agentconfig, av as assistant, aw as authenticatedFetch, ay as buildRetrievalChunkTool, az as buildRetrievalFullContextTool, aA as buildRetrievalTocTool, aB as connectWebSocket, aC as connectWithReconnect, aD as consumeSSEStream, aE as contacts, aF as conversations, aG as countCitations, aH as createAuthenticatedClient, aJ as dm, aK as doctags, aL as documents, aM as facts, aN as files, aO as filterSkills, aP as formatAgentStepLabel, aQ as formatFileSize, aR as formatItemLabel, aT as formatUserName, aU as formatWorkspaceChoices, aZ as getErrorMessage, a_ as getRawWorkspaceKey, a$ as health, b0 as parseSSEEvents, b1 as parseSlashCommand, b2 as parseSlashTokenInProgress, b3 as performPasswordLogin, b6 as profile, b7 as projects, b8 as requireData, b9 as requireOk, ba as resolveAuth, bb as resolveCitations, bc as resolveWorkspace, bd as responses, be as selectWorkspace, bf as selectWorkspaceById, bg as sessions, bh as settings, bi as streamSSE, bj as stripCitationMarkdown, bk as summarizeCitations, bl as tags, bm as tasks, bn as workspaces } from './browser-B43Cvo9W.cjs';
2
+ export { LoginProfile } from '@arbidocs/client';
package/dist/browser.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { A as AgentControlStateEvent, a as AgentStepDeltaEvent, b as AgentStepEvent, c as Arbi, d as ArbiApiError, e as ArbiError, f as ArbiErrorEvent, g as ArbiOptions, i as ArtifactEvent, j as AuthContext, k as AuthHeaders, l as AuthenticatedClient, C as ChatSession, m as CitationSummary, n as CliConfig, o as CliCredentials, p as CommandDescriptor, q as ConfigStore, r as ConnectOptions, s as CreateFactRequest, t as CreateFactsRequest, u as CreateTaskRequest, v as DeferredInterjectionEvent, F as FactResponse, G as FactSearchRequest, H as FactSearchResponse, J as ListFactsOptions, N as MessageMetadataPayload, O as MessageQueuedEvent, P as OutputTokensDetails, Q as ParsedSlashCommand, R as ProbeAnswerEvent, S as ProjectInvoicesResponse, T as ProjectUsageResponse, U as QueryOptions, V as ReconnectOptions, W as ReconnectableWsConnection, X as ResolvedCitation, Z as ResponseCompletedEvent, _ as ResponseContentPartAddedEvent, $ as ResponseCreatedEvent, a0 as ResponseFailedEvent, a1 as ResponseOutputItemAddedEvent, a2 as ResponseOutputItemDoneEvent, a3 as ResponseOutputTextDeltaEvent, a4 as ResponseOutputTextDoneEvent, a5 as ResponseUsage, a6 as SSEEvent, a7 as SSEStreamCallbacks, a8 as SSEStreamResult, a9 as SSEStreamStartData, ab as SkillSummary, ad as TaskResponse, ae as TokenBudgetContext, af as UpdateFactRequest, ag as UpdateTaskRequest, am as UserDailyUsageResponse, an as UserInfo, ao as UserInputRequestEvent, ap as UserMessageEvent, aq as WebSocketAuthError, ar as WorkspaceContext, as as WsConnection, at as agentconfig, au as assistant, av as authenticatedFetch, ax as buildRetrievalChunkTool, ay as buildRetrievalFullContextTool, az as buildRetrievalTocTool, aA as connectWebSocket, aB as connectWithReconnect, aC as consumeSSEStream, aD as contacts, aE as conversations, aF as countCitations, aG as createAuthenticatedClient, aI as dm, aJ as doctags, aK as documents, aL as facts, aM as files, aN as filterSkills, aO as formatAgentStepLabel, aP as formatFileSize, aQ as formatItemLabel, aS as formatUserName, aT as formatWorkspaceChoices, aY as getErrorMessage, aZ as getRawWorkspaceKey, a_ as health, a$ as parseSSEEvents, b0 as parseSlashCommand, b1 as parseSlashTokenInProgress, b2 as performPasswordLogin, b5 as projects, b6 as requireData, b7 as requireOk, b8 as resolveAuth, b9 as resolveCitations, ba as resolveWorkspace, bb as responses, bc as selectWorkspace, bd as selectWorkspaceById, be as settings, bf as streamSSE, bg as stripCitationMarkdown, bh as summarizeCitations, bi as tags, bj as tasks, bk as workspaces } from './browser-5spRium9.js';
2
- import '@arbidocs/client';
1
+ export { A as AgentControlStateEvent, a as AgentStepDeltaEvent, b as AgentStepEvent, c as Arbi, d as ArbiApiError, e as ArbiError, f as ArbiErrorEvent, g as ArbiOptions, i as ArtifactEvent, j as AuthContext, k as AuthHeaders, l as AuthenticatedClient, C as ChatSession, m as CitationSummary, n as CliConfig, o as CliCredentials, p as CommandDescriptor, q as ConfigStore, r as ConnectOptions, s as CreateFactRequest, t as CreateFactsRequest, u as CreateTaskRequest, v as DeferredInterjectionEvent, F as FactResponse, G as FactSearchRequest, H as FactSearchResponse, J as ListFactsOptions, N as MessageMetadataPayload, O as MessageQueuedEvent, P as OutputTokensDetails, Q as ParsedSlashCommand, R as ProbeAnswerEvent, S as ProjectInvoicesResponse, T as ProjectUsageResponse, U as QueryOptions, V as ReconnectOptions, W as ReconnectableWsConnection, X as ResolvedCitation, Z as ResponseCompletedEvent, _ as ResponseContentPartAddedEvent, $ as ResponseCreatedEvent, a0 as ResponseFailedEvent, a1 as ResponseOutputItemAddedEvent, a2 as ResponseOutputItemDoneEvent, a3 as ResponseOutputTextDeltaEvent, a4 as ResponseOutputTextDoneEvent, a5 as ResponseUsage, a6 as SSEEvent, a7 as SSEStreamCallbacks, a8 as SSEStreamResult, a9 as SSEStreamStartData, ab as SkillSummary, ad as TaskResponse, ae as TokenBudgetContext, af as UpdateFactRequest, ag as UpdateTaskRequest, am as UserDailyUsageResponse, an as UserInfo, ao as UserInputRequestEvent, ap as UserMessageEvent, aq as WebSocketAuthError, ar as WorkspaceContext, as as WsConnection, at as account, au as agentconfig, av as assistant, aw as authenticatedFetch, ay as buildRetrievalChunkTool, az as buildRetrievalFullContextTool, aA as buildRetrievalTocTool, aB as connectWebSocket, aC as connectWithReconnect, aD as consumeSSEStream, aE as contacts, aF as conversations, aG as countCitations, aH as createAuthenticatedClient, aJ as dm, aK as doctags, aL as documents, aM as facts, aN as files, aO as filterSkills, aP as formatAgentStepLabel, aQ as formatFileSize, aR as formatItemLabel, aT as formatUserName, aU as formatWorkspaceChoices, aZ as getErrorMessage, a_ as getRawWorkspaceKey, a$ as health, b0 as parseSSEEvents, b1 as parseSlashCommand, b2 as parseSlashTokenInProgress, b3 as performPasswordLogin, b6 as profile, b7 as projects, b8 as requireData, b9 as requireOk, ba as resolveAuth, bb as resolveCitations, bc as resolveWorkspace, bd as responses, be as selectWorkspace, bf as selectWorkspaceById, bg as sessions, bh as settings, bi as streamSSE, bj as stripCitationMarkdown, bk as summarizeCitations, bl as tags, bm as tasks, bn as workspaces } from './browser-B43Cvo9W.js';
2
+ export { LoginProfile } from '@arbidocs/client';
package/dist/browser.js CHANGED
@@ -1,4 +1,4 @@
1
- import { createArbiClient, base64ToBytes, deriveEncryptionKeypairFromSigning, sealedBoxDecrypt, sealKeyForSession, buildWebSocketUrl, createAuthMessage, parseServerMessage, isMessageType, createContentHash, encryptFile } from '@arbidocs/client';
1
+ import { createArbiClient, base64ToBytes, deriveEncryptionKeypairFromSigning, sealedBoxDecrypt, sealKeyForSession, buildWebSocketUrl, createAuthMessage, parseServerMessage, isMessageType, createContentHash, encryptFile, changePasswordWithRekey } from '@arbidocs/client';
2
2
 
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -3554,14 +3554,15 @@ async function extractErrorMessage(res) {
3554
3554
  return `Request failed: ${res.status} ${res.statusText}`;
3555
3555
  }
3556
3556
  async function authenticatedFetch(options) {
3557
- const { baseUrl, accessToken, path, method, body, headers } = options;
3557
+ const { baseUrl, accessToken, path, method, body, headers, signal } = options;
3558
3558
  const res = await fetch(`${baseUrl}${path}`, {
3559
3559
  method: method ?? (body ? "POST" : "GET"),
3560
3560
  headers: {
3561
3561
  Authorization: `Bearer ${accessToken}`,
3562
3562
  ...headers
3563
3563
  },
3564
- body
3564
+ body,
3565
+ signal
3565
3566
  });
3566
3567
  if (!res.ok) {
3567
3568
  const message = await extractErrorMessage(res);
@@ -4924,7 +4925,7 @@ async function retrieve(options) {
4924
4925
  return data;
4925
4926
  }
4926
4927
  async function queryAssistant(options) {
4927
- const { workspaceId, question, docIds, previousResponseId, model, ...auth } = options;
4928
+ const { workspaceId, question, docIds, previousResponseId, model, signal, ...auth } = options;
4928
4929
  const body = {
4929
4930
  input: question,
4930
4931
  workspace_ext_id: workspaceId,
@@ -4943,7 +4944,8 @@ async function queryAssistant(options) {
4943
4944
  path: "/v1/assistant/query",
4944
4945
  method: "POST",
4945
4946
  body: JSON.stringify(body),
4946
- headers: { "Content-Type": "application/json" }
4947
+ headers: { "Content-Type": "application/json" },
4948
+ signal
4947
4949
  });
4948
4950
  }
4949
4951
  async function respondToAgent(arbi, assistantMessageExtId, answer) {
@@ -5479,9 +5481,78 @@ async function getFileContent(auth, fileId) {
5479
5481
  }
5480
5482
 
5481
5483
  // src/operations/sessions.ts
5484
+ var sessions_exports = {};
5485
+ __export(sessions_exports, {
5486
+ currentSessionId: () => currentSessionId,
5487
+ listSessions: () => listSessions,
5488
+ logoutAllSessions: () => logoutAllSessions,
5489
+ terminateSession: () => terminateSession
5490
+ });
5482
5491
  async function listSessions(arbi) {
5483
5492
  return requireData(await arbi.fetch.GET("/v1/user/sessions"), "Failed to fetch sessions");
5484
5493
  }
5494
+ async function terminateSession(arbi, sessionId) {
5495
+ requireOk(
5496
+ await arbi.fetch.PATCH("/v1/user/sessions/{session_id}", {
5497
+ params: { path: { session_id: sessionId } },
5498
+ body: { ttl: 0 }
5499
+ }),
5500
+ "Failed to end session"
5501
+ );
5502
+ }
5503
+ async function logoutAllSessions(arbi) {
5504
+ requireOk(
5505
+ await arbi.fetch.POST("/v1/user/logout", { params: { query: { all_sessions: true } } }),
5506
+ "Failed to sign out of all sessions"
5507
+ );
5508
+ }
5509
+ function currentSessionId(accessToken) {
5510
+ const payload = accessToken?.split(".")[1];
5511
+ if (!payload) return null;
5512
+ try {
5513
+ const claims = JSON.parse(atob(payload.replace(/-/g, "+").replace(/_/g, "/")));
5514
+ return typeof claims.sk === "string" ? claims.sk.slice(0, 12) : null;
5515
+ } catch {
5516
+ return null;
5517
+ }
5518
+ }
5519
+
5520
+ // src/operations/profile.ts
5521
+ var profile_exports = {};
5522
+ __export(profile_exports, {
5523
+ updateProfile: () => updateProfile
5524
+ });
5525
+ async function updateProfile(arbi, body) {
5526
+ return requireData(
5527
+ await arbi.fetch.PATCH("/v1/user/profile", { body }),
5528
+ "Failed to update profile"
5529
+ );
5530
+ }
5531
+
5532
+ // src/operations/account.ts
5533
+ var account_exports = {};
5534
+ __export(account_exports, {
5535
+ confirmEmailChange: () => confirmEmailChange,
5536
+ requestDeletion: () => requestDeletion,
5537
+ requestEmailChange: () => requestEmailChange
5538
+ });
5539
+ async function requestEmailChange(arbi, newEmail) {
5540
+ requireOk(
5541
+ await arbi.fetch.POST("/v1/user/request-email-change", { body: { new_email: newEmail } }),
5542
+ "Failed to send the verification code"
5543
+ );
5544
+ }
5545
+ async function confirmEmailChange(arbi, newEmail, verificationCode) {
5546
+ return requireData(
5547
+ await arbi.fetch.POST("/v1/user/confirm-email-change", {
5548
+ body: { new_email: newEmail, verification_code: verificationCode }
5549
+ }),
5550
+ "Invalid or expired verification code"
5551
+ );
5552
+ }
5553
+ async function requestDeletion(arbi) {
5554
+ return requireData(await arbi.fetch.POST("/v1/user/request-deletion"), "Failed to delete account");
5555
+ }
5485
5556
 
5486
5557
  // src/operations/projects.ts
5487
5558
  var projects_exports = {};
@@ -5691,6 +5762,8 @@ function tokenExpiresWithin(token, seconds) {
5691
5762
  var Arbi = class {
5692
5763
  client = null;
5693
5764
  loginResult = null;
5765
+ userProfile = null;
5766
+ profileListeners = /* @__PURE__ */ new Set();
5694
5767
  currentWorkspaceId = null;
5695
5768
  dmCryptoContext = null;
5696
5769
  sessionExpiredListeners = /* @__PURE__ */ new Set();
@@ -5739,6 +5812,7 @@ var Arbi = class {
5739
5812
  async login(email, password) {
5740
5813
  const client = await this.init();
5741
5814
  this.loginResult = await client.auth.login({ email, password });
5815
+ this.userProfile = this.loginResult.profile ?? null;
5742
5816
  }
5743
5817
  /**
5744
5818
  * Recover a session using a stored signing private key (base64).
@@ -5748,6 +5822,7 @@ var Arbi = class {
5748
5822
  const client = await this.init();
5749
5823
  const signingPrivateKey = client.crypto.base64ToBytes(signingPrivateKeyBase64);
5750
5824
  this.loginResult = await client.auth.loginWithKey({ email, signingPrivateKey });
5825
+ this.userProfile = this.loginResult.profile ?? null;
5751
5826
  }
5752
5827
  /** A workspace's key, sealed to the caller's own session (what `/open` and `POST /workspace/users` take). */
5753
5828
  async sealWorkspaceKey(workspaceId) {
@@ -5807,6 +5882,7 @@ var Arbi = class {
5807
5882
  this.loginResult.serverSessionKey.fill(0);
5808
5883
  }
5809
5884
  this.loginResult = null;
5885
+ this.userProfile = null;
5810
5886
  this.currentWorkspaceId = null;
5811
5887
  this.dmCryptoContext = null;
5812
5888
  this.client?.session.clear();
@@ -5837,6 +5913,10 @@ var Arbi = class {
5837
5913
  return run();
5838
5914
  }
5839
5915
  }
5916
+ setUserProfile(profile) {
5917
+ this.userProfile = profile;
5918
+ for (const listener of [...this.profileListeners]) listener(profile);
5919
+ }
5840
5920
  /** Log out and clear internal state. */
5841
5921
  async logout() {
5842
5922
  if (this.client) {
@@ -5847,6 +5927,7 @@ var Arbi = class {
5847
5927
  this.loginResult.serverSessionKey.fill(0);
5848
5928
  }
5849
5929
  this.loginResult = null;
5930
+ this.userProfile = null;
5850
5931
  this.currentWorkspaceId = null;
5851
5932
  this.dmCryptoContext = null;
5852
5933
  }
@@ -5920,9 +6001,76 @@ var Arbi = class {
5920
6001
  const state = this.requireClient().session.getState();
5921
6002
  return state.userExtId ? { externalId: state.userExtId, email: state.userEmail ?? null } : null;
5922
6003
  },
6004
+ /**
6005
+ * The signed-in user's profile (name, picture, email, SSO flag) as the login response
6006
+ * carried it, kept current by `profile.update` and `account.confirmEmailChange`. `null` when
6007
+ * not logged in or when the session was restored without a login (then read the workspace
6008
+ * roster instead).
6009
+ */
6010
+ profile: () => this.userProfile,
6011
+ /** Be told when the profile changes (name, picture or email saved). Returns the unsubscribe. */
6012
+ onProfileChange: (listener) => {
6013
+ this.profileListeners.add(listener);
6014
+ return () => this.profileListeners.delete(listener);
6015
+ },
5923
6016
  /** Today's deployment-wide credit spend for the current user. */
5924
6017
  usageToday: () => getUserUsageToday(this.requireClient())
5925
6018
  };
6019
+ // ── Profile ───────────────────────────────────────────────────────────
6020
+ profile = {
6021
+ /** Update the display profile; pass only what changes (`''` clears family name or picture). */
6022
+ update: async (body) => {
6023
+ const updated = await updateProfile(this.requireClient(), body);
6024
+ if (this.userProfile) {
6025
+ this.setUserProfile({
6026
+ ...this.userProfile,
6027
+ givenName: updated.given_name ?? this.userProfile.givenName,
6028
+ familyName: updated.family_name ?? null,
6029
+ picture: updated.picture ?? null
6030
+ });
6031
+ }
6032
+ return updated;
6033
+ }
6034
+ };
6035
+ // ── Account ───────────────────────────────────────────────────────────
6036
+ account = {
6037
+ /** Send a verification code to the new address (not for SSO accounts). */
6038
+ requestEmailChange: (newEmail) => requestEmailChange(this.requireClient(), newEmail),
6039
+ /** Confirm the email change with the emailed code; the session and profile follow. */
6040
+ confirmEmailChange: async (newEmail, verificationCode) => {
6041
+ const client = this.requireClient();
6042
+ const result = await confirmEmailChange(client, newEmail, verificationCode);
6043
+ client.session.setUser(result.email, client.session.getState().userExtId ?? void 0);
6044
+ if (this.userProfile) this.setUserProfile({ ...this.userProfile, email: result.email });
6045
+ return result;
6046
+ },
6047
+ /**
6048
+ * Change (or, after recovery, set) the master password: re-keys the workspaces and direct
6049
+ * messages. Omit `currentPassword` in recovery mode. Resolves with the new signing key, whose
6050
+ * recovery file the user should save.
6051
+ */
6052
+ changePassword: async (params) => {
6053
+ const client = this.requireClient();
6054
+ const lr2 = this.requireLogin();
6055
+ const email = client.session.getState().userEmail ?? this.userProfile?.email;
6056
+ if (!email) throw new ArbiError("The account email is unknown; sign in again.");
6057
+ const result = await changePasswordWithRekey(
6058
+ { ...params, email, userExtId: lr2.userExtId },
6059
+ {
6060
+ fetchClient: client.fetch,
6061
+ deploymentDomain: this.options.deploymentDomain ?? new URL(this.options.url).hostname
6062
+ }
6063
+ );
6064
+ this.loginResult = { ...lr2, signingPrivateKey: result.newSigningPrivateKey };
6065
+ return result;
6066
+ },
6067
+ /** Close the account (soft delete) and sign out. Refused while a subscription is active. */
6068
+ requestDeletion: async () => {
6069
+ const result = await requestDeletion(this.requireClient());
6070
+ await this.logout();
6071
+ return result;
6072
+ }
6073
+ };
5926
6074
  // ── Workspaces ────────────────────────────────────────────────────────
5927
6075
  workspaces = {
5928
6076
  list: () => listWorkspaces(this.requireClient()),
@@ -6060,7 +6208,8 @@ var Arbi = class {
6060
6208
  question,
6061
6209
  docIds: options.docIds,
6062
6210
  previousResponseId: options.previousResponseId,
6063
- model: options.model
6211
+ model: options.model,
6212
+ signal: options.signal
6064
6213
  })
6065
6214
  );
6066
6215
  const callbacks = {
@@ -6308,7 +6457,16 @@ var Arbi = class {
6308
6457
  };
6309
6458
  // ── Sessions ────────────────────────────────────────────────────────
6310
6459
  sessions = {
6311
- list: () => listSessions(this.requireClient())
6460
+ list: () => listSessions(this.requireClient()),
6461
+ /** The id this device's session is listed under in `list()`; `null` when unknown. */
6462
+ currentId: () => currentSessionId(this.client?.session.getState().accessToken),
6463
+ /** End one of your own sessions now (not the one this device is on: that is `logout`). */
6464
+ terminate: (sessionId) => terminateSession(this.requireClient(), sessionId),
6465
+ /** Sign out of every device on the server, then clear this instance. */
6466
+ logoutAll: async () => {
6467
+ await logoutAllSessions(this.requireClient());
6468
+ await this.logout();
6469
+ }
6312
6470
  };
6313
6471
  // ── Internal guards ───────────────────────────────────────────────────
6314
6472
  requireClient() {
@@ -6394,6 +6552,6 @@ function extractResponseText(response) {
6394
6552
  return parts.join("");
6395
6553
  }
6396
6554
 
6397
- export { Arbi, ArbiApiError, ArbiError, WebSocketAuthError, agentconfig_exports as agentconfig, assistant_exports as assistant, authenticatedFetch, buildRetrievalChunkTool, buildRetrievalFullContextTool, buildRetrievalTocTool, connectWebSocket, connectWithReconnect, consumeSSEStream, contacts_exports as contacts, conversations_exports as conversations, countCitations, createAuthenticatedClient, dm_exports as dm, doctags_exports as doctags, documents_exports as documents, facts_exports as facts, files_exports as files, filterSkills, formatAgentStepLabel, formatFileSize, formatItemLabel, formatUserName, formatWorkspaceChoices, getErrorMessage, getRawWorkspaceKey, health_exports as health, parseSSEEvents, parseSlashCommand, parseSlashTokenInProgress, performPasswordLogin, projects_exports as projects, requireData, requireOk, resolveAuth, resolveCitations, resolveWorkspace, responses_exports as responses, selectWorkspace, selectWorkspaceById, settings_exports as settings, streamSSE, stripCitationMarkdown, summarizeCitations, tags_exports as tags, tasks_exports as tasks, workspaces_exports as workspaces };
6555
+ export { Arbi, ArbiApiError, ArbiError, WebSocketAuthError, account_exports as account, agentconfig_exports as agentconfig, assistant_exports as assistant, authenticatedFetch, buildRetrievalChunkTool, buildRetrievalFullContextTool, buildRetrievalTocTool, connectWebSocket, connectWithReconnect, consumeSSEStream, contacts_exports as contacts, conversations_exports as conversations, countCitations, createAuthenticatedClient, dm_exports as dm, doctags_exports as doctags, documents_exports as documents, facts_exports as facts, files_exports as files, filterSkills, formatAgentStepLabel, formatFileSize, formatItemLabel, formatUserName, formatWorkspaceChoices, getErrorMessage, getRawWorkspaceKey, health_exports as health, parseSSEEvents, parseSlashCommand, parseSlashTokenInProgress, performPasswordLogin, profile_exports as profile, projects_exports as projects, requireData, requireOk, resolveAuth, resolveCitations, resolveWorkspace, responses_exports as responses, selectWorkspace, selectWorkspaceById, sessions_exports as sessions, settings_exports as settings, streamSSE, stripCitationMarkdown, summarizeCitations, tags_exports as tags, tasks_exports as tasks, workspaces_exports as workspaces };
6398
6556
  //# sourceMappingURL=browser.js.map
6399
6557
  //# sourceMappingURL=browser.js.map