@arbidocs/sdk 0.3.79 → 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-a0r4Y6dE.d.cts → browser-DIO4_N2g.d.cts} +17 -4
- package/dist/{browser-a0r4Y6dE.d.ts → browser-DIO4_N2g.d.ts} +17 -4
- package/dist/browser.cjs +45 -5
- 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 +45 -5
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +45 -5
- 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 +45 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -333,21 +333,34 @@ interface SSEEvent {
|
|
|
333
333
|
event: string;
|
|
334
334
|
data: string;
|
|
335
335
|
}
|
|
336
|
+
/**
|
|
337
|
+
* A document-name lookup: `doc_ext_id` → human file name. Pass this to
|
|
338
|
+
* `formatAgentStepLabel` so steps that target a specific document
|
|
339
|
+
* ("Reading document", "Getting table of contents") render the real
|
|
340
|
+
* file name instead of an opaque `doc-xxxxxxxx` id. Callers build it
|
|
341
|
+
* from the workspace document list they already fetch before querying.
|
|
342
|
+
*/
|
|
343
|
+
type DocNameMap = Record<string, string>;
|
|
336
344
|
/**
|
|
337
345
|
* Format an AgentStepEvent into a human-readable label.
|
|
338
346
|
*
|
|
339
347
|
* Uses backend-provided `label` field when available, falling back to
|
|
340
|
-
* tool name or step name for old persisted events.
|
|
348
|
+
* tool name or step name for old persisted events. Pass `docNames` to
|
|
349
|
+
* resolve document-scoped steps to their file name.
|
|
341
350
|
*
|
|
342
351
|
* Priority:
|
|
343
352
|
* 1. `focus` — the agent's descriptive sentence about what it's doing
|
|
344
|
-
* 2. `label` — backend-provided display label
|
|
353
|
+
* 2. `label` — backend-provided display label (with doc name + pages
|
|
354
|
+
* appended when the step targets one document)
|
|
345
355
|
* 3. For `tool_progress` — detail label + optional message
|
|
346
356
|
* 4. Lifecycle fallback (planning, evaluation, etc.)
|
|
347
357
|
* 5. Tool name from detail
|
|
348
358
|
* 6. Fallback to step name or empty string
|
|
359
|
+
*
|
|
360
|
+
* The `goal` step's backend label is "Thinking…" (the bare "Goal" told
|
|
361
|
+
* a user nothing); the fallback map covers older events that omit it.
|
|
349
362
|
*/
|
|
350
|
-
declare function formatAgentStepLabel(step: AgentStepEvent): string;
|
|
363
|
+
declare function formatAgentStepLabel(step: AgentStepEvent, docNames?: DocNameMap): string;
|
|
351
364
|
/**
|
|
352
365
|
* Parse SSE events from a chunk of text, combining with a buffer
|
|
353
366
|
* of incomplete data from previous chunks.
|
|
@@ -4396,4 +4409,4 @@ declare namespace responses {
|
|
|
4396
4409
|
export { type responses_SubmitBackgroundQueryOptions as SubmitBackgroundQueryOptions, responses_extractResponseText as extractResponseText, responses_getResponse as getResponse, responses_submitBackgroundQuery as submitBackgroundQuery };
|
|
4397
4410
|
}
|
|
4398
4411
|
|
|
4399
|
-
export { type
|
|
4412
|
+
export { type UploadDirectOptions as $, type AgentStepDeltaEvent as A, type ResponseCompletedEvent as B, type ChatSession as C, DOC_TERMINAL_STATUSES as D, type ResponseContentPartAddedEvent as E, type FormattedWsMessage as F, type ResponseCreatedEvent as G, type ResponseFailedEvent as H, type ResponseOutputItemAddedEvent as I, type ResponseOutputItemDoneEvent as J, type ResponseOutputTextDeltaEvent as K, type ListAllOptions as L, type MessageLevel as M, type ResponseOutputTextDoneEvent as N, type OutputTokensDetails as O, type ParsedSlashCommand as P, type QueryOptions as Q, type ReconnectOptions as R, type ResponseUsage as S, type SSEEvent as T, type SSEStreamCallbacks as U, type SSEStreamResult as V, type SSEStreamStartData as W, SUPPORTED_EXTENSIONS as X, type SkillSummary as Y, type SkippedFile as Z, type UploadBatchResult as _, type AgentStepEvent as a, type UploadDirectResult as a0, type UploadOptions as a1, type UploadResult as a2, type UserInfo as a3, type UserInputRequestEvent as a4, type UserMessageEvent as a5, WebSocketAuthError as a6, type WorkspaceContext as a7, type WsConnection as a8, agentconfig as a9, getErrorCode as aA, getErrorMessage as aB, getRawWorkspaceKey as aC, health as aD, parseSSEEvents as aE, parseSlashCommand as aF, parseSlashTokenInProgress as aG, performPasswordLogin as aH, performSigningKeyLogin as aI, performSsoDeviceFlowLogin as aJ, requireData as aK, requireOk as aL, resolveAuth as aM, resolveCitations as aN, resolveWorkspace as aO, responses as aP, selectWorkspace as aQ, selectWorkspaceById as aR, settings as aS, streamSSE as aT, stripCitationMarkdown as aU, summarizeCitations as aV, tags as aW, workspaces as aX, assistant as aa, authenticatedFetch as ab, buildRetrievalChunkTool as ac, buildRetrievalFullContextTool as ad, buildRetrievalTocTool as ae, connectWebSocket as af, connectWithReconnect as ag, consumeSSEStream as ah, contacts as ai, conversations as aj, countCitations as ak, createAuthenticatedClient as al, createDocumentWaiter as am, dm as an, doctags as ao, documents as ap, files as aq, filterSkills as ar, formatAgentStepLabel as as, formatFileSize as at, formatStreamSummary as au, formatUserName as av, formatWorkspaceChoices as aw, formatWsMessage as ax, generateEncryptedWorkspaceKey as ay, generateNewWorkspaceKey as az, Arbi as b, ArbiApiError as c, ArbiError as d, type ArbiErrorEvent as e, type ArbiOptions as f, type ArtifactEvent as g, type AuthContext as h, type AuthHeaders as i, type AuthenticatedClient as j, type CitationSummary as k, type CliConfig as l, type CliCredentials as m, type ConfigStore as n, type ConnectOptions as o, type DmCryptoContext as p, type DocNameMap as q, type DocumentListFields as r, type DocumentListOrder as s, type DocumentWaiter as t, type DocumentWaiterOptions as u, type ListPaginatedOptions as v, type MessageMetadataPayload$1 as w, type MessageQueuedEvent as x, type ReconnectableWsConnection as y, type ResolvedCitation as z };
|
|
@@ -333,21 +333,34 @@ interface SSEEvent {
|
|
|
333
333
|
event: string;
|
|
334
334
|
data: string;
|
|
335
335
|
}
|
|
336
|
+
/**
|
|
337
|
+
* A document-name lookup: `doc_ext_id` → human file name. Pass this to
|
|
338
|
+
* `formatAgentStepLabel` so steps that target a specific document
|
|
339
|
+
* ("Reading document", "Getting table of contents") render the real
|
|
340
|
+
* file name instead of an opaque `doc-xxxxxxxx` id. Callers build it
|
|
341
|
+
* from the workspace document list they already fetch before querying.
|
|
342
|
+
*/
|
|
343
|
+
type DocNameMap = Record<string, string>;
|
|
336
344
|
/**
|
|
337
345
|
* Format an AgentStepEvent into a human-readable label.
|
|
338
346
|
*
|
|
339
347
|
* Uses backend-provided `label` field when available, falling back to
|
|
340
|
-
* tool name or step name for old persisted events.
|
|
348
|
+
* tool name or step name for old persisted events. Pass `docNames` to
|
|
349
|
+
* resolve document-scoped steps to their file name.
|
|
341
350
|
*
|
|
342
351
|
* Priority:
|
|
343
352
|
* 1. `focus` — the agent's descriptive sentence about what it's doing
|
|
344
|
-
* 2. `label` — backend-provided display label
|
|
353
|
+
* 2. `label` — backend-provided display label (with doc name + pages
|
|
354
|
+
* appended when the step targets one document)
|
|
345
355
|
* 3. For `tool_progress` — detail label + optional message
|
|
346
356
|
* 4. Lifecycle fallback (planning, evaluation, etc.)
|
|
347
357
|
* 5. Tool name from detail
|
|
348
358
|
* 6. Fallback to step name or empty string
|
|
359
|
+
*
|
|
360
|
+
* The `goal` step's backend label is "Thinking…" (the bare "Goal" told
|
|
361
|
+
* a user nothing); the fallback map covers older events that omit it.
|
|
349
362
|
*/
|
|
350
|
-
declare function formatAgentStepLabel(step: AgentStepEvent): string;
|
|
363
|
+
declare function formatAgentStepLabel(step: AgentStepEvent, docNames?: DocNameMap): string;
|
|
351
364
|
/**
|
|
352
365
|
* Parse SSE events from a chunk of text, combining with a buffer
|
|
353
366
|
* of incomplete data from previous chunks.
|
|
@@ -4396,4 +4409,4 @@ declare namespace responses {
|
|
|
4396
4409
|
export { type responses_SubmitBackgroundQueryOptions as SubmitBackgroundQueryOptions, responses_extractResponseText as extractResponseText, responses_getResponse as getResponse, responses_submitBackgroundQuery as submitBackgroundQuery };
|
|
4397
4410
|
}
|
|
4398
4411
|
|
|
4399
|
-
export { type
|
|
4412
|
+
export { type UploadDirectOptions as $, type AgentStepDeltaEvent as A, type ResponseCompletedEvent as B, type ChatSession as C, DOC_TERMINAL_STATUSES as D, type ResponseContentPartAddedEvent as E, type FormattedWsMessage as F, type ResponseCreatedEvent as G, type ResponseFailedEvent as H, type ResponseOutputItemAddedEvent as I, type ResponseOutputItemDoneEvent as J, type ResponseOutputTextDeltaEvent as K, type ListAllOptions as L, type MessageLevel as M, type ResponseOutputTextDoneEvent as N, type OutputTokensDetails as O, type ParsedSlashCommand as P, type QueryOptions as Q, type ReconnectOptions as R, type ResponseUsage as S, type SSEEvent as T, type SSEStreamCallbacks as U, type SSEStreamResult as V, type SSEStreamStartData as W, SUPPORTED_EXTENSIONS as X, type SkillSummary as Y, type SkippedFile as Z, type UploadBatchResult as _, type AgentStepEvent as a, type UploadDirectResult as a0, type UploadOptions as a1, type UploadResult as a2, type UserInfo as a3, type UserInputRequestEvent as a4, type UserMessageEvent as a5, WebSocketAuthError as a6, type WorkspaceContext as a7, type WsConnection as a8, agentconfig as a9, getErrorCode as aA, getErrorMessage as aB, getRawWorkspaceKey as aC, health as aD, parseSSEEvents as aE, parseSlashCommand as aF, parseSlashTokenInProgress as aG, performPasswordLogin as aH, performSigningKeyLogin as aI, performSsoDeviceFlowLogin as aJ, requireData as aK, requireOk as aL, resolveAuth as aM, resolveCitations as aN, resolveWorkspace as aO, responses as aP, selectWorkspace as aQ, selectWorkspaceById as aR, settings as aS, streamSSE as aT, stripCitationMarkdown as aU, summarizeCitations as aV, tags as aW, workspaces as aX, assistant as aa, authenticatedFetch as ab, buildRetrievalChunkTool as ac, buildRetrievalFullContextTool as ad, buildRetrievalTocTool as ae, connectWebSocket as af, connectWithReconnect as ag, consumeSSEStream as ah, contacts as ai, conversations as aj, countCitations as ak, createAuthenticatedClient as al, createDocumentWaiter as am, dm as an, doctags as ao, documents as ap, files as aq, filterSkills as ar, formatAgentStepLabel as as, formatFileSize as at, formatStreamSummary as au, formatUserName as av, formatWorkspaceChoices as aw, formatWsMessage as ax, generateEncryptedWorkspaceKey as ay, generateNewWorkspaceKey as az, Arbi as b, ArbiApiError as c, ArbiError as d, type ArbiErrorEvent as e, type ArbiOptions as f, type ArtifactEvent as g, type AuthContext as h, type AuthHeaders as i, type AuthenticatedClient as j, type CitationSummary as k, type CliConfig as l, type CliCredentials as m, type ConfigStore as n, type ConnectOptions as o, type DmCryptoContext as p, type DocNameMap as q, type DocumentListFields as r, type DocumentListOrder as s, type DocumentWaiter as t, type DocumentWaiterOptions as u, type ListPaginatedOptions as v, type MessageMetadataPayload$1 as w, type MessageQueuedEvent as x, type ReconnectableWsConnection as y, type ResolvedCitation as z };
|
package/dist/browser.cjs
CHANGED
|
@@ -3787,26 +3787,66 @@ async function resolveWorkspace(store, workspaceOpt) {
|
|
|
3787
3787
|
|
|
3788
3788
|
// src/sse.ts
|
|
3789
3789
|
var LIFECYCLE_LABELS_FALLBACK = {
|
|
3790
|
+
goal: "Thinking\u2026",
|
|
3790
3791
|
evaluation: "Evaluating results",
|
|
3791
3792
|
answering: "Answered",
|
|
3792
3793
|
reviewing: "Reviewing answer",
|
|
3793
3794
|
planning: "Planning",
|
|
3794
3795
|
tool_progress: "Working"
|
|
3795
3796
|
};
|
|
3796
|
-
function
|
|
3797
|
-
if (
|
|
3798
|
-
|
|
3797
|
+
function resolveDocRefs(text, docNames) {
|
|
3798
|
+
if (!docNames) return text;
|
|
3799
|
+
return text.replace(/\{(doc-[^}]+)\}/g, (_match, id) => docNames[id] ?? id);
|
|
3800
|
+
}
|
|
3801
|
+
function resolveStepDocName(step, docNames) {
|
|
3802
|
+
if (!docNames) return void 0;
|
|
3803
|
+
const detail = step.detail;
|
|
3804
|
+
if (!detail || detail.length === 0) return void 0;
|
|
3805
|
+
for (const d2 of detail) {
|
|
3806
|
+
const id = d2.doc_ext_id ?? d2.document_ext_id;
|
|
3807
|
+
if (typeof id === "string") return docNames[id] ?? id;
|
|
3808
|
+
}
|
|
3809
|
+
return void 0;
|
|
3810
|
+
}
|
|
3811
|
+
function extractPageRange(step) {
|
|
3812
|
+
const detail = step.detail;
|
|
3813
|
+
if (!detail || detail.length === 0) return void 0;
|
|
3814
|
+
for (const d2 of detail) {
|
|
3815
|
+
const summary = typeof d2.summary === "string" ? d2.summary : void 0;
|
|
3816
|
+
if (!summary) continue;
|
|
3817
|
+
const match = summary.match(/\bpp?\.\s*(\d[\d.,\s–—-]*)/);
|
|
3818
|
+
if (!match) continue;
|
|
3819
|
+
const floored = match[1].replace(/\d+(?:\.\d+)?/g, (n2) => String(Math.floor(parseFloat(n2)))).replace(/(\d+)\s*[–—-]\s*\1(?!\d)/g, "$1");
|
|
3820
|
+
const items = [];
|
|
3821
|
+
for (const raw of floored.split(",")) {
|
|
3822
|
+
const item = raw.trim();
|
|
3823
|
+
if (item && !items.includes(item)) items.push(item);
|
|
3824
|
+
}
|
|
3825
|
+
if (items.length > 0) return `pp. ${items.join(", ")}`;
|
|
3826
|
+
}
|
|
3827
|
+
return void 0;
|
|
3828
|
+
}
|
|
3829
|
+
function formatAgentStepLabel(step, docNames) {
|
|
3830
|
+
if (step.step === "goal") {
|
|
3831
|
+
return step.label && step.label !== "Goal" ? step.label : "Thinking\u2026";
|
|
3832
|
+
}
|
|
3833
|
+
if (step.focus) return resolveDocRefs(step.focus, docNames);
|
|
3834
|
+
const docName = resolveStepDocName(step, docNames);
|
|
3835
|
+
const pages = docName ? extractPageRange(step) : void 0;
|
|
3836
|
+
const suffix = docName ? ` \u2014 ${docName}${pages ? ` \xB7 ${pages}` : ""}` : "";
|
|
3837
|
+
if (step.label) return `${step.label}${suffix}`;
|
|
3799
3838
|
const detail = step.detail;
|
|
3800
3839
|
if (step.step === "tool_progress" && detail && detail.length > 0) {
|
|
3801
3840
|
const label = detail[0].label || LIFECYCLE_LABELS_FALLBACK.tool_progress;
|
|
3841
|
+
if (suffix) return `${label}${suffix}`;
|
|
3802
3842
|
const message = detail[0].message;
|
|
3803
|
-
return message ? `${label}: ${message}` : label;
|
|
3843
|
+
return message ? `${label}: ${resolveDocRefs(message, docNames)}` : label;
|
|
3804
3844
|
}
|
|
3805
3845
|
if (step.step) {
|
|
3806
3846
|
return LIFECYCLE_LABELS_FALLBACK[step.step] || step.step;
|
|
3807
3847
|
}
|
|
3808
3848
|
if (detail && detail.length > 0) {
|
|
3809
|
-
if (detail[0].label) return detail[0].label
|
|
3849
|
+
if (detail[0].label) return `${detail[0].label}${suffix}`;
|
|
3810
3850
|
if (detail[0].tool) return detail[0].tool;
|
|
3811
3851
|
}
|
|
3812
3852
|
return "";
|