github-router 0.3.357 → 0.3.367

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 (121) hide show
  1. package/dist/ado-tools-rysFZDws.js +1 -0
  2. package/dist/{aic-ledger-BuFrsGur.js → aic-ledger-_mvGW2Ev.js} +42 -7
  3. package/dist/aic-ledger-_mvGW2Ev.js.map +1 -0
  4. package/dist/{aic-statusline-settings-DBS9sEGC.js → aic-statusline-settings-B5EMMSFC.js} +2 -2
  5. package/dist/{aic-statusline-settings-DBS9sEGC.js.map → aic-statusline-settings-B5EMMSFC.js.map} +1 -1
  6. package/dist/{attribution-settings-D9PxJxkL.js → attribution-settings-wVzQvIdL.js} +188 -64
  7. package/dist/attribution-settings-wVzQvIdL.js.map +1 -0
  8. package/dist/{auth-DFawaLJU.js → auth-B3UvYB2r.js} +3 -3
  9. package/dist/{auth-DFawaLJU.js.map → auth-B3UvYB2r.js.map} +1 -1
  10. package/dist/browser-ext/manifest.json +1 -1
  11. package/dist/{check-usage-BkVEl-Su.js → check-usage-45vyaLfl.js} +4 -4
  12. package/dist/{check-usage-BkVEl-Su.js.map → check-usage-45vyaLfl.js.map} +1 -1
  13. package/dist/{claude-BTYQjK-K.js → claude-B3pIageM.js} +89 -41
  14. package/dist/claude-B3pIageM.js.map +1 -0
  15. package/dist/{claude-md-injection-Cpzolxin.js → claude-md-injection-BV4tPUWo.js} +126 -35
  16. package/dist/claude-md-injection-BV4tPUWo.js.map +1 -0
  17. package/dist/{codex-TdsG6C9K.js → codex-B_AMB6JM.js} +7 -7
  18. package/dist/{codex-TdsG6C9K.js.map → codex-B_AMB6JM.js.map} +1 -1
  19. package/dist/{copilot-discount-Bsmv_3OX.js → copilot-discount-BuDbQOHq.js} +2 -2
  20. package/dist/{copilot-discount-Bsmv_3OX.js.map → copilot-discount-BuDbQOHq.js.map} +1 -1
  21. package/dist/{debug-DkNTuErv.js → debug-DL2JsRqY.js} +2 -2
  22. package/dist/{debug-DkNTuErv.js.map → debug-DL2JsRqY.js.map} +1 -1
  23. package/dist/engine-D3oNrF6Z.js +1 -0
  24. package/dist/{gate-discovery-NNQg0t0H.js → gate-discovery-CXE-7VcM.js} +5 -5
  25. package/dist/{gate-discovery-NNQg0t0H.js.map → gate-discovery-CXE-7VcM.js.map} +1 -1
  26. package/dist/{get-copilot-usage-P9chc-X2.js → get-copilot-usage-BbGmK03C.js} +2 -2
  27. package/dist/{get-copilot-usage-P9chc-X2.js.map → get-copilot-usage-BbGmK03C.js.map} +1 -1
  28. package/dist/hooks.mjs +200 -117
  29. package/dist/hooks.sha256 +1 -1
  30. package/dist/{index-cmd-BkfYr9FH.js → index-cmd-CjRcmYk3.js} +4 -4
  31. package/dist/{index-cmd-BkfYr9FH.js.map → index-cmd-CjRcmYk3.js.map} +1 -1
  32. package/dist/{internal-aic-status-C6L4-ncP.js → internal-aic-status-BAVomi5A.js} +4 -4
  33. package/dist/{internal-aic-status-C6L4-ncP.js.map → internal-aic-status-BAVomi5A.js.map} +1 -1
  34. package/dist/{internal-artifact-open-DgJ3PCtt.js → internal-artifact-open-NAGn9Mgt.js} +2 -2
  35. package/dist/{internal-artifact-open-DgJ3PCtt.js.map → internal-artifact-open-NAGn9Mgt.js.map} +1 -1
  36. package/dist/{internal-fast-dispatch-guard-CicGz6oM.js → internal-fast-dispatch-guard-DP25L_Bx.js} +1 -1
  37. package/dist/{internal-fast-dispatch-guard-CgBtUsQI.js → internal-fast-dispatch-guard-DbrgO9Ab.js} +2 -2
  38. package/dist/{internal-fast-dispatch-guard-CgBtUsQI.js.map → internal-fast-dispatch-guard-DbrgO9Ab.js.map} +1 -1
  39. package/dist/{internal-first-mate-guard-DTXPT7JW.js → internal-first-mate-guard-C8GwLbaX.js} +1 -1
  40. package/dist/{internal-first-mate-guard-BfWYN6Jb.js → internal-first-mate-guard-GufCUMl3.js} +3 -3
  41. package/dist/{internal-first-mate-guard-BfWYN6Jb.js.map → internal-first-mate-guard-GufCUMl3.js.map} +1 -1
  42. package/dist/{internal-max-dispatch-guard-mNl9CCir.js → internal-max-dispatch-guard-BB0vwiPx.js} +1 -1
  43. package/dist/{internal-max-dispatch-guard-CY8l9SDw.js → internal-max-dispatch-guard-BodVFHRC.js} +2 -2
  44. package/dist/{internal-max-dispatch-guard-CY8l9SDw.js.map → internal-max-dispatch-guard-BodVFHRC.js.map} +1 -1
  45. package/dist/{internal-plan-review-2OHTs8Nk.js → internal-plan-review-ChFx8wTX.js} +3 -3
  46. package/dist/{internal-plan-review-2OHTs8Nk.js.map → internal-plan-review-ChFx8wTX.js.map} +1 -1
  47. package/dist/{internal-prompt-submit-CkfUcu34.js → internal-prompt-submit-BaccW_CC.js} +4 -4
  48. package/dist/{internal-prompt-submit-CkfUcu34.js.map → internal-prompt-submit-BaccW_CC.js.map} +1 -1
  49. package/dist/{internal-prompt-submit-DZ_-2A6a.js → internal-prompt-submit-DPUBQZtG.js} +2 -2
  50. package/dist/{internal-rebrief-EhBHAHsz.js → internal-rebrief-NjSlx5QY.js} +4 -4
  51. package/dist/{internal-rebrief-EhBHAHsz.js.map → internal-rebrief-NjSlx5QY.js.map} +1 -1
  52. package/dist/{internal-session-bind-Bv50ju2n.js → internal-session-bind-dsUOcKxU.js} +2 -2
  53. package/dist/{internal-session-bind-Bv50ju2n.js.map → internal-session-bind-dsUOcKxU.js.map} +1 -1
  54. package/dist/{internal-stop-hook-Iz8XXE07.js → internal-stop-hook-B2TTl6Zp.js} +5 -5
  55. package/dist/{internal-stop-hook-Iz8XXE07.js.map → internal-stop-hook-B2TTl6Zp.js.map} +1 -1
  56. package/dist/{internal-stop-review-K6f8xsCh.js → internal-stop-review-D_KEV_04.js} +2 -2
  57. package/dist/{internal-stop-review-K6f8xsCh.js.map → internal-stop-review-D_KEV_04.js.map} +1 -1
  58. package/dist/{internal-worker-guard-GVhTjVlR.js → internal-worker-guard-DB6shBIn.js} +2 -2
  59. package/dist/{internal-worker-guard-GVhTjVlR.js.map → internal-worker-guard-DB6shBIn.js.map} +1 -1
  60. package/dist/{internal-workspace-header-d2hFf9Jy.js → internal-workspace-header-DBg5Y7oN.js} +2 -2
  61. package/dist/{internal-workspace-header-d2hFf9Jy.js.map → internal-workspace-header-DBg5Y7oN.js.map} +1 -1
  62. package/dist/{lifecycle-C6cxM_Nk.js → lifecycle-9nX09dBl.js} +2 -2
  63. package/dist/{lifecycle-C6cxM_Nk.js.map → lifecycle-9nX09dBl.js.map} +1 -1
  64. package/dist/lifecycle-C_CT13c9.js +1 -0
  65. package/dist/lifecycle-DibiH857.js +1 -0
  66. package/dist/{lifecycle-pl9QpvqD.js → lifecycle-Gge2Dadd.js} +2 -2
  67. package/dist/{lifecycle-pl9QpvqD.js.map → lifecycle-Gge2Dadd.js.map} +1 -1
  68. package/dist/main.js +23 -23
  69. package/dist/{mcp-workspace-header-Su8uUxJg.js → mcp-workspace-header-Xw9B1W6T.js} +2 -2
  70. package/dist/{mcp-workspace-header-Su8uUxJg.js.map → mcp-workspace-header-Xw9B1W6T.js.map} +1 -1
  71. package/dist/{models-D8v8OTbN.js → models-BR6i348u.js} +3 -3
  72. package/dist/{models-D8v8OTbN.js.map → models-BR6i348u.js.map} +1 -1
  73. package/dist/{orchestration-Bov4rZEi.js → orchestration-D3-2ulhX.js} +2 -2
  74. package/dist/{orchestration-Bov4rZEi.js.map → orchestration-D3-2ulhX.js.map} +1 -1
  75. package/dist/{paths-BSI_EtDT.js → paths-C5477RGC.js} +48 -4
  76. package/dist/paths-C5477RGC.js.map +1 -0
  77. package/dist/paths-CEswtFj5.js +1 -0
  78. package/dist/{peer-mcp-personas-GANlrtNR.js → peer-mcp-personas-BOgR46nM.js} +519 -169
  79. package/dist/peer-mcp-personas-BOgR46nM.js.map +1 -0
  80. package/dist/{pi-TKFwPyLA.js → pi-DcWp83mx.js} +377 -602
  81. package/dist/pi-DcWp83mx.js.map +1 -0
  82. package/dist/{plan-review-hook-CHK1wL3-.js → plan-review-hook-C9K-em4D.js} +3 -3
  83. package/dist/{plan-review-hook-CHK1wL3-.js.map → plan-review-hook-C9K-em4D.js.map} +1 -1
  84. package/dist/{provision-BNN6yRk8.js → provision-DkWR9B6I.js} +5 -5
  85. package/dist/{provision-BNN6yRk8.js.map → provision-DkWR9B6I.js.map} +1 -1
  86. package/dist/{self-invocation-Dk_UHD_v.js → self-invocation-BtcGj-lY.js} +2 -2
  87. package/dist/{self-invocation-Dk_UHD_v.js.map → self-invocation-BtcGj-lY.js.map} +1 -1
  88. package/dist/{serve-BaeLm9Um.js → serve-BGwEVDdc.js} +14 -14
  89. package/dist/{serve-BaeLm9Um.js.map → serve-BGwEVDdc.js.map} +1 -1
  90. package/dist/{server-setup-BcUQv5ac.js → server-setup-DVPL9iph.js} +911 -100
  91. package/dist/server-setup-DVPL9iph.js.map +1 -0
  92. package/dist/{service-backend-DHyd9vjW.js → service-backend-B6D_DY1Z.js} +3 -3
  93. package/dist/{service-backend-DHyd9vjW.js.map → service-backend-B6D_DY1Z.js.map} +1 -1
  94. package/dist/{start-BdoGJc36.js → start-BUWx3nSr.js} +4 -4
  95. package/dist/{start-BdoGJc36.js.map → start-BUWx3nSr.js.map} +1 -1
  96. package/dist/{static-context-pack-dKrzbfIN.js → static-context-pack-ChHuxBpk.js} +232 -61
  97. package/dist/static-context-pack-ChHuxBpk.js.map +1 -0
  98. package/dist/{stop-gate-hook-CC7VWkZM.js → stop-gate-hook-DnLC09Lg.js} +3 -3
  99. package/dist/{stop-gate-hook-CC7VWkZM.js.map → stop-gate-hook-DnLC09Lg.js.map} +1 -1
  100. package/dist/{stop-gate-policy-CoR8xKNQ.js → stop-gate-policy-Dx9c98_d.js} +2 -2
  101. package/dist/{stop-gate-policy-CoR8xKNQ.js.map → stop-gate-policy-Dx9c98_d.js.map} +1 -1
  102. package/dist/{token-CA2s70qj.js → token-OTb61rOC.js} +2 -2
  103. package/dist/{token-CA2s70qj.js.map → token-OTb61rOC.js.map} +1 -1
  104. package/dist/{worker-dispatch-B_rriT7z.js → worker-dispatch-B1w2qfjX.js} +2 -2
  105. package/dist/{worker-dispatch-B_rriT7z.js.map → worker-dispatch-B1w2qfjX.js.map} +1 -1
  106. package/docs/azure-mcp.md +29 -31
  107. package/package.json +1 -1
  108. package/dist/ado-tools-DqLJ-u19.js +0 -1
  109. package/dist/aic-ledger-BuFrsGur.js.map +0 -1
  110. package/dist/attribution-settings-D9PxJxkL.js.map +0 -1
  111. package/dist/claude-BTYQjK-K.js.map +0 -1
  112. package/dist/claude-md-injection-Cpzolxin.js.map +0 -1
  113. package/dist/engine-CmhUwYI5.js +0 -1
  114. package/dist/lifecycle-BU_d2QMs.js +0 -1
  115. package/dist/lifecycle-ByFyew_w.js +0 -1
  116. package/dist/paths-BSI_EtDT.js.map +0 -1
  117. package/dist/paths-BYxX9DfA.js +0 -1
  118. package/dist/peer-mcp-personas-GANlrtNR.js.map +0 -1
  119. package/dist/pi-TKFwPyLA.js.map +0 -1
  120. package/dist/server-setup-BcUQv5ac.js.map +0 -1
  121. package/dist/static-context-pack-dKrzbfIN.js.map +0 -1
