@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/index.cjs CHANGED
@@ -4187,14 +4187,10 @@ async function resolveWorkspace(store, workspaceOpt) {
4187
4187
  }
4188
4188
 
4189
4189
  // src/sse.ts
4190
- var LIFECYCLE_LABELS_FALLBACK = {
4191
- goal: "Thinking\u2026",
4192
- evaluation: "Evaluating results",
4193
- answering: "Answered",
4194
- interjection: "Your message",
4195
- planning: "Planning",
4196
- tool_progress: "Working"
4197
- };
4190
+ function humanizeStep(identifier) {
4191
+ const spaced = identifier.replace(/[_-]+/g, " ").trim();
4192
+ return spaced.charAt(0).toUpperCase() + spaced.slice(1);
4193
+ }
4198
4194
  function buildDocNameMap(docs) {
4199
4195
  const map = {};
4200
4196
  for (const doc of docs) {
@@ -4247,13 +4243,13 @@ function formatAgentStepLabel(step, docNames) {
4247
4243
  if (step.label) return `${step.label}${suffix}`;
4248
4244
  const detail = step.detail;
4249
4245
  if (step.step === "tool_progress" && detail && detail.length > 0) {
4250
- const label = detail[0].label || LIFECYCLE_LABELS_FALLBACK.tool_progress;
4246
+ const label = detail[0].label || humanizeStep(step.step);
4251
4247
  if (suffix) return `${label}${suffix}`;
4252
4248
  const message = detail[0].message;
4253
4249
  return message ? `${label}: ${resolveDocRefs(message, docNames)}` : label;
4254
4250
  }
4255
4251
  if (step.step) {
4256
- return LIFECYCLE_LABELS_FALLBACK[step.step] || step.step;
4252
+ return humanizeStep(step.step);
4257
4253
  }
4258
4254
  if (detail && detail.length > 0) {
4259
4255
  if (detail[0].label) return `${detail[0].label}${suffix}`;
@@ -4321,6 +4317,7 @@ async function streamSSE(response, callbacks = {}) {
4321
4317
  },
4322
4318
  "response.output_text.done": (raw) => {
4323
4319
  const data = JSON.parse(raw);
4320
+ text = data.text;
4324
4321
  callbacks.onTextDone?.(data.text);
4325
4322
  },
4326
4323
  "response.output_item.done": (raw) => {
@@ -4338,6 +4335,11 @@ async function streamSSE(response, callbacks = {}) {
4338
4335
  metadata = meta;
4339
4336
  callbacks.onMetadata?.(meta);
4340
4337
  }
4338
+ const finalText = data.response?.metadata?.content;
4339
+ if (finalText) {
4340
+ text = finalText;
4341
+ callbacks.onTextDone?.(finalText);
4342
+ }
4341
4343
  if (data.context) {
4342
4344
  context = data.context;
4343
4345
  }
@@ -4370,6 +4372,11 @@ async function streamSSE(response, callbacks = {}) {
4370
4372
  callbacks.onAgentStep?.(data);
4371
4373
  if (data.t != null) callbacks.onElapsedTime?.(data.t);
4372
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
+ },
4373
4380
  "arbi.agent_step_delta": (raw) => {
4374
4381
  const data = JSON.parse(raw);
4375
4382
  callbacks.onAgentStepDelta?.(data);