github-router 0.3.229 → 0.3.233

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/main.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import { $ as searchWeb, $t as UPSTREAM_FETCH_TIMEOUT_MS, A as trustRepo, At as createResponses, Bt as warmTreeSitterPool, C as fileLastPromptStore, Cn as copilotBaseUrl, Ct as shimDefaultsToXhigh, D as repoRoot, Dt as assembleResponsesPayload, E as repoFingerprint, En as state, Et as getTokenCount, Ft as provisionBrowserAssets, G as buildEnv, Gt as buildWorkspaceHeaderHelperCommand, Ht as DEFINITION_OF_GREATNESS, It as hasSupportedBrowserInstalled, J as toolbeltEnabled, Jt as toolbeltPathOverride, K as availableToolCommands, Kt as buildWorkspaceHeaderJson, Lt as provisionAndIndexColbert, M as resolveSealedGate, Mt as MAX_RESPONSE_BODY_BYTES, Nt as readResponseBodyCapped, O as stopGateEnabledForRepo, Ot as resolveMcpToolTimeoutMs, Pt as parseJsonOrDiagnose, Q as assetFor, Qt as DEFAULT_PORT, Rt as extractTarGzMember, S as fileFindingsStore, Sn as GITHUB_API_BASE_URL, St as workerToolsEnabled, T as isSubagentContext, Tn as githubHeaders, Tt as createMessages, Ut as shouldUseInsecureTls, Vt as CONDENSED_OPERATING_SEQUENCE, Wt as ArtifactClient, X as vscodeRipgrepPath, Xt as DEFAULT_CODEX_MODEL, Y as toolbeltSkipSet, Yt as DEFAULT_CLAUDE_MODEL_FALLBACKS, Z as TOOLBELT_TOOLS, Zt as DEFAULT_CODEX_MODEL_FALLBACKS, _ as stopGateDisabled, _n as getModels, _t as browserToolsEnabled, a as buildPeerAwarenessSnippet, an as setupCopilotToken, at as buildAnthropicErrorEvent, b as stopReviewEnabled, bn as HTTPError, bt as nativeSubagentModel, c as personasFor, cn as tryRefreshAndRetry, ct as logStreamError, d as buildStopHookCommand, dn as cacheVSCodeVersion, dt as handleMcpDelete, en as UPSTREAM_INACTIVITY_TIMEOUT_MS, et as ADVISOR_INTERNAL_TOOL_NAME, f as captureLaunchBaseline, fn as filterBetaHeader, ft as handleMcpPost, g as launchBaselineKey, gn as sleep$1, gt as browserCompoundToolsEnabled, h as injectStopHookIntoSettingsFile, hn as resolveModel, ht as browseAgentEnabled, i as buildAgentPrompt, in as withInstallLock, it as isAdvisorRequested, j as liveExec, jt as createChatCompletions, k as stopReviewStateDir, kt as pickEndpoint, l as buildArtifactOpenHookCommand, ln as cacheCopilotVersion, lt as readIteratorWithTimeout, m as fileBlockBudget, mn as resolveCodexModel, mt as artifactToolsEnabled, n as MCP_GROUPS, nn as pickClaudeDefault, nt as buildAdvisorStream, o as buildPeerAwarenessSummary, on as setupGitHubAgentToken, ot as buildOpenAIErrorEvent, p as decideStopHook, pn as isNullish, pt as agentToolsEnabled, q as buildToolbeltAwareness, qt as collapsePathKeys, r as assertMcpToolSurfaceConsistent, rn as getPackageVersion, rt as injectAdvisorTool, s as enumerateInjectedMcpToolNames, sn as setupGitHubToken, st as isControllerClosedError, t as GROUP_META, tn as generateRandomPort, tt as ADVISOR_TOOL_INSTRUCTIONS, u as buildSessionBindHookCommand, un as cacheModels, ut as relayAnthropicStream, v as stopGateId, vn as getGitHubUser, vt as fleetToolsEnabled, w as fileReviewDebounce, wn as copilotHeaders, wt as countTokens, x as fileBaselineStore, xn as forwardError, xt as standInToolEnabled, y as stopGatePlanMode, yn as fetchWithTransientRetry, yt as geminiAvailable, zt as extractZipMember } from "./peer-mcp-personas-BKwMCOsl.js";
3
- import { a as isUnderClaudeConfigMirror, d as writeRuntimeFileSecure, i as ensurePaths, o as removeOwnClaudeConfigMirror, r as ensureClaudeConfigMirror, t as PATHS, u as writeArtifactCredsToMirror } from "./paths-BO22pMUb.js";
4
- import { c as killManagedTree, d as runCommandCapture, f as runCommandVoid, l as parseBoolEnv, s as killChildProcessTree, u as resolveExecutable } from "./lifecycle-D-1CYr1Y.js";
5
- import { a as sweepRegistry } from "./lifecycle-bPdiXjYB.js";
2
+ import { $ as searchWeb, $t as DEFAULT_CODEX_MODEL, A as trustRepo, At as assembleResponsesPayload, Bt as provisionAndIndexColbert, C as fileLastPromptStore, Cn as HTTPError, Ct as scribeModel, D as repoRoot, Dn as copilotHeaders, Dt as countTokens, E as repoFingerprint, En as copilotBaseUrl, Et as shimDefaultsToXhigh, Ft as MAX_RESPONSE_BODY_BYTES, G as buildEnv, Gt as DEFINITION_OF_GREATNESS, Ht as extractZipMember, It as readResponseBodyCapped, J as toolbeltEnabled, Jt as buildWorkspaceHeaderHelperCommand, K as availableToolCommands, Kt as shouldUseInsecureTls, Lt as parseJsonOrDiagnose, M as resolveSealedGate, Mt as pickEndpoint, Nt as createResponses, O as stopGateEnabledForRepo, On as githubHeaders, Ot as createMessages, Pt as createChatCompletions, Q as assetFor, Qt as DEFAULT_CLAUDE_MODEL_FALLBACKS, Rt as provisionBrowserAssets, S as fileFindingsStore, Sn as fetchWithTransientRetry, St as scoutModel, T as isSubagentContext, Tn as GITHUB_API_BASE_URL, Tt as workerToolsEnabled, Ut as warmTreeSitterPool, Vt as extractTarGzMember, Wt as CONDENSED_OPERATING_SEQUENCE, X as vscodeRipgrepPath, Xt as collapsePathKeys, Y as toolbeltSkipSet, Yt as buildWorkspaceHeaderJson, Z as TOOLBELT_TOOLS, Zt as toolbeltPathOverride, _ as stopGateDisabled, _n as resolveCodexModel, _t as browserCompoundToolsEnabled, a as buildPeerAwarenessSnippet, an as pickClaudeDefault, at as buildAnthropicErrorEvent, b as stopReviewEnabled, bn as getModels, bt as geminiAvailable, c as personasFor, cn as setupCopilotToken, ct as logStreamError, d as buildStopHookCommand, dn as tryRefreshAndRetry, dt as handleMcpDelete, en as DEFAULT_CODEX_MODEL_FALLBACKS, et as ADVISOR_INTERNAL_TOOL_NAME, f as captureLaunchBaseline, fn as cacheCopilotVersion, ft as handleMcpPost, g as launchBaselineKey, gn as isNullish, gt as browseAgentEnabled, h as injectStopHookIntoSettingsFile, hn as filterBetaHeader, ht as brainstormModel, i as buildAgentPrompt, in as generateRandomPort, it as isAdvisorRequested, j as liveExec, jt as resolveMcpToolTimeoutMs, k as stopReviewStateDir, kn as state, kt as getTokenCount, l as buildArtifactOpenHookCommand, ln as setupGitHubAgentToken, lt as readIteratorWithTimeout, m as fileBlockBudget, mn as cacheVSCodeVersion, mt as artifactToolsEnabled, n as MCP_GROUPS, nn as UPSTREAM_FETCH_TIMEOUT_MS, nt as buildAdvisorStream, o as buildPeerAwarenessSummary, on as getPackageVersion, ot as buildOpenAIErrorEvent, p as decideStopHook, pn as cacheModels, pt as agentToolsEnabled, q as buildToolbeltAwareness, qt as ArtifactClient, r as assertMcpToolSurfaceConsistent, rn as UPSTREAM_INACTIVITY_TIMEOUT_MS, rt as injectAdvisorTool, s as enumerateInjectedMcpToolNames, sn as withInstallLock, st as isControllerClosedError, t as GROUP_META, tn as DEFAULT_PORT, tt as ADVISOR_TOOL_INSTRUCTIONS, u as buildSessionBindHookCommand, un as setupGitHubToken, ut as relayAnthropicStream, v as stopGateId, vn as resolveModel, vt as browserToolsEnabled, w as fileReviewDebounce, wn as forwardError, wt as standInToolEnabled, x as fileBaselineStore, xn as getGitHubUser, xt as nativeSubagentModel, y as stopGatePlanMode, yn as sleep$1, yt as fleetToolsEnabled, zt as hasSupportedBrowserInstalled } from "./peer-mcp-personas-B-EPdjSE.js";
3
+ import { a as isUnderClaudeConfigMirror, d as writeRuntimeFileSecure, i as ensurePaths, o as removeOwnClaudeConfigMirror, r as ensureClaudeConfigMirror, t as PATHS, u as writeArtifactCredsToMirror } from "./paths-ogCi3URX.js";
4
+ import { c as killManagedTree, d as runCommandCapture, f as runCommandVoid, l as parseBoolEnv, s as killChildProcessTree, u as resolveExecutable } from "./lifecycle-C5ALWmZK.js";
5
+ import { a as sweepRegistry } from "./lifecycle-DR4TGEIY.js";
6
6
  import { defineCommand, runMain } from "citty";