@@ -1,6 +1,6 @@
1
- import { P as warmTreeSitterPool } from "./service-backend-DHyd9vjW.js";
2
- import { B as runSelfUpdate, a as setupAndServe, c as startKeepAwake, i as parseSharedArgs, n as getCodexEnvVars, o as sharedServerArgs, t as getClaudeCodeEnvVars } from "./server-setup-BcUQv5ac.js";
3
- import { bn as provisionAndIndexColbert, pn as provisionBrowserAssets, xt as browserToolsEnabled, yn as colbertDegradedWarning } from "./peer-mcp-personas-GANlrtNR.js";
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";
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-BdoGJc36.js.map
133
+ //# sourceMappingURL=start-BUWx3nSr.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"start-BdoGJc36.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,YAAY;GAC3C,IACE,MAAM,SAAS,uBAAuB,KACnC,MAAM,SAAS,8BAA8B,GAEhD,OAAO;EAEX;EAEA,OAAO;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,qBAAqB,WAAW,KAAK,KAAK;EAEvD,QAAQ,IACN,yFAAyF,UAAU,OACrG;CACF;AACF,CAAC"}
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;GACvC,OAAO;EACT;EAGA,IAAI,IAAI,iCAAiC,OAAO;EAIhD,IAAI,IAAI,cAAc;GACpB,MAAM,QAAQ,IAAI,aAAa,YAAY;GAC3C,IACE,MAAM,SAAS,uBAAuB,KACnC,MAAM,SAAS,8BAA8B,GAEhD,OAAO;EAEX;EAEA,OAAO;CACT;CAEA,MAAM,YAAY,IAAI;CACtB,IAAI,WAAW;EACb,IAAI,UAAU,SAAS,KAAK,GAAG,OAAO;EACtC,IAAI,UAAU,S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1
  import { r as BALANCED_PROFILE_MODELS, t as BALANCED_PROFILE_CONTRACT } from "./balanced-profile-contract-DtnTIBjL.js";
