@arbidocs/sdk 0.4.32 → 0.4.34
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/README.md +18 -0
- package/dist/{browser-CsCYLnPh.d.cts → browser-CQ3lohen.d.cts} +198 -8
- package/dist/{browser-CsCYLnPh.d.ts → browser-CQ3lohen.d.ts} +198 -8
- package/dist/browser.cjs +158 -19
- 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 +159 -21
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +188 -33
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -3
- package/dist/index.d.ts +18 -3
- package/dist/index.js +186 -33
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as ConfigStore, q as CliConfig, r as CliCredentials, C as ChatSession,
|
|
2
|
-
export { A as ActivityKind, a as ActivityResponse, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, i as ArbiOptions, j as ArbiSessionExpiredError, k as ArtifactEvent, l as AuthContext, n as AuthMode, o as AuthenticatedClient, p as CitationSummary, s as CommandDescriptor, u as ConnectOptions, v as ConversationResponse, y as CreateWorkRequest, z as CreateWorkflowRequest, D as DOC_TERMINAL_STATUSES, F as DocNameMap, G as
|
|
1
|
+
import { t as ConfigStore, q as CliConfig, r as CliCredentials, C as ChatSession, ao as SkippedFile, az as UploadResult, m as AuthHeaders, av as UploadBatchResult, ay as UploadOptions, aw as UploadDirectOptions, ax as UploadDirectResult, am as SUPPORTED_EXTENSIONS, T as MailAttachment, E as DmCryptoContext } from './browser-CQ3lohen.cjs';
|
|
2
|
+
export { A as ActivityKind, a as ActivityResponse, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, i as ArbiOptions, j as ArbiSessionExpiredError, k as ArtifactEvent, l as AuthContext, n as AuthMode, o as AuthenticatedClient, p as CitationSummary, s as CommandDescriptor, u as ConnectOptions, v as ConversationResponse, y as CreateWorkRequest, z as CreateWorkflowRequest, D as DOC_TERMINAL_STATUSES, F as DocNameMap, G as DocumentAutomationAction, H as DocumentListFields, I as DocumentListOrder, J as DocumentSelector, K as DocumentWaiter, L as DocumentWaiterOptions, P as FormattedWsMessage, Q as ListAllOptions, S as ListPaginatedOptions, U as MessageLevel, V as MessageMetadataPayload, W as MessageQueuedEvent, X as OutputTokensDetails, Y as ParsedSlashCommand, Z as PendingAuthResponse, _ as PlanWorkRequest, a0 as ProjectInvoicesResponse, a1 as ProjectUsageResponse, a2 as QueryOptions, a3 as ReconnectOptions, a4 as ReconnectableWsConnection, a5 as RequestApprovalRequest, a6 as ResolvedCitation, a7 as ResolvedRecipient, a8 as ResponseCompletedEvent, a9 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 ReviewWorkRequest, ai as SSEEvent, aj as SSEStreamCallbacks, ak as SSEStreamResult, al as SSEStreamStartData, an as SkillSummary, ap as SubmitBackgroundQueryOptions, aq as TaskPlan, ar as TokenBudgetContext, as as UpdateConversationRequest, au as UpdateWorkflowRequest, aA as UserDailyUsageResponse, aB as UserInfo, aC as UserInputRequestEvent, aD as UserMessageEvent, aE as WebSocketAuthError, aF as WorkStatus, aG as WorkflowAuthMode, aH as WorkflowResponse, aI as WorkflowRunHistoryResponse, aJ as WorkflowRunResponse, aK as WorkspaceContext, aL as WsConnection, aM as account, aN as agentconfig, aO as agents, aP as assistant, aQ as authenticatedFetch, aR as buildDocNameMap, aS as buildRetrievalChunkTool, aT as buildRetrievalFullContextTool, aU as buildRetrievalTocTool, aV as connectWebSocket, aW as connectWithReconnect, aX as consumeSSEStream, aY as contacts, aZ as conversations, a_ as countCitations, a$ as createAuthenticatedClient, b0 as createDocumentWaiter, b1 as dm, b2 as doctags, b3 as documents, b4 as facts, b5 as files, b6 as filterSkills, b7 as formatAgentStepLabel, b8 as formatFileSize, b9 as formatItemLabel, ba as formatStreamSummary, bb as formatUserName, bc as formatWorkspaceChoices, bd as formatWsMessage, be as generateEncryptedWorkspaceKey, bf as generateNewWorkspaceKey, bg as getErrorCode, bh as getErrorMessage, bi as getRawWorkspaceKey, bj as health, bk as mail, bl as parseSSEEvents, bm as parseSlashCommand, bn as parseSlashTokenInProgress, bo as performPasswordLogin, bp as performSigningKeyLogin, bq as performSsoDeviceFlowLogin, br as profile, bs as projects, bt as requireData, bu as requireOk, bv as resolveAuth, bw as resolveCitations, bx as resolveWorkspace, by as responses, bz as selectWorkspace, bA as selectWorkspaceById, bB as sessions, bC as settings, bD as streamSSE, bE as stripCitationMarkdown, bF as summarizeCitations, bG as tags, bH as work, bI as workflows, bJ as workspaces } from './browser-CQ3lohen.cjs';
|
|
3
3
|
import { SessionStorageProvider, ArbiClient } from '@arbidocs/client';
|
|
4
4
|
export { LoginProfile } from '@arbidocs/client';
|
|
5
5
|
|
|
@@ -372,6 +372,21 @@ declare namespace documentsNode {
|
|
|
372
372
|
export { documentsNode_ARCHIVE_EXTENSIONS as ARCHIVE_EXTENSIONS, type documentsNode_FileOutcome as FileOutcome, type documentsNode_FileStatus as FileStatus, documentsNode_SUPPORTED_EXTENSIONS as SUPPORTED_EXTENSIONS, type documentsNode_UploadDirectoryDirectOptions as UploadDirectoryDirectOptions, type documentsNode_UploadDirectoryOptions as UploadDirectoryOptions, type documentsNode_UploadManifestOptions as UploadManifestOptions, type documentsNode_UploadManifestProgress as UploadManifestProgress, type documentsNode_UploadManifestResult as UploadManifestResult, type documentsNode_UploadManifestSummary as UploadManifestSummary, type documentsNode_UploadProgress as UploadProgress, documentsNode_uploadArchive as uploadArchive, documentsNode_uploadDirectory as uploadDirectory, documentsNode_uploadLocalArchiveDirect as uploadLocalArchiveDirect, documentsNode_uploadLocalDirectoryDirect as uploadLocalDirectoryDirect, documentsNode_uploadLocalFile as uploadLocalFile, documentsNode_uploadLocalFilesDirect as uploadLocalFilesDirect, documentsNode_uploadLocalZipDirect as uploadLocalZipDirect, documentsNode_uploadManifest as uploadManifest, documentsNode_uploadZip as uploadZip, documentsNode_walkSupportedFiles as walkSupportedFiles };
|
|
373
373
|
}
|
|
374
374
|
|
|
375
|
+
/**
|
|
376
|
+
* Mail operations — Node.js file system helpers.
|
|
377
|
+
*
|
|
378
|
+
* Needs Node built-ins (fs, path), so it is not browser-safe. Browser code builds attachments from a
|
|
379
|
+
* `File` instead.
|
|
380
|
+
*/
|
|
381
|
+
|
|
382
|
+
/** Read a local file as a mail attachment, with a content type guessed from its name. */
|
|
383
|
+
declare function attachmentFromFile(filePath: string): MailAttachment;
|
|
384
|
+
|
|
385
|
+
declare const mailNode_attachmentFromFile: typeof attachmentFromFile;
|
|
386
|
+
declare namespace mailNode {
|
|
387
|
+
export { mailNode_attachmentFromFile as attachmentFromFile };
|
|
388
|
+
}
|
|
389
|
+
|
|
375
390
|
/**
|
|
376
391
|
* Orchestrator interface for `arbi listen`.
|
|
377
392
|
*
|
|
@@ -549,4 +564,4 @@ declare namespace index {
|
|
|
549
564
|
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 };
|
|
550
565
|
}
|
|
551
566
|
|
|
552
|
-
export { AuthHeaders, ChatSession, ClaudeOrchestrator, type ClaudeOrchestratorOptions, CliConfig, CliCredentials, ConfigStore, DmCryptoContext, type DmListener, type DmListenerOptions, FileConfigStore, OpenClawOrchestrator, type OpenClawOrchestratorOptions, type Orchestrator, type PromptContext, deviceFlow, documentsNode, index as listen, startDmListener };
|
|
567
|
+
export { AuthHeaders, ChatSession, ClaudeOrchestrator, type ClaudeOrchestratorOptions, CliConfig, CliCredentials, ConfigStore, DmCryptoContext, type DmListener, type DmListenerOptions, FileConfigStore, OpenClawOrchestrator, type OpenClawOrchestratorOptions, type Orchestrator, type PromptContext, deviceFlow, documentsNode, index as listen, mailNode, startDmListener };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as ConfigStore, q as CliConfig, r as CliCredentials, C as ChatSession,
|
|
2
|
-
export { A as ActivityKind, a as ActivityResponse, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, i as ArbiOptions, j as ArbiSessionExpiredError, k as ArtifactEvent, l as AuthContext, n as AuthMode, o as AuthenticatedClient, p as CitationSummary, s as CommandDescriptor, u as ConnectOptions, v as ConversationResponse, y as CreateWorkRequest, z as CreateWorkflowRequest, D as DOC_TERMINAL_STATUSES, F as DocNameMap, G as
|
|
1
|
+
import { t as ConfigStore, q as CliConfig, r as CliCredentials, C as ChatSession, ao as SkippedFile, az as UploadResult, m as AuthHeaders, av as UploadBatchResult, ay as UploadOptions, aw as UploadDirectOptions, ax as UploadDirectResult, am as SUPPORTED_EXTENSIONS, T as MailAttachment, E as DmCryptoContext } from './browser-CQ3lohen.js';
|
|
2
|
+
export { A as ActivityKind, a as ActivityResponse, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, i as ArbiOptions, j as ArbiSessionExpiredError, k as ArtifactEvent, l as AuthContext, n as AuthMode, o as AuthenticatedClient, p as CitationSummary, s as CommandDescriptor, u as ConnectOptions, v as ConversationResponse, y as CreateWorkRequest, z as CreateWorkflowRequest, D as DOC_TERMINAL_STATUSES, F as DocNameMap, G as DocumentAutomationAction, H as DocumentListFields, I as DocumentListOrder, J as DocumentSelector, K as DocumentWaiter, L as DocumentWaiterOptions, P as FormattedWsMessage, Q as ListAllOptions, S as ListPaginatedOptions, U as MessageLevel, V as MessageMetadataPayload, W as MessageQueuedEvent, X as OutputTokensDetails, Y as ParsedSlashCommand, Z as PendingAuthResponse, _ as PlanWorkRequest, a0 as ProjectInvoicesResponse, a1 as ProjectUsageResponse, a2 as QueryOptions, a3 as ReconnectOptions, a4 as ReconnectableWsConnection, a5 as RequestApprovalRequest, a6 as ResolvedCitation, a7 as ResolvedRecipient, a8 as ResponseCompletedEvent, a9 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 ReviewWorkRequest, ai as SSEEvent, aj as SSEStreamCallbacks, ak as SSEStreamResult, al as SSEStreamStartData, an as SkillSummary, ap as SubmitBackgroundQueryOptions, aq as TaskPlan, ar as TokenBudgetContext, as as UpdateConversationRequest, au as UpdateWorkflowRequest, aA as UserDailyUsageResponse, aB as UserInfo, aC as UserInputRequestEvent, aD as UserMessageEvent, aE as WebSocketAuthError, aF as WorkStatus, aG as WorkflowAuthMode, aH as WorkflowResponse, aI as WorkflowRunHistoryResponse, aJ as WorkflowRunResponse, aK as WorkspaceContext, aL as WsConnection, aM as account, aN as agentconfig, aO as agents, aP as assistant, aQ as authenticatedFetch, aR as buildDocNameMap, aS as buildRetrievalChunkTool, aT as buildRetrievalFullContextTool, aU as buildRetrievalTocTool, aV as connectWebSocket, aW as connectWithReconnect, aX as consumeSSEStream, aY as contacts, aZ as conversations, a_ as countCitations, a$ as createAuthenticatedClient, b0 as createDocumentWaiter, b1 as dm, b2 as doctags, b3 as documents, b4 as facts, b5 as files, b6 as filterSkills, b7 as formatAgentStepLabel, b8 as formatFileSize, b9 as formatItemLabel, ba as formatStreamSummary, bb as formatUserName, bc as formatWorkspaceChoices, bd as formatWsMessage, be as generateEncryptedWorkspaceKey, bf as generateNewWorkspaceKey, bg as getErrorCode, bh as getErrorMessage, bi as getRawWorkspaceKey, bj as health, bk as mail, bl as parseSSEEvents, bm as parseSlashCommand, bn as parseSlashTokenInProgress, bo as performPasswordLogin, bp as performSigningKeyLogin, bq as performSsoDeviceFlowLogin, br as profile, bs as projects, bt as requireData, bu as requireOk, bv as resolveAuth, bw as resolveCitations, bx as resolveWorkspace, by as responses, bz as selectWorkspace, bA as selectWorkspaceById, bB as sessions, bC as settings, bD as streamSSE, bE as stripCitationMarkdown, bF as summarizeCitations, bG as tags, bH as work, bI as workflows, bJ as workspaces } from './browser-CQ3lohen.js';
|
|
3
3
|
import { SessionStorageProvider, ArbiClient } from '@arbidocs/client';
|
|
4
4
|
export { LoginProfile } from '@arbidocs/client';
|
|
5
5
|
|
|
@@ -372,6 +372,21 @@ declare namespace documentsNode {
|
|
|
372
372
|
export { documentsNode_ARCHIVE_EXTENSIONS as ARCHIVE_EXTENSIONS, type documentsNode_FileOutcome as FileOutcome, type documentsNode_FileStatus as FileStatus, documentsNode_SUPPORTED_EXTENSIONS as SUPPORTED_EXTENSIONS, type documentsNode_UploadDirectoryDirectOptions as UploadDirectoryDirectOptions, type documentsNode_UploadDirectoryOptions as UploadDirectoryOptions, type documentsNode_UploadManifestOptions as UploadManifestOptions, type documentsNode_UploadManifestProgress as UploadManifestProgress, type documentsNode_UploadManifestResult as UploadManifestResult, type documentsNode_UploadManifestSummary as UploadManifestSummary, type documentsNode_UploadProgress as UploadProgress, documentsNode_uploadArchive as uploadArchive, documentsNode_uploadDirectory as uploadDirectory, documentsNode_uploadLocalArchiveDirect as uploadLocalArchiveDirect, documentsNode_uploadLocalDirectoryDirect as uploadLocalDirectoryDirect, documentsNode_uploadLocalFile as uploadLocalFile, documentsNode_uploadLocalFilesDirect as uploadLocalFilesDirect, documentsNode_uploadLocalZipDirect as uploadLocalZipDirect, documentsNode_uploadManifest as uploadManifest, documentsNode_uploadZip as uploadZip, documentsNode_walkSupportedFiles as walkSupportedFiles };
|
|
373
373
|
}
|
|
374
374
|
|
|
375
|
+
/**
|
|
376
|
+
* Mail operations — Node.js file system helpers.
|
|
377
|
+
*
|
|
378
|
+
* Needs Node built-ins (fs, path), so it is not browser-safe. Browser code builds attachments from a
|
|
379
|
+
* `File` instead.
|
|
380
|
+
*/
|
|
381
|
+
|
|
382
|
+
/** Read a local file as a mail attachment, with a content type guessed from its name. */
|
|
383
|
+
declare function attachmentFromFile(filePath: string): MailAttachment;
|
|
384
|
+
|
|
385
|
+
declare const mailNode_attachmentFromFile: typeof attachmentFromFile;
|
|
386
|
+
declare namespace mailNode {
|
|
387
|
+
export { mailNode_attachmentFromFile as attachmentFromFile };
|
|
388
|
+
}
|
|
389
|
+
|
|
375
390
|
/**
|
|
376
391
|
* Orchestrator interface for `arbi listen`.
|
|
377
392
|
*
|
|
@@ -549,4 +564,4 @@ declare namespace index {
|
|
|
549
564
|
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 };
|
|
550
565
|
}
|
|
551
566
|
|
|
552
|
-
export { AuthHeaders, ChatSession, ClaudeOrchestrator, type ClaudeOrchestratorOptions, CliConfig, CliCredentials, ConfigStore, DmCryptoContext, type DmListener, type DmListenerOptions, FileConfigStore, OpenClawOrchestrator, type OpenClawOrchestratorOptions, type Orchestrator, type PromptContext, deviceFlow, documentsNode, index as listen, startDmListener };
|
|
567
|
+
export { AuthHeaders, ChatSession, ClaudeOrchestrator, type ClaudeOrchestratorOptions, CliConfig, CliCredentials, ConfigStore, DmCryptoContext, type DmListener, type DmListenerOptions, FileConfigStore, OpenClawOrchestrator, type OpenClawOrchestratorOptions, type Orchestrator, type PromptContext, deviceFlow, documentsNode, index as listen, mailNode, startDmListener };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs2, { readFileSync } from 'fs';
|
|
2
2
|
import path2, { dirname, resolve } from 'path';
|
|
3
3
|
import os2 from 'os';
|
|
4
|
-
import { createArbiClient, base64ToBytes, deriveEncryptionKeypairFromSigning, sealedBoxDecrypt, sealKeyForSession, buildWebSocketUrl, createAuthMessage, parseServerMessage, isMessageType, createContentHash, encryptFile, changePasswordWithRekey } from '@arbidocs/client';
|
|
4
|
+
import { createArbiClient, base64ToBytes, deriveEncryptionKeypairFromSigning, sealedBoxDecrypt, sealKeyForSession, buildWebSocketUrl, createAuthMessage, parseServerMessage, isMessageType, createContentHash, encryptFile, changePasswordWithRekey, initSodium } from '@arbidocs/client';
|
|
5
5
|
import { execSync, spawn } from 'child_process';
|
|
6
6
|
import { createHash } from 'crypto';
|
|
7
7
|
import { fileURLToPath } from 'url';
|
|
@@ -3574,8 +3574,8 @@ async function extractErrorMessage(res) {
|
|
|
3574
3574
|
const text = await res.text();
|
|
3575
3575
|
if (text) {
|
|
3576
3576
|
try {
|
|
3577
|
-
const
|
|
3578
|
-
bodyDetail = detailText(
|
|
3577
|
+
const json2 = JSON.parse(text);
|
|
3578
|
+
bodyDetail = detailText(json2.detail) || json2.message || json2.error || void 0;
|
|
3579
3579
|
} catch {
|
|
3580
3580
|
if (text.length < 200) bodyDetail = text;
|
|
3581
3581
|
}
|
|
@@ -3588,8 +3588,8 @@ async function extractErrorMessage(res) {
|
|
|
3588
3588
|
return `Request failed: ${res.status} ${res.statusText}`;
|
|
3589
3589
|
}
|
|
3590
3590
|
async function authenticatedFetch(options) {
|
|
3591
|
-
const { baseUrl, accessToken, path:
|
|
3592
|
-
const res = await fetch(`${baseUrl}${
|
|
3591
|
+
const { baseUrl, accessToken, path: path4, method, body, headers, signal } = options;
|
|
3592
|
+
const res = await fetch(`${baseUrl}${path4}`, {
|
|
3593
3593
|
method: method ?? (body ? "POST" : "GET"),
|
|
3594
3594
|
headers: {
|
|
3595
3595
|
Authorization: `Bearer ${accessToken}`,
|
|
@@ -3807,8 +3807,8 @@ var FileConfigStore = class {
|
|
|
3807
3807
|
readPublicConfigDomain(filePath) {
|
|
3808
3808
|
try {
|
|
3809
3809
|
const content = fs2.readFileSync(filePath, "utf-8");
|
|
3810
|
-
const
|
|
3811
|
-
const domain =
|
|
3810
|
+
const json2 = JSON.parse(content);
|
|
3811
|
+
const domain = json2?.deployment?.domain;
|
|
3812
3812
|
if (domain) {
|
|
3813
3813
|
return { baseUrl: `https://${domain}`, deploymentDomain: domain };
|
|
3814
3814
|
}
|
|
@@ -5029,8 +5029,8 @@ async function getThumbnails(auth, docIds) {
|
|
|
5029
5029
|
headers: { "Content-Type": "application/json" },
|
|
5030
5030
|
body: JSON.stringify({ document_ext_ids: docIds })
|
|
5031
5031
|
});
|
|
5032
|
-
const
|
|
5033
|
-
return
|
|
5032
|
+
const json2 = await res.json();
|
|
5033
|
+
return json2.thumbnails ?? {};
|
|
5034
5034
|
}
|
|
5035
5035
|
async function uploadFile(auth, fileData, fileName, options) {
|
|
5036
5036
|
const formData = new FormData();
|
|
@@ -5922,17 +5922,17 @@ async function encryptDmContent(arbi, plaintext, recipientEncryptionPubKeyBase64
|
|
|
5922
5922
|
senderEncryptionSecretKey
|
|
5923
5923
|
);
|
|
5924
5924
|
}
|
|
5925
|
-
async function decryptDmContent(arbi, notification,
|
|
5925
|
+
async function decryptDmContent(arbi, notification, crypto2) {
|
|
5926
5926
|
if (!notification.content) return null;
|
|
5927
|
-
const isSent = notification.sender.external_id ===
|
|
5927
|
+
const isSent = notification.sender.external_id === crypto2.userExtId;
|
|
5928
5928
|
const otherParty = isSent ? notification.recipient : notification.sender;
|
|
5929
5929
|
return arbi.crypto.decryptMessage(
|
|
5930
5930
|
notification.content,
|
|
5931
5931
|
otherParty.encryption_public_key,
|
|
5932
|
-
|
|
5932
|
+
crypto2.encryptionKeypair.secretKey
|
|
5933
5933
|
);
|
|
5934
5934
|
}
|
|
5935
|
-
async function decryptDmBatch(arbi, notifications,
|
|
5935
|
+
async function decryptDmBatch(arbi, notifications, crypto2) {
|
|
5936
5936
|
const results = [];
|
|
5937
5937
|
for (const n2 of notifications) {
|
|
5938
5938
|
if (n2.type !== "user_message" || !n2.content) {
|
|
@@ -5940,7 +5940,7 @@ async function decryptDmBatch(arbi, notifications, crypto) {
|
|
|
5940
5940
|
continue;
|
|
5941
5941
|
}
|
|
5942
5942
|
try {
|
|
5943
|
-
const plaintext = await decryptDmContent(arbi, n2,
|
|
5943
|
+
const plaintext = await decryptDmContent(arbi, n2, crypto2);
|
|
5944
5944
|
results.push({ ...n2, content: plaintext });
|
|
5945
5945
|
} catch {
|
|
5946
5946
|
results.push({ ...n2, content: "[Decryption failed]" });
|
|
@@ -5951,9 +5951,9 @@ async function decryptDmBatch(arbi, notifications, crypto) {
|
|
|
5951
5951
|
async function listDMs(arbi) {
|
|
5952
5952
|
return requireData(await arbi.fetch.GET("/v1/notifications/"), "Failed to fetch messages");
|
|
5953
5953
|
}
|
|
5954
|
-
async function listDecryptedDMs(arbi,
|
|
5954
|
+
async function listDecryptedDMs(arbi, crypto2) {
|
|
5955
5955
|
const raw = await listDMs(arbi);
|
|
5956
|
-
return decryptDmBatch(arbi, raw,
|
|
5956
|
+
return decryptDmBatch(arbi, raw, crypto2);
|
|
5957
5957
|
}
|
|
5958
5958
|
async function listActivity(arbi, options) {
|
|
5959
5959
|
return requireData(
|
|
@@ -6000,7 +6000,7 @@ async function resolveRecipient(arbi, ref) {
|
|
|
6000
6000
|
}
|
|
6001
6001
|
return null;
|
|
6002
6002
|
}
|
|
6003
|
-
async function sendEncryptedDM(arbi, messages,
|
|
6003
|
+
async function sendEncryptedDM(arbi, messages, crypto2) {
|
|
6004
6004
|
const plaintextFor = new Map(messages.map((m2) => [m2.recipient_ext_id, m2.content]));
|
|
6005
6005
|
const encrypted = await Promise.all(
|
|
6006
6006
|
messages.map(async (msg) => ({
|
|
@@ -6009,7 +6009,7 @@ async function sendEncryptedDM(arbi, messages, crypto) {
|
|
|
6009
6009
|
arbi,
|
|
6010
6010
|
msg.content,
|
|
6011
6011
|
msg.recipient_encryption_public_key,
|
|
6012
|
-
|
|
6012
|
+
crypto2.encryptionKeypair.secretKey
|
|
6013
6013
|
)
|
|
6014
6014
|
}))
|
|
6015
6015
|
);
|
|
@@ -6024,7 +6024,7 @@ async function sendEncryptedDM(arbi, messages, crypto) {
|
|
|
6024
6024
|
content: plaintextFor.get(n2.recipient.external_id) ?? n2.content
|
|
6025
6025
|
}));
|
|
6026
6026
|
}
|
|
6027
|
-
async function requestWorkspaceAccess(arbi, params,
|
|
6027
|
+
async function requestWorkspaceAccess(arbi, params, crypto2) {
|
|
6028
6028
|
const payload = JSON.stringify({
|
|
6029
6029
|
session_pubkey_b64: params.sessionPubkeyB64,
|
|
6030
6030
|
note: params.note?.trim() || void 0
|
|
@@ -6033,7 +6033,7 @@ async function requestWorkspaceAccess(arbi, params, crypto) {
|
|
|
6033
6033
|
arbi,
|
|
6034
6034
|
payload,
|
|
6035
6035
|
params.recipientEncryptionPublicKey,
|
|
6036
|
-
|
|
6036
|
+
crypto2.encryptionKeypair.secretKey
|
|
6037
6037
|
);
|
|
6038
6038
|
return requireData(
|
|
6039
6039
|
await arbi.fetch.POST("/v1/notifications/access-request", {
|
|
@@ -6434,6 +6434,7 @@ __export(workflows_exports, {
|
|
|
6434
6434
|
createWorkflow: () => createWorkflow,
|
|
6435
6435
|
deleteWorkflow: () => deleteWorkflow,
|
|
6436
6436
|
getWorkflow: () => getWorkflow,
|
|
6437
|
+
listWorkflowRuns: () => listWorkflowRuns,
|
|
6437
6438
|
listWorkflows: () => listWorkflows,
|
|
6438
6439
|
runWorkflow: () => runWorkflow,
|
|
6439
6440
|
updateWorkflow: () => updateWorkflow
|
|
@@ -6469,6 +6470,12 @@ async function runWorkflow(arbi, workflowId) {
|
|
|
6469
6470
|
"Failed to run workflow"
|
|
6470
6471
|
);
|
|
6471
6472
|
}
|
|
6473
|
+
async function listWorkflowRuns(arbi, workflowId) {
|
|
6474
|
+
return requireData(
|
|
6475
|
+
await arbi.fetch.GET("/v1/workflow/{workflow_id}/runs", byId2(workflowId)),
|
|
6476
|
+
"Failed to list automation executions"
|
|
6477
|
+
);
|
|
6478
|
+
}
|
|
6472
6479
|
|
|
6473
6480
|
// src/operations/facts.ts
|
|
6474
6481
|
var facts_exports = {};
|
|
@@ -6542,8 +6549,8 @@ function tokenExpiresWithin(token, seconds) {
|
|
|
6542
6549
|
const payload = token?.split(".")[1];
|
|
6543
6550
|
if (!payload) return false;
|
|
6544
6551
|
try {
|
|
6545
|
-
const
|
|
6546
|
-
const { exp } = JSON.parse(
|
|
6552
|
+
const json2 = atob(payload.replace(/-/g, "+").replace(/_/g, "/"));
|
|
6553
|
+
const { exp } = JSON.parse(json2);
|
|
6547
6554
|
return typeof exp === "number" && exp * 1e3 - Date.now() < seconds * 1e3;
|
|
6548
6555
|
} catch {
|
|
6549
6556
|
return false;
|
|
@@ -6934,9 +6941,9 @@ var Arbi = class {
|
|
|
6934
6941
|
const lr2 = this.requireLogin();
|
|
6935
6942
|
const userExtId = lr2.userExtId ?? client.session.getState().userExtId;
|
|
6936
6943
|
if (!userExtId) throw new ArbiError("No user id in session \u2014 cannot request access");
|
|
6937
|
-
const
|
|
6944
|
+
const crypto2 = createDmCryptoContext(client, lr2.signingPrivateKey, userExtId);
|
|
6938
6945
|
const sessionPubkeyB64 = client.crypto.bytesToBase64(lr2.serverSessionKey);
|
|
6939
|
-
return requestWorkspaceAccess(client, { ...params, sessionPubkeyB64 },
|
|
6946
|
+
return requestWorkspaceAccess(client, { ...params, sessionPubkeyB64 }, crypto2);
|
|
6940
6947
|
},
|
|
6941
6948
|
copyDocuments: (targetWorkspaceId, docIds, targetWorkspaceKey) => copyDocuments(
|
|
6942
6949
|
this.requireClient(),
|
|
@@ -7056,11 +7063,11 @@ var Arbi = class {
|
|
|
7056
7063
|
};
|
|
7057
7064
|
/** Authenticated native Word transport, with normal session recovery. */
|
|
7058
7065
|
editor = {
|
|
7059
|
-
request: (
|
|
7066
|
+
request: (path4, options = {}) => this.recovering(async () => {
|
|
7060
7067
|
const { baseUrl, accessToken } = this.getAuthHeaders();
|
|
7061
7068
|
const headers = new Headers(options.headers);
|
|
7062
7069
|
headers.set("Authorization", `Bearer ${accessToken}`);
|
|
7063
|
-
const response = await fetch(`${baseUrl}/v1/editor${
|
|
7070
|
+
const response = await fetch(`${baseUrl}/v1/editor${path4}`, { ...options, headers });
|
|
7064
7071
|
if (!response.ok) {
|
|
7065
7072
|
const body = await response.json().catch(() => null);
|
|
7066
7073
|
throw new ArbiApiError(body?.detail || `Document request failed (${response.status})`, {
|
|
@@ -8118,6 +8125,152 @@ async function uploadArchive(auth, archivePath, options) {
|
|
|
8118
8125
|
}
|
|
8119
8126
|
}
|
|
8120
8127
|
|
|
8128
|
+
// src/operations/mail.ts
|
|
8129
|
+
var mail_exports = {};
|
|
8130
|
+
__export(mail_exports, {
|
|
8131
|
+
NATIVE_ACCOUNT: () => NATIVE_ACCOUNT,
|
|
8132
|
+
attachmentFromBytes: () => attachmentFromBytes,
|
|
8133
|
+
claimNativeAlias: () => claimNativeAlias,
|
|
8134
|
+
createMailFetch: () => createMailFetch,
|
|
8135
|
+
downloadAttachment: () => downloadAttachment,
|
|
8136
|
+
getMailPolicy: () => getMailPolicy,
|
|
8137
|
+
getMessage: () => getMessage2,
|
|
8138
|
+
listFolders: () => listFolders,
|
|
8139
|
+
listMailAccounts: () => listMailAccounts,
|
|
8140
|
+
listMessages: () => listMessages,
|
|
8141
|
+
saveDraft: () => saveDraft,
|
|
8142
|
+
sendMessage: () => sendMessage,
|
|
8143
|
+
unlockNativeMail: () => unlockNativeMail,
|
|
8144
|
+
updateMessage: () => updateMessage
|
|
8145
|
+
});
|
|
8146
|
+
var NATIVE_ACCOUNT = "native";
|
|
8147
|
+
function createMailFetch(auth) {
|
|
8148
|
+
return (path4, init = {}) => authenticatedFetch({
|
|
8149
|
+
...auth,
|
|
8150
|
+
path: `/v1/mail${path4}`,
|
|
8151
|
+
method: init.method,
|
|
8152
|
+
body: init.body,
|
|
8153
|
+
headers: {
|
|
8154
|
+
...init.body ? { "Content-Type": "application/json" } : {},
|
|
8155
|
+
...init.headers
|
|
8156
|
+
}
|
|
8157
|
+
});
|
|
8158
|
+
}
|
|
8159
|
+
async function json(response) {
|
|
8160
|
+
return (await response).json();
|
|
8161
|
+
}
|
|
8162
|
+
var accountPath = (accountId) => `/accounts/${encodeURIComponent(accountId)}`;
|
|
8163
|
+
function getMailPolicy(mail) {
|
|
8164
|
+
return json(mail("/policy"));
|
|
8165
|
+
}
|
|
8166
|
+
function listMailAccounts(mail) {
|
|
8167
|
+
return json(mail("/accounts"));
|
|
8168
|
+
}
|
|
8169
|
+
async function claimNativeAlias(mail, alias) {
|
|
8170
|
+
const { email } = await json(
|
|
8171
|
+
mail("/native/alias", { method: "POST", body: JSON.stringify({ alias }) })
|
|
8172
|
+
);
|
|
8173
|
+
return email;
|
|
8174
|
+
}
|
|
8175
|
+
function listFolders(mail, accountId = NATIVE_ACCOUNT) {
|
|
8176
|
+
return json(mail(`${accountPath(accountId)}/folders`));
|
|
8177
|
+
}
|
|
8178
|
+
function listMessages(mail, options) {
|
|
8179
|
+
const params = new URLSearchParams({ folder_id: options.folderId });
|
|
8180
|
+
if (options.query) params.set("q", options.query);
|
|
8181
|
+
if (options.cursor) params.set("cursor", options.cursor);
|
|
8182
|
+
if (options.limit) params.set("limit", String(options.limit));
|
|
8183
|
+
return json(mail(`${accountPath(options.accountId ?? NATIVE_ACCOUNT)}/messages?${params}`));
|
|
8184
|
+
}
|
|
8185
|
+
function getMessage2(mail, messageId, accountId = NATIVE_ACCOUNT) {
|
|
8186
|
+
return json(mail(`${accountPath(accountId)}/messages/${encodeURIComponent(messageId)}`));
|
|
8187
|
+
}
|
|
8188
|
+
async function downloadAttachment(mail, messageId, attachmentId, accountId = NATIVE_ACCOUNT) {
|
|
8189
|
+
const path4 = `${accountPath(accountId)}/messages/${encodeURIComponent(messageId)}/attachments/${encodeURIComponent(attachmentId)}`;
|
|
8190
|
+
return new Uint8Array(await (await mail(path4)).arrayBuffer());
|
|
8191
|
+
}
|
|
8192
|
+
async function updateMessage(mail, messageId, update, accountId = NATIVE_ACCOUNT) {
|
|
8193
|
+
await mail(`${accountPath(accountId)}/messages/${encodeURIComponent(messageId)}`, {
|
|
8194
|
+
method: "PATCH",
|
|
8195
|
+
body: JSON.stringify(update)
|
|
8196
|
+
});
|
|
8197
|
+
}
|
|
8198
|
+
function saveDraft(mail, compose, accountId = NATIVE_ACCOUNT) {
|
|
8199
|
+
return json(
|
|
8200
|
+
mail(`${accountPath(accountId)}/drafts`, { method: "POST", body: JSON.stringify(compose) })
|
|
8201
|
+
);
|
|
8202
|
+
}
|
|
8203
|
+
function sendMessage(mail, message, accountId = NATIVE_ACCOUNT) {
|
|
8204
|
+
const body = { ...message, request_id: message.request_id ?? crypto.randomUUID() };
|
|
8205
|
+
return json(
|
|
8206
|
+
mail(`${accountPath(accountId)}/send`, { method: "POST", body: JSON.stringify(body) })
|
|
8207
|
+
);
|
|
8208
|
+
}
|
|
8209
|
+
async function unlockNativeMail(mail, keys) {
|
|
8210
|
+
await initSodium();
|
|
8211
|
+
const secretKey = deriveEncryptionKeypairFromSigning({
|
|
8212
|
+
publicKey: keys.signingPrivateKey.slice(32, 64),
|
|
8213
|
+
secretKey: keys.signingPrivateKey
|
|
8214
|
+
}).secretKey;
|
|
8215
|
+
try {
|
|
8216
|
+
let cursor = 0;
|
|
8217
|
+
while (cursor !== null) {
|
|
8218
|
+
const page = await json(
|
|
8219
|
+
mail(`/native/keys?cursor=${cursor}`)
|
|
8220
|
+
);
|
|
8221
|
+
const sealed = {};
|
|
8222
|
+
for (const [id, wrapped] of Object.entries(page.keys)) {
|
|
8223
|
+
const key = sealedBoxDecrypt(wrapped, secretKey);
|
|
8224
|
+
try {
|
|
8225
|
+
sealed[id] = await sealKeyForSession(key, keys.serverSessionKey);
|
|
8226
|
+
} finally {
|
|
8227
|
+
key.fill(0);
|
|
8228
|
+
}
|
|
8229
|
+
}
|
|
8230
|
+
if (Object.keys(sealed).length) {
|
|
8231
|
+
await mail("/native/session-keys", {
|
|
8232
|
+
method: "POST",
|
|
8233
|
+
body: JSON.stringify({ keys: sealed })
|
|
8234
|
+
});
|
|
8235
|
+
}
|
|
8236
|
+
cursor = page.next_cursor;
|
|
8237
|
+
}
|
|
8238
|
+
} finally {
|
|
8239
|
+
secretKey.fill(0);
|
|
8240
|
+
}
|
|
8241
|
+
}
|
|
8242
|
+
function attachmentFromBytes(name, contentType, bytes) {
|
|
8243
|
+
return {
|
|
8244
|
+
id: "",
|
|
8245
|
+
name,
|
|
8246
|
+
content_type: contentType,
|
|
8247
|
+
size: bytes.length,
|
|
8248
|
+
content_base64: bytesToBase64(bytes)
|
|
8249
|
+
};
|
|
8250
|
+
}
|
|
8251
|
+
function bytesToBase64(bytes) {
|
|
8252
|
+
let binary = "";
|
|
8253
|
+
for (let i2 = 0; i2 < bytes.length; i2 += 32768) {
|
|
8254
|
+
binary += String.fromCharCode(...bytes.subarray(i2, i2 + 32768));
|
|
8255
|
+
}
|
|
8256
|
+
return btoa(binary);
|
|
8257
|
+
}
|
|
8258
|
+
|
|
8259
|
+
// src/operations/mail-node.ts
|
|
8260
|
+
var mail_node_exports = {};
|
|
8261
|
+
__export(mail_node_exports, {
|
|
8262
|
+
attachmentFromFile: () => attachmentFromFile
|
|
8263
|
+
});
|
|
8264
|
+
function attachmentFromFile(filePath) {
|
|
8265
|
+
const resolved = path2.resolve(filePath);
|
|
8266
|
+
const name = path2.basename(resolved);
|
|
8267
|
+
return attachmentFromBytes(
|
|
8268
|
+
name,
|
|
8269
|
+
mimeFromName(name) || "application/octet-stream",
|
|
8270
|
+
fs2.readFileSync(resolved)
|
|
8271
|
+
);
|
|
8272
|
+
}
|
|
8273
|
+
|
|
8121
8274
|
// src/listen/index.ts
|
|
8122
8275
|
var listen_exports = {};
|
|
8123
8276
|
__export(listen_exports, {
|
|
@@ -8282,14 +8435,14 @@ var OpenClawOrchestrator = class {
|
|
|
8282
8435
|
return;
|
|
8283
8436
|
}
|
|
8284
8437
|
try {
|
|
8285
|
-
const
|
|
8286
|
-
const payloads =
|
|
8438
|
+
const json2 = JSON.parse(stdout);
|
|
8439
|
+
const payloads = json2?.payloads ?? json2?.result?.payloads ?? [];
|
|
8287
8440
|
const texts = payloads.map((p2) => p2.text ?? "").filter(Boolean);
|
|
8288
8441
|
if (texts.length > 0) {
|
|
8289
8442
|
resolve2(texts.join("\n"));
|
|
8290
8443
|
return;
|
|
8291
8444
|
}
|
|
8292
|
-
const finalText =
|
|
8445
|
+
const finalText = json2?.meta?.systemPromptReport?.finalAssistantVisibleText ?? json2?.meta?.systemPromptReport?.finalAssistantRawText;
|
|
8293
8446
|
if (typeof finalText === "string" && finalText.trim()) {
|
|
8294
8447
|
resolve2(finalText.trim());
|
|
8295
8448
|
return;
|
|
@@ -8309,7 +8462,7 @@ var OpenClawOrchestrator = class {
|
|
|
8309
8462
|
|
|
8310
8463
|
// src/listen/dm-listener.ts
|
|
8311
8464
|
async function startDmListener(options) {
|
|
8312
|
-
const { arbi, baseUrl, crypto, orchestrator, parentExtId, onLog, onError } = options;
|
|
8465
|
+
const { arbi, baseUrl, crypto: crypto2, orchestrator, parentExtId, onLog, onError } = options;
|
|
8313
8466
|
const log = onLog ?? (() => {
|
|
8314
8467
|
});
|
|
8315
8468
|
const logError = onError ?? ((msg) => console.error(msg));
|
|
@@ -8326,7 +8479,7 @@ async function startDmListener(options) {
|
|
|
8326
8479
|
}
|
|
8327
8480
|
let plaintext;
|
|
8328
8481
|
try {
|
|
8329
|
-
plaintext = await decryptDmContent(arbi, msg,
|
|
8482
|
+
plaintext = await decryptDmContent(arbi, msg, crypto2);
|
|
8330
8483
|
} catch (err) {
|
|
8331
8484
|
logError("Failed to decrypt incoming DM", err);
|
|
8332
8485
|
return;
|
|
@@ -8362,7 +8515,7 @@ async function startDmListener(options) {
|
|
|
8362
8515
|
recipient_encryption_public_key: senderPubKey
|
|
8363
8516
|
}
|
|
8364
8517
|
],
|
|
8365
|
-
|
|
8518
|
+
crypto2
|
|
8366
8519
|
);
|
|
8367
8520
|
log(`Reply sent to ${msg.sender?.email ?? senderExtId}`);
|
|
8368
8521
|
} catch (err) {
|
|
@@ -8420,6 +8573,6 @@ async function startDmListener(options) {
|
|
|
8420
8573
|
};
|
|
8421
8574
|
}
|
|
8422
8575
|
|
|
8423
|
-
export { Arbi, ArbiApiError, ArbiError, ArbiSessionExpiredError, ClaudeOrchestrator, DOC_TERMINAL_STATUSES, FileConfigStore, OpenClawOrchestrator, WebSocketAuthError, account_exports as account, agentconfig_exports as agentconfig, agents_exports as agents, assistant_exports as assistant, authenticatedFetch, buildDocNameMap, 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, facts_exports as facts, files_exports as files, filterSkills, formatAgentStepLabel, formatFileSize, formatItemLabel, 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, work_exports as work, workflows_exports as workflows, workspaces_exports as workspaces };
|
|
8576
|
+
export { Arbi, ArbiApiError, ArbiError, ArbiSessionExpiredError, ClaudeOrchestrator, DOC_TERMINAL_STATUSES, FileConfigStore, OpenClawOrchestrator, WebSocketAuthError, account_exports as account, agentconfig_exports as agentconfig, agents_exports as agents, assistant_exports as assistant, authenticatedFetch, buildDocNameMap, 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, facts_exports as facts, files_exports as files, filterSkills, formatAgentStepLabel, formatFileSize, formatItemLabel, formatStreamSummary, formatUserName, formatWorkspaceChoices, formatWsMessage, generateEncryptedWorkspaceKey, generateNewWorkspaceKey, getErrorCode, getErrorMessage, getRawWorkspaceKey, health_exports as health, listen_exports as listen, mail_exports as mail, mail_node_exports as mailNode, 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, work_exports as work, workflows_exports as workflows, workspaces_exports as workspaces };
|
|
8424
8577
|
//# sourceMappingURL=index.js.map
|
|
8425
8578
|
//# sourceMappingURL=index.js.map
|