7
7
  import consola from "consola";
8
8
  import { createHash, randomBytes, randomUUID } from "node:crypto";
@@ -1243,6 +1243,75 @@ const BUILTIN_SUBAGENT_DEFINITIONS = {
1243
1243
  prompt: "You are a planning agent. Read the codebase (read-only — do not modify files) to design a concrete, ordered implementation plan for the task: the approach, the specific files to change, reuse of existing utilities, risks, and how the result will be verified. Return the plan as your final message."
1244
1244
  }
1245
1245
  };
1246
+ /** Empty-string-safe read of an optional model id. */
1247
+ function nonEmptyModel(id) {
1248
+ return id && id.length > 0 ? id : void 0;
1249
+ }
1250
+ /**
1251
+ * The shared "prefer the dedicated tools over shell" steer, appended to every
1252
+ * native subagent prompt. `bashUses` names the work that legitimately belongs in
1253
+ * Bash for that agent (`builds` for a coder, `repros` for an investigator), the
1254
+ * only token that ever differed across the three hand-copied variants this
1255
+ * replaces.
1256
+ *
1257
+ * Deliberately NOT merged with `FILE_TOOL_GUIDANCE` in
1258
+ * `anthropic-translate/anthropic-request.ts`: that one is injected at the shim
1259
+ * boundary and therefore only reaches shim-routed (non-Claude) models. When a
1260
+ * native falls back to the lead's Claude model the shim is bypassed entirely, so
1261
+ * this prompt-level copy is the only coverage that survives. Two layers, two
1262
+ * different reasons to exist.
1263
+ */
1264
+ function fileToolSteer(bashUses) {
1265
+ return `Use the dedicated Edit/Write/Read tools for file changes and Grep/Glob for search; reserve Bash for running ${bashUses}, tests, and git. Do not shell out (sed/awk/python/here-docs) to read or edit files.`;
1266
+ }
1267
+ /** The read-only half of `fileToolSteer`, for agents that never write. */
1268
+ function readOnlyToolSteer() {
1269
+ return "Use Read to read files and Grep/Glob plus the semantic code search tool to find them; Bash is for read-only inspection such as git log, git blame, and git show. Do not modify any file, and do not run mutating commands.";
1270
+ }
1271
+ /**
1272
+ * `tools:` allowlist for the read-only natives (`scout`, `brainstorm`), modelled
1273
+ * on Claude Code's own `Explore`/`Plan` built-ins, which run with every tool
1274
+ * EXCEPT Agent / Artifact / ExitPlanMode / Edit / Write / NotebookEdit — note
1275
+ * that Anthropic's own read-only agent keeps Bash, which is what makes `git log`
1276
+ * and `git blame` reachable.
1277
+ *
1278
+ * Two deliberate deviations, both forced by the frontmatter format:
1279
+ *
1280
+ * 1. `tools:` is a POSITIVE allowlist with no "all except" form, so the
1281
+ * complement has to be spelled out. Rather than enumerate every harness tool
1282
+ * (which varies by Claude Code version, and would silently drop anything
1283
+ * added later), this lists the read / search / shell core that a read-only
1284
+ * agent actually uses. Tools added by a future release are NOT inherited by
1285
+ * these two agents; that is the price of real enforcement over a prompt that
1286
+ * merely asks nicely.
1287
+ * 2. The workers and orchestrate MCP groups are excluded on the same reasoning
1288
+ * that makes `Explore` drop `Agent`: both spawn further agents, so leaving
1289
+ * them in would reintroduce exactly the recursion that exclusion prevents.
1290
+ *
1291
+ * NOT A SANDBOX. `Bash` is retained because Anthropic's own read-only built-in
1292
+ * retains it, and without it an explorer cannot run `git log` / `git blame` /
1293
+ * `git show`, which is most of what repository archaeology needs. A shell is a
1294
+ * general write primitive, so "read-only" here means the agent has no dedicated
1295
+ * mutation tool and is instructed not to mutate, NOT that mutation is
1296
+ * impossible. Dropping Edit/Write still removes the path a model reaches for by
1297
+ * default. If a future change needs a hard guarantee, this allowlist is not
1298
+ * where it can be made.
1299
+ *
1300
+ * `searchKey` is the RESOLVED group key, not the bare literal: a user-side
1301
+ * `mcpServers` collision renames the group (`gh-router-search`, …), and a
1302
+ * hardcoded `mcp__search__*` would then grant nothing at all.
1303
+ */
1304
+ function readOnlyToolAllowlist(searchKey) {
1305
+ return [
1306
+ "Read",
1307
+ "Grep",
1308
+ "Glob",
1309
+ "Bash",
1310
+ "WebFetch",
1311
+ "WebSearch",
1312
+ `mcp__${searchKey}__*`
1313
+ ];
1314
+ }
1246
1315
  /**
1247
1316
  * Build the JSON payload for `claude --agents <path>`.
1248
1317
  *
@@ -1275,22 +1344,41 @@ function buildPeerAgentDefinitions(opts) {
1275
1344
  }),
1276
1345
  ...peersMcp
1277
1346
  };
1278
- const nativeModel = opts.nativeSubagentModel && opts.nativeSubagentModel.length > 0 ? opts.nativeSubagentModel : void 0;
1347
+ const nativeModel = nonEmptyModel(opts.nativeSubagentModel);
1348
+ const brainstormModel$1 = nonEmptyModel(opts.brainstormModel);
1349
+ const scoutModel$1 = nonEmptyModel(opts.scoutModel);
1350
+ const scribeModel$1 = nonEmptyModel(opts.scribeModel);
1279
1351
  const modelField = nativeModel ? { model: nativeModel } : {};
1352
+ const searchKey = opts.groupKeys.search ?? GROUP_META.search.preferredKey;
1353
+ const searchMcp = opts.serverUrl ? { mcpServers: { [searchKey]: httpEntryFor(opts.serverUrl, "search", opts.nonce, opts.workspaceHeaderCmd) } } : {};
1280
1354
  out.implementer = {
1281
1355
  description: nativeModel ? `Bounded implementation subagent running ${nativeModel} (strong non-Claude coder, maximum reasoning). Use proactively for well-scoped coding tasks — edits, small features, fixes — to keep the lead's context focused; runs in its own context. Model is overridable at spawn.` : `Bounded implementation subagent (native tools, runs on the lead's model in its own context). Use proactively for well-scoped coding tasks — edits, small features, fixes — to keep the lead's context focused. Model is overridable at spawn.`,
1282
- prompt: "You are a bounded implementation subagent for well-scoped coding tasks. Implement the requested change surgically, matching the surrounding code style and minimizing unrelated churn. Use the dedicated Edit/Write/Read tools for file changes and Grep/Glob for search; reserve Bash for running builds, tests, and git — do not shell out (sed/awk/python/here-docs) to read or edit files. Verify with the project's build or tests where applicable. Do the work yourself — do not spawn further subagents. Report exactly what changed and any risks.",
1356
+ prompt: "You are a bounded implementation subagent for well-scoped coding tasks. Implement the requested change surgically, matching the surrounding code style and minimizing unrelated churn. " + fileToolSteer("builds") + " Verify with the project's build or tests where applicable. Do the work yourself — do not spawn further subagents. Report exactly what changed and any risks.",
1283
1357
  ...modelField
1284
1358
  };
1285
- out.debugger = {
1286
- description: nativeModel ? `Root-cause & debugging subagent running ${nativeModel} at maximum reasoning. Use proactively for reproducing a bug end to end, isolating the true root cause, and proposing a minimal fix investigation-heavy work best kept off the lead's context; runs in its own context. Model is overridable at spawn.` : `Root-cause & debugging subagent (native tools, runs on the lead's model in its own context). Use proactively for reproducing a bug end to end, isolating the true root cause, and proposing a minimal fix kept off the lead's context. Model is overridable at spawn.`,
1287
- prompt: "You are a root-cause debugging subagent. Reproduce the failure end to end first — as close to how a real user hits it as you can before theorizing. Form hypotheses and test them against the actual code and runtime: read the code, run the repro with Bash, and add temporary instrumentation only if needed (remove it after). Identify the true root cause, not a symptom; if a fix is in scope, make it minimal and verify the repro now passes. Use the dedicated Edit/Write/Read tools for file changes and Grep/Glob for search; reserve Bash for running repros, tests, and git do not shell out (sed/awk/python/here-docs) to read or edit files. Do the work yourself — do not spawn further subagents. Report the root cause with evidence, the fix (if any), and any residual risks.",
1359
+ out.reviewer = {
1360
+ description: nativeModel ? `Feedback subagent running ${nativeModel} at maximum reasoning. Use proactively when something already exists and you want it assessed: a diff, a plan, a document, a failing test. It does whatever the assessment needs, including reproducing a failure and isolating its root cause, and keeps that work off the lead's context. Model is overridable at spawn.` : `Feedback subagent (native tools, runs on the lead's model in its own context). Use proactively when something already exists and you want it assessed: a diff, a plan, a document, a failing test. It does whatever the assessment needs, including reproducing a failure and isolating its root cause. Model is overridable at spawn.`,
1361
+ prompt: "You are a feedback subagent. Your job is to tell the caller what is actually true about the artifact you are given — code, a plan, a document, a failure report — and what is wrong with it. Verify against the ACTUAL code by reading it; never assume. Do whatever the assessment requires: reproduce a failure end to end as close to how a real user hits it as you can, form hypotheses and test them against the code and runtime, and isolate the true root cause rather than a symptom. Where the change warrants it, author tests that try to BREAK the implementation (edge cases, error paths, and the acceptance criteria as executable checks), run them, and report which pass and which fail; do NOT modify production code just to make tests pass. " + fileToolSteer("builds") + " Do the work yourself — do not spawn further subagents. Report severity-ranked findings with `file:line` citations, the evidence behind each, and end with a clear go/no-go.",
1288
1362
  ...modelField
1289
1363
  };
1290
- out["qa-engineer"] = {
1291
- description: nativeModel ? `Review, testing & QA subagent running ${nativeModel} at maximum reasoning. Use proactively to review a change for correctness, author and run tests that try to break it, and give a severity-ranked go/no-go while keeping the lead's context focused; runs in its own context. Model is overridable at spawn.` : `Review, testing & QA subagent (native tools, runs on the lead's model in its own context). Use proactively to review a change for correctness, author and run tests that try to break it, and give a severity-ranked go/no-go. Model is overridable at spawn.`,
1292
- prompt: "You are a review, testing, and QA subagent. Verify correctness against the ACTUAL code by reading it never assume. Where the change warrants it, author tests that try to BREAK the implementation (edge cases, error paths, and the acceptance criteria as executable checks), then run them and report which pass and which fail; do NOT modify production code just to make tests pass. Use the dedicated Edit/Write/Read tools for file changes and Grep/Glob for search; reserve Bash for running builds, tests, and git do not shell out (sed/awk/python/here-docs) to read or edit files. Do the work yourself do not spawn further subagents. Report severity-ranked findings with `file:line` citations and end with a clear go/no-go.",
1293
- ...modelField
1364
+ out.brainstorm = {
1365
+ description: brainstormModel$1 ? `Divergent-options subagent running ${brainstormModel$1} (third lab, for approaches the lead would not generate). Use proactively BEFORE an approach is chosen. Pass the decision, the constraints, what you have already ruled out, and the cost of being wrong; pass your current leading approach too if you have one, and it will try to beat it rather than restate it. Read-only; it proposes, then hands off to implementer. Model is overridable at spawn.` : `Divergent-options subagent (runs on the lead's model in its own context). Use proactively BEFORE an approach is chosen. Pass the decision, the constraints, what you have already ruled out, and the cost of being wrong; pass your current leading approach too if you have one, and it will try to beat it rather than restate it. Read-only; it proposes, then hands off to implementer. Model is overridable at spawn.`,
1366
+ prompt: "You are a divergent-options subagent: the lead's sounding board while an approach is still open. Your job is to surface the option the lead would not have reached on its own. If the caller states its current leading approach, your job is to try to beat it, and you close with one verdict: `replace`, `retain`, or `insufficient evidence`. `replace` requires naming a concrete alternative that dominates it and the evidence that decides between them. `retain` is a real answer and a useful one: say it plainly when the approach survives a genuine attempt to beat it. Manufactured disagreement is as useless as agreement; do neither. If the caller states no leading approach, generate independently and let the lead compare. Return 3 to 5 approaches that differ in MECHANISM, not in phrasing. For each: how it works, what it costs, what would have to be true for it to be the right answer, and the failure mode that would kill it. Near-duplicate options are the failure mode to avoid — if only one real approach exists, say so plainly and explain why the alternatives are dead, because one honest option beats four padded ones. Screen EVERY candidate against this repository and this environment before you rank them, then verify the one you are about to recommend can actually run here: read the code path it depends on, the guard that would refuse it, the artifact it assumes exists. A recommendation that cannot execute is worse than no recommendation. If checking kills your front-runner, rerank and say so. Ground every option in what the repository actually contains, and prefer reusing what is already there over inventing something new. " + readOnlyToolSteer() + " Do the work yourself — do not spawn further subagents.",
1367
+ tools: readOnlyToolAllowlist(searchKey),
1368
+ ...brainstormModel$1 ? { model: brainstormModel$1 } : {},
1369
+ ...searchMcp
1370
+ };
1371
+ if (scoutModel$1) out.scout = {
1372
+ description: `Read-only exploration subagent running ${scoutModel$1} (fast and cheap, so repository lookups do not run at the lead's model rates). Use proactively to find or understand something in the codebase: it sweeps widely and returns conclusions with file:line references rather than file dumps. Model is overridable at spawn.`,
1373
+ prompt: "You are a read-only exploration subagent. Answer the question by investigating the repository: cast a wide net, then narrow. Return the conclusion, not the raw material — cite `file:line` for anything load-bearing and quote only the lines that matter. If the answer is that something does not exist, say so explicitly and describe where you looked. " + readOnlyToolSteer() + " Do the work yourself — do not spawn further subagents.",
1374
+ tools: readOnlyToolAllowlist(searchKey),
1375
+ model: scoutModel$1,
1376
+ ...searchMcp
1377
+ };
1378
+ out.scribe = {
1379
+ description: scribeModel$1 ? `Documentation subagent running ${scribeModel$1}. Use proactively for prose that trails the code: docs, ADRs, CLAUDE.md sections, changelog entries, and README updates that have gone stale. Keeps low-glamour upkeep off the lead's context. Model is overridable at spawn.` : `Documentation subagent (runs on the lead's model in its own context). Use proactively for prose that trails the code: docs, ADRs, CLAUDE.md sections, changelog entries, and README updates that have gone stale. Model is overridable at spawn.`,
1380
+ prompt: "You are a documentation subagent. Write and maintain the prose that trails the code: docs, ADRs, CLAUDE.md sections, changelog entries, README rows. Read the code before describing it — every claim you write must be checkable against the repository as it is now, not as a summary said it was. Match the surrounding document's voice, structure, and level of detail. Prefer updating an existing document over adding a new one, and delete what has become false rather than layering a correction on top of it. " + fileToolSteer("builds") + " Do the work yourself — do not spawn further subagents. Report which documents changed and any claim you could not verify.",
1381
+ ...scribeModel$1 ? { model: scribeModel$1 } : {}
1294
1382
  };
1295
1383
  if (opts.workerToolsAvailable) {
1296
1384
  const workersKey = workersKeyOf(opts.groupKeys);
@@ -1628,6 +1716,9 @@ async function writePeerMcpRuntimeFiles(serverUrl, opts) {
1628
1716
  workerToolsAvailable: opts.workerToolsAvailable,
1629
1717
  browseAvailable: opts.browseAvailable,
1630
1718
  nativeSubagentModel: opts.nativeSubagentModel,
1719
+ brainstormModel: opts.brainstormModel,
1720
+ scoutModel: opts.scoutModel,
1721
+ scribeModel: opts.scribeModel,
1631
1722
  nonce,
1632
1723
  codexHome,
1633
1724
  serverUrl,
@@ -2894,7 +2985,7 @@ async function discoverGateCommands(cwd, opts) {
2894
2985
  if (files.length === 0) return null;
2895
2986
  let result;
2896
2987
  try {
2897
- const { runWorkerAgent } = await import("./engine-v9-pEKoD.js");
2988
+ const { runWorkerAgent } = await import("./engine-BEvlds_1.js");
2898
2989
  result = await runWorkerAgent({
2899
2990
  mode: "explore",
2900
2991
  workspace: root,
@@ -4079,7 +4170,7 @@ const STYLE_DIRECTIVE = "Write concisely without losing detail. Use a natural hu
4079
4170
  * Self-referentially compliant with the style directive: no em dashes, no
4080
4171
  * Claude / Anthropic attribution.
4081
4172
  */
