@usabledev/usable-chat 1.162.2 → 1.162.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 +21 -5
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -285914,6 +285914,14 @@ var init_file_storage_service = __esm({
285914
285914
 
285915
285915
  // src/core/orchestrator/index.ts
285916
285916
  import { randomUUID as randomUUID5 } from "node:crypto";
285917
+ function shouldRecoverSilentStop({
285918
+ text: text3,
285919
+ lastStepHadToolErrors,
285920
+ lastStepHadToolActivity,
285921
+ recoveryAttempted
285922
+ }) {
285923
+ return !recoveryAttempted && !text3?.trim() && (lastStepHadToolErrors || lastStepHadToolActivity);
285924
+ }
285917
285925
  function getBuiltInDataParentToolName(toolName) {
285918
285926
  if (!toolName.startsWith("parent_")) return null;
285919
285927
  const parentToolName = toolName.slice("parent_".length);
@@ -289031,6 +289039,7 @@ ${combinedSystemMessage}` : combinedSystemMessage;
289031
289039
  const maxSteps = config3.maxSteps || 200;
289032
289040
  let forceNoTools = false;
289033
289041
  let lastStepHadToolErrors = false;
289042
+ let lastStepHadToolActivity = false;
289034
289043
  let recoveryAttempted = false;
289035
289044
  const repeatedToolCallCounts = /* @__PURE__ */ new Map();
289036
289045
  const MAX_IDENTICAL_TOOL_CALLS = 3;
@@ -289563,19 +289572,25 @@ Re-read them (working_memory on web, bash on the CLI \u2014 grep/sed projection,
289563
289572
  multiplexer.send(stepFinishEvent);
289564
289573
  orchestrationLogger.debug("Emitted step-finish event", { currentStep });
289565
289574
  if (result.finishReason === "stop" || result.finishReason === "end_turn") {
289566
- const hasNoVisibleOutput = !result.text?.trim() && !(result.reasoningDetails && result.reasoningDetails.length > 0);
289567
- if (lastStepHadToolErrors && hasNoVisibleOutput && !recoveryAttempted) {
289575
+ if (shouldRecoverSilentStop({
289576
+ text: result.text,
289577
+ lastStepHadToolErrors,
289578
+ lastStepHadToolActivity,
289579
+ recoveryAttempted
289580
+ })) {
289568
289581
  recoveryAttempted = true;
289582
+ 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.";
289569
289583
  orchestrationLogger.warn(
289570
- "Model stopped silently after a tool error \u2014 injecting recovery prompt",
289584
+ "Model stopped silently after tool activity \u2014 injecting recovery prompt",
289571
289585
  { step: currentStep, finishReason: result.finishReason },
289572
289586
  { userId, sessionId: sessionId2 }
289573
289587
  );
289574
289588
  conversationMessages.push({
289575
289589
  role: "user",
289576
- content: "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)."
289590
+ content: recoveryPrompt
289577
289591
  });
289578
289592
  lastStepHadToolErrors = false;
289593
+ lastStepHadToolActivity = false;
289579
289594
  continue;
289580
289595
  }
289581
289596
  const hasOnlyThinking = !result.text?.trim() && result.reasoningDetails?.length;
@@ -289927,6 +289942,7 @@ Re-read them (working_memory on web, bash on the CLI \u2014 grep/sed projection,
289927
289942
  messageCount: conversationMessages.length
289928
289943
  });
289929
289944
  lastStepHadToolErrors = result.toolResults.some((tr5) => tr5.isError === true);
289945
+ lastStepHadToolActivity = result.toolCalls.length > 0;
289930
289946
  orchestrationLogger.info(
289931
289947
  "Conversation updated, continuing loop",
289932
289948
  {
@@ -308920,7 +308936,7 @@ init_tui_select();
308920
308936
  init_model_registry();
308921
308937
 
308922
308938
  // package.json
308923
- var version2 = "1.162.2";
308939
+ var version2 = "1.162.3";
308924
308940
 
308925
308941
  // src/adapters/cli/model-catalog.ts
308926
308942
  init_codex_auth();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usabledev/usable-chat",
3
- "version": "1.162.2",
3
+ "version": "1.162.3",
4
4
  "description": "usable-chat — terminal harness for usable-chat (headless + TUI)",
5
5
  "type": "module",
6
6
  "bin": {