clawmoney 0.15.70 → 0.15.72
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.
|
@@ -85,9 +85,16 @@ const STATIC_CLAUDE_CODE_HEADERS = {
|
|
|
85
85
|
// matches claudeCodeSystemPrompts template #2 in sub2api's validator
|
|
86
86
|
// (hasClaudeCodeSystemPrompt → dice coefficient ≥ 0.5).
|
|
87
87
|
const CLAUDE_CODE_SYSTEM_PROMPT_LEAD = "You are a Claude agent, built on Anthropic's Claude Agent SDK.";
|
|
88
|
-
//
|
|
89
|
-
//
|
|
90
|
-
|
|
88
|
+
// Template-mode instructions ONLY — not used in passthrough mode.
|
|
89
|
+
// In passthrough, the buyer's Claude Code sends its own tool definitions
|
|
90
|
+
// and expects full agentic behavior; injecting "do not use tools" here
|
|
91
|
+
// would break WebSearch / Bash / Edit / all other tools, producing
|
|
92
|
+
// "current mode can't use tools" responses from the model.
|
|
93
|
+
const RELAY_INSTRUCTIONS_TEMPLATE = "You are operating in pure-LLM relay mode. Respond to the user's message with plain text only. Do not use tools. Do not ask clarifying questions. Be concise.";
|
|
94
|
+
// Passthrough-mode marker — just the CC identity lead, no tool-suppression.
|
|
95
|
+
// The buyer controls tool behavior via the body's `tools` array and
|
|
96
|
+
// their own system prompt.
|
|
97
|
+
const RELAY_INSTRUCTIONS_PASSTHROUGH = "";
|
|
91
98
|
// Short-name → fully qualified ID mapping required by the Claude OAuth API.
|
|
92
99
|
const MODEL_ID_OVERRIDES = {
|
|
93
100
|
"claude-sonnet-4-5": "claude-sonnet-4-5-20250929",
|
|
@@ -165,15 +172,35 @@ function pickClaudeBetasForModel(model) {
|
|
|
165
172
|
const m = normalizeModel(model);
|
|
166
173
|
const isHaiku = m.includes("haiku");
|
|
167
174
|
const betas = [];
|
|
175
|
+
// claude-code-20250219 — required for non-haiku models, Anthropic uses
|
|
176
|
+
// it to identify legitimate Claude Code requests (missing → "non-CC"
|
|
177
|
+
// classification → Extra usage required for long context etc).
|
|
168
178
|
if (!isHaiku)
|
|
169
179
|
betas.push("claude-code-20250219");
|
|
170
|
-
//
|
|
171
|
-
// Max-tier OAuth tokens.
|
|
180
|
+
// oauth-2025-04-20 — required for OAuth (Max subscription) tokens.
|
|
172
181
|
betas.push("oauth-2025-04-20");
|
|
173
|
-
//
|
|
182
|
+
// interleaved-thinking-2025-05-14 — all Claude 4+ models support it.
|
|
174
183
|
if (modelSupportsThinking(model)) {
|
|
175
184
|
betas.push("interleaved-thinking-2025-05-14");
|
|
176
185
|
}
|
|
186
|
+
// Below: betas that real Claude Code always sends. Missing any of these
|
|
187
|
+
// causes Anthropic to treat the request as "not quite Claude Code",
|
|
188
|
+
// which silently disables tool use and may force Extra usage billing
|
|
189
|
+
// on long context. Cross-referenced against auth2api and real CC wire
|
|
190
|
+
// capture (2026-04 versions).
|
|
191
|
+
//
|
|
192
|
+
// - redact-thinking-2026-02-12: hides thinking blocks in response
|
|
193
|
+
// - context-management-2025-06-27: enables tool_result context windows
|
|
194
|
+
// - prompt-caching-scope-2026-01-05: global prompt cache scope
|
|
195
|
+
// - advanced-tool-use-2025-11-20: enables tool_use for non-haiku (CRITICAL)
|
|
196
|
+
// - effort-2025-11-24: adaptive thinking effort levels
|
|
197
|
+
betas.push("redact-thinking-2026-02-12");
|
|
198
|
+
betas.push("context-management-2025-06-27");
|
|
199
|
+
betas.push("prompt-caching-scope-2026-01-05");
|
|
200
|
+
if (!isHaiku) {
|
|
201
|
+
betas.push("advanced-tool-use-2025-11-20");
|
|
202
|
+
betas.push("effort-2025-11-24");
|
|
203
|
+
}
|
|
177
204
|
return betas;
|
|
178
205
|
}
|
|
179
206
|
// ── Proxy (honor HTTPS_PROXY / http_proxy env vars) ──
|
|
@@ -808,7 +835,7 @@ async function doCallClaudeApi(opts) {
|
|
|
808
835
|
},
|
|
809
836
|
{
|
|
810
837
|
type: "text",
|
|
811
|
-
text: `${CLAUDE_CODE_SYSTEM_PROMPT_LEAD}\n\n${
|
|
838
|
+
text: `${CLAUDE_CODE_SYSTEM_PROMPT_LEAD}\n\n${RELAY_INSTRUCTIONS_TEMPLATE}`,
|
|
812
839
|
// Mark the last system block for prompt caching. Real Claude Code
|
|
813
840
|
// *always* attaches cache_control: {type: "ephemeral"} to its system
|
|
814
841
|
// blocks — Anthropic uses the presence of this marker as part of its
|
|
@@ -1151,9 +1178,13 @@ function ensureClaudeCodeShell(body, fingerprint) {
|
|
|
1151
1178
|
// marker that unblocks the ordering validator.
|
|
1152
1179
|
if (!hasCcMarker) {
|
|
1153
1180
|
const buyerUsesExtendedCache = bodyHasExtendedCacheBlock(body);
|
|
1181
|
+
// Passthrough mode: inject ONLY the CC identity lead, no tool
|
|
1182
|
+
// suppression. The buyer's Claude Code drives tool use via its own
|
|
1183
|
+
// tools array + system prompt. Appending "Do not use tools" here
|
|
1184
|
+
// would break WebSearch / Bash / Edit / every other tool.
|
|
1154
1185
|
const markerBlock = {
|
|
1155
1186
|
type: "text",
|
|
1156
|
-
text:
|
|
1187
|
+
text: CLAUDE_CODE_SYSTEM_PROMPT_LEAD,
|
|
1157
1188
|
cache_control: buyerUsesExtendedCache
|
|
1158
1189
|
? { type: "ephemeral", ttl: "1h" }
|
|
1159
1190
|
: { type: "ephemeral" },
|