@blockrun/cc 0.7.0 → 0.7.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.
@@ -2,6 +2,7 @@ interface StartOptions {
2
2
  port?: string;
3
3
  model?: string;
4
4
  launch?: boolean;
5
+ debug?: boolean;
5
6
  }
6
7
  export declare function startCommand(options: StartOptions): Promise<void>;
7
8
  export {};
@@ -25,7 +25,7 @@ export async function startCommand(options) {
25
25
  console.log(`Model: ${chalk.green(model)}`);
26
26
  console.log(`Proxy: ${chalk.cyan(`http://localhost:${port}`)}`);
27
27
  console.log(`Backend: ${chalk.dim(apiUrl)}\n`);
28
- const server = createProxy({ port, apiUrl, chain: 'solana', modelOverride: model });
28
+ const server = createProxy({ port, apiUrl, chain: 'solana', modelOverride: model, debug: options.debug });
29
29
  launchServer(server, port, shouldLaunch, model);
30
30
  }
31
31
  else {
@@ -46,7 +46,7 @@ export async function startCommand(options) {
46
46
  console.log(`Model: ${chalk.green(model)}`);
47
47
  console.log(`Proxy: ${chalk.cyan(`http://localhost:${port}`)}`);
48
48
  console.log(`Backend: ${chalk.dim(apiUrl)}\n`);
49
- const server = createProxy({ port, apiUrl, chain: 'base', modelOverride: model });
49
+ const server = createProxy({ port, apiUrl, chain: 'base', modelOverride: model, debug: options.debug });
50
50
  launchServer(server, port, shouldLaunch, model);
51
51
  }
52
52
  }
package/dist/index.js CHANGED
@@ -21,6 +21,7 @@ program
21
21
  .option('-p, --port <port>', 'Proxy port', '8402')
22
22
  .option('-m, --model <model>', 'Default model (e.g. openai/gpt-5.4, anthropic/claude-sonnet-4.6)')
23
23
  .option('--no-launch', 'Start proxy only, do not launch Claude Code')
24
+ .option('--debug', 'Enable debug logging')
24
25
  .action(startCommand);
25
26
  program
26
27
  .command('models')
@@ -5,6 +5,7 @@ export interface ProxyOptions {
5
5
  apiUrl: string;
6
6
  chain?: Chain;
7
7
  modelOverride?: string;
8
+ debug?: boolean;
8
9
  }
9
10
  export declare function createProxy(options: ProxyOptions): http.Server;
10
11
  type RequestCategory = 'simple' | 'code' | 'default';
@@ -1,5 +1,9 @@
1
1
  import http from 'node:http';
2
2
  import { getOrCreateWallet, getOrCreateSolanaWallet, createPaymentPayload, createSolanaPaymentPayload, parsePaymentRequired, extractPaymentDetails, solanaKeyToBytes, SOLANA_NETWORK, } from '@blockrun/llm';
3
+ function debug(options, ...args) {
4
+ if (options.debug)
5
+ console.error('[brcc]', ...args);
6
+ }
3
7
  const DEFAULT_MAX_TOKENS = 4096;
4
8
  let lastOutputTokens = 0;
5
9
  export function createProxy(options) {
@@ -41,14 +45,14 @@ export function createProxy(options) {
41
45
  const original = parsed.max_tokens;
42
46
  const model = (parsed.model || '').toLowerCase();
43
47
  const modelCap = (model.includes('deepseek') || model.includes('haiku') || model.includes('gpt-oss')) ? 8192 : 16384;
44
- if (lastOutputTokens > 0) {
45
- parsed.max_tokens = Math.min(lastOutputTokens, modelCap);
46
- }
47
- else {
48
- parsed.max_tokens = Math.min(parsed.max_tokens, DEFAULT_MAX_TOKENS, modelCap);
49
- }
48
+ // Use max of (last output × 2, default 4096) capped by model limit
49
+ // This ensures short replies don't starve the next request
50
+ const adaptive = lastOutputTokens > 0
51
+ ? Math.max(lastOutputTokens * 2, DEFAULT_MAX_TOKENS)
52
+ : DEFAULT_MAX_TOKENS;
53
+ parsed.max_tokens = Math.min(adaptive, modelCap);
50
54
  if (original !== parsed.max_tokens) {
51
- console.log(`[brcc] max_tokens: ${original} → ${parsed.max_tokens} (last output: ${lastOutputTokens || 'none'})`);
55
+ debug(options, `max_tokens: ${original} → ${parsed.max_tokens} (last output: ${lastOutputTokens || 'none'})`);
52
56
  }
53
57
  }
54
58
  body = JSON.stringify(parsed);
@@ -96,7 +100,7 @@ export function createProxy(options) {
96
100
  const match = lastChunkText.match(/"output_tokens"\s*:\s*(\d+)/);
97
101
  if (match) {
98
102
  lastOutputTokens = parseInt(match[1], 10);
99
- console.log(`[brcc] recorded output_tokens: ${lastOutputTokens} (stream)`);
103
+ debug(options, `recorded output_tokens: ${lastOutputTokens} (stream)`);
100
104
  }
101
105
  }
102
106
  res.end();
@@ -116,7 +120,7 @@ export function createProxy(options) {
116
120
  const parsed = JSON.parse(text);
117
121
  if (parsed.usage?.output_tokens) {
118
122
  lastOutputTokens = parsed.usage.output_tokens;
119
- console.log(`[brcc] recorded output_tokens: ${lastOutputTokens}`);
123
+ debug(options, `recorded output_tokens: ${lastOutputTokens}`);
120
124
  }
121
125
  }
122
126
  catch { /* not JSON */ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockrun/cc",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
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": {