4082
- const OPERATING_DEFAULTS_DIRECTIVE = "## Operating defaults (apply when the user has not specified otherwise; the user's explicit direction and the domain's own standards always override)\n\nOrchestrate. Delegate research, implementation, review, and large reads to the right subagent, worker, or model (the `implementer`, `debugger`, and `qa-engineer` native subagents for bounded implementation, root-cause debugging, and review/testing respectively; worker-* agents for background non-blocking runs; Task subagents for parallel work; peer critics for review) so your own context stays free to reason and collaborate with the user. Prefer parallel delegation for independent work. Do trivial, surgical, and last-mile work directly; delegate the rest rather than doing it yourself and filling your own context. Delegate to a subagent by default whenever one can do the work without loss of quality: the main thread is where you think with and respond to the user, and its context window is a finite shared resource, so protect it by pushing heavy or exploratory work outward and keeping only the conclusions.\n\nAim high. Default to radical simplicity and a relentless focus on the user's real experience: design for the person and the job to be done, not the demo. Reason about the whole system from first principles, anticipating scale and the long arc rather than patching the surface. Work backwards from the outcome the user actually needs. Question every assumption and prefer what you can derive, reproduce, or test.\n\nEngineering excellence. When making technical decisions, give little weight to development cost; prefer quality, simplicity, robustness, scalability, and long-term maintainability. Fix a bug by first reproducing it end to end, as close to how a real user hits it as you can, so you solve the real problem and not a symptom. When testing a product end to end, be picky about the UI and obsessed with pixel perfection: if something clearly looks off, even when it is unrelated to your task, get it fixed along the way. Hold that same bar for the codebase itself: a lint error, a failing test, or a flaky test is worth fixing the moment you see it, whoever introduced it. Fold it into your current work rather than letting it derail the task the user actually asked for.";
4173
+ const OPERATING_DEFAULTS_DIRECTIVE = "## Operating defaults (apply when the user has not specified otherwise; the user's explicit direction and the domain's own standards always override)\n\nOrchestrate. Delegate research, implementation, review, and large reads to the right subagent, worker, or model. Reach for `implementer` when you know what to build, `reviewer` when something exists and you want it assessed (including reproducing and root-causing a failure), `brainstorm` when you do not yet know which approach to take, `scout` to find or understand something in the repo, and `scribe` for docs and ADRs that trail the code; worker-* agents for background non-blocking runs; Task subagents for parallel work; peer critics for review. That keeps your own context free to reason and collaborate with the user. Prefer parallel delegation for independent work. Do trivial, surgical, and last-mile work directly; delegate the rest rather than doing it yourself and filling your own context. Delegate to a subagent by default whenever one can do the work without loss of quality: the main thread is where you think with and respond to the user, and its context window is a finite shared resource, so protect it by pushing heavy or exploratory work outward and keeping only the conclusions.\n\nAim high. Default to radical simplicity and a relentless focus on the user's real experience: design for the person and the job to be done, not the demo. Reason about the whole system from first principles, anticipating scale and the long arc rather than patching the surface. Work backwards from the outcome the user actually needs. Question every assumption and prefer what you can derive, reproduce, or test.\n\nEngineering excellence. When making technical decisions, give little weight to development cost; prefer quality, simplicity, robustness, scalability, and long-term maintainability. Fix a bug by first reproducing it end to end, as close to how a real user hits it as you can, so you solve the real problem and not a symptom. When testing a product end to end, be picky about the UI and obsessed with pixel perfection: if something clearly looks off, even when it is unrelated to your task, get it fixed along the way. Hold that same bar for the codebase itself: a lint error, a failing test, or a flaky test is worth fixing the moment you see it, whoever introduced it. Fold it into your current work rather than letting it derail the task the user actually asked for.";
4083
4174
  /**
4084
4175
  * Condensed digest of OPERATING_DEFAULTS_DIRECTIVE for the spawned session's
4085
4176
  * system prompt (--append-system-prompt). The FULL directive is prepended to
@@ -4820,8 +4911,20 @@ function keepDisplayOn() {
4820
4911
  const ES_CONTINUOUS = 2147483648;
4821
4912
  const ES_SYSTEM_REQUIRED = 1;
4822
4913
  const ES_DISPLAY_REQUIRED = 2;
4823
- /** Default time to wait for the helper's `OK` readiness line. */
4824
- const DEFAULT_READY_TIMEOUT_MS = 5e3;
4914
+ /** Default time to wait for the helper's `OK` readiness line.
4915
+ *
4916
+ * Sized for the slowest LEGITIMATE path, not the typical one. The script's
4917
+ * `Add-Type -MemberDefinition` compiles a C# P/Invoke shim through csc.exe on
4918
+ * first use, and that compile happens BEFORE the `OK` line is printed. On a
4919
+ * cold machine (a fresh CI runner, a laptop that just booted, a host with
4920
+ * aggressive on-access AV scanning) it routinely takes well over five seconds.
4921
+ *
4922
+ * Giving up early does not fail loudly, which is what makes a tight value
4923
+ * costly here: `ready` resolves false, the caller logs a debug no-op, and the
4924
+ * user silently loses keep-awake on exactly the slow machines most likely to be
4925
+ * left running unattended. Waiting longer costs nothing, because the readiness
4926
+ * promise is awaited in the background and never blocks launch. */
4927
+ const DEFAULT_READY_TIMEOUT_MS = 2e4;
4825
4928
  /**
4826
4929
  * The execution-state flags to assert. Always `ES_CONTINUOUS |
4827
4930
  * ES_SYSTEM_REQUIRED` (machine stays awake); adds `ES_DISPLAY_REQUIRED`
@@ -5222,7 +5325,7 @@ function initProxyFromEnv() {
5222
5325
  //#endregion
5223
5326
  //#region package.json
5224
5327
  var name = "github-router";
5225
- var version$1 = "0.3.229";
5328
+ var version$1 = "0.3.233";
5226
5329
 
5227
5330
  //#endregion
5228
5331
  //#region src/lib/approval.ts
@@ -5347,7 +5450,7 @@ function detectCapabilityMismatch(info, model) {
5347
5450
  * that should get a probe row added.
5348
5451
  *
5349
5452
  * Format (single line, deterministic-ish key order):
5350
- * [fields] path=<P> body_keys=<csv> tool_field_keys=<csv> beta_values=<csv>
5453
+ * [fields] path=<P> body_keys=<csv> tool_field_keys=<csv> beta_values=<csv> agent=<id|->
5351
5454
  *
5352
5455
  * Where:
5353
5456
  * - `body_keys` is the alphabetical union of top-level keys in the
@@ -5357,13 +5460,19 @@ function detectCapabilityMismatch(info, model) {
5357
5460
  * - `beta_values` is the comma-split anthropic-beta header value as
5358
5461
  * received (NOT filtered) — captures what the client sends, not
5359
5462
  * what we forward
5463
+ * - `agent` is Claude Code's `x-claude-code-agent-id` header, or `-` for
5464
+ * main-loop traffic. Without it a capture cannot tell a subagent request
5465
+ * from a main-loop one, which is exactly the question you need answered
5466
+ * when reasoning about per-agent request shape (does a subagent send a
5467
+ * `thinking` block?). The header value is opaque to us and is logged
5468
+ * verbatim.
5360
5469
  */
