opencode-anthropic-fix 0.1.1 → 0.1.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/index.mjs +31 -4
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1024,11 +1024,19 @@ export async function AnthropicAuthPlugin({ client, project, directory, worktree
1024
1024
  const enabled = value === "on" || value === "true" || value === "1";
1025
1025
  saveConfig({ fast_mode: enabled });
1026
1026
  config.fast_mode = enabled;
1027
+ _fastModeAppliedToast = false; // reset so next application toasts
1028
+ toast(enabled ? "⚡ Fast mode ON (Opus 4.6 only)" : "⚡ Fast mode OFF", enabled ? "info" : "success", {
1029
+ debounceKey: "fast-mode-toggle",
1030
+ }).catch(() => {});
1027
1031
  },
1028
1032
  "fast-mode": () => {
1029
1033
  const enabled = value === "on" || value === "true" || value === "1";
1030
1034
  saveConfig({ fast_mode: enabled });
1031
1035
  config.fast_mode = enabled;
1036
+ _fastModeAppliedToast = false;
1037
+ toast(enabled ? "⚡ Fast mode ON (Opus 4.6 only)" : "⚡ Fast mode OFF", enabled ? "info" : "success", {
1038
+ debounceKey: "fast-mode-toggle",
1039
+ }).catch(() => {});
1032
1040
  },
1033
1041
  telemetry: () => {
1034
1042
  const enabled = value === "on" || value === "true" || value === "1";
@@ -1063,6 +1071,9 @@ export async function AnthropicAuthPlugin({ client, project, directory, worktree
1063
1071
  adaptiveContextState.escalatedByError = false;
1064
1072
  adaptiveContextState.lastTransitionTurn = sessionMetrics.turns;
1065
1073
  }
1074
+ toast(enabled ? "⬡ Adaptive 1M context ON" : "⬡ Adaptive 1M context OFF", enabled ? "info" : "success", {
1075
+ debounceKey: "adaptive-ctx-toggle",
1076
+ }).catch(() => {});
1066
1077
  },
1067
1078
  "token-efficient-tools": () => {
1068
1079
  const enabled = value === "on" || value === "true" || value === "1";
@@ -2783,6 +2794,12 @@ export async function AnthropicAuthPlugin({ client, project, directory, worktree
2783
2794
  );
2784
2795
  logTransformedSystemPrompt(body);
2785
2796
 
2797
+ // Toast on first fast-mode application in session (reset on toggle)
2798
+ if (!_fastModeAppliedToast && typeof body === "string" && body.includes('"speed":"fast"')) {
2799
+ _fastModeAppliedToast = true;
2800
+ toast("⚡ Fast mode active", "info", { debounceKey: "fast-mode-active" }).catch(() => {});
2801
+ }
2802
+
2786
2803
  // Capture request body for /anthropic context (2MB cap)
2787
2804
  if (typeof body === "string" && body.length <= 2_000_000) {
2788
2805
  sessionMetrics.lastRequestBody = body;
@@ -3271,7 +3288,11 @@ export async function AnthropicAuthPlugin({ client, project, directory, worktree
3271
3288
  if (response.status === 400 && errorBody && errorBody.includes("speed")) {
3272
3289
  if (config.fast_mode) {
3273
3290
  config.fast_mode = false;
3291
+ _fastModeAppliedToast = false;
3274
3292
  saveConfig({ fast_mode: false });
3293
+ toast("⚡ Fast mode OFF — not supported by API", "warning", {
3294
+ debounceKey: "fast-mode-off",
3295
+ }).catch(() => {});
3275
3296
  debugLog("fast mode not supported by API, auto-disabled");
3276
3297
  }
3277
3298
  }
@@ -3341,7 +3362,8 @@ export async function AnthropicAuthPlugin({ client, project, directory, worktree
3341
3362
  // Graceful degradation: disable fast mode on rate limits
3342
3363
  if (config.fast_mode && (response.status === 429 || response.status === 529)) {
3343
3364
  config.fast_mode = false;
3344
- toast("Fast mode disabled due to rate limiting", "warning", {
3365
+ _fastModeAppliedToast = false;
3366
+ toast("⚡ Fast mode OFF — rate limited", "warning", {
3345
3367
  debounceKey: "fast-mode-off",
3346
3368
  }).catch(() => {});
3347
3369
  debugLog("auto-disabled fast mode after rate limit");
@@ -3894,6 +3916,10 @@ const adaptiveContextState = {
3894
3916
  escalatedByError: false,
3895
3917
  };
3896
3918
 
3919
+ /** Track whether we've already toasted about fast mode being applied this session.
3920
+ * Resets when fast mode is toggled off/on so the user gets fresh feedback. */
3921
+ let _fastModeAppliedToast = false;
3922
+
3897
3923
  // ---------------------------------------------------------------------------
3898
3924
  // Cache break detection state (Phase 2, Task 2.3)
3899
3925
  // ---------------------------------------------------------------------------
@@ -6107,9 +6133,10 @@ function buildAnthropicBetaHeader(
6107
6133
 
6108
6134
  // === ALWAYS-ON BETAS (Claude Code v2.1.90 base set) ===
6109
6135
  // These are ALWAYS included regardless of env vars or feature flags.
6110
- if (!haiku) {
6111
- betas.push(CLAUDE_CODE_BETA_FLAG); // "claude-code-20250219"
6112
- }
6136
+ // NOTE: Real Claude Code skips this beta for Haiku, but we include it
6137
+ // so that Haiku subagents (via model-router delegation) get full mimic
6138
+ // behavior from the Anthropic API.
6139
+ betas.push(CLAUDE_CODE_BETA_FLAG); // "claude-code-20250219"
6113
6140
 
6114
6141
  // Tool search: use provider-aware header.
6115
6142
  // 1P/Foundry u2192 advanced-tool-use-2025-11-20 (enables broader tool capabilities)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-anthropic-fix",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "license": "GPL-3.0-or-later",
5
5
  "main": "./index.mjs",
6
6
  "files": [