2
- import { t as buildSelfCommand } from "./self-invocation-Dk_UHD_v.js";
3
- import { s as isSubagentContext } from "./stop-gate-policy-CoR8xKNQ.js";
2
+ import { t as buildSelfCommand } from "./self-invocation-BtcGj-lY.js";
3
+ import { s as isSubagentContext } from "./stop-gate-policy-Dx9c98_d.js";
4
4
  import { existsSync, readFileSync, readdirSync } from "node:fs";
5
5
  import path from "node:path";
6
6
  //#region src/lib/cheapest-profile-contract.ts
@@ -135,50 +135,6 @@ const CHEAPEST_PROFILE_CONTRACT = Object.freeze({
135
135
  delegationGraph: CHEAPEST_PROFILE_DELEGATION_GRAPH
136
136
  });
137
137
  //#endregion
138
- //#region src/lib/balanced2-profile-contract.ts
139
- /**
140
- * Fixed identities for the literal `github-router claude -m balanced2` profile.
141
- *
142
- * `balanced2` is `balanced` with the Sol tier moved from `gpt-5.6-sol` to
143
- * `gpt-6.1-sol` for the lead and reviewer, and the Oracle moved from
144
- * `grok-4.6` to `grok-4.7`. Everything else — the Luna `Explore`/
145
- * `General-Purpose` roles, the bare-slug 200K window, the medium lead effort,
146
- * the Advisor-free surface, the Oracle-only peer set and the delegation graph
147
- * (including `reviewer` → `Explore`) — is inherited verbatim.
148
- *
149
- * The `astra` slot is inherited unchanged on purpose: it is declarative only on
150
- * this family (no balanced launch synthesizes an `astra` tool; only `fast` and
151
- * `cheap1m` do), so the identity has no consumer to alter.
152
- *
153
- * Derived from `BALANCED_PROFILE_CONTRACT` by spread rather than copied: a
154
- * field added to the family later is inherited here automatically, and the
155
- * declared deltas are the only lines in this file that can drift.
156
- */
157
- /** The 6.1 Sol tier that distinguishes this profile's lead/reviewer. */
158
- const BALANCED2_SOL_MODEL = "gpt-6.1-sol";
159
- /** The xAI Oracle that supersedes `balanced`'s Grok 4.6 row. */
160
- const BALANCED2_ORACLE_MODEL = "grok-4.7";
161
- const BALANCED2_PROFILE_MODELS = Object.freeze({
162
- ...BALANCED_PROFILE_MODELS,
163
- lead: BALANCED2_SOL_MODEL,
164
- reviewer: BALANCED2_SOL_MODEL,
165
- oracle: BALANCED2_ORACLE_MODEL
166
- });
167
- const BALANCED2_PROFILE_NATIVE_MODELS = Object.freeze({
168
- Explore: BALANCED2_PROFILE_MODELS.explore,
169
- "General-Purpose": BALANCED2_PROFILE_MODELS["General-Purpose"],
170
- reviewer: BALANCED2_PROFILE_MODELS.reviewer
171
- });
172
- const BALANCED2_PROFILE_ORACLE_MODEL = BALANCED2_PROFILE_MODELS.oracle;
173
- /** The `-m balanced2` aggregate: the base contract with only the Sol
174
- * lead/reviewer identities and the Oracle replaced. */
175
- const BALANCED2_PROFILE_CONTRACT = Object.freeze({
176
- ...BALANCED_PROFILE_CONTRACT,
177
- models: BALANCED2_PROFILE_MODELS,
178
- nativeModels: BALANCED2_PROFILE_NATIVE_MODELS,
179
- oracleModel: BALANCED2_PROFILE_ORACLE_MODEL
180
- });
181
- //#endregion
182
138
  //#region src/lib/cheapest2-profile-contract.ts
