@arbidocs/sdk 0.3.115 → 0.3.117
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-B5b3SDW6.d.cts → browser-CxTSIAhf.d.cts} +1029 -714
- package/dist/{browser-B5b3SDW6.d.ts → browser-CxTSIAhf.d.ts} +1029 -714
- package/dist/browser.cjs +225 -37
- 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 +225 -38
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +226 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -108
- package/dist/index.d.ts +3 -108
- package/dist/index.js +226 -45
- 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, Q as QueryOptions, R as ReconnectOptions,
|
|
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-CxTSIAhf.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, Q as QueryOptions, R as ReconnectOptions,
|
|
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-CxTSIAhf.js';
|
|
2
2
|
import '@arbidocs/client';
|
package/dist/browser.js
CHANGED
|
@@ -4639,6 +4639,7 @@ __export(workspaces_exports, {
|
|
|
4639
4639
|
copyDocuments: () => copyDocuments,
|
|
4640
4640
|
createWorkspace: () => createWorkspace,
|
|
4641
4641
|
deleteWorkspaces: () => deleteWorkspaces,
|
|
4642
|
+
getWorkspaceChronology: () => getWorkspaceChronology,
|
|
4642
4643
|
listWorkspaceUsers: () => listWorkspaceUsers,
|
|
4643
4644
|
listWorkspaces: () => listWorkspaces,
|
|
4644
4645
|
removeWorkspaceUsers: () => removeWorkspaceUsers,
|
|
@@ -4703,6 +4704,14 @@ async function setUserRole(arbi, userIds, role) {
|
|
|
4703
4704
|
"Failed to update roles"
|
|
4704
4705
|
);
|
|
4705
4706
|
}
|
|
4707
|
+
async function getWorkspaceChronology(arbi, workspaceId) {
|
|
4708
|
+
return requireData(
|
|
4709
|
+
await arbi.fetch.GET("/v1/workspace/{workspace_ext_id}/chronology", {
|
|
4710
|
+
params: { path: { workspace_ext_id: workspaceId } }
|
|
4711
|
+
}),
|
|
4712
|
+
"Failed to fetch workspace chronology"
|
|
4713
|
+
);
|
|
4714
|
+
}
|
|
4706
4715
|
async function copyDocuments(arbi, targetWorkspaceId, docIds, targetWorkspaceKey) {
|
|
4707
4716
|
return requireData(
|
|
4708
4717
|
await arbi.fetch.POST("/v1/workspace/copy", {
|
|
@@ -5067,13 +5076,50 @@ __export(dm_exports, {
|
|
|
5067
5076
|
decryptDmContent: () => decryptDmContent,
|
|
5068
5077
|
deleteDMs: () => deleteDMs,
|
|
5069
5078
|
encryptDmContent: () => encryptDmContent,
|
|
5079
|
+
listActivity: () => listActivity,
|
|
5070
5080
|
listDMs: () => listDMs,
|
|
5071
5081
|
listDecryptedDMs: () => listDecryptedDMs,
|
|
5072
5082
|
markRead: () => markRead,
|
|
5073
5083
|
requestWorkspaceAccess: () => requestWorkspaceAccess,
|
|
5084
|
+
resolveRecipient: () => resolveRecipient,
|
|
5074
5085
|
sendDM: () => sendDM,
|
|
5075
5086
|
sendEncryptedDM: () => sendEncryptedDM
|
|
5076
5087
|
});
|
|
5088
|
+
|
|
5089
|
+
// src/operations/agents.ts
|
|
5090
|
+
async function listAgents(arbi) {
|
|
5091
|
+
return requireData(await arbi.fetch.GET("/v1/agents"), "Failed to fetch agents");
|
|
5092
|
+
}
|
|
5093
|
+
async function createAgent(arbi, name) {
|
|
5094
|
+
const body = { name };
|
|
5095
|
+
return requireData(await arbi.fetch.POST("/v1/agents", { body }), "Failed to create agent");
|
|
5096
|
+
}
|
|
5097
|
+
async function getAgentConfig(arbi, agentExtId) {
|
|
5098
|
+
return requireData(
|
|
5099
|
+
await arbi.fetch.GET("/v1/agents/{agent_ext_id}/config", {
|
|
5100
|
+
params: { path: { agent_ext_id: agentExtId } }
|
|
5101
|
+
}),
|
|
5102
|
+
"Failed to fetch agent config"
|
|
5103
|
+
);
|
|
5104
|
+
}
|
|
5105
|
+
async function listAgentWorkspaces(arbi, agentExtId) {
|
|
5106
|
+
return requireData(
|
|
5107
|
+
await arbi.fetch.GET("/v1/agents/{agent_ext_id}/workspaces", {
|
|
5108
|
+
params: { path: { agent_ext_id: agentExtId } }
|
|
5109
|
+
}),
|
|
5110
|
+
"Failed to fetch agent workspaces"
|
|
5111
|
+
);
|
|
5112
|
+
}
|
|
5113
|
+
async function deleteAgents(arbi, agentExtIds) {
|
|
5114
|
+
return requireData(
|
|
5115
|
+
await arbi.fetch.DELETE("/v1/agents", {
|
|
5116
|
+
body: { agent_ext_ids: agentExtIds }
|
|
5117
|
+
}),
|
|
5118
|
+
"Failed to delete agents"
|
|
5119
|
+
);
|
|
5120
|
+
}
|
|
5121
|
+
|
|
5122
|
+
// src/operations/dm.ts
|
|
5077
5123
|
function createDmCryptoContext(arbi, signingPrivateKeyBytes, userExtId) {
|
|
5078
5124
|
const ed25519PublicKey = signingPrivateKeyBytes.slice(32, 64);
|
|
5079
5125
|
const encryptionKeypair = arbi.crypto.deriveEncryptionKeypairFromSigning({
|
|
@@ -5122,6 +5168,51 @@ async function listDecryptedDMs(arbi, crypto) {
|
|
|
5122
5168
|
const raw = await listDMs(arbi);
|
|
5123
5169
|
return decryptDmBatch(arbi, raw, crypto);
|
|
5124
5170
|
}
|
|
5171
|
+
async function listActivity(arbi, options) {
|
|
5172
|
+
return requireData(
|
|
5173
|
+
await arbi.fetch.GET("/v1/notifications/", {
|
|
5174
|
+
params: {
|
|
5175
|
+
query: {
|
|
5176
|
+
type: "activity",
|
|
5177
|
+
...options?.limit != null ? { limit: options.limit } : {},
|
|
5178
|
+
...options?.offset != null ? { offset: options.offset } : {}
|
|
5179
|
+
}
|
|
5180
|
+
}
|
|
5181
|
+
}),
|
|
5182
|
+
"Failed to fetch activity"
|
|
5183
|
+
);
|
|
5184
|
+
}
|
|
5185
|
+
async function resolveRecipient(arbi, ref) {
|
|
5186
|
+
const isEmail = ref.includes("@");
|
|
5187
|
+
const matchKey = isEmail ? "email" : "external_id";
|
|
5188
|
+
const contacts = await listContacts(arbi);
|
|
5189
|
+
const contactMatch = contacts.find(
|
|
5190
|
+
(c2) => isEmail ? c2.email === ref : c2.user?.external_id === ref || c2.external_id === ref
|
|
5191
|
+
);
|
|
5192
|
+
if (contactMatch?.user?.encryption_public_key) {
|
|
5193
|
+
return {
|
|
5194
|
+
extId: contactMatch.user.external_id,
|
|
5195
|
+
pubKey: contactMatch.user.encryption_public_key
|
|
5196
|
+
};
|
|
5197
|
+
}
|
|
5198
|
+
try {
|
|
5199
|
+
const agents = await listAgents(arbi);
|
|
5200
|
+
const agentMatch = agents.find((a2) => a2[matchKey] === ref);
|
|
5201
|
+
if (agentMatch?.encryption_public_key) {
|
|
5202
|
+
return { extId: agentMatch.external_id, pubKey: agentMatch.encryption_public_key };
|
|
5203
|
+
}
|
|
5204
|
+
} catch {
|
|
5205
|
+
}
|
|
5206
|
+
try {
|
|
5207
|
+
const wsUsers = await listWorkspaceUsers(arbi);
|
|
5208
|
+
const wsMatch = wsUsers.find((wu) => wu.user[matchKey] === ref);
|
|
5209
|
+
if (wsMatch?.user.encryption_public_key) {
|
|
5210
|
+
return { extId: wsMatch.user.external_id, pubKey: wsMatch.user.encryption_public_key };
|
|
5211
|
+
}
|
|
5212
|
+
} catch {
|
|
5213
|
+
}
|
|
5214
|
+
return null;
|
|
5215
|
+
}
|
|
5125
5216
|
async function sendEncryptedDM(arbi, messages, crypto) {
|
|
5126
5217
|
const encrypted = await Promise.all(
|
|
5127
5218
|
messages.map(async (msg) => ({
|
|
@@ -5318,45 +5409,21 @@ async function getFileContent(auth, fileId) {
|
|
|
5318
5409
|
});
|
|
5319
5410
|
}
|
|
5320
5411
|
|
|
5321
|
-
// src/operations/agents.ts
|
|
5322
|
-
async function listAgents(arbi) {
|
|
5323
|
-
return requireData(await arbi.fetch.GET("/v1/agents"), "Failed to fetch agents");
|
|
5324
|
-
}
|
|
5325
|
-
async function createAgent(arbi, name) {
|
|
5326
|
-
const body = { name };
|
|
5327
|
-
return requireData(await arbi.fetch.POST("/v1/agents", { body }), "Failed to create agent");
|
|
5328
|
-
}
|
|
5329
|
-
async function getAgentConfig(arbi, agentExtId) {
|
|
5330
|
-
return requireData(
|
|
5331
|
-
await arbi.fetch.GET("/v1/agents/{agent_ext_id}/config", {
|
|
5332
|
-
params: { path: { agent_ext_id: agentExtId } }
|
|
5333
|
-
}),
|
|
5334
|
-
"Failed to fetch agent config"
|
|
5335
|
-
);
|
|
5336
|
-
}
|
|
5337
|
-
async function listAgentWorkspaces(arbi, agentExtId) {
|
|
5338
|
-
return requireData(
|
|
5339
|
-
await arbi.fetch.GET("/v1/agents/{agent_ext_id}/workspaces", {
|
|
5340
|
-
params: { path: { agent_ext_id: agentExtId } }
|
|
5341
|
-
}),
|
|
5342
|
-
"Failed to fetch agent workspaces"
|
|
5343
|
-
);
|
|
5344
|
-
}
|
|
5345
|
-
async function deleteAgents(arbi, agentExtIds) {
|
|
5346
|
-
return requireData(
|
|
5347
|
-
await arbi.fetch.DELETE("/v1/agents", {
|
|
5348
|
-
body: { agent_ext_ids: agentExtIds }
|
|
5349
|
-
}),
|
|
5350
|
-
"Failed to delete agents"
|
|
5351
|
-
);
|
|
5352
|
-
}
|
|
5353
|
-
|
|
5354
5412
|
// src/operations/sessions.ts
|
|
5355
5413
|
async function listSessions(arbi) {
|
|
5356
5414
|
return requireData(await arbi.fetch.GET("/v1/user/sessions"), "Failed to fetch sessions");
|
|
5357
5415
|
}
|
|
5358
5416
|
|
|
5359
5417
|
// src/operations/projects.ts
|
|
5418
|
+
var projects_exports = {};
|
|
5419
|
+
__export(projects_exports, {
|
|
5420
|
+
createProject: () => createProject,
|
|
5421
|
+
getProjectInvoices: () => getProjectInvoices,
|
|
5422
|
+
getProjectUsage: () => getProjectUsage,
|
|
5423
|
+
getUserUsageToday: () => getUserUsageToday,
|
|
5424
|
+
listProjects: () => listProjects,
|
|
5425
|
+
refreshProject: () => refreshProject
|
|
5426
|
+
});
|
|
5360
5427
|
async function listProjects(arbi) {
|
|
5361
5428
|
return requireData(await arbi.fetch.GET("/v1/user/projects/"), "Failed to fetch projects");
|
|
5362
5429
|
}
|
|
@@ -5376,6 +5443,28 @@ async function refreshProject(arbi, projectExtId) {
|
|
|
5376
5443
|
"Failed to refresh project"
|
|
5377
5444
|
);
|
|
5378
5445
|
}
|
|
5446
|
+
async function getProjectUsage(arbi, projectExtId, monthsBack) {
|
|
5447
|
+
return requireData(
|
|
5448
|
+
await arbi.fetch.GET("/v1/user/projects/{project_ext_id}/usage", {
|
|
5449
|
+
params: {
|
|
5450
|
+
path: { project_ext_id: projectExtId },
|
|
5451
|
+
query: monthsBack === void 0 ? void 0 : { months_back: monthsBack }
|
|
5452
|
+
}
|
|
5453
|
+
}),
|
|
5454
|
+
"Failed to fetch project usage"
|
|
5455
|
+
);
|
|
5456
|
+
}
|
|
5457
|
+
async function getProjectInvoices(arbi, projectExtId) {
|
|
5458
|
+
return requireData(
|
|
5459
|
+
await arbi.fetch.GET("/v1/user/projects/{project_ext_id}/invoices", {
|
|
5460
|
+
params: { path: { project_ext_id: projectExtId } }
|
|
5461
|
+
}),
|
|
5462
|
+
"Failed to fetch project invoices"
|
|
5463
|
+
);
|
|
5464
|
+
}
|
|
5465
|
+
async function getUserUsageToday(arbi) {
|
|
5466
|
+
return requireData(await arbi.fetch.GET("/v1/user/me/usage/today"), "Failed to fetch today usage");
|
|
5467
|
+
}
|
|
5379
5468
|
|
|
5380
5469
|
// src/operations/tasks.ts
|
|
5381
5470
|
var tasks_exports = {};
|
|
@@ -5468,6 +5557,7 @@ var Arbi = class {
|
|
|
5468
5557
|
client = null;
|
|
5469
5558
|
loginResult = null;
|
|
5470
5559
|
currentWorkspaceId = null;
|
|
5560
|
+
dmCryptoContext = null;
|
|
5471
5561
|
options;
|
|
5472
5562
|
constructor(options) {
|
|
5473
5563
|
this.options = options;
|
|
@@ -5554,6 +5644,7 @@ var Arbi = class {
|
|
|
5554
5644
|
}
|
|
5555
5645
|
this.loginResult = null;
|
|
5556
5646
|
this.currentWorkspaceId = null;
|
|
5647
|
+
this.dmCryptoContext = null;
|
|
5557
5648
|
}
|
|
5558
5649
|
// ── Accessors ─────────────────────────────────────────────────────────
|
|
5559
5650
|
/** Get the underlying ArbiClient (throws if not initialized). */
|
|
@@ -5601,7 +5692,26 @@ var Arbi = class {
|
|
|
5601
5692
|
projects = {
|
|
5602
5693
|
list: () => listProjects(this.requireClient()),
|
|
5603
5694
|
create: (name) => createProject(this.requireClient(), name),
|
|
5604
|
-
refresh: (projectExtId) => refreshProject(this.requireClient(), projectExtId)
|
|
5695
|
+
refresh: (projectExtId) => refreshProject(this.requireClient(), projectExtId),
|
|
5696
|
+
/** AI usage + spend breakdown for a project's billing period. */
|
|
5697
|
+
usage: (projectExtId, monthsBack) => getProjectUsage(this.requireClient(), projectExtId, monthsBack),
|
|
5698
|
+
/** Stripe invoices for a project's subscription. */
|
|
5699
|
+
invoices: (projectExtId) => getProjectInvoices(this.requireClient(), projectExtId)
|
|
5700
|
+
};
|
|
5701
|
+
// ── User (account-scoped usage) ───────────────────────────────────────
|
|
5702
|
+
user = {
|
|
5703
|
+
/**
|
|
5704
|
+
* The authenticated user's identity from the current session
|
|
5705
|
+
* (`external_id` + `email`), established at login. Returns `null` when not
|
|
5706
|
+
* logged in. This is the canonical "who am I" accessor — DM direction and
|
|
5707
|
+
* ownership checks read it instead of re-deriving identity per call.
|
|
5708
|
+
*/
|
|
5709
|
+
identity: () => {
|
|
5710
|
+
const state = this.requireClient().session.getState();
|
|
5711
|
+
return state.userExtId && state.userEmail ? { externalId: state.userExtId, email: state.userEmail } : null;
|
|
5712
|
+
},
|
|
5713
|
+
/** Today's deployment-wide credit spend for the current user. */
|
|
5714
|
+
usageToday: () => getUserUsageToday(this.requireClient())
|
|
5605
5715
|
};
|
|
5606
5716
|
// ── Workspaces ────────────────────────────────────────────────────────
|
|
5607
5717
|
workspaces = {
|
|
@@ -5649,6 +5759,14 @@ var Arbi = class {
|
|
|
5649
5759
|
targetWorkspaceId,
|
|
5650
5760
|
docIds,
|
|
5651
5761
|
targetWorkspaceKey
|
|
5762
|
+
),
|
|
5763
|
+
/**
|
|
5764
|
+
* The last-generated document-derived chronology (key case events / dates).
|
|
5765
|
+
* Defaults to the currently open workspace when no id is passed.
|
|
5766
|
+
*/
|
|
5767
|
+
chronology: (workspaceId) => getWorkspaceChronology(
|
|
5768
|
+
this.requireClient(),
|
|
5769
|
+
workspaceId ?? this.requireWorkspace()
|
|
5652
5770
|
)
|
|
5653
5771
|
};
|
|
5654
5772
|
// ── Documents ─────────────────────────────────────────────────────────
|
|
@@ -5775,11 +5893,80 @@ var Arbi = class {
|
|
|
5775
5893
|
groupByStatus: groupContactsByStatus
|
|
5776
5894
|
};
|
|
5777
5895
|
// ── Direct Messages ───────────────────────────────────────────────────
|
|
5896
|
+
/**
|
|
5897
|
+
* Build (and cache) the DM crypto context for the current session.
|
|
5898
|
+
*
|
|
5899
|
+
* Derives the user's curve25519 keypair from the stored signing key and pairs
|
|
5900
|
+
* it with their external_id — everything `list()`/`send()` need to encrypt and
|
|
5901
|
+
* decrypt. Cached for the session and cleared on logout. Consumers never touch
|
|
5902
|
+
* this: it's an internal of the `dm` surface.
|
|
5903
|
+
*/
|
|
5904
|
+
async requireDmCrypto() {
|
|
5905
|
+
if (this.dmCryptoContext) return this.dmCryptoContext;
|
|
5906
|
+
const client = this.requireClient();
|
|
5907
|
+
const session = await client.storage.getSession();
|
|
5908
|
+
if (!session) {
|
|
5909
|
+
throw new ArbiError("Not authenticated \u2014 no session available for DM encryption");
|
|
5910
|
+
}
|
|
5911
|
+
const userExtId = client.session.getState().userExtId;
|
|
5912
|
+
if (!userExtId) {
|
|
5913
|
+
throw new ArbiError("No user identity in session \u2014 cannot set up DM encryption");
|
|
5914
|
+
}
|
|
5915
|
+
this.dmCryptoContext = createDmCryptoContext(client, session.signingPrivateKey, userExtId);
|
|
5916
|
+
return this.dmCryptoContext;
|
|
5917
|
+
}
|
|
5778
5918
|
dm = {
|
|
5779
|
-
|
|
5780
|
-
|
|
5919
|
+
/**
|
|
5920
|
+
* List direct messages, newest first, with content already **decrypted**.
|
|
5921
|
+
* (A message that can't be decrypted comes back as `[Decryption failed]`.)
|
|
5922
|
+
*/
|
|
5923
|
+
list: async () => listDecryptedDMs(this.requireClient(), await this.requireDmCrypto()),
|
|
5924
|
+
/**
|
|
5925
|
+
* Send an E2E-encrypted DM to a recipient (email or `usr-`/`agt-` id).
|
|
5926
|
+
* Resolves the recipient's public key and encrypts internally — the caller
|
|
5927
|
+
* passes plaintext and never handles keys or ciphertext.
|
|
5928
|
+
*/
|
|
5929
|
+
send: async (recipient, text) => {
|
|
5930
|
+
const client = this.requireClient();
|
|
5931
|
+
const resolved = await resolveRecipient(client, recipient);
|
|
5932
|
+
if (!resolved) {
|
|
5933
|
+
throw new ArbiError(
|
|
5934
|
+
`Could not resolve DM recipient "${recipient}" (not a known contact, agent, or workspace member)`
|
|
5935
|
+
);
|
|
5936
|
+
}
|
|
5937
|
+
return sendEncryptedDM(
|
|
5938
|
+
client,
|
|
5939
|
+
[
|
|
5940
|
+
{
|
|
5941
|
+
recipient_ext_id: resolved.extId,
|
|
5942
|
+
content: text,
|
|
5943
|
+
recipient_encryption_public_key: resolved.pubKey
|
|
5944
|
+
}
|
|
5945
|
+
],
|
|
5946
|
+
await this.requireDmCrypto()
|
|
5947
|
+
);
|
|
5948
|
+
},
|
|
5949
|
+
/**
|
|
5950
|
+
* Send to a recipient whose external_id + public key are already known
|
|
5951
|
+
* (e.g. from a message's `sender`), skipping directory resolution.
|
|
5952
|
+
*/
|
|
5953
|
+
sendTo: async (recipientExtId, recipientPublicKey, text) => sendEncryptedDM(
|
|
5954
|
+
this.requireClient(),
|
|
5955
|
+
[
|
|
5956
|
+
{
|
|
5957
|
+
recipient_ext_id: recipientExtId,
|
|
5958
|
+
content: text,
|
|
5959
|
+
recipient_encryption_public_key: recipientPublicKey
|
|
5960
|
+
}
|
|
5961
|
+
],
|
|
5962
|
+
await this.requireDmCrypto()
|
|
5963
|
+
),
|
|
5964
|
+
/** Resolve a recipient reference to `{ extId, pubKey }` (contacts → agents → workspace). */
|
|
5965
|
+
resolveRecipient: (recipient) => resolveRecipient(this.requireClient(), recipient),
|
|
5781
5966
|
markRead: (messageIds) => markRead(this.requireClient(), messageIds),
|
|
5782
|
-
delete: (messageIds) => deleteDMs(this.requireClient(), messageIds)
|
|
5967
|
+
delete: (messageIds) => deleteDMs(this.requireClient(), messageIds),
|
|
5968
|
+
/** List the current user's durable activity feed (never unread; excluded from DMs). */
|
|
5969
|
+
listActivity: (options) => listActivity(this.requireClient(), options)
|
|
5783
5970
|
};
|
|
5784
5971
|
// ── Settings ──────────────────────────────────────────────────────────
|
|
5785
5972
|
settings = {
|
|
@@ -5923,6 +6110,6 @@ function extractResponseText(response) {
|
|
|
5923
6110
|
return parts.join("");
|
|
5924
6111
|
}
|
|
5925
6112
|
|
|
5926
|
-
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, files_exports as files, filterSkills, formatAgentStepLabel, formatFileSize, formatUserName, formatWorkspaceChoices, getErrorMessage, getRawWorkspaceKey, health_exports as health, memory_exports as memory, parseSSEEvents, parseSlashCommand, parseSlashTokenInProgress, performPasswordLogin, 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 };
|
|
6113
|
+
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, files_exports as files, filterSkills, formatAgentStepLabel, formatFileSize, formatUserName, formatWorkspaceChoices, getErrorMessage, getRawWorkspaceKey, health_exports as health, memory_exports as memory, 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 };
|
|
5927
6114
|
//# sourceMappingURL=browser.js.map
|
|
5928
6115
|
//# sourceMappingURL=browser.js.map
|