github-router 0.3.353 → 0.3.355
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ado-tools-B5TCtnlQ.js +1 -0
- package/dist/{aic-statusline-settings-LnoxjBPe.js → aic-statusline-settings-EdsV1gzY.js} +6 -4
- package/dist/aic-statusline-settings-EdsV1gzY.js.map +1 -0
- package/dist/{attribution-settings-7cbLvuiE.js → attribution-settings-N48QlHu2.js} +51 -39
- package/dist/{attribution-settings-7cbLvuiE.js.map → attribution-settings-N48QlHu2.js.map} +1 -1
- package/dist/balanced-profile-contract-DtnTIBjL.js +105 -0
- package/dist/balanced-profile-contract-DtnTIBjL.js.map +1 -0
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/{claude-CugVz_lo.js → claude-BAKFTVqA.js} +68 -59
- package/dist/claude-BAKFTVqA.js.map +1 -0
- package/dist/{claude-md-injection-BoXOsg7h.js → claude-md-injection-CDOoGNEJ.js} +20 -15
- package/dist/claude-md-injection-CDOoGNEJ.js.map +1 -0
- package/dist/{codex-pfFa6vPh.js → codex-CspHNGZA.js} +5 -5
- package/dist/{codex-pfFa6vPh.js.map → codex-CspHNGZA.js.map} +1 -1
- package/dist/{copilot-discount-C3jfysK-.js → copilot-discount-kpOLluHm.js} +3 -1
- package/dist/copilot-discount-kpOLluHm.js.map +1 -0
- package/dist/engine-YvnWaTnR.js +1 -0
- package/dist/fast-profile-contract-JOnZBgFB.js +61 -0
- package/dist/fast-profile-contract-JOnZBgFB.js.map +1 -0
- package/dist/{gate-discovery-Cvdko01z.js → gate-discovery-JeKibE14.js} +2 -2
- package/dist/{gate-discovery-Cvdko01z.js.map → gate-discovery-JeKibE14.js.map} +1 -1
- package/dist/hooks.mjs +193 -12
- package/dist/hooks.sha256 +1 -1
- package/dist/{internal-aic-status-Dmi2bCsR.js → internal-aic-status-wYPsCG4r.js} +2 -2
- package/dist/{internal-aic-status-Dmi2bCsR.js.map → internal-aic-status-wYPsCG4r.js.map} +1 -1
- package/dist/{internal-fast-dispatch-guard-Cv7zf0ZI.js → internal-fast-dispatch-guard-A8teEib4.js} +1 -1
- package/dist/{internal-fast-dispatch-guard-BQm1MI9d.js → internal-fast-dispatch-guard-D_TCtJhQ.js} +3 -2
- package/dist/{internal-fast-dispatch-guard-BQm1MI9d.js.map → internal-fast-dispatch-guard-D_TCtJhQ.js.map} +1 -1
- package/dist/{internal-max-dispatch-guard-T-M7DRIW.js → internal-max-dispatch-guard-BM_B15EH.js} +1 -1
- package/dist/{internal-max-dispatch-guard-DkJixDmG.js → internal-max-dispatch-guard-D7ByWH4v.js} +2 -2
- package/dist/{internal-max-dispatch-guard-DkJixDmG.js.map → internal-max-dispatch-guard-D7ByWH4v.js.map} +1 -1
- package/dist/{internal-prompt-submit-B9MJxc3K.js → internal-prompt-submit-C77GnEaW.js} +3 -3
- package/dist/internal-prompt-submit-C77GnEaW.js.map +1 -0
- package/dist/{internal-prompt-submit-6OXEdQCK.js → internal-prompt-submit-CDTwamkW.js} +2 -2
- package/dist/{internal-rebrief-zIdunX3R.js → internal-rebrief-DZygfGHp.js} +6 -6
- package/dist/internal-rebrief-DZygfGHp.js.map +1 -0
- package/dist/{internal-stop-hook-DGcRVh_2.js → internal-stop-hook-Dz6mdfcL.js} +2 -2
- package/dist/{internal-stop-hook-DGcRVh_2.js.map → internal-stop-hook-Dz6mdfcL.js.map} +1 -1
- package/dist/main.js +11 -11
- package/dist/{max-profile-contract-DQDEDCsR.js → max-profile-contract-CMvzKSsg.js} +2 -2
- package/dist/max-profile-contract-CMvzKSsg.js.map +1 -0
- package/dist/{peer-mcp-personas-DDMKRFFG.js → peer-mcp-personas-Ch4VWo40.js} +165 -185
- package/dist/peer-mcp-personas-Ch4VWo40.js.map +1 -0
- package/dist/{pi-BNpaiwEF.js → pi-Cwj383nc.js} +61 -62
- package/dist/pi-Cwj383nc.js.map +1 -0
- package/dist/{provision-BtYRtvrj.js → provision-PodfFQu-.js} +2 -2
- package/dist/{provision-BtYRtvrj.js.map → provision-PodfFQu-.js.map} +1 -1
- package/dist/{serve-BQ0spYrs.js → serve-D-OuW7kz.js} +7 -7
- package/dist/{serve-BQ0spYrs.js.map → serve-D-OuW7kz.js.map} +1 -1
- package/dist/{server-setup-COrhtCdv.js → server-setup-DDZxJgl0.js} +197 -133
- package/dist/server-setup-DDZxJgl0.js.map +1 -0
- package/dist/{start-Dd7O3bB9.js → start-CZZ0cTV9.js} +3 -3
- package/dist/{start-Dd7O3bB9.js.map → start-CZZ0cTV9.js.map} +1 -1
- package/dist/{static-context-pack-CyucviRD.js → static-context-pack-BRqt4ajJ.js} +313 -6
- package/dist/static-context-pack-BRqt4ajJ.js.map +1 -0
- package/docs/azure-mcp.md +28 -24
- package/package.json +1 -1
- package/dist/ado-tools-xbuVU7YN.js +0 -1
- package/dist/aic-statusline-settings-LnoxjBPe.js.map +0 -1
- package/dist/balanced-profile-contract-XiIj4O1U.js +0 -127
- package/dist/balanced-profile-contract-XiIj4O1U.js.map +0 -1
- package/dist/claude-CugVz_lo.js.map +0 -1
- package/dist/claude-md-injection-BoXOsg7h.js.map +0 -1
- package/dist/copilot-discount-C3jfysK-.js.map +0 -1
- package/dist/engine-DwLIk1Zn.js +0 -1
- package/dist/internal-prompt-submit-B9MJxc3K.js.map +0 -1
- package/dist/internal-rebrief-zIdunX3R.js.map +0 -1
- package/dist/max-profile-contract-DQDEDCsR.js.map +0 -1
- package/dist/peer-mcp-personas-DDMKRFFG.js.map +0 -1
- package/dist/pi-BNpaiwEF.js.map +0 -1
- package/dist/server-setup-COrhtCdv.js.map +0 -1
- package/dist/static-context-pack-CyucviRD.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { P as warmTreeSitterPool } from "./service-backend-DV1u5x0Q.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-
|
|
3
|
-
import { _n as colbertDegradedWarning, fn as provisionBrowserAssets, vn as provisionAndIndexColbert, xt as browserToolsEnabled } from "./peer-mcp-personas-
|
|
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-DDZxJgl0.js";
|
|
3
|
+
import { _n as colbertDegradedWarning, fn as provisionBrowserAssets, vn as provisionAndIndexColbert, xt as browserToolsEnabled } from "./peer-mcp-personas-Ch4VWo40.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-
|
|
133
|
+
//# sourceMappingURL=start-CZZ0cTV9.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start-Dd7O3bB9.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,M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AAQ;EACV,CAAC;EAID,cAAmB,EAAE,YAAY,KAAK,mBAAmB,MAAM,CAAC;EAKhE,yBAA8B;EAI9B,uBAA4B,CAAC,CAC1B,MAAM,YAAY;GACjB,IAAI,SAAS,QAAQ,OAAO,MAAM,GAAG,QAAQ,GAAG;EAClD,CAAC,CAAC,CACD,YAAY,CAAC,CAAC;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-CZZ0cTV9.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,SA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CAAC,CAC1B,MAAM,YAAY;GACjB,IAAI,SAAS,QAAQ,OAAO,MAAM,GAAG,QAAQ,GAAG;EAClD,CAAC,CAAC,CACD,YAAY,CAAC,CAAC;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,7 +1,314 @@
|
|
|
1
|
+
import { r as BALANCED_PROFILE_MODELS, t as BALANCED_PROFILE_CONTRACT } from "./balanced-profile-contract-DtnTIBjL.js";
|
|
1
2
|
import { t as buildSelfCommand } from "./self-invocation-Dr5zlbpM.js";
|
|
2
3
|
import { s as isSubagentContext } from "./stop-gate-policy-FGAfpfc-.js";
|
|
3
4
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
4
5
|
import path from "node:path";
|
|
6
|
+
//#region src/lib/cheapest-profile-contract.ts
|
|
7
|
+
/**
|
|
8
|
+
* Fixed identities for the literal `github-router claude -m cheapest` profile.
|
|
9
|
+
*
|
|
10
|
+
* The cheapest all-200K tier: a `gpt-6-luna`/max LEAD at Claude Code's
|
|
11
|
+
* DEFAULT (bare-slug) 200K window, every subagent at the same 200K default,
|
|
12
|
+
* a `gpt-5.6-sol`/medium Advisor (bare slug), and a `gpt-5.6-sol`/high
|
|
13
|
+
* primary Oracle. Oracle-only peer set (no `astra`) and a three-agent
|
|
14
|
+
* surface (`Explore`/`General-Purpose`/`reviewer` — no `Plan`): the lead
|
|
15
|
+
* plans directly and reviews the final plan with the Advisor (advisory)
|
|
16
|
+
* before presenting it.
|
|
17
|
+
*
|
|
18
|
+
* "max" on the lead is enforced at two layers: the launcher seeds
|
|
19
|
+
* `CLAUDE_CODE_EFFORT_LEVEL=max` (so the client stamps max instead of its
|
|
20
|
+
* `high` default on lead requests) and the request preprocessor defaults
|
|
21
|
+
* bare-Luna lead traffic to max when no explicit effort is present.
|
|
22
|
+
*
|
|
23
|
+
* The "200K window" here is enforced client-side by the launcher-seeded
|
|
24
|
+
* `CLAUDE_CODE_DISABLE_1M_CONTEXT=1` (see `getClaudeCodeEnvVars`), not by
|
|
25
|
+
* the bare slugs alone: every row maps via `behavesAs` onto a known Claude
|
|
26
|
+
* model whose client-side profile is native-1M.
|
|
27
|
+
*
|
|
28
|
+
* This module is deliberately dependency-free, including its own delegation
|
|
29
|
+
* graph literal: each pinned profile owns its graph so tuning one roster
|
|
30
|
+
* cannot silently retune another.
|
|
31
|
+
*/
|
|
32
|
+
const CHEAPEST_PROFILE_MODELS = Object.freeze({
|
|
33
|
+
lead: "gpt-6-luna",
|
|
34
|
+
explore: "gpt-6-luna",
|
|
35
|
+
"General-Purpose": "gpt-6-luna",
|
|
36
|
+
reviewer: "gpt-6-luna",
|
|
37
|
+
advisor: "gpt-5.6-sol",
|
|
38
|
+
oracle: "gpt-5.6-sol"
|
|
39
|
+
});
|
|
40
|
+
const CHEAPEST_PROFILE_NATIVE_AGENT_NAMES = [
|
|
41
|
+
"Explore",
|
|
42
|
+
"General-Purpose",
|
|
43
|
+
"reviewer"
|
|
44
|
+
];
|
|
45
|
+
const CHEAPEST_PROFILE_NATIVE_MODELS = Object.freeze({
|
|
46
|
+
Explore: CHEAPEST_PROFILE_MODELS.explore,
|
|
47
|
+
"General-Purpose": CHEAPEST_PROFILE_MODELS["General-Purpose"],
|
|
48
|
+
reviewer: CHEAPEST_PROFILE_MODELS.reviewer
|
|
49
|
+
});
|
|
50
|
+
const CHEAPEST_PROFILE_NATIVE_EFFORTS = Object.freeze({
|
|
51
|
+
Explore: "high",
|
|
52
|
+
"General-Purpose": "max",
|
|
53
|
+
reviewer: "max"
|
|
54
|
+
});
|
|
55
|
+
/**
|
|
56
|
+
* Lead context window (tokens) for `-m cheapest`. The Luna LEAD runs at
|
|
57
|
+
* Claude Code's DEFAULT (bare-slug) 200K budget — the whole point of the
|
|
58
|
+
* cheapest launch is that no role carries `[1m]` accounting.
|
|
59
|
+
*/
|
|
60
|
+
const CHEAPEST_PROFILE_LEAD_CONTEXT_TOKENS = 2e5;
|
|
61
|
+
/**
|
|
62
|
+
* Subagent/peer context window (tokens). Every non-lead role (and the lead
|
|
63
|
+
* as well) runs at Claude Code's DEFAULT (bare-slug) budget — 200K.
|
|
64
|
+
*/
|
|
65
|
+
const CHEAPEST_PROFILE_SUBAGENT_CONTEXT_TOKENS = 2e5;
|
|
66
|
+
const CHEAPEST_PROFILE_ADVISOR_MODEL = CHEAPEST_PROFILE_MODELS.advisor;
|
|
67
|
+
/**
|
|
68
|
+
* Client-visible Advisor identity for cheapest mode. The BARE Sol slug
|
|
69
|
+
* (no `[1m]` bracket): Claude Code budgets the Advisor tool as a 200K-model
|
|
70
|
+
* and forwards no more than ~200K of the lead's transcript, and the proxy
|
|
71
|
+
* mirrors that with `CHEAPEST_PROFILE_ADVISOR_CONTEXT_TOKENS`.
|
|
72
|
+
*/
|
|
73
|
+
const CHEAPEST_PROFILE_ADVISOR_CLIENT_MODEL = CHEAPEST_PROFILE_MODELS.advisor;
|
|
74
|
+
/** Advisor context window for cheapest mode (tokens). */
|
|
75
|
+
const CHEAPEST_PROFILE_ADVISOR_CONTEXT_TOKENS = CHEAPEST_PROFILE_SUBAGENT_CONTEXT_TOKENS;
|
|
76
|
+
/**
|
|
77
|
+
* Curated-transcript token budget for the cheapest Advisor (the protégé
|
|
78
|
+
* consult). Unlike every other advisor profile, the cheapest lead CURATES the
|
|
79
|
+
* window: the proxy renders a small, tool-aware transcript and the lead's
|
|
80
|
+
* pre-call brief (`<caller_context>`) leads, so the advisor reads signal
|
|
81
|
+
* rather than a 200K dump of raw tool output.
|
|
82
|
+
*
|
|
83
|
+
* This is deliberately much smaller than the 200K client budget: the point is
|
|
84
|
+
* to bound advisor read cost and focus attention, not to maximize context.
|
|
85
|
+
* Default 24K, clamped to [16K, 32K], overridable via
|
|
86
|
+
* `GH_ROUTER_ADVISOR_TRANSCRIPT_TOKENS` (see `resolveCheapestAdvisorTranscriptTokens`).
|
|
87
|
+
*/
|
|
88
|
+
const CHEAPEST_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_DEFAULT = 24e3;
|
|
89
|
+
const CHEAPEST_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_MIN = 16e3;
|
|
90
|
+
const CHEAPEST_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_MAX = 32e3;
|
|
91
|
+
const CHEAPEST_PROFILE_ADVISOR_EFFORT = "medium";
|
|
92
|
+
const CHEAPEST_PROFILE_ORACLE_MODEL = CHEAPEST_PROFILE_MODELS.oracle;
|
|
93
|
+
const CHEAPEST_PROFILE_ORACLE_EFFORT = "high";
|
|
94
|
+
/**
|
|
95
|
+
* Synthesized MCP consultant tools for `-m cheapest`: Oracle only, like
|
|
96
|
+
* `-m cheap` (never `astra`).
|
|
97
|
+
*/
|
|
98
|
+
const CHEAPEST_PROFILE_SYNTHESIZED_PEERS = ["oracle"];
|
|
99
|
+
/** Each native role's permitted native-agent targets. The lead gets the roster.
|
|
100
|
+
* There is no `Plan` role: the lead plans directly (reviewing the final plan
|
|
101
|
+
* with the Advisor before presenting it) and the cheapest planner's heavy
|
|
102
|
+
* use of `Explore` and `General-Purpose` is prompt-level guidance in its
|
|
103
|
+
* agent definition, not a graph change. */
|
|
104
|
+
const CHEAPEST_PROFILE_DELEGATION_GRAPH = Object.freeze({
|
|
105
|
+
Explore: Object.freeze([]),
|
|
106
|
+
"General-Purpose": Object.freeze(["reviewer"]),
|
|
107
|
+
reviewer: Object.freeze([])
|
|
108
|
+
});
|
|
109
|
+
/**
|
|
110
|
+
* Every fixed identity for `-m cheapest` in one frozen aggregate.
|
|
111
|
+
*
|
|
112
|
+
* `cheapest2-profile-contract.ts` derives from this by spread, overriding only
|
|
113
|
+
* the Sol identities and the Advisor effort. Keeping the aggregate here means a
|
|
114
|
+
* field added to the family later is inherited by BOTH siblings automatically
|
|
115
|
+
* instead of being silently absent from the copy nobody remembered to edit.
|
|
116
|
+
*/
|
|
117
|
+
const CHEAPEST_PROFILE_CONTRACT = Object.freeze({
|
|
118
|
+
models: CHEAPEST_PROFILE_MODELS,
|
|
119
|
+
nativeAgentNames: CHEAPEST_PROFILE_NATIVE_AGENT_NAMES,
|
|
120
|
+
nativeModels: CHEAPEST_PROFILE_NATIVE_MODELS,
|
|
121
|
+
nativeEfforts: CHEAPEST_PROFILE_NATIVE_EFFORTS,
|
|
122
|
+
leadContextTokens: CHEAPEST_PROFILE_LEAD_CONTEXT_TOKENS,
|
|
123
|
+
subagentContextTokens: CHEAPEST_PROFILE_SUBAGENT_CONTEXT_TOKENS,
|
|
124
|
+
leadEffort: "max",
|
|
125
|
+
advisorModel: CHEAPEST_PROFILE_ADVISOR_MODEL,
|
|
126
|
+
advisorClientModel: CHEAPEST_PROFILE_ADVISOR_CLIENT_MODEL,
|
|
127
|
+
advisorContextTokens: CHEAPEST_PROFILE_ADVISOR_CONTEXT_TOKENS,
|
|
128
|
+
advisorTranscriptTokensDefault: CHEAPEST_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_DEFAULT,
|
|
129
|
+
advisorTranscriptTokensMin: CHEAPEST_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_MIN,
|
|
130
|
+
advisorTranscriptTokensMax: CHEAPEST_PROFILE_ADVISOR_TRANSCRIPT_TOKENS_MAX,
|
|
131
|
+
advisorEffort: CHEAPEST_PROFILE_ADVISOR_EFFORT,
|
|
132
|
+
oracleModel: CHEAPEST_PROFILE_ORACLE_MODEL,
|
|
133
|
+
oracleEffort: CHEAPEST_PROFILE_ORACLE_EFFORT,
|
|
134
|
+
synthesizedPeers: CHEAPEST_PROFILE_SYNTHESIZED_PEERS,
|
|
135
|
+
delegationGraph: CHEAPEST_PROFILE_DELEGATION_GRAPH
|
|
136
|
+
});
|
|
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
|
+
//#region src/lib/cheapest2-profile-contract.ts
|
|
183
|
+
/**
|
|
184
|
+
* Fixed identities for the literal `github-router claude -m cheapest2` profile.
|
|
185
|
+
*
|
|
186
|
+
* `cheapest2` is `cheapest` with the Sol tier moved from `gpt-5.6-sol` to
|
|
187
|
+
* `gpt-6.1-sol` and the Advisor raised to `high`. Everything else — the
|
|
188
|
+
* `gpt-6-luna`/max lead, the Luna subagents, the bare-slug 200K window, the
|
|
189
|
+
* curated 24K Advisor transcript budget, the Oracle-only peer set, the
|
|
190
|
+
* three-agent surface and the delegation graph — is inherited verbatim.
|
|
191
|
+
*
|
|
192
|
+
* Derived from `CHEAPEST_PROFILE_CONTRACT` by spread rather than copied: a
|
|
193
|
+
* field added to the family later is inherited here automatically, and the
|
|
194
|
+
* declared deltas are the only lines in this file that can drift.
|
|
195
|
+
*/
|
|
196
|
+
/** The 6.1 Sol tier that distinguishes this profile from `cheapest`. */
|
|
197
|
+
const CHEAPEST2_SOL_MODEL = "gpt-6.1-sol";
|
|
198
|
+
const CHEAPEST2_PROFILE_MODELS = Object.freeze({
|
|
199
|
+
...CHEAPEST_PROFILE_MODELS,
|
|
200
|
+
advisor: CHEAPEST2_SOL_MODEL,
|
|
201
|
+
oracle: CHEAPEST2_SOL_MODEL
|
|
202
|
+
});
|
|
203
|
+
const CHEAPEST2_PROFILE_NATIVE_MODELS = Object.freeze({
|
|
204
|
+
Explore: CHEAPEST2_PROFILE_MODELS.explore,
|
|
205
|
+
"General-Purpose": CHEAPEST2_PROFILE_MODELS["General-Purpose"],
|
|
206
|
+
reviewer: CHEAPEST2_PROFILE_MODELS.reviewer
|
|
207
|
+
});
|
|
208
|
+
const CHEAPEST2_PROFILE_ADVISOR_MODEL = CHEAPEST2_PROFILE_MODELS.advisor;
|
|
209
|
+
const CHEAPEST2_PROFILE_ADVISOR_CLIENT_MODEL = CHEAPEST2_PROFILE_MODELS.advisor;
|
|
210
|
+
/**
|
|
211
|
+
* The one non-model delta from `cheapest`: the Advisor runs at `high`. The
|
|
212
|
+
* Claude path already forces `high` on the wire for any cheapest-profile
|
|
213
|
+
* Advisor (`resolveAdvisorEffort`, `fastProfile = true`); this declaration
|
|
214
|
+
* matches the wire and makes the Pi runtime's Advisor `high` too.
|
|
215
|
+
*/
|
|
216
|
+
const CHEAPEST2_PROFILE_ADVISOR_EFFORT = "high";
|
|
217
|
+
const CHEAPEST2_PROFILE_ORACLE_MODEL = CHEAPEST2_PROFILE_MODELS.oracle;
|
|
218
|
+
/** The `-m cheapest2` aggregate: the base contract with only the Sol
|
|
219
|
+
* identities and the Advisor effort replaced. */
|
|
220
|
+
const CHEAPEST2_PROFILE_CONTRACT = Object.freeze({
|
|
221
|
+
...CHEAPEST_PROFILE_CONTRACT,
|
|
222
|
+
models: CHEAPEST2_PROFILE_MODELS,
|
|
223
|
+
nativeModels: CHEAPEST2_PROFILE_NATIVE_MODELS,
|
|
224
|
+
advisorModel: CHEAPEST2_PROFILE_ADVISOR_MODEL,
|
|
225
|
+
advisorClientModel: CHEAPEST2_PROFILE_ADVISOR_CLIENT_MODEL,
|
|
226
|
+
advisorEffort: CHEAPEST2_PROFILE_ADVISOR_EFFORT,
|
|
227
|
+
oracleModel: CHEAPEST2_PROFILE_ORACLE_MODEL
|
|
228
|
+
});
|
|
229
|
+
//#endregion
|
|
230
|
+
//#region src/lib/profile-family.ts
|
|
231
|
+
/**
|
|
232
|
+
* The `cheapest`/`cheapest2` and `balanced`/`balanced2` launch-profile families.
|
|
233
|
+
*
|
|
234
|
+
* The `-2` aliases are not separate tiers: each is its base profile with a
|
|
235
|
+
* declared set of Sol identities replaced (`cheapest2`: Advisor + Oracle at
|
|
236
|
+
* `gpt-6.1-sol`, Advisor effort `high`; `balanced2`: lead + reviewer at
|
|
237
|
+
* `gpt-6.1-sol`, Oracle `grok-4.7`). Every consumer therefore asks the family
|
|
238
|
+
* helpers below rather than comparing against one literal id, which is what
|
|
239
|
+
* keeps the two siblings from drifting: a check written for `cheapest` covers
|
|
240
|
+
* `cheapest2` by construction instead of needing a parallel branch.
|
|
241
|
+
*
|
|
242
|
+
* This module imports only the four contract modules — never
|
|
243
|
+
* `launch-profile.ts` — so it can be imported from anywhere in `src/lib`
|
|
244
|
+
* without creating a cycle.
|
|
245
|
+
*/
|
|
246
|
+
function isCheapestFamily(profileId) {
|
|
247
|
+
return profileId === "cheapest" || profileId === "cheapest2";
|
|
248
|
+
}
|
|
249
|
+
function isBalancedFamily(profileId) {
|
|
250
|
+
return profileId === "balanced" || profileId === "balanced2";
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Every FIXED-ROSTER launch profile: `fast`, the cheap pair, and both
|
|
254
|
+
* families. These are the launches whose MCP surface, picker rows,
|
|
255
|
+
* mirror purge and status line the router owns outright.
|
|
256
|
+
*
|
|
257
|
+
* `max` is deliberately absent. It shares some of the same wiring, but it
|
|
258
|
+
* has its own reviewer/roster path rather than the shared fast-style
|
|
259
|
+
* projection, so every call site that includes it says so explicitly.
|
|
260
|
+
*/
|
|
261
|
+
const PINNED_PROFILE_IDS = /* @__PURE__ */ new Set([
|
|
262
|
+
"fast",
|
|
263
|
+
"cheap",
|
|
264
|
+
"cheap1m",
|
|
265
|
+
"cheapest",
|
|
266
|
+
"cheapest2",
|
|
267
|
+
"balanced",
|
|
268
|
+
"balanced2"
|
|
269
|
+
]);
|
|
270
|
+
function isPinnedLaunchProfile(profileId) {
|
|
271
|
+
return profileId != null && PINNED_PROFILE_IDS.has(profileId);
|
|
272
|
+
}
|
|
273
|
+
/** The contract for a cheapest-family profile. Any other id falls back to the
|
|
274
|
+
* base contract, so a caller that asks for a family contract on a
|
|
275
|
+
* non-family launch still gets a complete, valid object rather than
|
|
276
|
+
* `undefined`. */
|
|
277
|
+
function cheapestContractFor(profileId) {
|
|
278
|
+
return profileId === "cheapest2" ? CHEAPEST2_PROFILE_CONTRACT : CHEAPEST_PROFILE_CONTRACT;
|
|
279
|
+
}
|
|
280
|
+
/** The contract for a balanced-family profile (base fallback, as above). */
|
|
281
|
+
function balancedContractFor(profileId) {
|
|
282
|
+
return profileId === "balanced2" ? BALANCED2_PROFILE_CONTRACT : BALANCED_PROFILE_CONTRACT;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Human-readable model name for prose and descriptors. These strings reach
|
|
286
|
+
* the model's own instructions and the user's terminal, so they are spelled
|
|
287
|
+
* out rather than derived: "GPT-6.1 Sol" is not mechanical from the slug, and
|
|
288
|
+
* an id with no entry (an operator-pinned model) is returned verbatim rather
|
|
289
|
+
* than guessed at.
|
|
290
|
+
*/
|
|
291
|
+
const MODEL_DISPLAY_NAMES = Object.freeze({
|
|
292
|
+
"gpt-6.1-sol": "GPT-6.1 Sol",
|
|
293
|
+
"gpt-5.6-sol": "GPT-5.6 Sol",
|
|
294
|
+
"gpt-6-sol": "GPT-6 Sol",
|
|
295
|
+
"gpt-6-luna": "GPT-6 Luna",
|
|
296
|
+
"grok-4.7": "Grok 4.7",
|
|
297
|
+
"grok-4.6": "Grok 4.6",
|
|
298
|
+
"claude-opus-5.5": "Opus 5"
|
|
299
|
+
});
|
|
300
|
+
function displayModelName(modelId) {
|
|
301
|
+
return MODEL_DISPLAY_NAMES[modelId] ?? modelId;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* The model the cheapest-family prompt rewrite runs on. Both siblings rewrite
|
|
305
|
+
* with their own advisor-tier Sol, so one call site serves both and a future
|
|
306
|
+
* tier only has to change its contract.
|
|
307
|
+
*/
|
|
308
|
+
function cheapestRewriteModelFor(profileId) {
|
|
309
|
+
return cheapestContractFor(profileId).advisorModel;
|
|
310
|
+
}
|
|
311
|
+
//#endregion
|
|
5
312
|
//#region src/lib/cheapest-prompt-rewrite.ts
|
|
6
313
|
/**
|
|
7
314
|
* Cheapest-only Sol → Luna prompt rewrite (additive, fail-open).
|
|
@@ -20,8 +327,9 @@ import path from "node:path";
|
|
|
20
327
|
* - static context pack first (user prompt + AGENTS.md/CLAUDE.md + repo
|
|
21
328
|
* structure + search snippets), all capped for cache-friendliness EXCEPT
|
|
22
329
|
* the user prompt, which is passed through in full.
|
|
23
|
-
* - rewriter is `gpt-5.6-sol`
|
|
24
|
-
*
|
|
330
|
+
* - rewriter is the family's Advisor-tier Sol (`gpt-5.6-sol` on `cheapest`,
|
|
331
|
+
* `gpt-6.1-sol` on `cheapest2`) bare 200K at medium effort, via the
|
|
332
|
+
* caller's `inferSol`.
|
|
25
333
|
* - the contract leads with grounding + constraints (small models' documented
|
|
26
334
|
* weak spot) and explicitly avoids prescribing step-by-step procedure or
|
|
27
335
|
* CoT, which measurably degrade instruction-following; the ordered plan is
|
|
@@ -35,7 +343,6 @@ import path from "node:path";
|
|
|
35
343
|
* existing V2 scope/goal path; a wall-clock timeout yields
|
|
36
344
|
* `{ brief: null, timedOut: true }` and is TERMINAL for the prompt.
|
|
37
345
|
*/
|
|
38
|
-
const CHEAPEST_REWRITE_MODEL = "gpt-5.6-sol";
|
|
39
346
|
const CHEAPEST_REWRITE_EFFORT = "medium";
|
|
40
347
|
/** Max chars per search-result blob fed to Sol. */
|
|
41
348
|
const CHEAPEST_REWRITE_SEARCH_CAP = 6144;
|
|
@@ -56,7 +363,7 @@ function isCheapestRewriteDisabledEnv(env = process.env) {
|
|
|
56
363
|
function isCheapestRewriteEligible(input) {
|
|
57
364
|
if (!input.steerEnabled) return false;
|
|
58
365
|
if (input.rewriteDisabled) return false;
|
|
59
|
-
if (input.profile
|
|
366
|
+
if (!isCheapestFamily(input.profile)) return false;
|
|
60
367
|
return input.promptIsNonTrivial;
|
|
61
368
|
}
|
|
62
369
|
/** Adaptive budget: 5 only on Sol's explicit deep-grounding flag, else 3. */
|
|
@@ -830,6 +1137,6 @@ function buildStaticPack(workspace) {
|
|
|
830
1137
|
};
|
|
831
1138
|
}
|
|
832
1139
|
//#endregion
|
|
833
|
-
export { decidePromptSubmitV2 as a, CHEAPEST_REWRITE_EFFORT as c,
|
|
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 };
|
|
834
1141
|
|
|
835
|
-
//# sourceMappingURL=static-context-pack-
|
|
1142
|
+
//# sourceMappingURL=static-context-pack-BRqt4ajJ.js.map
|