@arbidocs/sdk 0.3.79 → 0.3.81
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-CV7TVakj.d.cts} +33 -8
- package/dist/{browser-a0r4Y6dE.d.ts → browser-CV7TVakj.d.ts} +33 -8
- package/dist/browser.cjs +57 -6
- 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 +57 -6
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +57 -6
- 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 +57 -6
- 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.
|
|
@@ -2692,7 +2705,6 @@ declare class Arbi {
|
|
|
2692
2705
|
MEMORY_CREATION: boolean;
|
|
2693
2706
|
GOALS_ENABLED: boolean;
|
|
2694
2707
|
GOAL_MAX_OUTER_LOOPS: number;
|
|
2695
|
-
REVIEW_ENABLED: boolean;
|
|
2696
2708
|
PERSONA: string;
|
|
2697
2709
|
AGENT_MODEL_NAME: string;
|
|
2698
2710
|
AGENT_API_TYPE: "local" | "remote";
|
|
@@ -3355,9 +3367,11 @@ declare namespace tags {
|
|
|
3355
3367
|
}
|
|
3356
3368
|
|
|
3357
3369
|
/**
|
|
3358
|
-
* Conversation operations — list, threads, delete, share, title, messages.
|
|
3370
|
+
* Conversation operations — list, threads, delete, share, title, messages, import.
|
|
3359
3371
|
*/
|
|
3360
3372
|
|
|
3373
|
+
type ConversationImportResponse = components['schemas']['ConversationImportResponse'];
|
|
3374
|
+
|
|
3361
3375
|
declare function listConversations(arbi: ArbiClient): Promise<{
|
|
3362
3376
|
external_id: string;
|
|
3363
3377
|
title: string | null;
|
|
@@ -3369,6 +3383,16 @@ declare function listConversations(arbi: ArbiClient): Promise<{
|
|
|
3369
3383
|
message_count: number;
|
|
3370
3384
|
last_message_status?: string | null | undefined;
|
|
3371
3385
|
}[]>;
|
|
3386
|
+
/**
|
|
3387
|
+
* Import a conversation export into the active workspace.
|
|
3388
|
+
*
|
|
3389
|
+
* Accepts a ChatGPT data export (`conversations.json`), an OpenClaw session log, or a
|
|
3390
|
+
* Claude Code transcript (`.jsonl`); `source='auto'` lets the server detect the format.
|
|
3391
|
+
* Uses raw multipart fetch (the typed client can't express file uploads), mirroring
|
|
3392
|
+
* `files.uploadFile`. The active workspace + cipher are resolved server-side from the
|
|
3393
|
+
* session, so no extra header is needed.
|
|
3394
|
+
*/
|
|
3395
|
+
declare function importConversations(auth: AuthHeaders, fileData: Blob, fileName: string, source?: string): Promise<ConversationImportResponse>;
|
|
3372
3396
|
declare function getConversationThreads(arbi: ArbiClient, conversationId: string): Promise<{
|
|
3373
3397
|
conversation_ext_id: string;
|
|
3374
3398
|
threads: {
|
|
@@ -3655,15 +3679,17 @@ declare function deleteMessage(arbi: ArbiClient, messageId: string): Promise<{
|
|
|
3655
3679
|
detail: string;
|
|
3656
3680
|
}>;
|
|
3657
3681
|
|
|
3682
|
+
type conversations_ConversationImportResponse = ConversationImportResponse;
|
|
3658
3683
|
declare const conversations_deleteConversation: typeof deleteConversation;
|
|
3659
3684
|
declare const conversations_deleteMessage: typeof deleteMessage;
|
|
3660
3685
|
declare const conversations_getConversationThreads: typeof getConversationThreads;
|
|
3661
3686
|
declare const conversations_getMessage: typeof getMessage;
|
|
3687
|
+
declare const conversations_importConversations: typeof importConversations;
|
|
3662
3688
|
declare const conversations_listConversations: typeof listConversations;
|
|
3663
3689
|
declare const conversations_shareConversation: typeof shareConversation;
|
|
3664
3690
|
declare const conversations_updateConversationTitle: typeof updateConversationTitle;
|
|
3665
3691
|
declare namespace conversations {
|
|
3666
|
-
export { conversations_deleteConversation as deleteConversation, conversations_deleteMessage as deleteMessage, conversations_getConversationThreads as getConversationThreads, conversations_getMessage as getMessage, conversations_listConversations as listConversations, conversations_shareConversation as shareConversation, conversations_updateConversationTitle as updateConversationTitle };
|
|
3692
|
+
export { type conversations_ConversationImportResponse as ConversationImportResponse, conversations_deleteConversation as deleteConversation, conversations_deleteMessage as deleteMessage, conversations_getConversationThreads as getConversationThreads, conversations_getMessage as getMessage, conversations_importConversations as importConversations, conversations_listConversations as listConversations, conversations_shareConversation as shareConversation, conversations_updateConversationTitle as updateConversationTitle };
|
|
3667
3693
|
}
|
|
3668
3694
|
|
|
3669
3695
|
/**
|
|
@@ -4038,7 +4064,6 @@ declare function getConfig(arbi: ArbiClient, configId: string): Promise<{
|
|
|
4038
4064
|
MEMORY_CREATION: boolean;
|
|
4039
4065
|
GOALS_ENABLED: boolean;
|
|
4040
4066
|
GOAL_MAX_OUTER_LOOPS: number;
|
|
4041
|
-
REVIEW_ENABLED: boolean;
|
|
4042
4067
|
PERSONA: string;
|
|
4043
4068
|
AGENT_MODEL_NAME: string;
|
|
4044
4069
|
AGENT_API_TYPE: "local" | "remote";
|
|
@@ -4396,4 +4421,4 @@ declare namespace responses {
|
|
|
4396
4421
|
export { type responses_SubmitBackgroundQueryOptions as SubmitBackgroundQueryOptions, responses_extractResponseText as extractResponseText, responses_getResponse as getResponse, responses_submitBackgroundQuery as submitBackgroundQuery };
|
|
4397
4422
|
}
|
|
4398
4423
|
|
|
4399
|
-
export { type
|
|
4424
|
+
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.
|
|
@@ -2692,7 +2705,6 @@ declare class Arbi {
|
|
|
2692
2705
|
MEMORY_CREATION: boolean;
|
|
2693
2706
|
GOALS_ENABLED: boolean;
|
|
2694
2707
|
GOAL_MAX_OUTER_LOOPS: number;
|
|
2695
|
-
REVIEW_ENABLED: boolean;
|
|
2696
2708
|
PERSONA: string;
|
|
2697
2709
|
AGENT_MODEL_NAME: string;
|
|
2698
2710
|
AGENT_API_TYPE: "local" | "remote";
|
|
@@ -3355,9 +3367,11 @@ declare namespace tags {
|
|
|
3355
3367
|
}
|
|
3356
3368
|
|
|
3357
3369
|
/**
|
|
3358
|
-
* Conversation operations — list, threads, delete, share, title, messages.
|
|
3370
|
+
* Conversation operations — list, threads, delete, share, title, messages, import.
|
|
3359
3371
|
*/
|
|
3360
3372
|
|
|
3373
|
+
type ConversationImportResponse = components['schemas']['ConversationImportResponse'];
|
|
3374
|
+
|
|
3361
3375
|
declare function listConversations(arbi: ArbiClient): Promise<{
|
|
3362
3376
|
external_id: string;
|
|
3363
3377
|
title: string | null;
|
|
@@ -3369,6 +3383,16 @@ declare function listConversations(arbi: ArbiClient): Promise<{
|
|
|
3369
3383
|
message_count: number;
|
|
3370
3384
|
last_message_status?: string | null | undefined;
|
|
3371
3385
|
}[]>;
|
|
3386
|
+
/**
|
|
3387
|
+
* Import a conversation export into the active workspace.
|
|
3388
|
+
*
|
|
3389
|
+
* Accepts a ChatGPT data export (`conversations.json`), an OpenClaw session log, or a
|
|
3390
|
+
* Claude Code transcript (`.jsonl`); `source='auto'` lets the server detect the format.
|
|
3391
|
+
* Uses raw multipart fetch (the typed client can't express file uploads), mirroring
|
|
3392
|
+
* `files.uploadFile`. The active workspace + cipher are resolved server-side from the
|
|
3393
|
+
* session, so no extra header is needed.
|
|
3394
|
+
*/
|
|
3395
|
+
declare function importConversations(auth: AuthHeaders, fileData: Blob, fileName: string, source?: string): Promise<ConversationImportResponse>;
|
|
3372
3396
|
declare function getConversationThreads(arbi: ArbiClient, conversationId: string): Promise<{
|
|
3373
3397
|
conversation_ext_id: string;
|
|
3374
3398
|
threads: {
|
|
@@ -3655,15 +3679,17 @@ declare function deleteMessage(arbi: ArbiClient, messageId: string): Promise<{
|
|
|
3655
3679
|
detail: string;
|
|
3656
3680
|
}>;
|
|
3657
3681
|
|
|
3682
|
+
type conversations_ConversationImportResponse = ConversationImportResponse;
|
|
3658
3683
|
declare const conversations_deleteConversation: typeof deleteConversation;
|
|
3659
3684
|
declare const conversations_deleteMessage: typeof deleteMessage;
|
|
3660
3685
|
declare const conversations_getConversationThreads: typeof getConversationThreads;
|
|
3661
3686
|
declare const conversations_getMessage: typeof getMessage;
|
|
3687
|
+
declare const conversations_importConversations: typeof importConversations;
|
|
3662
3688
|
declare const conversations_listConversations: typeof listConversations;
|
|
3663
3689
|
declare const conversations_shareConversation: typeof shareConversation;
|
|
3664
3690
|
declare const conversations_updateConversationTitle: typeof updateConversationTitle;
|
|
3665
3691
|
declare namespace conversations {
|
|
3666
|
-
export { conversations_deleteConversation as deleteConversation, conversations_deleteMessage as deleteMessage, conversations_getConversationThreads as getConversationThreads, conversations_getMessage as getMessage, conversations_listConversations as listConversations, conversations_shareConversation as shareConversation, conversations_updateConversationTitle as updateConversationTitle };
|
|
3692
|
+
export { type conversations_ConversationImportResponse as ConversationImportResponse, conversations_deleteConversation as deleteConversation, conversations_deleteMessage as deleteMessage, conversations_getConversationThreads as getConversationThreads, conversations_getMessage as getMessage, conversations_importConversations as importConversations, conversations_listConversations as listConversations, conversations_shareConversation as shareConversation, conversations_updateConversationTitle as updateConversationTitle };
|
|
3667
3693
|
}
|
|
3668
3694
|
|
|
3669
3695
|
/**
|
|
@@ -4038,7 +4064,6 @@ declare function getConfig(arbi: ArbiClient, configId: string): Promise<{
|
|
|
4038
4064
|
MEMORY_CREATION: boolean;
|
|
4039
4065
|
GOALS_ENABLED: boolean;
|
|
4040
4066
|
GOAL_MAX_OUTER_LOOPS: number;
|
|
4041
|
-
REVIEW_ENABLED: boolean;
|
|
4042
4067
|
PERSONA: string;
|
|
4043
4068
|
AGENT_MODEL_NAME: string;
|
|
4044
4069
|
AGENT_API_TYPE: "local" | "remote";
|
|
@@ -4396,4 +4421,4 @@ declare namespace responses {
|
|
|
4396
4421
|
export { type responses_SubmitBackgroundQueryOptions as SubmitBackgroundQueryOptions, responses_extractResponseText as extractResponseText, responses_getResponse as getResponse, responses_submitBackgroundQuery as submitBackgroundQuery };
|
|
4397
4422
|
}
|
|
4398
4423
|
|
|
4399
|
-
export { type
|
|
4424
|
+
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,65 @@ 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
|
-
reviewing: "Reviewing answer",
|
|
3793
3793
|
planning: "Planning",
|
|
3794
3794
|
tool_progress: "Working"
|
|
3795
3795
|
};
|
|
3796
|
-
function
|
|
3797
|
-
if (
|
|
3798
|
-
|
|
3796
|
+
function resolveDocRefs(text, docNames) {
|
|
3797
|
+
if (!docNames) return text;
|
|
3798
|
+
return text.replace(/\{(doc-[^}]+)\}/g, (_match, id) => docNames[id] ?? id);
|
|
3799
|
+
}
|
|
3800
|
+
function resolveStepDocName(step, docNames) {
|
|
3801
|
+
if (!docNames) return void 0;
|
|
3802
|
+
const detail = step.detail;
|
|
3803
|
+
if (!detail || detail.length === 0) return void 0;
|
|
3804
|
+
for (const d2 of detail) {
|
|
3805
|
+
const id = d2.doc_ext_id ?? d2.document_ext_id;
|
|
3806
|
+
if (typeof id === "string") return docNames[id] ?? id;
|
|
3807
|
+
}
|
|
3808
|
+
return void 0;
|
|
3809
|
+
}
|
|
3810
|
+
function extractPageRange(step) {
|
|
3811
|
+
const detail = step.detail;
|
|
3812
|
+
if (!detail || detail.length === 0) return void 0;
|
|
3813
|
+
for (const d2 of detail) {
|
|
3814
|
+
const summary = typeof d2.summary === "string" ? d2.summary : void 0;
|
|
3815
|
+
if (!summary) continue;
|
|
3816
|
+
const match = summary.match(/\bpp?\.\s*(\d[\d.,\s–—-]*)/);
|
|
3817
|
+
if (!match) continue;
|
|
3818
|
+
const floored = match[1].replace(/\d+(?:\.\d+)?/g, (n2) => String(Math.floor(parseFloat(n2)))).replace(/(\d+)\s*[–—-]\s*\1(?!\d)/g, "$1");
|
|
3819
|
+
const items = [];
|
|
3820
|
+
for (const raw of floored.split(",")) {
|
|
3821
|
+
const item = raw.trim();
|
|
3822
|
+
if (item && !items.includes(item)) items.push(item);
|
|
3823
|
+
}
|
|
3824
|
+
if (items.length > 0) return `pp. ${items.join(", ")}`;
|
|
3825
|
+
}
|
|
3826
|
+
return void 0;
|
|
3827
|
+
}
|
|
3828
|
+
function formatAgentStepLabel(step, docNames) {
|
|
3829
|
+
if (step.step === "goal") {
|
|
3830
|
+
return step.label && step.label !== "Goal" ? step.label : "Thinking\u2026";
|
|
3831
|
+
}
|
|
3832
|
+
if (step.focus) return resolveDocRefs(step.focus, docNames);
|
|
3833
|
+
const docName = resolveStepDocName(step, docNames);
|
|
3834
|
+
const pages = docName ? extractPageRange(step) : void 0;
|
|
3835
|
+
const suffix = docName ? ` \u2014 ${docName}${pages ? ` \xB7 ${pages}` : ""}` : "";
|
|
3836
|
+
if (step.label) return `${step.label}${suffix}`;
|
|
3799
3837
|
const detail = step.detail;
|
|
3800
3838
|
if (step.step === "tool_progress" && detail && detail.length > 0) {
|
|
3801
3839
|
const label = detail[0].label || LIFECYCLE_LABELS_FALLBACK.tool_progress;
|
|
3840
|
+
if (suffix) return `${label}${suffix}`;
|
|
3802
3841
|
const message = detail[0].message;
|
|
3803
|
-
return message ? `${label}: ${message}` : label;
|
|
3842
|
+
return message ? `${label}: ${resolveDocRefs(message, docNames)}` : label;
|
|
3804
3843
|
}
|
|
3805
3844
|
if (step.step) {
|
|
3806
3845
|
return LIFECYCLE_LABELS_FALLBACK[step.step] || step.step;
|
|
3807
3846
|
}
|
|
3808
3847
|
if (detail && detail.length > 0) {
|
|
3809
|
-
if (detail[0].label) return detail[0].label
|
|
3848
|
+
if (detail[0].label) return `${detail[0].label}${suffix}`;
|
|
3810
3849
|
if (detail[0].tool) return detail[0].tool;
|
|
3811
3850
|
}
|
|
3812
3851
|
return "";
|
|
@@ -4655,6 +4694,7 @@ __export(conversations_exports, {
|
|
|
4655
4694
|
deleteMessage: () => deleteMessage,
|
|
4656
4695
|
getConversationThreads: () => getConversationThreads,
|
|
4657
4696
|
getMessage: () => getMessage,
|
|
4697
|
+
importConversations: () => importConversations,
|
|
4658
4698
|
listConversations: () => listConversations,
|
|
4659
4699
|
shareConversation: () => shareConversation,
|
|
4660
4700
|
updateConversationTitle: () => updateConversationTitle
|
|
@@ -4662,6 +4702,17 @@ __export(conversations_exports, {
|
|
|
4662
4702
|
async function listConversations(arbi) {
|
|
4663
4703
|
return requireData(await arbi.fetch.GET("/v1/conversation/list"), "Failed to fetch conversations");
|
|
4664
4704
|
}
|
|
4705
|
+
async function importConversations(auth, fileData, fileName, source = "auto") {
|
|
4706
|
+
const formData = new FormData();
|
|
4707
|
+
formData.append("file", fileData, fileName);
|
|
4708
|
+
const res = await authenticatedFetch({
|
|
4709
|
+
...auth,
|
|
4710
|
+
path: `/v1/conversation/import?source=${encodeURIComponent(source)}`,
|
|
4711
|
+
method: "POST",
|
|
4712
|
+
body: formData
|
|
4713
|
+
});
|
|
4714
|
+
return res.json();
|
|
4715
|
+
}
|
|
4665
4716
|
async function getConversationThreads(arbi, conversationId) {
|
|
4666
4717
|
return requireData(
|
|
4667
4718
|
await arbi.fetch.GET("/v1/conversation/{conversation_ext_id}/threads", {
|