@arbidocs/sdk 0.4.128 → 0.4.130

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- export { A as ActivityKind, a as ActivityResponse, b as AgentControlStateEvent, c as AgentStepDeltaEvent, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, h as ArbiErrorEvent, i as ArbiOptions, k as ArtifactEvent, l as AuthContext, m as AuthHeaders, n as AuthMode, o as AuthenticatedClient, C as ChatAttachmentFile, p as ChatAttachmentInput, q as ChatCryptoContext, r as ChatKeyRing, s as ChatKind, t as ChatMemberKey, u as ChatMemberResponse, v as ChatMessageResponse, w as ChatResponse, x as ChatSession, y as CitationSummary, z as CliConfig, B as CliCredentials, D as CommandDescriptor, E as ConfigStore, F as ConnectOptions, G as ConversationResponse, H as ConversationUsageResponse, I as CreateFactRequest, J as CreateFactsRequest, K as CreateWorkRequest, L as CreateWorkflowRequest, M as DEFAULT_AI_USD_PER_GBP, P as DecryptedChatMessage, Q as DeferredInterjectionEvent, S as DocumentAutomationAction, V as DocumentSelector, Y as FactResponse, Z as FactSearchRequest, _ as FactSearchResponse, a0 as IdentityErrorCode, a1 as IdentityPurchase, a2 as IdentityState, a3 as IdentityStatus, a4 as LinkedRun, a6 as ListFactsOptions, a9 as MailDraftSSEEvent, ab as MessageMetadataPayload, ac as MessageQueuedEvent, ad as OutputTokensDetails, ae as ParsedSlashCommand, af as PendingAuthResponse, ag as PlanStepsError, ah as PlanWorkRequest, ai as ProbeAnswerEvent, aj as ProjectBudget, ak as ProjectConversationUsageResponse, al as ProjectDetails, am as ProjectEventKind, an as ProjectEventResponse, ao as ProjectInvoicesResponse, ap as ProjectResponse, aq as ProjectUpdateRequest, ar as ProjectUsageResponse, as as QueryOptions, at as RaisedSignal, au as ReconnectOptions, av as ReconnectableWsConnection, aw as ResolvedCitation, ay as ResponseCompletedEvent, az as ResponseContentPartAddedEvent, aA as ResponseCreatedEvent, aB as ResponseFailedEvent, aC as ResponseOutputItemAddedEvent, aD as ResponseOutputItemDoneEvent, aE as ResponseOutputTextDeltaEvent, aF as ResponseOutputTextDoneEvent, aG as ResponseUsage, aH as RunProgress, aI as RunStep, aJ as RunWaitingOn, aK as SSEEvent, aL as SSEStreamCallbacks, aM as SSEStreamResult, aN as SSEStreamStartData, aQ as SendBack, aR as SkillSummary, aT as StepActionRequest, aU as StepActivityEvent, aV as StepAssignee, aW as StepField, aZ as StepKind, a_ as StepPhase, a$ as StepSignal, b0 as StepSignalWhen, b1 as StepState, b2 as StepStatus, b3 as SubmitBackgroundQueryOptions, b4 as TagChange, b5 as TagFieldDefinition, b6 as TagKind, b7 as TagKindField, b8 as TagKindSchema, b9 as TagLinks, ba as TagListQuery, bb as TagResponse, bc as TaskPlan, bd as TaskPlanStep, be as TokenBudgetContext, bf as UpdateConversationRequest, bg as UpdateFactRequest, bh as UpdateWorkflowRequest, bn as UsageBreakdown, bo as UserDailyUsageResponse, bp as UserInfo, bq as UserInputRequestEvent, br as UserMessageEvent, bs as WebSocketAuthError, bt as WorkStatus, bu as WorkflowAuthMode, bv as WorkflowResponse, bw as WorkflowRunHistoryResponse, bx as WorkflowRunResponse, by as WorkspaceContext, bz as WsConnection, bA as account, bB as agentconfig, bD as assistant, bE as authenticatedFetch, bG as buildFactsContextTool, bH as buildRetrievalChunkTool, bI as buildRetrievalFullContextTool, bJ as buildRetrievalTocTool, bK as chats, bL as connectWebSocket, bM as connectWithReconnect, bN as consumeSSEStream, bO as contacts, bP as conversations, bQ as countCitations, bR as createAuthenticatedClient, bT as doctags, bU as documents, bV as facts, bW as files, bX as filterSkills, bY as formatAgentStepLabel, bZ as formatFileSize, b_ as formatGbp, b$ as formatGbpPerMillionTokens, c0 as formatItemLabel, c2 as formatUserName, c3 as formatWorkspaceChoices, c8 as getErrorMessage, c9 as getRawWorkspaceKey, ca as health, cc as identityErrorCode, cb as identityVerification, cd as mail, ce as notifications, cf as parseSSEEvents, cg as parseSlashCommand, ch as parseSlashTokenInProgress, ci as performPasswordLogin, cl as profile, cm as projects, cn as requireData, co as requireOk, cp as resolveAuth, cq as resolveCitations, cr as resolveWorkspace, cs as responses, ct as selectWorkspace, cu as selectWorkspaceById, cv as sessions, cw as settings, cy as streamSSE, cz as stripCitationMarkdown, cA as summarizeCitations, cB as tags, cC as usdToGbp, cD as work, cE as workflowSteps, cF as workflows, cG as workspaces } from './browser-Ds-drrLp.cjs';
1
+ export { A as ActivityKind, a as ActivityResponse, b as AgentControlStateEvent, c as AgentStepDeltaEvent, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, h as ArbiErrorEvent, i as ArbiOptions, k as ArtifactEvent, l as AuthContext, m as AuthHeaders, n as AuthMode, o as AuthenticatedClient, C as ChatAttachmentFile, p as ChatAttachmentInput, q as ChatCryptoContext, r as ChatKeyRing, s as ChatKind, t as ChatMemberKey, u as ChatMemberResponse, v as ChatMessageResponse, w as ChatResponse, x as ChatSession, y as CitationSummary, z as CitationToolSources, B as CliConfig, D as CliCredentials, E as CommandDescriptor, F as ConfigStore, G as ConnectOptions, H as ConversationResponse, I as ConversationUsageResponse, J as CreateFactRequest, K as CreateFactsRequest, L as CreateWorkRequest, M as CreateWorkflowRequest, N as DEFAULT_AI_USD_PER_GBP, Q as DecryptedChatMessage, R as DeferredInterjectionEvent, T as DocumentAutomationAction, W as DocumentSelector, Z as FLAT_TAG_KINDS, _ as FactResponse, $ as FactSearchRequest, a0 as FactSearchResponse, a2 as IdentityErrorCode, a3 as IdentityPurchase, a4 as IdentityState, a5 as IdentityStatus, a6 as LinkedRun, a8 as ListFactsOptions, ab as MailDraftSSEEvent, ad as MessageMetadataPayload, ae as MessageQueuedEvent, af as OutputTokensDetails, ag as ParsedSlashCommand, ah as PendingAuthResponse, ai as PlanStepsError, aj as PlanWorkRequest, ak as ProbeAnswerEvent, al as ProjectBudget, am as ProjectConversationUsageResponse, an as ProjectDetails, ao as ProjectEventKind, ap as ProjectEventResponse, aq as ProjectInvoicesResponse, ar as ProjectResponse, as as ProjectUpdateRequest, at as ProjectUsageResponse, au as QueryOptions, av as RaisedSignal, aw as ReconnectOptions, ax as ReconnectableWsConnection, ay as ResolvedCitation, aA as ResponseCompletedEvent, aB as ResponseContentPartAddedEvent, aC as ResponseCreatedEvent, aD as ResponseFailedEvent, aE as ResponseOutputItemAddedEvent, aF as ResponseOutputItemDoneEvent, aG as ResponseOutputTextDeltaEvent, aH as ResponseOutputTextDoneEvent, aI as ResponseUsage, aJ as RunProgress, aK as RunStep, aL as RunWaitingOn, aM as SSEEvent, aN as SSEStreamCallbacks, aO as SSEStreamResult, aP as SSEStreamStartData, aS as SendBack, aT as SkillSummary, aV as StepActionRequest, aW as StepActivityEvent, aX as StepAssignee, aY as StepField, a$ as StepKind, b0 as StepPhase, b1 as StepSignal, b2 as StepSignalWhen, b3 as StepState, b4 as StepStatus, b5 as SubmitBackgroundQueryOptions, b6 as TAG_KINDS, b7 as TagChange, b8 as TagFieldDefinition, b9 as TagKind, ba as TagKindField, bb as TagKindSchema, bc as TagLinks, bd as TagListQuery, be as TagResponse, bf as TaskPlan, bg as TaskPlanStep, bh as TokenBudgetContext, bi as UpdateConversationRequest, bj as UpdateFactRequest, bk as UpdateWorkflowRequest, bq as UsageBreakdown, br as UserDailyUsageResponse, bs as UserInfo, bt as UserInputRequestEvent, bu as UserMessageEvent, bv as WebSocketAuthError, bw as WorkStatus, bx as WorkflowAuthMode, by as WorkflowResponse, bz as WorkflowRunHistoryResponse, bA as WorkflowRunResponse, bB as WorkspaceContext, bC as WsConnection, bD as account, bE as agentconfig, bG as assistant, bH as authenticatedFetch, bI as buildCitationChunkData, bK as buildFactsContextTool, bL as buildRetrievalChunkTool, bM as buildRetrievalFullContextTool, bN as buildRetrievalTocTool, bO as chats, bP as connectWebSocket, bQ as connectWithReconnect, bR as consumeSSEStream, bS as contacts, bT as conversations, bU as countCitations, bV as createAuthenticatedClient, bX as doctags, bY as documents, bZ as facts, b_ as files, b$ as filterSkills, c0 as formatAgentStepLabel, c1 as formatFileSize, c2 as formatGbp, c3 as formatGbpPerMillionTokens, c4 as formatItemLabel, c6 as formatUserName, c7 as formatWorkspaceChoices, cc as getErrorMessage, cd as getRawWorkspaceKey, ce as health, cg as identityErrorCode, cf as identityVerification, ch as mail, ci as notifications, cj as parseSSEEvents, ck as parseSlashCommand, cl as parseSlashTokenInProgress, cm as performPasswordLogin, cp as profile, cq as projects, cr as requireData, cs as requireOk, ct as resolveAuth, cu as resolveCitations, cv as resolveWorkspace, cw as responses, cx as selectWorkspace, cy as selectWorkspaceById, cz as sessions, cA as settings, cC as streamSSE, cD as stripCitationMarkdown, cE as summarizeCitations, cF as tags, cG as usdToGbp, cH as work, cI as workflowSteps, cJ as workflows, cK as workspaces } from './browser-BRF6pkOB.cjs';
2
2
  export { LoginProfile } from '@arbidocs/client';
