@askalf/dario 3.0.2 → 3.0.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.
- package/dist/cc-template.js +13 -13
- package/dist/proxy.js +4 -2
- package/package.json +1 -1
package/dist/cc-template.js
CHANGED
|
@@ -309,6 +309,8 @@ export function buildCCRequest(clientBody, billingTag, agentIdentity, cache1h, i
|
|
|
309
309
|
systemText = systemText.replace(pattern, '');
|
|
310
310
|
}
|
|
311
311
|
// ── Build the CC request from template ──
|
|
312
|
+
// Key order matches CC v2.1.104 MITM capture exactly:
|
|
313
|
+
// model, messages, system, tools, metadata, max_tokens, thinking, context_management, output_config, stream
|
|
312
314
|
const ccRequest = {
|
|
313
315
|
model,
|
|
314
316
|
messages,
|
|
@@ -317,17 +319,12 @@ export function buildCCRequest(clientBody, billingTag, agentIdentity, cache1h, i
|
|
|
317
319
|
{ type: 'text', text: agentIdentity, cache_control: cache1h },
|
|
318
320
|
{ type: 'text', text: systemText || 'You are a helpful assistant.', cache_control: cache1h },
|
|
319
321
|
],
|
|
320
|
-
max_tokens: 64000,
|
|
321
322
|
};
|
|
322
|
-
//
|
|
323
|
-
if (
|
|
324
|
-
ccRequest.
|
|
325
|
-
ccRequest.output_config = { effort: 'medium' };
|
|
326
|
-
ccRequest.context_management = { edits: [{ type: 'clear_thinking_20251015', keep: 'all' }] };
|
|
327
|
-
// CC sends temperature:1 explicitly when not in thinking-only mode
|
|
328
|
-
ccRequest.temperature = 1;
|
|
323
|
+
// Tools come before metadata in CC's key order
|
|
324
|
+
if (clientTools && clientTools.length > 0) {
|
|
325
|
+
ccRequest.tools = CC_TOOL_DEFINITIONS;
|
|
329
326
|
}
|
|
330
|
-
//
|
|
327
|
+
// Metadata
|
|
331
328
|
ccRequest.metadata = {
|
|
332
329
|
user_id: JSON.stringify({
|
|
333
330
|
device_id: identity.deviceId,
|
|
@@ -335,11 +332,14 @@ export function buildCCRequest(clientBody, billingTag, agentIdentity, cache1h, i
|
|
|
335
332
|
session_id: identity.sessionId,
|
|
336
333
|
}),
|
|
337
334
|
};
|
|
338
|
-
ccRequest.
|
|
339
|
-
//
|
|
340
|
-
if (
|
|
341
|
-
ccRequest.
|
|
335
|
+
ccRequest.max_tokens = 64000;
|
|
336
|
+
// Model-specific fields — order: thinking, context_management, output_config
|
|
337
|
+
if (!isHaiku) {
|
|
338
|
+
ccRequest.thinking = { type: 'adaptive' };
|
|
339
|
+
ccRequest.context_management = { edits: [{ type: 'clear_thinking_20251015', keep: 'all' }] };
|
|
340
|
+
ccRequest.output_config = { effort: 'medium' };
|
|
342
341
|
}
|
|
342
|
+
ccRequest.stream = stream;
|
|
343
343
|
return { body: ccRequest, toolMap: activeToolMap, unmappedTools };
|
|
344
344
|
}
|
|
345
345
|
/**
|
package/dist/proxy.js
CHANGED
|
@@ -725,8 +725,10 @@ export async function startProxy(opts = {}) {
|
|
|
725
725
|
}
|
|
726
726
|
else {
|
|
727
727
|
// Claude-optimized: full beta set matching real Claude Code (exact order from MITM capture)
|
|
728
|
-
//
|
|
729
|
-
|
|
728
|
+
// Exact beta set from CC v2.1.104 MITM capture (exact order)
|
|
729
|
+
// Only 8 betas — CC sends more conditionally (fast-mode, web-search, etc.)
|
|
730
|
+
// but the base set for a standard request is exactly this
|
|
731
|
+
beta = 'claude-code-20250219,oauth-2025-04-20,context-1m-2025-08-07,interleaved-thinking-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,advisor-tool-2026-03-01,effort-2025-11-24';
|
|
730
732
|
if (clientBeta) {
|
|
731
733
|
const baseSet = new Set(beta.split(','));
|
|
732
734
|
const filtered = filterBillableBetas(clientBeta)
|