@arbidocs/sdk 0.4.127 → 0.4.129
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-Ds-drrLp.d.cts → browser-BRF6pkOB.d.cts} +29 -3
- package/dist/{browser-Ds-drrLp.d.ts → browser-BRF6pkOB.d.ts} +29 -3
- package/dist/browser.cjs +45 -27
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +44 -29
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +45 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +44 -29
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -709,7 +709,7 @@ declare function usdToGbp(usd: number, usdPerGbp?: number): number;
|
|
|
709
709
|
declare function formatGbpPerMillionTokens(costPerToken: number | null | undefined): string | null;
|
|
710
710
|
|
|
711
711
|
/**
|
|
712
|
-
* Citation resolution utilities — shared by CLI and
|
|
712
|
+
* Citation resolution utilities — shared by the CLI, the TUI and the web app.
|
|
713
713
|
*
|
|
714
714
|
* Parses citation data from SSE metadata (`MessageMetadataPayload`) and
|
|
715
715
|
* resolves chunk references into displayable citation summaries and passages.
|
|
@@ -768,6 +768,22 @@ declare function countCitations(metadata: MessageMetadataPayload | null): number
|
|
|
768
768
|
* Replaces `[text](#cite-N)` with `text[N]`.
|
|
769
769
|
*/
|
|
770
770
|
declare function stripCitationMarkdown(text: string): string;
|
|
771
|
+
/** The tools of a message: on the message itself, or under `meta` in older stored messages. */
|
|
772
|
+
interface CitationToolSources {
|
|
773
|
+
tools?: unknown;
|
|
774
|
+
meta?: {
|
|
775
|
+
tools?: unknown;
|
|
776
|
+
} | null;
|
|
777
|
+
}
|
|
778
|
+
/**
|
|
779
|
+
* The retrieved passages a message's citations resolve against, keyed by document as the tool
|
|
780
|
+
* responses are. `retrieval_full_context` and `retrieval_chunk` can both return passages from the
|
|
781
|
+
* same document under the same key, so their arrays are concatenated (each chunk once, by
|
|
782
|
+
* `chunk_ext_id`) rather than spread over each other: a spread keeps only the last array, and a
|
|
783
|
+
* cited passage it drops never resolves, so its citation shows fewer passages, or the wrong ones.
|
|
784
|
+
* Reads `message.tools` and the legacy `message.meta.tools`.
|
|
785
|
+
*/
|
|
786
|
+
declare function buildCitationChunkData(message: CitationToolSources): Record<string, Chunk$1[]>;
|
|
771
787
|
|
|
772
788
|
/**
|
|
773
789
|
* Document operations — browser-safe functions.
|
|
@@ -10945,6 +10961,15 @@ interface NativeMailKeys {
|
|
|
10945
10961
|
* Call it again to unlock mail that arrived since.
|
|
10946
10962
|
*/
|
|
10947
10963
|
declare function unlockNativeMail(mail: MailFetch, keys: NativeMailKeys): Promise<void>;
|
|
10964
|
+
/**
|
|
10965
|
+
* Claim a secure message from its link (`/secure-mail/<id>#key=<fragmentKey>`) into the user's
|
|
10966
|
+
* native inbox. Both encrypted parts are authenticated under the link key before anything is
|
|
10967
|
+
* claimed; the claim then proves possession of the key and re-seals it to `recipientPublicKey`
|
|
10968
|
+
* (the user's X25519 public key).
|
|
10969
|
+
*/
|
|
10970
|
+
declare function claimSecureMail(mail: MailFetch, id: string, fragmentKey: string, recipientPublicKey: Uint8Array): Promise<{
|
|
10971
|
+
id: string;
|
|
10972
|
+
}>;
|
|
10948
10973
|
/** Build an attachment from bytes. */
|
|
10949
10974
|
declare function attachmentFromBytes(name: string, contentType: string, bytes: Uint8Array): MailAttachment;
|
|
10950
10975
|
|
|
@@ -10967,6 +10992,7 @@ declare const mail_NATIVE_ACCOUNT: typeof NATIVE_ACCOUNT;
|
|
|
10967
10992
|
type mail_NativeMailKeys = NativeMailKeys;
|
|
10968
10993
|
declare const mail_attachmentFromBytes: typeof attachmentFromBytes;
|
|
10969
10994
|
declare const mail_claimNativeAlias: typeof claimNativeAlias;
|
|
10995
|
+
declare const mail_claimSecureMail: typeof claimSecureMail;
|
|
10970
10996
|
declare const mail_createMailFetch: typeof createMailFetch;
|
|
10971
10997
|
declare const mail_downloadAttachment: typeof downloadAttachment;
|
|
10972
10998
|
declare const mail_getMailPolicy: typeof getMailPolicy;
|
|
@@ -10979,7 +11005,7 @@ declare const mail_sendMessage: typeof sendMessage;
|
|
|
10979
11005
|
declare const mail_unlockNativeMail: typeof unlockNativeMail;
|
|
10980
11006
|
declare const mail_updateMessage: typeof updateMessage;
|
|
10981
11007
|
declare namespace mail {
|
|
10982
|
-
export { type mail_ListMessagesOptions as ListMessagesOptions, type mail_MailAccount as MailAccount, type mail_MailAddress as MailAddress, type mail_MailAddressInput as MailAddressInput, type mail_MailAttachment as MailAttachment, type mail_MailCompose as MailCompose, type mail_MailDraftSaved as MailDraftSaved, type mail_MailFetch as MailFetch, type mail_MailFolder as MailFolder, type mail_MailMessage as MailMessage, type mail_MailMessagePage as MailMessagePage, type mail_MailMessageUpdate as MailMessageUpdate, type mail_MailPolicy as MailPolicy, type mail_MailSend as MailSend, type mail_MailSendResult as MailSendResult, mail_NATIVE_ACCOUNT as NATIVE_ACCOUNT, type mail_NativeMailKeys as NativeMailKeys, mail_attachmentFromBytes as attachmentFromBytes, mail_claimNativeAlias as claimNativeAlias, mail_createMailFetch as createMailFetch, mail_downloadAttachment as downloadAttachment, mail_getMailPolicy as getMailPolicy, mail_getMessage as getMessage, mail_listFolders as listFolders, mail_listMailAccounts as listMailAccounts, mail_listMessages as listMessages, mail_saveDraft as saveDraft, mail_sendMessage as sendMessage, mail_unlockNativeMail as unlockNativeMail, mail_updateMessage as updateMessage };
|
|
11008
|
+
export { type mail_ListMessagesOptions as ListMessagesOptions, type mail_MailAccount as MailAccount, type mail_MailAddress as MailAddress, type mail_MailAddressInput as MailAddressInput, type mail_MailAttachment as MailAttachment, type mail_MailCompose as MailCompose, type mail_MailDraftSaved as MailDraftSaved, type mail_MailFetch as MailFetch, type mail_MailFolder as MailFolder, type mail_MailMessage as MailMessage, type mail_MailMessagePage as MailMessagePage, type mail_MailMessageUpdate as MailMessageUpdate, type mail_MailPolicy as MailPolicy, type mail_MailSend as MailSend, type mail_MailSendResult as MailSendResult, mail_NATIVE_ACCOUNT as NATIVE_ACCOUNT, type mail_NativeMailKeys as NativeMailKeys, mail_attachmentFromBytes as attachmentFromBytes, mail_claimNativeAlias as claimNativeAlias, mail_claimSecureMail as claimSecureMail, mail_createMailFetch as createMailFetch, mail_downloadAttachment as downloadAttachment, mail_getMailPolicy as getMailPolicy, mail_getMessage as getMessage, mail_listFolders as listFolders, mail_listMailAccounts as listMailAccounts, mail_listMessages as listMessages, mail_saveDraft as saveDraft, mail_sendMessage as sendMessage, mail_unlockNativeMail as unlockNativeMail, mail_updateMessage as updateMessage };
|
|
10983
11009
|
}
|
|
10984
11010
|
|
|
10985
11011
|
/**
|
|
@@ -11084,4 +11110,4 @@ declare namespace identity {
|
|
|
11084
11110
|
export { type identity_IdentityErrorCode as IdentityErrorCode, type identity_IdentityPurchase as IdentityPurchase, type identity_IdentityState as IdentityState, type identity_IdentityStatus as IdentityStatus, identity_acceptName as acceptName, identity_getStatus as getStatus, identity_identityErrorCode as identityErrorCode, identity_purchase as purchase, identity_refresh as refresh, identity_remove as remove, identity_startSession as startSession };
|
|
11085
11111
|
}
|
|
11086
11112
|
|
|
11087
|
-
export { type
|
|
11113
|
+
export { type FactSearchRequest as $, type ActivityKind as A, type CliConfig as B, type ChatAttachmentFile as C, type CliCredentials as D, type CommandDescriptor as E, type ConfigStore as F, type ConnectOptions as G, type ConversationResponse as H, type ConversationUsageResponse as I, type CreateFactRequest as J, type CreateFactsRequest as K, type CreateWorkRequest as L, type CreateWorkflowRequest as M, DEFAULT_AI_USD_PER_GBP as N, DOC_TERMINAL_STATUSES as O, type DecryptedChat as P, type DecryptedChatMessage as Q, type DeferredInterjectionEvent as R, type DocNameMap as S, type DocumentAutomationAction as T, type DocumentListFields as U, type DocumentListOrder as V, type DocumentSelector as W, type DocumentWaiter as X, type DocumentWaiterOptions as Y, FLAT_TAG_KINDS as Z, type FactResponse as _, type ActivityResponse as a, type StepKind as a$, type FactSearchResponse as a0, type FormattedWsMessage as a1, type IdentityErrorCode as a2, type IdentityPurchase as a3, type IdentityState as a4, type IdentityStatus as a5, type LinkedRun as a6, type ListAllOptions as a7, type ListFactsOptions as a8, type ListPaginatedOptions as a9, type ResponseCompletedEvent as aA, type ResponseContentPartAddedEvent as aB, type ResponseCreatedEvent as aC, type ResponseFailedEvent as aD, type ResponseOutputItemAddedEvent as aE, type ResponseOutputItemDoneEvent as aF, type ResponseOutputTextDeltaEvent as aG, type ResponseOutputTextDoneEvent as aH, type ResponseUsage as aI, type RunProgress as aJ, type RunStep as aK, type RunWaitingOn as aL, type SSEEvent as aM, type SSEStreamCallbacks as aN, type SSEStreamResult as aO, type SSEStreamStartData as aP, STEP_FIELD_OPTION_TONES as aQ, SUPPORTED_EXTENSIONS as aR, type SendBack as aS, type SkillSummary as aT, type SkippedFile as aU, type StepActionRequest as aV, type StepActivityEvent as aW, type StepAssignee as aX, type StepField as aY, type StepFieldOption as aZ, type StepFieldOptionTone as a_, type MailAttachment as aa, type MailDraftSSEEvent as ab, type MessageLevel as ac, type MessageMetadataPayload$1 as ad, type MessageQueuedEvent as ae, type OutputTokensDetails as af, type ParsedSlashCommand as ag, type PendingAuthResponse as ah, PlanStepsError as ai, type PlanWorkRequest as aj, type ProbeAnswerEvent as ak, type ProjectBudget as al, type ProjectConversationUsageResponse as am, type ProjectDetails as an, type ProjectEventKind as ao, type ProjectEventResponse as ap, type ProjectInvoicesResponse as aq, type ProjectResponse as ar, type ProjectUpdateRequest as as, type ProjectUsageResponse as at, type QueryOptions as au, type RaisedSignal as av, type ReconnectOptions as aw, type ReconnectableWsConnection as ax, type ResolvedCitation as ay, type ResolvedRecipient as az, type AgentControlStateEvent as b, filterSkills as b$, type StepPhase as b0, type StepSignal as b1, type StepSignalWhen as b2, type StepState as b3, type StepStatus as b4, type SubmitBackgroundQueryOptions as b5, TAG_KINDS as b6, type TagChange as b7, type TagFieldDefinition as b8, type TagKind as b9, type WorkflowRunResponse as bA, type WorkspaceContext as bB, type WsConnection as bC, account as bD, agentconfig as bE, agents as bF, assistant as bG, authenticatedFetch as bH, buildCitationChunkData as bI, buildDocNameMap as bJ, buildFactsContextTool as bK, buildRetrievalChunkTool as bL, buildRetrievalFullContextTool as bM, buildRetrievalTocTool as bN, chats as bO, connectWebSocket as bP, connectWithReconnect as bQ, consumeSSEStream as bR, contacts as bS, conversations as bT, countCitations as bU, createAuthenticatedClient as bV, createDocumentWaiter as bW, doctags as bX, documents as bY, facts as bZ, files as b_, type TagKindField as ba, type TagKindSchema as bb, type TagLinks as bc, type TagListQuery as bd, type TagResponse as be, type TaskPlan as bf, type TaskPlanStep as bg, type TokenBudgetContext as bh, type UpdateConversationRequest as bi, type UpdateFactRequest as bj, type UpdateWorkflowRequest as bk, type UploadBatchResult as bl, type UploadDirectOptions as bm, type UploadDirectResult as bn, type UploadOptions as bo, type UploadResult as bp, type UsageBreakdown as bq, type UserDailyUsageResponse as br, type UserInfo as bs, type UserInputRequestEvent as bt, type UserMessageEvent as bu, WebSocketAuthError as bv, type WorkStatus as bw, type WorkflowAuthMode as bx, type WorkflowResponse as by, type WorkflowRunHistoryResponse as bz, type AgentStepDeltaEvent as c, formatAgentStepLabel as c0, formatFileSize as c1, formatGbp as c2, formatGbpPerMillionTokens as c3, formatItemLabel as c4, formatStreamSummary as c5, formatUserName as c6, formatWorkspaceChoices as c7, formatWsMessage as c8, generateEncryptedWorkspaceKey as c9, settings as cA, signatureRequests as cB, streamSSE as cC, stripCitationMarkdown as cD, summarizeCitations as cE, tags as cF, usdToGbp as cG, work as cH, workflowSteps as cI, workflows as cJ, workspaces as cK, generateNewWorkspaceKey as ca, getErrorCode as cb, getErrorMessage as cc, getRawWorkspaceKey as cd, health as ce, identity as cf, identityErrorCode as cg, mail as ch, notifications as ci, parseSSEEvents as cj, parseSlashCommand as ck, parseSlashTokenInProgress as cl, performPasswordLogin as cm, performSigningKeyLogin as cn, performSsoDeviceFlowLogin as co, profile as cp, projects as cq, requireData as cr, requireOk as cs, resolveAuth as ct, resolveCitations as cu, resolveWorkspace as cv, responses as cw, selectWorkspace as cx, selectWorkspaceById as cy, sessions as cz, type AgentStepEvent as d, Arbi as e, ArbiApiError as f, ArbiError as g, type ArbiErrorEvent as h, type ArbiOptions as i, ArbiSessionExpiredError as j, type ArtifactEvent as k, type AuthContext as l, type AuthHeaders as m, type AuthMode as n, type AuthenticatedClient as o, type ChatAttachmentInput as p, type ChatCryptoContext as q, type ChatKeyRing as r, type ChatKind as s, type ChatMemberKey as t, type ChatMemberResponse as u, type ChatMessageResponse as v, type ChatResponse as w, type ChatSession as x, type CitationSummary as y, type CitationToolSources as z };
|
|
@@ -709,7 +709,7 @@ declare function usdToGbp(usd: number, usdPerGbp?: number): number;
|
|
|
709
709
|
declare function formatGbpPerMillionTokens(costPerToken: number | null | undefined): string | null;
|
|
710
710
|
|
|
711
711
|
/**
|
|
712
|
-
* Citation resolution utilities — shared by CLI and
|
|
712
|
+
* Citation resolution utilities — shared by the CLI, the TUI and the web app.
|
|
713
713
|
*
|
|
714
714
|
* Parses citation data from SSE metadata (`MessageMetadataPayload`) and
|
|
715
715
|
* resolves chunk references into displayable citation summaries and passages.
|
|
@@ -768,6 +768,22 @@ declare function countCitations(metadata: MessageMetadataPayload | null): number
|
|
|
768
768
|
* Replaces `[text](#cite-N)` with `text[N]`.
|
|
769
769
|
*/
|
|
770
770
|
declare function stripCitationMarkdown(text: string): string;
|
|
771
|
+
/** The tools of a message: on the message itself, or under `meta` in older stored messages. */
|
|
772
|
+
interface CitationToolSources {
|
|
773
|
+
tools?: unknown;
|
|
774
|
+
meta?: {
|
|
775
|
+
tools?: unknown;
|
|
776
|
+
} | null;
|
|
777
|
+
}
|
|
778
|
+
/**
|
|
779
|
+
* The retrieved passages a message's citations resolve against, keyed by document as the tool
|
|
780
|
+
* responses are. `retrieval_full_context` and `retrieval_chunk` can both return passages from the
|
|
781
|
+
* same document under the same key, so their arrays are concatenated (each chunk once, by
|
|
782
|
+
* `chunk_ext_id`) rather than spread over each other: a spread keeps only the last array, and a
|
|
783
|
+
* cited passage it drops never resolves, so its citation shows fewer passages, or the wrong ones.
|
|
784
|
+
* Reads `message.tools` and the legacy `message.meta.tools`.
|
|
785
|
+
*/
|
|
786
|
+
declare function buildCitationChunkData(message: CitationToolSources): Record<string, Chunk$1[]>;
|
|
771
787
|
|
|
772
788
|
/**
|
|
773
789
|
* Document operations — browser-safe functions.
|
|
@@ -10945,6 +10961,15 @@ interface NativeMailKeys {
|
|
|
10945
10961
|
* Call it again to unlock mail that arrived since.
|
|
10946
10962
|
*/
|
|
10947
10963
|
declare function unlockNativeMail(mail: MailFetch, keys: NativeMailKeys): Promise<void>;
|
|
10964
|
+
/**
|
|
10965
|
+
* Claim a secure message from its link (`/secure-mail/<id>#key=<fragmentKey>`) into the user's
|
|
10966
|
+
* native inbox. Both encrypted parts are authenticated under the link key before anything is
|
|
10967
|
+
* claimed; the claim then proves possession of the key and re-seals it to `recipientPublicKey`
|
|
10968
|
+
* (the user's X25519 public key).
|
|
10969
|
+
*/
|
|
10970
|
+
declare function claimSecureMail(mail: MailFetch, id: string, fragmentKey: string, recipientPublicKey: Uint8Array): Promise<{
|
|
10971
|
+
id: string;
|
|
10972
|
+
}>;
|
|
10948
10973
|
/** Build an attachment from bytes. */
|
|
10949
10974
|
declare function attachmentFromBytes(name: string, contentType: string, bytes: Uint8Array): MailAttachment;
|
|
10950
10975
|
|
|
@@ -10967,6 +10992,7 @@ declare const mail_NATIVE_ACCOUNT: typeof NATIVE_ACCOUNT;
|
|
|
10967
10992
|
type mail_NativeMailKeys = NativeMailKeys;
|
|
10968
10993
|
declare const mail_attachmentFromBytes: typeof attachmentFromBytes;
|
|
10969
10994
|
declare const mail_claimNativeAlias: typeof claimNativeAlias;
|
|
10995
|
+
declare const mail_claimSecureMail: typeof claimSecureMail;
|
|
10970
10996
|
declare const mail_createMailFetch: typeof createMailFetch;
|
|
10971
10997
|
declare const mail_downloadAttachment: typeof downloadAttachment;
|
|
10972
10998
|
declare const mail_getMailPolicy: typeof getMailPolicy;
|
|
@@ -10979,7 +11005,7 @@ declare const mail_sendMessage: typeof sendMessage;
|
|
|
10979
11005
|
declare const mail_unlockNativeMail: typeof unlockNativeMail;
|
|
10980
11006
|
declare const mail_updateMessage: typeof updateMessage;
|
|
10981
11007
|
declare namespace mail {
|
|
10982
|
-
export { type mail_ListMessagesOptions as ListMessagesOptions, type mail_MailAccount as MailAccount, type mail_MailAddress as MailAddress, type mail_MailAddressInput as MailAddressInput, type mail_MailAttachment as MailAttachment, type mail_MailCompose as MailCompose, type mail_MailDraftSaved as MailDraftSaved, type mail_MailFetch as MailFetch, type mail_MailFolder as MailFolder, type mail_MailMessage as MailMessage, type mail_MailMessagePage as MailMessagePage, type mail_MailMessageUpdate as MailMessageUpdate, type mail_MailPolicy as MailPolicy, type mail_MailSend as MailSend, type mail_MailSendResult as MailSendResult, mail_NATIVE_ACCOUNT as NATIVE_ACCOUNT, type mail_NativeMailKeys as NativeMailKeys, mail_attachmentFromBytes as attachmentFromBytes, mail_claimNativeAlias as claimNativeAlias, mail_createMailFetch as createMailFetch, mail_downloadAttachment as downloadAttachment, mail_getMailPolicy as getMailPolicy, mail_getMessage as getMessage, mail_listFolders as listFolders, mail_listMailAccounts as listMailAccounts, mail_listMessages as listMessages, mail_saveDraft as saveDraft, mail_sendMessage as sendMessage, mail_unlockNativeMail as unlockNativeMail, mail_updateMessage as updateMessage };
|
|
11008
|
+
export { type mail_ListMessagesOptions as ListMessagesOptions, type mail_MailAccount as MailAccount, type mail_MailAddress as MailAddress, type mail_MailAddressInput as MailAddressInput, type mail_MailAttachment as MailAttachment, type mail_MailCompose as MailCompose, type mail_MailDraftSaved as MailDraftSaved, type mail_MailFetch as MailFetch, type mail_MailFolder as MailFolder, type mail_MailMessage as MailMessage, type mail_MailMessagePage as MailMessagePage, type mail_MailMessageUpdate as MailMessageUpdate, type mail_MailPolicy as MailPolicy, type mail_MailSend as MailSend, type mail_MailSendResult as MailSendResult, mail_NATIVE_ACCOUNT as NATIVE_ACCOUNT, type mail_NativeMailKeys as NativeMailKeys, mail_attachmentFromBytes as attachmentFromBytes, mail_claimNativeAlias as claimNativeAlias, mail_claimSecureMail as claimSecureMail, mail_createMailFetch as createMailFetch, mail_downloadAttachment as downloadAttachment, mail_getMailPolicy as getMailPolicy, mail_getMessage as getMessage, mail_listFolders as listFolders, mail_listMailAccounts as listMailAccounts, mail_listMessages as listMessages, mail_saveDraft as saveDraft, mail_sendMessage as sendMessage, mail_unlockNativeMail as unlockNativeMail, mail_updateMessage as updateMessage };
|
|
10983
11009
|
}
|
|
10984
11010
|
|
|
10985
11011
|
/**
|
|
@@ -11084,4 +11110,4 @@ declare namespace identity {
|
|
|
11084
11110
|
export { type identity_IdentityErrorCode as IdentityErrorCode, type identity_IdentityPurchase as IdentityPurchase, type identity_IdentityState as IdentityState, type identity_IdentityStatus as IdentityStatus, identity_acceptName as acceptName, identity_getStatus as getStatus, identity_identityErrorCode as identityErrorCode, identity_purchase as purchase, identity_refresh as refresh, identity_remove as remove, identity_startSession as startSession };
|
|
11085
11111
|
}
|
|
11086
11112
|
|
|
11087
|
-
export { type
|
|
11113
|
+
export { type FactSearchRequest as $, type ActivityKind as A, type CliConfig as B, type ChatAttachmentFile as C, type CliCredentials as D, type CommandDescriptor as E, type ConfigStore as F, type ConnectOptions as G, type ConversationResponse as H, type ConversationUsageResponse as I, type CreateFactRequest as J, type CreateFactsRequest as K, type CreateWorkRequest as L, type CreateWorkflowRequest as M, DEFAULT_AI_USD_PER_GBP as N, DOC_TERMINAL_STATUSES as O, type DecryptedChat as P, type DecryptedChatMessage as Q, type DeferredInterjectionEvent as R, type DocNameMap as S, type DocumentAutomationAction as T, type DocumentListFields as U, type DocumentListOrder as V, type DocumentSelector as W, type DocumentWaiter as X, type DocumentWaiterOptions as Y, FLAT_TAG_KINDS as Z, type FactResponse as _, type ActivityResponse as a, type StepKind as a$, type FactSearchResponse as a0, type FormattedWsMessage as a1, type IdentityErrorCode as a2, type IdentityPurchase as a3, type IdentityState as a4, type IdentityStatus as a5, type LinkedRun as a6, type ListAllOptions as a7, type ListFactsOptions as a8, type ListPaginatedOptions as a9, type ResponseCompletedEvent as aA, type ResponseContentPartAddedEvent as aB, type ResponseCreatedEvent as aC, type ResponseFailedEvent as aD, type ResponseOutputItemAddedEvent as aE, type ResponseOutputItemDoneEvent as aF, type ResponseOutputTextDeltaEvent as aG, type ResponseOutputTextDoneEvent as aH, type ResponseUsage as aI, type RunProgress as aJ, type RunStep as aK, type RunWaitingOn as aL, type SSEEvent as aM, type SSEStreamCallbacks as aN, type SSEStreamResult as aO, type SSEStreamStartData as aP, STEP_FIELD_OPTION_TONES as aQ, SUPPORTED_EXTENSIONS as aR, type SendBack as aS, type SkillSummary as aT, type SkippedFile as aU, type StepActionRequest as aV, type StepActivityEvent as aW, type StepAssignee as aX, type StepField as aY, type StepFieldOption as aZ, type StepFieldOptionTone as a_, type MailAttachment as aa, type MailDraftSSEEvent as ab, type MessageLevel as ac, type MessageMetadataPayload$1 as ad, type MessageQueuedEvent as ae, type OutputTokensDetails as af, type ParsedSlashCommand as ag, type PendingAuthResponse as ah, PlanStepsError as ai, type PlanWorkRequest as aj, type ProbeAnswerEvent as ak, type ProjectBudget as al, type ProjectConversationUsageResponse as am, type ProjectDetails as an, type ProjectEventKind as ao, type ProjectEventResponse as ap, type ProjectInvoicesResponse as aq, type ProjectResponse as ar, type ProjectUpdateRequest as as, type ProjectUsageResponse as at, type QueryOptions as au, type RaisedSignal as av, type ReconnectOptions as aw, type ReconnectableWsConnection as ax, type ResolvedCitation as ay, type ResolvedRecipient as az, type AgentControlStateEvent as b, filterSkills as b$, type StepPhase as b0, type StepSignal as b1, type StepSignalWhen as b2, type StepState as b3, type StepStatus as b4, type SubmitBackgroundQueryOptions as b5, TAG_KINDS as b6, type TagChange as b7, type TagFieldDefinition as b8, type TagKind as b9, type WorkflowRunResponse as bA, type WorkspaceContext as bB, type WsConnection as bC, account as bD, agentconfig as bE, agents as bF, assistant as bG, authenticatedFetch as bH, buildCitationChunkData as bI, buildDocNameMap as bJ, buildFactsContextTool as bK, buildRetrievalChunkTool as bL, buildRetrievalFullContextTool as bM, buildRetrievalTocTool as bN, chats as bO, connectWebSocket as bP, connectWithReconnect as bQ, consumeSSEStream as bR, contacts as bS, conversations as bT, countCitations as bU, createAuthenticatedClient as bV, createDocumentWaiter as bW, doctags as bX, documents as bY, facts as bZ, files as b_, type TagKindField as ba, type TagKindSchema as bb, type TagLinks as bc, type TagListQuery as bd, type TagResponse as be, type TaskPlan as bf, type TaskPlanStep as bg, type TokenBudgetContext as bh, type UpdateConversationRequest as bi, type UpdateFactRequest as bj, type UpdateWorkflowRequest as bk, type UploadBatchResult as bl, type UploadDirectOptions as bm, type UploadDirectResult as bn, type UploadOptions as bo, type UploadResult as bp, type UsageBreakdown as bq, type UserDailyUsageResponse as br, type UserInfo as bs, type UserInputRequestEvent as bt, type UserMessageEvent as bu, WebSocketAuthError as bv, type WorkStatus as bw, type WorkflowAuthMode as bx, type WorkflowResponse as by, type WorkflowRunHistoryResponse as bz, type AgentStepDeltaEvent as c, formatAgentStepLabel as c0, formatFileSize as c1, formatGbp as c2, formatGbpPerMillionTokens as c3, formatItemLabel as c4, formatStreamSummary as c5, formatUserName as c6, formatWorkspaceChoices as c7, formatWsMessage as c8, generateEncryptedWorkspaceKey as c9, settings as cA, signatureRequests as cB, streamSSE as cC, stripCitationMarkdown as cD, summarizeCitations as cE, tags as cF, usdToGbp as cG, work as cH, workflowSteps as cI, workflows as cJ, workspaces as cK, generateNewWorkspaceKey as ca, getErrorCode as cb, getErrorMessage as cc, getRawWorkspaceKey as cd, health as ce, identity as cf, identityErrorCode as cg, mail as ch, notifications as ci, parseSSEEvents as cj, parseSlashCommand as ck, parseSlashTokenInProgress as cl, performPasswordLogin as cm, performSigningKeyLogin as cn, performSsoDeviceFlowLogin as co, profile as cp, projects as cq, requireData as cr, requireOk as cs, resolveAuth as ct, resolveCitations as cu, resolveWorkspace as cv, responses as cw, selectWorkspace as cx, selectWorkspaceById as cy, sessions as cz, type AgentStepEvent as d, Arbi as e, ArbiApiError as f, ArbiError as g, type ArbiErrorEvent as h, type ArbiOptions as i, ArbiSessionExpiredError as j, type ArtifactEvent as k, type AuthContext as l, type AuthHeaders as m, type AuthMode as n, type AuthenticatedClient as o, type ChatAttachmentInput as p, type ChatCryptoContext as q, type ChatKeyRing as r, type ChatKind as s, type ChatMemberKey as t, type ChatMemberResponse as u, type ChatMessageResponse as v, type ChatResponse as w, type ChatSession as x, type CitationSummary as y, type CitationToolSources as z };
|
package/dist/browser.cjs
CHANGED
|
@@ -3658,24 +3658,14 @@ async function performPasswordLogin(config, email, password, store) {
|
|
|
3658
3658
|
}
|
|
3659
3659
|
async function selectWorkspace(arbi, workspaceId, wrappedKey, serverSessionKey, signingPrivateKeyBase64) {
|
|
3660
3660
|
const signingPrivateKey = client.base64ToBytes(signingPrivateKeyBase64);
|
|
3661
|
-
const
|
|
3662
|
-
const encryptionKeyPair = client.deriveEncryptionKeypairFromSigning({
|
|
3663
|
-
publicKey: ed25519PublicKey,
|
|
3664
|
-
secretKey: signingPrivateKey
|
|
3665
|
-
});
|
|
3666
|
-
const workspaceKey = client.sealedBoxDecrypt(wrappedKey, encryptionKeyPair.secretKey);
|
|
3661
|
+
const workspaceKey = client.unwrapWorkspaceKey(wrappedKey, signingPrivateKey);
|
|
3667
3662
|
const header = await client.sealKeyForSession(workspaceKey, serverSessionKey);
|
|
3668
3663
|
arbi.session.setSelectedWorkspace(workspaceId);
|
|
3669
3664
|
return header;
|
|
3670
3665
|
}
|
|
3671
3666
|
async function generateEncryptedWorkspaceKey(arbi, wrappedKey, serverSessionKey, signingPrivateKeyBase64) {
|
|
3672
3667
|
const signingPrivateKey = client.base64ToBytes(signingPrivateKeyBase64);
|
|
3673
|
-
const
|
|
3674
|
-
const encryptionKeyPair = client.deriveEncryptionKeypairFromSigning({
|
|
3675
|
-
publicKey: ed25519PublicKey,
|
|
3676
|
-
secretKey: signingPrivateKey
|
|
3677
|
-
});
|
|
3678
|
-
const workspaceKey = client.sealedBoxDecrypt(wrappedKey, encryptionKeyPair.secretKey);
|
|
3668
|
+
const workspaceKey = client.unwrapWorkspaceKey(wrappedKey, signingPrivateKey);
|
|
3679
3669
|
return client.sealKeyForSession(workspaceKey, serverSessionKey);
|
|
3680
3670
|
}
|
|
3681
3671
|
async function getRawWorkspaceKey(arbi, workspaceId, signingPrivateKeyBase64) {
|
|
@@ -3688,12 +3678,7 @@ async function getRawWorkspaceKey(arbi, workspaceId, signingPrivateKeyBase64) {
|
|
|
3688
3678
|
throw new ArbiError(`Workspace ${workspaceId} not found or has no encryption key`);
|
|
3689
3679
|
}
|
|
3690
3680
|
const signingPrivateKey = client.base64ToBytes(signingPrivateKeyBase64);
|
|
3691
|
-
|
|
3692
|
-
const encryptionKeyPair = client.deriveEncryptionKeypairFromSigning({
|
|
3693
|
-
publicKey: ed25519PublicKey,
|
|
3694
|
-
secretKey: signingPrivateKey
|
|
3695
|
-
});
|
|
3696
|
-
return client.sealedBoxDecrypt(ws.wrapped_key, encryptionKeyPair.secretKey);
|
|
3681
|
+
return client.unwrapWorkspaceKey(ws.wrapped_key, signingPrivateKey);
|
|
3697
3682
|
}
|
|
3698
3683
|
var StaleSessionError = class extends ArbiError {
|
|
3699
3684
|
constructor(message) {
|
|
@@ -4328,6 +4313,25 @@ function countCitations(metadata) {
|
|
|
4328
4313
|
function stripCitationMarkdown(text) {
|
|
4329
4314
|
return text.replace(/\[([^\]]+)\]\(#cite-(\d+)\)/g, "$1[$2]");
|
|
4330
4315
|
}
|
|
4316
|
+
function buildCitationChunkData(message) {
|
|
4317
|
+
const merged = {};
|
|
4318
|
+
const sources = [message.tools, message.meta?.tools];
|
|
4319
|
+
for (const toolName of ["retrieval_full_context", "retrieval_chunk"]) {
|
|
4320
|
+
for (const tools of sources) {
|
|
4321
|
+
const tool = tools?.[toolName];
|
|
4322
|
+
if (!tool?.tool_responses) continue;
|
|
4323
|
+
for (const [key, chunks] of Object.entries(tool.tool_responses)) {
|
|
4324
|
+
if (!Array.isArray(chunks)) continue;
|
|
4325
|
+
const seen = new Set((merged[key] ?? []).map((c2) => c2.metadata?.chunk_ext_id));
|
|
4326
|
+
const fresh = chunks.filter(
|
|
4327
|
+
(c2) => !c2.metadata?.chunk_ext_id || !seen.has(c2.metadata.chunk_ext_id)
|
|
4328
|
+
);
|
|
4329
|
+
merged[key] = [...merged[key] ?? [], ...fresh];
|
|
4330
|
+
}
|
|
4331
|
+
}
|
|
4332
|
+
}
|
|
4333
|
+
return merged;
|
|
4334
|
+
}
|
|
4331
4335
|
function buildChunkLookup(tools) {
|
|
4332
4336
|
const lookup = /* @__PURE__ */ new Map();
|
|
4333
4337
|
for (const toolName of ["retrieval_chunk", "retrieval_full_context"]) {
|
|
@@ -4671,7 +4675,11 @@ async function presignedPut(url, body, onProgress, headers) {
|
|
|
4671
4675
|
});
|
|
4672
4676
|
return;
|
|
4673
4677
|
}
|
|
4674
|
-
const putRes = await fetch(url, {
|
|
4678
|
+
const putRes = await fetch(url, {
|
|
4679
|
+
method: "PUT",
|
|
4680
|
+
body,
|
|
4681
|
+
...headers ? { headers } : {}
|
|
4682
|
+
});
|
|
4675
4683
|
if (!putRes.ok) {
|
|
4676
4684
|
const snippet = await putRes.text().catch(() => "");
|
|
4677
4685
|
throw new Error(`Presigned PUT failed: ${putRes.status} ${snippet.slice(0, 200)}`);
|
|
@@ -5771,10 +5779,7 @@ async function downloadChatAttachment(arbi, file) {
|
|
|
5771
5779
|
|
|
5772
5780
|
// src/operations/chats.ts
|
|
5773
5781
|
function createChatCryptoContext(signingPrivateKeyBytes, userExtId) {
|
|
5774
|
-
const encryptionKeypair = client.
|
|
5775
|
-
publicKey: signingPrivateKeyBytes.slice(32, 64),
|
|
5776
|
-
secretKey: signingPrivateKeyBytes
|
|
5777
|
-
});
|
|
5782
|
+
const encryptionKeypair = client.encryptionKeypairFromSigningKey(signingPrivateKeyBytes);
|
|
5778
5783
|
return { encryptionKeypair, userExtId };
|
|
5779
5784
|
}
|
|
5780
5785
|
function isAgentExtId(extId) {
|
|
@@ -7567,6 +7572,7 @@ __export(mail_exports, {
|
|
|
7567
7572
|
NATIVE_ACCOUNT: () => NATIVE_ACCOUNT,
|
|
7568
7573
|
attachmentFromBytes: () => attachmentFromBytes,
|
|
7569
7574
|
claimNativeAlias: () => claimNativeAlias,
|
|
7575
|
+
claimSecureMail: () => claimSecureMail,
|
|
7570
7576
|
createMailFetch: () => createMailFetch,
|
|
7571
7577
|
downloadAttachment: () => downloadAttachment,
|
|
7572
7578
|
getMailPolicy: () => getMailPolicy,
|
|
@@ -7644,10 +7650,7 @@ function sendMessage(mail, message, accountId = NATIVE_ACCOUNT) {
|
|
|
7644
7650
|
}
|
|
7645
7651
|
async function unlockNativeMail(mail, keys) {
|
|
7646
7652
|
await client.initSodium();
|
|
7647
|
-
const secretKey = client.
|
|
7648
|
-
publicKey: keys.signingPrivateKey.slice(32, 64),
|
|
7649
|
-
secretKey: keys.signingPrivateKey
|
|
7650
|
-
}).secretKey;
|
|
7653
|
+
const secretKey = client.encryptionKeypairFromSigningKey(keys.signingPrivateKey).secretKey;
|
|
7651
7654
|
try {
|
|
7652
7655
|
let cursor = 0;
|
|
7653
7656
|
while (cursor !== null) {
|
|
@@ -7675,6 +7678,18 @@ async function unlockNativeMail(mail, keys) {
|
|
|
7675
7678
|
secretKey.fill(0);
|
|
7676
7679
|
}
|
|
7677
7680
|
}
|
|
7681
|
+
async function claimSecureMail(mail, id, fragmentKey, recipientPublicKey) {
|
|
7682
|
+
const key = client.decodeSecureMailKey(fragmentKey);
|
|
7683
|
+
try {
|
|
7684
|
+
const path = `/secure/${encodeURIComponent(id)}`;
|
|
7685
|
+
const { raw } = await client.openSecureMail(await json(mail(path)), key);
|
|
7686
|
+
raw.fill(0);
|
|
7687
|
+
const claim = await client.secureMailClaim(key, recipientPublicKey);
|
|
7688
|
+
return await json(mail(`${path}/claim`, { method: "POST", body: JSON.stringify(claim) }));
|
|
7689
|
+
} finally {
|
|
7690
|
+
key.fill(0);
|
|
7691
|
+
}
|
|
7692
|
+
}
|
|
7678
7693
|
function attachmentFromBytes(name, contentType, bytes) {
|
|
7679
7694
|
return {
|
|
7680
7695
|
id: "",
|
|
@@ -8756,12 +8771,15 @@ exports.Arbi = Arbi;
|
|
|
8756
8771
|
exports.ArbiApiError = ArbiApiError;
|
|
8757
8772
|
exports.ArbiError = ArbiError;
|
|
8758
8773
|
exports.DEFAULT_AI_USD_PER_GBP = DEFAULT_AI_USD_PER_GBP;
|
|
8774
|
+
exports.FLAT_TAG_KINDS = FLAT_TAG_KINDS;
|
|
8759
8775
|
exports.PlanStepsError = PlanStepsError;
|
|
8776
|
+
exports.TAG_KINDS = TAG_KINDS;
|
|
8760
8777
|
exports.WebSocketAuthError = WebSocketAuthError;
|
|
8761
8778
|
exports.account = account_exports;
|
|
8762
8779
|
exports.agentconfig = agentconfig_exports;
|
|
8763
8780
|
exports.assistant = assistant_exports;
|
|
8764
8781
|
exports.authenticatedFetch = authenticatedFetch;
|
|
8782
|
+
exports.buildCitationChunkData = buildCitationChunkData;
|
|
8765
8783
|
exports.buildFactsContextTool = buildFactsContextTool;
|
|
8766
8784
|
exports.buildRetrievalChunkTool = buildRetrievalChunkTool;
|
|
8767
8785
|
exports.buildRetrievalFullContextTool = buildRetrievalFullContextTool;
|