package/dist/browser.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export { A as ActivityKind, a as ActivityResponse, b as AgentControlStateEvent, c as AgentStepDeltaEvent, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, h as ArbiErrorEvent, i as ArbiOptions, k as ArtifactEvent, l as AuthContext, m as AuthHeaders, n as AuthMode, o as AuthenticatedClient, C as ChatAttachmentFile, p as ChatAttachmentInput, q as ChatCryptoContext, r as ChatKeyRing, s as ChatKind, t as ChatMemberKey, u as ChatMemberResponse, v as ChatMessageResponse, w as ChatResponse, x as ChatSession, y as CitationSummary, z as CliConfig, B as CliCredentials, D as CommandDescriptor, E as ConfigStore, F as ConnectOptions, G as ConversationResponse, H as ConversationUsageResponse, I as CreateFactRequest, J as CreateFactsRequest, K as CreateWorkRequest, L as CreateWorkflowRequest, M as DEFAULT_AI_USD_PER_GBP, P as DecryptedChatMessage, Q as DeferredInterjectionEvent, S as DocumentAutomationAction, V as DocumentSelector, Y as FactResponse, Z as FactSearchRequest, _ as FactSearchResponse, a0 as IdentityErrorCode, a1 as IdentityPurchase, a2 as IdentityState, a3 as IdentityStatus, a4 as LinkedRun, a6 as ListFactsOptions, a9 as MailDraftSSEEvent, ab as MessageMetadataPayload, ac as MessageQueuedEvent, ad as OutputTokensDetails, ae as ParsedSlashCommand, af as PendingAuthResponse, ag as PlanStepsError, ah as PlanWorkRequest, ai as ProbeAnswerEvent, aj as ProjectBudget, ak as ProjectConversationUsageResponse, al as ProjectDetails, am as ProjectEventKind, an as ProjectEventResponse, ao as ProjectInvoicesResponse, ap as ProjectResponse, aq as ProjectUpdateRequest, ar as ProjectUsageResponse, as as QueryOptions, at as RaisedSignal, au as ReconnectOptions, av as ReconnectableWsConnection, aw as ResolvedCitation, ay as ResponseCompletedEvent, az as ResponseContentPartAddedEvent, aA as ResponseCreatedEvent, aB as ResponseFailedEvent, aC as ResponseOutputItemAddedEvent, aD as ResponseOutputItemDoneEvent, aE as ResponseOutputTextDeltaEvent, aF as ResponseOutputTextDoneEvent, aG as ResponseUsage, aH as RunProgress, aI as RunStep, aJ as RunWaitingOn, aK as SSEEvent, aL as SSEStreamCallbacks, aM as SSEStreamResult, aN as SSEStreamStartData, aQ as SendBack, aR as SkillSummary, aT as StepActionRequest, aU as StepActivityEvent, aV as StepAssignee, aW as StepField, aZ as StepKind, a_ as StepPhase, a$ as StepSignal, b0 as StepSignalWhen, b1 as StepState, b2 as StepStatus, b3 as SubmitBackgroundQueryOptions, b4 as TagChange, b5 as TagFieldDefinition, b6 as TagKind, b7 as TagKindField, b8 as TagKindSchema, b9 as TagLinks, ba as TagListQuery, bb as TagResponse, bc as TaskPlan, bd as TaskPlanStep, be as TokenBudgetContext, bf as UpdateConversationRequest, bg as UpdateFactRequest, bh as UpdateWorkflowRequest, bn as UsageBreakdown, bo as UserDailyUsageResponse, bp as UserInfo, bq as UserInputRequestEvent, br as UserMessageEvent, bs as WebSocketAuthError, bt as WorkStatus, bu as WorkflowAuthMode, bv as WorkflowResponse, bw as WorkflowRunHistoryResponse, bx as WorkflowRunResponse, by as WorkspaceContext, bz as WsConnection, bA as account, bB as agentconfig, bD as assistant, bE as authenticatedFetch, bG as buildFactsContextTool, bH as buildRetrievalChunkTool, bI as buildRetrievalFullContextTool, bJ as buildRetrievalTocTool, bK as chats, bL as connectWebSocket, bM as connectWithReconnect, bN as consumeSSEStream, bO as contacts, bP as conversations, bQ as countCitations, bR as createAuthenticatedClient, bT as doctags, bU as documents, bV as facts, bW as files, bX as filterSkills, bY as formatAgentStepLabel, bZ as formatFileSize, b_ as formatGbp, b$ as formatGbpPerMillionTokens, c0 as formatItemLabel, c2 as formatUserName, c3 as formatWorkspaceChoices, c8 as getErrorMessage, c9 as getRawWorkspaceKey, ca as health, cc as identityErrorCode, cb as identityVerification, cd as mail, ce as notifications, cf as parseSSEEvents, cg as parseSlashCommand, ch as parseSlashTokenInProgress, ci as performPasswordLogin, cl as profile, cm as projects, cn as requireData, co as requireOk, cp as resolveAuth, cq as resolveCitations, cr as resolveWorkspace, cs as responses, ct as selectWorkspace, cu as selectWorkspaceById, cv as sessions, cw as settings, cy as streamSSE, cz as stripCitationMarkdown, cA as summarizeCitations, cB as tags, cC as usdToGbp, cD as work, cE as workflowSteps, cF as workflows, cG as workspaces } from './browser-Ds-drrLp.js';
1
+ export { A as ActivityKind, a as ActivityResponse, b as AgentControlStateEvent, c as AgentStepDeltaEvent, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, h as ArbiErrorEvent, i as ArbiOptions, k as ArtifactEvent, l as AuthContext, m as AuthHeaders, n as AuthMode, o as AuthenticatedClient, C as ChatAttachmentFile, p as ChatAttachmentInput, q as ChatCryptoContext, r as ChatKeyRing, s as ChatKind, t as ChatMemberKey, u as ChatMemberResponse, v as ChatMessageResponse, w as ChatResponse, x as ChatSession, y as CitationSummary, z as CitationToolSources, B as CliConfig, D as CliCredentials, E as CommandDescriptor, F as ConfigStore, G as ConnectOptions, H as ConversationResponse, I as ConversationUsageResponse, J as CreateFactRequest, K as CreateFactsRequest, L as CreateWorkRequest, M as CreateWorkflowRequest, N as DEFAULT_AI_USD_PER_GBP, Q as DecryptedChatMessage, R as DeferredInterjectionEvent, T as DocumentAutomationAction, W as DocumentSelector, Z as FLAT_TAG_KINDS, _ as FactResponse, $ as FactSearchRequest, a0 as FactSearchResponse, a2 as IdentityErrorCode, a3 as IdentityPurchase, a4 as IdentityState, a5 as IdentityStatus, a6 as LinkedRun, a8 as ListFactsOptions, ab as MailDraftSSEEvent, ad as MessageMetadataPayload, ae as MessageQueuedEvent, af as OutputTokensDetails, ag as ParsedSlashCommand, ah as PendingAuthResponse, ai as PlanStepsError, aj as PlanWorkRequest, ak as ProbeAnswerEvent, al as ProjectBudget, am as ProjectConversationUsageResponse, an as ProjectDetails, ao as ProjectEventKind, ap as ProjectEventResponse, aq as ProjectInvoicesResponse, ar as ProjectResponse, as as ProjectUpdateRequest, at as ProjectUsageResponse, au as QueryOptions, av as RaisedSignal, aw as ReconnectOptions, ax as ReconnectableWsConnection, ay as ResolvedCitation, aA as ResponseCompletedEvent, aB as ResponseContentPartAddedEvent, aC as ResponseCreatedEvent, aD as ResponseFailedEvent, aE as ResponseOutputItemAddedEvent, aF as ResponseOutputItemDoneEvent, aG as ResponseOutputTextDeltaEvent, aH as ResponseOutputTextDoneEvent, aI as ResponseUsage, aJ as RunProgress, aK as RunStep, aL as RunWaitingOn, aM as SSEEvent, aN as SSEStreamCallbacks, aO as SSEStreamResult, aP as SSEStreamStartData, aS as SendBack, aT as SkillSummary, aV as StepActionRequest, aW as StepActivityEvent, aX as StepAssignee, aY as StepField, a$ as StepKind, b0 as StepPhase, b1 as StepSignal, b2 as StepSignalWhen, b3 as StepState, b4 as StepStatus, b5 as SubmitBackgroundQueryOptions, b6 as TAG_KINDS, b7 as TagChange, b8 as TagFieldDefinition, b9 as TagKind, ba as TagKindField, bb as TagKindSchema, bc as TagLinks, bd as TagListQuery, be as TagResponse, bf as TaskPlan, bg as TaskPlanStep, bh as TokenBudgetContext, bi as UpdateConversationRequest, bj as UpdateFactRequest, bk as UpdateWorkflowRequest, bq as UsageBreakdown, br as UserDailyUsageResponse, bs as UserInfo, bt as UserInputRequestEvent, bu as UserMessageEvent, bv as WebSocketAuthError, bw as WorkStatus, bx as WorkflowAuthMode, by as WorkflowResponse, bz as WorkflowRunHistoryResponse, bA as WorkflowRunResponse, bB as WorkspaceContext, bC as WsConnection, bD as account, bE as agentconfig, bG as assistant, bH as authenticatedFetch, bI as buildCitationChunkData, bK as buildFactsContextTool, bL as buildRetrievalChunkTool, bM as buildRetrievalFullContextTool, bN as buildRetrievalTocTool, bO as chats, bP as connectWebSocket, bQ as connectWithReconnect, bR as consumeSSEStream, bS as contacts, bT as conversations, bU as countCitations, bV as createAuthenticatedClient, bX as doctags, bY as documents, bZ as facts, b_ as files, b$ as filterSkills, c0 as formatAgentStepLabel, c1 as formatFileSize, c2 as formatGbp, c3 as formatGbpPerMillionTokens, c4 as formatItemLabel, c6 as formatUserName, c7 as formatWorkspaceChoices, cc as getErrorMessage, cd as getRawWorkspaceKey, ce as health, cg as identityErrorCode, cf as identityVerification, ch as mail, ci as notifications, cj as parseSSEEvents, ck as parseSlashCommand, cl as parseSlashTokenInProgress, cm as performPasswordLogin, cp as profile, cq as projects, cr as requireData, cs as requireOk, ct as resolveAuth, cu as resolveCitations, cv as resolveWorkspace, cw as responses, cx as selectWorkspace, cy as selectWorkspaceById, cz as sessions, cA as settings, cC as streamSSE, cD as stripCitationMarkdown, cE as summarizeCitations, cF as tags, cG as usdToGbp, cH as work, cI as workflowSteps, cJ as workflows, cK as workspaces } from './browser-BRF6pkOB.js';
2
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, initSodium, bytesToBase64, encryptWithChatKey, decryptWithChatKey, decryptFile, deriveDirectChatKey, openSealedChatKey, generateChatKey, sealChatKey, encryptMessage, changePassword } from '@arbidocs/client';
1
+ import { createArbiClient, base64ToBytes, unwrapWorkspaceKey, sealKeyForSession, buildWebSocketUrl, createAuthMessage, parseServerMessage, isMessageType, createContentHash, encryptFile, initSodium, bytesToBase64, encryptWithChatKey, decryptWithChatKey, decryptFile, encryptionKeypairFromSigningKey, deriveDirectChatKey, openSealedChatKey, generateChatKey, sealChatKey, encryptMessage, sealedBoxDecrypt, decodeSecureMailKey, openSecureMail, secureMailClaim, changePassword } from '@arbidocs/client';
2
2
 
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
@@ -3655,24 +3655,14 @@ async function performPasswordLogin(config, email, password, store) {
3655
3655
  }
