@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
package/dist/index.cjs
CHANGED
|
@@ -4188,26 +4188,65 @@ 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
|
-
reviewing: "Reviewing answer",
|
|
4194
4194
|
planning: "Planning",
|
|
4195
4195
|
tool_progress: "Working"
|
|
4196
4196
|
};
|
|
4197
|
-
function
|
|
4198
|
-
if (
|
|
4199
|
-
|
|
4197
|
+
function resolveDocRefs(text, docNames) {
|
|
4198
|
+
if (!docNames) return text;
|
|
4199
|
+
return text.replace(/\{(doc-[^}]+)\}/g, (_match, id) => docNames[id] ?? id);
|
|
4200
|
+
}
|
|
4201
|
+
function resolveStepDocName(step, docNames) {
|
|
4202
|
+
if (!docNames) return void 0;
|
|
4203
|
+
const detail = step.detail;
|
|
4204
|
+
if (!detail || detail.length === 0) return void 0;
|
|
4205
|
+
for (const d2 of detail) {
|
|
4206
|
+
const id = d2.doc_ext_id ?? d2.document_ext_id;
|
|
4207
|
+
if (typeof id === "string") return docNames[id] ?? id;
|
|
4208
|
+
}
|
|
4209
|
+
return void 0;
|
|
4210
|
+
}
|
|
4211
|
+
function extractPageRange(step) {
|
|
4212
|
+
const detail = step.detail;
|
|
4213
|
+
if (!detail || detail.length === 0) return void 0;
|
|
4214
|
+
for (const d2 of detail) {
|
|
4215
|
+
const summary = typeof d2.summary === "string" ? d2.summary : void 0;
|
|
4216
|
+
if (!summary) continue;
|
|
4217
|
+
const match = summary.match(/\bpp?\.\s*(\d[\d.,\s–—-]*)/);
|
|
4218
|
+
if (!match) continue;
|
|
4219
|
+
const floored = match[1].replace(/\d+(?:\.\d+)?/g, (n2) => String(Math.floor(parseFloat(n2)))).replace(/(\d+)\s*[–—-]\s*\1(?!\d)/g, "$1");
|
|
4220
|
+
const items = [];
|
|
4221
|
+
for (const raw of floored.split(",")) {
|
|
4222
|
+
const item = raw.trim();
|
|
4223
|
+
if (item && !items.includes(item)) items.push(item);
|
|
4224
|
+
}
|
|
4225
|
+
if (items.length > 0) return `pp. ${items.join(", ")}`;
|
|
4226
|
+
}
|
|
4227
|
+
return void 0;
|
|
4228
|
+
}
|
|
4229
|
+
function formatAgentStepLabel(step, docNames) {
|
|
4230
|
+
if (step.step === "goal") {
|
|
4231
|
+
return step.label && step.label !== "Goal" ? step.label : "Thinking\u2026";
|
|
4232
|
+
}
|
|
4233
|
+
if (step.focus) return resolveDocRefs(step.focus, docNames);
|
|
4234
|
+
const docName = resolveStepDocName(step, docNames);
|
|
4235
|
+
const pages = docName ? extractPageRange(step) : void 0;
|
|
4236
|
+
const suffix = docName ? ` \u2014 ${docName}${pages ? ` \xB7 ${pages}` : ""}` : "";
|
|
4237
|
+
if (step.label) return `${step.label}${suffix}`;
|
|
4200
4238
|
const detail = step.detail;
|
|
4201
4239
|
if (step.step === "tool_progress" && detail && detail.length > 0) {
|
|
4202
4240
|
const label = detail[0].label || LIFECYCLE_LABELS_FALLBACK.tool_progress;
|
|
4241
|
+
if (suffix) return `${label}${suffix}`;
|
|
4203
4242
|
const message = detail[0].message;
|
|
4204
|
-
return message ? `${label}: ${message}` : label;
|
|
4243
|
+
return message ? `${label}: ${resolveDocRefs(message, docNames)}` : label;
|
|
4205
4244
|
}
|
|
4206
4245
|
if (step.step) {
|
|
4207
4246
|
return LIFECYCLE_LABELS_FALLBACK[step.step] || step.step;
|
|
4208
4247
|
}
|
|
4209
4248
|
if (detail && detail.length > 0) {
|
|
4210
|
-
if (detail[0].label) return detail[0].label
|
|
4249
|
+
if (detail[0].label) return `${detail[0].label}${suffix}`;
|
|
4211
4250
|
if (detail[0].tool) return detail[0].tool;
|
|
4212
4251
|
}
|
|
4213
4252
|
return "";
|
|
@@ -5200,6 +5239,7 @@ __export(conversations_exports, {
|
|
|
5200
5239
|
deleteMessage: () => deleteMessage,
|
|
5201
5240
|
getConversationThreads: () => getConversationThreads,
|
|
5202
5241
|
getMessage: () => getMessage,
|
|
5242
|
+
importConversations: () => importConversations,
|
|
5203
5243
|
listConversations: () => listConversations,
|
|
5204
5244
|
shareConversation: () => shareConversation,
|
|
5205
5245
|
updateConversationTitle: () => updateConversationTitle
|
|
@@ -5207,6 +5247,17 @@ __export(conversations_exports, {
|
|
|
5207
5247
|
async function listConversations(arbi) {
|
|
5208
5248
|
return requireData(await arbi.fetch.GET("/v1/conversation/list"), "Failed to fetch conversations");
|
|
5209
5249
|
}
|
|
5250
|
+
async function importConversations(auth, fileData, fileName, source = "auto") {
|
|
5251
|
+
const formData = new FormData();
|
|
5252
|
+
formData.append("file", fileData, fileName);
|
|
5253
|
+
const res = await authenticatedFetch({
|
|
5254
|
+
...auth,
|
|
5255
|
+
path: `/v1/conversation/import?source=${encodeURIComponent(source)}`,
|
|
5256
|
+
method: "POST",
|
|
5257
|
+
body: formData
|
|
5258
|
+
});
|
|
5259
|
+
return res.json();
|
|
5260
|
+
}
|
|
5210
5261
|
async function getConversationThreads(arbi, conversationId) {
|
|
5211
5262
|
return requireData(
|
|
5212
5263
|
await arbi.fetch.GET("/v1/conversation/{conversation_ext_id}/threads", {
|