@arbidocs/sdk 0.4.3 → 0.4.4
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-Bdzn5DIN.d.cts} +192 -3
- package/dist/{browser-4VHbRx1J.d.ts → browser-Bdzn5DIN.d.ts} +192 -3
- package/dist/browser.cjs +138 -4
- 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 +138 -4
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +130 -4
- 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 +130 -4
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { q as ConfigStore, n as CliConfig, o as CliCredentials, C as ChatSession, ac as SkippedFile, al as UploadResult, k as AuthHeaders, ah as UploadBatchResult, ak as UploadOptions, ai as UploadDirectOptions, aj as UploadDirectResult, aa as SUPPORTED_EXTENSIONS, w as DmCryptoContext } from './browser-
|
|
2
|
-
export { b as AgentStepEvent, c as Arbi, d as ArbiApiError, e as ArbiError, g as ArbiOptions, h as ArbiSessionExpiredError, i as ArtifactEvent, j as AuthContext, l as AuthenticatedClient, m as CitationSummary, p as CommandDescriptor, r as ConnectOptions, D as DOC_TERMINAL_STATUSES, x as DocNameMap, y as DocumentListFields, z as DocumentListOrder, B as DocumentWaiter, E as DocumentWaiterOptions, I as FormattedWsMessage, L as ListAllOptions, K as ListPaginatedOptions, M as MessageLevel, N as MessageMetadataPayload, O as MessageQueuedEvent, P as OutputTokensDetails, Q as ParsedSlashCommand, S as ProjectInvoicesResponse, T as ProjectUsageResponse, U as QueryOptions, V as ReconnectOptions, W as ReconnectableWsConnection, X as ResolvedCitation, Y as ResolvedRecipient, Z as ResponseCompletedEvent, _ as ResponseContentPartAddedEvent, $ as ResponseCreatedEvent, a0 as ResponseFailedEvent, a1 as ResponseOutputItemAddedEvent, a2 as ResponseOutputItemDoneEvent, a3 as ResponseOutputTextDeltaEvent, a4 as ResponseOutputTextDoneEvent, a5 as ResponseUsage, a6 as SSEEvent, a7 as SSEStreamCallbacks, a8 as SSEStreamResult, a9 as SSEStreamStartData, ab as SkillSummary, ae as TokenBudgetContext, am as UserDailyUsageResponse, an as UserInfo, ao as UserInputRequestEvent, ap as UserMessageEvent, aq as WebSocketAuthError, ar as WorkspaceContext, as as WsConnection, at as agentconfig, au as assistant, av as authenticatedFetch, aw as buildDocNameMap, 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, aH as createDocumentWaiter, 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, aR as formatStreamSummary, aS as formatUserName, aT as formatWorkspaceChoices, aU as formatWsMessage, aV as generateEncryptedWorkspaceKey, aW as generateNewWorkspaceKey, aX as getErrorCode, aY as getErrorMessage, aZ as getRawWorkspaceKey, a_ as health, a$ as parseSSEEvents, b0 as parseSlashCommand, b1 as parseSlashTokenInProgress, b2 as performPasswordLogin, b3 as performSigningKeyLogin, b4 as performSsoDeviceFlowLogin, 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
|
+
import { q as ConfigStore, n as CliConfig, o as CliCredentials, C as ChatSession, ac as SkippedFile, al as UploadResult, k as AuthHeaders, ah as UploadBatchResult, ak as UploadOptions, ai as UploadDirectOptions, aj as UploadDirectResult, aa as SUPPORTED_EXTENSIONS, w as DmCryptoContext } from './browser-Bdzn5DIN.cjs';
|
|
2
|
+
export { b as AgentStepEvent, c as Arbi, d as ArbiApiError, e as ArbiError, g as ArbiOptions, h as ArbiSessionExpiredError, i as ArtifactEvent, j as AuthContext, l as AuthenticatedClient, m as CitationSummary, p as CommandDescriptor, r as ConnectOptions, D as DOC_TERMINAL_STATUSES, x as DocNameMap, y as DocumentListFields, z as DocumentListOrder, B as DocumentWaiter, E as DocumentWaiterOptions, I as FormattedWsMessage, L as ListAllOptions, K as ListPaginatedOptions, M as MessageLevel, N as MessageMetadataPayload, O as MessageQueuedEvent, P as OutputTokensDetails, Q as ParsedSlashCommand, S as ProjectInvoicesResponse, T as ProjectUsageResponse, U as QueryOptions, V as ReconnectOptions, W as ReconnectableWsConnection, X as ResolvedCitation, Y as ResolvedRecipient, Z as ResponseCompletedEvent, _ as ResponseContentPartAddedEvent, $ as ResponseCreatedEvent, a0 as ResponseFailedEvent, a1 as ResponseOutputItemAddedEvent, a2 as ResponseOutputItemDoneEvent, a3 as ResponseOutputTextDeltaEvent, a4 as ResponseOutputTextDoneEvent, a5 as ResponseUsage, a6 as SSEEvent, a7 as SSEStreamCallbacks, a8 as SSEStreamResult, a9 as SSEStreamStartData, ab as SkillSummary, ae as TokenBudgetContext, am as UserDailyUsageResponse, an as UserInfo, ao as UserInputRequestEvent, ap as UserMessageEvent, aq as WebSocketAuthError, ar as WorkspaceContext, as as WsConnection, at as agentconfig, au as assistant, av as authenticatedFetch, aw as buildDocNameMap, 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, aH as createDocumentWaiter, 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, aR as formatStreamSummary, aS as formatUserName, aT as formatWorkspaceChoices, aU as formatWsMessage, aV as generateEncryptedWorkspaceKey, aW as generateNewWorkspaceKey, aX as getErrorCode, aY as getErrorMessage, aZ as getRawWorkspaceKey, a_ as health, a$ as parseSSEEvents, b0 as parseSlashCommand, b1 as parseSlashTokenInProgress, b2 as performPasswordLogin, b3 as performSigningKeyLogin, b4 as performSsoDeviceFlowLogin, 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-Bdzn5DIN.cjs';
|
|
3
3
|
import { SessionStorageProvider, ArbiClient, components } from '@arbidocs/client';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -380,6 +380,8 @@ declare namespace documentsNode {
|
|
|
380
380
|
type UserResponse = components['schemas']['UserResponse'];
|
|
381
381
|
type CreateAgentResponse = components['schemas']['CreateAgentResponse'];
|
|
382
382
|
type AgentWorkspaceResponse = components['schemas']['AgentWorkspaceResponse'];
|
|
383
|
+
type AuthorizeAgentResponse = components['schemas']['AuthorizeAgentResponse'];
|
|
384
|
+
type AuthorizeLimitsResponse = components['schemas']['AuthorizeLimitsResponse'];
|
|
383
385
|
declare function listAgents(arbi: ArbiClient): Promise<UserResponse[]>;
|
|
384
386
|
/**
|
|
385
387
|
* Create a persistent agent. Only `name` is accepted (alphanumeric, `_`/`-`).
|
|
@@ -677,14 +679,27 @@ declare function listAgentWorkspaces(arbi: ArbiClient, agentExtId: string): Prom
|
|
|
677
679
|
declare function deleteAgents(arbi: ArbiClient, agentExtIds: string[]): Promise<{
|
|
678
680
|
[x: string]: unknown;
|
|
679
681
|
}>;
|
|
682
|
+
/**
|
|
683
|
+
* Mint a fresh, TTL'd run session for the caller's own agent
|
|
684
|
+
* (`POST /v1/agents/{id}/authorize`). The response carries the session's public key; deposit a
|
|
685
|
+
* temporary workspace key on it with `Arbi.workspaces.grantTemporaryAccess()` (or do both in one
|
|
686
|
+
* call with `Arbi.agents.grantTemporaryAccess()`). `ttlSeconds` omitted = the deployment default.
|
|
687
|
+
*/
|
|
688
|
+
declare function authorizeAgent(arbi: ArbiClient, agentExtId: string, workspaceExtId: string, ttlSeconds?: number): Promise<AuthorizeAgentResponse>;
|
|
689
|
+
/** The default and maximum lifetime of a temporary agent authorization. */
|
|
690
|
+
declare function getAuthorizeLimits(arbi: ArbiClient): Promise<AuthorizeLimitsResponse>;
|
|
680
691
|
|
|
692
|
+
type agents_AuthorizeAgentResponse = AuthorizeAgentResponse;
|
|
693
|
+
type agents_AuthorizeLimitsResponse = AuthorizeLimitsResponse;
|
|
694
|
+
declare const agents_authorizeAgent: typeof authorizeAgent;
|
|
681
695
|
declare const agents_createAgent: typeof createAgent;
|
|
682
696
|
declare const agents_deleteAgents: typeof deleteAgents;
|
|
683
697
|
declare const agents_getAgentConfig: typeof getAgentConfig;
|
|
698
|
+
declare const agents_getAuthorizeLimits: typeof getAuthorizeLimits;
|
|
684
699
|
declare const agents_listAgentWorkspaces: typeof listAgentWorkspaces;
|
|
685
700
|
declare const agents_listAgents: typeof listAgents;
|
|
686
701
|
declare namespace agents {
|
|
687
|
-
export { agents_createAgent as createAgent, agents_deleteAgents as deleteAgents, agents_getAgentConfig as getAgentConfig, agents_listAgentWorkspaces as listAgentWorkspaces, agents_listAgents as listAgents };
|
|
702
|
+
export { type agents_AuthorizeAgentResponse as AuthorizeAgentResponse, type agents_AuthorizeLimitsResponse as AuthorizeLimitsResponse, agents_authorizeAgent as authorizeAgent, agents_createAgent as createAgent, agents_deleteAgents as deleteAgents, agents_getAgentConfig as getAgentConfig, agents_getAuthorizeLimits as getAuthorizeLimits, agents_listAgentWorkspaces as listAgentWorkspaces, agents_listAgents as listAgents };
|
|
688
703
|
}
|
|
689
704
|
|
|
690
705
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { q as ConfigStore, n as CliConfig, o as CliCredentials, C as ChatSession, ac as SkippedFile, al as UploadResult, k as AuthHeaders, ah as UploadBatchResult, ak as UploadOptions, ai as UploadDirectOptions, aj as UploadDirectResult, aa as SUPPORTED_EXTENSIONS, w as DmCryptoContext } from './browser-
|
|
2
|
-
export { b as AgentStepEvent, c as Arbi, d as ArbiApiError, e as ArbiError, g as ArbiOptions, h as ArbiSessionExpiredError, i as ArtifactEvent, j as AuthContext, l as AuthenticatedClient, m as CitationSummary, p as CommandDescriptor, r as ConnectOptions, D as DOC_TERMINAL_STATUSES, x as DocNameMap, y as DocumentListFields, z as DocumentListOrder, B as DocumentWaiter, E as DocumentWaiterOptions, I as FormattedWsMessage, L as ListAllOptions, K as ListPaginatedOptions, M as MessageLevel, N as MessageMetadataPayload, O as MessageQueuedEvent, P as OutputTokensDetails, Q as ParsedSlashCommand, S as ProjectInvoicesResponse, T as ProjectUsageResponse, U as QueryOptions, V as ReconnectOptions, W as ReconnectableWsConnection, X as ResolvedCitation, Y as ResolvedRecipient, Z as ResponseCompletedEvent, _ as ResponseContentPartAddedEvent, $ as ResponseCreatedEvent, a0 as ResponseFailedEvent, a1 as ResponseOutputItemAddedEvent, a2 as ResponseOutputItemDoneEvent, a3 as ResponseOutputTextDeltaEvent, a4 as ResponseOutputTextDoneEvent, a5 as ResponseUsage, a6 as SSEEvent, a7 as SSEStreamCallbacks, a8 as SSEStreamResult, a9 as SSEStreamStartData, ab as SkillSummary, ae as TokenBudgetContext, am as UserDailyUsageResponse, an as UserInfo, ao as UserInputRequestEvent, ap as UserMessageEvent, aq as WebSocketAuthError, ar as WorkspaceContext, as as WsConnection, at as agentconfig, au as assistant, av as authenticatedFetch, aw as buildDocNameMap, 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, aH as createDocumentWaiter, 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, aR as formatStreamSummary, aS as formatUserName, aT as formatWorkspaceChoices, aU as formatWsMessage, aV as generateEncryptedWorkspaceKey, aW as generateNewWorkspaceKey, aX as getErrorCode, aY as getErrorMessage, aZ as getRawWorkspaceKey, a_ as health, a$ as parseSSEEvents, b0 as parseSlashCommand, b1 as parseSlashTokenInProgress, b2 as performPasswordLogin, b3 as performSigningKeyLogin, b4 as performSsoDeviceFlowLogin, 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
|
+
import { q as ConfigStore, n as CliConfig, o as CliCredentials, C as ChatSession, ac as SkippedFile, al as UploadResult, k as AuthHeaders, ah as UploadBatchResult, ak as UploadOptions, ai as UploadDirectOptions, aj as UploadDirectResult, aa as SUPPORTED_EXTENSIONS, w as DmCryptoContext } from './browser-Bdzn5DIN.js';
|
|
2
|
+
export { b as AgentStepEvent, c as Arbi, d as ArbiApiError, e as ArbiError, g as ArbiOptions, h as ArbiSessionExpiredError, i as ArtifactEvent, j as AuthContext, l as AuthenticatedClient, m as CitationSummary, p as CommandDescriptor, r as ConnectOptions, D as DOC_TERMINAL_STATUSES, x as DocNameMap, y as DocumentListFields, z as DocumentListOrder, B as DocumentWaiter, E as DocumentWaiterOptions, I as FormattedWsMessage, L as ListAllOptions, K as ListPaginatedOptions, M as MessageLevel, N as MessageMetadataPayload, O as MessageQueuedEvent, P as OutputTokensDetails, Q as ParsedSlashCommand, S as ProjectInvoicesResponse, T as ProjectUsageResponse, U as QueryOptions, V as ReconnectOptions, W as ReconnectableWsConnection, X as ResolvedCitation, Y as ResolvedRecipient, Z as ResponseCompletedEvent, _ as ResponseContentPartAddedEvent, $ as ResponseCreatedEvent, a0 as ResponseFailedEvent, a1 as ResponseOutputItemAddedEvent, a2 as ResponseOutputItemDoneEvent, a3 as ResponseOutputTextDeltaEvent, a4 as ResponseOutputTextDoneEvent, a5 as ResponseUsage, a6 as SSEEvent, a7 as SSEStreamCallbacks, a8 as SSEStreamResult, a9 as SSEStreamStartData, ab as SkillSummary, ae as TokenBudgetContext, am as UserDailyUsageResponse, an as UserInfo, ao as UserInputRequestEvent, ap as UserMessageEvent, aq as WebSocketAuthError, ar as WorkspaceContext, as as WsConnection, at as agentconfig, au as assistant, av as authenticatedFetch, aw as buildDocNameMap, 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, aH as createDocumentWaiter, 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, aR as formatStreamSummary, aS as formatUserName, aT as formatWorkspaceChoices, aU as formatWsMessage, aV as generateEncryptedWorkspaceKey, aW as generateNewWorkspaceKey, aX as getErrorCode, aY as getErrorMessage, aZ as getRawWorkspaceKey, a_ as health, a$ as parseSSEEvents, b0 as parseSlashCommand, b1 as parseSlashTokenInProgress, b2 as performPasswordLogin, b3 as performSigningKeyLogin, b4 as performSsoDeviceFlowLogin, 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-Bdzn5DIN.js';
|
|
3
3
|
import { SessionStorageProvider, ArbiClient, components } from '@arbidocs/client';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -380,6 +380,8 @@ declare namespace documentsNode {
|
|
|
380
380
|
type UserResponse = components['schemas']['UserResponse'];
|
|
381
381
|
type CreateAgentResponse = components['schemas']['CreateAgentResponse'];
|
|
382
382
|
type AgentWorkspaceResponse = components['schemas']['AgentWorkspaceResponse'];
|
|
383
|
+
type AuthorizeAgentResponse = components['schemas']['AuthorizeAgentResponse'];
|
|
384
|
+
type AuthorizeLimitsResponse = components['schemas']['AuthorizeLimitsResponse'];
|
|
383
385
|
declare function listAgents(arbi: ArbiClient): Promise<UserResponse[]>;
|
|
384
386
|
/**
|
|
385
387
|
* Create a persistent agent. Only `name` is accepted (alphanumeric, `_`/`-`).
|
|
@@ -677,14 +679,27 @@ declare function listAgentWorkspaces(arbi: ArbiClient, agentExtId: string): Prom
|
|
|
677
679
|
declare function deleteAgents(arbi: ArbiClient, agentExtIds: string[]): Promise<{
|
|
678
680
|
[x: string]: unknown;
|
|
679
681
|
}>;
|
|
682
|
+
/**
|
|
683
|
+
* Mint a fresh, TTL'd run session for the caller's own agent
|
|
684
|
+
* (`POST /v1/agents/{id}/authorize`). The response carries the session's public key; deposit a
|
|
685
|
+
* temporary workspace key on it with `Arbi.workspaces.grantTemporaryAccess()` (or do both in one
|
|
686
|
+
* call with `Arbi.agents.grantTemporaryAccess()`). `ttlSeconds` omitted = the deployment default.
|
|
687
|
+
*/
|
|
688
|
+
declare function authorizeAgent(arbi: ArbiClient, agentExtId: string, workspaceExtId: string, ttlSeconds?: number): Promise<AuthorizeAgentResponse>;
|
|
689
|
+
/** The default and maximum lifetime of a temporary agent authorization. */
|
|
690
|
+
declare function getAuthorizeLimits(arbi: ArbiClient): Promise<AuthorizeLimitsResponse>;
|
|
680
691
|
|
|
692
|
+
type agents_AuthorizeAgentResponse = AuthorizeAgentResponse;
|
|
693
|
+
type agents_AuthorizeLimitsResponse = AuthorizeLimitsResponse;
|
|
694
|
+
declare const agents_authorizeAgent: typeof authorizeAgent;
|
|
681
695
|
declare const agents_createAgent: typeof createAgent;
|
|
682
696
|
declare const agents_deleteAgents: typeof deleteAgents;
|
|
683
697
|
declare const agents_getAgentConfig: typeof getAgentConfig;
|
|
698
|
+
declare const agents_getAuthorizeLimits: typeof getAuthorizeLimits;
|
|
684
699
|
declare const agents_listAgentWorkspaces: typeof listAgentWorkspaces;
|
|
685
700
|
declare const agents_listAgents: typeof listAgents;
|
|
686
701
|
declare namespace agents {
|
|
687
|
-
export { agents_createAgent as createAgent, agents_deleteAgents as deleteAgents, agents_getAgentConfig as getAgentConfig, agents_listAgentWorkspaces as listAgentWorkspaces, agents_listAgents as listAgents };
|
|
702
|
+
export { type agents_AuthorizeAgentResponse as AuthorizeAgentResponse, type agents_AuthorizeLimitsResponse as AuthorizeLimitsResponse, agents_authorizeAgent as authorizeAgent, agents_createAgent as createAgent, agents_deleteAgents as deleteAgents, agents_getAgentConfig as getAgentConfig, agents_getAuthorizeLimits as getAuthorizeLimits, agents_listAgentWorkspaces as listAgentWorkspaces, agents_listAgents as listAgents };
|
|
688
703
|
}
|
|
689
704
|
|
|
690
705
|
/**
|
package/dist/index.js
CHANGED
|
@@ -5216,6 +5216,7 @@ __export(workspaces_exports, {
|
|
|
5216
5216
|
copyDocuments: () => copyDocuments,
|
|
5217
5217
|
createWorkspace: () => createWorkspace,
|
|
5218
5218
|
deleteWorkspaces: () => deleteWorkspaces,
|
|
5219
|
+
grantTemporaryWorkspaceAccess: () => grantTemporaryWorkspaceAccess,
|
|
5219
5220
|
listWorkspaceUsers: () => listWorkspaceUsers,
|
|
5220
5221
|
listWorkspaces: () => listWorkspaces,
|
|
5221
5222
|
removeWorkspaceUsers: () => removeWorkspaceUsers,
|
|
@@ -5256,14 +5257,33 @@ async function updateWorkspace(arbi, body) {
|
|
|
5256
5257
|
async function listWorkspaceUsers(arbi) {
|
|
5257
5258
|
return requireData(await arbi.fetch.GET("/v1/workspace/users"), "Failed to fetch workspace users");
|
|
5258
5259
|
}
|
|
5259
|
-
async function addWorkspaceUsers(arbi, emails, role = "collaborator") {
|
|
5260
|
+
async function addWorkspaceUsers(arbi, emails, role = "collaborator", target) {
|
|
5260
5261
|
return requireData(
|
|
5261
5262
|
await arbi.fetch.POST("/v1/workspace/users", {
|
|
5262
|
-
body:
|
|
5263
|
+
body: target ? {
|
|
5264
|
+
emails,
|
|
5265
|
+
role,
|
|
5266
|
+
workspace_ext_id: target.workspaceExtId,
|
|
5267
|
+
workspace_key: target.workspaceKey
|
|
5268
|
+
} : { emails, role }
|
|
5263
5269
|
}),
|
|
5264
5270
|
"Failed to add users"
|
|
5265
5271
|
);
|
|
5266
5272
|
}
|
|
5273
|
+
async function grantTemporaryWorkspaceAccess(arbi, params) {
|
|
5274
|
+
return requireData(
|
|
5275
|
+
await arbi.fetch.POST("/v1/workspace/users", {
|
|
5276
|
+
body: {
|
|
5277
|
+
emails: params.emails,
|
|
5278
|
+
role: params.role ?? "collaborator",
|
|
5279
|
+
workspace_ext_id: params.workspaceExtId,
|
|
5280
|
+
workspace_key: params.workspaceKey,
|
|
5281
|
+
session_pubkey_b64: params.sessionPubkeyB64
|
|
5282
|
+
}
|
|
5283
|
+
}),
|
|
5284
|
+
"Failed to grant temporary access"
|
|
5285
|
+
);
|
|
5286
|
+
}
|
|
5267
5287
|
async function removeWorkspaceUsers(arbi, userIds) {
|
|
5268
5288
|
requireOk(
|
|
5269
5289
|
await arbi.fetch.DELETE("/v1/workspace/users", {
|
|
@@ -5659,9 +5679,11 @@ __export(dm_exports, {
|
|
|
5659
5679
|
// src/operations/agents.ts
|
|
5660
5680
|
var agents_exports = {};
|
|
5661
5681
|
__export(agents_exports, {
|
|
5682
|
+
authorizeAgent: () => authorizeAgent,
|
|
5662
5683
|
createAgent: () => createAgent,
|
|
5663
5684
|
deleteAgents: () => deleteAgents,
|
|
5664
5685
|
getAgentConfig: () => getAgentConfig,
|
|
5686
|
+
getAuthorizeLimits: () => getAuthorizeLimits,
|
|
5665
5687
|
listAgentWorkspaces: () => listAgentWorkspaces,
|
|
5666
5688
|
listAgents: () => listAgents
|
|
5667
5689
|
});
|
|
@@ -5696,6 +5718,21 @@ async function deleteAgents(arbi, agentExtIds) {
|
|
|
5696
5718
|
"Failed to delete agents"
|
|
5697
5719
|
);
|
|
5698
5720
|
}
|
|
5721
|
+
async function authorizeAgent(arbi, agentExtId, workspaceExtId, ttlSeconds) {
|
|
5722
|
+
return requireData(
|
|
5723
|
+
await arbi.fetch.POST("/v1/agents/{agent_ext_id}/authorize", {
|
|
5724
|
+
params: { path: { agent_ext_id: agentExtId } },
|
|
5725
|
+
body: { workspace_ext_id: workspaceExtId, ttl_seconds: ttlSeconds ?? null }
|
|
5726
|
+
}),
|
|
5727
|
+
"Failed to authorize agent"
|
|
5728
|
+
);
|
|
5729
|
+
}
|
|
5730
|
+
async function getAuthorizeLimits(arbi) {
|
|
5731
|
+
return requireData(
|
|
5732
|
+
await arbi.fetch.GET("/v1/agents/authorize-limits"),
|
|
5733
|
+
"Failed to fetch authorize limits"
|
|
5734
|
+
);
|
|
5735
|
+
}
|
|
5699
5736
|
|
|
5700
5737
|
// src/operations/dm.ts
|
|
5701
5738
|
function createDmCryptoContext(arbi, signingPrivateKeyBytes, userExtId) {
|
|
@@ -6082,6 +6119,7 @@ __export(tasks_exports, {
|
|
|
6082
6119
|
createTask: () => createTask,
|
|
6083
6120
|
deleteTask: () => deleteTask,
|
|
6084
6121
|
getTask: () => getTask,
|
|
6122
|
+
listTaskRuns: () => listTaskRuns,
|
|
6085
6123
|
listTasks: () => listTasks,
|
|
6086
6124
|
runTask: () => runTask,
|
|
6087
6125
|
updateTask: () => updateTask
|
|
@@ -6119,6 +6157,12 @@ async function runTask(arbi, taskId) {
|
|
|
6119
6157
|
"Failed to run task"
|
|
6120
6158
|
);
|
|
6121
6159
|
}
|
|
6160
|
+
async function listTaskRuns(arbi, taskId) {
|
|
6161
|
+
return requireData(
|
|
6162
|
+
await arbi.fetch.GET("/v1/tasks/{task_id}/runs", { params: { path: { task_id: taskId } } }),
|
|
6163
|
+
"Failed to list task runs"
|
|
6164
|
+
);
|
|
6165
|
+
}
|
|
6122
6166
|
|
|
6123
6167
|
// src/operations/facts.ts
|
|
6124
6168
|
var facts_exports = {};
|
|
@@ -6260,6 +6304,22 @@ var Arbi = class {
|
|
|
6260
6304
|
const signingPrivateKey = client.crypto.base64ToBytes(signingPrivateKeyBase64);
|
|
6261
6305
|
this.loginResult = await client.auth.loginWithKey({ email, signingPrivateKey });
|
|
6262
6306
|
}
|
|
6307
|
+
/** A workspace's key, sealed to the caller's own session (what `/open` and `POST /workspace/users` take). */
|
|
6308
|
+
async sealWorkspaceKey(workspaceId) {
|
|
6309
|
+
const client = this.requireClient();
|
|
6310
|
+
const lr2 = this.requireLogin();
|
|
6311
|
+
const all = await listWorkspaces(client);
|
|
6312
|
+
const ws = all.find((w2) => w2.external_id === workspaceId);
|
|
6313
|
+
if (!ws || !ws.wrapped_key) {
|
|
6314
|
+
throw new ArbiError(`Workspace ${workspaceId} not found or has no encryption key`);
|
|
6315
|
+
}
|
|
6316
|
+
return generateEncryptedWorkspaceKey(
|
|
6317
|
+
client,
|
|
6318
|
+
ws.wrapped_key,
|
|
6319
|
+
lr2.serverSessionKey,
|
|
6320
|
+
client.crypto.bytesToBase64(lr2.signingPrivateKey)
|
|
6321
|
+
);
|
|
6322
|
+
}
|
|
6263
6323
|
/**
|
|
6264
6324
|
* Select a workspace by ID. Fetches the workspace list, finds the matching
|
|
6265
6325
|
* workspace, decrypts the wrapped key, and sets up auth headers.
|
|
@@ -6442,6 +6502,30 @@ var Arbi = class {
|
|
|
6442
6502
|
update: (body) => updateWorkspace(this.requireClient(), body),
|
|
6443
6503
|
listUsers: () => listWorkspaceUsers(this.requireClient()),
|
|
6444
6504
|
addUsers: (emails, role) => addWorkspaceUsers(this.requireClient(), emails, role),
|
|
6505
|
+
/**
|
|
6506
|
+
* Grant users a temporary key scoped to ONE session (identified by its public key), for
|
|
6507
|
+
* example an agent's run session minted by `agents.authorize()`. Nothing standing is created:
|
|
6508
|
+
* the grant expires with that session. Works for any workspace the caller holds a key for;
|
|
6509
|
+
* it does not need to be the open one.
|
|
6510
|
+
*/
|
|
6511
|
+
grantTemporaryAccess: async (params) => {
|
|
6512
|
+
const client = this.requireClient();
|
|
6513
|
+
return grantTemporaryWorkspaceAccess(client, {
|
|
6514
|
+
emails: params.emails,
|
|
6515
|
+
workspaceExtId: params.workspaceId,
|
|
6516
|
+
workspaceKey: await this.sealWorkspaceKey(params.workspaceId),
|
|
6517
|
+
sessionPubkeyB64: params.sessionPubkeyB64,
|
|
6518
|
+
role: params.role
|
|
6519
|
+
});
|
|
6520
|
+
},
|
|
6521
|
+
/**
|
|
6522
|
+
* Add users (standing, permanent membership) to ANY workspace the caller holds a key for,
|
|
6523
|
+
* without opening it. `addUsers` does the same for the currently open workspace.
|
|
6524
|
+
*/
|
|
6525
|
+
grantAccess: async (params) => addWorkspaceUsers(this.requireClient(), params.emails, params.role, {
|
|
6526
|
+
workspaceExtId: params.workspaceId,
|
|
6527
|
+
workspaceKey: await this.sealWorkspaceKey(params.workspaceId)
|
|
6528
|
+
}),
|
|
6445
6529
|
removeUsers: (userIds) => removeWorkspaceUsers(this.requireClient(), userIds),
|
|
6446
6530
|
setUserRole: (userIds, role) => setUserRole(this.requireClient(), userIds, role),
|
|
6447
6531
|
/**
|
|
@@ -6557,6 +6641,8 @@ var Arbi = class {
|
|
|
6557
6641
|
* Respond to an agent's question during a human-in-the-loop workflow.
|
|
6558
6642
|
*/
|
|
6559
6643
|
respond: (assistantMessageExtId, answer) => respondToAgent(this.requireClient(), assistantMessageExtId, answer),
|
|
6644
|
+
/** The skills the caller can run (own + shared marketplace), metadata only. */
|
|
6645
|
+
listSkills: (options) => listSkills(this.requireClient(), options),
|
|
6560
6646
|
/**
|
|
6561
6647
|
* Search documents without LLM generation (retrieval only).
|
|
6562
6648
|
*/
|
|
@@ -6713,7 +6799,28 @@ var Arbi = class {
|
|
|
6713
6799
|
create: (name) => createAgent(this.requireClient(), name),
|
|
6714
6800
|
getConfig: (agentExtId) => getAgentConfig(this.requireClient(), agentExtId),
|
|
6715
6801
|
listWorkspaces: (agentExtId) => listAgentWorkspaces(this.requireClient(), agentExtId),
|
|
6716
|
-
delete: (agentExtIds) => deleteAgents(this.requireClient(), agentExtIds)
|
|
6802
|
+
delete: (agentExtIds) => deleteAgents(this.requireClient(), agentExtIds),
|
|
6803
|
+
/** Mint a TTL'd run session for an agent; see `grantTemporaryAccess` to also deposit a key. */
|
|
6804
|
+
authorize: (agentExtId, workspaceId, ttlSeconds) => authorizeAgent(this.requireClient(), agentExtId, workspaceId, ttlSeconds),
|
|
6805
|
+
authorizeLimits: () => getAuthorizeLimits(this.requireClient()),
|
|
6806
|
+
/**
|
|
6807
|
+
* Give an agent temporary, session-scoped access to a workspace: mint its run session, then
|
|
6808
|
+
* deposit the workspace key on it. Returns the session details (`ttl` in seconds).
|
|
6809
|
+
*/
|
|
6810
|
+
grantTemporaryAccess: async (agentExtId, workspaceId, ttlSeconds) => {
|
|
6811
|
+
const session = await authorizeAgent(
|
|
6812
|
+
this.requireClient(),
|
|
6813
|
+
agentExtId,
|
|
6814
|
+
workspaceId,
|
|
6815
|
+
ttlSeconds
|
|
6816
|
+
);
|
|
6817
|
+
await this.workspaces.grantTemporaryAccess({
|
|
6818
|
+
workspaceId,
|
|
6819
|
+
emails: [session.agent_email],
|
|
6820
|
+
sessionPubkeyB64: session.session_pubkey_b64
|
|
6821
|
+
});
|
|
6822
|
+
return session;
|
|
6823
|
+
}
|
|
6717
6824
|
};
|
|
6718
6825
|
// ── Scheduled tasks ───────────────────────────────────────────────────
|
|
6719
6826
|
tasks = {
|
|
@@ -6722,7 +6829,26 @@ var Arbi = class {
|
|
|
6722
6829
|
get: (taskId) => getTask(this.requireClient(), taskId),
|
|
6723
6830
|
update: (taskId, body) => updateTask(this.requireClient(), taskId, body),
|
|
6724
6831
|
delete: (taskId) => deleteTask(this.requireClient(), taskId),
|
|
6725
|
-
run: (taskId) => runTask(this.requireClient(), taskId)
|
|
6832
|
+
run: (taskId) => runTask(this.requireClient(), taskId),
|
|
6833
|
+
listRuns: (taskId) => listTaskRuns(this.requireClient(), taskId),
|
|
6834
|
+
/**
|
|
6835
|
+
* Run a task and, when the run is parked waiting for workspace access (a temporary
|
|
6836
|
+
* authorization tier), grant the agent's run session a temporary key and run it again.
|
|
6837
|
+
* A task that needs no approval returns from the first call already running.
|
|
6838
|
+
*/
|
|
6839
|
+
runWithAuth: async (taskId) => {
|
|
6840
|
+
const client = this.requireClient();
|
|
6841
|
+
const first = await runTask(client, taskId);
|
|
6842
|
+
if (!first.pending_auth_request_id || !first.pending_auth_session_pubkey || !first.pending_auth_agent_email || !first.workspace_ext_id) {
|
|
6843
|
+
return first;
|
|
6844
|
+
}
|
|
6845
|
+
await this.workspaces.grantTemporaryAccess({
|
|
6846
|
+
workspaceId: first.workspace_ext_id,
|
|
6847
|
+
emails: [first.pending_auth_agent_email],
|
|
6848
|
+
sessionPubkeyB64: first.pending_auth_session_pubkey
|
|
6849
|
+
});
|
|
6850
|
+
return runTask(client, taskId);
|
|
6851
|
+
}
|
|
6726
6852
|
};
|
|
6727
6853
|
// ── Workspace facts ─────────────────────────────────────────────────
|
|
6728
6854
|
facts = {
|