@arbidocs/sdk 0.4.4 → 0.4.6
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-Bdzn5DIN.d.cts → browser-B43Cvo9W.d.cts} +142 -5
- package/dist/{browser-Bdzn5DIN.d.ts → browser-B43Cvo9W.d.ts} +142 -5
- package/dist/browser.cjs +170 -12
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +2 -2
- package/dist/browser.d.ts +2 -2
- package/dist/browser.js +169 -14
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +165 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -41
- package/dist/index.d.ts +4 -41
- package/dist/index.js +166 -27
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { q as ConfigStore, n as CliConfig, o as CliCredentials, C as ChatSession, ac as SkippedFile, al as UploadResult, k as AuthHeaders, ah as UploadBatchResult, ak as UploadOptions, ai as UploadDirectOptions, aj as UploadDirectResult, aa as SUPPORTED_EXTENSIONS, w as DmCryptoContext } from './browser-
|
|
2
|
-
export { b as AgentStepEvent, c as Arbi, d as ArbiApiError, e as ArbiError, g as ArbiOptions, h as ArbiSessionExpiredError, i as ArtifactEvent, j as AuthContext, l as AuthenticatedClient, m as CitationSummary, p as CommandDescriptor, r as ConnectOptions, D as DOC_TERMINAL_STATUSES, x as DocNameMap, y as DocumentListFields, z as DocumentListOrder, B as DocumentWaiter, E as DocumentWaiterOptions, I as FormattedWsMessage, L as ListAllOptions, K as ListPaginatedOptions, M as MessageLevel, N as MessageMetadataPayload, O as MessageQueuedEvent, P as OutputTokensDetails, Q as ParsedSlashCommand, S as ProjectInvoicesResponse, T as ProjectUsageResponse, U as QueryOptions, V as ReconnectOptions, W as ReconnectableWsConnection, X as ResolvedCitation, Y as ResolvedRecipient, Z as ResponseCompletedEvent, _ as ResponseContentPartAddedEvent, $ as ResponseCreatedEvent, a0 as ResponseFailedEvent, a1 as ResponseOutputItemAddedEvent, a2 as ResponseOutputItemDoneEvent, a3 as ResponseOutputTextDeltaEvent, a4 as ResponseOutputTextDoneEvent, a5 as ResponseUsage, a6 as SSEEvent, a7 as SSEStreamCallbacks, a8 as SSEStreamResult, a9 as SSEStreamStartData, ab as SkillSummary, ae as TokenBudgetContext, am as UserDailyUsageResponse, an as UserInfo, ao as UserInputRequestEvent, ap as UserMessageEvent, aq as WebSocketAuthError, ar as WorkspaceContext, as as WsConnection, at as
|
|
1
|
+
import { q as ConfigStore, n as CliConfig, o as CliCredentials, C as ChatSession, ac as SkippedFile, al as UploadResult, k as AuthHeaders, ah as UploadBatchResult, ak as UploadOptions, ai as UploadDirectOptions, aj as UploadDirectResult, aa as SUPPORTED_EXTENSIONS, w as DmCryptoContext } from './browser-B43Cvo9W.cjs';
|
|
2
|
+
export { b as AgentStepEvent, c as Arbi, d as ArbiApiError, e as ArbiError, g as ArbiOptions, h as ArbiSessionExpiredError, i as ArtifactEvent, j as AuthContext, l as AuthenticatedClient, m as CitationSummary, p as CommandDescriptor, r as ConnectOptions, D as DOC_TERMINAL_STATUSES, x as DocNameMap, y as DocumentListFields, z as DocumentListOrder, B as DocumentWaiter, E as DocumentWaiterOptions, I as FormattedWsMessage, L as ListAllOptions, K as ListPaginatedOptions, M as MessageLevel, N as MessageMetadataPayload, O as MessageQueuedEvent, P as OutputTokensDetails, Q as ParsedSlashCommand, S as ProjectInvoicesResponse, T as ProjectUsageResponse, U as QueryOptions, V as ReconnectOptions, W as ReconnectableWsConnection, X as ResolvedCitation, Y as ResolvedRecipient, Z as ResponseCompletedEvent, _ as ResponseContentPartAddedEvent, $ as ResponseCreatedEvent, a0 as ResponseFailedEvent, a1 as ResponseOutputItemAddedEvent, a2 as ResponseOutputItemDoneEvent, a3 as ResponseOutputTextDeltaEvent, a4 as ResponseOutputTextDoneEvent, a5 as ResponseUsage, a6 as SSEEvent, a7 as SSEStreamCallbacks, a8 as SSEStreamResult, a9 as SSEStreamStartData, ab as SkillSummary, ae as TokenBudgetContext, am as UserDailyUsageResponse, an as UserInfo, ao as UserInputRequestEvent, ap as UserMessageEvent, aq as WebSocketAuthError, ar as WorkspaceContext, as as WsConnection, at as account, au as agentconfig, av as assistant, aw as authenticatedFetch, ax as buildDocNameMap, ay as buildRetrievalChunkTool, az as buildRetrievalFullContextTool, aA as buildRetrievalTocTool, aB as connectWebSocket, aC as connectWithReconnect, aD as consumeSSEStream, aE as contacts, aF as conversations, aG as countCitations, aH as createAuthenticatedClient, aI as createDocumentWaiter, aJ as dm, aK as doctags, aL as documents, aM as facts, aN as files, aO as filterSkills, aP as formatAgentStepLabel, aQ as formatFileSize, aR as formatItemLabel, aS as formatStreamSummary, aT as formatUserName, aU as formatWorkspaceChoices, aV as formatWsMessage, aW as generateEncryptedWorkspaceKey, aX as generateNewWorkspaceKey, aY as getErrorCode, aZ as getErrorMessage, a_ as getRawWorkspaceKey, a$ as health, b0 as parseSSEEvents, b1 as parseSlashCommand, b2 as parseSlashTokenInProgress, b3 as performPasswordLogin, b4 as performSigningKeyLogin, b5 as performSsoDeviceFlowLogin, b6 as profile, b7 as projects, b8 as requireData, b9 as requireOk, ba as resolveAuth, bb as resolveCitations, bc as resolveWorkspace, bd as responses, be as selectWorkspace, bf as selectWorkspaceById, bg as sessions, bh as settings, bi as streamSSE, bj as stripCitationMarkdown, bk as summarizeCitations, bl as tags, bm as tasks, bn as workspaces } from './browser-B43Cvo9W.cjs';
|
|
3
3
|
import { SessionStorageProvider, ArbiClient, components } from '@arbidocs/client';
|
|
4
|
+
export { LoginProfile } from '@arbidocs/client';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Configuration persistence — file-based implementation for Node.js environments.
|
|
@@ -702,44 +703,6 @@ declare namespace agents {
|
|
|
702
703
|
export { type agents_AuthorizeAgentResponse as AuthorizeAgentResponse, type agents_AuthorizeLimitsResponse as AuthorizeLimitsResponse, agents_authorizeAgent as authorizeAgent, agents_createAgent as createAgent, agents_deleteAgents as deleteAgents, agents_getAgentConfig as getAgentConfig, agents_getAuthorizeLimits as getAuthorizeLimits, agents_listAgentWorkspaces as listAgentWorkspaces, agents_listAgents as listAgents };
|
|
703
704
|
}
|
|
704
705
|
|
|
705
|
-
/**
|
|
706
|
-
* Session operations — list active sessions.
|
|
707
|
-
*/
|
|
708
|
-
|
|
709
|
-
type SessionInfoResponse = components['schemas']['SessionInfoResponse'];
|
|
710
|
-
/**
|
|
711
|
-
* List all active sessions for the current user.
|
|
712
|
-
* Agents see only their own session.
|
|
713
|
-
*/
|
|
714
|
-
declare function listSessions(arbi: ArbiClient): Promise<SessionInfoResponse[]>;
|
|
715
|
-
|
|
716
|
-
declare const sessions_listSessions: typeof listSessions;
|
|
717
|
-
declare namespace sessions {
|
|
718
|
-
export { sessions_listSessions as listSessions };
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
/**
|
|
722
|
-
* User profile operations — the current user's display identity.
|
|
723
|
-
*/
|
|
724
|
-
|
|
725
|
-
type UpdateProfileRequest = components['schemas']['UpdateProfileRequest'];
|
|
726
|
-
/**
|
|
727
|
-
* Update the signed-in user's profile. Fields are optional — pass only what
|
|
728
|
-
* changes (e.g. `given_name`, `family_name`, `picture`).
|
|
729
|
-
*/
|
|
730
|
-
declare function updateProfile(arbi: ArbiClient, body: UpdateProfileRequest): Promise<{
|
|
731
|
-
given_name: string;
|
|
732
|
-
family_name?: string | null | undefined;
|
|
733
|
-
email: string;
|
|
734
|
-
picture?: string | null | undefined;
|
|
735
|
-
}>;
|
|
736
|
-
|
|
737
|
-
type profile_UpdateProfileRequest = UpdateProfileRequest;
|
|
738
|
-
declare const profile_updateProfile: typeof updateProfile;
|
|
739
|
-
declare namespace profile {
|
|
740
|
-
export { type profile_UpdateProfileRequest as UpdateProfileRequest, profile_updateProfile as updateProfile };
|
|
741
|
-
}
|
|
742
|
-
|
|
743
706
|
/**
|
|
744
707
|
* Orchestrator interface for `arbi listen`.
|
|
745
708
|
*
|
|
@@ -917,4 +880,4 @@ declare namespace index {
|
|
|
917
880
|
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 };
|
|
918
881
|
}
|
|
919
882
|
|
|
920
|
-
export { AuthHeaders, ChatSession, ClaudeOrchestrator, type ClaudeOrchestratorOptions, CliConfig, CliCredentials, ConfigStore, DmCryptoContext, type DmListener, type DmListenerOptions, FileConfigStore, OpenClawOrchestrator, type OpenClawOrchestratorOptions, type Orchestrator, type PromptContext, agents, deviceFlow, documentsNode, index as listen,
|
|
883
|
+
export { AuthHeaders, ChatSession, ClaudeOrchestrator, type ClaudeOrchestratorOptions, CliConfig, CliCredentials, ConfigStore, DmCryptoContext, type DmListener, type DmListenerOptions, FileConfigStore, OpenClawOrchestrator, type OpenClawOrchestratorOptions, type Orchestrator, type PromptContext, agents, deviceFlow, documentsNode, index as listen, startDmListener };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { q as ConfigStore, n as CliConfig, o as CliCredentials, C as ChatSession, ac as SkippedFile, al as UploadResult, k as AuthHeaders, ah as UploadBatchResult, ak as UploadOptions, ai as UploadDirectOptions, aj as UploadDirectResult, aa as SUPPORTED_EXTENSIONS, w as DmCryptoContext } from './browser-
|
|
2
|
-
export { b as AgentStepEvent, c as Arbi, d as ArbiApiError, e as ArbiError, g as ArbiOptions, h as ArbiSessionExpiredError, i as ArtifactEvent, j as AuthContext, l as AuthenticatedClient, m as CitationSummary, p as CommandDescriptor, r as ConnectOptions, D as DOC_TERMINAL_STATUSES, x as DocNameMap, y as DocumentListFields, z as DocumentListOrder, B as DocumentWaiter, E as DocumentWaiterOptions, I as FormattedWsMessage, L as ListAllOptions, K as ListPaginatedOptions, M as MessageLevel, N as MessageMetadataPayload, O as MessageQueuedEvent, P as OutputTokensDetails, Q as ParsedSlashCommand, S as ProjectInvoicesResponse, T as ProjectUsageResponse, U as QueryOptions, V as ReconnectOptions, W as ReconnectableWsConnection, X as ResolvedCitation, Y as ResolvedRecipient, Z as ResponseCompletedEvent, _ as ResponseContentPartAddedEvent, $ as ResponseCreatedEvent, a0 as ResponseFailedEvent, a1 as ResponseOutputItemAddedEvent, a2 as ResponseOutputItemDoneEvent, a3 as ResponseOutputTextDeltaEvent, a4 as ResponseOutputTextDoneEvent, a5 as ResponseUsage, a6 as SSEEvent, a7 as SSEStreamCallbacks, a8 as SSEStreamResult, a9 as SSEStreamStartData, ab as SkillSummary, ae as TokenBudgetContext, am as UserDailyUsageResponse, an as UserInfo, ao as UserInputRequestEvent, ap as UserMessageEvent, aq as WebSocketAuthError, ar as WorkspaceContext, as as WsConnection, at as
|
|
1
|
+
import { q as ConfigStore, n as CliConfig, o as CliCredentials, C as ChatSession, ac as SkippedFile, al as UploadResult, k as AuthHeaders, ah as UploadBatchResult, ak as UploadOptions, ai as UploadDirectOptions, aj as UploadDirectResult, aa as SUPPORTED_EXTENSIONS, w as DmCryptoContext } from './browser-B43Cvo9W.js';
|
|
2
|
+
export { b as AgentStepEvent, c as Arbi, d as ArbiApiError, e as ArbiError, g as ArbiOptions, h as ArbiSessionExpiredError, i as ArtifactEvent, j as AuthContext, l as AuthenticatedClient, m as CitationSummary, p as CommandDescriptor, r as ConnectOptions, D as DOC_TERMINAL_STATUSES, x as DocNameMap, y as DocumentListFields, z as DocumentListOrder, B as DocumentWaiter, E as DocumentWaiterOptions, I as FormattedWsMessage, L as ListAllOptions, K as ListPaginatedOptions, M as MessageLevel, N as MessageMetadataPayload, O as MessageQueuedEvent, P as OutputTokensDetails, Q as ParsedSlashCommand, S as ProjectInvoicesResponse, T as ProjectUsageResponse, U as QueryOptions, V as ReconnectOptions, W as ReconnectableWsConnection, X as ResolvedCitation, Y as ResolvedRecipient, Z as ResponseCompletedEvent, _ as ResponseContentPartAddedEvent, $ as ResponseCreatedEvent, a0 as ResponseFailedEvent, a1 as ResponseOutputItemAddedEvent, a2 as ResponseOutputItemDoneEvent, a3 as ResponseOutputTextDeltaEvent, a4 as ResponseOutputTextDoneEvent, a5 as ResponseUsage, a6 as SSEEvent, a7 as SSEStreamCallbacks, a8 as SSEStreamResult, a9 as SSEStreamStartData, ab as SkillSummary, ae as TokenBudgetContext, am as UserDailyUsageResponse, an as UserInfo, ao as UserInputRequestEvent, ap as UserMessageEvent, aq as WebSocketAuthError, ar as WorkspaceContext, as as WsConnection, at as account, au as agentconfig, av as assistant, aw as authenticatedFetch, ax as buildDocNameMap, ay as buildRetrievalChunkTool, az as buildRetrievalFullContextTool, aA as buildRetrievalTocTool, aB as connectWebSocket, aC as connectWithReconnect, aD as consumeSSEStream, aE as contacts, aF as conversations, aG as countCitations, aH as createAuthenticatedClient, aI as createDocumentWaiter, aJ as dm, aK as doctags, aL as documents, aM as facts, aN as files, aO as filterSkills, aP as formatAgentStepLabel, aQ as formatFileSize, aR as formatItemLabel, aS as formatStreamSummary, aT as formatUserName, aU as formatWorkspaceChoices, aV as formatWsMessage, aW as generateEncryptedWorkspaceKey, aX as generateNewWorkspaceKey, aY as getErrorCode, aZ as getErrorMessage, a_ as getRawWorkspaceKey, a$ as health, b0 as parseSSEEvents, b1 as parseSlashCommand, b2 as parseSlashTokenInProgress, b3 as performPasswordLogin, b4 as performSigningKeyLogin, b5 as performSsoDeviceFlowLogin, b6 as profile, b7 as projects, b8 as requireData, b9 as requireOk, ba as resolveAuth, bb as resolveCitations, bc as resolveWorkspace, bd as responses, be as selectWorkspace, bf as selectWorkspaceById, bg as sessions, bh as settings, bi as streamSSE, bj as stripCitationMarkdown, bk as summarizeCitations, bl as tags, bm as tasks, bn as workspaces } from './browser-B43Cvo9W.js';
|
|
3
3
|
import { SessionStorageProvider, ArbiClient, components } from '@arbidocs/client';
|
|
4
|
+
export { LoginProfile } from '@arbidocs/client';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Configuration persistence — file-based implementation for Node.js environments.
|
|
@@ -702,44 +703,6 @@ declare namespace agents {
|
|
|
702
703
|
export { type agents_AuthorizeAgentResponse as AuthorizeAgentResponse, type agents_AuthorizeLimitsResponse as AuthorizeLimitsResponse, agents_authorizeAgent as authorizeAgent, agents_createAgent as createAgent, agents_deleteAgents as deleteAgents, agents_getAgentConfig as getAgentConfig, agents_getAuthorizeLimits as getAuthorizeLimits, agents_listAgentWorkspaces as listAgentWorkspaces, agents_listAgents as listAgents };
|
|
703
704
|
}
|
|
704
705
|
|
|
705
|
-
/**
|
|
706
|
-
* Session operations — list active sessions.
|
|
707
|
-
*/
|
|
708
|
-
|
|
709
|
-
type SessionInfoResponse = components['schemas']['SessionInfoResponse'];
|
|
710
|
-
/**
|
|
711
|
-
* List all active sessions for the current user.
|
|
712
|
-
* Agents see only their own session.
|
|
713
|
-
*/
|
|
714
|
-
declare function listSessions(arbi: ArbiClient): Promise<SessionInfoResponse[]>;
|
|
715
|
-
|
|
716
|
-
declare const sessions_listSessions: typeof listSessions;
|
|
717
|
-
declare namespace sessions {
|
|
718
|
-
export { sessions_listSessions as listSessions };
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
/**
|
|
722
|
-
* User profile operations — the current user's display identity.
|
|
723
|
-
*/
|
|
724
|
-
|
|
725
|
-
type UpdateProfileRequest = components['schemas']['UpdateProfileRequest'];
|
|
726
|
-
/**
|
|
727
|
-
* Update the signed-in user's profile. Fields are optional — pass only what
|
|
728
|
-
* changes (e.g. `given_name`, `family_name`, `picture`).
|
|
729
|
-
*/
|
|
730
|
-
declare function updateProfile(arbi: ArbiClient, body: UpdateProfileRequest): Promise<{
|
|
731
|
-
given_name: string;
|
|
732
|
-
family_name?: string | null | undefined;
|
|
733
|
-
email: string;
|
|
734
|
-
picture?: string | null | undefined;
|
|
735
|
-
}>;
|
|
736
|
-
|
|
737
|
-
type profile_UpdateProfileRequest = UpdateProfileRequest;
|
|
738
|
-
declare const profile_updateProfile: typeof updateProfile;
|
|
739
|
-
declare namespace profile {
|
|
740
|
-
export { type profile_UpdateProfileRequest as UpdateProfileRequest, profile_updateProfile as updateProfile };
|
|
741
|
-
}
|
|
742
|
-
|
|
743
706
|
/**
|
|
744
707
|
* Orchestrator interface for `arbi listen`.
|
|
745
708
|
*
|
|
@@ -917,4 +880,4 @@ declare namespace index {
|
|
|
917
880
|
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 };
|
|
918
881
|
}
|
|
919
882
|
|
|
920
|
-
export { AuthHeaders, ChatSession, ClaudeOrchestrator, type ClaudeOrchestratorOptions, CliConfig, CliCredentials, ConfigStore, DmCryptoContext, type DmListener, type DmListenerOptions, FileConfigStore, OpenClawOrchestrator, type OpenClawOrchestratorOptions, type Orchestrator, type PromptContext, agents, deviceFlow, documentsNode, index as listen,
|
|
883
|
+
export { AuthHeaders, ChatSession, ClaudeOrchestrator, type ClaudeOrchestratorOptions, CliConfig, CliCredentials, ConfigStore, DmCryptoContext, type DmListener, type DmListenerOptions, FileConfigStore, OpenClawOrchestrator, type OpenClawOrchestratorOptions, type Orchestrator, type PromptContext, agents, deviceFlow, documentsNode, index as listen, 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 } from '@arbidocs/client';
|
|
4
|
+
import { createArbiClient, base64ToBytes, deriveEncryptionKeypairFromSigning, sealedBoxDecrypt, sealKeyForSession, buildWebSocketUrl, createAuthMessage, parseServerMessage, isMessageType, createContentHash, encryptFile, changePasswordWithRekey } from '@arbidocs/client';
|
|
5
5
|
import { execSync, spawn } from 'child_process';
|
|
6
6
|
import { createHash } from 'crypto';
|
|
7
7
|
import { fileURLToPath } from 'url';
|
|
@@ -3572,14 +3572,15 @@ async function extractErrorMessage(res) {
|
|
|
3572
3572
|
return `Request failed: ${res.status} ${res.statusText}`;
|
|
3573
3573
|
}
|
|
3574
3574
|
async function authenticatedFetch(options) {
|
|
3575
|
-
const { baseUrl, accessToken, path: path3, method, body, headers } = options;
|
|
3575
|
+
const { baseUrl, accessToken, path: path3, method, body, headers, signal } = options;
|
|
3576
3576
|
const res = await fetch(`${baseUrl}${path3}`, {
|
|
3577
3577
|
method: method ?? (body ? "POST" : "GET"),
|
|
3578
3578
|
headers: {
|
|
3579
3579
|
Authorization: `Bearer ${accessToken}`,
|
|
3580
3580
|
...headers
|
|
3581
3581
|
},
|
|
3582
|
-
body
|
|
3582
|
+
body,
|
|
3583
|
+
signal
|
|
3583
3584
|
});
|
|
3584
3585
|
if (!res.ok) {
|
|
3585
3586
|
const message = await extractErrorMessage(res);
|
|
@@ -5019,6 +5020,7 @@ async function uploadFile(auth, fileData, fileName, options) {
|
|
|
5019
5020
|
if (options?.folder) params.set("folder", sanitizeFolderPath(options.folder));
|
|
5020
5021
|
if (options?.configExtId) params.set("config_ext_id", options.configExtId);
|
|
5021
5022
|
if (options?.wpType) params.set("wp_type", options.wpType);
|
|
5023
|
+
if (options?.parentExtId) params.set("parent_ext_id", options.parentExtId);
|
|
5022
5024
|
const qs = params.toString();
|
|
5023
5025
|
const res = await authenticatedFetch({
|
|
5024
5026
|
...auth,
|
|
@@ -5035,6 +5037,7 @@ async function uploadFiles(auth, files, options) {
|
|
|
5035
5037
|
if (options?.folder) params.set("folder", sanitizeFolderPath(options.folder));
|
|
5036
5038
|
if (options?.configExtId) params.set("config_ext_id", options.configExtId);
|
|
5037
5039
|
if (options?.wpType) params.set("wp_type", options.wpType);
|
|
5040
|
+
if (options?.parentExtId) params.set("parent_ext_id", options.parentExtId);
|
|
5038
5041
|
const qs = params.toString();
|
|
5039
5042
|
const res = await authenticatedFetch({
|
|
5040
5043
|
...auth,
|
|
@@ -5465,7 +5468,7 @@ async function retrieve(options) {
|
|
|
5465
5468
|
return data;
|
|
5466
5469
|
}
|
|
5467
5470
|
async function queryAssistant(options) {
|
|
5468
|
-
const { workspaceId, question, docIds, previousResponseId, model, ...auth } = options;
|
|
5471
|
+
const { workspaceId, question, docIds, previousResponseId, model, signal, ...auth } = options;
|
|
5469
5472
|
const body = {
|
|
5470
5473
|
input: question,
|
|
5471
5474
|
workspace_ext_id: workspaceId,
|
|
@@ -5484,7 +5487,8 @@ async function queryAssistant(options) {
|
|
|
5484
5487
|
path: "/v1/assistant/query",
|
|
5485
5488
|
method: "POST",
|
|
5486
5489
|
body: JSON.stringify(body),
|
|
5487
|
-
headers: { "Content-Type": "application/json" }
|
|
5490
|
+
headers: { "Content-Type": "application/json" },
|
|
5491
|
+
signal
|
|
5488
5492
|
});
|
|
5489
5493
|
}
|
|
5490
5494
|
async function respondToAgent(arbi, assistantMessageExtId, answer) {
|
|
@@ -6032,11 +6036,76 @@ async function getFileContent(auth, fileId) {
|
|
|
6032
6036
|
// src/operations/sessions.ts
|
|
6033
6037
|
var sessions_exports = {};
|
|
6034
6038
|
__export(sessions_exports, {
|
|
6035
|
-
|
|
6039
|
+
currentSessionId: () => currentSessionId,
|
|
6040
|
+
listSessions: () => listSessions,
|
|
6041
|
+
logoutAllSessions: () => logoutAllSessions,
|
|
6042
|
+
terminateSession: () => terminateSession
|
|
6036
6043
|
});
|
|
6037
6044
|
async function listSessions(arbi) {
|
|
6038
6045
|
return requireData(await arbi.fetch.GET("/v1/user/sessions"), "Failed to fetch sessions");
|
|
6039
6046
|
}
|
|
6047
|
+
async function terminateSession(arbi, sessionId) {
|
|
6048
|
+
requireOk(
|
|
6049
|
+
await arbi.fetch.PATCH("/v1/user/sessions/{session_id}", {
|
|
6050
|
+
params: { path: { session_id: sessionId } },
|
|
6051
|
+
body: { ttl: 0 }
|
|
6052
|
+
}),
|
|
6053
|
+
"Failed to end session"
|
|
6054
|
+
);
|
|
6055
|
+
}
|
|
6056
|
+
async function logoutAllSessions(arbi) {
|
|
6057
|
+
requireOk(
|
|
6058
|
+
await arbi.fetch.POST("/v1/user/logout", { params: { query: { all_sessions: true } } }),
|
|
6059
|
+
"Failed to sign out of all sessions"
|
|
6060
|
+
);
|
|
6061
|
+
}
|
|
6062
|
+
function currentSessionId(accessToken) {
|
|
6063
|
+
const payload = accessToken?.split(".")[1];
|
|
6064
|
+
if (!payload) return null;
|
|
6065
|
+
try {
|
|
6066
|
+
const claims = JSON.parse(atob(payload.replace(/-/g, "+").replace(/_/g, "/")));
|
|
6067
|
+
return typeof claims.sk === "string" ? claims.sk.slice(0, 12) : null;
|
|
6068
|
+
} catch {
|
|
6069
|
+
return null;
|
|
6070
|
+
}
|
|
6071
|
+
}
|
|
6072
|
+
|
|
6073
|
+
// src/operations/profile.ts
|
|
6074
|
+
var profile_exports = {};
|
|
6075
|
+
__export(profile_exports, {
|
|
6076
|
+
updateProfile: () => updateProfile
|
|
6077
|
+
});
|
|
6078
|
+
async function updateProfile(arbi, body) {
|
|
6079
|
+
return requireData(
|
|
6080
|
+
await arbi.fetch.PATCH("/v1/user/profile", { body }),
|
|
6081
|
+
"Failed to update profile"
|
|
6082
|
+
);
|
|
6083
|
+
}
|
|
6084
|
+
|
|
6085
|
+
// src/operations/account.ts
|
|
6086
|
+
var account_exports = {};
|
|
6087
|
+
__export(account_exports, {
|
|
6088
|
+
confirmEmailChange: () => confirmEmailChange,
|
|
6089
|
+
requestDeletion: () => requestDeletion,
|
|
6090
|
+
requestEmailChange: () => requestEmailChange
|
|
6091
|
+
});
|
|
6092
|
+
async function requestEmailChange(arbi, newEmail) {
|
|
6093
|
+
requireOk(
|
|
6094
|
+
await arbi.fetch.POST("/v1/user/request-email-change", { body: { new_email: newEmail } }),
|
|
6095
|
+
"Failed to send the verification code"
|
|
6096
|
+
);
|
|
6097
|
+
}
|
|
6098
|
+
async function confirmEmailChange(arbi, newEmail, verificationCode) {
|
|
6099
|
+
return requireData(
|
|
6100
|
+
await arbi.fetch.POST("/v1/user/confirm-email-change", {
|
|
6101
|
+
body: { new_email: newEmail, verification_code: verificationCode }
|
|
6102
|
+
}),
|
|
6103
|
+
"Invalid or expired verification code"
|
|
6104
|
+
);
|
|
6105
|
+
}
|
|
6106
|
+
async function requestDeletion(arbi) {
|
|
6107
|
+
return requireData(await arbi.fetch.POST("/v1/user/request-deletion"), "Failed to delete account");
|
|
6108
|
+
}
|
|
6040
6109
|
|
|
6041
6110
|
// src/operations/projects.ts
|
|
6042
6111
|
var projects_exports = {};
|
|
@@ -6246,6 +6315,8 @@ function tokenExpiresWithin(token, seconds) {
|
|
|
6246
6315
|
var Arbi = class {
|
|
6247
6316
|
client = null;
|
|
6248
6317
|
loginResult = null;
|
|
6318
|
+
userProfile = null;
|
|
6319
|
+
profileListeners = /* @__PURE__ */ new Set();
|
|
6249
6320
|
currentWorkspaceId = null;
|
|
6250
6321
|
dmCryptoContext = null;
|
|
6251
6322
|
sessionExpiredListeners = /* @__PURE__ */ new Set();
|
|
@@ -6294,6 +6365,7 @@ var Arbi = class {
|
|
|
6294
6365
|
async login(email, password) {
|
|
6295
6366
|
const client = await this.init();
|
|
6296
6367
|
this.loginResult = await client.auth.login({ email, password });
|
|
6368
|
+
this.userProfile = this.loginResult.profile ?? null;
|
|
6297
6369
|
}
|
|
6298
6370
|
/**
|
|
6299
6371
|
* Recover a session using a stored signing private key (base64).
|
|
@@ -6303,6 +6375,7 @@ var Arbi = class {
|
|
|
6303
6375
|
const client = await this.init();
|
|
6304
6376
|
const signingPrivateKey = client.crypto.base64ToBytes(signingPrivateKeyBase64);
|
|
6305
6377
|
this.loginResult = await client.auth.loginWithKey({ email, signingPrivateKey });
|
|
6378
|
+
this.userProfile = this.loginResult.profile ?? null;
|
|
6306
6379
|
}
|
|
6307
6380
|
/** A workspace's key, sealed to the caller's own session (what `/open` and `POST /workspace/users` take). */
|
|
6308
6381
|
async sealWorkspaceKey(workspaceId) {
|
|
@@ -6362,6 +6435,7 @@ var Arbi = class {
|
|
|
6362
6435
|
this.loginResult.serverSessionKey.fill(0);
|
|
6363
6436
|
}
|
|
6364
6437
|
this.loginResult = null;
|
|
6438
|
+
this.userProfile = null;
|
|
6365
6439
|
this.currentWorkspaceId = null;
|
|
6366
6440
|
this.dmCryptoContext = null;
|
|
6367
6441
|
this.client?.session.clear();
|
|
@@ -6392,6 +6466,10 @@ var Arbi = class {
|
|
|
6392
6466
|
return run();
|
|
6393
6467
|
}
|
|
6394
6468
|
}
|
|
6469
|
+
setUserProfile(profile) {
|
|
6470
|
+
this.userProfile = profile;
|
|
6471
|
+
for (const listener of [...this.profileListeners]) listener(profile);
|
|
6472
|
+
}
|
|
6395
6473
|
/** Log out and clear internal state. */
|
|
6396
6474
|
async logout() {
|
|
6397
6475
|
if (this.client) {
|
|
@@ -6402,6 +6480,7 @@ var Arbi = class {
|
|
|
6402
6480
|
this.loginResult.serverSessionKey.fill(0);
|
|
6403
6481
|
}
|
|
6404
6482
|
this.loginResult = null;
|
|
6483
|
+
this.userProfile = null;
|
|
6405
6484
|
this.currentWorkspaceId = null;
|
|
6406
6485
|
this.dmCryptoContext = null;
|
|
6407
6486
|
}
|
|
@@ -6475,9 +6554,76 @@ var Arbi = class {
|
|
|
6475
6554
|
const state = this.requireClient().session.getState();
|
|
6476
6555
|
return state.userExtId ? { externalId: state.userExtId, email: state.userEmail ?? null } : null;
|
|
6477
6556
|
},
|
|
6557
|
+
/**
|
|
6558
|
+
* The signed-in user's profile (name, picture, email, SSO flag) as the login response
|
|
6559
|
+
* carried it, kept current by `profile.update` and `account.confirmEmailChange`. `null` when
|
|
6560
|
+
* not logged in or when the session was restored without a login (then read the workspace
|
|
6561
|
+
* roster instead).
|
|
6562
|
+
*/
|
|
6563
|
+
profile: () => this.userProfile,
|
|
6564
|
+
/** Be told when the profile changes (name, picture or email saved). Returns the unsubscribe. */
|
|
6565
|
+
onProfileChange: (listener) => {
|
|
6566
|
+
this.profileListeners.add(listener);
|
|
6567
|
+
return () => this.profileListeners.delete(listener);
|
|
6568
|
+
},
|
|
6478
6569
|
/** Today's deployment-wide credit spend for the current user. */
|
|
6479
6570
|
usageToday: () => getUserUsageToday(this.requireClient())
|
|
6480
6571
|
};
|
|
6572
|
+
// ── Profile ───────────────────────────────────────────────────────────
|
|
6573
|
+
profile = {
|
|
6574
|
+
/** Update the display profile; pass only what changes (`''` clears family name or picture). */
|
|
6575
|
+
update: async (body) => {
|
|
6576
|
+
const updated = await updateProfile(this.requireClient(), body);
|
|
6577
|
+
if (this.userProfile) {
|
|
6578
|
+
this.setUserProfile({
|
|
6579
|
+
...this.userProfile,
|
|
6580
|
+
givenName: updated.given_name ?? this.userProfile.givenName,
|
|
6581
|
+
familyName: updated.family_name ?? null,
|
|
6582
|
+
picture: updated.picture ?? null
|
|
6583
|
+
});
|
|
6584
|
+
}
|
|
6585
|
+
return updated;
|
|
6586
|
+
}
|
|
6587
|
+
};
|
|
6588
|
+
// ── Account ───────────────────────────────────────────────────────────
|
|
6589
|
+
account = {
|
|
6590
|
+
/** Send a verification code to the new address (not for SSO accounts). */
|
|
6591
|
+
requestEmailChange: (newEmail) => requestEmailChange(this.requireClient(), newEmail),
|
|
6592
|
+
/** Confirm the email change with the emailed code; the session and profile follow. */
|
|
6593
|
+
confirmEmailChange: async (newEmail, verificationCode) => {
|
|
6594
|
+
const client = this.requireClient();
|
|
6595
|
+
const result = await confirmEmailChange(client, newEmail, verificationCode);
|
|
6596
|
+
client.session.setUser(result.email, client.session.getState().userExtId ?? void 0);
|
|
6597
|
+
if (this.userProfile) this.setUserProfile({ ...this.userProfile, email: result.email });
|
|
6598
|
+
return result;
|
|
6599
|
+
},
|
|
6600
|
+
/**
|
|
6601
|
+
* Change (or, after recovery, set) the master password: re-keys the workspaces and direct
|
|
6602
|
+
* messages. Omit `currentPassword` in recovery mode. Resolves with the new signing key, whose
|
|
6603
|
+
* recovery file the user should save.
|
|
6604
|
+
*/
|
|
6605
|
+
changePassword: async (params) => {
|
|
6606
|
+
const client = this.requireClient();
|
|
6607
|
+
const lr2 = this.requireLogin();
|
|
6608
|
+
const email = client.session.getState().userEmail ?? this.userProfile?.email;
|
|
6609
|
+
if (!email) throw new ArbiError("The account email is unknown; sign in again.");
|
|
6610
|
+
const result = await changePasswordWithRekey(
|
|
6611
|
+
{ ...params, email, userExtId: lr2.userExtId },
|
|
6612
|
+
{
|
|
6613
|
+
fetchClient: client.fetch,
|
|
6614
|
+
deploymentDomain: this.options.deploymentDomain ?? new URL(this.options.url).hostname
|
|
6615
|
+
}
|
|
6616
|
+
);
|
|
6617
|
+
this.loginResult = { ...lr2, signingPrivateKey: result.newSigningPrivateKey };
|
|
6618
|
+
return result;
|
|
6619
|
+
},
|
|
6620
|
+
/** Close the account (soft delete) and sign out. Refused while a subscription is active. */
|
|
6621
|
+
requestDeletion: async () => {
|
|
6622
|
+
const result = await requestDeletion(this.requireClient());
|
|
6623
|
+
await this.logout();
|
|
6624
|
+
return result;
|
|
6625
|
+
}
|
|
6626
|
+
};
|
|
6481
6627
|
// ── Workspaces ────────────────────────────────────────────────────────
|
|
6482
6628
|
workspaces = {
|
|
6483
6629
|
list: () => listWorkspaces(this.requireClient()),
|
|
@@ -6583,12 +6729,7 @@ var Arbi = class {
|
|
|
6583
6729
|
uploadFile: (fileData, fileName, options) => {
|
|
6584
6730
|
this.requireWorkspace();
|
|
6585
6731
|
return this.recovering(
|
|
6586
|
-
() => uploadFile(
|
|
6587
|
-
this.getAuthHeaders(),
|
|
6588
|
-
fileData,
|
|
6589
|
-
fileName,
|
|
6590
|
-
options?.folder ? { folder: options.folder } : void 0
|
|
6591
|
-
)
|
|
6732
|
+
() => uploadFile(this.getAuthHeaders(), fileData, fileName, options)
|
|
6592
6733
|
);
|
|
6593
6734
|
},
|
|
6594
6735
|
download: (docId) => this.recovering(() => downloadDocument(this.getAuthHeaders(), docId)),
|
|
@@ -6620,7 +6761,8 @@ var Arbi = class {
|
|
|
6620
6761
|
question,
|
|
6621
6762
|
docIds: options.docIds,
|
|
6622
6763
|
previousResponseId: options.previousResponseId,
|
|
6623
|
-
model: options.model
|
|
6764
|
+
model: options.model,
|
|
6765
|
+
signal: options.signal
|
|
6624
6766
|
})
|
|
6625
6767
|
);
|
|
6626
6768
|
const callbacks = {
|
|
@@ -6868,7 +7010,16 @@ var Arbi = class {
|
|
|
6868
7010
|
};
|
|
6869
7011
|
// ── Sessions ────────────────────────────────────────────────────────
|
|
6870
7012
|
sessions = {
|
|
6871
|
-
list: () => listSessions(this.requireClient())
|
|
7013
|
+
list: () => listSessions(this.requireClient()),
|
|
7014
|
+
/** The id this device's session is listed under in `list()`; `null` when unknown. */
|
|
7015
|
+
currentId: () => currentSessionId(this.client?.session.getState().accessToken),
|
|
7016
|
+
/** End one of your own sessions now (not the one this device is on: that is `logout`). */
|
|
7017
|
+
terminate: (sessionId) => terminateSession(this.requireClient(), sessionId),
|
|
7018
|
+
/** Sign out of every device on the server, then clear this instance. */
|
|
7019
|
+
logoutAll: async () => {
|
|
7020
|
+
await logoutAllSessions(this.requireClient());
|
|
7021
|
+
await this.logout();
|
|
7022
|
+
}
|
|
6872
7023
|
};
|
|
6873
7024
|
// ── Internal guards ───────────────────────────────────────────────────
|
|
6874
7025
|
requireClient() {
|
|
@@ -7699,18 +7850,6 @@ function extractResponseText(response) {
|
|
|
7699
7850
|
return parts.join("");
|
|
7700
7851
|
}
|
|
7701
7852
|
|
|
7702
|
-
// src/operations/profile.ts
|
|
7703
|
-
var profile_exports = {};
|
|
7704
|
-
__export(profile_exports, {
|
|
7705
|
-
updateProfile: () => updateProfile
|
|
7706
|
-
});
|
|
7707
|
-
async function updateProfile(arbi, body) {
|
|
7708
|
-
return requireData(
|
|
7709
|
-
await arbi.fetch.PATCH("/v1/user/profile", { body }),
|
|
7710
|
-
"Failed to update profile"
|
|
7711
|
-
);
|
|
7712
|
-
}
|
|
7713
|
-
|
|
7714
7853
|
// src/listen/index.ts
|
|
7715
7854
|
var listen_exports = {};
|
|
7716
7855
|
__export(listen_exports, {
|
|
@@ -8013,6 +8152,6 @@ async function startDmListener(options) {
|
|
|
8013
8152
|
};
|
|
8014
8153
|
}
|
|
8015
8154
|
|
|
8016
|
-
export { Arbi, ArbiApiError, ArbiError, ArbiSessionExpiredError, ClaudeOrchestrator, DOC_TERMINAL_STATUSES, FileConfigStore, OpenClawOrchestrator, WebSocketAuthError, 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, tasks_exports as tasks, workspaces_exports as workspaces };
|
|
8155
|
+
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, tasks_exports as tasks, workspaces_exports as workspaces };
|
|
8017
8156
|
//# sourceMappingURL=index.js.map
|
|
8018
8157
|
//# sourceMappingURL=index.js.map
|