183
139
  /**
184
140
  * Fixed identities for the literal `github-router claude -m cheapest2` profile.
@@ -227,6 +183,168 @@ const CHEAPEST2_PROFILE_CONTRACT = Object.freeze({
227
183
  oracleModel: CHEAPEST2_PROFILE_ORACLE_MODEL
228
184
  });
229
185
  //#endregion
186
+ //#region src/lib/local-profile-contract.ts
187
+ /**
188
+ * Fixed identities for the literal `github-router claude -m local` and
189
+ * `-m local2` launch profiles.
190
+ *
191
+ * Both profiles route the MAIN agent loop at a locally running model server
192
+ * instead of Copilot, so their model ids are the three Anthropic tier names the
193
+ * server itself resolves (`opus` / `sonnet` / `haiku`) rather than catalog
194
+ * slugs. Nothing here assumes which stack is serving them, what else its model
195
+ * list contains, or that any capability beyond "Claude Code works with it" is
196
+ * present.
197
+ *
198
+ * Everything that is NOT a model identity is inherited from
199
+ * `CHEAPEST_PROFILE_CONTRACT` by reference rather than copied: the roster
200
+ * (`Explore` / `General-Purpose` / `reviewer`, no `Plan`), the delegation graph,
201
+ * the per-role efforts, the synthesized peer set and the 200K windows are the
202
+ * cheapest profile's, so "the prompts are the same as cheapest" holds by
203
+ * construction and cannot drift one file away from the prose that describes it.
204
+ *
205
+ * Declared deltas only:
206
+ * - `models` / `nativeModels` — the local tier ids.
207
+ * - `oracleModel` — `cheapest2`'s `gpt-6.1-sol`, because the Oracle is an MCP
208
+ * persona that still runs on Copilot: it is a consult the local lead makes,
209
+ * not a local turn.
210
+ * - NO `leadEffort`. The launcher seeds `CLAUDE_CODE_EFFORT_LEVEL` for the
211
+ * cheapest family, and we know nothing about the local server's effort
212
+ * ladder, so the client's own picker decides. The type-level absence is
213
+ * what stops a future edit from seeding one by accident.
214
+ * - NO advisor fields on `local`: that profile is Advisor-free by design,
215
+ * exactly like `balanced`. `local2` adds them back.
216
+ */
217
+ /**
218
+ * The three ids the local endpoint resolves. Claude Code's `/model` picker and
219
+ * its tier env vars speak these names, and the server maps each onto whatever
220
+ * it actually has loaded, so the proxy never learns (or guesses) a real model
221
+ * slug.
222
+ */
223
+ const LOCAL_PROFILE_TIER_MODELS = Object.freeze({
224
+ opus: "opus",
225
+ sonnet: "sonnet",
226
+ haiku: "haiku"
227
+ });
228
+ const LOCAL_PROFILE_MODELS = Object.freeze({
229
+ lead: LOCAL_PROFILE_TIER_MODELS.opus,
230
+ explore: LOCAL_PROFILE_TIER_MODELS.haiku,
231
+ "General-Purpose": LOCAL_PROFILE_TIER_MODELS.sonnet,
232
+ reviewer: LOCAL_PROFILE_TIER_MODELS.opus,
233
+ /** Copilot-served MCP persona, inherited from `cheapest2`. */
234
+ oracle: CHEAPEST2_SOL_MODEL
235
+ });
236
+ const LOCAL_PROFILE_NATIVE_AGENT_NAMES = CHEAPEST_PROFILE_NATIVE_AGENT_NAMES;
237
+ const LOCAL_PROFILE_NATIVE_MODELS = Object.freeze({
238
+ Explore: LOCAL_PROFILE_MODELS.explore,
239
+ "General-Purpose": LOCAL_PROFILE_MODELS["General-Purpose"],
240
+ reviewer: LOCAL_PROFILE_MODELS.reviewer
241
+ });
242
+ /**
243
+ * Per-role efforts are the cheapest profile's verbatim. They ride on the
244
+ * subagent `.md` frontmatter, which is a prompt-level preference the local
245
+ * server may ignore; the LEAD effort is deliberately NOT seeded (see above).
246
+ */
247
+ const LOCAL_PROFILE_NATIVE_EFFORTS = CHEAPEST_PROFILE_NATIVE_EFFORTS;
248
+ /** 200K: enforced client-side by `CLAUDE_CODE_DISABLE_1M_CONTEXT=1`. */
249
+ const LOCAL_PROFILE_LEAD_CONTEXT_TOKENS = 2e5;
250
+ const LOCAL_PROFILE_SUBAGENT_CONTEXT_TOKENS = CHEAPEST_PROFILE_SUBAGENT_CONTEXT_TOKENS;
251
+ const LOCAL_PROFILE_ORACLE_MODEL = LOCAL_PROFILE_MODELS.oracle;
252
+ /**
253
+ * Every fixed identity for `-m local` in one frozen aggregate.
254
+ *
255
+ * `local2` derives from this by spread, adding only its Advisor block.
256
+ */
257
+ const LOCAL_PROFILE_CONTRACT = Object.freeze({
258
+ models: LOCAL_PROFILE_MODELS,
259
+ tierModels: LOCAL_PROFILE_TIER_MODELS,
260
+ nativeAgentNames: LOCAL_PROFILE_NATIVE_AGENT_NAMES,
261
+ nativeModels: LOCAL_PROFILE_NATIVE_MODELS,
262
+ nativeEfforts: LOCAL_PROFILE_NATIVE_EFFORTS,
263
+ leadContextTokens: LOCAL_PROFILE_LEAD_CONTEXT_TOKENS,
264
+ subagentContextTokens: LOCAL_PROFILE_SUBAGENT_CONTEXT_TOKENS,
265
+ oracleModel: LOCAL_PROFILE_ORACLE_MODEL,
266
+ oracleEffort: CHEAPEST_PROFILE_ORACLE_EFFORT,
267
+ synthesizedPeers: CHEAPEST_PROFILE_SYNTHESIZED_PEERS,
268
+ delegationGraph: CHEAPEST_PROFILE_DELEGATION_GRAPH
269
+ });
270
+ /**
271
+ * The `-m local2` Advisor: `gpt-6.1-sol` on Copilot, `high`, at the cheapest
272
+ * family's default window and curated ("small digest") transcript budget.
273
+ *
274
+ * The lead turn stays local and free; only the Advisor consult is billed.
275
+ */
276
+ const LOCAL2_PROFILE_ADVISOR_MODEL = CHEAPEST2_SOL_MODEL;
277
+ const LOCAL2_PROFILE_ADVISOR_CLIENT_MODEL = CHEAPEST2_SOL_MODEL;
278
+ const LOCAL2_PROFILE_ADVISOR_CONTEXT_TOKENS = LOCAL_PROFILE_SUBAGENT_CONTEXT_TOKENS;
279
+ const LOCAL2_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_DEFAULT = CHEAPEST_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_DEFAULT;
280
+ const LOCAL2_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_MIN = CHEAPEST_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_MIN;
281
+ const LOCAL2_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_MAX = CHEAPEST_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_MAX;
282
+ /** Matches `cheapest2`: the curated protégé consult runs its advisor at `high`. */
283
+ const LOCAL2_PROFILE_ADVISOR_EFFORT = "high";
284
+ /**
285
+ * The `-m local2` aggregate: the local contract plus the curated Advisor.
286
+ *
287
+ * The advisor fields are present HERE and absent from `LOCAL_PROFILE_CONTRACT`
288
+ * on purpose, so every advisor call site has to name the profile it is serving
289
+ * instead of inheriting one by accident.
290
+ */
291
+ const LOCAL2_PROFILE_CONTRACT = Object.freeze({
292
+ ...LOCAL_PROFILE_CONTRACT,
293
+ advisorModel: LOCAL2_PROFILE_ADVISOR_MODEL,
294
+ advisorClientModel: LOCAL2_PROFILE_ADVISOR_CLIENT_MODEL,
295
+ advisorContextTokens: LOCAL2_PROFILE_ADVISOR_CONTEXT_TOKENS,
296
+ advisorTranscriptTokensDefault: LOCAL2_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_DEFAULT,
297
+ advisorTranscriptTokensMin: LOCAL2_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_MIN,
298
+ advisorTranscriptTokensMax: LOCAL2_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_MAX,
299
+ advisorEffort: LOCAL2_PROFILE_ADVISOR_EFFORT
300
+ });
301
+ /** The local lead slug, used by the child-env/tier-row wiring. */
302
+ const LOCAL_PROFILE_LEAD_MODEL = LOCAL_PROFILE_MODELS.lead;
303
+ //#endregion
304
+ //#region src/lib/balanced2-profile-contract.ts
305
+ /**
306
+ * Fixed identities for the literal `github-router claude -m balanced2` profile.
307
+ *
308
+ * `balanced2` is `balanced` with the Sol tier moved from `gpt-5.6-sol` to
309
+ * `gpt-6.1-sol` for the lead and reviewer, and the Oracle moved from
310
+ * `grok-4.6` to `grok-4.7`. Everything else — the Luna `Explore`/
311
+ * `General-Purpose` roles, the bare-slug 200K window, the medium lead effort,
312
+ * the Advisor-free surface, the Oracle-only peer set and the delegation graph
313
+ * (including `reviewer` → `Explore`) — is inherited verbatim.
314
+ *
315
+ * The `astra` slot is inherited unchanged on purpose: it is declarative only on
316
+ * this family (no balanced launch synthesizes an `astra` tool; only `fast` and
317
+ * `cheap1m` do), so the identity has no consumer to alter.
318
+ *
319
+ * Derived from `BALANCED_PROFILE_CONTRACT` by spread rather than copied: a
320
+ * field added to the family later is inherited here automatically, and the
321
+ * declared deltas are the only lines in this file that can drift.
322
+ */
323
+ /** The 6.1 Sol tier that distinguishes this profile's lead/reviewer. */
324
+ const BALANCED2_SOL_MODEL = "gpt-6.1-sol";
325
+ /** The xAI Oracle that supersedes `balanced`'s Grok 4.6 row. */
326
+ const BALANCED2_ORACLE_MODEL = "grok-4.7";
327
+ const BALANCED2_PROFILE_MODELS = Object.freeze({
328
+ ...BALANCED_PROFILE_MODELS,
329
+ lead: BALANCED2_SOL_MODEL,
330
+ reviewer: BALANCED2_SOL_MODEL,
331
+ oracle: BALANCED2_ORACLE_MODEL
332
+ });
333
+ const BALANCED2_PROFILE_NATIVE_MODELS = Object.freeze({
334
+ Explore: BALANCED2_PROFILE_MODELS.explore,
335
+ "General-Purpose": BALANCED2_PROFILE_MODELS["General-Purpose"],
336
+ reviewer: BALANCED2_PROFILE_MODELS.reviewer
337
+ });
338
+ const BALANCED2_PROFILE_ORACLE_MODEL = BALANCED2_PROFILE_MODELS.oracle;
339
+ /** The `-m balanced2` aggregate: the base contract with only the Sol
340
+ * lead/reviewer identities and the Oracle replaced. */
341
+ const BALANCED2_PROFILE_CONTRACT = Object.freeze({
342
+ ...BALANCED_PROFILE_CONTRACT,
343
+ models: BALANCED2_PROFILE_MODELS,
344
+ nativeModels: BALANCED2_PROFILE_NATIVE_MODELS,
345
+ oracleModel: BALANCED2_PROFILE_ORACLE_MODEL
346
+ });
347
+ //#endregion
230
348
  //#region src/lib/profile-family.ts