3656
3656
  async function selectWorkspace(arbi, workspaceId, wrappedKey, serverSessionKey, signingPrivateKeyBase64) {
3657
3657
  const signingPrivateKey = base64ToBytes(signingPrivateKeyBase64);
3658
- const ed25519PublicKey = signingPrivateKey.slice(32, 64);
3659
- const encryptionKeyPair = deriveEncryptionKeypairFromSigning({
3660
- publicKey: ed25519PublicKey,
3661
- secretKey: signingPrivateKey
3662
- });
3663
- const workspaceKey = sealedBoxDecrypt(wrappedKey, encryptionKeyPair.secretKey);
3658
+ const workspaceKey = unwrapWorkspaceKey(wrappedKey, signingPrivateKey);
3664
3659
  const header = await sealKeyForSession(workspaceKey, serverSessionKey);
3665
3660
  arbi.session.setSelectedWorkspace(workspaceId);
3666
3661
  return header;
3667
3662
  }
3668
3663
  async function generateEncryptedWorkspaceKey(arbi, wrappedKey, serverSessionKey, signingPrivateKeyBase64) {
3669
3664
  const signingPrivateKey = base64ToBytes(signingPrivateKeyBase64);
3670
- const ed25519PublicKey = signingPrivateKey.slice(32, 64);
3671
- const encryptionKeyPair = deriveEncryptionKeypairFromSigning({
3672
- publicKey: ed25519PublicKey,
3673
- secretKey: signingPrivateKey
3674
- });
3675
- const workspaceKey = sealedBoxDecrypt(wrappedKey, encryptionKeyPair.secretKey);
3665
+ const workspaceKey = unwrapWorkspaceKey(wrappedKey, signingPrivateKey);
3676
3666
  return sealKeyForSession(workspaceKey, serverSessionKey);
3677
3667
  }
