@arbidocs/sdk 0.3.131 → 0.3.133
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-B1XvwSa9.d.cts → browser-BSWvYcjS.d.cts} +8 -0
- package/dist/{browser-B1XvwSa9.d.ts → browser-BSWvYcjS.d.ts} +8 -0
- package/dist/browser.cjs +17 -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 +17 -10
- package/dist/browser.js.map +1 -1
- package/dist/index.cjs +17 -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 +17 -10
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -309,6 +309,7 @@ type ResponseOutputItemDoneEvent = components['schemas']['ResponseOutputItemDone
|
|
|
309
309
|
type ResponseContentPartAddedEvent = components['schemas']['ResponseContentPartAddedEvent'];
|
|
310
310
|
type AgentStepEvent = components['schemas']['AgentStepEvent'];
|
|
311
311
|
type AgentStepDeltaEvent = components['schemas']['AgentStepDeltaEvent'];
|
|
312
|
+
type GeneratingEvent = components['schemas']['GeneratingEvent'];
|
|
312
313
|
type UserInputRequestEvent = components['schemas']['UserInputRequestEvent'];
|
|
313
314
|
type ProbeAnswerEvent = components['schemas']['ProbeAnswerEvent'];
|
|
314
315
|
type DeferredInterjectionEvent = components['schemas']['DeferredInterjectionEvent'];
|
|
@@ -404,6 +405,13 @@ interface SSEStreamCallbacks {
|
|
|
404
405
|
onAgentStep?: (data: AgentStepEvent) => void;
|
|
405
406
|
/** Live narration delta — append `delta` to the focus of the step with the matching `index`. */
|
|
406
407
|
onAgentStepDelta?: (data: AgentStepDeltaEvent) => void;
|
|
408
|
+
/**
|
|
409
|
+
* The model has started generating free text. Open the token channel here.
|
|
410
|
+
* It does NOT mean the text is the answer — a preamble before a tool call
|
|
411
|
+
* looks identical at this point. Only the absence of a tool call proves it
|
|
412
|
+
* was the answer, which is not known until the turn resolves.
|
|
413
|
+
*/
|
|
414
|
+
onGenerating?: (data: GeneratingEvent) => void;
|
|
407
415
|
onError?: (message: string) => void;
|
|
408
416
|
/**
|
|
409
417
|
* Fired when the server emits a structured `arbi.error` event mid-stream.
|
|
@@ -309,6 +309,7 @@ type ResponseOutputItemDoneEvent = components['schemas']['ResponseOutputItemDone
|
|
|
309
309
|
type ResponseContentPartAddedEvent = components['schemas']['ResponseContentPartAddedEvent'];
|
|
310
310
|
type AgentStepEvent = components['schemas']['AgentStepEvent'];
|
|
311
311
|
type AgentStepDeltaEvent = components['schemas']['AgentStepDeltaEvent'];
|
|
312
|
+
type GeneratingEvent = components['schemas']['GeneratingEvent'];
|
|
312
313
|
type UserInputRequestEvent = components['schemas']['UserInputRequestEvent'];
|
|
313
314
|
type ProbeAnswerEvent = components['schemas']['ProbeAnswerEvent'];
|
|
314
315
|
type DeferredInterjectionEvent = components['schemas']['DeferredInterjectionEvent'];
|
|
@@ -404,6 +405,13 @@ interface SSEStreamCallbacks {
|
|
|
404
405
|
onAgentStep?: (data: AgentStepEvent) => void;
|
|
405
406
|
/** Live narration delta — append `delta` to the focus of the step with the matching `index`. */
|
|
406
407
|
onAgentStepDelta?: (data: AgentStepDeltaEvent) => void;
|
|
408
|
+
/**
|
|
409
|
+
* The model has started generating free text. Open the token channel here.
|
|
410
|
+
* It does NOT mean the text is the answer — a preamble before a tool call
|
|
411
|
+
* looks identical at this point. Only the absence of a tool call proves it
|
|
412
|
+
* was the answer, which is not known until the turn resolves.
|
|
413
|
+
*/
|
|
414
|
+
onGenerating?: (data: GeneratingEvent) => void;
|
|
407
415
|
onError?: (message: string) => void;
|
|
408
416
|
/**
|
|
409
417
|
* Fired when the server emits a structured `arbi.error` event mid-stream.
|
package/dist/browser.cjs
CHANGED
|
@@ -3786,14 +3786,10 @@ async function resolveWorkspace(store, workspaceOpt) {
|
|
|
3786
3786
|
}
|
|
3787
3787
|
|
|
3788
3788
|
// src/sse.ts
|
|
3789
|
-
|
|
3790
|
-
|
|
3791
|
-
|
|
3792
|
-
|
|
3793
|
-
interjection: "Your message",
|
|
3794
|
-
planning: "Planning",
|
|
3795
|
-
tool_progress: "Working"
|
|
3796
|
-
};
|
|
3789
|
+
function humanizeStep(identifier) {
|
|
3790
|
+
const spaced = identifier.replace(/[_-]+/g, " ").trim();
|
|
3791
|
+
return spaced.charAt(0).toUpperCase() + spaced.slice(1);
|
|
3792
|
+
}
|
|
3797
3793
|
function resolveDocRefs(text, docNames) {
|
|
3798
3794
|
if (!docNames) return text;
|
|
3799
3795
|
return text.replace(/\{(doc-[^}]+)\}/g, (_match, id) => docNames[id] ?? id);
|
|
@@ -3837,13 +3833,13 @@ function formatAgentStepLabel(step, docNames) {
|
|
|
3837
3833
|
if (step.label) return `${step.label}${suffix}`;
|
|
3838
3834
|
const detail = step.detail;
|
|
3839
3835
|
if (step.step === "tool_progress" && detail && detail.length > 0) {
|
|
3840
|
-
const label = detail[0].label ||
|
|
3836
|
+
const label = detail[0].label || humanizeStep(step.step);
|
|
3841
3837
|
if (suffix) return `${label}${suffix}`;
|
|
3842
3838
|
const message = detail[0].message;
|
|
3843
3839
|
return message ? `${label}: ${resolveDocRefs(message, docNames)}` : label;
|
|
3844
3840
|
}
|
|
3845
3841
|
if (step.step) {
|
|
3846
|
-
return
|
|
3842
|
+
return humanizeStep(step.step);
|
|
3847
3843
|
}
|
|
3848
3844
|
if (detail && detail.length > 0) {
|
|
3849
3845
|
if (detail[0].label) return `${detail[0].label}${suffix}`;
|
|
@@ -3911,6 +3907,7 @@ async function streamSSE(response, callbacks = {}) {
|
|
|
3911
3907
|
},
|
|
3912
3908
|
"response.output_text.done": (raw) => {
|
|
3913
3909
|
const data = JSON.parse(raw);
|
|
3910
|
+
text = data.text;
|
|
3914
3911
|
callbacks.onTextDone?.(data.text);
|
|
3915
3912
|
},
|
|
3916
3913
|
"response.output_item.done": (raw) => {
|
|
@@ -3928,6 +3925,11 @@ async function streamSSE(response, callbacks = {}) {
|
|
|
3928
3925
|
metadata = meta;
|
|
3929
3926
|
callbacks.onMetadata?.(meta);
|
|
3930
3927
|
}
|
|
3928
|
+
const finalText = data.response?.metadata?.content;
|
|
3929
|
+
if (finalText) {
|
|
3930
|
+
text = finalText;
|
|
3931
|
+
callbacks.onTextDone?.(finalText);
|
|
3932
|
+
}
|
|
3931
3933
|
if (data.context) {
|
|
3932
3934
|
context = data.context;
|
|
3933
3935
|
}
|
|
@@ -3960,6 +3962,11 @@ async function streamSSE(response, callbacks = {}) {
|
|
|
3960
3962
|
callbacks.onAgentStep?.(data);
|
|
3961
3963
|
if (data.t != null) callbacks.onElapsedTime?.(data.t);
|
|
3962
3964
|
},
|
|
3965
|
+
"arbi.generating": (raw) => {
|
|
3966
|
+
const data = JSON.parse(raw);
|
|
3967
|
+
callbacks.onGenerating?.(data);
|
|
3968
|
+
if (data.t != null) callbacks.onElapsedTime?.(data.t);
|
|
3969
|
+
},
|
|
3963
3970
|
"arbi.agent_step_delta": (raw) => {
|
|
3964
3971
|
const data = JSON.parse(raw);
|
|
3965
3972
|
callbacks.onAgentStepDelta?.(data);
|