@arbidocs/sdk 0.3.118 → 0.3.120

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.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { o as ConfigStore, l as CliConfig, m as CliCredentials, C as ChatSession, a6 as SkippedFile, ae as UploadResult, i as AuthHeaders, aa as UploadBatchResult, ad as UploadOptions, ab as UploadDirectOptions, ac as UploadDirectResult, a4 as SUPPORTED_EXTENSIONS, s as DmCryptoContext } from './browser-CxTSIAhf.cjs';
2
- export { a as AgentStepEvent, b as Arbi, c as ArbiApiError, d as ArbiError, f as ArbiOptions, g as ArtifactEvent, h as AuthContext, j as AuthenticatedClient, k as CitationSummary, n as CommandDescriptor, p as ConnectOptions, D as DOC_TERMINAL_STATUSES, t as DocNameMap, u as DocumentListFields, v as DocumentListOrder, w as DocumentWaiter, x as DocumentWaiterOptions, F as FormattedWsMessage, L as ListAllOptions, y as ListPaginatedOptions, E as MessageLevel, G as MessageMetadataPayload, H as MessageQueuedEvent, O as OutputTokensDetails, P as ParsedSlashCommand, I as ProjectInvoicesResponse, J as ProjectUsageResponse, Q as QueryOptions, R as ReconnectOptions, K as ReconnectableWsConnection, N as ResolvedCitation, S as ResolvedRecipient, T as ResponseCompletedEvent, U as ResponseContentPartAddedEvent, V as ResponseCreatedEvent, W as ResponseFailedEvent, X as ResponseOutputItemAddedEvent, Y as ResponseOutputItemDoneEvent, Z as ResponseOutputTextDeltaEvent, _ as ResponseOutputTextDoneEvent, $ as ResponseUsage, a0 as SSEEvent, a1 as SSEStreamCallbacks, a2 as SSEStreamResult, a3 as SSEStreamStartData, a5 as SkillSummary, af as UserDailyUsageResponse, ag as UserInfo, ah as UserInputRequestEvent, ai as UserMessageEvent, aj as WebSocketAuthError, ak as WorkspaceChronologyOut, al as WorkspaceContext, am as WsConnection, an as agentconfig, ao as assistant, ap as authenticatedFetch, aq as buildRetrievalChunkTool, ar as buildRetrievalFullContextTool, as as buildRetrievalTocTool, at as connectWebSocket, au as connectWithReconnect, av as consumeSSEStream, aw as contacts, ax as conversations, ay as countCitations, az as createAuthenticatedClient, aA as createDocumentWaiter, aB as dm, aC as doctags, aD as documents, aE as files, aF as filterSkills, aG as formatAgentStepLabel, aH as formatFileSize, aI as formatStreamSummary, aJ as formatUserName, aK as formatWorkspaceChoices, aL as formatWsMessage, aM as generateEncryptedWorkspaceKey, aN as generateNewWorkspaceKey, aO as getErrorCode, aP as getErrorMessage, aQ as getRawWorkspaceKey, aR as health, aT as parseSSEEvents, aU as parseSlashCommand, aV as parseSlashTokenInProgress, aW as performPasswordLogin, aX as performSigningKeyLogin, aY as performSsoDeviceFlowLogin, aZ as projects, a_ as requireData, a$ as requireOk, b0 as resolveAuth, b1 as resolveCitations, b2 as resolveWorkspace, b3 as responses, b4 as selectWorkspace, b5 as selectWorkspaceById, b6 as settings, b7 as streamSSE, b8 as stripCitationMarkdown, b9 as summarizeCitations, ba as tags, bc as workspaces } from './browser-CxTSIAhf.cjs';
1
+ import { o as ConfigStore, l as CliConfig, m as CliCredentials, C as ChatSession, a6 as SkippedFile, ae as UploadResult, i as AuthHeaders, aa as UploadBatchResult, ad as UploadOptions, ab as UploadDirectOptions, ac as UploadDirectResult, a4 as SUPPORTED_EXTENSIONS, s as DmCryptoContext } from './browser-BUspHdyk.cjs';
2
+ export { a as AgentStepEvent, b as Arbi, c as ArbiApiError, d as ArbiError, f as ArbiOptions, g as ArtifactEvent, h as AuthContext, j as AuthenticatedClient, k as CitationSummary, n as CommandDescriptor, p as ConnectOptions, D as DOC_TERMINAL_STATUSES, t as DocNameMap, u as DocumentListFields, v as DocumentListOrder, w as DocumentWaiter, x as DocumentWaiterOptions, F as FormattedWsMessage, L as ListAllOptions, y as ListPaginatedOptions, E as MessageLevel, G as MessageMetadataPayload, H as MessageQueuedEvent, O as OutputTokensDetails, P as ParsedSlashCommand, I as ProjectInvoicesResponse, J as ProjectUsageResponse, Q as QueryOptions, R as ReconnectOptions, K as ReconnectableWsConnection, N as ResolvedCitation, S as ResolvedRecipient, T as ResponseCompletedEvent, U as ResponseContentPartAddedEvent, V as ResponseCreatedEvent, W as ResponseFailedEvent, X as ResponseOutputItemAddedEvent, Y as ResponseOutputItemDoneEvent, Z as ResponseOutputTextDeltaEvent, _ as ResponseOutputTextDoneEvent, $ as ResponseUsage, a0 as SSEEvent, a1 as SSEStreamCallbacks, a2 as SSEStreamResult, a3 as SSEStreamStartData, a5 as SkillSummary, af as UserDailyUsageResponse, ag as UserInfo, ah as UserInputRequestEvent, ai as UserMessageEvent, aj as WebSocketAuthError, ak as WorkspaceChronologyOut, al as WorkspaceContext, am as WsConnection, an as agentconfig, ao as assistant, ap as authenticatedFetch, aq as buildRetrievalChunkTool, ar as buildRetrievalFullContextTool, as as buildRetrievalTocTool, at as connectWebSocket, au as connectWithReconnect, av as consumeSSEStream, aw as contacts, ax as conversations, ay as countCitations, az as createAuthenticatedClient, aA as createDocumentWaiter, aB as dm, aC as doctags, aD as documents, aE as files, aF as filterSkills, aG as formatAgentStepLabel, aH as formatFileSize, aI as formatStreamSummary, aJ as formatUserName, aK as formatWorkspaceChoices, aL as formatWsMessage, aM as generateEncryptedWorkspaceKey, aN as generateNewWorkspaceKey, aO as getErrorCode, aP as getErrorMessage, aQ as getRawWorkspaceKey, aR as health, aT as parseSSEEvents, aU as parseSlashCommand, aV as parseSlashTokenInProgress, aW as performPasswordLogin, aX as performSigningKeyLogin, aY as performSsoDeviceFlowLogin, aZ as projects, a_ as requireData, a$ as requireOk, b0 as resolveAuth, b1 as resolveCitations, b2 as resolveWorkspace, b3 as responses, b4 as selectWorkspace, b5 as selectWorkspaceById, b6 as settings, b7 as streamSSE, b8 as stripCitationMarkdown, b9 as summarizeCitations, ba as tags, bb as tasks, bc as workspaces } from './browser-BUspHdyk.cjs';
3
3
  import { SessionStorageProvider, ArbiClient, components } from '@arbidocs/client';
