@usabledev/usable-chat 1.207.4 → 1.207.6

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 +23 -6
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -362995,6 +362995,9 @@ function resolveSilentStopResponse({
362995
362995
  }
362996
362996
  return text5 || "";
362997
362997
  }
362998
+ function resolveWorkForcedToolName(input) {
362999
+ return input.isWorkMode && !input.alreadySatisfied && typeof input.requestedToolName === "string" && input.offeredToolNames.includes(input.requestedToolName) ? input.requestedToolName : void 0;
363000
+ }
362998
363001
  function shouldInjectVisualizationPrompt(config3) {
362999
363002
  return !config3.localFilesystem && config3.visualizationsEnabled !== false;
363000
363003
  }
@@ -363760,7 +363763,8 @@ async function callLLM({
363760
363763
  scriptedLlm,
363761
363764
  providerRouting,
363762
363765
  providerPrivacy,
363763
- providerAttemptBudget
363766
+ providerAttemptBudget,
363767
+ forcedToolName
363764
363768
  }) {
363765
363769
  if (process.env.E2E_ALLOW_TEST_SEAMS === "true" && scriptedLlm && scriptedLlm.length > 0) {
363766
363770
  const turn = selectScriptedTurn(scriptedLlm, conversationMessages);
@@ -363989,7 +363993,7 @@ async function callLLM({
363989
363993
  include_usage: true
363990
363994
  },
363991
363995
  tools,
363992
- tool_choice: shouldEnableTools ? "auto" : void 0,
363996
+ tool_choice: shouldEnableTools ? forcedToolName ? { type: "function", function: { name: forcedToolName } } : "auto" : void 0,
363993
363997
  temperature,
363994
363998
  max_tokens: maxTokens,
363995
363999
  // Only OpenRouter accepts this extension. Compatible routes
@@ -366864,6 +366868,7 @@ ${combinedSystemMessage}` : combinedSystemMessage;
366864
366868
  let lastStepHadToolActivity = false;
366865
366869
  let recoveryAttempted = false;
366866
366870
  let hookContinuationAttempted = false;
366871
+ let requiredWorkToolSatisfied = false;
366867
366872
  const repeatedToolCallCounts = /* @__PURE__ */ new Map();
366868
366873
  const MAX_IDENTICAL_TOOL_CALLS = 3;
366869
366874
  const stableStringify = (value) => {
@@ -366976,13 +366981,21 @@ ${submitHooks.context.join("\n")}
366976
366981
  );
366977
366982
  const useOpenAIToolFormat = !isClaude || providerRouting?.provider === "usable";
366978
366983
  const tools = shouldEnableTools && rawTools && !forceNoTools ? useOpenAIToolFormat ? adaptToolSchemasForProvider(convertToOpenRouterTools(rawTools), selectedModelId) : convertToClaudeTools(rawTools) : void 0;
366984
+ const toolNames2 = tools ? !useOpenAIToolFormat ? tools.map((tool2) => tool2.name) : tools.map((tool2) => tool2.function.name) : [];
366985
+ const requestedWorkToolName = context3.metadata?.workRequiredToolName;
366986
+ const forcedToolName = resolveWorkForcedToolName({
366987
+ isWorkMode: context3.metadata?.workRuntime === "machine",
366988
+ requestedToolName: requestedWorkToolName,
366989
+ offeredToolNames: toolNames2,
366990
+ alreadySatisfied: requiredWorkToolSatisfied
366991
+ });
366979
366992
  if (tools) {
366980
- const toolNames2 = !useOpenAIToolFormat ? tools.map((t14) => t14.name) : tools.map((t14) => t14.function.name);
366981
366993
  orchestrationLogger.info("Tools being sent to provider", {
366982
366994
  provider: isClaude ? "claude" : "openrouter",
366983
366995
  toolCount: toolNames2.length,
366984
366996
  toolNames: toolNames2,
366985
- hasAskSubagent: toolNames2.includes("ask-subagent")
366997
+ hasAskSubagent: toolNames2.includes("ask-subagent"),
366998
+ forcedToolName
366986
366999
  });
366987
367000
  }
366988
367001
  const toCountableMessage = (msg) => {
@@ -367361,7 +367374,8 @@ Re-read them (working_memory on web, bash on the CLI \u2014 grep/sed projection,
367361
367374
  scriptedLlm: config3.__scriptedLlm,
367362
367375
  providerRouting,
367363
367376
  providerPrivacy,
367364
- providerAttemptBudget
367377
+ providerAttemptBudget,
367378
+ forcedToolName
367365
367379
  });
367366
367380
  const overflowResult = result;
367367
367381
  if (overflowResult.finishReason === "error" && (overflowResult.contextOverflow || isContextOverflowError(overflowResult.errorMessage))) {
@@ -367455,6 +367469,9 @@ Re-read them (working_memory on web, bash on the CLI \u2014 grep/sed projection,
367455
367469
  finishReason: result.finishReason,
367456
367470
  toolCallsCount: result.toolCalls.length
367457
367471
  });
367472
+ if (forcedToolName && result.toolCalls.some((toolCall) => toolCall.name === forcedToolName)) {
367473
+ requiredWorkToolSatisfied = true;
367474
+ }
367458
367475
  orchestrationLogger.info(
367459
367476
  `Step ${currentStep} complete`,
367460
367477
  {
@@ -391574,7 +391591,7 @@ init_tui_select();
391574
391591
  init_model_registry();
391575
391592
 
391576
391593
  // package.json
391577
- var version2 = "1.207.4";
391594
+ var version2 = "1.207.6";
391578
391595
 
391579
391596
  // src/adapters/cli/model-catalog.ts
391580
391597
  init_codex_auth();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usabledev/usable-chat",
3
- "version": "1.207.4",
3
+ "version": "1.207.6",
4
4
  "description": "usable-chat — terminal harness for usable-chat (headless + TUI)",
5
5
  "type": "module",
6
6
  "bin": {