@arbidocs/sdk 0.3.134 → 0.3.135
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-BSWvYcjS.d.cts → browser-k4I8Geez.d.cts} +26 -27
- package/dist/{browser-BSWvYcjS.d.ts → browser-k4I8Geez.d.ts} +26 -27
- package/dist/browser.cjs +24 -23
- 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 +24 -24
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +24 -23
- 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 +24 -24
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -4232,6 +4232,12 @@ function extractPageRange(step) {
|
|
|
4232
4232
|
}
|
|
4233
4233
|
return void 0;
|
|
4234
4234
|
}
|
|
4235
|
+
function formatItemLabel(item, docNames) {
|
|
4236
|
+
const arbi = item.arbi;
|
|
4237
|
+
if (arbi?.focus) return resolveDocRefs(arbi.focus, docNames);
|
|
4238
|
+
if (arbi?.label) return arbi.label;
|
|
4239
|
+
return item.name ?? "";
|
|
4240
|
+
}
|
|
4235
4241
|
function formatAgentStepLabel(step, docNames) {
|
|
4236
4242
|
if (step.step === "goal") {
|
|
4237
4243
|
return step.label && step.label !== "Goal" ? step.label : "Thinking\u2026";
|
|
@@ -4312,7 +4318,11 @@ async function streamSSE(response, callbacks = {}) {
|
|
|
4312
4318
|
const data = JSON.parse(raw);
|
|
4313
4319
|
if (data.delta) {
|
|
4314
4320
|
text += data.delta;
|
|
4315
|
-
callbacks.
|
|
4321
|
+
if (callbacks.onOutputTextDelta) {
|
|
4322
|
+
callbacks.onOutputTextDelta({ item_id: data.item_id ?? "", delta: data.delta });
|
|
4323
|
+
} else {
|
|
4324
|
+
callbacks.onToken?.(data.delta);
|
|
4325
|
+
}
|
|
4316
4326
|
}
|
|
4317
4327
|
},
|
|
4318
4328
|
"response.output_text.done": (raw) => {
|
|
@@ -4320,9 +4330,20 @@ async function streamSSE(response, callbacks = {}) {
|
|
|
4320
4330
|
text = data.text;
|
|
4321
4331
|
callbacks.onTextDone?.(data.text);
|
|
4322
4332
|
},
|
|
4333
|
+
"response.function_call_arguments.delta": (raw) => {
|
|
4334
|
+
const data = JSON.parse(raw);
|
|
4335
|
+
callbacks.onFunctionCallArgumentsDelta?.(data);
|
|
4336
|
+
},
|
|
4323
4337
|
"response.output_item.done": (raw) => {
|
|
4324
4338
|
const data = JSON.parse(raw);
|
|
4339
|
+
const item = data.item;
|
|
4340
|
+
if (item?.type === "function_call" || item?.type === "reasoning") {
|
|
4341
|
+
const label = formatItemLabel(item);
|
|
4342
|
+
if (label) agentSteps.push(label);
|
|
4343
|
+
if (item.type === "function_call") toolCallCount += 1;
|
|
4344
|
+
}
|
|
4325
4345
|
callbacks.onOutputItemDone?.(data);
|
|
4346
|
+
if (data.t != null) callbacks.onElapsedTime?.(data.t);
|
|
4326
4347
|
},
|
|
4327
4348
|
"response.completed": (raw) => {
|
|
4328
4349
|
const data = JSON.parse(raw);
|
|
@@ -4361,27 +4382,6 @@ async function streamSSE(response, callbacks = {}) {
|
|
|
4361
4382
|
}
|
|
4362
4383
|
callbacks.onMessageQueued?.(data);
|
|
4363
4384
|
},
|
|
4364
|
-
"arbi.agent_step": (raw) => {
|
|
4365
|
-
const data = JSON.parse(raw);
|
|
4366
|
-
const label = formatAgentStepLabel(data);
|
|
4367
|
-
if (label) agentSteps.push(label);
|
|
4368
|
-
const detail = data.detail;
|
|
4369
|
-
if (detail && Array.isArray(detail)) {
|
|
4370
|
-
toolCallCount += detail.filter((d2) => d2.tool).length;
|
|
4371
|
-
}
|
|
4372
|
-
callbacks.onAgentStep?.(data);
|
|
4373
|
-
if (data.t != null) callbacks.onElapsedTime?.(data.t);
|
|
4374
|
-
},
|
|
4375
|
-
"arbi.generating": (raw) => {
|
|
4376
|
-
const data = JSON.parse(raw);
|
|
4377
|
-
callbacks.onGenerating?.(data);
|
|
4378
|
-
if (data.t != null) callbacks.onElapsedTime?.(data.t);
|
|
4379
|
-
},
|
|
4380
|
-
"arbi.agent_step_delta": (raw) => {
|
|
4381
|
-
const data = JSON.parse(raw);
|
|
4382
|
-
callbacks.onAgentStepDelta?.(data);
|
|
4383
|
-
if (data.t != null) callbacks.onElapsedTime?.(data.t);
|
|
4384
|
-
},
|
|
4385
4385
|
"arbi.user_message": (raw) => {
|
|
4386
4386
|
const data = JSON.parse(raw);
|
|
4387
4387
|
userMessage = data;
|
|
@@ -6456,7 +6456,7 @@ var Arbi = class {
|
|
|
6456
6456
|
const callbacks = {
|
|
6457
6457
|
onToken: options.onToken,
|
|
6458
6458
|
onStreamStart: options.onStreamStart,
|
|
6459
|
-
|
|
6459
|
+
onOutputItemDone: options.onOutputItemDone,
|
|
6460
6460
|
onError: options.onError,
|
|
6461
6461
|
onUserMessage: options.onUserMessage,
|
|
6462
6462
|
onMetadata: options.onMetadata,
|
|
@@ -7824,6 +7824,7 @@ exports.files = files_exports;
|
|
|
7824
7824
|
exports.filterSkills = filterSkills;
|
|
7825
7825
|
exports.formatAgentStepLabel = formatAgentStepLabel;
|
|
7826
7826
|
exports.formatFileSize = formatFileSize;
|
|
7827
|
+
exports.formatItemLabel = formatItemLabel;
|
|
7827
7828
|
exports.formatStreamSummary = formatStreamSummary;
|
|
7828
7829
|
exports.formatUserName = formatUserName;
|
|
7829
7830
|
exports.formatWorkspaceChoices = formatWorkspaceChoices;
|