@arbidocs/sdk 0.4.25 → 0.4.29
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-C9-wve7D.d.cts → browser-AwN8DBBO.d.cts} +501 -45
- package/dist/{browser-C9-wve7D.d.ts → browser-AwN8DBBO.d.ts} +501 -45
- package/dist/browser.cjs +176 -67
- 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 +176 -67
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +182 -68
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -335
- package/dist/index.d.ts +4 -335
- package/dist/index.js +182 -68
- 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 ActivityKind, a as ActivityResponse, b as AgentControlStateEvent, c as AgentStepDeltaEvent, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, h as ArbiErrorEvent, i as ArbiOptions, k as ArtifactEvent, l as AuthContext, m as AuthHeaders, n as AuthMode, o as AuthenticatedClient, C as ChatSession, p as CitationSummary, q as CliConfig, r as CliCredentials, s as CommandDescriptor, t as ConfigStore, u as ConnectOptions, v as ConversationResponse, w as CreateFactRequest, x as CreateFactsRequest, y as CreateWorkRequest, z as CreateWorkflowRequest, B as DeferredInterjectionEvent, K as FactResponse, L as FactSearchRequest, M as FactSearchResponse, P as ListFactsOptions, S as MessageMetadataPayload, T as MessageQueuedEvent, U as OutputTokensDetails, V as ParsedSlashCommand, W as PendingAuthResponse, X as PlanWorkRequest, Y as ProbeAnswerEvent, Z as ProjectInvoicesResponse, _ as ProjectUsageResponse, $ as QueryOptions, a0 as ReconnectOptions, a1 as ReconnectableWsConnection, a2 as RequestApprovalRequest, a3 as ResolvedCitation, a5 as ResponseCompletedEvent, a6 as ResponseContentPartAddedEvent, a7 as ResponseCreatedEvent, a8 as ResponseFailedEvent, a9 as ResponseOutputItemAddedEvent, aa as ResponseOutputItemDoneEvent, ab as ResponseOutputTextDeltaEvent, ac as ResponseOutputTextDoneEvent, ad as ResponseUsage, ae as ReviewWorkRequest, af as SSEEvent, ag as SSEStreamCallbacks, ah as SSEStreamResult, ai as SSEStreamStartData, ak as SkillSummary, am as
|
|
1
|
+
export { A as ActivityKind, a as ActivityResponse, b as AgentControlStateEvent, c as AgentStepDeltaEvent, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, h as ArbiErrorEvent, i as ArbiOptions, k as ArtifactEvent, l as AuthContext, m as AuthHeaders, n as AuthMode, o as AuthenticatedClient, C as ChatSession, p as CitationSummary, q as CliConfig, r as CliCredentials, s as CommandDescriptor, t as ConfigStore, u as ConnectOptions, v as ConversationResponse, w as CreateFactRequest, x as CreateFactsRequest, y as CreateWorkRequest, z as CreateWorkflowRequest, B as DeferredInterjectionEvent, K as FactResponse, L as FactSearchRequest, M as FactSearchResponse, P as ListFactsOptions, S as MessageMetadataPayload, T as MessageQueuedEvent, U as OutputTokensDetails, V as ParsedSlashCommand, W as PendingAuthResponse, X as PlanWorkRequest, Y as ProbeAnswerEvent, Z as ProjectInvoicesResponse, _ as ProjectUsageResponse, $ as QueryOptions, a0 as ReconnectOptions, a1 as ReconnectableWsConnection, a2 as RequestApprovalRequest, a3 as ResolvedCitation, a5 as ResponseCompletedEvent, a6 as ResponseContentPartAddedEvent, a7 as ResponseCreatedEvent, a8 as ResponseFailedEvent, a9 as ResponseOutputItemAddedEvent, aa as ResponseOutputItemDoneEvent, ab as ResponseOutputTextDeltaEvent, ac as ResponseOutputTextDoneEvent, ad as ResponseUsage, ae as ReviewWorkRequest, af as SSEEvent, ag as SSEStreamCallbacks, ah as SSEStreamResult, ai as SSEStreamStartData, ak as SkillSummary, am as SubmitBackgroundQueryOptions, an as TaskPlan, ao as TokenBudgetContext, ap as UpdateConversationRequest, aq as UpdateFactRequest, ar as UpdateWorkflowRequest, ax as UserDailyUsageResponse, ay as UserInfo, az as UserInputRequestEvent, aA as UserMessageEvent, aB as WebSocketAuthError, aC as WorkStatus, aD as WorkflowAuthMode, aE as WorkflowResponse, aF as WorkflowRunResponse, aG as WorkspaceContext, aH as WsConnection, aI as account, aJ as agentconfig, aL as assistant, aM as authenticatedFetch, aO as buildRetrievalChunkTool, aP as buildRetrievalFullContextTool, aQ as buildRetrievalTocTool, aR as connectWebSocket, aS as connectWithReconnect, aT as consumeSSEStream, aU as contacts, aV as conversations, aW as countCitations, aX as createAuthenticatedClient, aZ as dm, a_ as doctags, a$ as documents, b0 as facts, b1 as files, b2 as filterSkills, b3 as formatAgentStepLabel, b4 as formatFileSize, b5 as formatItemLabel, b7 as formatUserName, b8 as formatWorkspaceChoices, bd as getErrorMessage, be as getRawWorkspaceKey, bf as health, bg as parseSSEEvents, bh as parseSlashCommand, bi as parseSlashTokenInProgress, bj as performPasswordLogin, bm as profile, bn as projects, bo as requireData, bp as requireOk, bq as resolveAuth, br as resolveCitations, bs as resolveWorkspace, bt as responses, bu as selectWorkspace, bv as selectWorkspaceById, bw as sessions, bx as settings, by as streamSSE, bz as stripCitationMarkdown, bA as summarizeCitations, bB as tags, bC as work, bD as workflows, bE as workspaces } from './browser-AwN8DBBO.cjs';
|
|
2
2
|
export { LoginProfile } from '@arbidocs/client';
|
package/dist/browser.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { A as ActivityKind, a as ActivityResponse, b as AgentControlStateEvent, c as AgentStepDeltaEvent, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, h as ArbiErrorEvent, i as ArbiOptions, k as ArtifactEvent, l as AuthContext, m as AuthHeaders, n as AuthMode, o as AuthenticatedClient, C as ChatSession, p as CitationSummary, q as CliConfig, r as CliCredentials, s as CommandDescriptor, t as ConfigStore, u as ConnectOptions, v as ConversationResponse, w as CreateFactRequest, x as CreateFactsRequest, y as CreateWorkRequest, z as CreateWorkflowRequest, B as DeferredInterjectionEvent, K as FactResponse, L as FactSearchRequest, M as FactSearchResponse, P as ListFactsOptions, S as MessageMetadataPayload, T as MessageQueuedEvent, U as OutputTokensDetails, V as ParsedSlashCommand, W as PendingAuthResponse, X as PlanWorkRequest, Y as ProbeAnswerEvent, Z as ProjectInvoicesResponse, _ as ProjectUsageResponse, $ as QueryOptions, a0 as ReconnectOptions, a1 as ReconnectableWsConnection, a2 as RequestApprovalRequest, a3 as ResolvedCitation, a5 as ResponseCompletedEvent, a6 as ResponseContentPartAddedEvent, a7 as ResponseCreatedEvent, a8 as ResponseFailedEvent, a9 as ResponseOutputItemAddedEvent, aa as ResponseOutputItemDoneEvent, ab as ResponseOutputTextDeltaEvent, ac as ResponseOutputTextDoneEvent, ad as ResponseUsage, ae as ReviewWorkRequest, af as SSEEvent, ag as SSEStreamCallbacks, ah as SSEStreamResult, ai as SSEStreamStartData, ak as SkillSummary, am as
|
|
1
|
+
export { A as ActivityKind, a as ActivityResponse, b as AgentControlStateEvent, c as AgentStepDeltaEvent, d as AgentStepEvent, e as Arbi, f as ArbiApiError, g as ArbiError, h as ArbiErrorEvent, i as ArbiOptions, k as ArtifactEvent, l as AuthContext, m as AuthHeaders, n as AuthMode, o as AuthenticatedClient, C as ChatSession, p as CitationSummary, q as CliConfig, r as CliCredentials, s as CommandDescriptor, t as ConfigStore, u as ConnectOptions, v as ConversationResponse, w as CreateFactRequest, x as CreateFactsRequest, y as CreateWorkRequest, z as CreateWorkflowRequest, B as DeferredInterjectionEvent, K as FactResponse, L as FactSearchRequest, M as FactSearchResponse, P as ListFactsOptions, S as MessageMetadataPayload, T as MessageQueuedEvent, U as OutputTokensDetails, V as ParsedSlashCommand, W as PendingAuthResponse, X as PlanWorkRequest, Y as ProbeAnswerEvent, Z as ProjectInvoicesResponse, _ as ProjectUsageResponse, $ as QueryOptions, a0 as ReconnectOptions, a1 as ReconnectableWsConnection, a2 as RequestApprovalRequest, a3 as ResolvedCitation, a5 as ResponseCompletedEvent, a6 as ResponseContentPartAddedEvent, a7 as ResponseCreatedEvent, a8 as ResponseFailedEvent, a9 as ResponseOutputItemAddedEvent, aa as ResponseOutputItemDoneEvent, ab as ResponseOutputTextDeltaEvent, ac as ResponseOutputTextDoneEvent, ad as ResponseUsage, ae as ReviewWorkRequest, af as SSEEvent, ag as SSEStreamCallbacks, ah as SSEStreamResult, ai as SSEStreamStartData, ak as SkillSummary, am as SubmitBackgroundQueryOptions, an as TaskPlan, ao as TokenBudgetContext, ap as UpdateConversationRequest, aq as UpdateFactRequest, ar as UpdateWorkflowRequest, ax as UserDailyUsageResponse, ay as UserInfo, az as UserInputRequestEvent, aA as UserMessageEvent, aB as WebSocketAuthError, aC as WorkStatus, aD as WorkflowAuthMode, aE as WorkflowResponse, aF as WorkflowRunResponse, aG as WorkspaceContext, aH as WsConnection, aI as account, aJ as agentconfig, aL as assistant, aM as authenticatedFetch, aO as buildRetrievalChunkTool, aP as buildRetrievalFullContextTool, aQ as buildRetrievalTocTool, aR as connectWebSocket, aS as connectWithReconnect, aT as consumeSSEStream, aU as contacts, aV as conversations, aW as countCitations, aX as createAuthenticatedClient, aZ as dm, a_ as doctags, a$ as documents, b0 as facts, b1 as files, b2 as filterSkills, b3 as formatAgentStepLabel, b4 as formatFileSize, b5 as formatItemLabel, b7 as formatUserName, b8 as formatWorkspaceChoices, bd as getErrorMessage, be as getRawWorkspaceKey, bf as health, bg as parseSSEEvents, bh as parseSlashCommand, bi as parseSlashTokenInProgress, bj as performPasswordLogin, bm as profile, bn as projects, bo as requireData, bp as requireOk, bq as resolveAuth, br as resolveCitations, bs as resolveWorkspace, bt as responses, bu as selectWorkspace, bv as selectWorkspaceById, bw as sessions, bx as settings, by as streamSSE, bz as stripCitationMarkdown, bA as summarizeCitations, bB as tags, bC as work, bD as workflows, bE as workspaces } from './browser-AwN8DBBO.js';
|
|
2
2
|
export { LoginProfile } from '@arbidocs/client';
|
package/dist/browser.js
CHANGED
|
@@ -3499,19 +3499,21 @@ function apiErrorDetail(apiError) {
|
|
|
3499
3499
|
return detailText(body.detail) || (typeof body.message === "string" ? body.message : void 0);
|
|
3500
3500
|
}
|
|
3501
3501
|
var ArbiApiError = class extends ArbiError {
|
|
3502
|
+
status;
|
|
3502
3503
|
apiError;
|
|
3503
3504
|
/** Why the server refused, in its words (e.g. "run_at must be in the future"), when it said. */
|
|
3504
3505
|
detail;
|
|
3505
|
-
constructor(message, apiError) {
|
|
3506
|
+
constructor(message, apiError, status) {
|
|
3506
3507
|
super(message);
|
|
3507
3508
|
this.name = "ArbiApiError";
|
|
3508
3509
|
this.apiError = apiError;
|
|
3510
|
+
this.status = status;
|
|
3509
3511
|
this.detail = apiErrorDetail(apiError);
|
|
3510
3512
|
}
|
|
3511
3513
|
};
|
|
3512
3514
|
function requireData(result, message) {
|
|
3513
3515
|
if (result.error || !result.data) {
|
|
3514
|
-
throw new ArbiApiError(message, result.error);
|
|
3516
|
+
throw new ArbiApiError(message, result.error, result.response?.status);
|
|
3515
3517
|
}
|
|
3516
3518
|
return result.data;
|
|
3517
3519
|
}
|
|
@@ -4870,6 +4872,7 @@ __export(assistant_exports, {
|
|
|
4870
4872
|
buildRetrievalChunkTool: () => buildRetrievalChunkTool,
|
|
4871
4873
|
buildRetrievalFullContextTool: () => buildRetrievalFullContextTool,
|
|
4872
4874
|
buildRetrievalTocTool: () => buildRetrievalTocTool,
|
|
4875
|
+
cancelAssistantRun: () => cancelAssistantRun,
|
|
4873
4876
|
filterSkills: () => filterSkills,
|
|
4874
4877
|
listCommands: () => listCommands,
|
|
4875
4878
|
listSkills: () => listSkills,
|
|
@@ -4945,6 +4948,9 @@ async function queryAssistant(options) {
|
|
|
4945
4948
|
question,
|
|
4946
4949
|
docIds,
|
|
4947
4950
|
previousResponseId,
|
|
4951
|
+
conversationId,
|
|
4952
|
+
assistantMode,
|
|
4953
|
+
agentId,
|
|
4948
4954
|
model,
|
|
4949
4955
|
mentions,
|
|
4950
4956
|
signal,
|
|
@@ -4955,14 +4961,17 @@ async function queryAssistant(options) {
|
|
|
4955
4961
|
input: question,
|
|
4956
4962
|
...activeArtifactExtId ? { active_artifact_ext_id: activeArtifactExtId } : {},
|
|
4957
4963
|
workspace_ext_id: workspaceId,
|
|
4964
|
+
...agentId ? { agent_ext_id: agentId } : {},
|
|
4958
4965
|
stream: true,
|
|
4959
4966
|
background: false,
|
|
4960
4967
|
store: true,
|
|
4961
|
-
tools: {
|
|
4968
|
+
tools: agentId ? {} : {
|
|
4962
4969
|
retrieval_chunk: buildRetrievalChunkTool(docIds),
|
|
4963
4970
|
retrieval_full_context: buildRetrievalFullContextTool([])
|
|
4964
4971
|
},
|
|
4965
4972
|
...previousResponseId ? { previous_response_id: previousResponseId } : {},
|
|
4973
|
+
...conversationId ? { conversation_ext_id: conversationId } : {},
|
|
4974
|
+
...assistantMode ? { assistant_mode: assistantMode } : {},
|
|
4966
4975
|
...model ? { model } : {},
|
|
4967
4976
|
...mentions && mentions.length > 0 ? { mentions } : {}
|
|
4968
4977
|
};
|
|
@@ -5024,6 +5033,91 @@ function filterSkills(items, query, pinned = []) {
|
|
|
5024
5033
|
});
|
|
5025
5034
|
return matched;
|
|
5026
5035
|
}
|
|
5036
|
+
async function cancelAssistantRun(auth, responseId) {
|
|
5037
|
+
await authenticatedFetch({
|
|
5038
|
+
...auth,
|
|
5039
|
+
path: `/v1/assistant/run/${encodeURIComponent(responseId)}/cancel`,
|
|
5040
|
+
method: "POST"
|
|
5041
|
+
});
|
|
5042
|
+
}
|
|
5043
|
+
|
|
5044
|
+
// src/operations/responses.ts
|
|
5045
|
+
var responses_exports = {};
|
|
5046
|
+
__export(responses_exports, {
|
|
5047
|
+
extractResponseText: () => extractResponseText,
|
|
5048
|
+
getResponse: () => getResponse,
|
|
5049
|
+
submitBackgroundQuery: () => submitBackgroundQuery
|
|
5050
|
+
});
|
|
5051
|
+
async function submitBackgroundQuery(options) {
|
|
5052
|
+
const {
|
|
5053
|
+
workspaceId,
|
|
5054
|
+
question,
|
|
5055
|
+
docIds,
|
|
5056
|
+
previousResponseId,
|
|
5057
|
+
model,
|
|
5058
|
+
task,
|
|
5059
|
+
conversationId,
|
|
5060
|
+
mentions,
|
|
5061
|
+
activeArtifactExtId,
|
|
5062
|
+
...auth
|
|
5063
|
+
} = options;
|
|
5064
|
+
const tools = {};
|
|
5065
|
+
if (docIds.length > 0) {
|
|
5066
|
+
tools.retrieval_chunk = {
|
|
5067
|
+
name: "retrieval_chunk",
|
|
5068
|
+
description: "retrieval chunk",
|
|
5069
|
+
tool_args: { doc_ext_ids: docIds },
|
|
5070
|
+
tool_responses: {}
|
|
5071
|
+
};
|
|
5072
|
+
tools.retrieval_full_context = {
|
|
5073
|
+
name: "retrieval_full_context",
|
|
5074
|
+
description: "retrieval full context",
|
|
5075
|
+
tool_args: { doc_ext_ids: docIds },
|
|
5076
|
+
tool_responses: {}
|
|
5077
|
+
};
|
|
5078
|
+
}
|
|
5079
|
+
const body = {
|
|
5080
|
+
input: question,
|
|
5081
|
+
workspace_ext_id: workspaceId,
|
|
5082
|
+
stream: false,
|
|
5083
|
+
background: true,
|
|
5084
|
+
store: true,
|
|
5085
|
+
tools,
|
|
5086
|
+
...task !== void 0 ? { task } : {},
|
|
5087
|
+
...conversationId ? { conversation_ext_id: conversationId } : {},
|
|
5088
|
+
...mentions !== void 0 ? { mentions } : {},
|
|
5089
|
+
...activeArtifactExtId ? { active_artifact_ext_id: activeArtifactExtId } : {},
|
|
5090
|
+
...previousResponseId ? { previous_response_id: previousResponseId } : {},
|
|
5091
|
+
...model ? { model } : {}
|
|
5092
|
+
};
|
|
5093
|
+
const res = await authenticatedFetch({
|
|
5094
|
+
...auth,
|
|
5095
|
+
path: "/v1/responses",
|
|
5096
|
+
method: "POST",
|
|
5097
|
+
body: JSON.stringify(body),
|
|
5098
|
+
headers: { "Content-Type": "application/json" }
|
|
5099
|
+
});
|
|
5100
|
+
return await res.json();
|
|
5101
|
+
}
|
|
5102
|
+
async function getResponse(auth, responseId) {
|
|
5103
|
+
const res = await authenticatedFetch({
|
|
5104
|
+
...auth,
|
|
5105
|
+
path: `/v1/responses/${responseId}`,
|
|
5106
|
+
method: "GET"
|
|
5107
|
+
});
|
|
5108
|
+
return await res.json();
|
|
5109
|
+
}
|
|
5110
|
+
function extractResponseText(response) {
|
|
5111
|
+
const parts = [];
|
|
5112
|
+
for (const msg of response.output) {
|
|
5113
|
+
for (const item of msg.content) {
|
|
5114
|
+
if ("type" in item && item.type === "output_text" && "text" in item) {
|
|
5115
|
+
parts.push(item.text);
|
|
5116
|
+
}
|
|
5117
|
+
}
|
|
5118
|
+
}
|
|
5119
|
+
return parts.join("");
|
|
5120
|
+
}
|
|
5027
5121
|
|
|
5028
5122
|
// src/operations/tags.ts
|
|
5029
5123
|
var tags_exports = {};
|
|
@@ -5211,6 +5305,48 @@ async function getAuthorizeLimits(arbi) {
|
|
|
5211
5305
|
"Failed to fetch authorize limits"
|
|
5212
5306
|
);
|
|
5213
5307
|
}
|
|
5308
|
+
async function getAgentSession(arbi, agentId) {
|
|
5309
|
+
return requireData(
|
|
5310
|
+
await arbi.fetch.GET("/v1/agents/{agent_ext_id}/session", {
|
|
5311
|
+
params: { path: { agent_ext_id: agentId } }
|
|
5312
|
+
}),
|
|
5313
|
+
"Failed to read agent session"
|
|
5314
|
+
);
|
|
5315
|
+
}
|
|
5316
|
+
async function startAgentSession(arbi, agentId, workspaceId) {
|
|
5317
|
+
return requireData(
|
|
5318
|
+
await arbi.fetch.POST("/v1/agents/{agent_ext_id}/session", {
|
|
5319
|
+
params: { path: { agent_ext_id: agentId } },
|
|
5320
|
+
body: { workspace_ext_id: workspaceId ?? null }
|
|
5321
|
+
}),
|
|
5322
|
+
"Failed to start agent session"
|
|
5323
|
+
);
|
|
5324
|
+
}
|
|
5325
|
+
async function closeAgentSession(arbi, agentId) {
|
|
5326
|
+
const { error } = await arbi.fetch.DELETE("/v1/agents/{agent_ext_id}/session", {
|
|
5327
|
+
params: { path: { agent_ext_id: agentId } }
|
|
5328
|
+
});
|
|
5329
|
+
if (error) throw new Error("Failed to close agent session");
|
|
5330
|
+
}
|
|
5331
|
+
async function listAgentChats(arbi, agentId) {
|
|
5332
|
+
return requireData(
|
|
5333
|
+
await arbi.fetch.GET("/v1/agents/{agent_ext_id}/chats", {
|
|
5334
|
+
params: { path: { agent_ext_id: agentId } }
|
|
5335
|
+
}),
|
|
5336
|
+
"Failed to read agent chats"
|
|
5337
|
+
);
|
|
5338
|
+
}
|
|
5339
|
+
async function stageAgentFile(auth, agentId, file, name) {
|
|
5340
|
+
const body = new FormData();
|
|
5341
|
+
body.append("file", file, name);
|
|
5342
|
+
const response = await authenticatedFetch({
|
|
5343
|
+
...auth,
|
|
5344
|
+
path: `/v1/agents/${encodeURIComponent(agentId)}/files`,
|
|
5345
|
+
method: "POST",
|
|
5346
|
+
body
|
|
5347
|
+
});
|
|
5348
|
+
return response.json();
|
|
5349
|
+
}
|
|
5214
5350
|
|
|
5215
5351
|
// src/operations/dm.ts
|
|
5216
5352
|
function createDmCryptoContext(arbi, signingPrivateKeyBytes, userExtId) {
|
|
@@ -5920,6 +6056,18 @@ var Arbi = class {
|
|
|
5920
6056
|
this.loginResult = await client.auth.loginWithKey({ email, signingPrivateKey });
|
|
5921
6057
|
this.userProfile = this.loginResult.profile ?? null;
|
|
5922
6058
|
}
|
|
6059
|
+
/** Recover browser authentication using the encrypted signing key already in IndexedDB. */
|
|
6060
|
+
async restoreSession(email) {
|
|
6061
|
+
const client = await this.init();
|
|
6062
|
+
const saved = await client.storage.getSession();
|
|
6063
|
+
if (!saved?.signingPrivateKey) return false;
|
|
6064
|
+
this.loginResult = await client.auth.loginWithKey({
|
|
6065
|
+
email,
|
|
6066
|
+
signingPrivateKey: saved.signingPrivateKey
|
|
6067
|
+
});
|
|
6068
|
+
this.userProfile = this.loginResult.profile ?? null;
|
|
6069
|
+
return true;
|
|
6070
|
+
}
|
|
5923
6071
|
/** A workspace's key, sealed to the caller's own session (what `/open` and `POST /workspace/users` take). */
|
|
5924
6072
|
async sealWorkspaceKey(workspaceId) {
|
|
5925
6073
|
const client = this.requireClient();
|
|
@@ -6367,19 +6515,38 @@ var Arbi = class {
|
|
|
6367
6515
|
};
|
|
6368
6516
|
// ── Assistant ─────────────────────────────────────────────────────────
|
|
6369
6517
|
assistant = {
|
|
6518
|
+
cancelRun: (responseId) => this.recovering(() => cancelAssistantRun(this.getAuthHeaders(), responseId)),
|
|
6519
|
+
/** Start a durable background turn; task options make its thread a reviewable work item. */
|
|
6520
|
+
submit: (question, options) => {
|
|
6521
|
+
const workspaceId = this.requireWorkspace();
|
|
6522
|
+
return this.recovering(
|
|
6523
|
+
() => submitBackgroundQuery({
|
|
6524
|
+
...this.getAuthHeaders(),
|
|
6525
|
+
...options,
|
|
6526
|
+
workspaceId,
|
|
6527
|
+
question
|
|
6528
|
+
})
|
|
6529
|
+
);
|
|
6530
|
+
},
|
|
6531
|
+
/** Read the status of a background turn. */
|
|
6532
|
+
getResponse: (id) => this.recovering(() => getResponse(this.getAuthHeaders(), id)),
|
|
6370
6533
|
/**
|
|
6371
6534
|
* Send a question to the RAG assistant with streaming support.
|
|
6372
6535
|
* Returns the accumulated result after the stream completes.
|
|
6373
6536
|
*/
|
|
6374
6537
|
query: async (question, options) => {
|
|
6375
|
-
const workspaceId = this.requireWorkspace();
|
|
6538
|
+
const workspaceId = options.workspaceId ?? this.requireWorkspace();
|
|
6376
6539
|
const response = await this.recovering(
|
|
6377
6540
|
() => queryAssistant({
|
|
6378
6541
|
...this.getAuthHeaders(),
|
|
6379
6542
|
workspaceId,
|
|
6380
6543
|
question,
|
|
6544
|
+
agentId: options.agentId,
|
|
6381
6545
|
docIds: options.docIds,
|
|
6382
6546
|
previousResponseId: options.previousResponseId,
|
|
6547
|
+
conversationId: options.conversationId,
|
|
6548
|
+
assistantMode: options.assistantMode,
|
|
6549
|
+
mentions: options.mentions,
|
|
6383
6550
|
model: options.model,
|
|
6384
6551
|
activeArtifactExtId: options.activeArtifactExtId,
|
|
6385
6552
|
signal: options.signal
|
|
@@ -6557,6 +6724,11 @@ var Arbi = class {
|
|
|
6557
6724
|
};
|
|
6558
6725
|
// ── Agents ──────────────────────────────────────────────────────────
|
|
6559
6726
|
agents = {
|
|
6727
|
+
getSession: (agentId) => getAgentSession(this.requireClient(), agentId),
|
|
6728
|
+
startSession: (agentId, workspaceId) => startAgentSession(this.requireClient(), agentId, workspaceId),
|
|
6729
|
+
closeSession: (agentId) => closeAgentSession(this.requireClient(), agentId),
|
|
6730
|
+
listChats: (agentId) => listAgentChats(this.requireClient(), agentId),
|
|
6731
|
+
stageFile: (agentId, file, name) => this.recovering(() => stageAgentFile(this.getAuthHeaders(), agentId, file, name)),
|
|
6560
6732
|
list: () => listAgents(this.requireClient()),
|
|
6561
6733
|
create: (name) => createAgent(this.requireClient(), name),
|
|
6562
6734
|
getConfig: (agentExtId) => getAgentConfig(this.requireClient(), agentExtId),
|
|
@@ -6643,69 +6815,6 @@ var Arbi = class {
|
|
|
6643
6815
|
}
|
|
6644
6816
|
};
|
|
6645
6817
|
|
|
6646
|
-
// src/operations/responses.ts
|
|
6647
|
-
var responses_exports = {};
|
|
6648
|
-
__export(responses_exports, {
|
|
6649
|
-
extractResponseText: () => extractResponseText,
|
|
6650
|
-
getResponse: () => getResponse,
|
|
6651
|
-
submitBackgroundQuery: () => submitBackgroundQuery
|
|
6652
|
-
});
|
|
6653
|
-
async function submitBackgroundQuery(options) {
|
|
6654
|
-
const { workspaceId, question, docIds, previousResponseId, model, ...auth } = options;
|
|
6655
|
-
const tools = {};
|
|
6656
|
-
if (docIds.length > 0) {
|
|
6657
|
-
tools.retrieval_chunk = {
|
|
6658
|
-
name: "retrieval_chunk",
|
|
6659
|
-
description: "retrieval chunk",
|
|
6660
|
-
tool_args: { doc_ext_ids: docIds },
|
|
6661
|
-
tool_responses: {}
|
|
6662
|
-
};
|
|
6663
|
-
tools.retrieval_full_context = {
|
|
6664
|
-
name: "retrieval_full_context",
|
|
6665
|
-
description: "retrieval full context",
|
|
6666
|
-
tool_args: { doc_ext_ids: [] },
|
|
6667
|
-
tool_responses: {}
|
|
6668
|
-
};
|
|
6669
|
-
}
|
|
6670
|
-
const body = {
|
|
6671
|
-
input: question,
|
|
6672
|
-
workspace_ext_id: workspaceId,
|
|
6673
|
-
stream: false,
|
|
6674
|
-
background: true,
|
|
6675
|
-
store: true,
|
|
6676
|
-
tools,
|
|
6677
|
-
...previousResponseId ? { previous_response_id: previousResponseId } : {},
|
|
6678
|
-
...model ? { model } : {}
|
|
6679
|
-
};
|
|
6680
|
-
const res = await authenticatedFetch({
|
|
6681
|
-
...auth,
|
|
6682
|
-
path: "/v1/responses",
|
|
6683
|
-
method: "POST",
|
|
6684
|
-
body: JSON.stringify(body),
|
|
6685
|
-
headers: { "Content-Type": "application/json" }
|
|
6686
|
-
});
|
|
6687
|
-
return await res.json();
|
|
6688
|
-
}
|
|
6689
|
-
async function getResponse(auth, responseId) {
|
|
6690
|
-
const res = await authenticatedFetch({
|
|
6691
|
-
...auth,
|
|
6692
|
-
path: `/v1/responses/${responseId}`,
|
|
6693
|
-
method: "GET"
|
|
6694
|
-
});
|
|
6695
|
-
return await res.json();
|
|
6696
|
-
}
|
|
6697
|
-
function extractResponseText(response) {
|
|
6698
|
-
const parts = [];
|
|
6699
|
-
for (const msg of response.output) {
|
|
6700
|
-
for (const item of msg.content) {
|
|
6701
|
-
if ("type" in item && item.type === "output_text" && "text" in item) {
|
|
6702
|
-
parts.push(item.text);
|
|
6703
|
-
}
|
|
6704
|
-
}
|
|
6705
|
-
}
|
|
6706
|
-
return parts.join("");
|
|
6707
|
-
}
|
|
6708
|
-
|
|
6709
6818
|
export { Arbi, ArbiApiError, ArbiError, WebSocketAuthError, account_exports as account, agentconfig_exports as agentconfig, assistant_exports as assistant, authenticatedFetch, buildRetrievalChunkTool, buildRetrievalFullContextTool, buildRetrievalTocTool, connectWebSocket, connectWithReconnect, consumeSSEStream, contacts_exports as contacts, conversations_exports as conversations, countCitations, createAuthenticatedClient, dm_exports as dm, doctags_exports as doctags, documents_exports as documents, facts_exports as facts, files_exports as files, filterSkills, formatAgentStepLabel, formatFileSize, formatItemLabel, formatUserName, formatWorkspaceChoices, getErrorMessage, getRawWorkspaceKey, health_exports as health, parseSSEEvents, parseSlashCommand, parseSlashTokenInProgress, performPasswordLogin, profile_exports as profile, projects_exports as projects, requireData, requireOk, resolveAuth, resolveCitations, resolveWorkspace, responses_exports as responses, selectWorkspace, selectWorkspaceById, sessions_exports as sessions, settings_exports as settings, streamSSE, stripCitationMarkdown, summarizeCitations, tags_exports as tags, work_exports as work, workflows_exports as workflows, workspaces_exports as workspaces };
|
|
6710
6819
|
//# sourceMappingURL=browser.js.map
|
|
6711
6820
|
//# sourceMappingURL=browser.js.map
|