@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
|
@@ -308,11 +308,13 @@ type ResponseOutputItemAddedEvent = components['schemas']['ResponseOutputItemAdd
|
|
|
308
308
|
type ResponseOutputItemDoneEvent = components['schemas']['ResponseOutputItemDoneEvent'];
|
|
309
309
|
type ResponseContentPartAddedEvent = components['schemas']['ResponseContentPartAddedEvent'];
|
|
310
310
|
type AgentStepEvent = components['schemas']['AgentStepEvent'];
|
|
311
|
+
type AgentStepDeltaEvent = components['schemas']['AgentStepDeltaEvent'];
|
|
311
312
|
type UserInputRequestEvent = components['schemas']['UserInputRequestEvent'];
|
|
312
313
|
type ArtifactEvent = components['schemas']['ArtifactEvent'];
|
|
313
314
|
type UserMessageEvent = components['schemas']['UserMessageEvent'];
|
|
314
315
|
type MessageQueuedEvent = components['schemas']['MessageQueuedEvent'];
|
|
315
316
|
type MessageMetadataPayload$1 = components['schemas']['MessageMetadataPayload'];
|
|
317
|
+
type ArbiErrorEvent = components['schemas']['ArbiErrorEvent'];
|
|
316
318
|
type ResponseUsage = components['schemas']['ResponseUsage'];
|
|
317
319
|
type OutputTokensDetails = components['schemas']['OutputTokensDetails'];
|
|
318
320
|
type TokenBudgetContext = components['schemas']['TokenBudgetContext'];
|
|
@@ -331,21 +333,34 @@ interface SSEEvent {
|
|
|
331
333
|
event: string;
|
|
332
334
|
data: string;
|
|
333
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>;
|
|
334
344
|
/**
|
|
335
345
|
* Format an AgentStepEvent into a human-readable label.
|
|
336
346
|
*
|
|
337
347
|
* Uses backend-provided `label` field when available, falling back to
|
|
338
|
-
* 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.
|
|
339
350
|
*
|
|
340
351
|
* Priority:
|
|
341
352
|
* 1. `focus` — the agent's descriptive sentence about what it's doing
|
|
342
|
-
* 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)
|
|
343
355
|
* 3. For `tool_progress` — detail label + optional message
|
|
344
356
|
* 4. Lifecycle fallback (planning, evaluation, etc.)
|
|
345
357
|
* 5. Tool name from detail
|
|
346
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.
|
|
347
362
|
*/
|
|
348
|
-
declare function formatAgentStepLabel(step: AgentStepEvent): string;
|
|
363
|
+
declare function formatAgentStepLabel(step: AgentStepEvent, docNames?: DocNameMap): string;
|
|
349
364
|
/**
|
|
350
365
|
* Parse SSE events from a chunk of text, combining with a buffer
|
|
351
366
|
* of incomplete data from previous chunks.
|
|
@@ -360,26 +375,18 @@ declare function parseSSEEvents(chunk: string, buffer: string): {
|
|
|
360
375
|
* Callbacks for streaming SSE events. All callbacks are optional —
|
|
361
376
|
* omitted callbacks simply ignore that event type.
|
|
362
377
|
*/
|
|
363
|
-
/** Structured ARBI error event (e.g. quota exceeded mid-stream). */
|
|
364
|
-
interface ArbiErrorEvent {
|
|
365
|
-
code: string;
|
|
366
|
-
message: string;
|
|
367
|
-
/** Present for QUOTA_EXCEEDED — current spend in USD. */
|
|
368
|
-
spend?: number;
|
|
369
|
-
/** Present for QUOTA_EXCEEDED — budget cap in USD. */
|
|
370
|
-
budget?: number;
|
|
371
|
-
/** Present for QUOTA_EXCEEDED — affected project external id. */
|
|
372
|
-
project_ext_id?: string | null;
|
|
373
|
-
[key: string]: unknown;
|
|
374
|
-
}
|
|
375
378
|
interface SSEStreamCallbacks {
|
|
376
379
|
onStreamStart?: (data: SSEStreamStartData) => void;
|
|
377
380
|
onToken?: (content: string) => void;
|
|
381
|
+
/** Live reasoning/thinking-token deltas (raw channel). Usually surfaced only in message details. */
|
|
382
|
+
onReasoningDelta?: (delta: string) => void;
|
|
378
383
|
onTextDone?: (text: string) => void;
|
|
379
384
|
onOutputItemAdded?: (data: ResponseOutputItemAddedEvent) => void;
|
|
380
385
|
onOutputItemDone?: (data: ResponseOutputItemDoneEvent) => void;
|
|
381
386
|
onContentPartAdded?: (data: ResponseContentPartAddedEvent) => void;
|
|
382
387
|
onAgentStep?: (data: AgentStepEvent) => void;
|
|
388
|
+
/** Live narration delta — append `delta` to the focus of the step with the matching `index`. */
|
|
389
|
+
onAgentStepDelta?: (data: AgentStepDeltaEvent) => void;
|
|
383
390
|
onError?: (message: string) => void;
|
|
384
391
|
/**
|
|
385
392
|
* Fired when the server emits a structured `arbi.error` event mid-stream.
|
|
@@ -2687,6 +2694,7 @@ declare class Arbi {
|
|
|
2687
2694
|
} | undefined;
|
|
2688
2695
|
MCP_TOOLS: string[];
|
|
2689
2696
|
PLANNING_ENABLED: boolean;
|
|
2697
|
+
DEEP_RESEARCH_ENABLED: boolean;
|
|
2690
2698
|
SUGGESTED_QUERIES: boolean;
|
|
2691
2699
|
ARTIFACTS_ENABLED: boolean;
|
|
2692
2700
|
VISION_ENABLED: boolean;
|
|
@@ -2696,8 +2704,6 @@ declare class Arbi {
|
|
|
2696
2704
|
SKILL_CREATION: boolean;
|
|
2697
2705
|
MEMORY_CREATION: boolean;
|
|
2698
2706
|
GOALS_ENABLED: boolean;
|
|
2699
|
-
GOAL_LOOP: boolean;
|
|
2700
|
-
GOAL_TEXT: string;
|
|
2701
2707
|
GOAL_MAX_OUTER_LOOPS: number;
|
|
2702
2708
|
REVIEW_ENABLED: boolean;
|
|
2703
2709
|
PERSONA: string;
|
|
@@ -4034,6 +4040,7 @@ declare function getConfig(arbi: ArbiClient, configId: string): Promise<{
|
|
|
4034
4040
|
} | undefined;
|
|
4035
4041
|
MCP_TOOLS: string[];
|
|
4036
4042
|
PLANNING_ENABLED: boolean;
|
|
4043
|
+
DEEP_RESEARCH_ENABLED: boolean;
|
|
4037
4044
|
SUGGESTED_QUERIES: boolean;
|
|
4038
4045
|
ARTIFACTS_ENABLED: boolean;
|
|
4039
4046
|
VISION_ENABLED: boolean;
|
|
@@ -4043,8 +4050,6 @@ declare function getConfig(arbi: ArbiClient, configId: string): Promise<{
|
|
|
4043
4050
|
SKILL_CREATION: boolean;
|
|
4044
4051
|
MEMORY_CREATION: boolean;
|
|
4045
4052
|
GOALS_ENABLED: boolean;
|
|
4046
|
-
GOAL_LOOP: boolean;
|
|
4047
|
-
GOAL_TEXT: string;
|
|
4048
4053
|
GOAL_MAX_OUTER_LOOPS: number;
|
|
4049
4054
|
REVIEW_ENABLED: boolean;
|
|
4050
4055
|
PERSONA: string;
|
|
@@ -4404,4 +4409,4 @@ declare namespace responses {
|
|
|
4404
4409
|
export { type responses_SubmitBackgroundQueryOptions as SubmitBackgroundQueryOptions, responses_extractResponseText as extractResponseText, responses_getResponse as getResponse, responses_submitBackgroundQuery as submitBackgroundQuery };
|
|
4405
4410
|
}
|
|
4406
4411
|
|
|
4407
|
-
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 };
|
|
@@ -308,11 +308,13 @@ type ResponseOutputItemAddedEvent = components['schemas']['ResponseOutputItemAdd
|
|
|
308
308
|
type ResponseOutputItemDoneEvent = components['schemas']['ResponseOutputItemDoneEvent'];
|
|
309
309
|
type ResponseContentPartAddedEvent = components['schemas']['ResponseContentPartAddedEvent'];
|
|
310
310
|
type AgentStepEvent = components['schemas']['AgentStepEvent'];
|
|
311
|
+
type AgentStepDeltaEvent = components['schemas']['AgentStepDeltaEvent'];
|
|
311
312
|
type UserInputRequestEvent = components['schemas']['UserInputRequestEvent'];
|
|
312
313
|
type ArtifactEvent = components['schemas']['ArtifactEvent'];
|
|
313
314
|
type UserMessageEvent = components['schemas']['UserMessageEvent'];
|
|
314
315
|
type MessageQueuedEvent = components['schemas']['MessageQueuedEvent'];
|
|
315
316
|
type MessageMetadataPayload$1 = components['schemas']['MessageMetadataPayload'];
|
|
317
|
+
type ArbiErrorEvent = components['schemas']['ArbiErrorEvent'];
|
|
316
318
|
type ResponseUsage = components['schemas']['ResponseUsage'];
|
|
317
319
|
type OutputTokensDetails = components['schemas']['OutputTokensDetails'];
|
|
318
320
|
type TokenBudgetContext = components['schemas']['TokenBudgetContext'];
|
|
@@ -331,21 +333,34 @@ interface SSEEvent {
|
|
|
331
333
|
event: string;
|
|
332
334
|
data: string;
|
|
333
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>;
|
|
334
344
|
/**
|
|
335
345
|
* Format an AgentStepEvent into a human-readable label.
|
|
336
346
|
*
|
|
337
347
|
* Uses backend-provided `label` field when available, falling back to
|
|
338
|
-
* 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.
|
|
339
350
|
*
|
|
340
351
|
* Priority:
|
|
341
352
|
* 1. `focus` — the agent's descriptive sentence about what it's doing
|
|
342
|
-
* 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)
|
|
343
355
|
* 3. For `tool_progress` — detail label + optional message
|
|
344
356
|
* 4. Lifecycle fallback (planning, evaluation, etc.)
|
|
345
357
|
* 5. Tool name from detail
|
|
346
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.
|
|
347
362
|
*/
|
|
348
|
-
declare function formatAgentStepLabel(step: AgentStepEvent): string;
|
|
363
|
+
declare function formatAgentStepLabel(step: AgentStepEvent, docNames?: DocNameMap): string;
|
|
349
364
|
/**
|
|
350
365
|
* Parse SSE events from a chunk of text, combining with a buffer
|
|
351
366
|
* of incomplete data from previous chunks.
|
|
@@ -360,26 +375,18 @@ declare function parseSSEEvents(chunk: string, buffer: string): {
|
|
|
360
375
|
* Callbacks for streaming SSE events. All callbacks are optional —
|
|
361
376
|
* omitted callbacks simply ignore that event type.
|
|
362
377
|
*/
|
|
363
|
-
/** Structured ARBI error event (e.g. quota exceeded mid-stream). */
|
|
364
|
-
interface ArbiErrorEvent {
|
|
365
|
-
code: string;
|
|
366
|
-
message: string;
|
|
367
|
-
/** Present for QUOTA_EXCEEDED — current spend in USD. */
|
|
368
|
-
spend?: number;
|
|
369
|
-
/** Present for QUOTA_EXCEEDED — budget cap in USD. */
|
|
370
|
-
budget?: number;
|
|
371
|
-
/** Present for QUOTA_EXCEEDED — affected project external id. */
|
|
372
|
-
project_ext_id?: string | null;
|
|
373
|
-
[key: string]: unknown;
|
|
374
|
-
}
|
|
375
378
|
interface SSEStreamCallbacks {
|
|
376
379
|
onStreamStart?: (data: SSEStreamStartData) => void;
|
|
377
380
|
onToken?: (content: string) => void;
|
|
381
|
+
/** Live reasoning/thinking-token deltas (raw channel). Usually surfaced only in message details. */
|
|
382
|
+
onReasoningDelta?: (delta: string) => void;
|
|
378
383
|
onTextDone?: (text: string) => void;
|
|
379
384
|
onOutputItemAdded?: (data: ResponseOutputItemAddedEvent) => void;
|
|
380
385
|
onOutputItemDone?: (data: ResponseOutputItemDoneEvent) => void;
|
|
381
386
|
onContentPartAdded?: (data: ResponseContentPartAddedEvent) => void;
|
|
382
387
|
onAgentStep?: (data: AgentStepEvent) => void;
|
|
388
|
+
/** Live narration delta — append `delta` to the focus of the step with the matching `index`. */
|
|
389
|
+
onAgentStepDelta?: (data: AgentStepDeltaEvent) => void;
|
|
383
390
|
onError?: (message: string) => void;
|
|
384
391
|
/**
|
|
385
392
|
* Fired when the server emits a structured `arbi.error` event mid-stream.
|
|
@@ -2687,6 +2694,7 @@ declare class Arbi {
|
|
|
2687
2694
|
} | undefined;
|
|
2688
2695
|
MCP_TOOLS: string[];
|
|
2689
2696
|
PLANNING_ENABLED: boolean;
|
|
2697
|
+
DEEP_RESEARCH_ENABLED: boolean;
|
|
2690
2698
|
SUGGESTED_QUERIES: boolean;
|
|
2691
2699
|
ARTIFACTS_ENABLED: boolean;
|
|
2692
2700
|
VISION_ENABLED: boolean;
|
|
@@ -2696,8 +2704,6 @@ declare class Arbi {
|
|
|
2696
2704
|
SKILL_CREATION: boolean;
|
|
2697
2705
|
MEMORY_CREATION: boolean;
|
|
2698
2706
|
GOALS_ENABLED: boolean;
|
|
2699
|
-
GOAL_LOOP: boolean;
|
|
2700
|
-
GOAL_TEXT: string;
|
|
2701
2707
|
GOAL_MAX_OUTER_LOOPS: number;
|
|
2702
2708
|
REVIEW_ENABLED: boolean;
|
|
2703
2709
|
PERSONA: string;
|
|
@@ -4034,6 +4040,7 @@ declare function getConfig(arbi: ArbiClient, configId: string): Promise<{
|
|
|
4034
4040
|
} | undefined;
|
|
4035
4041
|
MCP_TOOLS: string[];
|
|
4036
4042
|
PLANNING_ENABLED: boolean;
|
|
4043
|
+
DEEP_RESEARCH_ENABLED: boolean;
|
|
4037
4044
|
SUGGESTED_QUERIES: boolean;
|
|
4038
4045
|
ARTIFACTS_ENABLED: boolean;
|
|
4039
4046
|
VISION_ENABLED: boolean;
|
|
@@ -4043,8 +4050,6 @@ declare function getConfig(arbi: ArbiClient, configId: string): Promise<{
|
|
|
4043
4050
|
SKILL_CREATION: boolean;
|
|
4044
4051
|
MEMORY_CREATION: boolean;
|
|
4045
4052
|
GOALS_ENABLED: boolean;
|
|
4046
|
-
GOAL_LOOP: boolean;
|
|
4047
|
-
GOAL_TEXT: string;
|
|
4048
4053
|
GOAL_MAX_OUTER_LOOPS: number;
|
|
4049
4054
|
REVIEW_ENABLED: boolean;
|
|
4050
4055
|
PERSONA: string;
|
|
@@ -4404,4 +4409,4 @@ declare namespace responses {
|
|
|
4404
4409
|
export { type responses_SubmitBackgroundQueryOptions as SubmitBackgroundQueryOptions, responses_extractResponseText as extractResponseText, responses_getResponse as getResponse, responses_submitBackgroundQuery as submitBackgroundQuery };
|
|
4405
4410
|
}
|
|
4406
4411
|
|
|
4407
|
-
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
|
-
answering: "
|
|
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 "";
|
|
@@ -3920,6 +3960,11 @@ async function streamSSE(response, callbacks = {}) {
|
|
|
3920
3960
|
callbacks.onAgentStep?.(data);
|
|
3921
3961
|
if (data.t != null) callbacks.onElapsedTime?.(data.t);
|
|
3922
3962
|
},
|
|
3963
|
+
"arbi.agent_step_delta": (raw) => {
|
|
3964
|
+
const data = JSON.parse(raw);
|
|
3965
|
+
callbacks.onAgentStepDelta?.(data);
|
|
3966
|
+
if (data.t != null) callbacks.onElapsedTime?.(data.t);
|
|
3967
|
+
},
|
|
3923
3968
|
"arbi.user_message": (raw) => {
|
|
3924
3969
|
const data = JSON.parse(raw);
|
|
3925
3970
|
userMessage = data;
|
|
@@ -3945,16 +3990,21 @@ async function streamSSE(response, callbacks = {}) {
|
|
|
3945
3990
|
errors.push(message);
|
|
3946
3991
|
callbacks.onArbiError?.(data);
|
|
3947
3992
|
callbacks.onError?.(message);
|
|
3948
|
-
},
|
|
3949
|
-
"response.complete": () => {
|
|
3950
|
-
callbacks.onComplete?.();
|
|
3951
3993
|
}
|
|
3952
3994
|
};
|
|
3953
3995
|
const processEvents = (events) => {
|
|
3954
3996
|
for (const { event, data } of events) {
|
|
3955
3997
|
try {
|
|
3998
|
+
if (event === "reasoning") {
|
|
3999
|
+
callbacks.onReasoningDelta?.(data);
|
|
4000
|
+
continue;
|
|
4001
|
+
}
|
|
3956
4002
|
const handler = eventHandlers[event];
|
|
3957
|
-
if (handler)
|
|
4003
|
+
if (handler) {
|
|
4004
|
+
handler(data);
|
|
4005
|
+
} else {
|
|
4006
|
+
console.warn(`[arbi-sse] unhandled SSE event: ${event}`);
|
|
4007
|
+
}
|
|
3958
4008
|
} catch {
|
|
3959
4009
|
}
|
|
3960
4010
|
}
|