@blockrun/cc 0.7.1 → 0.7.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.
@@ -1,8 +1,18 @@
1
1
  import http from 'node:http';
2
2
  import { getOrCreateWallet, getOrCreateSolanaWallet, createPaymentPayload, createSolanaPaymentPayload, parsePaymentRequired, extractPaymentDetails, solanaKeyToBytes, SOLANA_NETWORK, } from '@blockrun/llm';
3
+ import fs from 'node:fs';
4
+ import path from 'node:path';
5
+ import os from 'node:os';
6
+ const LOG_FILE = path.join(os.homedir(), '.blockrun', 'brcc-debug.log');
3
7
  function debug(options, ...args) {
4
- if (options.debug)
5
- console.log('[brcc]', ...args);
8
+ if (!options.debug)
9
+ return;
10
+ const msg = `[${new Date().toISOString()}] ${args.map(String).join(' ')}\n`;
11
+ try {
12
+ fs.mkdirSync(path.dirname(LOG_FILE), { recursive: true });
13
+ fs.appendFileSync(LOG_FILE, msg);
14
+ }
15
+ catch { /* ignore */ }
6
16
  }
7
17
  const DEFAULT_MAX_TOKENS = 4096;
8
18
  let lastOutputTokens = 0;
@@ -45,12 +55,12 @@ export function createProxy(options) {
45
55
  const original = parsed.max_tokens;
46
56
  const model = (parsed.model || '').toLowerCase();
47
57
  const modelCap = (model.includes('deepseek') || model.includes('haiku') || model.includes('gpt-oss')) ? 8192 : 16384;
48
- if (lastOutputTokens > 0) {
49
- parsed.max_tokens = Math.min(lastOutputTokens, modelCap);
50
- }
51
- else {
52
- parsed.max_tokens = Math.min(parsed.max_tokens, DEFAULT_MAX_TOKENS, modelCap);
53
- }
58
+ // Use max of (last output × 2, default 4096) capped by model limit
59
+ // This ensures short replies don't starve the next request
60
+ const adaptive = lastOutputTokens > 0
61
+ ? Math.max(lastOutputTokens * 2, DEFAULT_MAX_TOKENS)
62
+ : DEFAULT_MAX_TOKENS;
63
+ parsed.max_tokens = Math.min(adaptive, modelCap);
54
64
  if (original !== parsed.max_tokens) {
55
65
  debug(options, `max_tokens: ${original} → ${parsed.max_tokens} (last output: ${lastOutputTokens || 'none'})`);
56
66
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockrun/cc",
3
- "version": "0.7.1",
3
+ "version": "0.7.3",
4
4
  "description": "Run Claude Code with any model — no rate limits, no account locks, no phone verification. Pay per use with USDC.",
5
5
  "type": "module",
6
6
  "bin": {