@arbidocs/sdk 0.3.119 → 0.3.121
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-CxTSIAhf.d.cts → browser-BUspHdyk.d.cts} +105 -80
- package/dist/{browser-CxTSIAhf.d.ts → browser-BUspHdyk.d.ts} +105 -80
- package/dist/browser.cjs +53 -11
- package/dist/browser.cjs.map +1 -1
- package/dist/browser.d.cts +1 -1
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +53 -11
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +76 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -3
- package/dist/index.d.ts +25 -3
- package/dist/index.js +75 -12
- 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 AgentStepDeltaEvent, a as AgentStepEvent, b as Arbi, c as ArbiApiError, d as ArbiError, e as ArbiErrorEvent, f as ArbiOptions, g as ArtifactEvent, h as AuthContext, i as AuthHeaders, j as AuthenticatedClient, C as ChatSession, k as CitationSummary, l as CliConfig, m as CliCredentials, n as CommandDescriptor, o as ConfigStore, p as ConnectOptions, q as CreateMemoryRequest, r as CreateTaskRequest, M as MemoryResponse, z as MemorySearchRequest, B as MemorySearchResponse, G as MessageMetadataPayload, H as MessageQueuedEvent, O as OutputTokensDetails, P as ParsedSlashCommand, I as ProjectInvoicesResponse, J as ProjectUsageResponse, Q as QueryOptions, R as ReconnectOptions, K as ReconnectableWsConnection, N as ResolvedCitation, T as ResponseCompletedEvent, U as ResponseContentPartAddedEvent, V as ResponseCreatedEvent, W as ResponseFailedEvent, X as ResponseOutputItemAddedEvent, Y as ResponseOutputItemDoneEvent, Z as ResponseOutputTextDeltaEvent, _ as ResponseOutputTextDoneEvent, $ as ResponseUsage, a0 as SSEEvent, a1 as SSEStreamCallbacks, a2 as SSEStreamResult, a3 as SSEStreamStartData, a5 as SkillSummary, a7 as TaskResponse, a8 as UpdateMemoryRequest, a9 as UpdateTaskRequest, af as UserDailyUsageResponse, ag as UserInfo, ah as UserInputRequestEvent, ai as UserMessageEvent, aj as WebSocketAuthError, ak as WorkspaceChronologyOut, al as WorkspaceContext, am as WsConnection, an as agentconfig, ao as assistant, ap as authenticatedFetch, aq as buildRetrievalChunkTool, ar as buildRetrievalFullContextTool, as as buildRetrievalTocTool, at as connectWebSocket, au as connectWithReconnect, av as consumeSSEStream, aw as contacts, ax as conversations, ay as countCitations, az as createAuthenticatedClient, aB as dm, aC as doctags, aD as documents, aE as files, aF as filterSkills, aG as formatAgentStepLabel, aH as formatFileSize, aJ as formatUserName, aK as formatWorkspaceChoices, aP as getErrorMessage, aQ as getRawWorkspaceKey, aR as health, aS as memory, aT as parseSSEEvents, aU as parseSlashCommand, aV as parseSlashTokenInProgress, aW as performPasswordLogin, aZ as projects, a_ as requireData, a$ as requireOk, b0 as resolveAuth, b1 as resolveCitations, b2 as resolveWorkspace, b3 as responses, b4 as selectWorkspace, b5 as selectWorkspaceById, b6 as settings, b7 as streamSSE, b8 as stripCitationMarkdown, b9 as summarizeCitations, ba as tags, bb as tasks, bc as workspaces } from './browser-
|
|
1
|
+
export { A as AgentStepDeltaEvent, a as AgentStepEvent, b as Arbi, c as ArbiApiError, d as ArbiError, e as ArbiErrorEvent, f as ArbiOptions, g as ArtifactEvent, h as AuthContext, i as AuthHeaders, j as AuthenticatedClient, C as ChatSession, k as CitationSummary, l as CliConfig, m as CliCredentials, n as CommandDescriptor, o as ConfigStore, p as ConnectOptions, q as CreateMemoryRequest, r as CreateTaskRequest, M as MemoryResponse, z as MemorySearchRequest, B as MemorySearchResponse, G as MessageMetadataPayload, H as MessageQueuedEvent, O as OutputTokensDetails, P as ParsedSlashCommand, I as ProjectInvoicesResponse, J as ProjectUsageResponse, Q as QueryOptions, R as ReconnectOptions, K as ReconnectableWsConnection, N as ResolvedCitation, T as ResponseCompletedEvent, U as ResponseContentPartAddedEvent, V as ResponseCreatedEvent, W as ResponseFailedEvent, X as ResponseOutputItemAddedEvent, Y as ResponseOutputItemDoneEvent, Z as ResponseOutputTextDeltaEvent, _ as ResponseOutputTextDoneEvent, $ as ResponseUsage, a0 as SSEEvent, a1 as SSEStreamCallbacks, a2 as SSEStreamResult, a3 as SSEStreamStartData, a5 as SkillSummary, a7 as TaskResponse, a8 as UpdateMemoryRequest, a9 as UpdateTaskRequest, af as UserDailyUsageResponse, ag as UserInfo, ah as UserInputRequestEvent, ai as UserMessageEvent, aj as WebSocketAuthError, ak as WorkspaceChronologyOut, al as WorkspaceContext, am as WsConnection, an as agentconfig, ao as assistant, ap as authenticatedFetch, aq as buildRetrievalChunkTool, ar as buildRetrievalFullContextTool, as as buildRetrievalTocTool, at as connectWebSocket, au as connectWithReconnect, av as consumeSSEStream, aw as contacts, ax as conversations, ay as countCitations, az as createAuthenticatedClient, aB as dm, aC as doctags, aD as documents, aE as files, aF as filterSkills, aG as formatAgentStepLabel, aH as formatFileSize, aJ as formatUserName, aK as formatWorkspaceChoices, aP as getErrorMessage, aQ as getRawWorkspaceKey, aR as health, aS as memory, aT as parseSSEEvents, aU as parseSlashCommand, aV as parseSlashTokenInProgress, aW as performPasswordLogin, aZ as projects, a_ as requireData, a$ as requireOk, b0 as resolveAuth, b1 as resolveCitations, b2 as resolveWorkspace, b3 as responses, b4 as selectWorkspace, b5 as selectWorkspaceById, b6 as settings, b7 as streamSSE, b8 as stripCitationMarkdown, b9 as summarizeCitations, ba as tags, bb as tasks, bc as workspaces } from './browser-BUspHdyk.cjs';
|
|
2
2
|
import '@arbidocs/client';
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { A as AgentStepDeltaEvent, a as AgentStepEvent, b as Arbi, c as ArbiApiError, d as ArbiError, e as ArbiErrorEvent, f as ArbiOptions, g as ArtifactEvent, h as AuthContext, i as AuthHeaders, j as AuthenticatedClient, C as ChatSession, k as CitationSummary, l as CliConfig, m as CliCredentials, n as CommandDescriptor, o as ConfigStore, p as ConnectOptions, q as CreateMemoryRequest, r as CreateTaskRequest, M as MemoryResponse, z as MemorySearchRequest, B as MemorySearchResponse, G as MessageMetadataPayload, H as MessageQueuedEvent, O as OutputTokensDetails, P as ParsedSlashCommand, I as ProjectInvoicesResponse, J as ProjectUsageResponse, Q as QueryOptions, R as ReconnectOptions, K as ReconnectableWsConnection, N as ResolvedCitation, T as ResponseCompletedEvent, U as ResponseContentPartAddedEvent, V as ResponseCreatedEvent, W as ResponseFailedEvent, X as ResponseOutputItemAddedEvent, Y as ResponseOutputItemDoneEvent, Z as ResponseOutputTextDeltaEvent, _ as ResponseOutputTextDoneEvent, $ as ResponseUsage, a0 as SSEEvent, a1 as SSEStreamCallbacks, a2 as SSEStreamResult, a3 as SSEStreamStartData, a5 as SkillSummary, a7 as TaskResponse, a8 as UpdateMemoryRequest, a9 as UpdateTaskRequest, af as UserDailyUsageResponse, ag as UserInfo, ah as UserInputRequestEvent, ai as UserMessageEvent, aj as WebSocketAuthError, ak as WorkspaceChronologyOut, al as WorkspaceContext, am as WsConnection, an as agentconfig, ao as assistant, ap as authenticatedFetch, aq as buildRetrievalChunkTool, ar as buildRetrievalFullContextTool, as as buildRetrievalTocTool, at as connectWebSocket, au as connectWithReconnect, av as consumeSSEStream, aw as contacts, ax as conversations, ay as countCitations, az as createAuthenticatedClient, aB as dm, aC as doctags, aD as documents, aE as files, aF as filterSkills, aG as formatAgentStepLabel, aH as formatFileSize, aJ as formatUserName, aK as formatWorkspaceChoices, aP as getErrorMessage, aQ as getRawWorkspaceKey, aR as health, aS as memory, aT as parseSSEEvents, aU as parseSlashCommand, aV as parseSlashTokenInProgress, aW as performPasswordLogin, aZ as projects, a_ as requireData, a$ as requireOk, b0 as resolveAuth, b1 as resolveCitations, b2 as resolveWorkspace, b3 as responses, b4 as selectWorkspace, b5 as selectWorkspaceById, b6 as settings, b7 as streamSSE, b8 as stripCitationMarkdown, b9 as summarizeCitations, ba as tags, bb as tasks, bc as workspaces } from './browser-
|
|
1
|
+
export { A as AgentStepDeltaEvent, a as AgentStepEvent, b as Arbi, c as ArbiApiError, d as ArbiError, e as ArbiErrorEvent, f as ArbiOptions, g as ArtifactEvent, h as AuthContext, i as AuthHeaders, j as AuthenticatedClient, C as ChatSession, k as CitationSummary, l as CliConfig, m as CliCredentials, n as CommandDescriptor, o as ConfigStore, p as ConnectOptions, q as CreateMemoryRequest, r as CreateTaskRequest, M as MemoryResponse, z as MemorySearchRequest, B as MemorySearchResponse, G as MessageMetadataPayload, H as MessageQueuedEvent, O as OutputTokensDetails, P as ParsedSlashCommand, I as ProjectInvoicesResponse, J as ProjectUsageResponse, Q as QueryOptions, R as ReconnectOptions, K as ReconnectableWsConnection, N as ResolvedCitation, T as ResponseCompletedEvent, U as ResponseContentPartAddedEvent, V as ResponseCreatedEvent, W as ResponseFailedEvent, X as ResponseOutputItemAddedEvent, Y as ResponseOutputItemDoneEvent, Z as ResponseOutputTextDeltaEvent, _ as ResponseOutputTextDoneEvent, $ as ResponseUsage, a0 as SSEEvent, a1 as SSEStreamCallbacks, a2 as SSEStreamResult, a3 as SSEStreamStartData, a5 as SkillSummary, a7 as TaskResponse, a8 as UpdateMemoryRequest, a9 as UpdateTaskRequest, af as UserDailyUsageResponse, ag as UserInfo, ah as UserInputRequestEvent, ai as UserMessageEvent, aj as WebSocketAuthError, ak as WorkspaceChronologyOut, al as WorkspaceContext, am as WsConnection, an as agentconfig, ao as assistant, ap as authenticatedFetch, aq as buildRetrievalChunkTool, ar as buildRetrievalFullContextTool, as as buildRetrievalTocTool, at as connectWebSocket, au as connectWithReconnect, av as consumeSSEStream, aw as contacts, ax as conversations, ay as countCitations, az as createAuthenticatedClient, aB as dm, aC as doctags, aD as documents, aE as files, aF as filterSkills, aG as formatAgentStepLabel, aH as formatFileSize, aJ as formatUserName, aK as formatWorkspaceChoices, aP as getErrorMessage, aQ as getRawWorkspaceKey, aR as health, aS as memory, aT as parseSSEEvents, aU as parseSlashCommand, aV as parseSlashTokenInProgress, aW as performPasswordLogin, aZ as projects, a_ as requireData, a$ as requireOk, b0 as resolveAuth, b1 as resolveCitations, b2 as resolveWorkspace, b3 as responses, b4 as selectWorkspace, b5 as selectWorkspaceById, b6 as settings, b7 as streamSSE, b8 as stripCitationMarkdown, b9 as summarizeCitations, ba as tags, bb as tasks, bc as workspaces } from './browser-BUspHdyk.js';
|
|
2
2
|
import '@arbidocs/client';
|
package/dist/browser.js
CHANGED
|
@@ -5214,6 +5214,7 @@ async function resolveRecipient(arbi, ref) {
|
|
|
5214
5214
|
return null;
|
|
5215
5215
|
}
|
|
5216
5216
|
async function sendEncryptedDM(arbi, messages, crypto) {
|
|
5217
|
+
const plaintextFor = new Map(messages.map((m2) => [m2.recipient_ext_id, m2.content]));
|
|
5217
5218
|
const encrypted = await Promise.all(
|
|
5218
5219
|
messages.map(async (msg) => ({
|
|
5219
5220
|
recipient_ext_id: msg.recipient_ext_id,
|
|
@@ -5225,10 +5226,14 @@ async function sendEncryptedDM(arbi, messages, crypto) {
|
|
|
5225
5226
|
)
|
|
5226
5227
|
}))
|
|
5227
5228
|
);
|
|
5228
|
-
|
|
5229
|
+
const created = requireData(
|
|
5229
5230
|
await arbi.fetch.POST("/v1/notifications/", { body: { messages: encrypted } }),
|
|
5230
5231
|
"Failed to send message"
|
|
5231
5232
|
);
|
|
5233
|
+
return created.map((n2) => ({
|
|
5234
|
+
...n2,
|
|
5235
|
+
content: plaintextFor.get(n2.recipient.external_id) ?? n2.content
|
|
5236
|
+
}));
|
|
5232
5237
|
}
|
|
5233
5238
|
async function requestWorkspaceAccess(arbi, params, crypto) {
|
|
5234
5239
|
const payload = JSON.stringify({
|
|
@@ -5418,11 +5423,14 @@ async function listSessions(arbi) {
|
|
|
5418
5423
|
var projects_exports = {};
|
|
5419
5424
|
__export(projects_exports, {
|
|
5420
5425
|
createProject: () => createProject,
|
|
5426
|
+
deleteProject: () => deleteProject,
|
|
5421
5427
|
getProjectInvoices: () => getProjectInvoices,
|
|
5422
5428
|
getProjectUsage: () => getProjectUsage,
|
|
5423
5429
|
getUserUsageToday: () => getUserUsageToday,
|
|
5424
5430
|
listProjects: () => listProjects,
|
|
5425
|
-
refreshProject: () => refreshProject
|
|
5431
|
+
refreshProject: () => refreshProject,
|
|
5432
|
+
renameProject: () => renameProject,
|
|
5433
|
+
updateProject: () => updateProject
|
|
5426
5434
|
});
|
|
5427
5435
|
async function listProjects(arbi) {
|
|
5428
5436
|
return requireData(await arbi.fetch.GET("/v1/user/projects/"), "Failed to fetch projects");
|
|
@@ -5435,6 +5443,26 @@ async function createProject(arbi, name) {
|
|
|
5435
5443
|
"Failed to create project"
|
|
5436
5444
|
);
|
|
5437
5445
|
}
|
|
5446
|
+
async function updateProject(arbi, projectExtId, body) {
|
|
5447
|
+
return requireData(
|
|
5448
|
+
await arbi.fetch.PATCH("/v1/user/projects/{project_ext_id}", {
|
|
5449
|
+
params: { path: { project_ext_id: projectExtId } },
|
|
5450
|
+
body
|
|
5451
|
+
}),
|
|
5452
|
+
"Failed to update project"
|
|
5453
|
+
);
|
|
5454
|
+
}
|
|
5455
|
+
async function renameProject(arbi, projectExtId, name) {
|
|
5456
|
+
return updateProject(arbi, projectExtId, { name });
|
|
5457
|
+
}
|
|
5458
|
+
async function deleteProject(arbi, projectExtId) {
|
|
5459
|
+
requireOk(
|
|
5460
|
+
await arbi.fetch.DELETE("/v1/user/projects/{project_ext_id}", {
|
|
5461
|
+
params: { path: { project_ext_id: projectExtId } }
|
|
5462
|
+
}),
|
|
5463
|
+
"Failed to delete project"
|
|
5464
|
+
);
|
|
5465
|
+
}
|
|
5438
5466
|
async function refreshProject(arbi, projectExtId) {
|
|
5439
5467
|
return requireData(
|
|
5440
5468
|
await arbi.fetch.POST("/v1/user/projects/{project_ext_id}/refresh", {
|
|
@@ -5702,13 +5730,19 @@ var Arbi = class {
|
|
|
5702
5730
|
user = {
|
|
5703
5731
|
/**
|
|
5704
5732
|
* The authenticated user's identity from the current session
|
|
5705
|
-
* (`external_id
|
|
5706
|
-
* logged in. This is the canonical "who am I"
|
|
5707
|
-
* ownership checks read it instead of re-deriving
|
|
5733
|
+
* (`external_id`, plus `email` when the session carries one), established at
|
|
5734
|
+
* login. Returns `null` when not logged in. This is the canonical "who am I"
|
|
5735
|
+
* accessor — DM direction and ownership checks read it instead of re-deriving
|
|
5736
|
+
* identity per call.
|
|
5737
|
+
*
|
|
5738
|
+
* The external_id alone decides identity. A session without an email (e.g. an
|
|
5739
|
+
* agent, or a key-restored session) is still a known user, so `email` is
|
|
5740
|
+
* nullable rather than gating the whole identity: an ownership check must
|
|
5741
|
+
* never silently fail open just because the email is missing.
|
|
5708
5742
|
*/
|
|
5709
5743
|
identity: () => {
|
|
5710
5744
|
const state = this.requireClient().session.getState();
|
|
5711
|
-
return state.userExtId
|
|
5745
|
+
return state.userExtId ? { externalId: state.userExtId, email: state.userEmail ?? null } : null;
|
|
5712
5746
|
},
|
|
5713
5747
|
/** Today's deployment-wide credit spend for the current user. */
|
|
5714
5748
|
usageToday: () => getUserUsageToday(this.requireClient())
|
|
@@ -5896,23 +5930,31 @@ var Arbi = class {
|
|
|
5896
5930
|
/**
|
|
5897
5931
|
* Build (and cache) the DM crypto context for the current session.
|
|
5898
5932
|
*
|
|
5899
|
-
* Derives the user's curve25519 keypair from
|
|
5900
|
-
*
|
|
5933
|
+
* Derives the user's curve25519 keypair from their signing key and pairs it
|
|
5934
|
+
* with their external_id — everything `list()`/`send()` need to encrypt and
|
|
5901
5935
|
* decrypt. Cached for the session and cleared on logout. Consumers never touch
|
|
5902
5936
|
* this: it's an internal of the `dm` surface.
|
|
5937
|
+
*
|
|
5938
|
+
* The key comes from the live login result first, exactly as `selectWorkspace`
|
|
5939
|
+
* sources it, and only then from persisted storage (which is what restores a
|
|
5940
|
+
* session on reload). Reading storage first would make DMs the one feature that
|
|
5941
|
+
* breaks whenever persistence is unavailable — `saveSession` deliberately
|
|
5942
|
+
* no-ops without Web Crypto (a non-secure origin, tracking prevention, an
|
|
5943
|
+
* embedded widget), so a perfectly authenticated user with a working workspace
|
|
5944
|
+
* would be told they are "not authenticated" the moment they opened Messages.
|
|
5903
5945
|
*/
|
|
5904
5946
|
async requireDmCrypto() {
|
|
5905
5947
|
if (this.dmCryptoContext) return this.dmCryptoContext;
|
|
5906
5948
|
const client = this.requireClient();
|
|
5907
|
-
const
|
|
5908
|
-
if (!
|
|
5949
|
+
const signingPrivateKey = this.loginResult?.signingPrivateKey ?? (await client.storage.getSession())?.signingPrivateKey;
|
|
5950
|
+
if (!signingPrivateKey) {
|
|
5909
5951
|
throw new ArbiError("Not authenticated \u2014 no session available for DM encryption");
|
|
5910
5952
|
}
|
|
5911
5953
|
const userExtId = client.session.getState().userExtId;
|
|
5912
5954
|
if (!userExtId) {
|
|
5913
5955
|
throw new ArbiError("No user identity in session \u2014 cannot set up DM encryption");
|
|
5914
5956
|
}
|
|
5915
|
-
this.dmCryptoContext = createDmCryptoContext(client,
|
|
5957
|
+
this.dmCryptoContext = createDmCryptoContext(client, signingPrivateKey, userExtId);
|
|
5916
5958
|
return this.dmCryptoContext;
|
|
5917
5959
|
}
|
|
5918
5960
|
dm = {
|