@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/browser.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { A as AgentControlStateEvent, a as AgentStepDeltaEvent, b as AgentStepEvent, c as Arbi, d as ArbiApiError, e as ArbiError, f as ArbiErrorEvent, g as ArbiOptions, i as ArtifactEvent, j as AuthContext, k as AuthHeaders, l as AuthenticatedClient, C as ChatSession, m as CitationSummary, n as CliConfig, o as CliCredentials, p as CommandDescriptor, q as ConfigStore, r as ConnectOptions, s as CreateFactRequest, t as CreateFactsRequest, u as CreateTaskRequest, v as DeferredInterjectionEvent, F as FactResponse, G as FactSearchRequest, H as FactSearchResponse, J as ListFactsOptions, N as MessageMetadataPayload, O as MessageQueuedEvent, P as OutputTokensDetails, Q as ParsedSlashCommand, R as ProbeAnswerEvent, S as ProjectInvoicesResponse, T as ProjectUsageResponse, U as QueryOptions, V as ReconnectOptions, W as ReconnectableWsConnection, X as ResolvedCitation, 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, ad as TaskResponse, ae as TokenBudgetContext, af as UpdateFactRequest, ag as UpdateTaskRequest, am as UserDailyUsageResponse, an as UserInfo, ao as UserInputRequestEvent, ap as UserMessageEvent, aq as WebSocketAuthError, ar as WorkspaceContext, as as WsConnection, at as
|
|
2
|
-
|
|
1
|
+
export { A as AgentControlStateEvent, a as AgentStepDeltaEvent, b as AgentStepEvent, c as Arbi, d as ArbiApiError, e as ArbiError, f as ArbiErrorEvent, g as ArbiOptions, i as ArtifactEvent, j as AuthContext, k as AuthHeaders, l as AuthenticatedClient, C as ChatSession, m as CitationSummary, n as CliConfig, o as CliCredentials, p as CommandDescriptor, q as ConfigStore, r as ConnectOptions, s as CreateFactRequest, t as CreateFactsRequest, u as CreateTaskRequest, v as DeferredInterjectionEvent, F as FactResponse, G as FactSearchRequest, H as FactSearchResponse, J as ListFactsOptions, N as MessageMetadataPayload, O as MessageQueuedEvent, P as OutputTokensDetails, Q as ParsedSlashCommand, R as ProbeAnswerEvent, S as ProjectInvoicesResponse, T as ProjectUsageResponse, U as QueryOptions, V as ReconnectOptions, W as ReconnectableWsConnection, X as ResolvedCitation, 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, ad as TaskResponse, ae as TokenBudgetContext, af as UpdateFactRequest, ag as UpdateTaskRequest, 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, 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, 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, aT as formatUserName, aU as formatWorkspaceChoices, aZ as getErrorMessage, a_ as getRawWorkspaceKey, a$ as health, b0 as parseSSEEvents, b1 as parseSlashCommand, b2 as parseSlashTokenInProgress, b3 as performPasswordLogin, 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';
|
|
2
|
+
export { LoginProfile } from '@arbidocs/client';
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { A as AgentControlStateEvent, a as AgentStepDeltaEvent, b as AgentStepEvent, c as Arbi, d as ArbiApiError, e as ArbiError, f as ArbiErrorEvent, g as ArbiOptions, i as ArtifactEvent, j as AuthContext, k as AuthHeaders, l as AuthenticatedClient, C as ChatSession, m as CitationSummary, n as CliConfig, o as CliCredentials, p as CommandDescriptor, q as ConfigStore, r as ConnectOptions, s as CreateFactRequest, t as CreateFactsRequest, u as CreateTaskRequest, v as DeferredInterjectionEvent, F as FactResponse, G as FactSearchRequest, H as FactSearchResponse, J as ListFactsOptions, N as MessageMetadataPayload, O as MessageQueuedEvent, P as OutputTokensDetails, Q as ParsedSlashCommand, R as ProbeAnswerEvent, S as ProjectInvoicesResponse, T as ProjectUsageResponse, U as QueryOptions, V as ReconnectOptions, W as ReconnectableWsConnection, X as ResolvedCitation, 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, ad as TaskResponse, ae as TokenBudgetContext, af as UpdateFactRequest, ag as UpdateTaskRequest, am as UserDailyUsageResponse, an as UserInfo, ao as UserInputRequestEvent, ap as UserMessageEvent, aq as WebSocketAuthError, ar as WorkspaceContext, as as WsConnection, at as
|
|
2
|
-
|
|
1
|
+
export { A as AgentControlStateEvent, a as AgentStepDeltaEvent, b as AgentStepEvent, c as Arbi, d as ArbiApiError, e as ArbiError, f as ArbiErrorEvent, g as ArbiOptions, i as ArtifactEvent, j as AuthContext, k as AuthHeaders, l as AuthenticatedClient, C as ChatSession, m as CitationSummary, n as CliConfig, o as CliCredentials, p as CommandDescriptor, q as ConfigStore, r as ConnectOptions, s as CreateFactRequest, t as CreateFactsRequest, u as CreateTaskRequest, v as DeferredInterjectionEvent, F as FactResponse, G as FactSearchRequest, H as FactSearchResponse, J as ListFactsOptions, N as MessageMetadataPayload, O as MessageQueuedEvent, P as OutputTokensDetails, Q as ParsedSlashCommand, R as ProbeAnswerEvent, S as ProjectInvoicesResponse, T as ProjectUsageResponse, U as QueryOptions, V as ReconnectOptions, W as ReconnectableWsConnection, X as ResolvedCitation, 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, ad as TaskResponse, ae as TokenBudgetContext, af as UpdateFactRequest, ag as UpdateTaskRequest, 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, 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, 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, aT as formatUserName, aU as formatWorkspaceChoices, aZ as getErrorMessage, a_ as getRawWorkspaceKey, a$ as health, b0 as parseSSEEvents, b1 as parseSlashCommand, b2 as parseSlashTokenInProgress, b3 as performPasswordLogin, 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';
|
|
2
|
+
export { LoginProfile } from '@arbidocs/client';
|
package/dist/browser.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createArbiClient, base64ToBytes, deriveEncryptionKeypairFromSigning, sealedBoxDecrypt, sealKeyForSession, buildWebSocketUrl, createAuthMessage, parseServerMessage, isMessageType, createContentHash, encryptFile } from '@arbidocs/client';
|
|
1
|
+
import { createArbiClient, base64ToBytes, deriveEncryptionKeypairFromSigning, sealedBoxDecrypt, sealKeyForSession, buildWebSocketUrl, createAuthMessage, parseServerMessage, isMessageType, createContentHash, encryptFile, changePasswordWithRekey } from '@arbidocs/client';
|
|
2
2
|
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
@@ -3554,14 +3554,15 @@ async function extractErrorMessage(res) {
|
|
|
3554
3554
|
return `Request failed: ${res.status} ${res.statusText}`;
|
|
3555
3555
|
}
|
|
3556
3556
|
async function authenticatedFetch(options) {
|
|
3557
|
-
const { baseUrl, accessToken, path, method, body, headers } = options;
|
|
3557
|
+
const { baseUrl, accessToken, path, method, body, headers, signal } = options;
|
|
3558
3558
|
const res = await fetch(`${baseUrl}${path}`, {
|
|
3559
3559
|
method: method ?? (body ? "POST" : "GET"),
|
|
3560
3560
|
headers: {
|
|
3561
3561
|
Authorization: `Bearer ${accessToken}`,
|
|
3562
3562
|
...headers
|
|
3563
3563
|
},
|
|
3564
|
-
body
|
|
3564
|
+
body,
|
|
3565
|
+
signal
|
|
3565
3566
|
});
|
|
3566
3567
|
if (!res.ok) {
|
|
3567
3568
|
const message = await extractErrorMessage(res);
|
|
@@ -4476,6 +4477,7 @@ async function uploadFile(auth, fileData, fileName, options) {
|
|
|
4476
4477
|
if (options?.folder) params.set("folder", sanitizeFolderPath(options.folder));
|
|
4477
4478
|
if (options?.configExtId) params.set("config_ext_id", options.configExtId);
|
|
4478
4479
|
if (options?.wpType) params.set("wp_type", options.wpType);
|
|
4480
|
+
if (options?.parentExtId) params.set("parent_ext_id", options.parentExtId);
|
|
4479
4481
|
const qs = params.toString();
|
|
4480
4482
|
const res = await authenticatedFetch({
|
|
4481
4483
|
...auth,
|
|
@@ -4492,6 +4494,7 @@ async function uploadFiles(auth, files, options) {
|
|
|
4492
4494
|
if (options?.folder) params.set("folder", sanitizeFolderPath(options.folder));
|
|
4493
4495
|
if (options?.configExtId) params.set("config_ext_id", options.configExtId);
|
|
4494
4496
|
if (options?.wpType) params.set("wp_type", options.wpType);
|
|
4497
|
+
if (options?.parentExtId) params.set("parent_ext_id", options.parentExtId);
|
|
4495
4498
|
const qs = params.toString();
|
|
4496
4499
|
const res = await authenticatedFetch({
|
|
4497
4500
|
...auth,
|
|
@@ -4922,7 +4925,7 @@ async function retrieve(options) {
|
|
|
4922
4925
|
return data;
|
|
4923
4926
|
}
|
|
4924
4927
|
async function queryAssistant(options) {
|
|
4925
|
-
const { workspaceId, question, docIds, previousResponseId, model, ...auth } = options;
|
|
4928
|
+
const { workspaceId, question, docIds, previousResponseId, model, signal, ...auth } = options;
|
|
4926
4929
|
const body = {
|
|
4927
4930
|
input: question,
|
|
4928
4931
|
workspace_ext_id: workspaceId,
|
|
@@ -4941,7 +4944,8 @@ async function queryAssistant(options) {
|
|
|
4941
4944
|
path: "/v1/assistant/query",
|
|
4942
4945
|
method: "POST",
|
|
4943
4946
|
body: JSON.stringify(body),
|
|
4944
|
-
headers: { "Content-Type": "application/json" }
|
|
4947
|
+
headers: { "Content-Type": "application/json" },
|
|
4948
|
+
signal
|
|
4945
4949
|
});
|
|
4946
4950
|
}
|
|
4947
4951
|
async function respondToAgent(arbi, assistantMessageExtId, answer) {
|
|
@@ -5477,9 +5481,78 @@ async function getFileContent(auth, fileId) {
|
|
|
5477
5481
|
}
|
|
5478
5482
|
|
|
5479
5483
|
// src/operations/sessions.ts
|
|
5484
|
+
var sessions_exports = {};
|
|
5485
|
+
__export(sessions_exports, {
|
|
5486
|
+
currentSessionId: () => currentSessionId,
|
|
5487
|
+
listSessions: () => listSessions,
|
|
5488
|
+
logoutAllSessions: () => logoutAllSessions,
|
|
5489
|
+
terminateSession: () => terminateSession
|
|
5490
|
+
});
|
|
5480
5491
|
async function listSessions(arbi) {
|
|
5481
5492
|
return requireData(await arbi.fetch.GET("/v1/user/sessions"), "Failed to fetch sessions");
|
|
5482
5493
|
}
|
|
5494
|
+
async function terminateSession(arbi, sessionId) {
|
|
5495
|
+
requireOk(
|
|
5496
|
+
await arbi.fetch.PATCH("/v1/user/sessions/{session_id}", {
|
|
5497
|
+
params: { path: { session_id: sessionId } },
|
|
5498
|
+
body: { ttl: 0 }
|
|
5499
|
+
}),
|
|
5500
|
+
"Failed to end session"
|
|
5501
|
+
);
|
|
5502
|
+
}
|
|
5503
|
+
async function logoutAllSessions(arbi) {
|
|
5504
|
+
requireOk(
|
|
5505
|
+
await arbi.fetch.POST("/v1/user/logout", { params: { query: { all_sessions: true } } }),
|
|
5506
|
+
"Failed to sign out of all sessions"
|
|
5507
|
+
);
|
|
5508
|
+
}
|
|
5509
|
+
function currentSessionId(accessToken) {
|
|
5510
|
+
const payload = accessToken?.split(".")[1];
|
|
5511
|
+
if (!payload) return null;
|
|
5512
|
+
try {
|
|
5513
|
+
const claims = JSON.parse(atob(payload.replace(/-/g, "+").replace(/_/g, "/")));
|
|
5514
|
+
return typeof claims.sk === "string" ? claims.sk.slice(0, 12) : null;
|
|
5515
|
+
} catch {
|
|
5516
|
+
return null;
|
|
5517
|
+
}
|
|
5518
|
+
}
|
|
5519
|
+
|
|
5520
|
+
// src/operations/profile.ts
|
|
5521
|
+
var profile_exports = {};
|
|
5522
|
+
__export(profile_exports, {
|
|
5523
|
+
updateProfile: () => updateProfile
|
|
5524
|
+
});
|
|
5525
|
+
async function updateProfile(arbi, body) {
|
|
5526
|
+
return requireData(
|
|
5527
|
+
await arbi.fetch.PATCH("/v1/user/profile", { body }),
|
|
5528
|
+
"Failed to update profile"
|
|
5529
|
+
);
|
|
5530
|
+
}
|
|
5531
|
+
|
|
5532
|
+
// src/operations/account.ts
|
|
5533
|
+
var account_exports = {};
|
|
5534
|
+
__export(account_exports, {
|
|
5535
|
+
confirmEmailChange: () => confirmEmailChange,
|
|
5536
|
+
requestDeletion: () => requestDeletion,
|
|
5537
|
+
requestEmailChange: () => requestEmailChange
|
|
5538
|
+
});
|
|
5539
|
+
async function requestEmailChange(arbi, newEmail) {
|
|
5540
|
+
requireOk(
|
|
5541
|
+
await arbi.fetch.POST("/v1/user/request-email-change", { body: { new_email: newEmail } }),
|
|
5542
|
+
"Failed to send the verification code"
|
|
5543
|
+
);
|
|
5544
|
+
}
|
|
5545
|
+
async function confirmEmailChange(arbi, newEmail, verificationCode) {
|
|
5546
|
+
return requireData(
|
|
5547
|
+
await arbi.fetch.POST("/v1/user/confirm-email-change", {
|
|
5548
|
+
body: { new_email: newEmail, verification_code: verificationCode }
|
|
5549
|
+
}),
|
|
5550
|
+
"Invalid or expired verification code"
|
|
5551
|
+
);
|
|
5552
|
+
}
|
|
5553
|
+
async function requestDeletion(arbi) {
|
|
5554
|
+
return requireData(await arbi.fetch.POST("/v1/user/request-deletion"), "Failed to delete account");
|
|
5555
|
+
}
|
|
5483
5556
|
|
|
5484
5557
|
// src/operations/projects.ts
|
|
5485
5558
|
var projects_exports = {};
|
|
@@ -5689,6 +5762,8 @@ function tokenExpiresWithin(token, seconds) {
|
|
|
5689
5762
|
var Arbi = class {
|
|
5690
5763
|
client = null;
|
|
5691
5764
|
loginResult = null;
|
|
5765
|
+
userProfile = null;
|
|
5766
|
+
profileListeners = /* @__PURE__ */ new Set();
|
|
5692
5767
|
currentWorkspaceId = null;
|
|
5693
5768
|
dmCryptoContext = null;
|
|
5694
5769
|
sessionExpiredListeners = /* @__PURE__ */ new Set();
|
|
@@ -5737,6 +5812,7 @@ var Arbi = class {
|
|
|
5737
5812
|
async login(email, password) {
|
|
5738
5813
|
const client = await this.init();
|
|
5739
5814
|
this.loginResult = await client.auth.login({ email, password });
|
|
5815
|
+
this.userProfile = this.loginResult.profile ?? null;
|
|
5740
5816
|
}
|
|
5741
5817
|
/**
|
|
5742
5818
|
* Recover a session using a stored signing private key (base64).
|
|
@@ -5746,6 +5822,7 @@ var Arbi = class {
|
|
|
5746
5822
|
const client = await this.init();
|
|
5747
5823
|
const signingPrivateKey = client.crypto.base64ToBytes(signingPrivateKeyBase64);
|
|
5748
5824
|
this.loginResult = await client.auth.loginWithKey({ email, signingPrivateKey });
|
|
5825
|
+
this.userProfile = this.loginResult.profile ?? null;
|
|
5749
5826
|
}
|
|
5750
5827
|
/** A workspace's key, sealed to the caller's own session (what `/open` and `POST /workspace/users` take). */
|
|
5751
5828
|
async sealWorkspaceKey(workspaceId) {
|
|
@@ -5805,6 +5882,7 @@ var Arbi = class {
|
|
|
5805
5882
|
this.loginResult.serverSessionKey.fill(0);
|
|
5806
5883
|
}
|
|
5807
5884
|
this.loginResult = null;
|
|
5885
|
+
this.userProfile = null;
|
|
5808
5886
|
this.currentWorkspaceId = null;
|
|
5809
5887
|
this.dmCryptoContext = null;
|
|
5810
5888
|
this.client?.session.clear();
|
|
@@ -5835,6 +5913,10 @@ var Arbi = class {
|
|
|
5835
5913
|
return run();
|
|
5836
5914
|
}
|
|
5837
5915
|
}
|
|
5916
|
+
setUserProfile(profile) {
|
|
5917
|
+
this.userProfile = profile;
|
|
5918
|
+
for (const listener of [...this.profileListeners]) listener(profile);
|
|
5919
|
+
}
|
|
5838
5920
|
/** Log out and clear internal state. */
|
|
5839
5921
|
async logout() {
|
|
5840
5922
|
if (this.client) {
|
|
@@ -5845,6 +5927,7 @@ var Arbi = class {
|
|
|
5845
5927
|
this.loginResult.serverSessionKey.fill(0);
|
|
5846
5928
|
}
|
|
5847
5929
|
this.loginResult = null;
|
|
5930
|
+
this.userProfile = null;
|
|
5848
5931
|
this.currentWorkspaceId = null;
|
|
5849
5932
|
this.dmCryptoContext = null;
|
|
5850
5933
|
}
|
|
@@ -5918,9 +6001,76 @@ var Arbi = class {
|
|
|
5918
6001
|
const state = this.requireClient().session.getState();
|
|
5919
6002
|
return state.userExtId ? { externalId: state.userExtId, email: state.userEmail ?? null } : null;
|
|
5920
6003
|
},
|
|
6004
|
+
/**
|
|
6005
|
+
* The signed-in user's profile (name, picture, email, SSO flag) as the login response
|
|
6006
|
+
* carried it, kept current by `profile.update` and `account.confirmEmailChange`. `null` when
|
|
6007
|
+
* not logged in or when the session was restored without a login (then read the workspace
|
|
6008
|
+
* roster instead).
|
|
6009
|
+
*/
|
|
6010
|
+
profile: () => this.userProfile,
|
|
6011
|
+
/** Be told when the profile changes (name, picture or email saved). Returns the unsubscribe. */
|
|
6012
|
+
onProfileChange: (listener) => {
|
|
6013
|
+
this.profileListeners.add(listener);
|
|
6014
|
+
return () => this.profileListeners.delete(listener);
|
|
6015
|
+
},
|
|
5921
6016
|
/** Today's deployment-wide credit spend for the current user. */
|
|
5922
6017
|
usageToday: () => getUserUsageToday(this.requireClient())
|
|
5923
6018
|
};
|
|
6019
|
+
// ── Profile ───────────────────────────────────────────────────────────
|
|
6020
|
+
profile = {
|
|
6021
|
+
/** Update the display profile; pass only what changes (`''` clears family name or picture). */
|
|
6022
|
+
update: async (body) => {
|
|
6023
|
+
const updated = await updateProfile(this.requireClient(), body);
|
|
6024
|
+
if (this.userProfile) {
|
|
6025
|
+
this.setUserProfile({
|
|
6026
|
+
...this.userProfile,
|
|
6027
|
+
givenName: updated.given_name ?? this.userProfile.givenName,
|
|
6028
|
+
familyName: updated.family_name ?? null,
|
|
6029
|
+
picture: updated.picture ?? null
|
|
6030
|
+
});
|
|
6031
|
+
}
|
|
6032
|
+
return updated;
|
|
6033
|
+
}
|
|
6034
|
+
};
|
|
6035
|
+
// ── Account ───────────────────────────────────────────────────────────
|
|
6036
|
+
account = {
|
|
6037
|
+
/** Send a verification code to the new address (not for SSO accounts). */
|
|
6038
|
+
requestEmailChange: (newEmail) => requestEmailChange(this.requireClient(), newEmail),
|
|
6039
|
+
/** Confirm the email change with the emailed code; the session and profile follow. */
|
|
6040
|
+
confirmEmailChange: async (newEmail, verificationCode) => {
|
|
6041
|
+
const client = this.requireClient();
|
|
6042
|
+
const result = await confirmEmailChange(client, newEmail, verificationCode);
|
|
6043
|
+
client.session.setUser(result.email, client.session.getState().userExtId ?? void 0);
|
|
6044
|
+
if (this.userProfile) this.setUserProfile({ ...this.userProfile, email: result.email });
|
|
6045
|
+
return result;
|
|
6046
|
+
},
|
|
6047
|
+
/**
|
|
6048
|
+
* Change (or, after recovery, set) the master password: re-keys the workspaces and direct
|
|
6049
|
+
* messages. Omit `currentPassword` in recovery mode. Resolves with the new signing key, whose
|
|
6050
|
+
* recovery file the user should save.
|
|
6051
|
+
*/
|
|
6052
|
+
changePassword: async (params) => {
|
|
6053
|
+
const client = this.requireClient();
|
|
6054
|
+
const lr2 = this.requireLogin();
|
|
6055
|
+
const email = client.session.getState().userEmail ?? this.userProfile?.email;
|
|
6056
|
+
if (!email) throw new ArbiError("The account email is unknown; sign in again.");
|
|
6057
|
+
const result = await changePasswordWithRekey(
|
|
6058
|
+
{ ...params, email, userExtId: lr2.userExtId },
|
|
6059
|
+
{
|
|
6060
|
+
fetchClient: client.fetch,
|
|
6061
|
+
deploymentDomain: this.options.deploymentDomain ?? new URL(this.options.url).hostname
|
|
6062
|
+
}
|
|
6063
|
+
);
|
|
6064
|
+
this.loginResult = { ...lr2, signingPrivateKey: result.newSigningPrivateKey };
|
|
6065
|
+
return result;
|
|
6066
|
+
},
|
|
6067
|
+
/** Close the account (soft delete) and sign out. Refused while a subscription is active. */
|
|
6068
|
+
requestDeletion: async () => {
|
|
6069
|
+
const result = await requestDeletion(this.requireClient());
|
|
6070
|
+
await this.logout();
|
|
6071
|
+
return result;
|
|
6072
|
+
}
|
|
6073
|
+
};
|
|
5924
6074
|
// ── Workspaces ────────────────────────────────────────────────────────
|
|
5925
6075
|
workspaces = {
|
|
5926
6076
|
list: () => listWorkspaces(this.requireClient()),
|
|
@@ -6026,12 +6176,7 @@ var Arbi = class {
|
|
|
6026
6176
|
uploadFile: (fileData, fileName, options) => {
|
|
6027
6177
|
this.requireWorkspace();
|
|
6028
6178
|
return this.recovering(
|
|
6029
|
-
() => uploadFile(
|
|
6030
|
-
this.getAuthHeaders(),
|
|
6031
|
-
fileData,
|
|
6032
|
-
fileName,
|
|
6033
|
-
options?.folder ? { folder: options.folder } : void 0
|
|
6034
|
-
)
|
|
6179
|
+
() => uploadFile(this.getAuthHeaders(), fileData, fileName, options)
|
|
6035
6180
|
);
|
|
6036
6181
|
},
|
|
6037
6182
|
download: (docId) => this.recovering(() => downloadDocument(this.getAuthHeaders(), docId)),
|
|
@@ -6063,7 +6208,8 @@ var Arbi = class {
|
|
|
6063
6208
|
question,
|
|
6064
6209
|
docIds: options.docIds,
|
|
6065
6210
|
previousResponseId: options.previousResponseId,
|
|
6066
|
-
model: options.model
|
|
6211
|
+
model: options.model,
|
|
6212
|
+
signal: options.signal
|
|
6067
6213
|
})
|
|
6068
6214
|
);
|
|
6069
6215
|
const callbacks = {
|
|
@@ -6311,7 +6457,16 @@ var Arbi = class {
|
|
|
6311
6457
|
};
|
|
6312
6458
|
// ── Sessions ────────────────────────────────────────────────────────
|
|
6313
6459
|
sessions = {
|
|
6314
|
-
list: () => listSessions(this.requireClient())
|
|
6460
|
+
list: () => listSessions(this.requireClient()),
|
|
6461
|
+
/** The id this device's session is listed under in `list()`; `null` when unknown. */
|
|
6462
|
+
currentId: () => currentSessionId(this.client?.session.getState().accessToken),
|
|
6463
|
+
/** End one of your own sessions now (not the one this device is on: that is `logout`). */
|
|
6464
|
+
terminate: (sessionId) => terminateSession(this.requireClient(), sessionId),
|
|
6465
|
+
/** Sign out of every device on the server, then clear this instance. */
|
|
6466
|
+
logoutAll: async () => {
|
|
6467
|
+
await logoutAllSessions(this.requireClient());
|
|
6468
|
+
await this.logout();
|
|
6469
|
+
}
|
|
6315
6470
|
};
|
|
6316
6471
|
// ── Internal guards ───────────────────────────────────────────────────
|
|
6317
6472
|
requireClient() {
|
|
@@ -6397,6 +6552,6 @@ function extractResponseText(response) {
|
|
|
6397
6552
|
return parts.join("");
|
|
6398
6553
|
}
|
|
6399
6554
|
|
|
6400
|
-
export { Arbi, ArbiApiError, ArbiError, WebSocketAuthError, agentconfig_exports as agentconfig, assistant_exports as assistant, authenticatedFetch, buildRetrievalChunkTool, buildRetrievalFullContextTool, buildRetrievalTocTool, connectWebSocket, connectWithReconnect, consumeSSEStream, contacts_exports as contacts, conversations_exports as conversations, countCitations, createAuthenticatedClient, dm_exports as dm, doctags_exports as doctags, documents_exports as documents, facts_exports as facts, files_exports as files, filterSkills, formatAgentStepLabel, formatFileSize, formatItemLabel, formatUserName, formatWorkspaceChoices, getErrorMessage, getRawWorkspaceKey, health_exports as health, parseSSEEvents, parseSlashCommand, parseSlashTokenInProgress, performPasswordLogin, projects_exports as projects, requireData, requireOk, resolveAuth, resolveCitations, resolveWorkspace, responses_exports as responses, selectWorkspace, selectWorkspaceById, settings_exports as settings, streamSSE, stripCitationMarkdown, summarizeCitations, tags_exports as tags, tasks_exports as tasks, workspaces_exports as workspaces };
|
|
6555
|
+
export { Arbi, ArbiApiError, ArbiError, WebSocketAuthError, account_exports as account, agentconfig_exports as agentconfig, assistant_exports as assistant, authenticatedFetch, buildRetrievalChunkTool, buildRetrievalFullContextTool, buildRetrievalTocTool, connectWebSocket, connectWithReconnect, consumeSSEStream, contacts_exports as contacts, conversations_exports as conversations, countCitations, createAuthenticatedClient, dm_exports as dm, doctags_exports as doctags, documents_exports as documents, facts_exports as facts, files_exports as files, filterSkills, formatAgentStepLabel, formatFileSize, formatItemLabel, formatUserName, formatWorkspaceChoices, getErrorMessage, getRawWorkspaceKey, health_exports as health, parseSSEEvents, parseSlashCommand, parseSlashTokenInProgress, performPasswordLogin, profile_exports as profile, projects_exports as projects, requireData, requireOk, resolveAuth, resolveCitations, resolveWorkspace, responses_exports as responses, selectWorkspace, selectWorkspaceById, sessions_exports as sessions, settings_exports as settings, streamSSE, stripCitationMarkdown, summarizeCitations, tags_exports as tags, tasks_exports as tasks, workspaces_exports as workspaces };
|
|
6401
6556
|
//# sourceMappingURL=browser.js.map
|
|
6402
6557
|
//# sourceMappingURL=browser.js.map
|