@arbidocs/sdk 0.4.5 → 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-5spRium9.d.cts → browser-B43Cvo9W.d.cts} +139 -2
- package/dist/{browser-5spRium9.d.ts → browser-B43Cvo9W.d.ts} +139 -2
- package/dist/browser.cjs +167 -6
- 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 +166 -8
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +162 -19
- 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 +163 -21
- 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);
|
|
@@ -5467,7 +5468,7 @@ async function retrieve(options) {
|
|
|
5467
5468
|
return data;
|
|
5468
5469
|
}
|
|
5469
5470
|
async function queryAssistant(options) {
|
|
5470
|
-
const { workspaceId, question, docIds, previousResponseId, model, ...auth } = options;
|
|
5471
|
+
const { workspaceId, question, docIds, previousResponseId, model, signal, ...auth } = options;
|
|
5471
5472
|
const body = {
|
|
5472
5473
|
input: question,
|
|
5473
5474
|
workspace_ext_id: workspaceId,
|
|
@@ -5486,7 +5487,8 @@ async function queryAssistant(options) {
|
|
|
5486
5487
|
path: "/v1/assistant/query",
|
|
5487
5488
|
method: "POST",
|
|
5488
5489
|
body: JSON.stringify(body),
|
|
5489
|
-
headers: { "Content-Type": "application/json" }
|
|
5490
|
+
headers: { "Content-Type": "application/json" },
|
|
5491
|
+
signal
|
|
5490
5492
|
});
|
|
5491
5493
|
}
|
|
5492
5494
|
async function respondToAgent(arbi, assistantMessageExtId, answer) {
|
|
@@ -6034,11 +6036,76 @@ async function getFileContent(auth, fileId) {
|
|
|
6034
6036
|
// src/operations/sessions.ts
|
|
6035
6037
|
var sessions_exports = {};
|
|
6036
6038
|
__export(sessions_exports, {
|
|
6037
|
-
|
|
6039
|
+
currentSessionId: () => currentSessionId,
|
|
6040
|
+
listSessions: () => listSessions,
|
|
6041
|
+
logoutAllSessions: () => logoutAllSessions,
|
|
6042
|
+
terminateSession: () => terminateSession
|
|
6038
6043
|
});
|
|
6039
6044
|
async function listSessions(arbi) {
|
|
6040
6045
|
return requireData(await arbi.fetch.GET("/v1/user/sessions"), "Failed to fetch sessions");
|
|
6041
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
|
+
}
|
|
6042
6109
|
|
|
6043
6110
|
// src/operations/projects.ts
|
|
6044
6111
|
var projects_exports = {};
|
|
@@ -6248,6 +6315,8 @@ function tokenExpiresWithin(token, seconds) {
|
|
|
6248
6315
|
var Arbi = class {
|
|
6249
6316
|
client = null;
|
|
6250
6317
|
loginResult = null;
|
|
6318
|
+
userProfile = null;
|
|
6319
|
+
profileListeners = /* @__PURE__ */ new Set();
|
|
6251
6320
|
currentWorkspaceId = null;
|
|
6252
6321
|
dmCryptoContext = null;
|
|
6253
6322
|
sessionExpiredListeners = /* @__PURE__ */ new Set();
|
|
@@ -6296,6 +6365,7 @@ var Arbi = class {
|
|
|
6296
6365
|
async login(email, password) {
|
|
6297
6366
|
const client = await this.init();
|
|
6298
6367
|
this.loginResult = await client.auth.login({ email, password });
|
|
6368
|
+
this.userProfile = this.loginResult.profile ?? null;
|
|
6299
6369
|
}
|
|
6300
6370
|
/**
|
|
6301
6371
|
* Recover a session using a stored signing private key (base64).
|
|
@@ -6305,6 +6375,7 @@ var Arbi = class {
|
|
|
6305
6375
|
const client = await this.init();
|
|
6306
6376
|
const signingPrivateKey = client.crypto.base64ToBytes(signingPrivateKeyBase64);
|
|
6307
6377
|
this.loginResult = await client.auth.loginWithKey({ email, signingPrivateKey });
|
|
6378
|
+
this.userProfile = this.loginResult.profile ?? null;
|
|
6308
6379
|
}
|
|
6309
6380
|
/** A workspace's key, sealed to the caller's own session (what `/open` and `POST /workspace/users` take). */
|
|
6310
6381
|
async sealWorkspaceKey(workspaceId) {
|
|
@@ -6364,6 +6435,7 @@ var Arbi = class {
|
|
|
6364
6435
|
this.loginResult.serverSessionKey.fill(0);
|
|
6365
6436
|
}
|
|
6366
6437
|
this.loginResult = null;
|
|
6438
|
+
this.userProfile = null;
|
|
6367
6439
|
this.currentWorkspaceId = null;
|
|
6368
6440
|
this.dmCryptoContext = null;
|
|
6369
6441
|
this.client?.session.clear();
|
|
@@ -6394,6 +6466,10 @@ var Arbi = class {
|
|
|
6394
6466
|
return run();
|
|
6395
6467
|
}
|
|
6396
6468
|
}
|
|
6469
|
+
setUserProfile(profile) {
|
|
6470
|
+
this.userProfile = profile;
|
|
6471
|
+
for (const listener of [...this.profileListeners]) listener(profile);
|
|
6472
|
+
}
|
|
6397
6473
|
/** Log out and clear internal state. */
|
|
6398
6474
|
async logout() {
|
|
6399
6475
|
if (this.client) {
|
|
@@ -6404,6 +6480,7 @@ var Arbi = class {
|
|
|
6404
6480
|
this.loginResult.serverSessionKey.fill(0);
|
|
6405
6481
|
}
|
|
6406
6482
|
this.loginResult = null;
|
|
6483
|
+
this.userProfile = null;
|
|
6407
6484
|
this.currentWorkspaceId = null;
|
|
6408
6485
|
this.dmCryptoContext = null;
|
|
6409
6486
|
}
|
|
@@ -6477,9 +6554,76 @@ var Arbi = class {
|
|
|
6477
6554
|
const state = this.requireClient().session.getState();
|
|
6478
6555
|
return state.userExtId ? { externalId: state.userExtId, email: state.userEmail ?? null } : null;
|
|
6479
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
|
+
},
|
|
6480
6569
|
/** Today's deployment-wide credit spend for the current user. */
|
|
6481
6570
|
usageToday: () => getUserUsageToday(this.requireClient())
|
|
6482
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
|
+
};
|
|
6483
6627
|
// ── Workspaces ────────────────────────────────────────────────────────
|
|
6484
6628
|
workspaces = {
|
|
6485
6629
|
list: () => listWorkspaces(this.requireClient()),
|
|
@@ -6617,7 +6761,8 @@ var Arbi = class {
|
|
|
6617
6761
|
question,
|
|
6618
6762
|
docIds: options.docIds,
|
|
6619
6763
|
previousResponseId: options.previousResponseId,
|
|
6620
|
-
model: options.model
|
|
6764
|
+
model: options.model,
|
|
6765
|
+
signal: options.signal
|
|
6621
6766
|
})
|
|
6622
6767
|
);
|
|
6623
6768
|
const callbacks = {
|
|
@@ -6865,7 +7010,16 @@ var Arbi = class {
|
|
|
6865
7010
|
};
|
|
6866
7011
|
// ── Sessions ────────────────────────────────────────────────────────
|
|
6867
7012
|
sessions = {
|
|
6868
|
-
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
|
+
}
|
|
6869
7023
|
};
|
|
6870
7024
|
// ── Internal guards ───────────────────────────────────────────────────
|
|
6871
7025
|
requireClient() {
|
|
@@ -7696,18 +7850,6 @@ function extractResponseText(response) {
|
|
|
7696
7850
|
return parts.join("");
|
|
7697
7851
|
}
|
|
7698
7852
|
|
|
7699
|
-
// src/operations/profile.ts
|
|
7700
|
-
var profile_exports = {};
|
|
7701
|
-
__export(profile_exports, {
|
|
7702
|
-
updateProfile: () => updateProfile
|
|
7703
|
-
});
|
|
7704
|
-
async function updateProfile(arbi, body) {
|
|
7705
|
-
return requireData(
|
|
7706
|
-
await arbi.fetch.PATCH("/v1/user/profile", { body }),
|
|
7707
|
-
"Failed to update profile"
|
|
7708
|
-
);
|
|
7709
|
-
}
|
|
7710
|
-
|
|
7711
7853
|
// src/listen/index.ts
|
|
7712
7854
|
var listen_exports = {};
|
|
7713
7855
|
__export(listen_exports, {
|
|
@@ -8010,6 +8152,6 @@ async function startDmListener(options) {
|
|
|
8010
8152
|
};
|
|
8011
8153
|
}
|
|
8012
8154
|
|
|
8013
|
-
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 };
|
|
8014
8156
|
//# sourceMappingURL=index.js.map
|
|
8015
8157
|
//# sourceMappingURL=index.js.map
|