@usabledev/usable-chat 1.207.2 → 1.207.3

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.
Files changed (2) hide show
  1. package/cli.js +46 -12
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -362966,9 +362966,20 @@ function shouldRecoverSilentStop({
362966
362966
  text: text5,
362967
362967
  lastStepHadToolErrors,
362968
362968
  lastStepHadToolActivity,
362969
- recoveryAttempted
362969
+ recoveryAttempted,
362970
+ recoverPreToolStop = false
362970
362971
  }) {
362971
- return !recoveryAttempted && !text5?.trim() && (lastStepHadToolErrors || lastStepHadToolActivity);
362972
+ return !recoveryAttempted && !text5?.trim() && (lastStepHadToolErrors || lastStepHadToolActivity || recoverPreToolStop);
362973
+ }
362974
+ function resolveSilentStopResponse({
362975
+ text: text5,
362976
+ recoveryAttempted,
362977
+ recoverPreToolStop
362978
+ }) {
362979
+ if (recoverPreToolStop && recoveryAttempted && !text5?.trim()) {
362980
+ return "I could not complete that Work request. Please try again.";
362981
+ }
362982
+ return text5 || "";
362972
362983
  }
362973
362984
  function shouldInjectVisualizationPrompt(config3) {
362974
362985
  return !config3.localFilesystem && config3.visualizationsEnabled !== false;
@@ -367455,13 +367466,19 @@ Re-read them (working_memory on web, bash on the CLI \u2014 grep/sed projection,
367455
367466
  text: result.text,
367456
367467
  lastStepHadToolErrors,
367457
367468
  lastStepHadToolActivity,
367458
- recoveryAttempted
367469
+ recoveryAttempted,
367470
+ recoverPreToolStop: context3.metadata?.workRuntime === "machine"
367459
367471
  })) {
367460
367472
  recoveryAttempted = true;
367461
- const recoveryPrompt = lastStepHadToolErrors ? "The previous tool call failed. Briefly summarise to the user what happened, why it likely failed, and any next steps they could take (without retrying the failed tool)." : "The previous step used tools but did not produce a visible final answer. Using the available tool results, answer the user now. Do not call more tools unless absolutely required.";
367473
+ const recoveryPrompt = lastStepHadToolErrors ? "The previous tool call failed. Briefly summarise to the user what happened, why it likely failed, and any next steps they could take (without retrying the failed tool)." : lastStepHadToolActivity ? "The previous step used tools but did not produce a visible final answer. Using the available tool results, answer the user now. Do not call more tools unless absolutely required." : "The previous response ended before producing visible content or a tool call. Complete the user's original request now. Use the available tools when the request requires them.";
367462
367474
  orchestrationLogger.warn(
367463
- "Model stopped silently after tool activity \u2014 injecting recovery prompt",
367464
- { step: currentStep, finishReason: result.finishReason },
367475
+ "Model stopped silently \u2014 injecting recovery prompt",
367476
+ {
367477
+ step: currentStep,
367478
+ finishReason: result.finishReason,
367479
+ hadToolActivity: lastStepHadToolActivity,
367480
+ workRuntime: context3.metadata?.workRuntime === "machine"
367481
+ },
367465
367482
  { userId, sessionId: sessionId2 }
367466
367483
  );
367467
367484
  conversationMessages.push({
@@ -367472,13 +367489,30 @@ Re-read them (working_memory on web, bash on the CLI \u2014 grep/sed projection,
367472
367489
  lastStepHadToolActivity = false;
367473
367490
  continue;
367474
367491
  }
367492
+ const finalResponseText = resolveSilentStopResponse({
367493
+ text: result.text,
367494
+ recoveryAttempted,
367495
+ recoverPreToolStop: context3.metadata?.workRuntime === "machine"
367496
+ });
367497
+ if (finalResponseText !== (result.text || "")) {
367498
+ multiplexer.send(
367499
+ emitter.emit("text-delta", {
367500
+ textDelta: finalResponseText
367501
+ })
367502
+ );
367503
+ orchestrationLogger.error(
367504
+ "Work model stopped silently after its bounded recovery",
367505
+ { step: currentStep, finishReason: result.finishReason },
367506
+ { userId, sessionId: sessionId2 }
367507
+ );
367508
+ }
367475
367509
  if (context3.hookExecution && !hookContinuationAttempted) {
367476
367510
  try {
367477
367511
  const stopHooks = await context3.hookExecution.run(
367478
367512
  "agent-stop",
367479
367513
  {
367480
- responseProduced: Boolean(result.text?.trim()),
367481
- response: result.text || "",
367514
+ responseProduced: Boolean(finalResponseText.trim()),
367515
+ response: finalResponseText,
367482
367516
  finishReason: result.finishReason,
367483
367517
  continuationCount: hookContinuationAttempted ? 1 : 0
367484
367518
  },
@@ -367489,7 +367523,7 @@ Re-read them (working_memory on web, bash on the CLI \u2014 grep/sed projection,
367489
367523
  hookContinuationAttempted = true;
367490
367524
  conversationMessages.push({
367491
367525
  role: "assistant",
367492
- content: result.text || ""
367526
+ content: finalResponseText
367493
367527
  });
367494
367528
  conversationMessages.push({
367495
367529
  role: "user",
@@ -367504,10 +367538,10 @@ Continue once without hiding or replacing your prior response.`
367504
367538
  });
367505
367539
  }
367506
367540
  }
367507
- const hasOnlyThinking = !result.text?.trim() && result.reasoningDetails?.length;
367541
+ const hasOnlyThinking = !finalResponseText.trim() && result.reasoningDetails?.length;
367508
367542
  const finalAssistantMessage = {
367509
367543
  role: "assistant",
367510
- content: hasOnlyThinking ? "(thinking completed)" : result.text || ""
367544
+ content: hasOnlyThinking ? "(thinking completed)" : finalResponseText
367511
367545
  };
367512
367546
  if (result.reasoningDetails && result.reasoningDetails.length > 0) {
367513
367547
  if (!isClaude) {
@@ -391524,7 +391558,7 @@ init_tui_select();
391524
391558
  init_model_registry();
391525
391559
 
391526
391560
  // package.json
391527
- var version2 = "1.207.2";
391561
+ var version2 = "1.207.3";
391528
391562
 
391529
391563
  // src/adapters/cli/model-catalog.ts
391530
391564
  init_codex_auth();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usabledev/usable-chat",
3
- "version": "1.207.2",
3
+ "version": "1.207.3",
4
4
  "description": "usable-chat — terminal harness for usable-chat (headless + TUI)",
5
5
  "type": "module",
6
6
  "bin": {