4
4
 
5
5
  /**
@@ -696,6 +696,28 @@ declare namespace sessions {
696
696
  export { sessions_listSessions as listSessions };
697
697
  }
698
698
 
699
+ /**
700
+ * User profile operations — the current user's display identity.
701
+ */
702
+
703
+ type UpdateProfileRequest = components['schemas']['UpdateProfileRequest'];
704
+ /**
705
+ * Update the signed-in user's profile. Fields are optional — pass only what
706
+ * changes (e.g. `given_name`, `family_name`, `picture`).
707
+ */
708
+ declare function updateProfile(arbi: ArbiClient, body: UpdateProfileRequest): Promise<{
709
+ given_name: string;
710
+ family_name?: string | null | undefined;
711
+ email: string;
712
+ picture?: string | null | undefined;
713
+ }>;
714
+
715
+ type profile_UpdateProfileRequest = UpdateProfileRequest;
716
+ declare const profile_updateProfile: typeof updateProfile;
717
+ declare namespace profile {
718
+ export { type profile_UpdateProfileRequest as UpdateProfileRequest, profile_updateProfile as updateProfile };
719
+ }
720
+
699
721
  /**
700
722
  * Orchestrator interface for `arbi listen`.
701
723
  *
@@ -873,4 +895,4 @@ declare namespace index {
873
895
  export { index_ClaudeOrchestrator as ClaudeOrchestrator, type index_ClaudeOrchestratorOptions as ClaudeOrchestratorOptions, type index_DmListener as DmListener, type index_DmListenerOptions as DmListenerOptions, index_OpenClawOrchestrator as OpenClawOrchestrator, type index_OpenClawOrchestratorOptions as OpenClawOrchestratorOptions, type index_Orchestrator as Orchestrator, type index_PromptContext as PromptContext, index_startDmListener as startDmListener };
874
896
  }
875
897
 
876
- export { AuthHeaders, ChatSession, ClaudeOrchestrator, type ClaudeOrchestratorOptions, CliConfig, CliCredentials, ConfigStore, DmCryptoContext, type DmListener, type DmListenerOptions, FileConfigStore, OpenClawOrchestrator, type OpenClawOrchestratorOptions, type Orchestrator, type PromptContext, agents, deviceFlow, documentsNode, index as listen, sessions, startDmListener };
898
+ export { AuthHeaders, ChatSession, ClaudeOrchestrator, type ClaudeOrchestratorOptions, CliConfig, CliCredentials, ConfigStore, DmCryptoContext, type DmListener, type DmListenerOptions, FileConfigStore, OpenClawOrchestrator, type OpenClawOrchestratorOptions, type Orchestrator, type PromptContext, agents, deviceFlow, documentsNode, index as listen, profile, sessions, startDmListener };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { o as ConfigStore, l as CliConfig, m as CliCredentials, C as ChatSession, a6 as SkippedFile, ae as UploadResult, i as AuthHeaders, aa as UploadBatchResult, ad as UploadOptions, ab as UploadDirectOptions, ac as UploadDirectResult, a4 as SUPPORTED_EXTENSIONS, s as DmCryptoContext } from './browser-CxTSIAhf.js';
2
- export { a as AgentStepEvent, b as Arbi, c as ArbiApiError, d as ArbiError, f as ArbiOptions, g as ArtifactEvent, h as AuthContext, j as AuthenticatedClient, k as CitationSummary, n as CommandDescriptor, p as ConnectOptions, D as DOC_TERMINAL_STATUSES, t as DocNameMap, u as DocumentListFields, v as DocumentListOrder, w as DocumentWaiter, x as DocumentWaiterOptions, F as FormattedWsMessage, L as ListAllOptions, y as ListPaginatedOptions, E as MessageLevel, G as MessageMetadataPayload, H as MessageQueuedEvent, O as OutputTokensDetails, P as ParsedSlashCommand, I as ProjectInvoicesResponse, J as ProjectUsageResponse, Q as QueryOptions, R as ReconnectOptions, K as ReconnectableWsConnection, N as ResolvedCitation, S as ResolvedRecipient, T as ResponseCompletedEvent, U as ResponseContentPartAddedEvent, V as ResponseCreatedEvent, W as ResponseFailedEvent, X as ResponseOutputItemAddedEvent, Y as ResponseOutputItemDoneEvent, Z as ResponseOutputTextDeltaEvent, _ as ResponseOutputTextDoneEvent, $ as ResponseUsage, a0 as SSEEvent, a1 as SSEStreamCallbacks, a2 as SSEStreamResult, a3 as SSEStreamStartData, a5 as SkillSummary, af as UserDailyUsageResponse, ag as UserInfo, ah as UserInputRequestEvent, ai as UserMessageEvent, aj as WebSocketAuthError, ak as WorkspaceChronologyOut, al as WorkspaceContext, am as WsConnection, an as agentconfig, ao as assistant, ap as authenticatedFetch, aq as buildRetrievalChunkTool, ar as buildRetrievalFullContextTool, as as buildRetrievalTocTool, at as connectWebSocket, au as connectWithReconnect, av as consumeSSEStream, aw as contacts, ax as conversations, ay as countCitations, az as createAuthenticatedClient, aA as createDocumentWaiter, aB as dm, aC as doctags, aD as documents, aE as files, aF as filterSkills, aG as formatAgentStepLabel, aH as formatFileSize, aI as formatStreamSummary, aJ as formatUserName, aK as formatWorkspaceChoices, aL as formatWsMessage, aM as generateEncryptedWorkspaceKey, aN as generateNewWorkspaceKey, aO as getErrorCode, aP as getErrorMessage, aQ as getRawWorkspaceKey, aR as health, aT as parseSSEEvents, aU as parseSlashCommand, aV as parseSlashTokenInProgress, aW as performPasswordLogin, aX as performSigningKeyLogin, aY as performSsoDeviceFlowLogin, aZ as projects, a_ as requireData, a$ as requireOk, b0 as resolveAuth, b1 as resolveCitations, b2 as resolveWorkspace, b3 as responses, b4 as selectWorkspace, b5 as selectWorkspaceById, b6 as settings, b7 as streamSSE, b8 as stripCitationMarkdown, b9 as summarizeCitations, ba as tags, bc as workspaces } from './browser-CxTSIAhf.js';
1
+ import { o as ConfigStore, l as CliConfig, m as CliCredentials, C as ChatSession, a6 as SkippedFile, ae as UploadResult, i as AuthHeaders, aa as UploadBatchResult, ad as UploadOptions, ab as UploadDirectOptions, ac as UploadDirectResult, a4 as SUPPORTED_EXTENSIONS, s as DmCryptoContext } from './browser-BUspHdyk.js';
2
+ export { a as AgentStepEvent, b as Arbi, c as ArbiApiError, d as ArbiError, f as ArbiOptions, g as ArtifactEvent, h as AuthContext, j as AuthenticatedClient, k as CitationSummary, n as CommandDescriptor, p as ConnectOptions, D as DOC_TERMINAL_STATUSES, t as DocNameMap, u as DocumentListFields, v as DocumentListOrder, w as DocumentWaiter, x as DocumentWaiterOptions, F as FormattedWsMessage, L as ListAllOptions, y as ListPaginatedOptions, E as MessageLevel, G as MessageMetadataPayload, H as MessageQueuedEvent, O as OutputTokensDetails, P as ParsedSlashCommand, I as ProjectInvoicesResponse, J as ProjectUsageResponse, Q as QueryOptions, R as ReconnectOptions, K as ReconnectableWsConnection, N as ResolvedCitation, S as ResolvedRecipient, T as ResponseCompletedEvent, U as ResponseContentPartAddedEvent, V as ResponseCreatedEvent, W as ResponseFailedEvent, X as ResponseOutputItemAddedEvent, Y as ResponseOutputItemDoneEvent, Z as ResponseOutputTextDeltaEvent, _ as ResponseOutputTextDoneEvent, $ as ResponseUsage, a0 as SSEEvent, a1 as SSEStreamCallbacks, a2 as SSEStreamResult, a3 as SSEStreamStartData, a5 as SkillSummary, af as UserDailyUsageResponse, ag as UserInfo, ah as UserInputRequestEvent, ai as UserMessageEvent, aj as WebSocketAuthError, ak as WorkspaceChronologyOut, al as WorkspaceContext, am as WsConnection, an as agentconfig, ao as assistant, ap as authenticatedFetch, aq as buildRetrievalChunkTool, ar as buildRetrievalFullContextTool, as as buildRetrievalTocTool, at as connectWebSocket, au as connectWithReconnect, av as consumeSSEStream, aw as contacts, ax as conversations, ay as countCitations, az as createAuthenticatedClient, aA as createDocumentWaiter, aB as dm, aC as doctags, aD as documents, aE as files, aF as filterSkills, aG as formatAgentStepLabel, aH as formatFileSize, aI as formatStreamSummary, aJ as formatUserName, aK as formatWorkspaceChoices, aL as formatWsMessage, aM as generateEncryptedWorkspaceKey, aN as generateNewWorkspaceKey, aO as getErrorCode, aP as getErrorMessage, aQ as getRawWorkspaceKey, aR as health, aT as parseSSEEvents, aU as parseSlashCommand, aV as parseSlashTokenInProgress, aW as performPasswordLogin, aX as performSigningKeyLogin, aY as performSsoDeviceFlowLogin, aZ as projects, a_ as requireData, a$ as requireOk, b0 as resolveAuth, b1 as resolveCitations, b2 as resolveWorkspace, b3 as responses, b4 as selectWorkspace, b5 as selectWorkspaceById, b6 as settings, b7 as streamSSE, b8 as stripCitationMarkdown, b9 as summarizeCitations, ba as tags, bb as tasks, bc as workspaces } from './browser-BUspHdyk.js';
3
3
  import { SessionStorageProvider, ArbiClient, components } from '@arbidocs/client';
4
4
 
5
5
  /**
@@ -696,6 +696,28 @@ declare namespace sessions {
696
696
  export { sessions_listSessions as listSessions };
697
697
  }
698
698
 
699
+ /**
700
+ * User profile operations — the current user's display identity.
701
+ */
702
+
703
+ type UpdateProfileRequest = components['schemas']['UpdateProfileRequest'];
704
+ /**
705
+ * Update the signed-in user's profile. Fields are optional — pass only what
706
+ * changes (e.g. `given_name`, `family_name`, `picture`).
707
+ */
708
+ declare function updateProfile(arbi: ArbiClient, body: UpdateProfileRequest): Promise<{
709
+ given_name: string;
710
+ family_name?: string | null | undefined;
711
+ email: string;
712
+ picture?: string | null | undefined;
713
+ }>;
714
+
715
+ type profile_UpdateProfileRequest = UpdateProfileRequest;
716
+ declare const profile_updateProfile: typeof updateProfile;
717
+ declare namespace profile {
718
+ export { type profile_UpdateProfileRequest as UpdateProfileRequest, profile_updateProfile as updateProfile };
719
+ }
720
+
699
721
  /**
700
722
  * Orchestrator interface for `arbi listen`.
701
723
  *
@@ -873,4 +895,4 @@ declare namespace index {
873
895
  export { index_ClaudeOrchestrator as ClaudeOrchestrator, type index_ClaudeOrchestratorOptions as ClaudeOrchestratorOptions, type index_DmListener as DmListener, type index_DmListenerOptions as DmListenerOptions, index_OpenClawOrchestrator as OpenClawOrchestrator, type index_OpenClawOrchestratorOptions as OpenClawOrchestratorOptions, type index_Orchestrator as Orchestrator, type index_PromptContext as PromptContext, index_startDmListener as startDmListener };
874
896
  }
875
897
 
876
- export { AuthHeaders, ChatSession, ClaudeOrchestrator, type ClaudeOrchestratorOptions, CliConfig, CliCredentials, ConfigStore, DmCryptoContext, type DmListener, type DmListenerOptions, FileConfigStore, OpenClawOrchestrator, type OpenClawOrchestratorOptions, type Orchestrator, type PromptContext, agents, deviceFlow, documentsNode, index as listen, sessions, startDmListener };
898
+ export { AuthHeaders, ChatSession, ClaudeOrchestrator, type ClaudeOrchestratorOptions, CliConfig, CliCredentials, ConfigStore, DmCryptoContext, type DmListener, type DmListenerOptions, FileConfigStore, OpenClawOrchestrator, type OpenClawOrchestratorOptions, type Orchestrator, type PromptContext, agents, deviceFlow, documentsNode, index as listen, profile, sessions, startDmListener };
package/dist/index.js CHANGED
@@ -5761,6 +5761,7 @@ async function resolveRecipient(arbi, ref) {
5761
5761
  return null;
5762
5762
  }
5763
5763
  async function sendEncryptedDM(arbi, messages, crypto) {
5764
+ const plaintextFor = new Map(messages.map((m2) => [m2.recipient_ext_id, m2.content]));
5764
5765
  const encrypted = await Promise.all(
5765
5766
  messages.map(async (msg) => ({
5766
5767
  recipient_ext_id: msg.recipient_ext_id,
@@ -5772,10 +5773,14 @@ async function sendEncryptedDM(arbi, messages, crypto) {
5772
5773
  )
5773
5774
  }))
5774
5775
  );
5775
- return requireData(
5776
+ const created = requireData(
5776
5777
  await arbi.fetch.POST("/v1/notifications/", { body: { messages: encrypted } }),
5777
5778
  "Failed to send message"
5778
5779
  );
5780
+ return created.map((n2) => ({
5781
+ ...n2,
5782
+ content: plaintextFor.get(n2.recipient.external_id) ?? n2.content
5783
+ }));
5779
5784
  }
5780
5785
  async function requestWorkspaceAccess(arbi, params, crypto) {
5781
5786
  const payload = JSON.stringify({
@@ -5969,11 +5974,14 @@ async function listSessions(arbi) {
5969
5974
  var projects_exports = {};
5970
5975
  __export(projects_exports, {
5971
5976
  createProject: () => createProject,
5977
+ deleteProject: () => deleteProject,
5972
5978
  getProjectInvoices: () => getProjectInvoices,
5973
5979
  getProjectUsage: () => getProjectUsage,
5974
5980
  getUserUsageToday: () => getUserUsageToday,
5975
5981
  listProjects: () => listProjects,
5976
- refreshProject: () => refreshProject
5982
+ refreshProject: () => refreshProject,
5983
+ renameProject: () => renameProject,
5984
+ updateProject: () => updateProject
5977
5985
  });
5978
5986
  async function listProjects(arbi) {
5979
5987
  return requireData(await arbi.fetch.GET("/v1/user/projects/"), "Failed to fetch projects");
@@ -5986,6 +5994,26 @@ async function createProject(arbi, name) {
5986
5994
  "Failed to create project"
5987
5995
  );
5988
5996
  }
5997
+ async function updateProject(arbi, projectExtId, body) {
5998
+ return requireData(
5999
+ await arbi.fetch.PATCH("/v1/user/projects/{project_ext_id}", {
6000
+ params: { path: { project_ext_id: projectExtId } },
6001
+ body
6002
+ }),
6003
+ "Failed to update project"
6004
+ );
6005
+ }
6006
+ async function renameProject(arbi, projectExtId, name) {
6007
+ return updateProject(arbi, projectExtId, { name });
6008
+ }
6009
+ async function deleteProject(arbi, projectExtId) {
6010
+ requireOk(
6011
+ await arbi.fetch.DELETE("/v1/user/projects/{project_ext_id}", {
6012
+ params: { path: { project_ext_id: projectExtId } }
6013
+ }),
6014
+ "Failed to delete project"
6015
+ );
6016
+ }
5989
6017
  async function refreshProject(arbi, projectExtId) {
5990
6018
  return requireData(
5991
6019
  await arbi.fetch.POST("/v1/user/projects/{project_ext_id}/refresh", {
@@ -6018,6 +6046,15 @@ async function getUserUsageToday(arbi) {
6018
6046
  }
6019
6047
 
6020
6048
  // src/operations/tasks.ts
6049
+ var tasks_exports = {};
6050
+ __export(tasks_exports, {
6051
+ createTask: () => createTask,
6052
+ deleteTask: () => deleteTask,
6053
+ getTask: () => getTask,
6054
+ listTasks: () => listTasks,
6055
+ runTask: () => runTask,
6056
+ updateTask: () => updateTask
6057
+ });
6021
6058
  async function listTasks(arbi) {
6022
6059
  return requireData(await arbi.fetch.GET("/v1/tasks"), "Failed to list tasks");
6023
6060
  }
@@ -6236,13 +6273,19 @@ var Arbi = class {
6236
6273
  user = {
6237
6274
  /**
6238
6275
  * The authenticated user's identity from the current session
6239
- * (`external_id` + `email`), established at login. Returns `null` when not
6240
- * logged in. This is the canonical "who am I" accessor — DM direction and
6241
- * ownership checks read it instead of re-deriving identity per call.
6276
+ * (`external_id`, plus `email` when the session carries one), established at
6277
+ * login. Returns `null` when not logged in. This is the canonical "who am I"
6278
+ * accessor — DM direction and ownership checks read it instead of re-deriving
6279
+ * identity per call.
6280
+ *
6281
+ * The external_id alone decides identity. A session without an email (e.g. an
6282
+ * agent, or a key-restored session) is still a known user, so `email` is
6283
+ * nullable rather than gating the whole identity: an ownership check must
6284
+ * never silently fail open just because the email is missing.
6242
6285
  */
