github-router 0.3.367 → 0.3.370

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 (88) hide show
  1. package/dist/ado-tools-B5MNQMFs.js +1 -0
  2. package/dist/{aic-ledger-_mvGW2Ev.js → aic-ledger-Cp7Yk9-Q.js} +2 -2
  3. package/dist/{aic-ledger-_mvGW2Ev.js.map → aic-ledger-Cp7Yk9-Q.js.map} +1 -1
  4. package/dist/{attribution-settings-wVzQvIdL.js → attribution-settings-Cppl9atx.js} +224 -192
  5. package/dist/attribution-settings-Cppl9atx.js.map +1 -0
  6. package/dist/{auth-B3UvYB2r.js → auth-B1egtvt4.js} +3 -3
  7. package/dist/{auth-B3UvYB2r.js.map → auth-B1egtvt4.js.map} +1 -1
  8. package/dist/{balanced-profile-contract-DtnTIBjL.js → balanced-profile-contract-Dm_usmw7.js} +7 -1
  9. package/dist/{balanced-profile-contract-DtnTIBjL.js.map → balanced-profile-contract-Dm_usmw7.js.map} +1 -1
  10. package/dist/{bluebird-client-C29-JOkG.js → bluebird-client-ByCRusGQ.js} +3 -3
  11. package/dist/bluebird-client-ByCRusGQ.js.map +1 -0
  12. package/dist/bluebird-client-CY6NBHQu.js +1 -0
  13. package/dist/browser-ext/manifest.json +1 -1
  14. package/dist/{check-usage-45vyaLfl.js → check-usage-T_z84Pgc.js} +3 -3
  15. package/dist/{check-usage-45vyaLfl.js.map → check-usage-T_z84Pgc.js.map} +1 -1
  16. package/dist/{claude-B3pIageM.js → claude-B3qNFwtc.js} +25 -20
  17. package/dist/claude-B3qNFwtc.js.map +1 -0
  18. package/dist/{claude-md-injection-BV4tPUWo.js → claude-md-injection-K3DKhsfI.js} +37 -12
  19. package/dist/claude-md-injection-K3DKhsfI.js.map +1 -0
  20. package/dist/{codex-B_AMB6JM.js → codex-3DEffjlm.js} +8 -8
  21. package/dist/{codex-B_AMB6JM.js.map → codex-3DEffjlm.js.map} +1 -1
  22. package/dist/{copilot-discount-BuDbQOHq.js → copilot-discount-T-cfWmc4.js} +2 -2
  23. package/dist/{copilot-discount-BuDbQOHq.js.map → copilot-discount-T-cfWmc4.js.map} +1 -1
  24. package/dist/engine-C2YCclx0.js +1 -0
  25. package/dist/{gate-discovery-CXE-7VcM.js → gate-discovery-BV6UGGVd.js} +2 -2
  26. package/dist/{gate-discovery-CXE-7VcM.js.map → gate-discovery-BV6UGGVd.js.map} +1 -1
  27. package/dist/{get-copilot-usage-BbGmK03C.js → get-copilot-usage-BSXeQEx8.js} +3 -3
  28. package/dist/{get-copilot-usage-BbGmK03C.js.map → get-copilot-usage-BSXeQEx8.js.map} +1 -1
  29. package/dist/hooks.mjs +74 -10
  30. package/dist/hooks.sha256 +1 -1
  31. package/dist/{internal-aic-status-BAVomi5A.js → internal-aic-status-CY0QxSa7.js} +3 -3
  32. package/dist/{internal-aic-status-BAVomi5A.js.map → internal-aic-status-CY0QxSa7.js.map} +1 -1
  33. package/dist/{internal-fast-dispatch-guard-DP25L_Bx.js → internal-fast-dispatch-guard-De_DJOyZ.js} +1 -1
  34. package/dist/{internal-fast-dispatch-guard-DbrgO9Ab.js → internal-fast-dispatch-guard-_n-A8hgo.js} +2 -2
  35. package/dist/{internal-fast-dispatch-guard-DbrgO9Ab.js.map → internal-fast-dispatch-guard-_n-A8hgo.js.map} +1 -1
  36. package/dist/{internal-max-dispatch-guard-BodVFHRC.js → internal-max-dispatch-guard-4rh6KSd8.js} +2 -2
  37. package/dist/{internal-max-dispatch-guard-BodVFHRC.js.map → internal-max-dispatch-guard-4rh6KSd8.js.map} +1 -1
  38. package/dist/{internal-max-dispatch-guard-BB0vwiPx.js → internal-max-dispatch-guard-CKnzgJje.js} +1 -1
  39. package/dist/{internal-prompt-submit-DPUBQZtG.js → internal-prompt-submit-B-kKTl-8.js} +2 -2
  40. package/dist/{internal-prompt-submit-BaccW_CC.js → internal-prompt-submit-bi7F7pKk.js} +2 -2
  41. package/dist/{internal-prompt-submit-BaccW_CC.js.map → internal-prompt-submit-bi7F7pKk.js.map} +1 -1
  42. package/dist/{internal-rebrief-NjSlx5QY.js → internal-rebrief-B6ZJS6Mp.js} +3 -3
  43. package/dist/{internal-rebrief-NjSlx5QY.js.map → internal-rebrief-B6ZJS6Mp.js.map} +1 -1
  44. package/dist/{internal-stop-hook-B2TTl6Zp.js → internal-stop-hook-covotLvl.js} +2 -2
  45. package/dist/{internal-stop-hook-B2TTl6Zp.js.map → internal-stop-hook-covotLvl.js.map} +1 -1
  46. package/dist/main.js +15 -14
  47. package/dist/main.js.map +1 -1
  48. package/dist/{max-profile-contract-Cx5_Z1Y7.js → max-profile-contract-CRj7N211.js} +2 -2
  49. package/dist/{max-profile-contract-Cx5_Z1Y7.js.map → max-profile-contract-CRj7N211.js.map} +1 -1
  50. package/dist/{models-BR6i348u.js → models-Ca-HQTYi.js} +2 -2
  51. package/dist/{models-BR6i348u.js.map → models-Ca-HQTYi.js.map} +1 -1
  52. package/dist/{peer-mcp-personas-BOgR46nM.js → peer-mcp-personas-6zWkXHQW.js} +1181 -354
  53. package/dist/peer-mcp-personas-6zWkXHQW.js.map +1 -0
  54. package/dist/{pi-DcWp83mx.js → pi-DJJlBHP9.js} +41 -19
  55. package/dist/{pi-DcWp83mx.js.map → pi-DJJlBHP9.js.map} +1 -1
  56. package/dist/{provision-DkWR9B6I.js → provision-C_aTowyW.js} +3 -2
  57. package/dist/provision-C_aTowyW.js.map +1 -0
  58. package/dist/{serve-BGwEVDdc.js → serve-CfizTkRS.js} +19 -11
  59. package/dist/serve-CfizTkRS.js.map +1 -0
  60. package/dist/{server-setup-DVPL9iph.js → server-setup-rm8ELtYa.js} +107 -138
  61. package/dist/server-setup-rm8ELtYa.js.map +1 -0
  62. package/dist/{start-BUWx3nSr.js → start-D7RcHG8T.js} +3 -3
  63. package/dist/{start-BUWx3nSr.js.map → start-D7RcHG8T.js.map} +1 -1
  64. package/dist/{state-CiwCLVDZ.js → state-DzsaGHr9.js} +3 -1
  65. package/dist/state-DzsaGHr9.js.map +1 -0
  66. package/dist/{static-context-pack-ChHuxBpk.js → static-context-pack-DvwLWlbe.js} +153 -17
  67. package/dist/static-context-pack-DvwLWlbe.js.map +1 -0
  68. package/dist/token-CVG0yI_j.js +480 -0
  69. package/dist/token-CVG0yI_j.js.map +1 -0
  70. package/dist/{token-OTb61rOC.js → token-Dqjs5ixP.js} +3 -3
  71. package/dist/{token-OTb61rOC.js.map → token-Dqjs5ixP.js.map} +1 -1
  72. package/dist/workiq-qnJR5_n2.js +144 -0
  73. package/dist/workiq-qnJR5_n2.js.map +1 -0
  74. package/dist/workiq-tools-BeTneKco.js +1 -0
  75. package/package.json +1 -1
  76. package/dist/ado-tools-rysFZDws.js +0 -1
  77. package/dist/attribution-settings-wVzQvIdL.js.map +0 -1
  78. package/dist/bluebird-client-C29-JOkG.js.map +0 -1
  79. package/dist/bluebird-client-DGE3WZqh.js +0 -1
  80. package/dist/claude-B3pIageM.js.map +0 -1
  81. package/dist/claude-md-injection-BV4tPUWo.js.map +0 -1
  82. package/dist/engine-D3oNrF6Z.js +0 -1
  83. package/dist/peer-mcp-personas-BOgR46nM.js.map +0 -1
  84. package/dist/provision-DkWR9B6I.js.map +0 -1
  85. package/dist/serve-BGwEVDdc.js.map +0 -1
  86. package/dist/server-setup-DVPL9iph.js.map +0 -1
  87. package/dist/state-CiwCLVDZ.js.map +0 -1
  88. package/dist/static-context-pack-ChHuxBpk.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { P as warmTreeSitterPool } from "./service-backend-B6D_DY1Z.js";
