@arbidocs/sdk 0.4.3 → 0.4.5
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-4VHbRx1J.d.cts → browser-5spRium9.d.cts} +195 -6
- package/dist/{browser-4VHbRx1J.d.ts → browser-5spRium9.d.ts} +195 -6
- package/dist/browser.cjs +141 -10
- 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 +141 -10
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +133 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +18 -3
- package/dist/index.d.ts +18 -3
- package/dist/index.js +133 -10
- 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 agentconfig, au as assistant, av as authenticatedFetch, ax as buildRetrievalChunkTool, ay as buildRetrievalFullContextTool, az as buildRetrievalTocTool, aA as connectWebSocket, aB as connectWithReconnect, aC as consumeSSEStream, aD as contacts, aE as conversations, aF as countCitations, aG as createAuthenticatedClient, aI as dm, aJ as doctags, aK as documents, aL as facts, aM as files, aN as filterSkills, aO as formatAgentStepLabel, aP as formatFileSize, aQ as formatItemLabel, aS as formatUserName, aT as formatWorkspaceChoices, aY as getErrorMessage, aZ as getRawWorkspaceKey, a_ as health, a$ as parseSSEEvents, b0 as parseSlashCommand, b1 as parseSlashTokenInProgress, b2 as performPasswordLogin, b5 as projects, b6 as requireData, b7 as requireOk, b8 as resolveAuth, b9 as resolveCitations, ba as resolveWorkspace, bb as responses, bc as selectWorkspace, bd as selectWorkspaceById, be as settings, bf as streamSSE, bg as stripCitationMarkdown, bh as summarizeCitations, bi as tags, bj as tasks, bk as workspaces } from './browser-
|
|
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 agentconfig, au as assistant, av as authenticatedFetch, ax as buildRetrievalChunkTool, ay as buildRetrievalFullContextTool, az as buildRetrievalTocTool, aA as connectWebSocket, aB as connectWithReconnect, aC as consumeSSEStream, aD as contacts, aE as conversations, aF as countCitations, aG as createAuthenticatedClient, aI as dm, aJ as doctags, aK as documents, aL as facts, aM as files, aN as filterSkills, aO as formatAgentStepLabel, aP as formatFileSize, aQ as formatItemLabel, aS as formatUserName, aT as formatWorkspaceChoices, aY as getErrorMessage, aZ as getRawWorkspaceKey, a_ as health, a$ as parseSSEEvents, b0 as parseSlashCommand, b1 as parseSlashTokenInProgress, b2 as performPasswordLogin, b5 as projects, b6 as requireData, b7 as requireOk, b8 as resolveAuth, b9 as resolveCitations, ba as resolveWorkspace, bb as responses, bc as selectWorkspace, bd as selectWorkspaceById, be as settings, bf as streamSSE, bg as stripCitationMarkdown, bh as summarizeCitations, bi as tags, bj as tasks, bk as workspaces } from './browser-5spRium9.cjs';
|
|
2
2
|
import '@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 agentconfig, au as assistant, av as authenticatedFetch, ax as buildRetrievalChunkTool, ay as buildRetrievalFullContextTool, az as buildRetrievalTocTool, aA as connectWebSocket, aB as connectWithReconnect, aC as consumeSSEStream, aD as contacts, aE as conversations, aF as countCitations, aG as createAuthenticatedClient, aI as dm, aJ as doctags, aK as documents, aL as facts, aM as files, aN as filterSkills, aO as formatAgentStepLabel, aP as formatFileSize, aQ as formatItemLabel, aS as formatUserName, aT as formatWorkspaceChoices, aY as getErrorMessage, aZ as getRawWorkspaceKey, a_ as health, a$ as parseSSEEvents, b0 as parseSlashCommand, b1 as parseSlashTokenInProgress, b2 as performPasswordLogin, b5 as projects, b6 as requireData, b7 as requireOk, b8 as resolveAuth, b9 as resolveCitations, ba as resolveWorkspace, bb as responses, bc as selectWorkspace, bd as selectWorkspaceById, be as settings, bf as streamSSE, bg as stripCitationMarkdown, bh as summarizeCitations, bi as tags, bj as tasks, bk as workspaces } from './browser-
|
|
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 agentconfig, au as assistant, av as authenticatedFetch, ax as buildRetrievalChunkTool, ay as buildRetrievalFullContextTool, az as buildRetrievalTocTool, aA as connectWebSocket, aB as connectWithReconnect, aC as consumeSSEStream, aD as contacts, aE as conversations, aF as countCitations, aG as createAuthenticatedClient, aI as dm, aJ as doctags, aK as documents, aL as facts, aM as files, aN as filterSkills, aO as formatAgentStepLabel, aP as formatFileSize, aQ as formatItemLabel, aS as formatUserName, aT as formatWorkspaceChoices, aY as getErrorMessage, aZ as getRawWorkspaceKey, a_ as health, a$ as parseSSEEvents, b0 as parseSlashCommand, b1 as parseSlashTokenInProgress, b2 as performPasswordLogin, b5 as projects, b6 as requireData, b7 as requireOk, b8 as resolveAuth, b9 as resolveCitations, ba as resolveWorkspace, bb as responses, bc as selectWorkspace, bd as selectWorkspaceById, be as settings, bf as streamSSE, bg as stripCitationMarkdown, bh as summarizeCitations, bi as tags, bj as tasks, bk as workspaces } from './browser-5spRium9.js';
|
|
2
2
|
import '@arbidocs/client';
|
package/dist/browser.js
CHANGED
|
@@ -3641,6 +3641,16 @@ async function selectWorkspace(arbi, workspaceId, wrappedKey, serverSessionKey,
|
|
|
3641
3641
|
arbi.session.setSelectedWorkspace(workspaceId);
|
|
3642
3642
|
return header;
|
|
3643
3643
|
}
|
|
3644
|
+
async function generateEncryptedWorkspaceKey(arbi, wrappedKey, serverSessionKey, signingPrivateKeyBase64) {
|
|
3645
|
+
const signingPrivateKey = base64ToBytes(signingPrivateKeyBase64);
|
|
3646
|
+
const ed25519PublicKey = signingPrivateKey.slice(32, 64);
|
|
3647
|
+
const encryptionKeyPair = deriveEncryptionKeypairFromSigning({
|
|
3648
|
+
publicKey: ed25519PublicKey,
|
|
3649
|
+
secretKey: signingPrivateKey
|
|
3650
|
+
});
|
|
3651
|
+
const workspaceKey = sealedBoxDecrypt(wrappedKey, encryptionKeyPair.secretKey);
|
|
3652
|
+
return sealKeyForSession(workspaceKey, serverSessionKey);
|
|
3653
|
+
}
|
|
3644
3654
|
async function getRawWorkspaceKey(arbi, workspaceId, signingPrivateKeyBase64) {
|
|
3645
3655
|
const { data: workspaces, error } = await arbi.fetch.GET("/v1/user/workspaces");
|
|
3646
3656
|
if (error || !workspaces) {
|
|
@@ -4466,6 +4476,7 @@ async function uploadFile(auth, fileData, fileName, options) {
|
|
|
4466
4476
|
if (options?.folder) params.set("folder", sanitizeFolderPath(options.folder));
|
|
4467
4477
|
if (options?.configExtId) params.set("config_ext_id", options.configExtId);
|
|
4468
4478
|
if (options?.wpType) params.set("wp_type", options.wpType);
|
|
4479
|
+
if (options?.parentExtId) params.set("parent_ext_id", options.parentExtId);
|
|
4469
4480
|
const qs = params.toString();
|
|
4470
4481
|
const res = await authenticatedFetch({
|
|
4471
4482
|
...auth,
|
|
@@ -4482,6 +4493,7 @@ async function uploadFiles(auth, files, options) {
|
|
|
4482
4493
|
if (options?.folder) params.set("folder", sanitizeFolderPath(options.folder));
|
|
4483
4494
|
if (options?.configExtId) params.set("config_ext_id", options.configExtId);
|
|
4484
4495
|
if (options?.wpType) params.set("wp_type", options.wpType);
|
|
4496
|
+
if (options?.parentExtId) params.set("parent_ext_id", options.parentExtId);
|
|
4485
4497
|
const qs = params.toString();
|
|
4486
4498
|
const res = await authenticatedFetch({
|
|
4487
4499
|
...auth,
|
|
@@ -4663,6 +4675,7 @@ __export(workspaces_exports, {
|
|
|
4663
4675
|
copyDocuments: () => copyDocuments,
|
|
4664
4676
|
createWorkspace: () => createWorkspace,
|
|
4665
4677
|
deleteWorkspaces: () => deleteWorkspaces,
|
|
4678
|
+
grantTemporaryWorkspaceAccess: () => grantTemporaryWorkspaceAccess,
|
|
4666
4679
|
listWorkspaceUsers: () => listWorkspaceUsers,
|
|
4667
4680
|
listWorkspaces: () => listWorkspaces,
|
|
4668
4681
|
removeWorkspaceUsers: () => removeWorkspaceUsers,
|
|
@@ -4703,14 +4716,33 @@ async function updateWorkspace(arbi, body) {
|
|
|
4703
4716
|
async function listWorkspaceUsers(arbi) {
|
|
4704
4717
|
return requireData(await arbi.fetch.GET("/v1/workspace/users"), "Failed to fetch workspace users");
|
|
4705
4718
|
}
|
|
4706
|
-
async function addWorkspaceUsers(arbi, emails, role = "collaborator") {
|
|
4719
|
+
async function addWorkspaceUsers(arbi, emails, role = "collaborator", target) {
|
|
4707
4720
|
return requireData(
|
|
4708
4721
|
await arbi.fetch.POST("/v1/workspace/users", {
|
|
4709
|
-
body:
|
|
4722
|
+
body: target ? {
|
|
4723
|
+
emails,
|
|
4724
|
+
role,
|
|
4725
|
+
workspace_ext_id: target.workspaceExtId,
|
|
4726
|
+
workspace_key: target.workspaceKey
|
|
4727
|
+
} : { emails, role }
|
|
4710
4728
|
}),
|
|
4711
4729
|
"Failed to add users"
|
|
4712
4730
|
);
|
|
4713
4731
|
}
|
|
4732
|
+
async function grantTemporaryWorkspaceAccess(arbi, params) {
|
|
4733
|
+
return requireData(
|
|
4734
|
+
await arbi.fetch.POST("/v1/workspace/users", {
|
|
4735
|
+
body: {
|
|
4736
|
+
emails: params.emails,
|
|
4737
|
+
role: params.role ?? "collaborator",
|
|
4738
|
+
workspace_ext_id: params.workspaceExtId,
|
|
4739
|
+
workspace_key: params.workspaceKey,
|
|
4740
|
+
session_pubkey_b64: params.sessionPubkeyB64
|
|
4741
|
+
}
|
|
4742
|
+
}),
|
|
4743
|
+
"Failed to grant temporary access"
|
|
4744
|
+
);
|
|
4745
|
+
}
|
|
4714
4746
|
async function removeWorkspaceUsers(arbi, userIds) {
|
|
4715
4747
|
requireOk(
|
|
4716
4748
|
await arbi.fetch.DELETE("/v1/workspace/users", {
|
|
@@ -5135,6 +5167,21 @@ async function deleteAgents(arbi, agentExtIds) {
|
|
|
5135
5167
|
"Failed to delete agents"
|
|
5136
5168
|
);
|
|
5137
5169
|
}
|
|
5170
|
+
async function authorizeAgent(arbi, agentExtId, workspaceExtId, ttlSeconds) {
|
|
5171
|
+
return requireData(
|
|
5172
|
+
await arbi.fetch.POST("/v1/agents/{agent_ext_id}/authorize", {
|
|
5173
|
+
params: { path: { agent_ext_id: agentExtId } },
|
|
5174
|
+
body: { workspace_ext_id: workspaceExtId, ttl_seconds: ttlSeconds ?? null }
|
|
5175
|
+
}),
|
|
5176
|
+
"Failed to authorize agent"
|
|
5177
|
+
);
|
|
5178
|
+
}
|
|
5179
|
+
async function getAuthorizeLimits(arbi) {
|
|
5180
|
+
return requireData(
|
|
5181
|
+
await arbi.fetch.GET("/v1/agents/authorize-limits"),
|
|
5182
|
+
"Failed to fetch authorize limits"
|
|
5183
|
+
);
|
|
5184
|
+
}
|
|
5138
5185
|
|
|
5139
5186
|
// src/operations/dm.ts
|
|
5140
5187
|
function createDmCryptoContext(arbi, signingPrivateKeyBytes, userExtId) {
|
|
@@ -5517,6 +5564,7 @@ __export(tasks_exports, {
|
|
|
5517
5564
|
createTask: () => createTask,
|
|
5518
5565
|
deleteTask: () => deleteTask,
|
|
5519
5566
|
getTask: () => getTask,
|
|
5567
|
+
listTaskRuns: () => listTaskRuns,
|
|
5520
5568
|
listTasks: () => listTasks,
|
|
5521
5569
|
runTask: () => runTask,
|
|
5522
5570
|
updateTask: () => updateTask
|
|
@@ -5554,6 +5602,12 @@ async function runTask(arbi, taskId) {
|
|
|
5554
5602
|
"Failed to run task"
|
|
5555
5603
|
);
|
|
5556
5604
|
}
|
|
5605
|
+
async function listTaskRuns(arbi, taskId) {
|
|
5606
|
+
return requireData(
|
|
5607
|
+
await arbi.fetch.GET("/v1/tasks/{task_id}/runs", { params: { path: { task_id: taskId } } }),
|
|
5608
|
+
"Failed to list task runs"
|
|
5609
|
+
);
|
|
5610
|
+
}
|
|
5557
5611
|
|
|
5558
5612
|
// src/operations/facts.ts
|
|
5559
5613
|
var facts_exports = {};
|
|
@@ -5695,6 +5749,22 @@ var Arbi = class {
|
|
|
5695
5749
|
const signingPrivateKey = client.crypto.base64ToBytes(signingPrivateKeyBase64);
|
|
5696
5750
|
this.loginResult = await client.auth.loginWithKey({ email, signingPrivateKey });
|
|
5697
5751
|
}
|
|
5752
|
+
/** A workspace's key, sealed to the caller's own session (what `/open` and `POST /workspace/users` take). */
|
|
5753
|
+
async sealWorkspaceKey(workspaceId) {
|
|
5754
|
+
const client = this.requireClient();
|
|
5755
|
+
const lr2 = this.requireLogin();
|
|
5756
|
+
const all = await listWorkspaces(client);
|
|
5757
|
+
const ws = all.find((w2) => w2.external_id === workspaceId);
|
|
5758
|
+
if (!ws || !ws.wrapped_key) {
|
|
5759
|
+
throw new ArbiError(`Workspace ${workspaceId} not found or has no encryption key`);
|
|
5760
|
+
}
|
|
5761
|
+
return generateEncryptedWorkspaceKey(
|
|
5762
|
+
client,
|
|
5763
|
+
ws.wrapped_key,
|
|
5764
|
+
lr2.serverSessionKey,
|
|
5765
|
+
client.crypto.bytesToBase64(lr2.signingPrivateKey)
|
|
5766
|
+
);
|
|
5767
|
+
}
|
|
5698
5768
|
/**
|
|
5699
5769
|
* Select a workspace by ID. Fetches the workspace list, finds the matching
|
|
5700
5770
|
* workspace, decrypts the wrapped key, and sets up auth headers.
|
|
@@ -5877,6 +5947,30 @@ var Arbi = class {
|
|
|
5877
5947
|
update: (body) => updateWorkspace(this.requireClient(), body),
|
|
5878
5948
|
listUsers: () => listWorkspaceUsers(this.requireClient()),
|
|
5879
5949
|
addUsers: (emails, role) => addWorkspaceUsers(this.requireClient(), emails, role),
|
|
5950
|
+
/**
|
|
5951
|
+
* Grant users a temporary key scoped to ONE session (identified by its public key), for
|
|
5952
|
+
* example an agent's run session minted by `agents.authorize()`. Nothing standing is created:
|
|
5953
|
+
* the grant expires with that session. Works for any workspace the caller holds a key for;
|
|
5954
|
+
* it does not need to be the open one.
|
|
5955
|
+
*/
|
|
5956
|
+
grantTemporaryAccess: async (params) => {
|
|
5957
|
+
const client = this.requireClient();
|
|
5958
|
+
return grantTemporaryWorkspaceAccess(client, {
|
|
5959
|
+
emails: params.emails,
|
|
5960
|
+
workspaceExtId: params.workspaceId,
|
|
5961
|
+
workspaceKey: await this.sealWorkspaceKey(params.workspaceId),
|
|
5962
|
+
sessionPubkeyB64: params.sessionPubkeyB64,
|
|
5963
|
+
role: params.role
|
|
5964
|
+
});
|
|
5965
|
+
},
|
|
5966
|
+
/**
|
|
5967
|
+
* Add users (standing, permanent membership) to ANY workspace the caller holds a key for,
|
|
5968
|
+
* without opening it. `addUsers` does the same for the currently open workspace.
|
|
5969
|
+
*/
|
|
5970
|
+
grantAccess: async (params) => addWorkspaceUsers(this.requireClient(), params.emails, params.role, {
|
|
5971
|
+
workspaceExtId: params.workspaceId,
|
|
5972
|
+
workspaceKey: await this.sealWorkspaceKey(params.workspaceId)
|
|
5973
|
+
}),
|
|
5880
5974
|
removeUsers: (userIds) => removeWorkspaceUsers(this.requireClient(), userIds),
|
|
5881
5975
|
setUserRole: (userIds, role) => setUserRole(this.requireClient(), userIds, role),
|
|
5882
5976
|
/**
|
|
@@ -5934,12 +6028,7 @@ var Arbi = class {
|
|
|
5934
6028
|
uploadFile: (fileData, fileName, options) => {
|
|
5935
6029
|
this.requireWorkspace();
|
|
5936
6030
|
return this.recovering(
|
|
5937
|
-
() => uploadFile(
|
|
5938
|
-
this.getAuthHeaders(),
|
|
5939
|
-
fileData,
|
|
5940
|
-
fileName,
|
|
5941
|
-
options?.folder ? { folder: options.folder } : void 0
|
|
5942
|
-
)
|
|
6031
|
+
() => uploadFile(this.getAuthHeaders(), fileData, fileName, options)
|
|
5943
6032
|
);
|
|
5944
6033
|
},
|
|
5945
6034
|
download: (docId) => this.recovering(() => downloadDocument(this.getAuthHeaders(), docId)),
|
|
@@ -5992,6 +6081,8 @@ var Arbi = class {
|
|
|
5992
6081
|
* Respond to an agent's question during a human-in-the-loop workflow.
|
|
5993
6082
|
*/
|
|
5994
6083
|
respond: (assistantMessageExtId, answer) => respondToAgent(this.requireClient(), assistantMessageExtId, answer),
|
|
6084
|
+
/** The skills the caller can run (own + shared marketplace), metadata only. */
|
|
6085
|
+
listSkills: (options) => listSkills(this.requireClient(), options),
|
|
5995
6086
|
/**
|
|
5996
6087
|
* Search documents without LLM generation (retrieval only).
|
|
5997
6088
|
*/
|
|
@@ -6148,7 +6239,28 @@ var Arbi = class {
|
|
|
6148
6239
|
create: (name) => createAgent(this.requireClient(), name),
|
|
6149
6240
|
getConfig: (agentExtId) => getAgentConfig(this.requireClient(), agentExtId),
|
|
6150
6241
|
listWorkspaces: (agentExtId) => listAgentWorkspaces(this.requireClient(), agentExtId),
|
|
6151
|
-
delete: (agentExtIds) => deleteAgents(this.requireClient(), agentExtIds)
|
|
6242
|
+
delete: (agentExtIds) => deleteAgents(this.requireClient(), agentExtIds),
|
|
6243
|
+
/** Mint a TTL'd run session for an agent; see `grantTemporaryAccess` to also deposit a key. */
|
|
6244
|
+
authorize: (agentExtId, workspaceId, ttlSeconds) => authorizeAgent(this.requireClient(), agentExtId, workspaceId, ttlSeconds),
|
|
6245
|
+
authorizeLimits: () => getAuthorizeLimits(this.requireClient()),
|
|
6246
|
+
/**
|
|
6247
|
+
* Give an agent temporary, session-scoped access to a workspace: mint its run session, then
|
|
6248
|
+
* deposit the workspace key on it. Returns the session details (`ttl` in seconds).
|
|
6249
|
+
*/
|
|
6250
|
+
grantTemporaryAccess: async (agentExtId, workspaceId, ttlSeconds) => {
|
|
6251
|
+
const session = await authorizeAgent(
|
|
6252
|
+
this.requireClient(),
|
|
6253
|
+
agentExtId,
|
|
6254
|
+
workspaceId,
|
|
6255
|
+
ttlSeconds
|
|
6256
|
+
);
|
|
6257
|
+
await this.workspaces.grantTemporaryAccess({
|
|
6258
|
+
workspaceId,
|
|
6259
|
+
emails: [session.agent_email],
|
|
6260
|
+
sessionPubkeyB64: session.session_pubkey_b64
|
|
6261
|
+
});
|
|
6262
|
+
return session;
|
|
6263
|
+
}
|
|
6152
6264
|
};
|
|
6153
6265
|
// ── Scheduled tasks ───────────────────────────────────────────────────
|
|
6154
6266
|
tasks = {
|
|
@@ -6157,7 +6269,26 @@ var Arbi = class {
|
|
|
6157
6269
|
get: (taskId) => getTask(this.requireClient(), taskId),
|
|
6158
6270
|
update: (taskId, body) => updateTask(this.requireClient(), taskId, body),
|
|
6159
6271
|
delete: (taskId) => deleteTask(this.requireClient(), taskId),
|
|
6160
|
-
run: (taskId) => runTask(this.requireClient(), taskId)
|
|
6272
|
+
run: (taskId) => runTask(this.requireClient(), taskId),
|
|
6273
|
+
listRuns: (taskId) => listTaskRuns(this.requireClient(), taskId),
|
|
6274
|
+
/**
|
|
6275
|
+
* Run a task and, when the run is parked waiting for workspace access (a temporary
|
|
6276
|
+
* authorization tier), grant the agent's run session a temporary key and run it again.
|
|
6277
|
+
* A task that needs no approval returns from the first call already running.
|
|
6278
|
+
*/
|
|
6279
|
+
runWithAuth: async (taskId) => {
|
|
6280
|
+
const client = this.requireClient();
|
|
6281
|
+
const first = await runTask(client, taskId);
|
|
6282
|
+
if (!first.pending_auth_request_id || !first.pending_auth_session_pubkey || !first.pending_auth_agent_email || !first.workspace_ext_id) {
|
|
6283
|
+
return first;
|
|
6284
|
+
}
|
|
6285
|
+
await this.workspaces.grantTemporaryAccess({
|
|
6286
|
+
workspaceId: first.workspace_ext_id,
|
|
6287
|
+
emails: [first.pending_auth_agent_email],
|
|
6288
|
+
sessionPubkeyB64: first.pending_auth_session_pubkey
|
|
6289
|
+
});
|
|
6290
|
+
return runTask(client, taskId);
|
|
6291
|
+
}
|
|
6161
6292
|
};
|
|
6162
6293
|
// ── Workspace facts ─────────────────────────────────────────────────
|
|
6163
6294
|
facts = {
|