@askalf/dario 2.8.1 → 2.8.2

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 (3) hide show
  1. package/README.md +10 -0
  2. package/dist/proxy.js +16 -3
  3. package/package.json +3 -2
package/README.md CHANGED
@@ -60,6 +60,16 @@ Opus, Sonnet, Haiku — all models, streaming, tool use. Works with Cursor, Cont
60
60
 
61
61
  *"Highly recommended for personal, local development. Solves a massive pain point for developers by bridging Claude Max/Pro subscriptions with developer IDEs, saving substantial API costs. Modular & lean (~1100 lines), modern PKCE auth, SSRF protection, mature CI/CD pipeline with CodeQL and npm provenance attestations."*
62
62
 
63
+ </td>
64
+ </tr>
65
+ <tr>
66
+ <td colspan="3" align="center"><br/><strong>In production</strong><br/><br/></td>
67
+ </tr>
68
+ <tr>
69
+ <td colspan="3" valign="top">
70
+
71
+ *"The 429s were driving us crazy running a multi-agent stack on Claude Max — the CLI fallback was duct tape until you found the real fix. Billing tag in the system prompt is wild. v2.8.0 running clean, zero 429s."* — [@belangertrading](https://github.com/belangertrading), multi-agent stack on Claude Max
72
+
63
73
  </td>
64
74
  </tr>
65
75
  </table>
package/dist/proxy.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { createServer } from 'node:http';
2
2
  import { randomUUID, timingSafeEqual } from 'node:crypto';
3
3
  import { execSync, spawn } from 'node:child_process';
4
- import { readFileSync, readdirSync } from 'node:fs';
4
+ import { readFileSync, readdirSync, writeFileSync, unlinkSync } from 'node:fs';
5
5
  import { join } from 'node:path';
6
- import { homedir } from 'node:os';
6
+ import { homedir, tmpdir } from 'node:os';
7
7
  import { arch, platform, version as nodeVersion } from 'node:process';
8
8
  import { getAccessToken, getStatus } from './oauth.js';
9
9
  const ANTHROPIC_API = 'https://api.anthropic.com';
@@ -365,14 +365,25 @@ async function handleViaCli(body, model, verbose) {
365
365
  const historyText = history.map(m => `${m.role}: ${typeof m.content === 'string' ? m.content : JSON.stringify(m.content)}`).join('\n');
366
366
  systemPrompt = systemPrompt ? `${systemPrompt}\n\nConversation history:\n${historyText}` : `Conversation history:\n${historyText}`;
367
367
  }
368
+ // Write system prompt to temp file instead of passing as arg to avoid E2BIG
369
+ // on large conversation contexts (OS arg size limit ~2MB)
370
+ let systemPromptFile = null;
368
371
  if (systemPrompt) {
369
- args.push('--append-system-prompt', systemPrompt);
372
+ systemPromptFile = join(tmpdir(), `dario-sysprompt-${randomUUID()}.txt`);
373
+ writeFileSync(systemPromptFile, systemPrompt, { mode: 0o600 });
374
+ args.push('--append-system-prompt-file', systemPromptFile);
370
375
  }
371
376
  if (verbose) {
372
377
  console.log(`[dario:cli] model=${effectiveModel} prompt=${prompt.substring(0, 60)}...`);
373
378
  }
374
379
  // Spawn claude --print
375
380
  return new Promise((resolve) => {
381
+ // Cleanup temp file when done
382
+ const cleanup = () => { if (systemPromptFile)
383
+ try {
384
+ unlinkSync(systemPromptFile);
385
+ }
386
+ catch { } };
376
387
  const child = spawn('claude', args, {
377
388
  stdio: ['pipe', 'pipe', 'pipe'],
378
389
  timeout: 300_000,
@@ -387,6 +398,7 @@ async function handleViaCli(body, model, verbose) {
387
398
  child.stdin.write(prompt);
388
399
  child.stdin.end();
389
400
  child.on('close', (code) => {
401
+ cleanup();
390
402
  if (code !== 0 || !stdout.trim()) {
391
403
  resolve({
392
404
  status: 502,
@@ -414,6 +426,7 @@ async function handleViaCli(body, model, verbose) {
414
426
  resolve({ status: 200, body: JSON.stringify(response), contentType: 'application/json' });
415
427
  });
416
428
  child.on('error', (err) => {
429
+ cleanup();
417
430
  resolve({
418
431
  status: 502,
419
432
  body: JSON.stringify({ type: 'error', error: { type: 'api_error', message: 'Claude CLI not found. Install Claude Code first.' } }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@askalf/dario",
3
- "version": "2.8.1",
3
+ "version": "2.8.2",
4
4
  "description": "Use your Claude subscription as an API. No API key needed. Local proxy for Claude Max/Pro subscriptions.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -25,7 +25,8 @@
25
25
  "prepublishOnly": "npm run build",
26
26
  "start": "node dist/cli.js",
27
27
  "dev": "tsx src/cli.ts",
28
- "e2e": "node test/e2e.mjs"
28
+ "e2e": "node test/e2e.mjs",
29
+ "compat": "node test/compat.mjs"
29
30
  },
30
31
  "keywords": [
31
32
  "claude",