@arbidocs/sdk 0.3.78 → 0.3.80
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-CgUpQbyw.d.cts → browser-DIO4_N2g.d.cts} +25 -20
- package/dist/{browser-CgUpQbyw.d.ts → browser-DIO4_N2g.d.ts} +25 -20
- package/dist/browser.cjs +60 -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 +60 -10
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +60 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +60 -10
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { n as ConfigStore, l as CliConfig, m as CliCredentials, C as ChatSession, Z as SkippedFile, a2 as UploadResult, i as AuthHeaders, _ as UploadBatchResult, a1 as UploadOptions, $ as UploadDirectOptions, a0 as UploadDirectResult, X as SUPPORTED_EXTENSIONS, p as DmCryptoContext } from './browser-DIO4_N2g.cjs';
|
|
2
|
+
export { a as AgentStepEvent, b as Arbi, c as ArbiApiError, d as ArbiError, f as ArbiOptions, g as ArtifactEvent, h as AuthContext, j as AuthenticatedClient, k as CitationSummary, o as ConnectOptions, D as DOC_TERMINAL_STATUSES, q as DocNameMap, r as DocumentListFields, s as DocumentListOrder, t as DocumentWaiter, u as DocumentWaiterOptions, F as FormattedWsMessage, L as ListAllOptions, v as ListPaginatedOptions, M as MessageLevel, w as MessageMetadataPayload, x as MessageQueuedEvent, O as OutputTokensDetails, P as ParsedSlashCommand, Q as QueryOptions, R as ReconnectOptions, y as ReconnectableWsConnection, z as ResolvedCitation, B as ResponseCompletedEvent, E as ResponseContentPartAddedEvent, G as ResponseCreatedEvent, H as ResponseFailedEvent, I as ResponseOutputItemAddedEvent, J as ResponseOutputItemDoneEvent, K as ResponseOutputTextDeltaEvent, N as ResponseOutputTextDoneEvent, S as ResponseUsage, T as SSEEvent, U as SSEStreamCallbacks, V as SSEStreamResult, W as SSEStreamStartData, Y as SkillSummary, a3 as UserInfo, a4 as UserInputRequestEvent, a5 as UserMessageEvent, a6 as WebSocketAuthError, a7 as WorkspaceContext, a8 as WsConnection, a9 as agentconfig, aa as assistant, ab as authenticatedFetch, ac as buildRetrievalChunkTool, ad as buildRetrievalFullContextTool, ae as buildRetrievalTocTool, af as connectWebSocket, ag as connectWithReconnect, ah as consumeSSEStream, ai as contacts, aj as conversations, ak as countCitations, al as createAuthenticatedClient, am as createDocumentWaiter, an as dm, ao as doctags, ap as documents, aq as files, ar as filterSkills, as as formatAgentStepLabel, at as formatFileSize, au as formatStreamSummary, av as formatUserName, aw as formatWorkspaceChoices, ax as formatWsMessage, ay as generateEncryptedWorkspaceKey, az as generateNewWorkspaceKey, aA as getErrorCode, aB as getErrorMessage, aC as getRawWorkspaceKey, aD as health, aE as parseSSEEvents, aF as parseSlashCommand, aG as parseSlashTokenInProgress, aH as performPasswordLogin, aI as performSigningKeyLogin, aJ as performSsoDeviceFlowLogin, aK as requireData, aL as requireOk, aM as resolveAuth, aN as resolveCitations, aO as resolveWorkspace, aP as responses, aQ as selectWorkspace, aR as selectWorkspaceById, aS as settings, aT as streamSSE, aU as stripCitationMarkdown, aV as summarizeCitations, aW as tags, aX as workspaces } from './browser-DIO4_N2g.cjs';
|
|
3
3
|
import { SessionStorageProvider, ArbiClient, components } from '@arbidocs/client';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { n as ConfigStore, l as CliConfig, m as CliCredentials, C as ChatSession, Z as SkippedFile, a2 as UploadResult, i as AuthHeaders, _ as UploadBatchResult, a1 as UploadOptions, $ as UploadDirectOptions, a0 as UploadDirectResult, X as SUPPORTED_EXTENSIONS, p as DmCryptoContext } from './browser-DIO4_N2g.js';
|
|
2
|
+
export { a as AgentStepEvent, b as Arbi, c as ArbiApiError, d as ArbiError, f as ArbiOptions, g as ArtifactEvent, h as AuthContext, j as AuthenticatedClient, k as CitationSummary, o as ConnectOptions, D as DOC_TERMINAL_STATUSES, q as DocNameMap, r as DocumentListFields, s as DocumentListOrder, t as DocumentWaiter, u as DocumentWaiterOptions, F as FormattedWsMessage, L as ListAllOptions, v as ListPaginatedOptions, M as MessageLevel, w as MessageMetadataPayload, x as MessageQueuedEvent, O as OutputTokensDetails, P as ParsedSlashCommand, Q as QueryOptions, R as ReconnectOptions, y as ReconnectableWsConnection, z as ResolvedCitation, B as ResponseCompletedEvent, E as ResponseContentPartAddedEvent, G as ResponseCreatedEvent, H as ResponseFailedEvent, I as ResponseOutputItemAddedEvent, J as ResponseOutputItemDoneEvent, K as ResponseOutputTextDeltaEvent, N as ResponseOutputTextDoneEvent, S as ResponseUsage, T as SSEEvent, U as SSEStreamCallbacks, V as SSEStreamResult, W as SSEStreamStartData, Y as SkillSummary, a3 as UserInfo, a4 as UserInputRequestEvent, a5 as UserMessageEvent, a6 as WebSocketAuthError, a7 as WorkspaceContext, a8 as WsConnection, a9 as agentconfig, aa as assistant, ab as authenticatedFetch, ac as buildRetrievalChunkTool, ad as buildRetrievalFullContextTool, ae as buildRetrievalTocTool, af as connectWebSocket, ag as connectWithReconnect, ah as consumeSSEStream, ai as contacts, aj as conversations, ak as countCitations, al as createAuthenticatedClient, am as createDocumentWaiter, an as dm, ao as doctags, ap as documents, aq as files, ar as filterSkills, as as formatAgentStepLabel, at as formatFileSize, au as formatStreamSummary, av as formatUserName, aw as formatWorkspaceChoices, ax as formatWsMessage, ay as generateEncryptedWorkspaceKey, az as generateNewWorkspaceKey, aA as getErrorCode, aB as getErrorMessage, aC as getRawWorkspaceKey, aD as health, aE as parseSSEEvents, aF as parseSlashCommand, aG as parseSlashTokenInProgress, aH as performPasswordLogin, aI as performSigningKeyLogin, aJ as performSsoDeviceFlowLogin, aK as requireData, aL as requireOk, aM as resolveAuth, aN as resolveCitations, aO as resolveWorkspace, aP as responses, aQ as selectWorkspace, aR as selectWorkspaceById, aS as settings, aT as streamSSE, aU as stripCitationMarkdown, aV as summarizeCitations, aW as tags, aX as workspaces } from './browser-DIO4_N2g.js';
|
|
3
3
|
import { SessionStorageProvider, ArbiClient, components } from '@arbidocs/client';
|
|
4
4
|
|
|
5
5
|
/**
|
package/dist/index.js
CHANGED
|
@@ -4179,26 +4179,66 @@ async function resolveWorkspace(store, workspaceOpt) {
|
|
|
4179
4179
|
|
|
4180
4180
|
// src/sse.ts
|
|
4181
4181
|
var LIFECYCLE_LABELS_FALLBACK = {
|
|
4182
|
+
goal: "Thinking\u2026",
|
|
4182
4183
|
evaluation: "Evaluating results",
|
|
4183
|
-
answering: "
|
|
4184
|
+
answering: "Answered",
|
|
4184
4185
|
reviewing: "Reviewing answer",
|
|
4185
4186
|
planning: "Planning",
|
|
4186
4187
|
tool_progress: "Working"
|
|
4187
4188
|
};
|
|
4188
|
-
function
|
|
4189
|
-
if (
|
|
4190
|
-
|
|
4189
|
+
function resolveDocRefs(text, docNames) {
|
|
4190
|
+
if (!docNames) return text;
|
|
4191
|
+
return text.replace(/\{(doc-[^}]+)\}/g, (_match, id) => docNames[id] ?? id);
|
|
4192
|
+
}
|
|
4193
|
+
function resolveStepDocName(step, docNames) {
|
|
4194
|
+
if (!docNames) return void 0;
|
|
4195
|
+
const detail = step.detail;
|
|
4196
|
+
if (!detail || detail.length === 0) return void 0;
|
|
4197
|
+
for (const d2 of detail) {
|
|
4198
|
+
const id = d2.doc_ext_id ?? d2.document_ext_id;
|
|
4199
|
+
if (typeof id === "string") return docNames[id] ?? id;
|
|
4200
|
+
}
|
|
4201
|
+
return void 0;
|
|
4202
|
+
}
|
|
4203
|
+
function extractPageRange(step) {
|
|
4204
|
+
const detail = step.detail;
|
|
4205
|
+
if (!detail || detail.length === 0) return void 0;
|
|
4206
|
+
for (const d2 of detail) {
|
|
4207
|
+
const summary = typeof d2.summary === "string" ? d2.summary : void 0;
|
|
4208
|
+
if (!summary) continue;
|
|
4209
|
+
const match = summary.match(/\bpp?\.\s*(\d[\d.,\s–—-]*)/);
|
|
4210
|
+
if (!match) continue;
|
|
4211
|
+
const floored = match[1].replace(/\d+(?:\.\d+)?/g, (n2) => String(Math.floor(parseFloat(n2)))).replace(/(\d+)\s*[–—-]\s*\1(?!\d)/g, "$1");
|
|
4212
|
+
const items = [];
|
|
4213
|
+
for (const raw of floored.split(",")) {
|
|
4214
|
+
const item = raw.trim();
|
|
4215
|
+
if (item && !items.includes(item)) items.push(item);
|
|
4216
|
+
}
|
|
4217
|
+
if (items.length > 0) return `pp. ${items.join(", ")}`;
|
|
4218
|
+
}
|
|
4219
|
+
return void 0;
|
|
4220
|
+
}
|
|
4221
|
+
function formatAgentStepLabel(step, docNames) {
|
|
4222
|
+
if (step.step === "goal") {
|
|
4223
|
+
return step.label && step.label !== "Goal" ? step.label : "Thinking\u2026";
|
|
4224
|
+
}
|
|
4225
|
+
if (step.focus) return resolveDocRefs(step.focus, docNames);
|
|
4226
|
+
const docName = resolveStepDocName(step, docNames);
|
|
4227
|
+
const pages = docName ? extractPageRange(step) : void 0;
|
|
4228
|
+
const suffix = docName ? ` \u2014 ${docName}${pages ? ` \xB7 ${pages}` : ""}` : "";
|
|
4229
|
+
if (step.label) return `${step.label}${suffix}`;
|
|
4191
4230
|
const detail = step.detail;
|
|
4192
4231
|
if (step.step === "tool_progress" && detail && detail.length > 0) {
|
|
4193
4232
|
const label = detail[0].label || LIFECYCLE_LABELS_FALLBACK.tool_progress;
|
|
4233
|
+
if (suffix) return `${label}${suffix}`;
|
|
4194
4234
|
const message = detail[0].message;
|
|
4195
|
-
return message ? `${label}: ${message}` : label;
|
|
4235
|
+
return message ? `${label}: ${resolveDocRefs(message, docNames)}` : label;
|
|
4196
4236
|
}
|
|
4197
4237
|
if (step.step) {
|
|
4198
4238
|
return LIFECYCLE_LABELS_FALLBACK[step.step] || step.step;
|
|
4199
4239
|
}
|
|
4200
4240
|
if (detail && detail.length > 0) {
|
|
4201
|
-
if (detail[0].label) return detail[0].label
|
|
4241
|
+
if (detail[0].label) return `${detail[0].label}${suffix}`;
|
|
4202
4242
|
if (detail[0].tool) return detail[0].tool;
|
|
4203
4243
|
}
|
|
4204
4244
|
return "";
|
|
@@ -4312,6 +4352,11 @@ async function streamSSE(response, callbacks = {}) {
|
|
|
4312
4352
|
callbacks.onAgentStep?.(data);
|
|
4313
4353
|
if (data.t != null) callbacks.onElapsedTime?.(data.t);
|
|
4314
4354
|
},
|
|
4355
|
+
"arbi.agent_step_delta": (raw) => {
|
|
4356
|
+
const data = JSON.parse(raw);
|
|
4357
|
+
callbacks.onAgentStepDelta?.(data);
|
|
4358
|
+
if (data.t != null) callbacks.onElapsedTime?.(data.t);
|
|
4359
|
+
},
|
|
4315
4360
|
"arbi.user_message": (raw) => {
|
|
4316
4361
|
const data = JSON.parse(raw);
|
|
4317
4362
|
userMessage = data;
|
|
@@ -4337,16 +4382,21 @@ async function streamSSE(response, callbacks = {}) {
|
|
|
4337
4382
|
errors.push(message);
|
|
4338
4383
|
callbacks.onArbiError?.(data);
|
|
4339
4384
|
callbacks.onError?.(message);
|
|
4340
|
-
},
|
|
4341
|
-
"response.complete": () => {
|
|
4342
|
-
callbacks.onComplete?.();
|
|
4343
4385
|
}
|
|
4344
4386
|
};
|
|
4345
4387
|
const processEvents = (events) => {
|
|
4346
4388
|
for (const { event, data } of events) {
|
|
4347
4389
|
try {
|
|
4390
|
+
if (event === "reasoning") {
|
|
4391
|
+
callbacks.onReasoningDelta?.(data);
|
|
4392
|
+
continue;
|
|
4393
|
+
}
|
|
4348
4394
|
const handler = eventHandlers[event];
|
|
4349
|
-
if (handler)
|
|
4395
|
+
if (handler) {
|
|
4396
|
+
handler(data);
|
|
4397
|
+
} else {
|
|
4398
|
+
console.warn(`[arbi-sse] unhandled SSE event: ${event}`);
|
|
4399
|
+
}
|
|
4350
4400
|
} catch {
|
|
4351
4401
|
}
|
|
4352
4402
|
}
|