pennyrouter 0.2.32 → 0.2.33

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pennyrouter",
3
- "version": "0.2.32",
3
+ "version": "0.2.33",
4
4
  "description": "Install and manage PennyRouter local coding-agent integrations.",
5
5
  "homepage": "https://pennyrouter.com",
6
6
  "bugs": {
package/src/launch.js CHANGED
@@ -523,6 +523,22 @@ function assertNoConflictingArgs(harness, args) {
523
523
  }
524
524
  }
525
525
 
526
+ const CLAUDE_AUTH_STARTUP_MODES = new Set(["auto", "proxy", "sub", "api", "openrouter"]);
527
+
528
+ function rewriteClaudeAuthStartup(args) {
529
+ // `claude <prompt>` submits the positional argument as the first user turn. Convert the
530
+ // convenient `penny claude proxy` spelling into the managed in-band command before Claude
531
+ // starts, so Claude receives a real @penny command rather than the literal word "proxy".
532
+ if (args.length === 1 && CLAUDE_AUTH_STARTUP_MODES.has(args[0].toLowerCase())) {
533
+ return [`@penny auth ${args[0].toLowerCase()}`];
534
+ }
535
+ if (args.length === 2 && args[0].toLowerCase() === "auth"
536
+ && CLAUDE_AUTH_STARTUP_MODES.has(args[1].toLowerCase())) {
537
+ return [`@penny auth ${args[1].toLowerCase()}`];
538
+ }
539
+ return args;
540
+ }
541
+
526
542
  export function buildPennyInvocation(harness, args, config) {
527
543
  const item = config.harnesses?.[harness];
528
544
  if (!item || !item.enabled) {
@@ -551,7 +567,7 @@ export function buildPennyInvocation(harness, args, config) {
551
567
  delete env.CLAUDE_CODE_MAX_CONTEXT_TOKENS;
552
568
  return {
553
569
  command: "claude",
554
- args: ["--settings", claudeLaunchSettingsPath(), ...args],
570
+ args: ["--settings", claudeLaunchSettingsPath(), ...rewriteClaudeAuthStartup(args)],
555
571
  env,
556
572
  };
557
573
  }
@@ -119,6 +119,13 @@ async function main() {
119
119
  assert.equal(claude.env.ANTHROPIC_DEFAULT_HAIKU_MODEL_DESCRIPTION, "Fast, economical Claude model · 200K context");
120
120
  assert.equal(claude.env.CLAUDE_CODE_MAX_CONTEXT_TOKENS, undefined);
121
121
 
122
+ const proxyStartup = buildPennyInvocation("claude", ["proxy"], config);
123
+ assert.deepEqual(proxyStartup.args.slice(-1), ["@penny auth proxy"]);
124
+ const apiStartup = buildPennyInvocation("claude", ["auth", "api"], config);
125
+ assert.deepEqual(apiStartup.args.slice(-1), ["@penny auth api"]);
126
+ const normalPrompt = buildPennyInvocation("claude", ["proxy", "please"], config);
127
+ assert.deepEqual(normalPrompt.args.slice(-2), ["proxy", "please"]);
128
+
122
129
  const codex = buildPennyInvocation("codex", ["resume", "--last"], config);
123
130
  assert.deepEqual(codex.args, ["--profile", "pennyrouter", "resume", "--last"]);
124
131
  assert.equal(codex.env.PENNYROUTER_API_KEY, "pr-super-secret");