231
349
  /**
232
350
  * The `cheapest`/`cheapest2` and `balanced`/`balanced2` launch-profile families.
@@ -249,9 +367,12 @@ function isCheapestFamily(profileId) {
249
367
  function isBalancedFamily(profileId) {
250
368
  return profileId === "balanced" || profileId === "balanced2";
251
369
  }
370
+ function isLocalFamily(profileId) {
371
+ return profileId === "local" || profileId === "local2";
372
+ }
252
373
  /**
253
- * Every FIXED-ROSTER launch profile: `fast`, the cheap pair, and both
254
- * families. These are the launches whose MCP surface, picker rows,
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,
255
376
  * mirror purge and status line the router owns outright.
256
377
  *
257
378
  * `max` is deliberately absent. It shares some of the same wiring, but it
@@ -265,7 +386,9 @@ const PINNED_PROFILE_IDS = /* @__PURE__ */ new Set([
265
386
  "cheapest",
266
387
  "cheapest2",
267
388
  "balanced",
268
- "balanced2"
389
+ "balanced2",
390
+ "local",
391
+ "local2"
269
392
  ]);
270
393
  function isPinnedLaunchProfile(profileId) {
271
394
  return profileId != null && PINNED_PROFILE_IDS.has(profileId);
@@ -282,6 +405,29 @@ function balancedContractFor(profileId) {
282
405
  return profileId === "balanced2" ? BALANCED2_PROFILE_CONTRACT : BALANCED_PROFILE_CONTRACT;
283
406
  }
284
407
  /**
408
+ * The contract for a local-family profile (base fallback, as above).
409
+ *
410
+ * Local is a THIRD family, not a cheapest sibling: its egress and model ids
411
+ * differ while its prose is inherited. `cheapestContractFor` is never the
412
+ * accessor for it, precisely because that function would hand back a Copilot
413
+ * model id for a launch that must never name one.
414
+ */
415
+ function localContractFor(profileId) {
416
+ return profileId === "local2" ? LOCAL2_PROFILE_CONTRACT : LOCAL_PROFILE_CONTRACT;
417
+ }
418
+ /**
419
+ * The `local2` contract including its Advisor block.
420
+ *
421
+ * A dedicated accessor rather than a widening of `localContractFor`: the base
422
+ * local contract has NO advisor fields at the type level (Advisor-free by
423
+ * design), so reading `localContractFor(id).advisorModel` is a type error on
424
+ * the union. Every advisor site therefore has to name `local2` to reach this
425
+ * function — which is exactly the property the contract's doc asks for.
426
+ */
427
+ function local2AdvisorContract() {
428
+ return LOCAL2_PROFILE_CONTRACT;
429
+ }
430
+ /**
285
431
  * Human-readable model name for prose and descriptors. These strings reach
286
432
  * the model's own instructions and the user's terminal, so they are spelled
287
433
  * out rather than derived: "GPT-6.1 Sol" is not mechanical from the slug, and
@@ -592,27 +738,51 @@ function decidePromptSubmit(input) {
592
738
  return decision;
593
739
  }
594
740
  /**
741
+ * The tool name the tip and the scope note point at. Claude Code resolves the
742
+ * scoped `search` group under its bare key; Pi always prefixes its native MCP
743
+ * servers with `gh-router-` (`PI_MCP_SERVER_PREFIX`) so the same group lands
744
+ * under a different name there.
745
+ *
746
+ * Declared BEFORE `PROMPT_SEARCH_TIP`: that const evaluates at module load,
747
+ * so a declaration below it would still be in its temporal dead zone.
748
+ */
749
+ const DEFAULT_PROMPT_SEARCH_TOOL = "mcp__search__code";
750
+ getPromptSearchTip(true);
751
+ /**
595
752
  * Build the search tip for the launch's search backend. When Bluebird is
596
753
  * enabled it owns both semantic and lexical calls; otherwise local ColBERT is
597
754
  * used when enabled, or lexical-only search when neither backend is enabled.
755
+ *
756
+ * `searchToolName` exists because the advice is client-facing prose, not
757
+ * policy: the decision to search is identical everywhere, but Pi's MCP server
758
+ * keys carry a `gh-router-` prefix, so naming Claude's tool there would point
759
+ * the model at a tool it cannot call.
598
760
  */
599
- function getPromptSearchTip(searchEnabled, bluebirdEnabled = false) {
600
- if (bluebirdEnabled) return "TIP (advisory): when this task needs code context, search Bluebird semantic + lexical in parallel — two `mcp__search__code` calls issued in the same turn. Bluebird failures are visible and do not fall back locally.";
601
- if (searchEnabled) return "TIP (advisory): when this task needs code context, search lexical + semantic in parallel — one `mcp__search__code` call with mode:\"lexical\" and one with mode:\"semantic\", issued in the same turn — before concluding.";
602
- return "TIP (advisory): when this task needs code context, search lexical (`mcp__search__code` with mode:\"lexical\"/\"exact\"/\"regex\" for exact symbols, filenames, errors, routes, flags, and config keys), issuing parallel calls in the same turn — before concluding.";
761
+ function getPromptSearchTip(searchEnabled, bluebirdEnabled = false, searchToolName = DEFAULT_PROMPT_SEARCH_TOOL) {
762
+ const tool = searchToolName;
763
+ if (bluebirdEnabled) return `TIP (advisory): when this task needs code context, search Bluebird semantic + lexical in parallel — two \`${tool}\` calls issued in the same turn. Bluebird failures are visible and do not fall back locally.`;
764
+ if (searchEnabled) return `TIP (advisory): when this task needs code context, search lexical + semantic in parallel — one \`${tool}\` call with mode:"lexical" and one with mode:"semantic", issued in the same turn — before concluding.`;
765
+ return `TIP (advisory): when this task needs code context, search lexical (\`${tool}\` with mode:"lexical"/"exact"/"regex" for exact symbols, filenames, errors, routes, flags, and config keys), issuing parallel calls in the same turn — before concluding.`;
603
766
  }
604
767
  /**
768
+ * The large-task escalation advice inside the scope note. Names the two Claude
769
+ * Code skills that compose a floor-raising run; a client without those skills
770
+ * passes its own sentence through `scopeAdvice`.
771
+ */
772
+ const DEFAULT_PROMPT_SCOPE_ADVICE = "Consider /gh-research first to saturate understanding, then /gh-orchestrate to compose a floor-raising workflow.";
773
+ /**
605
774
  * Build the scope-inference system prompt for the launch's search backend.
606
775
  * Mirrors `getPromptSearchTip`: Bluebird and local ColBERT variants ground the
607
776
  * inference in lexical + semantic results; the local-only variant in lexical results.
608
777
  */
609
- function getPromptScopeSystem(searchEnabled, bluebirdEnabled = false) {
778
+ function getPromptScopeSystem(searchEnabled, bluebirdEnabled = false, scopeAdvice = DEFAULT_PROMPT_SCOPE_ADVICE) {
610
779
  return `You are a scoping assistant for a coding agent about to act on a user's request. You are given the user's request and the results of ${bluebirdEnabled ? "a Bluebird lexical + semantic code search" : searchEnabled ? "a local lexical + semantic code search" : "a lexical code search"} over the relevant repository. Produce a SHORT advisory note (<= 120 words), plain text only:
611
780
  1. SCOPE: one line — is this trivial, focused (one area), or large/cross-cutting — grounded in what the search surfaced (reference the most relevant file(s) by name).
612
781
  2. GOAL: restate the user's OWN ask as a single measurable objective, in THEIR terms. Do NOT invent new requirements or acceptance criteria beyond what they asked.
613
- 3. Only if the task is large/cross-cutting, add a final line: "Consider /gh-research first to saturate understanding, then /gh-orchestrate to compose a floor-raising workflow." Omit it for a focused or trivial task.
782
+ 3. Only if the task is large/cross-cutting, add a final line: "${scopeAdvice}" Omit it for a focused or trivial task.
614
783
  This is advisory — the agent decides whether to follow it. Be concrete and concise; no preamble.`;
615
784
  }
785
+ getPromptScopeSystem(true);
616
786
  /** Max chars of each search-result blob fed into the scope inference. */
617
787
  const SEARCH_CONTEXT_CAP = 6144;
618
788
  /** Wrap the prior-turn review findings in an explicitly NON-AUTHORITATIVE frame. */
@@ -671,7 +841,8 @@ async function decidePromptSubmitV2(input) {
671
841
  const searchEnabled = input.searchEnabled === true;
672
842
  const bluebirdEnabled = input.bluebirdEnabled === true;
673
843
  const semanticAvailable = searchEnabled || bluebirdEnabled;
674
- const searchTip = getPromptSearchTip(searchEnabled, bluebirdEnabled);
844
+ const fallbackGoal = input.prose?.fallbackGoal ?? "GOAL (advisory): for a non-trivial task, FIRST run /gh-research on this ask to information saturation — verify the load-bearing claims against the actual code before planning, and do not plan or write code until research is saturated. THEN, for an implementation or change task, run /gh-orchestrate to compose and run a floor-raising workflow (it checkpoints before expensive work). Skip both for a trivial ask; you may decline if they do not fit.";
845
+ const searchTip = getPromptSearchTip(searchEnabled, bluebirdEnabled, input.prose?.searchToolName);
675
846
  if (input.rewrite && isCheapestRewriteEligible({
676
847
  profile: input.profile,
677
848
  promptIsNonTrivial: isNonTrivialPrompt(prompt),
@@ -699,15 +870,15 @@ async function decidePromptSubmitV2(input) {
699
870
  if (rewrite.timedOut) {
700
871
  decision.inject = joinSections([
701
872
  searchTip,
702
- PROMPT_STEER_GOAL,
873
+ fallbackGoal,
703
874
  findingsBlock
704
875
  ]);
705
876
  return decision;
706
877
  }
707
878
  }
708
- const scopeSystem = getPromptScopeSystem(searchEnabled, bluebirdEnabled);
879
+ const scopeSystem = getPromptScopeSystem(searchEnabled, bluebirdEnabled, input.prose?.scopeAdvice);
709
880
  const timeoutMs = input.io.timeoutMs ?? 22e3;
710
- let goal = PROMPT_STEER_GOAL;
881
+ let goal = fallbackGoal;
711
882
  let timer;
712
883
  const controller = new AbortController();
713
884
  try {
@@ -1137,6 +1308,6 @@ function buildStaticPack(workspace) {
1137
1308
  };
1138
1309
  }
1139
1310
  //#endregion
1140
- export { CHEAPEST_PROFILE_ADVISOR_MODEL as C, CHEAPEST_PROFILE_MODELS as D, CHEAPEST_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_MIN as E, CHEAPEST_PROFILE_NATIVE_AGENT_NAMES as O, CHEAPEST_PROFILE_ADVISOR_CLIENT_MODEL as S, CHEAPEST_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_MAX as T, isBalancedFamily as _, decidePromptSubmitV2 as a, CHEAPEST2_PROFILE_MODELS as b, CHEAPEST_REWRITE_EFFORT as c, isCheapestRewriteEligible as d, runCheapestRewrite as f, displayModelName as g, cheapestRewriteModelFor as h, decidePromptSubmit as i, CHEAPEST_PROFILE_NATIVE_EFFORTS as k, buildRebriefSystem as l, cheapestContractFor as m, PROMPT_STEER_GOAL as n, getPromptSearchTip as o, balancedContractFor as p, buildPromptSubmitHookCommand as r, isNonTrivialPrompt as s, buildStaticPack as t, isCheapestRewriteDisabledEnv as u, isCheapestFamily as v, CHEAPEST_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_DEFAULT as w, BALANCED2_PROFILE_MODELS as x, isPinnedLaunchProfile as y };
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 };
1141
1312
 
1142
- //# sourceMappingURL=static-context-pack-dKrzbfIN.js.map
1313
+ //# sourceMappingURL=static-context-pack-ChHuxBpk.js.map