@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
package/dist/index.cjs
CHANGED
|
@@ -4188,26 +4188,66 @@ async function resolveWorkspace(store, workspaceOpt) {
|
|
|
4188
4188
|
|
|
4189
4189
|
// src/sse.ts
|
|
4190
4190
|
var LIFECYCLE_LABELS_FALLBACK = {
|
|
4191
|
+
goal: "Thinking\u2026",
|
|
4191
4192
|
evaluation: "Evaluating results",
|
|
4192
4193
|
answering: "Answered",
|
|
4193
4194
|
reviewing: "Reviewing answer",
|
|
4194
4195
|
planning: "Planning",
|
|
4195
4196
|
tool_progress: "Working"
|
|
4196
4197
|
};
|
|
4197
|
-
function
|
|
4198
|
-
if (
|
|
4199
|
-
|
|
4198
|
+
function resolveDocRefs(text, docNames) {
|
|
4199
|
+
if (!docNames) return text;
|
|
4200
|
+
return text.replace(/\{(doc-[^}]+)\}/g, (_match, id) => docNames[id] ?? id);
|
|
4201
|
+
}
|
|
4202
|
+
function resolveStepDocName(step, docNames) {
|
|
4203
|
+
if (!docNames) return void 0;
|
|
4204
|
+
const detail = step.detail;
|
|
4205
|
+
if (!detail || detail.length === 0) return void 0;
|
|
4206
|
+
for (const d2 of detail) {
|
|
4207
|
+
const id = d2.doc_ext_id ?? d2.document_ext_id;
|
|
4208
|
+
if (typeof id === "string") return docNames[id] ?? id;
|
|
4209
|
+
}
|
|
4210
|
+
return void 0;
|
|
4211
|
+
}
|
|
4212
|
+
function extractPageRange(step) {
|
|
4213
|
+
const detail = step.detail;
|
|
4214
|
+
if (!detail || detail.length === 0) return void 0;
|
|
4215
|
+
for (const d2 of detail) {
|
|
4216
|
+
const summary = typeof d2.summary === "string" ? d2.summary : void 0;
|
|
4217
|
+
if (!summary) continue;
|
|
4218
|
+
const match = summary.match(/\bpp?\.\s*(\d[\d.,\s–—-]*)/);
|
|
4219
|
+
if (!match) continue;
|
|
4220
|
+
const floored = match[1].replace(/\d+(?:\.\d+)?/g, (n2) => String(Math.floor(parseFloat(n2)))).replace(/(\d+)\s*[–—-]\s*\1(?!\d)/g, "$1");
|
|
4221
|
+
const items = [];
|
|
4222
|
+
for (const raw of floored.split(",")) {
|
|
4223
|
+
const item = raw.trim();
|
|
4224
|
+
if (item && !items.includes(item)) items.push(item);
|
|
4225
|
+
}
|
|
4226
|
+
if (items.length > 0) return `pp. ${items.join(", ")}`;
|
|
4227
|
+
}
|
|
4228
|
+
return void 0;
|
|
4229
|
+
}
|
|
4230
|
+
function formatAgentStepLabel(step, docNames) {
|
|
4231
|
+
if (step.step === "goal") {
|
|
4232
|
+
return step.label && step.label !== "Goal" ? step.label : "Thinking\u2026";
|
|
4233
|
+
}
|
|
4234
|
+
if (step.focus) return resolveDocRefs(step.focus, docNames);
|
|
4235
|
+
const docName = resolveStepDocName(step, docNames);
|
|
4236
|
+
const pages = docName ? extractPageRange(step) : void 0;
|
|
4237
|
+
const suffix = docName ? ` \u2014 ${docName}${pages ? ` \xB7 ${pages}` : ""}` : "";
|
|
4238
|
+
if (step.label) return `${step.label}${suffix}`;
|
|
4200
4239
|
const detail = step.detail;
|
|
4201
4240
|
if (step.step === "tool_progress" && detail && detail.length > 0) {
|
|
4202
4241
|
const label = detail[0].label || LIFECYCLE_LABELS_FALLBACK.tool_progress;
|
|
4242
|
+
if (suffix) return `${label}${suffix}`;
|
|
4203
4243
|
const message = detail[0].message;
|
|
4204
|
-
return message ? `${label}: ${message}` : label;
|
|
4244
|
+
return message ? `${label}: ${resolveDocRefs(message, docNames)}` : label;
|
|
4205
4245
|
}
|
|
4206
4246
|
if (step.step) {
|
|
4207
4247
|
return LIFECYCLE_LABELS_FALLBACK[step.step] || step.step;
|
|
4208
4248
|
}
|
|
4209
4249
|
if (detail && detail.length > 0) {
|
|
4210
|
-
if (detail[0].label) return detail[0].label
|
|
4250
|
+
if (detail[0].label) return `${detail[0].label}${suffix}`;
|
|
4211
4251
|
if (detail[0].tool) return detail[0].tool;
|
|
4212
4252
|
}
|
|
4213
4253
|
return "";
|