3678
3668
  async function getRawWorkspaceKey(arbi, workspaceId, signingPrivateKeyBase64) {
@@ -3685,12 +3675,7 @@ async function getRawWorkspaceKey(arbi, workspaceId, signingPrivateKeyBase64) {
3685
3675
  throw new ArbiError(`Workspace ${workspaceId} not found or has no encryption key`);
3686
3676
  }
3687
3677
  const signingPrivateKey = base64ToBytes(signingPrivateKeyBase64);
3688
- const ed25519PublicKey = signingPrivateKey.slice(32, 64);
3689
- const encryptionKeyPair = deriveEncryptionKeypairFromSigning({
3690
- publicKey: ed25519PublicKey,
3691
- secretKey: signingPrivateKey
3692
- });
3693
- return sealedBoxDecrypt(ws.wrapped_key, encryptionKeyPair.secretKey);
3678
+ return unwrapWorkspaceKey(ws.wrapped_key, signingPrivateKey);
3694
3679
  }
3695
3680
  var StaleSessionError = class extends ArbiError {
3696
3681
  constructor(message) {
@@ -4325,6 +4310,25 @@ function countCitations(metadata) {
4325
4310
  function stripCitationMarkdown(text) {
4326
4311
  return text.replace(/\[([^\]]+)\]\(#cite-(\d+)\)/g, "$1[$2]");
4327
4312
  }
4313
+ function buildCitationChunkData(message) {
4314
+ const merged = {};
4315
+ const sources = [message.tools, message.meta?.tools];
4316
+ for (const toolName of ["retrieval_full_context", "retrieval_chunk"]) {
4317
+ for (const tools of sources) {
4318
+ const tool = tools?.[toolName];
4319
+ if (!tool?.tool_responses) continue;
4320
+ for (const [key, chunks] of Object.entries(tool.tool_responses)) {
4321
+ if (!Array.isArray(chunks)) continue;
4322
+ const seen = new Set((merged[key] ?? []).map((c2) => c2.metadata?.chunk_ext_id));
4323
+ const fresh = chunks.filter(
4324
+ (c2) => !c2.metadata?.chunk_ext_id || !seen.has(c2.metadata.chunk_ext_id)
4325
+ );
4326
+ merged[key] = [...merged[key] ?? [], ...fresh];
4327
+ }
4328
+ }
4329
+ }
4330
+ return merged;
4331
+ }
4328
4332
  function buildChunkLookup(tools) {
4329
4333
  const lookup = /* @__PURE__ */ new Map();
4330
4334
  for (const toolName of ["retrieval_chunk", "retrieval_full_context"]) {
@@ -5772,10 +5776,7 @@ async function downloadChatAttachment(arbi, file) {
5772
5776
 
5773
5777
  // src/operations/chats.ts
5774
5778
  function createChatCryptoContext(signingPrivateKeyBytes, userExtId) {
5775
- const encryptionKeypair = deriveEncryptionKeypairFromSigning({
5776
- publicKey: signingPrivateKeyBytes.slice(32, 64),
5777
- secretKey: signingPrivateKeyBytes
5778
- });
5779
+ const encryptionKeypair = encryptionKeypairFromSigningKey(signingPrivateKeyBytes);
5779
5780
  return { encryptionKeypair, userExtId };
5780
5781
  }
5781
5782
  function isAgentExtId(extId) {
@@ -7568,6 +7569,7 @@ __export(mail_exports, {
7568
7569
  NATIVE_ACCOUNT: () => NATIVE_ACCOUNT,
7569
7570
  attachmentFromBytes: () => attachmentFromBytes,
7570
7571
  claimNativeAlias: () => claimNativeAlias,
7572
+ claimSecureMail: () => claimSecureMail,
7571
7573
  createMailFetch: () => createMailFetch,
7572
7574
  downloadAttachment: () => downloadAttachment,
7573
7575
  getMailPolicy: () => getMailPolicy,
@@ -7645,10 +7647,7 @@ function sendMessage(mail, message, accountId = NATIVE_ACCOUNT) {
7645
7647
  }
7646
7648
  async function unlockNativeMail(mail, keys) {
7647
7649
  await initSodium();
7648
- const secretKey = deriveEncryptionKeypairFromSigning({
7649
- publicKey: keys.signingPrivateKey.slice(32, 64),
7650
- secretKey: keys.signingPrivateKey
7651
- }).secretKey;
7650
+ const secretKey = encryptionKeypairFromSigningKey(keys.signingPrivateKey).secretKey;
7652
7651
  try {
7653
7652
  let cursor = 0;
7654
7653
  while (cursor !== null) {
@@ -7676,6 +7675,18 @@ async function unlockNativeMail(mail, keys) {
7676
7675
  secretKey.fill(0);
7677
7676
  }
7678
7677
  }
7678
+ async function claimSecureMail(mail, id, fragmentKey, recipientPublicKey) {
7679
+ const key = decodeSecureMailKey(fragmentKey);
7680
+ try {
7681
+ const path = `/secure/${encodeURIComponent(id)}`;
7682
+ const { raw } = await openSecureMail(await json(mail(path)), key);
7683
+ raw.fill(0);
7684
+ const claim = await secureMailClaim(key, recipientPublicKey);
7685
+ return await json(mail(`${path}/claim`, { method: "POST", body: JSON.stringify(claim) }));
7686
+ } finally {
7687
+ key.fill(0);
7688
+ }
7689
+ }
7679
7690
  function attachmentFromBytes(name, contentType, bytes) {
7680
7691
  return {
7681
7692
  id: "",
@@ -8753,6 +8764,6 @@ var Arbi = class {
8753
8764
  }
8754
8765
  };
8755
8766
 
8756
- export { Arbi, ArbiApiError, ArbiError, DEFAULT_AI_USD_PER_GBP, PlanStepsError, WebSocketAuthError, account_exports as account, agentconfig_exports as agentconfig, assistant_exports as assistant, authenticatedFetch, buildFactsContextTool, buildRetrievalChunkTool, buildRetrievalFullContextTool, buildRetrievalTocTool, chats_exports as chats, connectWebSocket, connectWithReconnect, consumeSSEStream, contacts_exports as contacts, conversations_exports as conversations, countCitations, createAuthenticatedClient, doctags_exports as doctags, documents_exports as documents, facts_exports as facts, files_exports as files, filterSkills, formatAgentStepLabel, formatFileSize, formatGbp, formatGbpPerMillionTokens, formatItemLabel, formatUserName, formatWorkspaceChoices, getErrorMessage, getRawWorkspaceKey, health_exports as health, identityErrorCode, identity_exports as identityVerification, mail_exports as mail, notifications_exports as notifications, 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, usdToGbp, work_exports as work, workflow_steps_exports as workflowSteps, workflows_exports as workflows, workspaces_exports as workspaces };
8767
+ export { Arbi, ArbiApiError, ArbiError, DEFAULT_AI_USD_PER_GBP, FLAT_TAG_KINDS, PlanStepsError, TAG_KINDS, WebSocketAuthError, account_exports as account, agentconfig_exports as agentconfig, assistant_exports as assistant, authenticatedFetch, buildCitationChunkData, buildFactsContextTool, buildRetrievalChunkTool, buildRetrievalFullContextTool, buildRetrievalTocTool, chats_exports as chats, connectWebSocket, connectWithReconnect, consumeSSEStream, contacts_exports as contacts, conversations_exports as conversations, countCitations, createAuthenticatedClient, doctags_exports as doctags, documents_exports as documents, facts_exports as facts, files_exports as files, filterSkills, formatAgentStepLabel, formatFileSize, formatGbp, formatGbpPerMillionTokens, formatItemLabel, formatUserName, formatWorkspaceChoices, getErrorMessage, getRawWorkspaceKey, health_exports as health, identityErrorCode, identity_exports as identityVerification, mail_exports as mail, notifications_exports as notifications, 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, usdToGbp, work_exports as work, workflow_steps_exports as workflowSteps, workflows_exports as workflows, workspaces_exports as workspaces };
8757
8768
  //# sourceMappingURL=browser.js.map
8758
8769
  //# sourceMappingURL=browser.js.map