6243
6286
  identity: () => {
6244
6287
  const state = this.requireClient().session.getState();
6245
- return state.userExtId && state.userEmail ? { externalId: state.userExtId, email: state.userEmail } : null;
6288
+ return state.userExtId ? { externalId: state.userExtId, email: state.userEmail ?? null } : null;
6246
6289
  },
6247
6290
  /** Today's deployment-wide credit spend for the current user. */
6248
6291
  usageToday: () => getUserUsageToday(this.requireClient())
@@ -6430,23 +6473,31 @@ var Arbi = class {
6430
6473
  /**
6431
6474
  * Build (and cache) the DM crypto context for the current session.
6432
6475
  *
6433
- * Derives the user's curve25519 keypair from the stored signing key and pairs
6434
- * it with their external_id — everything `list()`/`send()` need to encrypt and
6476
+ * Derives the user's curve25519 keypair from their signing key and pairs it
6477
+ * with their external_id — everything `list()`/`send()` need to encrypt and
6435
6478
  * decrypt. Cached for the session and cleared on logout. Consumers never touch
6436
6479
  * this: it's an internal of the `dm` surface.
6480
+ *
6481
+ * The key comes from the live login result first, exactly as `selectWorkspace`
6482
+ * sources it, and only then from persisted storage (which is what restores a
6483
+ * session on reload). Reading storage first would make DMs the one feature that
6484
+ * breaks whenever persistence is unavailable — `saveSession` deliberately
6485
+ * no-ops without Web Crypto (a non-secure origin, tracking prevention, an
6486
+ * embedded widget), so a perfectly authenticated user with a working workspace
6487
+ * would be told they are "not authenticated" the moment they opened Messages.
6437
6488
  */
6438
6489
  async requireDmCrypto() {
6439
6490
  if (this.dmCryptoContext) return this.dmCryptoContext;
6440
6491
  const client = this.requireClient();
6441
- const session = await client.storage.getSession();
6442
- if (!session) {
6492
+ const signingPrivateKey = this.loginResult?.signingPrivateKey ?? (await client.storage.getSession())?.signingPrivateKey;
6493
+ if (!signingPrivateKey) {
6443
6494
  throw new ArbiError("Not authenticated \u2014 no session available for DM encryption");
6444
6495
  }
6445
6496
  const userExtId = client.session.getState().userExtId;
6446
6497
  if (!userExtId) {
6447
6498
  throw new ArbiError("No user identity in session \u2014 cannot set up DM encryption");
6448
6499
  }
6449
- this.dmCryptoContext = createDmCryptoContext(client, session.signingPrivateKey, userExtId);
6500
+ this.dmCryptoContext = createDmCryptoContext(client, signingPrivateKey, userExtId);
6450
6501
  return this.dmCryptoContext;
6451
6502
  }
6452
6503
  dm = {
@@ -7389,6 +7440,18 @@ function extractResponseText(response) {
7389
7440
  return parts.join("");
7390
7441
  }
7391
7442
 
7443
+ // src/operations/profile.ts
7444
+ var profile_exports = {};
7445
+ __export(profile_exports, {
7446
+ updateProfile: () => updateProfile
7447
+ });
7448
+ async function updateProfile(arbi, body) {
7449
+ return requireData(
7450
+ await arbi.fetch.PATCH("/v1/user/profile", { body }),
7451
+ "Failed to update profile"
7452
+ );
7453
+ }
7454
+
7392
7455
  // src/listen/index.ts
7393
7456
  var listen_exports = {};
7394
7457
  __export(listen_exports, {
@@ -7691,6 +7754,6 @@ async function startDmListener(options) {
7691
7754
  };
7692
7755
  }
7693
7756
 
7694
- export { Arbi, ArbiApiError, ArbiError, ClaudeOrchestrator, DOC_TERMINAL_STATUSES, FileConfigStore, OpenClawOrchestrator, WebSocketAuthError, agentconfig_exports as agentconfig, agents_exports as agents, assistant_exports as assistant, authenticatedFetch, buildRetrievalChunkTool, buildRetrievalFullContextTool, buildRetrievalTocTool, connectWebSocket, connectWithReconnect, consumeSSEStream, contacts_exports as contacts, conversations_exports as conversations, countCitations, createAuthenticatedClient, createDocumentWaiter, device_flow_exports as deviceFlow, dm_exports as dm, doctags_exports as doctags, documents_exports as documents, documents_node_exports as documentsNode, files_exports as files, filterSkills, formatAgentStepLabel, formatFileSize, formatStreamSummary, formatUserName, formatWorkspaceChoices, formatWsMessage, generateEncryptedWorkspaceKey, generateNewWorkspaceKey, getErrorCode, getErrorMessage, getRawWorkspaceKey, health_exports as health, listen_exports as listen, parseSSEEvents, parseSlashCommand, parseSlashTokenInProgress, performPasswordLogin, performSigningKeyLogin, performSsoDeviceFlowLogin, projects_exports as projects, requireData, requireOk, resolveAuth, resolveCitations, resolveWorkspace, responses_exports as responses, selectWorkspace, selectWorkspaceById, sessions_exports as sessions, settings_exports as settings, startDmListener, streamSSE, stripCitationMarkdown, summarizeCitations, tags_exports as tags, workspaces_exports as workspaces };
7757
+ export { Arbi, ArbiApiError, ArbiError, ClaudeOrchestrator, DOC_TERMINAL_STATUSES, FileConfigStore, OpenClawOrchestrator, WebSocketAuthError, agentconfig_exports as agentconfig, agents_exports as agents, assistant_exports as assistant, authenticatedFetch, buildRetrievalChunkTool, buildRetrievalFullContextTool, buildRetrievalTocTool, connectWebSocket, connectWithReconnect, consumeSSEStream, contacts_exports as contacts, conversations_exports as conversations, countCitations, createAuthenticatedClient, createDocumentWaiter, device_flow_exports as deviceFlow, dm_exports as dm, doctags_exports as doctags, documents_exports as documents, documents_node_exports as documentsNode, files_exports as files, filterSkills, formatAgentStepLabel, formatFileSize, formatStreamSummary, formatUserName, formatWorkspaceChoices, formatWsMessage, generateEncryptedWorkspaceKey, generateNewWorkspaceKey, getErrorCode, getErrorMessage, getRawWorkspaceKey, health_exports as health, listen_exports as listen, parseSSEEvents, parseSlashCommand, parseSlashTokenInProgress, performPasswordLogin, performSigningKeyLogin, performSsoDeviceFlowLogin, 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, startDmListener, streamSSE, stripCitationMarkdown, summarizeCitations, tags_exports as tags, tasks_exports as tasks, workspaces_exports as workspaces };
7695
7758
  //# sourceMappingURL=index.js.map
7696
7759
  //# sourceMappingURL=index.js.map