pennyrouter 0.2.32 → 0.2.34

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.34",
4
4
  "description": "Install and manage PennyRouter local coding-agent integrations.",
5
5
  "homepage": "https://pennyrouter.com",
6
6
  "bugs": {
package/src/cli.js CHANGED
@@ -593,6 +593,19 @@ export async function install(flags = {}) {
593
593
  flags, needsAuth, claudeAnthropicAuth, claudeProviders, codexProviders);
594
594
  gatewayBaseUrl = flags.gatewayBaseUrl || claim.gateway_base_url;
595
595
 
596
+ // A user-supplied proxy may live on a private network that the hosted gateway cannot
597
+ // reach. Let interactive installs choose the gateway after they choose the proxy: blank
598
+ // keeps the hosted default, while a supplied URL is used for credential storage,
599
+ // validation, probing, and the installed harness configuration. `--local` remains the
600
+ // explicit localhost:8400 developer shortcut and skips this prompt.
601
+ if (claudeProviders.has("anthropic-proxy") && !flags.gatewayBaseUrl
602
+ && !flags.yes && input.isTTY && output.isTTY) {
603
+ const privateGateway = (await promptText(
604
+ "PennyRouter gateway URL for this proxy (blank for hosted gateway): ",
605
+ )).trim();
606
+ if (privateGateway) gatewayBaseUrl = privateGateway;
607
+ }
608
+
596
609
  for (const credential of funding.credentials) {
597
610
  await storeUpstreamCredential({
598
611
  gatewayBaseUrl,
@@ -2040,6 +2053,10 @@ Usage:
2040
2053
  pennyrouter status
2041
2054
  pennyrouter mcp install|uninstall|status [--harness claude-code,codex]
2042
2055
 
2056
+ When an interactive install selects an Anthropic proxy, it asks for the PennyRouter gateway
2057
+ that can reach that proxy. Leave it blank for the hosted gateway, or enter a private/self-hosted
2058
+ gateway URL. Use --gateway-base-url (or --local for localhost:8400 development) for non-interactive installs.
2059
+
2043
2060
  Install and update both register the Threads MCP server with Claude Code and Codex (--no-mcp to
2044
2061
  skip a run). Run "pennyrouter mcp install" if you skipped it or had to rename a conflicting
2045
2062
  server, "pennyrouter mcp status" to see whether it is wired up, and "pennyrouter mcp uninstall"
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");