5361
5470
  function logRequestFields(opts) {
5362
5471
  if (process.env.GH_ROUTER_LOG_FIELDS !== "1") return;
5363
5472
  const bodyKeys = collectTopLevelKeys(opts.body);
5364
5473
  const toolFieldKeys = collectToolFieldKeys(opts.body);
5365
5474
  const betaValues = (opts.betaHeader ?? "").split(",").map((v) => v.trim()).filter(Boolean);
5366
- consola.info(`[fields] path=${opts.path} body_keys=${bodyKeys.join(",")} tool_field_keys=${toolFieldKeys.join(",")} beta_values=${betaValues.join(",")}`);
5475
+ consola.info(`[fields] path=${opts.path} body_keys=${bodyKeys.join(",")} tool_field_keys=${toolFieldKeys.join(",")} beta_values=${betaValues.join(",")} agent=${opts.agentId && opts.agentId.length > 0 ? opts.agentId : "-"}`);
5367
5476
  }
5368
5477
  function collectTopLevelKeys(body) {
5369
5478
  if (!body || typeof body !== "object" || Array.isArray(body)) return [];
@@ -6306,20 +6415,29 @@ function parseDisableParallelToolUse(toolChoice) {
6306
6415
  return toolChoice.disable_parallel_tool_use === true ? false : void 0;
6307
6416
  }
6308
6417
  /** Default absent Anthropic `thinking` to an effort, clamped by the model.
6309
- * OpenAI-frontier shim models (gpt-5.6-sol/gpt-5.5) default to xhigh so the
6310
- * native gpt-5.6-sol subagents (implementer/debugger/qa-engineer) and any
6311
- * `-m gpt-5.6-sol` main-loop session reason at max when the client sends no
6312
- * `thinking` block; every other shim model stays high. The
6313
- * `supported.includes("xhigh")` guard makes the intent explicit rather than
6314
- * trusting clampEffort to silently degrade. Opt out with
6315
- * `GH_ROUTER_DISABLE_FRONTIER_XHIGH_DEFAULT=1`. Returns undefined for a model
6316
- * that advertises NO `reasoning_effort` allowlist (may not support reasoning;
6317
- * forcing an effort could 400). Note: an explicit client `thinking` budget is
6318
- * handled by parseReasoningEffort and is NOT affected by this default. */
6418
+ * Every shim model defaults to `high`, so a client level maps to the identical
6419
+ * provider level (low→low, medium→medium, high→high, xhigh→xhigh) and `high` is
6420
+ * the only value the router injects on its own. There is deliberately NO floor:
6421
+ * an explicit client budget that buckets to `medium` yields `medium`, because a
6422
+ * one-directional max() would mean the router silently overriding the level the
6423
+ * user chose.
6424
+ *
6425
+ * Opt in to the previous behavior (xhigh for the OpenAI frontier models when no
6426
+ * thinking is sent) with `GH_ROUTER_FRONTIER_XHIGH_DEFAULT=1`. This replaces the
6427
+ * old opt-OUT `GH_ROUTER_DISABLE_FRONTIER_XHIGH_DEFAULT`, whose meaning would
6428
+ * have inverted under the new default.
6429
+ *
6430
+ * Two honest limits, both pre-existing: the level is bucketed from a token
6431
+ * budget so the mapping is lossy at the boundaries, and `clampEffort` moves a
6432
+ * level the model does not advertise (gemini has no `xhigh`). Returns undefined
6433
+ * for a model that advertises NO `reasoning_effort` allowlist, which leaves the
6434
+ * provider's own default rather than `high` — forcing an effort there could 400.
6435
+ * An explicit client `thinking` budget is handled by parseReasoningEffort and is
6436
+ * NOT affected by this default. */
6319
6437
  function defaultReasoningEffort(model) {
6320
6438
  const supported = model?.capabilities?.supports?.reasoning_effort;
6321
6439
  if (!(Array.isArray(supported) && supported.length > 0)) return void 0;
6322
- return clampEffort(parseBoolEnv(process.env.GH_ROUTER_DISABLE_FRONTIER_XHIGH_DEFAULT) !== true && model?.id != null && shimDefaultsToXhigh(model.id) && supported.includes("xhigh") ? "xhigh" : "high", supported);
6440
+ return clampEffort(parseBoolEnv(process.env.GH_ROUTER_FRONTIER_XHIGH_DEFAULT) === true && model?.id != null && shimDefaultsToXhigh(model.id) && supported.includes("xhigh") ? "xhigh" : "high", supported);
6323
6441
  }
6324
6442
  /**
6325
6443
  * Map Anthropic `thinking` to a Responses reasoning effort, clamped to the
@@ -7367,7 +7485,8 @@ async function handleCompletion(c) {
7367
7485
  logRequestFields({
7368
7486
  path: c.req.path,
7369
7487
  body: parsedForLog,
7370
- betaHeader: c.req.header("anthropic-beta")
7488
+ betaHeader: c.req.header("anthropic-beta"),
7489
+ agentId: c.req.header("x-claude-code-agent-id")
7371
7490
  });
7372
7491
  }
7373
7492
  if (state.manualApprove) await awaitApproval();
@@ -9014,7 +9133,10 @@ const claude = defineCommand({
9014
9133
  groupKeys,
9015
9134
  workerToolsAvailable: workerToolsEnabled(),
9016
9135
  browseAvailable: browseAgentEnabled(),
9017
- nativeSubagentModel: nativeSubagentModel()
9136
+ nativeSubagentModel: nativeSubagentModel(),
9137
+ brainstormModel: brainstormModel(),
9138
+ scoutModel: scoutModel(),
9139
+ scribeModel: scribeModel()
9018
9140
  });
9019
9141
  state.peerMcpNonce = runtime.nonce;
9020
9142
  envVars.GH_ROUTER_HOOK_MCP_URL = serverUrl;
@@ -9217,6 +9339,7 @@ const claude = defineCommand({
9217
9339
  powerBrowseAvailable: state.powerBrowseEnabled,
9218
9340
  fleetAvailable: fleetToolsEnabled(),
9219
9341
  agentToolsAvailable: agentToolsEnabled(),
9342
+ scoutAvailable: scoutModel() != null,
9220
9343
  groupKeys
9221
9344
  });
9222
9345
  peerAwarenessSnippet = peerSnippet;
@@ -11007,6 +11130,9 @@ async function provisionServeEnhancements(serverUrl, opts = {}) {
11007
11130
  workerToolsAvailable: workerToolsEnabled(),
11008
11131
  browseAvailable: browseAllowed && browseAgentEnabled(),
11009
11132
  nativeSubagentModel: nativeSubagentModel(),
11133
+ brainstormModel: brainstormModel(),
11134
+ scoutModel: scoutModel(),
11135
+ scribeModel: scribeModel(),
11010
11136
  builtinSubagents: BUILTIN_SUBAGENT_DEFINITIONS
11011
11137
  });
11012
11138
  state.peerMcpNonce = runtime.nonce;
@@ -11025,6 +11151,7 @@ async function provisionServeEnhancements(serverUrl, opts = {}) {
11025
11151
  compoundBrowseAvailable: browseAllowed && browserCompoundToolsEnabled(),
11026
11152
  powerBrowseAvailable: browseAllowed && state.powerBrowseEnabled,
11027
11153
  agentToolsAvailable: firstMateAllowed,
11154
+ scoutAvailable: scoutModel() != null,
11028
11155
  groupKeys
11029
11156
  })).catch((err) => consola.warn(`Peer-awareness CLAUDE.md append failed: ${String(err)}`));
11030
11157
  await prependStyleDirectiveToMirroredClaudeMd().catch((err) => consola.warn(`Style-directive CLAUDE.md prepend failed: ${String(err)}`));