@usabledev/usable-chat 1.167.0 → 1.168.0

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 +127 -73
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -45064,6 +45064,11 @@ var init_model_pricing = __esm({
45064
45064
  output: 15e-6,
45065
45065
  multiplier: 24
45066
45066
  },
45067
+ "anthropic/claude-sonnet-5": {
45068
+ input: 2e-6,
45069
+ output: 1e-5,
45070
+ multiplier: 16
45071
+ },
45067
45072
  // Deepseek Models
45068
45073
  "deepseek/deepseek-chat": {
45069
45074
  input: 32e-8,
@@ -45186,6 +45191,11 @@ var init_model_pricing = __esm({
45186
45191
  output: 15e-7,
45187
45192
  multiplier: 2
45188
45193
  },
45194
+ "google/gemini-3.1-flash-lite-image": {
45195
+ input: 25e-8,
45196
+ output: 15e-7,
45197
+ multiplier: 2
45198
+ },
45189
45199
  "google/gemini-3.1-flash-lite-preview": {
45190
45200
  input: 25e-8,
45191
45201
  output: 15e-7,
@@ -45421,8 +45431,8 @@ var init_model_pricing = __esm({
45421
45431
  multiplier: 1
45422
45432
  },
45423
45433
  "nvidia/nemotron-3-super-120b-a12b": {
45424
- input: 1e-7,
45425
- output: 5e-7,
45434
+ input: 85e-9,
45435
+ output: 4e-7,
45426
45436
  multiplier: 1
45427
45437
  },
45428
45438
  "nvidia/nemotron-3-ultra-550b-a55b": {
@@ -45989,6 +45999,29 @@ var init_model_registry_generated = __esm({
45989
45999
  "src/lib/model-registry-generated.ts"() {
45990
46000
  "use strict";
45991
46001
  GENERATED_MODELS = [
46002
+ {
46003
+ id: "anthropic/claude-sonnet-5",
46004
+ displayName: "Claude Sonnet 5",
46005
+ vendor: "anthropic",
46006
+ category: "balanced",
46007
+ capabilities: {
46008
+ vision: true,
46009
+ reasoning: false,
46010
+ maxTokens: 128e3,
46011
+ contextLength: 1e6
46012
+ },
46013
+ pricing: {
46014
+ inputPer1M: 2,
46015
+ outputPer1M: 10,
46016
+ multiplier: 16
46017
+ },
46018
+ availability: {
46019
+ mainChat: false,
46020
+ experts: true,
46021
+ embeds: true
46022
+ },
46023
+ createdAt: 1782843083
46024
+ },
45992
46025
  {
45993
46026
  id: "google/gemini-3-pro-image",
45994
46027
  displayName: "Nano Banana Pro (Gemini 3 Pro Image)",
@@ -46691,8 +46724,8 @@ var init_model_registry_generated = __esm({
46691
46724
  contextLength: 1e6
46692
46725
  },
46693
46726
  pricing: {
46694
- inputPer1M: 0.1,
46695
- outputPer1M: 0.5,
46727
+ inputPer1M: 0.085,
46728
+ outputPer1M: 0.4,
46696
46729
  multiplier: 1
46697
46730
  },
46698
46731
  availability: {
@@ -47630,7 +47663,7 @@ var init_model_registry_generated = __esm({
47630
47663
  capabilities: {
47631
47664
  vision: false,
47632
47665
  reasoning: true,
47633
- maxTokens: 262144,
47666
+ maxTokens: 100352,
47634
47667
  contextLength: 262144
47635
47668
  },
47636
47669
  pricing: {
@@ -48274,7 +48307,7 @@ var init_model_registry_generated = __esm({
48274
48307
  capabilities: {
48275
48308
  vision: false,
48276
48309
  reasoning: false,
48277
- maxTokens: 262144,
48310
+ maxTokens: 100352,
48278
48311
  contextLength: 262144
48279
48312
  },
48280
48313
  pricing: {
@@ -48665,7 +48698,7 @@ var init_model_registry_generated = __esm({
48665
48698
  capabilities: {
48666
48699
  vision: false,
48667
48700
  reasoning: false,
48668
- maxTokens: 32768,
48701
+ maxTokens: 100352,
48669
48702
  contextLength: 131072
48670
48703
  },
48671
48704
  pricing: {
@@ -49877,20 +49910,20 @@ var init_model_registry_generated = __esm({
49877
49910
  createdAt: 1708905600
49878
49911
  },
49879
49912
  {
49880
- id: "openai/gpt-4-turbo-preview",
49881
- displayName: "GPT-4 Turbo Preview",
49913
+ id: "openai/gpt-3.5-turbo-0613",
49914
+ displayName: "GPT-3.5 Turbo (older v0613)",
49882
49915
  vendor: "openai",
49883
- category: "specialized",
49916
+ category: "fast",
49884
49917
  capabilities: {
49885
49918
  vision: false,
49886
49919
  reasoning: false,
49887
49920
  maxTokens: 4096,
49888
- contextLength: 128e3
49921
+ contextLength: 4095
49889
49922
  },
49890
49923
  pricing: {
49891
- inputPer1M: 10,
49892
- outputPer1M: 30,
49893
- multiplier: 53
49924
+ inputPer1M: 1,
49925
+ outputPer1M: 2,
49926
+ multiplier: 4
49894
49927
  },
49895
49928
  availability: {
49896
49929
  mainChat: false,
@@ -49900,20 +49933,20 @@ var init_model_registry_generated = __esm({
49900
49933
  createdAt: 1706140800
49901
49934
  },
49902
49935
  {
49903
- id: "openai/gpt-3.5-turbo-0613",
49904
- displayName: "GPT-3.5 Turbo (older v0613)",
49936
+ id: "openai/gpt-4-turbo-preview",
49937
+ displayName: "GPT-4 Turbo Preview",
49905
49938
  vendor: "openai",
49906
- category: "fast",
49939
+ category: "specialized",
49907
49940
  capabilities: {
49908
49941
  vision: false,
49909
49942
  reasoning: false,
49910
49943
  maxTokens: 4096,
49911
- contextLength: 4095
49944
+ contextLength: 128e3
49912
49945
  },
49913
49946
  pricing: {
49914
- inputPer1M: 1,
49915
- outputPer1M: 2,
49916
- multiplier: 4
49947
+ inputPer1M: 10,
49948
+ outputPer1M: 30,
49949
+ multiplier: 53
49917
49950
  },
49918
49951
  availability: {
49919
49952
  mainChat: false,
@@ -49946,20 +49979,20 @@ var init_model_registry_generated = __esm({
49946
49979
  createdAt: 1693180800
49947
49980
  },
49948
49981
  {
49949
- id: "openai/gpt-4",
49950
- displayName: "GPT-4",
49982
+ id: "openai/gpt-3.5-turbo",
49983
+ displayName: "GPT-3.5 Turbo",
49951
49984
  vendor: "openai",
49952
- category: "specialized",
49985
+ category: "fast",
49953
49986
  capabilities: {
49954
49987
  vision: false,
49955
49988
  reasoning: false,
49956
49989
  maxTokens: 4096,
49957
- contextLength: 8191
49990
+ contextLength: 16385
49958
49991
  },
49959
49992
  pricing: {
49960
- inputPer1M: 30,
49961
- outputPer1M: 60,
49962
- multiplier: 120
49993
+ inputPer1M: 0.5,
49994
+ outputPer1M: 1.5,
49995
+ multiplier: 3
49963
49996
  },
49964
49997
  availability: {
49965
49998
  mainChat: false,
@@ -49969,20 +50002,20 @@ var init_model_registry_generated = __esm({
49969
50002
  createdAt: 1685232e3
49970
50003
  },
49971
50004
  {
49972
- id: "openai/gpt-3.5-turbo",
49973
- displayName: "GPT-3.5 Turbo",
50005
+ id: "openai/gpt-4",
50006
+ displayName: "GPT-4",
49974
50007
  vendor: "openai",
49975
- category: "fast",
50008
+ category: "specialized",
49976
50009
  capabilities: {
49977
50010
  vision: false,
49978
50011
  reasoning: false,
49979
50012
  maxTokens: 4096,
49980
- contextLength: 16385
50013
+ contextLength: 8191
49981
50014
  },
49982
50015
  pricing: {
49983
- inputPer1M: 0.5,
49984
- outputPer1M: 1.5,
49985
- multiplier: 3
50016
+ inputPer1M: 30,
50017
+ outputPer1M: 60,
50018
+ multiplier: 120
49986
50019
  },
49987
50020
  availability: {
49988
50021
  mainChat: false,
@@ -50074,6 +50107,7 @@ var init_model_registry = __esm({
50074
50107
  crossRegion: true
50075
50108
  },
50076
50109
  "claude-sonnet-4-6": { bedrockId: "anthropic.claude-sonnet-4-6", crossRegion: true },
50110
+ "claude-sonnet-5": { bedrockId: "global.anthropic.claude-sonnet-5", crossRegion: false },
50077
50111
  // Opus 4.7 uses the Global Cross-Region Inference profile (no regional Geo access required)
50078
50112
  "claude-opus-4-7": { bedrockId: "global.anthropic.claude-opus-4-7", crossRegion: false },
50079
50113
  "claude-opus-4-20250514": {
@@ -146958,6 +146992,19 @@ var init_bedrock_sdk = __esm({
146958
146992
  });
146959
146993
 
146960
146994
  // src/lib/claude-direct.ts
146995
+ function usesAdaptiveThinking(modelId) {
146996
+ return modelId.includes("claude-opus-4-7") || modelId.includes("claude-sonnet-5");
146997
+ }
146998
+ function supportsSamplingParameters(modelId) {
146999
+ return !modelId.includes("claude-sonnet-5");
147000
+ }
147001
+ function prepareClaudeRequestForModel(request) {
147002
+ if (supportsSamplingParameters(request.model)) {
147003
+ return request;
147004
+ }
147005
+ const { temperature: _temperature, ...rest } = request;
147006
+ return rest;
147007
+ }
146961
147008
  function convertToClaudeMessages(messages4, systemMessage) {
146962
147009
  const claudeMessages = [];
146963
147010
  let system = systemMessage;
@@ -147328,38 +147375,39 @@ function createAnthropicClient(apiKey) {
147328
147375
  });
147329
147376
  }
147330
147377
  async function callClaude(apiKey, request, options2) {
147378
+ const normalizedRequest = prepareClaudeRequestForModel(request);
147331
147379
  const anthropic = createAnthropicClient(apiKey);
147332
147380
  logger.debug("claude", "Calling Claude API directly", {
147333
- model: request.model,
147334
- hasThinking: !!request.thinking,
147335
- thinking: request.thinking,
147336
- hasTools: !!request.tools,
147337
- toolCount: request.tools?.length || 0,
147338
- hasSystem: !!request.system
147381
+ model: normalizedRequest.model,
147382
+ hasThinking: !!normalizedRequest.thinking,
147383
+ thinking: normalizedRequest.thinking,
147384
+ hasTools: !!normalizedRequest.tools,
147385
+ toolCount: normalizedRequest.tools?.length || 0,
147386
+ hasSystem: !!normalizedRequest.system
147339
147387
  });
147340
147388
  try {
147341
147389
  const streamParams = {
147342
- model: request.model,
147343
- max_tokens: request.max_tokens,
147344
- messages: request.messages
147390
+ model: normalizedRequest.model,
147391
+ max_tokens: normalizedRequest.max_tokens,
147392
+ messages: normalizedRequest.messages
147345
147393
  };
147346
- if (request.temperature !== void 0) {
147347
- streamParams.temperature = request.temperature;
147394
+ if (normalizedRequest.temperature !== void 0) {
147395
+ streamParams.temperature = normalizedRequest.temperature;
147348
147396
  }
147349
- if (request.system) {
147350
- streamParams.system = request.system;
147397
+ if (normalizedRequest.system) {
147398
+ streamParams.system = normalizedRequest.system;
147351
147399
  }
147352
- if (request.tools && request.tools.length > 0) {
147353
- streamParams.tools = request.tools;
147354
- if (request.tool_choice !== void 0 && request.tool_choice !== null) {
147355
- streamParams.tool_choice = request.tool_choice;
147400
+ if (normalizedRequest.tools && normalizedRequest.tools.length > 0) {
147401
+ streamParams.tools = normalizedRequest.tools;
147402
+ if (normalizedRequest.tool_choice !== void 0 && normalizedRequest.tool_choice !== null) {
147403
+ streamParams.tool_choice = normalizedRequest.tool_choice;
147356
147404
  }
147357
147405
  }
147358
- if (request.thinking) {
147359
- streamParams.thinking = request.thinking;
147406
+ if (normalizedRequest.thinking) {
147407
+ streamParams.thinking = normalizedRequest.thinking;
147360
147408
  }
147361
- if (request.output_config) {
147362
- streamParams.output_config = request.output_config;
147409
+ if (normalizedRequest.output_config) {
147410
+ streamParams.output_config = normalizedRequest.output_config;
147363
147411
  }
147364
147412
  const requestOptions = {
147365
147413
  signal: options2?.signal
@@ -147403,6 +147451,8 @@ async function callClaude(apiKey, request, options2) {
147403
147451
  }
147404
147452
  function extractClaudeModel(modelId) {
147405
147453
  const modelMap = {
147454
+ // Claude Sonnet 5 models
147455
+ "anthropic/claude-sonnet-5": "claude-sonnet-5",
147406
147456
  // Claude Sonnet 4.5 models
147407
147457
  "anthropic/claude-sonnet-4.5": "claude-sonnet-4-5-20250929",
147408
147458
  "anthropic/claude-sonnet-4.6": "claude-sonnet-4-6",
@@ -147457,9 +147507,9 @@ function getModelById2(modelId) {
147457
147507
  }
147458
147508
  function mapModeToModel(modeId) {
147459
147509
  const modeMap = {
147460
- "standard": "anthropic/claude-haiku-4.5",
147510
+ standard: "anthropic/claude-haiku-4.5",
147461
147511
  "quick-thinking": "anthropic/claude-haiku-4.5",
147462
- "deep-thinking": "anthropic/claude-sonnet-4.6",
147512
+ "deep-thinking": "anthropic/claude-sonnet-5",
147463
147513
  "multi-lingual": "google/gemini-3.1-pro-preview",
147464
147514
  "standard-fallback": "openai/gpt-5-mini"
147465
147515
  };
@@ -147481,6 +147531,7 @@ var init_model_config = __esm({
147481
147531
  "anthropic/claude-sonnet-4": { vision: true, reasoning: false },
147482
147532
  "anthropic/claude-sonnet-4.5": { vision: true, reasoning: true },
147483
147533
  "anthropic/claude-sonnet-4.6": { vision: true, reasoning: true },
147534
+ "anthropic/claude-sonnet-5": { vision: true, reasoning: true },
147484
147535
  "anthropic/claude-haiku-4.5": { vision: true, reasoning: true },
147485
147536
  "anthropic/claude-4.5-haiku": { vision: true, reasoning: true },
147486
147537
  "anthropic/claude-4.5-sonnet": { vision: true, reasoning: true },
@@ -147533,9 +147584,9 @@ var init_model_tiers = __esm({
147533
147584
  name: "Heavy Reasoning",
147534
147585
  models: [
147535
147586
  {
147536
- id: "anthropic/claude-sonnet-4.6",
147537
- displayName: "Claude Sonnet 4.6",
147538
- description: "Best for professional tasks, finance, and long conversations",
147587
+ id: "anthropic/claude-sonnet-5",
147588
+ displayName: "Claude Sonnet 5",
147589
+ description: "Best for professional tasks, coding, agents, and long conversations",
147539
147590
  provider: "Anthropic",
147540
147591
  costTier: "Expensive",
147541
147592
  zdr: true
@@ -213854,7 +213905,7 @@ HOW TO USE THIS:
213854
213905
  - \`model\`: **default to \`quick-thinking\` (alias for \`anthropic/claude-haiku-4.5\`) unless you have a specific reason not to.** Subagents are billed in addition to your own turn \u2014 every Sonnet-class subagent doubles cost. Guidance:
213855
213906
  - **\`quick-thinking\` / \`anthropic/claude-haiku-4.5\`** (cheapest, fast, strong tool use) \u2014 use this for: web/Usable search, summarisation, classification, simple extraction, drafting, tabular work, anything where one-shot quality is "good enough". Should be your **default**.
213856
213907
  - **\`google/gemini-3-flash-preview\`** (cheap, huge context, multimodal/multi-lingual) \u2014 use this when: you need to read a 100k+-token document, the task is multi-lingual, or there's image/audio input.
213857
- - **\`deep-thinking\` / \`anthropic/claude-sonnet-4.6\`** (5\u201310\xD7 the cost of Haiku) \u2014 only use when: the work requires multi-step reasoning over conflicting evidence, code generation against a specific architecture, or careful policy/risk judgement. If you find yourself reaching for this for "research", reach for Haiku first.
213908
+ - **\`deep-thinking\` / \`anthropic/claude-sonnet-5\`** (5\u201310\xD7 the cost of Haiku) \u2014 only use when: the work requires multi-step reasoning over conflicting evidence, code generation against a specific architecture, or careful policy/risk judgement. If you find yourself reaching for this for "research", reach for Haiku first.
213858
213909
  - **\`google/gemini-3.1-pro-preview\`** \u2014 only when both massive context AND deep reasoning are required.
213859
213910
  - \`allowedTools\`: tool names exactly as they appear in YOUR own tool list. Raw MCP names (no \`mcp__usable__\` prefix) for built-in / MCP tools; \`parent_*\` prefixed names for embed-host tools registered by the surrounding application (e.g. \`parent_search_vessel_registry\`). Subagents in embed contexts CAN use parent tools \u2014 list them here just like any other tool.
213860
213911
  - \`systemPrompt\` (optional): override the default worker-agent system prompt.
@@ -286796,29 +286847,32 @@ async function callLLM({
286796
286847
  const mergedSystem = systemMessage ? claudeMessages.system ? `${claudeMessages.system}
286797
286848
 
286798
286849
  ${systemMessage}` : systemMessage : claudeMessages.system;
286799
- const thinkingEnabled = reasoningConfig.enabled && reasoningConfig.providerOptions?.reasoning?.max_tokens && reasoningEffort === "high";
286850
+ const reasoningOptions = reasoningConfig.providerOptions?.reasoning;
286851
+ const adaptiveThinkingEnabled = reasoningConfig.enabled && Boolean(reasoningOptions) && reasoningEffort === "high" && usesAdaptiveThinking(claudeModel);
286852
+ const legacyThinkingEnabled = reasoningConfig.enabled && Boolean(reasoningOptions?.max_tokens) && reasoningEffort === "high" && !usesAdaptiveThinking(claudeModel);
286853
+ const thinkingEnabled = adaptiveThinkingEnabled || legacyThinkingEnabled;
286800
286854
  const claudeRequest = {
286801
286855
  model: claudeModel,
286802
286856
  messages: claudeMessages.messages,
286803
286857
  system: mergedSystem,
286804
- max_tokens: maxTokens,
286805
- // Temperature must be 1 when thinking is enabled, otherwise use provided temperature
286806
- temperature: thinkingEnabled ? 1 : temperature
286858
+ max_tokens: maxTokens
286807
286859
  };
286860
+ if (supportsSamplingParameters(claudeModel)) {
286861
+ claudeRequest.temperature = legacyThinkingEnabled ? 1 : temperature;
286862
+ }
286808
286863
  if (shouldEnableTools && tools && tools.length > 0) {
286809
286864
  claudeRequest.tools = tools;
286810
286865
  }
286811
- if (thinkingEnabled && reasoningConfig.providerOptions?.reasoning?.max_tokens) {
286812
- const usesAdaptiveThinking = claudeModel.includes("claude-opus-4-7");
286813
- if (usesAdaptiveThinking) {
286866
+ if (thinkingEnabled) {
286867
+ if (adaptiveThinkingEnabled) {
286814
286868
  claudeRequest.thinking = { type: "adaptive" };
286815
286869
  claudeRequest.output_config = {
286816
- effort: reasoningEffort ?? "high"
286870
+ effort: reasoningOptions?.effort ?? reasoningEffort ?? "high"
286817
286871
  };
286818
- } else {
286872
+ } else if (legacyThinkingEnabled && reasoningOptions?.max_tokens) {
286819
286873
  claudeRequest.thinking = {
286820
286874
  type: "enabled",
286821
- budget_tokens: reasoningConfig.providerOptions.reasoning.max_tokens
286875
+ budget_tokens: reasoningOptions.max_tokens
286822
286876
  };
286823
286877
  }
286824
286878
  }
@@ -308986,7 +309040,7 @@ init_tui_select();
308986
309040
  init_model_registry();
308987
309041
 
308988
309042
  // package.json
308989
- var version2 = "1.167.0";
309043
+ var version2 = "1.168.0";
308990
309044
 
308991
309045
  // src/adapters/cli/model-catalog.ts
308992
309046
  init_codex_auth();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usabledev/usable-chat",
3
- "version": "1.167.0",
3
+ "version": "1.168.0",
4
4
  "description": "usable-chat — terminal harness for usable-chat (headless + TUI)",
5
5
  "type": "module",
6
6
  "bin": {