2
- import { $ as runSelfUpdate, a as setupAndServe, b as startKeepAwake, i as parseSharedArgs, n as getCodexEnvVars, o as sharedServerArgs, t as getClaudeCodeEnvVars } from "./server-setup-DVPL9iph.js";
3
- import { Ct as browserToolsEnabled, En as provisionAndIndexColbert, Tn as colbertDegradedWarning, yn as provisionBrowserAssets } from "./peer-mcp-personas-BOgR46nM.js";
2
+ import { Z as runSelfUpdate, a as setupAndServe, i as parseSharedArgs, n as getCodexEnvVars, o as sharedServerArgs, t as getClaudeCodeEnvVars, v as startKeepAwake } from "./server-setup-rm8ELtYa.js";
3
+ import { At as browserToolsEnabled, Ln as colbertDegradedWarning, Rn as provisionAndIndexColbert, jn as provisionBrowserAssets } from "./peer-mcp-personas-6zWkXHQW.js";
4
4
  import { defineCommand } from "citty";
5
5
  import consola from "consola";
6
6
  import process$1 from "node:process";
@@ -130,4 +130,4 @@ const start = defineCommand({
130
130
  //#endregion
131
131
  export { start };
132
132
 
133
- //# sourceMappingURL=start-BUWx3nSr.js.map
133
+ //# sourceMappingURL=start-D7RcHG8T.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"start-BUWx3nSr.js","names":["process"],"sources":["../src/lib/shell.ts","../src/start.ts"],"sourcesContent":["import process from \"node:process\"\n\ntype ShellName = \"bash\" | \"zsh\" | \"fish\" | \"powershell\" | \"cmd\" | \"sh\"\ntype EnvVars = Record<string, string | undefined>\n\nfunction getShell(): ShellName {\n const { platform, env } = process\n\n if (platform === \"win32\") {\n // Git Bash / MSYS2 / Cygwin set SHELL even on Windows\n if (env.SHELL) {\n if (env.SHELL.endsWith(\"zsh\")) return \"zsh\"\n if (env.SHELL.endsWith(\"fish\")) return \"fish\"\n if (env.SHELL.endsWith(\"bash\")) return \"bash\"\n return \"sh\"\n }\n\n // Windows PowerShell 5.x sets this\n if (env.POWERSHELL_DISTRIBUTION_CHANNEL) return \"powershell\"\n\n // PowerShell (both 5.x and 7+/pwsh) adds user-scoped module paths\n // at runtime. The system-level PSModulePath in CMD lacks these paths.\n if (env.PSModulePath) {\n const lower = env.PSModulePath.toLowerCase()\n if (\n lower.includes(\"documents\\\\powershell\")\n || lower.includes(\"documents\\\\windowspowershell\")\n ) {\n return \"powershell\"\n }\n }\n\n return \"cmd\"\n }\n\n const shellPath = env.SHELL\n if (shellPath) {\n if (shellPath.endsWith(\"zsh\")) return \"zsh\"\n if (shellPath.endsWith(\"fish\")) return \"fish\"\n if (shellPath.endsWith(\"bash\")) return \"bash\"\n }\n\n return \"sh\"\n}\n\nfunction quotePosixValue(value: string): string {\n return `'${value.replace(/'/g, \"'\\\\''\")}'`\n}\n\nfunction quotePowerShellValue(value: string): string {\n return `'${value.replace(/'/g, \"''\")}'`\n}\n\n/**\n * Generates a copy-pasteable script to set multiple environment variables\n * and run a subsequent command.\n * @param {EnvVars} envVars - An object of environment variables to set.\n * @param {string} commandToRun - The command to run after setting the variables.\n * @returns {string} The formatted script string.\n */\nexport function generateEnvScript(\n envVars: EnvVars,\n commandToRun: string = \"\",\n): string {\n const shell = getShell()\n const filteredEnvVars = Object.entries(envVars).filter(\n ([, value]) => value !== undefined,\n ) as Array<[string, string]>\n\n let commandBlock: string\n\n switch (shell) {\n case \"powershell\": {\n commandBlock = filteredEnvVars\n .map(([key, value]) => `$env:${key} = ${quotePowerShellValue(value)}`)\n .join(\"; \")\n break\n }\n case \"cmd\": {\n commandBlock = filteredEnvVars\n .map(([key, value]) => `set \"${key}=${value}\"`)\n .join(\" & \")\n break\n }\n case \"fish\": {\n commandBlock = filteredEnvVars\n .map(([key, value]) => `set -gx ${key} ${quotePosixValue(value)}`)\n .join(\"; \")\n break\n }\n default: {\n // bash, zsh, sh\n const assignments = filteredEnvVars\n .map(([key, value]) => `${key}=${quotePosixValue(value)}`)\n .join(\" \")\n commandBlock = filteredEnvVars.length > 0 ? `export ${assignments}` : \"\"\n break\n }\n }\n\n if (commandBlock && commandToRun) {\n const separator =\n shell === \"cmd\" ? \" & \" : shell === \"powershell\" ? \"; \" : \" && \"\n return `${commandBlock}${separator}${commandToRun}`\n }\n\n return commandBlock || commandToRun\n}\n","#!/usr/bin/env node\n\nimport { defineCommand } from \"citty\"\nimport clipboard from \"clipboardy\"\nimport consola from \"consola\"\n\nimport { generateEnvScript } from \"./lib/shell\"\nimport { DEFAULT_CODEX_MODEL, DEFAULT_PORT } from \"./lib/port\"\nimport { provisionBrowserAssets } from \"./lib/browser-mcp/provision\"\nimport { browserToolsEnabled } from \"./lib/mcp-capabilities\"\nimport { colbertDegradedWarning, provisionAndIndexColbert } from \"./lib/colbert\"\nimport { startKeepAwake } from \"./lib/keep-awake\"\nimport { warmTreeSitterPool } from \"./lib/tree-sitter-pool/pool\"\nimport {\n getClaudeCodeEnvVars,\n getCodexEnvVars,\n parseSharedArgs,\n setupAndServe,\n sharedServerArgs,\n} from \"./lib/server-setup\"\nimport { runSelfUpdate } from \"./lib/self-update\"\n\nfunction printAndCopyCommand(command: string, label: string): void {\n consola.box(`${label}\\n\\n${command}`)\n try {\n clipboard.writeSync(command)\n consola.success(`Copied ${label} command to clipboard!`)\n } catch {\n consola.warn(\"Failed to copy to clipboard. Copy the command above manually.\")\n }\n}\n\nfunction generateClaudeCodeCommand(serverUrl: string, model?: string) {\n const envVars = getClaudeCodeEnvVars(serverUrl, model)\n const command = generateEnvScript(envVars, \"claude --dangerously-skip-permissions\")\n printAndCopyCommand(command, \"Claude Code\")\n}\n\nfunction generateCodexCommand(serverUrl: string, model?: string) {\n const codexModel = model ?? DEFAULT_CODEX_MODEL\n const envVars = getCodexEnvVars(serverUrl)\n const command = generateEnvScript(envVars, `codex -m ${codexModel}`)\n printAndCopyCommand(command, \"Codex CLI\")\n}\n\nexport const start = defineCommand({\n meta: {\n name: \"start\",\n description: \"Start the github-router server\",\n },\n args: {\n ...sharedServerArgs,\n cc: {\n type: \"boolean\",\n default: false,\n description:\n \"Generate a command to launch Claude Code with Copilot API config\",\n },\n cx: {\n type: \"boolean\",\n default: false,\n description:\n \"Generate a command to launch Codex CLI with Copilot API config\",\n },\n model: {\n alias: \"m\",\n type: \"string\",\n description: \"Override the default model (used with --cc or --cx)\",\n },\n },\n async run({ args }) {\n const parsed = parseSharedArgs(args as unknown as Record<string, unknown>)\n\n const { serverUrl } = await setupAndServe({\n ...parsed,\n port: parsed.port ?? DEFAULT_PORT,\n silent: false,\n })\n\n // Best-effort self-update (detached, applies next launch). Runs\n // after the server is listening so the bounded probe can't delay it.\n void runSelfUpdate({ selfUpdate: args[\"self-update\"] !== false })\n\n // Best-effort ColBERT semantic-search provision + background index of\n // the launch cwd (if a git repo). Opt-IN via --search (no-op otherwise);\n // never blocks launch, never throws.\n void provisionAndIndexColbert()\n\n // Surface a terminally-failed semantic index to the HUMAN (see the note\n // in claude.ts). Fire-and-forget; lexical search still works.\n void colbertDegradedWarning()\n .then((warning) => {\n if (warning) process.stderr.write(`${warning}\\n`)\n })\n .catch(() => {})\n\n // Ready one tree-sitter worker in the background so the first code search\n // avoids WASM/grammar initialization. One worker keeps launch CPU bounded;\n // demand grows the pool lazily. Opt out with GH_ROUTER_DISABLE_TS_POOL_WARMUP=1.\n void warmTreeSitterPool()\n\n // Best-effort: keep the machine awake while the proxy serves (win32\n // default-on; opt out with GH_ROUTER_DISABLE_KEEP_AWAKE=1). Holds a\n // SetThreadExecutionState assertion via a persistent PowerShell\n // helper. Self-registers its own SIGINT/SIGTERM/exit reaper — load-\n // bearing here, because `start` has no launchChild/onShutdown.\n startKeepAwake()\n\n // Best-effort: materialize the browser extension + bridge into the\n // stable app-dir and stamp the running version, so a one-time \"Load\n // unpacked\" survives npx/bunx upgrades. Gated on --browse; never\n // blocks launch, never throws.\n if (browserToolsEnabled()) {\n void provisionBrowserAssets().catch((err) =>\n consola.debug(\"Browser extension provisioning failed:\", err),\n )\n }\n\n if (args.cc) generateClaudeCodeCommand(serverUrl, args.model)\n if (args.cx) generateCodexCommand(serverUrl, args.model)\n\n consola.box(\n `🌐 Usage Viewer: https://animeshkundu.github.io/github-router/dashboard.html?endpoint=${serverUrl}/usage`,\n )\n },\n})\n"],"mappings":";;;;;;;;AAKA,SAAS,WAAsB;CAC7B,MAAM,EAAE,UAAU,QAAQA;CAE1B,IAAI,aAAa,SAAS;EAExB,IAAI,IAAI,OAAO;GACb,IAAI,IAAI,MAAM,SAAS,KAAK,GAAG,OAAO;GACtC,IAAI,IAAI,MAAM,SAAS,MAAM,GAAG,OAAO;GACvC,IAAI,IAAI,MAAM,SAAS,MAAM,GAAG,OAAO;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AAC;EAKjB,mBAAwB;EAOxB,eAAe;EAMf,IAAI,oBAAoB,GACtB,uBAA4B,CAAC,CAAC,OAAO,QACnC,QAAQ,MAAM,0CAA0C,GAAG,CAC7D;EAGF,IAAI,KAAK,IAAI,0BAA0B,WAAW,KAAK,KAAK;EAC5D,IAAI,KAAK,IAAI,qBAAqB,WAAW,KAAK,KAAK;EAEvD,QAAQ,IACN,yFAAyF,UAAU,OACrG;CACF;AACF,CAAC"}
1
+ {"version":3,"file":"start-D7RcHG8T.js","names":["process"],"sources":["../src/lib/shell.ts","../src/start.ts"],"sourcesContent":["import process from \"node:process\"\n\ntype ShellName = \"bash\" | \"zsh\" | \"fish\" | \"powershell\" | \"cmd\" | \"sh\"\ntype EnvVars = Record<string, string | undefined>\n\nfunction getShell(): ShellName {\n const { platform, env } = process\n\n if (platform === \"win32\") {\n // Git Bash / MSYS2 / Cygwin set SHELL even on Windows\n if (env.SHELL) {\n if (env.SHELL.endsWith(\"zsh\")) return \"zsh\"\n if (env.SHELL.endsWith(\"fish\")) return \"fish\"\n if (env.SHELL.endsWith(\"bash\")) return \"bash\"\n return \"sh\"\n }\n\n // Windows PowerShell 5.x sets this\n if (env.POWERSHELL_DISTRIBUTION_CHANNEL) return \"powershell\"\n\n // PowerShell (both 5.x and 7+/pwsh) adds user-scoped module paths\n // at runtime. The system-level PSModulePath in CMD lacks these paths.\n if (env.PSModulePath) {\n const lower = env.PSModulePath.toLowerCase()\n if (\n lower.includes(\"documents\\\\powershell\")\n || lower.includes(\"documents\\\\windowspowershell\")\n ) {\n return \"powershell\"\n }\n }\n\n return \"cmd\"\n }\n\n const shellPath = env.SHELL\n if (shellPath) {\n if (shellPath.endsWith(\"zsh\")) return \"zsh\"\n if (shellPath.endsWith(\"fish\")) return \"fish\"\n if (shellPath.endsWith(\"bash\")) return \"bash\"\n }\n\n return \"sh\"\n}\n\nfunction quotePosixValue(value: string): string {\n return `'${value.replace(/'/g, \"'\\\\''\")}'`\n}\n\nfunction quotePowerShellValue(value: string): string {\n return `'${value.replace(/'/g, \"''\")}'`\n}\n\n/**\n * Generates a copy-pasteable script to set multiple environment variables\n * and run a subsequent command.\n * @param {EnvVars} envVars - An object of environment variables to set.\n * @param {string} commandToRun - The command to run after setting the variables.\n * @returns {string} The formatted script string.\n */\nexport function generateEnvScript(\n envVars: EnvVars,\n commandToRun: string = \"\",\n): string {\n const shell = getShell()\n const filteredEnvVars = Object.entries(envVars).filter(\n ([, value]) => value !== undefined,\n ) as Array<[string, string]>\n\n let commandBlock: string\n\n switch (shell) {\n case \"powershell\": {\n commandBlock = filteredEnvVars\n .map(([key, value]) => `$env:${key} = ${quotePowerShellValue(value)}`)\n .join(\"; \")\n break\n }\n case \"cmd\": {\n commandBlock = filteredEnvVars\n .map(([key, value]) => `set \"${key}=${value}\"`)\n .join(\" & \")\n break\n }\n case \"fish\": {\n commandBlock = filteredEnvVars\n .map(([key, value]) => `set -gx ${key} ${quotePosixValue(value)}`)\n .join(\"; \")\n break\n }\n default: {\n // bash, zsh, sh\n const assignments = filteredEnvVars\n .map(([key, value]) => `${key}=${quotePosixValue(value)}`)\n .join(\" \")\n commandBlock = filteredEnvVars.length > 0 ? `export ${assignments}` : \"\"\n break\n }\n }\n\n if (commandBlock && commandToRun) {\n const separator =\n shell === \"cmd\" ? \" & \" : shell === \"powershell\" ? \"; \" : \" && \"\n return `${commandBlock}${separator}${commandToRun}`\n }\n\n return commandBlock || commandToRun\n}\n","#!/usr/bin/env node\n\nimport { defineCommand } from \"citty\"\nimport clipboard from \"clipboardy\"\nimport consola from \"consola\"\n\nimport { generateEnvScript } from \"./lib/shell\"\nimport { DEFAULT_CODEX_MODEL, DEFAULT_PORT } from \"./lib/port\"\nimport { provisionBrowserAssets } from \"./lib/browser-mcp/provision\"\nimport { browserToolsEnabled } from \"./lib/mcp-capabilities\"\nimport { colbertDegradedWarning, provisionAndIndexColbert } from \"./lib/colbert\"\nimport { startKeepAwake } from \"./lib/keep-awake\"\nimport { warmTreeSitterPool } from \"./lib/tree-sitter-pool/pool\"\nimport {\n getClaudeCodeEnvVars,\n getCodexEnvVars,\n parseSharedArgs,\n setupAndServe,\n sharedServerArgs,\n} from \"./lib/server-setup\"\nimport { runSelfUpdate } from \"./lib/self-update\"\n\nfunction printAndCopyCommand(command: string, label: string): void {\n consola.box(`${label}\\n\\n${command}`)\n try {\n clipboard.writeSync(command)\n consola.success(`Copied ${label} command to clipboard!`)\n } catch {\n consola.warn(\"Failed to copy to clipboard. Copy the command above manually.\")\n }\n}\n\nfunction generateClaudeCodeCommand(serverUrl: string, model?: string) {\n const envVars = getClaudeCodeEnvVars(serverUrl, model)\n const command = generateEnvScript(envVars, \"claude --dangerously-skip-permissions\")\n printAndCopyCommand(command, \"Claude Code\")\n}\n\nfunction generateCodexCommand(serverUrl: string, model?: string) {\n const codexModel = model ?? DEFAULT_CODEX_MODEL\n const envVars = getCodexEnvVars(serverUrl)\n const command = generateEnvScript(envVars, `codex -m ${codexModel}`)\n printAndCopyCommand(command, \"Codex CLI\")\n}\n\nexport const start = defineCommand({\n meta: {\n name: \"start\",\n description: \"Start the github-router server\",\n },\n args: {\n ...sharedServerArgs,\n cc: {\n type: \"boolean\",\n default: false,\n description:\n \"Generate a command to launch Claude Code with Copilot API config\",\n },\n cx: {\n type: \"boolean\",\n default: false,\n description:\n \"Generate a command to launch Codex CLI with Copilot API config\",\n },\n model: {\n alias: \"m\",\n type: \"string\",\n description: \"Override the default model (used with --cc or --cx)\",\n },\n },\n async run({ args }) {\n const parsed = parseSharedArgs(args as unknown as Record<string, unknown>)\n\n const { serverUrl } = await setupAndServe({\n ...parsed,\n port: parsed.port ?? DEFAULT_PORT,\n silent: false,\n })\n\n // Best-effort self-update (detached, applies next launch). Runs\n // after the server is listening so the bounded probe can't delay it.\n void runSelfUpdate({ selfUpdate: args[\"self-update\"] !== false })\n\n // Best-effort ColBERT semantic-search provision + background index of\n // the launch cwd (if a git repo). Opt-IN via --search (no-op otherwise);\n // never blocks launch, never throws.\n void provisionAndIndexColbert()\n\n // Surface a terminally-failed semantic index to the HUMAN (see the note\n // in claude.ts). Fire-and-forget; lexical search still works.\n void colbertDegradedWarning()\n .then((warning) => {\n if (warning) process.stderr.write(`${warning}\\n`)\n })\n .catch(() => {})\n\n // Ready one tree-sitter worker in the background so the first code search\n // avoids WASM/grammar initialization. One worker keeps launch CPU bounded;\n // demand grows the pool lazily. Opt out with GH_ROUTER_DISABLE_TS_POOL_WARMUP=1.\n void warmTreeSitterPool()\n\n // Best-effort: keep the machine awake while the proxy serves (win32\n // default-on; opt out with GH_ROUTER_DISABLE_KEEP_AWAKE=1). Holds a\n // SetThreadExecutionState assertion via a persistent PowerShell\n // helper. Self-registers its own SIGINT/SIGTERM/exit reaper — load-\n // bearing here, because `start` has no launchChild/onShutdown.\n startKeepAwake()\n\n // Best-effort: materialize the browser extension + bridge into the\n // stable app-dir and stamp the running version, so a one-time \"Load\n // unpacked\" survives npx/bunx upgrades. Gated on --browse; never\n // blocks launch, never throws.\n if (browserToolsEnabled()) {\n void provisionBrowserAssets().catch((err) =>\n consola.debug(\"Browser extension provisioning failed:\", err),\n )\n }\n\n if (args.cc) generateClaudeCodeCommand(serverUrl, args.model)\n if (args.cx) generateCodexCommand(serverUrl, args.model)\n\n consola.box(\n `🌐 Usage Viewer: https://animeshkundu.github.io/github-router/dashboard.html?endpoint=${serverUrl}/usage`,\n )\n },\n})\n"],"mappings":";;;;;;;;AAKA,SAAS,WAAsB;CAC7B,MAAM,EAAE,UAAU,QAAQA;CAE1B,IAAI,aAAa,SAAS;EAExB,IAAI,IAAI,OAAO;GACb,IAAI,IAAI,MAAM,SAAS,KAAK,GAAG,OAAO;GACtC,IAAI,IAAI,MAAM,SAAS,MAAM,GAAG,OAAO;GACvC,IAAI,IAAI,MAAM,SAAS,MAAM,GAAG,OAAO;GACvC,OAAO;EACT;EAGA,IAAI,IAAI,iCAAiC,OAAO;EAIhD,IAAI,IAAI,cAAc;GACpB,MAAM,QAAQ,IAAI,aAAa,Y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CAA0C,GAAG,CAC7D;EAGF,IAAI,KAAK,IAAI,0BAA0B,WAAW,KAAK,KAAK;EAC5D,IAAI,KAAK,IAAI,qBAAqB,WAAW,KAAK,KAAK;EAEvD,QAAQ,IACN,yFAAyF,UAAU,OACrG;CACF;AACF,CAAC"}
@@ -33,6 +33,8 @@ const state = {
33
33
  kustoDatabase: null,
34
34
  cloudAgentEnabled: false,
35
35
  cloudAgentEnvironment: "prod",
36
+ workiqEnabled: false,
37
+ workiqWriteEnabled: false,
36
38
  humanlikeForce: "auto",
37
39
  sessionId: randomUUID(),
38
40
  machineId: randomBytes(32).toString("hex"),
@@ -64,4 +66,4 @@ Object.defineProperty(state, "peerMcpNonce", {
64
66
  //#endregion
65
67
  export { state as t };
66
68
 
67
- //# sourceMappingURL=state-CiwCLVDZ.js.map
69
+ //# sourceMappingURL=state-DzsaGHr9.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"state-DzsaGHr9.js","names":[],"sources":["../src/lib/state.ts"],"sourcesContent":["import { randomBytes, randomUUID } from \"node:crypto\"\n\nimport type { ModelsResponse } from \"~/services/copilot/get-models\"\nimport type { BluebirdMcpClient } from \"./bluebird-client\"\nimport type { LaunchProfileId } from \"./launch-profile\"\n\n/**\n * One authenticated `github-router claude` (or `serve`) launch's identity\n * and capability scope, keyed by `launchId` in `state.launchRegistry`.\n *\n * Replaces the earlier scalar `state.peerMcpNonce` assumption — a single\n * process-global nonce cannot express \"which profile is this caller\", so\n * a concurrent fast + standard launch (or a reconnect) had no way to keep\n * their identities from being interchangeable. Each entry carries BOTH\n * credentials a launch presents on the wire:\n *\n * - `nonce` — the `/mcp` bearer (Streamable HTTP `Authorization` header).\n * - `secret` — the `/v1/messages` identity-preflight bearer, deliberately\n * a SEPARATE credential from `nonce` so leaking one surface's token\n * (say, via a client log) does not also authenticate the other.\n *\n * `allowedGroups` / `allowedPersonas` are the narrowing declaration for\n * scoped MCP surfaces: `undefined` means UNRESTRICTED (the standard/BYO\n * launch shape today), and a concrete `ReadonlySet` is a restricted profile's\n * hard allow-list. This module only stores and looks up the declaration;\n * enforcing it against `tools/list` / `tools/call` is the MCP route\n * handler's job.\n */\nexport interface LaunchRegistryEntry {\n /** Opaque per-launch id. Primary key into `state.launchRegistry`. */\n launchId: string\n /** `/mcp` Streamable HTTP bearer for this launch. */\n nonce: string\n /**\n * Optional lead-only `/mcp` bearer for fast profile.\n * Grants access to lead-only tools such as `astra`.\n */\n leadPeersNonce?: string\n /** `/v1/messages` identity-preflight bearer for this launch. */\n secret: string\n /** Which launch profile authenticated this entry. */\n profileId: LaunchProfileId\n /** Scoped MCP group allow-list. `undefined` = unrestricted. */\n allowedGroups?: ReadonlySet<string>\n /** Persona (peers-group) tool-name allow-list. `undefined` = unrestricted. */\n allowedPersonas?: ReadonlySet<string>\n /**\n * The client's own conversation id, learned from `x-claude-code-session-id`\n * on this launch's `/v1/messages` traffic.\n *\n * `/mcp` has no conversation header of its own, so a local consult issued\n * from an MCP tool call has nothing to key prompt-cache routing on. The\n * lead's `/v1/messages` requests are the one channel that carries the id,\n * and the launch registry is the shared place the messages route and the MCP\n * route both hold. Latest value wins: `/clear` starts a new conversation and\n * the stale id would otherwise follow the session forever.\n */\n sessionId?: string\n createdAt: number\n}\n\n/**\n * Registry key backing the `state.peerMcpNonce` back-compat accessor\n * below. Not a real launch id (no `registerLaunch` caller ever produces\n * this string), so it can never collide with a genuine per-launch UUID.\n */\nconst DEFAULT_LAUNCH_ID = \"__default__\"\n\nexport interface State {\n githubToken?: string\n copilotToken?: string\n /**\n * GitHub login of `githubToken`, resolved once at setup for the\n * launch summary. Display-only; auth decisions never read it.\n */\n githubUserLogin?: string\n\n /**\n * Where `githubToken` came from, which decides whether the proxy may\n * re-read it from disk.\n *\n * `\"file\"` — read from `PATHS.GITHUB_TOKEN_PATH`. A re-read is allowed, so\n * an out-of-band `github-router auth` heals a running proxy without a\n * restart.\n *\n * `\"explicit\"` — supplied by the operator via `--github-token` / `GH_TOKEN`.\n * The file is NEVER read on this path: silently replacing a\n * caller-supplied credential with whatever happens to be on disk would\n * override an explicit instruction. It also means \"run `github-router\n * auth`\" is false advice for this source — the remediation is to replace\n * the supplied value.\n */\n githubTokenSource?: \"file\" | \"explicit\"\n\n /**\n * Monotonic counter bumped on every SUCCESSFUL Copilot token exchange.\n *\n * This is the retry criterion for `tryRefreshAndRetry`, and it is\n * deliberately not \"did the token string change\": two consecutive\n * successful exchanges were observed returning an identical token, so a\n * string comparison would silently suppress legitimate retries. Nor is it\n * the refresh's own verdict — with requests A and B both holding a stale\n * token, A can refresh while B's later 401 is cooled down to a no-op, and\n * a verdict of \"nothing happened\" would fail B even though a good token is\n * already in `copilotToken`. Comparing generations answers the question\n * each request actually has: \"is what is in state now different from what\n * I already tried?\"\n */\n copilotTokenGeneration: number\n\n /**\n * Wall-clock ms after which `copilotToken` should be refreshed — already\n * skew-adjusted, so the per-request check is a plain `Date.now() >=` compare.\n *\n * Derived from the exchange's `refresh_in` (a DURATION) and never from its\n * absolute `expires_at`. A local clock running ahead of GitHub's would make\n * an absolute timestamp look already-past on a brand-new token and drive a\n * refresh storm; a duration is immune, because it is anchored to the same\n * clock that later reads it.\n */\n copilotTokenRefreshAt?: number\n\n /**\n * Second, WRITE-capable GitHub token for the first-mate\n * agent-orchestration surface (`--agents`). Minted by a separate\n * device-flow login against the GitHub CLI's OAuth client\n * (`GITHUB_AGENT_CLIENT_ID`, scopes `repo workflow read:org`) and\n * stored at `PATHS.GITHUB_AGENT_TOKEN_PATH`, apart from `githubToken`\n * (the Copilot App token, read:user). The first-mate GitHub service\n * layer uses this for ALL its calls (reads included, so it also works\n * on private repos). Undefined until the agent login has run.\n */\n githubAgentToken?: string\n\n accountType: string\n copilotApiUrl?: string\n models?: ModelsResponse\n vsCodeVersion?: string\n copilotVersion?: string\n\n manualApprove: boolean\n rateLimitWait: boolean\n showToken: boolean\n extendedBetas: boolean\n\n /**\n * Opt-in flag for the browser-control MCP tools (`browser_*`). Set by\n * `setupAndServe` from the `--browse` CLI flag or\n * `GH_ROUTER_ENABLE_BROWSE=1` env var. When false, all `browser_*`\n * tools are dropped from `tools/list` AND `tools/call` returns\n * -32601 — same defense-in-depth pattern as `workerToolsEnabled()` /\n * `standInToolEnabled()`. See `browserToolsEnabled()` in\n * `src/routes/mcp/handler.ts`.\n */\n browseEnabled: boolean\n\n /**\n * Opt-in flag for the fleet session-control MCP tools (`mcp__fleet__*`).\n * Set by `setupAndServe` from the `--fleet` CLI flag or\n * `GH_ROUTER_ENABLE_FLEET=1` env var. When false, all fleet tools are\n * dropped from `tools/list` AND `tools/call` returns -32601 — same\n * defense-in-depth pattern as `workerToolsEnabled()` /\n * `standInToolEnabled()`. See `fleetToolsEnabled()` in\n * `src/lib/mcp-capabilities.ts`.\n */\n fleetEnabled: boolean\n\n /**\n * Opt-in flag for the first-mate agent-orchestration MCP tools\n * (`mcp__first-mate__*`) and the in-process GitHub cloud-agent driving\n * layer. Set by `setupAndServe` from the `--agents` CLI flag or\n * `GH_ROUTER_ENABLE_AGENTS=1`. When false, the first-mate tools are\n * dropped from `tools/list` AND `tools/call` returns -32601 — same\n * defense-in-depth pattern as `fleetToolsEnabled()`. Additionally\n * requires `state.githubAgentToken` present (the write login), so the\n * surface is invisible rather than 401-ing when unauthenticated. See\n * `agentToolsEnabled()` in `src/lib/mcp-capabilities.ts`.\n */\n agentsEnabled: boolean\n\n /**\n * When true, --power-browse was passed (or GH_ROUTER_ENABLE_POWER_BROWSE=1\n * is set). Exposes the FULL browser MCP surface (~18 tools) on /mcp,\n * including the L0/L1 primitives that hand DOM details (refs,\n * bboxes, role/name dumps) to the lead model. Default --browse mode\n * exposes only the 6 lead-model tools (act, observe, extract,\n * navigate, screenshot, open_tab). Always implies browseEnabled.\n */\n powerBrowseEnabled: boolean\n\n /**\n * Opt-in flag for ColBERT/colgrep semantic code search. Set by\n * `setupAndServe` from the `--search` CLI flag or\n * `GH_ROUTER_ENABLE_SEMANTIC_SEARCH=1` env var. When false, no colgrep\n * binary/model is provisioned, no workspace is indexed, and the `code`\n * MCP tool serves lexical results (with `lexical-fallback` source when\n * semantic mode was requested). See `semanticSearchOptedIn()` in\n * `src/lib/colbert/index.ts`; `GH_ROUTER_DISABLE_SEMANTIC_SEARCH=1`\n * hard-disables regardless of this flag.\n */\n searchEnabled: boolean\n\n /**\n * Opt-in flag for Bluebird Azure DevOps code search. Set by\n * `setupAndServe` from the `--bluebird` CLI flag or\n * `GH_ROUTER_ENABLE_BLUEBIRD=1` env var. When true, the `code` MCP\n * tool routes `semantic`/`lexical` modes through the Bluebird MCP\n * server. This flag is independent from `searchEnabled`, which controls\n * local ColBERT provisioning; `exact`/`regex`/`ast` stay local.\n * See `src/lib/bluebird-client.ts`.\n */\n bluebirdEnabled: boolean\n\n /** Last connected Bluebird client, retained only for compatibility and\n * diagnostics. Client selection is owned by the Bluebird runtime manager. */\n bluebirdClient: BluebirdMcpClient | null\n\n /** Resolved Bluebird scope (org/project/repos/branch), for logging and\n * the `x-mcp-ec-*` headers baked into the client. */\n bluebirdOrganization: string | null\n bluebirdProject: string | null\n bluebirdRepositories: Array<string>\n bluebirdBranch: string | null\n\n /**\n * Azure DevOps remote MCP group (`mcp__ado__*`). Enabled by `--ado`, by\n * `GH_ROUTER_ENABLE_ADO=1`, or automatically when the workspace's git\n * remotes resolve to an Azure DevOps repository. See\n * `src/lib/azure-mcp-flags.ts` for the precedence and the trust argument.\n */\n adoEnabled: boolean\n /** Organization whose `https://mcp.dev.azure.com/{org}` endpoint is used. */\n adoOrganization: string | null\n /**\n * `X-MCP-Toolsets` selection. The single entry `\"all\"` means \"send no\n * header\". Empty only while the group is off.\n */\n adoToolsets: Array<string>\n /**\n * Send `X-MCP-Readonly: true`. True unless `--ado-write` was passed. Never\n * cleared by discovery — a git remote can turn this group on but can never\n * widen it to writes.\n */\n adoReadOnly: boolean\n\n /**\n * Kusto (Azure Data Explorer) MCP group (`mcp__kusto__*`). Turned on by the\n * operator's `--kusto` flag, by a named cluster, or automatically when the\n * workspace's git remotes resolve to an Azure DevOps repository. Discovery\n * turns the GROUP on and never supplies a cluster: the model names one per\n * call, and the operator's own cluster access bounds the reach.\n */\n kustoEnabled: boolean\n /**\n * Default cluster for calls that do not name one, or null. Null no longer\n * turns the group off: every kusto tool takes its own `cluster`, so a launch\n * with no default still works, it just requires the argument.\n */\n kustoCluster: string | null\n kustoDatabase: string | null\n\n /**\n * Cloud Agent Job API v2 MCP group (`mcp__cloudagent__*`): hand work to a cloud\n * coding agent running against an Azure DevOps repository.\n *\n * Enabled by `--cloudagent`, by `GH_ROUTER_ENABLE_CLOUDAGENT=1`, or automatically\n * when the workspace's git remotes resolve to an Azure DevOps repository.\n * Discovery enables the whole group, write tools included, matching the ADO,\n * Kusto and Bluebird groups; `--no-cloudagent` remains the operator's veto.\n */\n cloudAgentEnabled: boolean\n /** `prod` or `ppe`, normalized by `resolveCloudAgentFlags()` at launch. */\n cloudAgentEnvironment: string\n\n /**\n * Work IQ MCP group (`mcp__workiq__*`): Microsoft 365 research through the\n * hosted Work IQ service.\n *\n * Off by default and never auto-enabled: the group needs a signed-in Work IQ\n * account, and turning it on without one would advertise an empty server.\n * Enabled by `--workiq` or `GH_ROUTER_ENABLE_WORKIQ=1`.\n *\n * `setupAndServe` clears it back to false when the launch-time provisioning\n * pass cannot reach the service or has no usable token, so the group is\n * advertised only when the snapshot behind it is real.\n */\n workiqEnabled: boolean\n /**\n * Exposes the four mutating Work IQ tools (`create_entity`, `update_entity`,\n * `delete_entity`, `do_action`). The default surface is the eight read-only\n * tools; `--workiq-write` widens the snapshot to whatever the live server\n * actually advertises.\n */\n workiqWriteEnabled: boolean\n\n /**\n * Humanlike pacing override:\n * \"on\" - --humanlike CLI flag or GH_ROUTER_HUMANLIKE=1 env;\n * inject Beta-distributed inter-action delays, Bezier\n * mouse paths, per-keystroke jitter, scroll chunking\n * into every browser_* action dispatch.\n * \"off\" - GH_ROUTER_BROWSER_NO_HUMANLIKE=1; HARD disable, wins\n * over \"on\" so tests are reproducible.\n * \"auto\" - default; pacing engages only when bot-challenge\n * detection fires (Phase 4-future).\n *\n * Lead model never sees this state — it's an internal concern.\n */\n humanlikeForce: \"on\" | \"off\" | \"auto\"\n\n // Rate limiting configuration\n rateLimitSeconds?: number\n lastRequestTimestamp?: number\n\n // Persistent session identifiers to match VS Code fingerprint\n sessionId: string\n machineId: string\n\n /**\n * Keyed per-launch registry for the loopback `/mcp` endpoint AND the\n * `/v1/messages` identity preflight. Set by the `claude` subcommand\n * (via `registerLaunch` in `./launch-registry`) after `setupAndServe`\n * and before spawning Claude Code; removed by the launch's own\n * cleanup. When empty, `/mcp` rejects all requests — closes the\n * loopback-no-auth gap (DNS rebinding, malicious browser-ext native\n * messaging, sibling-process probe) exactly as the old scalar nonce\n * did when unset.\n *\n * Multiple entries coexist for concurrent fast/standard launches (or a\n * launch plus a reconnect); each is looked up by its OWN nonce/secret,\n * so two launches' authenticated identities never cross.\n */\n launchRegistry: Map<string, LaunchRegistryEntry>\n\n /**\n * @deprecated Back-compat accessor over the registry's DEFAULT_LAUNCH_ID\n * entry (profileId \"standard\", unrestricted `allowedGroups`/\n * `allowedPersonas`) — defined below via `Object.defineProperty`, not a\n * real stored field. Reading returns that entry's nonce; writing creates\n * or updates it (or deletes it on `undefined`). Exists so single-launch\n * call sites and tests that already do `state.peerMcpNonce = NONCE`\n * keep working unmodified while `checkAuth` and the identity preflight\n * consult the real keyed registry underneath. New code should call\n * `registerLaunch` / `findLaunchByNonce` / `findLaunchBySecret` from\n * `./launch-registry` directly instead of reading/writing this field.\n */\n peerMcpNonce?: string\n\n /**\n * Set by `github-router serve` (a single machine-wide control plane serving\n * many repos). When true, repo-scoped worker tools require an explicit/So-derived\n * `workspace` and must NOT silently default to the proxy launch cwd.\n */\n serveMode?: boolean\n}\n\nexport const state: State = {\n accountType: \"enterprise\",\n copilotTokenGeneration: 0,\n manualApprove: false,\n rateLimitWait: false,\n showToken: false,\n extendedBetas: false,\n browseEnabled: false,\n fleetEnabled: false,\n agentsEnabled: false,\n powerBrowseEnabled: false,\n searchEnabled: false,\n bluebirdEnabled: false,\n bluebirdClient: null,\n bluebirdOrganization: null,\n bluebirdProject: null,\n bluebirdRepositories: [],\n bluebirdBranch: null,\n adoEnabled: false,\n adoOrganization: null,\n adoToolsets: [],\n adoReadOnly: true,\n kustoEnabled: false,\n kustoCluster: null,\n kustoDatabase: null,\n cloudAgentEnabled: false,\n cloudAgentEnvironment: \"prod\",\n workiqEnabled: false,\n workiqWriteEnabled: false,\n humanlikeForce: \"auto\",\n sessionId: randomUUID(),\n machineId: randomBytes(32).toString(\"hex\"),\n launchRegistry: new Map(),\n}\n\n// `peerMcpNonce` is not a plain data field — it's a live view onto\n// `state.launchRegistry.get(DEFAULT_LAUNCH_ID)`. Defined via\n// `Object.defineProperty` (rather than a class) so `state` stays the\n// plain object literal every existing importer already destructures /\n// mutates directly.\nObject.defineProperty(state, \"peerMcpNonce\", {\n enumerable: true,\n configurable: true,\n get(): string | undefined {\n return state.launchRegistry.get(DEFAULT_LAUNCH_ID)?.nonce\n },\n set(value: string | undefined) {\n if (value === undefined) {\n state.launchRegistry.delete(DEFAULT_LAUNCH_ID)\n return\n }\n const existing = state.launchRegistry.get(DEFAULT_LAUNCH_ID)\n state.launchRegistry.set(DEFAULT_LAUNCH_ID, {\n launchId: DEFAULT_LAUNCH_ID,\n nonce: value,\n // A caller that only ever touches `peerMcpNonce` exposes MCP only and has\n // no Messages identity secret.\n // Never reuse the MCP bearer across surfaces: an empty secret cannot match\n // any non-empty custom header, while registered Claude launches always use\n // `registerLaunch` with independently generated credentials.\n secret: existing?.secret ?? \"\",\n profileId: existing?.profileId ?? \"standard\",\n allowedGroups: existing?.allowedGroups,\n allowedPersonas: existing?.allowedPersonas,\n createdAt: existing?.createdAt ?? Date.now(),\n })\n },\n})\n"],"mappings":";;;;;;;AAkEA,MAAM,oBAAoB;AAkS1B,MAAa,QAAe;CAC1B,aAAa;CACb,wBAAwB;CACxB,eAAe;CACf,eAAe;CACf,WAAW;CACX,eAAe;CACf,eAAe;CACf,cAAc;CACd,eAAe;CACf,oBAAoB;CACpB,eAAe;CACf,iBAAiB;CACjB,gBAAgB;CAChB,sBAAsB;CACtB,iBAAiB;CACjB,sBAAsB,CAAC;CACvB,gBAAgB;CAChB,YAAY;CACZ,iBAAiB;CACjB,aAAa,CAAC;CACd,aAAa;CACb,cAAc;CACd,cAAc;CACd,eAAe;CACf,mBAAmB;CACnB,uBAAuB;CACvB,eAAe;CACf,oBAAoB;CACpB,gBAAgB;CAChB,WAAW,WAAW;CACtB,WAAW,YAAY,EAAE,CAAC,CAAC,SAAS,KAAK;CACzC,gCAAgB,IAAI,IAAI;AAC1B;AAOA,OAAO,eAAe,OAAO,gBAAgB;CAC3C,YAAY;CACZ,cAAc;CACd,MAA0B;EACxB,OAAO,MAAM,eAAe,IAAI,iBAAiB,CAAC,EAAE;CACtD;CACA,IAAI,OAA2B;EAC7B,IAAI,UAAU,KAAA,GAAW;GACvB,MAAM,eAAe,OAAO,iBAAiB;GAC7C;EACF;EACA,MAAM,WAAW,MAAM,eAAe,IAAI,iBAAiB;EAC3D,MAAM,eAAe,IAAI,mBAAmB;GAC1C,UAAU;GACV,OAAO;GAMP,QAAQ,UAAU,UAAU;GAC5B,WAAW,UAAU,aAAa;GAClC,eAAe,UAAU;GACzB,iBAAiB,UAAU;GAC3B,WAAW,UAAU,aAAa,KAAK,IAAI;EAC7C,CAAC;CACH;AACF,CAAC"}
@@ -1,4 +1,4 @@
1
- import { r as BALANCED_PROFILE_MODELS, t as BALANCED_PROFILE_CONTRACT } from "./balanced-profile-contract-DtnTIBjL.js";
1
+ import { r as BALANCED_PROFILE_MODELS, t as BALANCED_PROFILE_CONTRACT } from "./balanced-profile-contract-Dm_usmw7.js";
2
2
  import { t as buildSelfCommand } from "./self-invocation-BtcGj-lY.js";
3
3
  import { s as isSubagentContext } from "./stop-gate-policy-Dx9c98_d.js";
4
4
  import { existsSync, readFileSync, readdirSync } from "node:fs";
@@ -92,6 +92,15 @@ const CHEAPEST_PROFILE_ADVISOR_EFFORT = "medium";
92
92
  const CHEAPEST_PROFILE_ORACLE_MODEL = CHEAPEST_PROFILE_MODELS.oracle;
93
93
  const CHEAPEST_PROFILE_ORACLE_EFFORT = "high";
94
94
  /**
95
+ * The Copilot model the prompt-rewrite hooks dispatch on.
96
+ *
97
+ * Separate from `advisorModel` because the two are only incidentally the same
98
+ * tier today: a rewrite is always a Copilot call, so a family member whose
99
+ * consultants move to another transport must not drag the rewrite along with
100
+ * them (see `cheaplocal-profile-contract.ts`).
101
+ */
102
+ const CHEAPEST_PROFILE_REWRITE_MODEL = CHEAPEST_PROFILE_MODELS.advisor;
103
+ /**
95
104
  * Synthesized MCP consultant tools for `-m cheapest`: Oracle only, like
96
105
  * `-m cheap` (never `astra`).
97
106
  */
@@ -131,6 +140,13 @@ const CHEAPEST_PROFILE_CONTRACT = Object.freeze({
131
140
  advisorEffort: CHEAPEST_PROFILE_ADVISOR_EFFORT,
132
141
  oracleModel: CHEAPEST_PROFILE_ORACLE_MODEL,
133
142
  oracleEffort: CHEAPEST_PROFILE_ORACLE_EFFORT,
143
+ rewriteModel: CHEAPEST_PROFILE_REWRITE_MODEL,
144
+ /**
145
+ * Where the Advisor and Oracle are served. `cheapest` and `cheapest2` both
146
+ * consult Copilot; `cheaplocal` is the family member that consults the local
147
+ * endpoint. Consumers branch on this value, never on a profile id.
148
+ */
149
+ consultTransport: "copilot",
134
150
  synthesizedPeers: CHEAPEST_PROFILE_SYNTHESIZED_PEERS,
135
151
  delegationGraph: CHEAPEST_PROFILE_DELEGATION_GRAPH
136
152
  });
@@ -171,6 +187,8 @@ const CHEAPEST2_PROFILE_ADVISOR_CLIENT_MODEL = CHEAPEST2_PROFILE_MODELS.advisor;
171
187
  */
172
188
  const CHEAPEST2_PROFILE_ADVISOR_EFFORT = "high";
173
189
  const CHEAPEST2_PROFILE_ORACLE_MODEL = CHEAPEST2_PROFILE_MODELS.oracle;
190
+ /** The rewrite stays on this sibling's own Sol tier. */
191
+ const CHEAPEST2_PROFILE_REWRITE_MODEL = CHEAPEST2_PROFILE_MODELS.advisor;
174
192
  /** The `-m cheapest2` aggregate: the base contract with only the Sol
175
193
  * identities and the Advisor effort replaced. */
176
194
  const CHEAPEST2_PROFILE_CONTRACT = Object.freeze({
@@ -180,7 +198,8 @@ const CHEAPEST2_PROFILE_CONTRACT = Object.freeze({
180
198
  advisorModel: CHEAPEST2_PROFILE_ADVISOR_MODEL,
181
199
  advisorClientModel: CHEAPEST2_PROFILE_ADVISOR_CLIENT_MODEL,
182
200
  advisorEffort: CHEAPEST2_PROFILE_ADVISOR_EFFORT,
183
- oracleModel: CHEAPEST2_PROFILE_ORACLE_MODEL
201
+ oracleModel: CHEAPEST2_PROFILE_ORACLE_MODEL,
202
+ rewriteModel: CHEAPEST2_PROFILE_REWRITE_MODEL
184
203
  });
185
204
  //#endregion
186
205
  //#region src/lib/local-profile-contract.ts
@@ -265,7 +284,14 @@ const LOCAL_PROFILE_CONTRACT = Object.freeze({
265
284
  oracleModel: LOCAL_PROFILE_ORACLE_MODEL,
266
285
  oracleEffort: CHEAPEST_PROFILE_ORACLE_EFFORT,
267
286
  synthesizedPeers: CHEAPEST_PROFILE_SYNTHESIZED_PEERS,
268
- delegationGraph: CHEAPEST_PROFILE_DELEGATION_GRAPH
287
+ delegationGraph: CHEAPEST_PROFILE_DELEGATION_GRAPH,
288
+ /**
289
+ * The consultants here are Copilot dispatches even though the LEAD is local:
290
+ * `local`'s Oracle persona and `local2`'s curated Advisor both run on the
291
+ * inherited Copilot slug. Declared so the cheapest family's transport field
292
+ * is present across every contract a curated-Advisor call site can hold.
293
+ */
294
+ consultTransport: "copilot"
269
295
  });
270
296
  /**
271
297
  * The `-m local2` Advisor: `gpt-6.1-sol` on Copilot, `high`, at the cheapest
@@ -345,24 +371,127 @@ const BALANCED2_PROFILE_CONTRACT = Object.freeze({
345
371
  oracleModel: BALANCED2_PROFILE_ORACLE_MODEL
346
372
  });
347
373
  //#endregion
374
+ //#region src/lib/cheaplocal-profile-contract.ts
375
+ /**
376
+ * Fixed identities for the literal `github-router claude -m cheaplocal` profile.
377
+ *
378
+ * `cheaplocal` is `cheapest` with its two consultants moved off Copilot: the
379
+ * Advisor and the Oracle are served by the local Anthropic-Messages endpoint
380
+ * (the same one `-m local` / `-m local2` point their main loop at) instead of a
381
+ * Copilot model.
382
+ *
383
+ * Everything else is inherited verbatim from `CHEAPEST_PROFILE_CONTRACT`:
384
+ * the `gpt-6-luna`/max lead, the Luna natives, the bare-slug 200K window, the
385
+ * curated 24K Advisor digest, the Oracle-only peer set, the three-agent surface
386
+ * and the delegation graph.
387
+ *
388
+ * Nothing in this file may characterize the local model. The endpoint is the
389
+ * only fact the profile carries about it, so no name, window, price or speed
390
+ * claim is made anywhere: the contract names a bare SLUG (`opus`) and a
391
+ * transport, and prose that reaches the model describes the consultants by
392
+ * transport ("the local model"), never by identity. The one effort the consult
393
+ * requests (`LOCAL_CONSULT_EFFORT`) is the operator's setting, not a property
394
+ * of the model.
395
+ *
396
+ * Derived by spread rather than copied, so a field added to the cheapest family
397
+ * later is inherited here automatically and the declared deltas below are the
398
+ * only lines that can drift.
399
+ */
400
+ /**
401
+ * The one model id this profile sends to the local endpoint.
402
+ *
403
+ * Bare, like the `-m local` lead: the profile assumes nothing about which model
404
+ * answers, and the endpoint maps the id itself. It is deliberately the SAME id
405
+ * for the Advisor and the Oracle because a second spelling would imply a
406
+ * distinction the profile cannot observe.
407
+ */
408
+ const CHEAPLOCAL_CONSULT_MODEL = "opus";
409
+ /**
410
+ * The Copilot model the prompt-rewrite hooks run on. Under `cheaplocal` the
411
+ * consultants are local, but the rewrite is a Copilot dispatch and must stay
412
+ * inside the profile's `{sol, luna}` egress ceiling, so it keeps the base
413
+ * family's Sol rather than following `advisorModel` to the local slug.
414
+ */
415
+ const CHEAPLOCAL_PROFILE_REWRITE_MODEL = "gpt-5.6-sol";
416
+ const CHEAPLOCAL_PROFILE_MODELS = Object.freeze({
417
+ ...CHEAPEST_PROFILE_MODELS,
418
+ advisor: CHEAPLOCAL_CONSULT_MODEL,
419
+ oracle: CHEAPLOCAL_CONSULT_MODEL
420
+ });
421
+ const CHEAPLOCAL_PROFILE_NATIVE_MODELS = Object.freeze({
422
+ Explore: CHEAPLOCAL_PROFILE_MODELS.explore,
423
+ "General-Purpose": CHEAPLOCAL_PROFILE_MODELS["General-Purpose"],
424
+ reviewer: CHEAPLOCAL_PROFILE_MODELS.reviewer
425
+ });
426
+ const CHEAPLOCAL_PROFILE_ADVISOR_MODEL = CHEAPLOCAL_PROFILE_MODELS.advisor;
427
+ /**
428
+ * Client-visible Advisor identity. A LABEL, not the model that answers: the
429
+ * wire id sent to the endpoint is `CHEAPLOCAL_CONSULT_MODEL`, and nothing in
430
+ * this profile can observe which model receives it.
431
+ *
432
+ * It is deliberately not a model id at all, for two reasons. First, naming a
433
+ * model here would make the client UI claim that model is consulting, which the
434
+ * profile cannot know. Second, Claude Code resolves a RECOGNIZED model alias
435
+ * through its own registry before putting the value in the native Advisor
436
+ * tool's `model` field: `--advisor opus` arrives at the proxy as
437
+ * `claude-opus-5.5`, so an alias can never be a stable pin for the strict
438
+ * client-drift check. `local` is not a model alias, so it passes through
439
+ * verbatim.
440
+ */
441
+ const CHEAPLOCAL_PROFILE_ADVISOR_CLIENT_MODEL = "local";
442
+ /**
443
+ * The declared effort is inherited but never transmitted: the local transport
444
+ * sends one fixed `max` request (`LOCAL_CONSULT_EFFORT`) instead of the
445
+ * family's Copilot effort, so the field exists only so the family contract
446
+ * stays a complete object.
447
+ */
448
+ const CHEAPLOCAL_PROFILE_ADVISOR_EFFORT = CHEAPEST_PROFILE_CONTRACT.advisorEffort;
449
+ const CHEAPLOCAL_PROFILE_ORACLE_MODEL = CHEAPLOCAL_PROFILE_MODELS.oracle;
450
+ /** The `-m cheaplocal` aggregate: the base contract with the two consultants
451
+ * pointed at the local endpoint. */
452
+ const CHEAPLOCAL_PROFILE_CONTRACT = Object.freeze({
453
+ ...CHEAPEST_PROFILE_CONTRACT,
454
+ models: CHEAPLOCAL_PROFILE_MODELS,
455
+ nativeModels: CHEAPLOCAL_PROFILE_NATIVE_MODELS,
456
+ advisorModel: CHEAPLOCAL_PROFILE_ADVISOR_MODEL,
457
+ advisorClientModel: CHEAPLOCAL_PROFILE_ADVISOR_CLIENT_MODEL,
458
+ advisorEffort: CHEAPLOCAL_PROFILE_ADVISOR_EFFORT,
459
+ oracleModel: CHEAPLOCAL_PROFILE_ORACLE_MODEL,
460
+ rewriteModel: CHEAPLOCAL_PROFILE_REWRITE_MODEL,
461
+ consultTransport: "local"
462
+ });
463
+ //#endregion
348
464
  //#region src/lib/profile-family.ts
349
465
  /**
350
- * The `cheapest`/`cheapest2` and `balanced`/`balanced2` launch-profile families.
466
+ * The `cheapest`/`cheapest2`/`cheaplocal` and `balanced`/`balanced2`
467
+ * launch-profile families.
351
468
  *
352
469
  * The `-2` aliases are not separate tiers: each is its base profile with a
353
470
  * declared set of Sol identities replaced (`cheapest2`: Advisor + Oracle at
354
471
  * `gpt-6.1-sol`, Advisor effort `high`; `balanced2`: lead + reviewer at
355
472
  * `gpt-6.1-sol`, Oracle `grok-4.7`). Every consumer therefore asks the family
356
473
  * helpers below rather than comparing against one literal id, which is what
357
- * keeps the two siblings from drifting: a check written for `cheapest` covers
474
+ * keeps the siblings from drifting: a check written for `cheapest` covers
358
475
  * `cheapest2` by construction instead of needing a parallel branch.
359
476
  *
360
- * This module imports only the four contract modules — never
477
+ * `cheaplocal` is a third cheapest sibling, not a local-family member: its lead
478
+ * and natives stay on Copilot and only its two consultants move to the local
479
+ * endpoint. It joins the family because every lead/native/window decision is
480
+ * identical to `cheapest`; the transport difference rides on the contract's
481
+ * `consultTransport`, so consumers branch on data rather than on this id.
482
+ *
483
+ * This module imports only the five contract modules — never
361
484
  * `launch-profile.ts` — so it can be imported from anywhere in `src/lib`
362
485
  * without creating a cycle.
363
486
  */
364
487
  function isCheapestFamily(profileId) {
365
- return profileId === "cheapest" || profileId === "cheapest2";
488
+ return profileId === "cheapest" || profileId === "cheapest2" || profileId === "cheaplocal";
489
+ }
490
+ /** The one cheapest sibling whose consultants leave Copilot. The predicate
491
+ * form matters at call sites that must EXCLUDE the id: Pi rejects it, and a
492
+ * plain `boolean` would leave `CheapestProfileId` intact after the refusal. */
493
+ function isCheaplocalProfile(profileId) {
494
+ return profileId === "cheaplocal";
366
495
  }
367
496
  function isBalancedFamily(profileId) {
368
497
  return profileId === "balanced" || profileId === "balanced2";
@@ -371,9 +500,10 @@ function isLocalFamily(profileId) {
371
500
  return profileId === "local" || profileId === "local2";
372
501
  }
373
502
  /**
374
- * Every FIXED-ROSTER launch profile: `fast`, the cheap pair, both families,
375
- * and the local pair. These are the launches whose MCP surface, picker rows,
376
- * mirror purge and status line the router owns outright.
503
+ * Every FIXED-ROSTER launch profile: `fast`, the cheap pair, the three cheapest
504
+ * siblings, the balanced pair, and the local pair. These are the launches whose
505
+ * MCP surface, picker rows, mirror purge and status line the router owns
506
+ * outright.
377
507
  *
378
508
  * `max` is deliberately absent. It shares some of the same wiring, but it
379
509
  * has its own reviewer/roster path rather than the shared fast-style
@@ -385,6 +515,7 @@ const PINNED_PROFILE_IDS = /* @__PURE__ */ new Set([
385
515
  "cheap1m",
386
516
  "cheapest",
387
517
  "cheapest2",
518
+ "cheaplocal",
388
519
  "balanced",
389
520
  "balanced2",
390
521
  "local",
@@ -398,7 +529,9 @@ function isPinnedLaunchProfile(profileId) {
398
529
  * non-family launch still gets a complete, valid object rather than
399
530
  * `undefined`. */
400
531
  function cheapestContractFor(profileId) {
401
- return profileId === "cheapest2" ? CHEAPEST2_PROFILE_CONTRACT : CHEAPEST_PROFILE_CONTRACT;
532
+ if (profileId === "cheapest2") return CHEAPEST2_PROFILE_CONTRACT;
533
+ if (profileId === "cheaplocal") return CHEAPLOCAL_PROFILE_CONTRACT;
534
+ return CHEAPEST_PROFILE_CONTRACT;
402
535
  }
403
536
  /** The contract for a balanced-family profile (base fallback, as above). */
404
537
  function balancedContractFor(profileId) {
@@ -447,12 +580,15 @@ function displayModelName(modelId) {
447
580
  return MODEL_DISPLAY_NAMES[modelId] ?? modelId;
448
581
  }
449
582
  /**
450
- * The model the cheapest-family prompt rewrite runs on. Both siblings rewrite
451
- * with their own advisor-tier Sol, so one call site serves both and a future
452
- * tier only has to change its contract.
583
+ * The model the cheapest-family prompt rewrite runs on.
584
+ *
585
+ * Read from `rewriteModel`, NOT `advisorModel`: the rewrite is always a Copilot
586
+ * dispatch, so a sibling whose consultants moved to the local endpoint must not
587
+ * hand a local slug to it. One call site serves every member and a future tier
588
+ * only has to change its contract.
453
589
  */
454
590
  function cheapestRewriteModelFor(profileId) {
455
- return cheapestContractFor(profileId).advisorModel;
591
+ return cheapestContractFor(profileId).rewriteModel;
456
592
  }
457
593
  //#endregion
458
594
  //#region src/lib/cheapest-prompt-rewrite.ts
@@ -1308,6 +1444,6 @@ function buildStaticPack(workspace) {
1308
1444
  };
1309
1445
  }
1310
1446
  //#endregion
1311
- export { CHEAPEST_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_DEFAULT as A, LOCAL_PROFILE_LEAD_MODEL as C, CHEAPEST2_PROFILE_MODELS as D, LOCAL_PROFILE_TIER_MODELS as E, CHEAPEST_PROFILE_NATIVE_EFFORTS as F, CHEAPEST_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_MIN as M, CHEAPEST_PROFILE_MODELS as N, CHEAPEST_PROFILE_ADVISOR_CLIENT_MODEL as O, CHEAPEST_PROFILE_NATIVE_AGENT_NAMES as P, BALANCED2_PROFILE_MODELS as S, LOCAL_PROFILE_NATIVE_MODELS as T, isCheapestFamily as _, decidePromptSubmitV2 as a, local2AdvisorContract as b, CHEAPEST_REWRITE_EFFORT as c, runCheapestRewrite as d, balancedContractFor as f, isBalancedFamily as g, displayModelName as h, decidePromptSubmit as i, CHEAPEST_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_MAX as j, CHEAPEST_PROFILE_ADVISOR_MODEL as k, buildRebriefSystem as l, cheapestRewriteModelFor as m, PROMPT_STEER_GOAL as n, getPromptSearchTip as o, cheapestContractFor as p, buildPromptSubmitHookCommand as r, isNonTrivialPrompt as s, buildStaticPack as t, isCheapestRewriteDisabledEnv as u, isLocalFamily as v, LOCAL_PROFILE_NATIVE_AGENT_NAMES as w, localContractFor as x, isPinnedLaunchProfile as y };
1447
+ export { CHEAPEST_PROFILE_ADVISOR_MODEL as A, BALANCED2_PROFILE_MODELS as C, LOCAL_PROFILE_TIER_MODELS as D, LOCAL_PROFILE_NATIVE_MODELS as E, CHEAPEST_PROFILE_NATIVE_AGENT_NAMES as F, CHEAPEST_PROFILE_NATIVE_EFFORTS as I, CHEAPEST_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_MAX as M, CHEAPEST_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_MIN as N, CHEAPEST2_PROFILE_MODELS as O, CHEAPEST_PROFILE_MODELS as P, localContractFor as S, LOCAL_PROFILE_NATIVE_AGENT_NAMES as T, isCheapestFamily as _, decidePromptSubmitV2 as a, isPinnedLaunchProfile as b, CHEAPEST_REWRITE_EFFORT as c, runCheapestRewrite as d, balancedContractFor as f, isBalancedFamily as g, displayModelName as h, decidePromptSubmit as i, CHEAPEST_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_DEFAULT as j, CHEAPEST_PROFILE_ADVISOR_CLIENT_MODEL as k, buildRebriefSystem as l, cheapestRewriteModelFor as m, PROMPT_STEER_GOAL as n, getPromptSearchTip as o, cheapestContractFor as p, buildPromptSubmitHookCommand as r, isNonTrivialPrompt as s, buildStaticPack as t, isCheapestRewriteDisabledEnv as u, isCheaplocalProfile as v, LOCAL_PROFILE_LEAD_MODEL as w, local2AdvisorContract as x, isLocalFamily as y };
1312
1448
 
1313
- //# sourceMappingURL=static-context-pack-ChHuxBpk.js.map
1449
+ //# sourceMappingURL=static-context-pack-DvwLWlbe.js.map