opencode-anthropic-fix 0.1.22 → 0.1.24
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/cli.mjs +0 -0
- package/index.mjs +27 -6
- package/package.json +9 -1
package/cli.mjs
CHANGED
|
File without changes
|
package/index.mjs
CHANGED
|
@@ -5390,19 +5390,22 @@ process.once("beforeExit", _beforeExitHandler);
|
|
|
5390
5390
|
// Request building helpers (extracted from original fetch interceptor)
|
|
5391
5391
|
// ---------------------------------------------------------------------------
|
|
5392
5392
|
|
|
5393
|
-
const FALLBACK_CLAUDE_CLI_VERSION = "2.1.
|
|
5393
|
+
const FALLBACK_CLAUDE_CLI_VERSION = "2.1.119";
|
|
5394
5394
|
const CLAUDE_CODE_NPM_LATEST_URL = "https://registry.npmjs.org/@anthropic-ai/claude-code/latest";
|
|
5395
|
-
const CLAUDE_CODE_BUILD_TIME = "2026-04-
|
|
5395
|
+
const CLAUDE_CODE_BUILD_TIME = "2026-04-23T19:08:52Z";
|
|
5396
5396
|
|
|
5397
5397
|
// The @anthropic-ai/sdk version bundled with Claude Code.
|
|
5398
5398
|
// This is distinct from the CLI version and goes in X-Stainless-Package-Version.
|
|
5399
5399
|
// v2.1.107 switched from @anthropic-ai/sdk v0.208.0 to v0.81.0 (confirmed via bundle var x$H="0.81.0").
|
|
5400
|
-
// Still 0.81.0 in v2.1.
|
|
5401
|
-
//
|
|
5400
|
+
// Still 0.81.0 in v2.1.119 (verified via strings extraction from native Bun binary;
|
|
5401
|
+
// adds cache-diagnosis-2026-04-07 beta gated by GrowthBook tengu_prompt_cache_diagnostics;
|
|
5402
|
+
// no other beta additions/removals vs 2.1.117; OAuth flow unchanged).
|
|
5402
5403
|
const ANTHROPIC_SDK_VERSION = "0.81.0";
|
|
5403
5404
|
|
|
5404
5405
|
// Map of CLI version → bundled SDK version (update when CLI version changes)
|
|
5405
5406
|
const CLI_TO_SDK_VERSION = new Map([
|
|
5407
|
+
["2.1.119", "0.81.0"],
|
|
5408
|
+
["2.1.117", "0.81.0"],
|
|
5406
5409
|
["2.1.116", "0.81.0"],
|
|
5407
5410
|
["2.1.115", "0.81.0"],
|
|
5408
5411
|
["2.1.114", "0.81.0"],
|
|
@@ -6218,6 +6221,7 @@ const EXPERIMENTAL_BETA_FLAGS = new Set([
|
|
|
6218
6221
|
"advanced-tool-use-2025-11-20",
|
|
6219
6222
|
"advisor-tool-2026-03-01",
|
|
6220
6223
|
"afk-mode-2026-01-31",
|
|
6224
|
+
"cache-diagnosis-2026-04-07",
|
|
6221
6225
|
"code-execution-2025-08-25",
|
|
6222
6226
|
"compact-2026-01-12",
|
|
6223
6227
|
"context-1m-2025-08-07",
|
|
@@ -6237,6 +6241,8 @@ const BETA_SHORTCUTS = new Map([
|
|
|
6237
6241
|
["1m", "context-1m-2025-08-07"],
|
|
6238
6242
|
["1m-context", "context-1m-2025-08-07"],
|
|
6239
6243
|
["context-1m", "context-1m-2025-08-07"],
|
|
6244
|
+
["cache-diagnosis", "cache-diagnosis-2026-04-07"],
|
|
6245
|
+
["cache-diag", "cache-diagnosis-2026-04-07"],
|
|
6240
6246
|
["context-hint", "context-hint-2026-04-09"],
|
|
6241
6247
|
["hint", "context-hint-2026-04-09"],
|
|
6242
6248
|
["fast", "fast-mode-2026-02-01"],
|
|
@@ -6937,13 +6943,28 @@ function isTitleGeneratorSystemBlocks(system) {
|
|
|
6937
6943
|
* @param {any[] | undefined} system
|
|
6938
6944
|
* @returns {Array<{type: string, text: string, cache_control?: {type: string}}>}
|
|
6939
6945
|
*/
|
|
6946
|
+
// Env-context fingerprint rewrite: opencode emits
|
|
6947
|
+
// "Here is some useful information about the environment you are running in:"
|
|
6948
|
+
// Real CC 2.1.117 emits
|
|
6949
|
+
// "Here is useful information about the environment you are running in:"
|
|
6950
|
+
// Removing "some " gives byte-level parity with the CC fingerprint and saves
|
|
6951
|
+
// ~1 token in the non-cached portion. Unconditional, every request.
|
|
6952
|
+
const OPENCODE_ENV_CONTEXT_PREFIX = "Here is some useful information about the environment you are running in:";
|
|
6953
|
+
const CC_ENV_CONTEXT_PREFIX = "Here is useful information about the environment you are running in:";
|
|
6954
|
+
|
|
6955
|
+
function rewriteEnvContextPhrasing(text) {
|
|
6956
|
+
if (typeof text !== "string" || text.length === 0) return text;
|
|
6957
|
+
if (text.indexOf(OPENCODE_ENV_CONTEXT_PREFIX) === -1) return text;
|
|
6958
|
+
return text.split(OPENCODE_ENV_CONTEXT_PREFIX).join(CC_ENV_CONTEXT_PREFIX);
|
|
6959
|
+
}
|
|
6960
|
+
|
|
6940
6961
|
function normalizeSystemTextBlocks(system) {
|
|
6941
6962
|
const output = [];
|
|
6942
6963
|
if (!Array.isArray(system)) return output;
|
|
6943
6964
|
|
|
6944
6965
|
for (const item of system) {
|
|
6945
6966
|
if (typeof item === "string") {
|
|
6946
|
-
output.push({ type: "text", text: item });
|
|
6967
|
+
output.push({ type: "text", text: rewriteEnvContextPhrasing(item) });
|
|
6947
6968
|
continue;
|
|
6948
6969
|
}
|
|
6949
6970
|
|
|
@@ -6952,7 +6973,7 @@ function normalizeSystemTextBlocks(system) {
|
|
|
6952
6973
|
|
|
6953
6974
|
const normalized = {
|
|
6954
6975
|
type: typeof item.type === "string" ? item.type : "text",
|
|
6955
|
-
text: item.text,
|
|
6976
|
+
text: rewriteEnvContextPhrasing(item.text),
|
|
6956
6977
|
};
|
|
6957
6978
|
|
|
6958
6979
|
// Intentionally strip cache_control from incoming system blocks.
|
package/package.json
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "opencode-anthropic-fix",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.24",
|
|
4
4
|
"license": "GPL-3.0-or-later",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/marco-jardim/opencode-anthropic-fix.git"
|
|
8
|
+
},
|
|
9
|
+
"homepage": "https://github.com/marco-jardim/opencode-anthropic-fix#readme",
|
|
10
|
+
"bugs": {
|
|
11
|
+
"url": "https://github.com/marco-jardim/opencode-anthropic-fix/issues"
|
|
12
|
+
},
|
|
5
13
|
"main": "./index.mjs",
|
|
6
14
|
"files": [
|
|
7
15
|
"index.mjs",
|