@khalilgharbaoui/opencode-claude-code-plugin 0.48.0 → 0.49.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.
package/dist/index.js CHANGED
@@ -991,7 +991,10 @@ function formatUnattendedReplayNote(dropped) {
991
991
  var UNRECOGNIZED_MODEL_STDERR_MARKER = "[claude-code:unrecognized_model]";
992
992
  var MODEL_CLI_FLOORS = {
993
993
  // "Added Claude Sonnet 5.5 (`claude-sonnet-5-5`)" (CHANGELOG, 2.1.284).
994
- "claude-sonnet-5-5": "2.1.284"
994
+ "claude-sonnet-5-5": "2.1.284",
995
+ // "Added Claude Haiku 5.5 (`claude-haiku-5-5`), now the default Haiku model
996
+ // on the Anthropic API" (CHANGELOG, 2.1.293). Absent from 2.1.288's catalog.
997
+ "claude-haiku-5-5": "2.1.293"
995
998
  };
996
999
  function parseUnrecognizedModel(stderr) {
997
1000
  const at = stderr.indexOf(UNRECOGNIZED_MODEL_STDERR_MARKER);
@@ -1885,8 +1888,8 @@ function cliSupportsInteractiveBypass(v) {
1885
1888
  if (!v) return false;
1886
1889
  return gte(v, { major: 2, minor: 1, patch: 263 });
1887
1890
  }
1888
- var INTERACTIVE_MEASURED_CLI = "2.1.288";
1889
- var INTERACTIVE_MEASURED = { major: 2, minor: 1, patch: 288 };
1891
+ var INTERACTIVE_MEASURED_CLI = "2.1.293";
1892
+ var INTERACTIVE_MEASURED = { major: 2, minor: 1, patch: 293 };
1890
1893
  function isUnmeasuredInteractiveCli(v) {
1891
1894
  if (!v) return false;
1892
1895
  return gte(v, INTERACTIVE_MEASURED) && !(v.major === INTERACTIVE_MEASURED.major && v.minor === INTERACTIVE_MEASURED.minor && v.patch === INTERACTIVE_MEASURED.patch);
@@ -7593,6 +7596,8 @@ function passthroughModel(id) {
7593
7596
  };
7594
7597
  }
7595
7598
  var haikuCost = { input: 1, output: 5, cacheRead: 0.1, cacheWrite: 1.25 };
7599
+ var haiku55Cost = { input: 0.1, output: 0.5, cacheRead: 0.01, cacheWrite: 0.125 };
7600
+ var haiku55LongPromptCost = { input: 0.5, output: 2.5, cacheRead: 0.05, cacheWrite: 0.625 };
7596
7601
  var sonnetCost = { input: 3, output: 15, cacheRead: 0.3, cacheWrite: 3.75 };
7597
7602
  var sonnet5Cost = { input: 2, output: 10, cacheRead: 0.2, cacheWrite: 2.5 };
7598
7603
  var opusCost = { input: 5, output: 25, cacheRead: 0.5, cacheWrite: 6.25 };
@@ -7633,6 +7638,9 @@ function toConfigModel(model) {
7633
7638
  variants: model.variants
7634
7639
  };
7635
7640
  }
7641
+ var LONG_PROMPT_COSTS = {
7642
+ "claude-haiku-5-5": { aboveTokens: 1e5, cost: haiku55LongPromptCost }
7643
+ };
7636
7644
  var defaultModels = {
7637
7645
  "claude-haiku-4-5": defineModel({
7638
7646
  id: "claude-haiku-4-5",
@@ -7645,6 +7653,32 @@ var defaultModels = {
7645
7653
  multiplier: 1,
7646
7654
  releaseDate: "2025-10-01"
7647
7655
  }),
7656
+ // Haiku 5.5 needs Claude Code 2.1.293+, the release that added it and made
7657
+ // it the default Haiku; an older CLI runs it on fallback limits and says so
7658
+ // on stderr, which `reportUnrecognizedModel` turns into a warning. Unlike
7659
+ // Haiku 4.5 it reasons: the CLI's catalog gives it `effort`, `max_effort`,
7660
+ // `xhigh_effort` and `adaptive_thinking`, and Anthropic's migration note says
7661
+ // manual `budget_tokens` is a 400 and adaptive thinking is on by default. The
7662
+ // plugin never sends `budget_tokens`, so nothing here special-cases it, the
7663
+ // same as Opus 5.5's `rejects_disabled_thinking`. No `-fast` entry: the
7664
+ // catalog gives it no `fast_mode` capability.
7665
+ //
7666
+ // The multiplier is 0.1 because it is exactly a tenth of Haiku 4.5 on input,
7667
+ // output, cache read and cache write alike, and Haiku 4.5's $1/$5 is the 1x
7668
+ // anchor every other entry here is already measured against. Re-anchoring the
7669
+ // whole table on Haiku 5.5 would change every model's displayed number for no
7670
+ // gain in accuracy.
7671
+ "claude-haiku-5-5": defineModel({
7672
+ id: "claude-haiku-5-5",
7673
+ name: "Claude Haiku 5.5",
7674
+ family: "haiku",
7675
+ reasoning: true,
7676
+ context: 1e6,
7677
+ output: 128e3,
7678
+ cost: haiku55Cost,
7679
+ multiplier: 0.1,
7680
+ releaseDate: "2026-10-07"
7681
+ }),
7648
7682
  "claude-sonnet-4-5": defineModel({
7649
7683
  id: "claude-sonnet-4-5",
7650
7684
  name: "Claude Sonnet 4.5",
@@ -7873,14 +7907,25 @@ function apiCallCostUsd(model, usage) {
7873
7907
  const base = model.replace(/@.*$/, "").replace(/\[1m\]$/i, "").replace(/-\d{8}$/, "");
7874
7908
  const entry = (usage.speed === "fast" ? defaultModels[`${base}${FAST_SUFFIX}`] : void 0) ?? defaultModels[base];
7875
7909
  if (!entry) return null;
7876
- const cost = entry.cost;
7877
7910
  const count = (value) => typeof value === "number" && Number.isFinite(value) ? value : 0;
7911
+ const cost = longPromptCost(base, usage, count) ?? entry.cost;
7878
7912
  const split = usage.cache_creation;
7879
7913
  const write1h = split ? count(split.ephemeral_1h_input_tokens) : 0;
7880
7914
  const write5m = split ? count(split.ephemeral_5m_input_tokens) : count(usage.cache_creation_input_tokens);
7881
7915
  const perMillion = count(usage.input_tokens) * cost.input + count(usage.output_tokens) * cost.output + count(usage.cache_read_input_tokens) * cost.cache.read + write5m * cost.cache.write + write1h * cost.input * 2;
7882
7916
  return perMillion / 1e6 + count(usage.server_tool_use?.web_search_requests) * WEB_SEARCH_USD;
7883
7917
  }
7918
+ function longPromptCost(base, usage, count) {
7919
+ const tier = LONG_PROMPT_COSTS[base];
7920
+ if (!tier) return null;
7921
+ const promptTokens = count(usage.input_tokens) + count(usage.cache_read_input_tokens) + count(usage.cache_creation_input_tokens);
7922
+ if (promptTokens <= tier.aboveTokens) return null;
7923
+ return {
7924
+ input: tier.cost.input,
7925
+ output: tier.cost.output,
7926
+ cache: { read: tier.cost.cacheRead, write: tier.cost.cacheWrite }
7927
+ };
7928
+ }
7884
7929
 
7885
7930
  // src/agent-models.ts
7886
7931
  var AGENT_DIR_NAMES = ["agents", "agent"];