github-router 0.3.295 → 0.3.302
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/{attribution-settings-pkIop1NU.js → attribution-settings-B1xutIts.js} +153 -16
- package/dist/attribution-settings-B1xutIts.js.map +1 -0
- package/dist/{auth-CluG5e-l.js → auth-CpjOjoUG.js} +4 -3
- package/dist/{auth-CluG5e-l.js.map → auth-CpjOjoUG.js.map} +1 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/{check-usage-iOzfnKJe.js → check-usage-BsN3S4Fu.js} +4 -4
- package/dist/{check-usage-iOzfnKJe.js.map → check-usage-BsN3S4Fu.js.map} +1 -1
- package/dist/{claude-DNmxk-Rm.js → claude-uRuzEH0W.js} +216 -112
- package/dist/claude-uRuzEH0W.js.map +1 -0
- package/dist/{codex-Dl4gpHn-.js → codex-D5ag-liR.js} +6 -5
- package/dist/{codex-Dl4gpHn-.js.map → codex-D5ag-liR.js.map} +1 -1
- package/dist/{debug-DsEwleGg.js → debug-BXRPyeqO.js} +2 -2
- package/dist/{debug-DsEwleGg.js.map → debug-BXRPyeqO.js.map} +1 -1
- package/dist/engine-2uMJ4Isk.js +2 -0
- package/dist/fast-profile-contract-K3P58nj3.js +57 -0
- package/dist/fast-profile-contract-K3P58nj3.js.map +1 -0
- package/dist/{gate-discovery-WcduofL4.js → gate-discovery-BTRVyKWu.js} +5 -5
- package/dist/{gate-discovery-WcduofL4.js.map → gate-discovery-BTRVyKWu.js.map} +1 -1
- package/dist/{get-copilot-usage-B7Z4XVWj.js → get-copilot-usage-ByjQqhdi.js} +3 -2
- package/dist/{get-copilot-usage-B7Z4XVWj.js.map → get-copilot-usage-ByjQqhdi.js.map} +1 -1
- package/dist/hooks.mjs +351 -21
- package/dist/hooks.sha256 +1 -1
- package/dist/{internal-artifact-open-D6tKMg8v.js → internal-artifact-open-DRSxShAW.js} +2 -2
- package/dist/{internal-artifact-open-D6tKMg8v.js.map → internal-artifact-open-DRSxShAW.js.map} +1 -1
- package/dist/{internal-fast-dispatch-guard-CPlCrTlU.js → internal-fast-dispatch-guard-CYOWbxjX.js} +1 -1
- package/dist/{internal-fast-dispatch-guard-Xyu17k9X.js → internal-fast-dispatch-guard-D2HcfXZv.js} +22 -18
- package/dist/internal-fast-dispatch-guard-D2HcfXZv.js.map +1 -0
- package/dist/{internal-first-mate-guard-C9BV7J4U.js → internal-first-mate-guard-Bcb5JwiO.js} +3 -3
- package/dist/{internal-first-mate-guard-C9BV7J4U.js.map → internal-first-mate-guard-Bcb5JwiO.js.map} +1 -1
- package/dist/{internal-first-mate-guard-WJApyc8j.js → internal-first-mate-guard-Brh_uois.js} +1 -1
- package/dist/internal-max-dispatch-guard-Bcjavapx.js +2 -0
- package/dist/internal-max-dispatch-guard-BjSVXMvC.js +198 -0
- package/dist/internal-max-dispatch-guard-BjSVXMvC.js.map +1 -0
- package/dist/{internal-plan-review-t3PuNfuL.js → internal-plan-review-DVY-iV2x.js} +3 -3
- package/dist/{internal-plan-review-t3PuNfuL.js.map → internal-plan-review-DVY-iV2x.js.map} +1 -1
- package/dist/{internal-prompt-submit-C3KovHQG.js → internal-prompt-submit-BTqRn4FW.js} +4 -4
- package/dist/{internal-prompt-submit-C3KovHQG.js.map → internal-prompt-submit-BTqRn4FW.js.map} +1 -1
- package/dist/{internal-session-bind-d2uoja8I.js → internal-session-bind-YfH656lt.js} +2 -2
- package/dist/{internal-session-bind-d2uoja8I.js.map → internal-session-bind-YfH656lt.js.map} +1 -1
- package/dist/{internal-stop-hook-DJFtGCsE.js → internal-stop-hook-BZg__ab6.js} +5 -5
- package/dist/{internal-stop-hook-DJFtGCsE.js.map → internal-stop-hook-BZg__ab6.js.map} +1 -1
- package/dist/{internal-stop-review-YtDUGXpX.js → internal-stop-review-B8MmEyQ1.js} +2 -2
- package/dist/{internal-stop-review-YtDUGXpX.js.map → internal-stop-review-B8MmEyQ1.js.map} +1 -1
- package/dist/{internal-worker-guard-CdkeS9PN.js → internal-worker-guard-Dr6W83TC.js} +2 -2
- package/dist/{internal-worker-guard-CdkeS9PN.js.map → internal-worker-guard-Dr6W83TC.js.map} +1 -1
- package/dist/{internal-workspace-header-tuBXJV22.js → internal-workspace-header-Cep0WSIb.js} +2 -2
- package/dist/{internal-workspace-header-tuBXJV22.js.map → internal-workspace-header-Cep0WSIb.js.map} +1 -1
- package/dist/lifecycle-4TZrJuAa.js +2 -0
- package/dist/{lifecycle-CM9eTzvk.js → lifecycle-CmPJ6e_6.js} +2 -2
- package/dist/{lifecycle-CM9eTzvk.js.map → lifecycle-CmPJ6e_6.js.map} +1 -1
- package/dist/{lifecycle-Bg6doY3-.js → lifecycle-DgsJ_8Am.js} +2 -2
- package/dist/{lifecycle-Bg6doY3-.js.map → lifecycle-DgsJ_8Am.js.map} +1 -1
- package/dist/lifecycle-O91Vzzb-.js +2 -0
- package/dist/main.js +19 -18
- package/dist/main.js.map +1 -1
- package/dist/max-profile-contract-BTXowh6k.js +264 -0
- package/dist/max-profile-contract-BTXowh6k.js.map +1 -0
- package/dist/{mcp-workspace-header-dERl2YTT.js → mcp-workspace-header-NzFD0Wgd.js} +2 -2
- package/dist/{mcp-workspace-header-dERl2YTT.js.map → mcp-workspace-header-NzFD0Wgd.js.map} +1 -1
- package/dist/{models-DZ4hYsR7.js → models-1KwEUgzd.js} +3 -3
- package/dist/{models-DZ4hYsR7.js.map → models-1KwEUgzd.js.map} +1 -1
- package/dist/{orchestration-BiGCEwbH.js → orchestration-CYyp9w-t.js} +2 -2
- package/dist/{orchestration-BiGCEwbH.js.map → orchestration-CYyp9w-t.js.map} +1 -1
- package/dist/paths-DDAiPVto.js +2 -0
- package/dist/{paths-Ci485qSJ.js → paths-IcZW8gZx.js} +4 -4
- package/dist/{paths-Ci485qSJ.js.map → paths-IcZW8gZx.js.map} +1 -1
- package/dist/{peer-mcp-personas-BwNtC8jt.js → peer-mcp-personas-DwEiYeJS.js} +498 -260
- package/dist/peer-mcp-personas-DwEiYeJS.js.map +1 -0
- package/dist/{plan-review-hook-DuW0pSoM.js → plan-review-hook-szSNt6uU.js} +3 -3
- package/dist/{plan-review-hook-DuW0pSoM.js.map → plan-review-hook-szSNt6uU.js.map} +1 -1
- package/dist/{prompt-submit-hook-IMl7ssfr.js → prompt-submit-hook-ZUxo_jEl.js} +3 -3
- package/dist/{prompt-submit-hook-IMl7ssfr.js.map → prompt-submit-hook-ZUxo_jEl.js.map} +1 -1
- package/dist/{provision-DeNqzvSM.js → provision-BLT1pCFy.js} +4 -4
- package/dist/{provision-DeNqzvSM.js.map → provision-BLT1pCFy.js.map} +1 -1
- package/dist/{self-invocation-DAB_od0C.js → self-invocation-BJWbA8ka.js} +2 -2
- package/dist/{self-invocation-DAB_od0C.js.map → self-invocation-BJWbA8ka.js.map} +1 -1
- package/dist/{serve-BS5EmCpM.js → serve-wEZoOijw.js} +13 -12
- package/dist/{serve-BS5EmCpM.js.map → serve-wEZoOijw.js.map} +1 -1
- package/dist/{server-setup-DsGJnJ_O.js → server-setup-Zn5wkosb.js} +268 -41
- package/dist/server-setup-Zn5wkosb.js.map +1 -0
- package/dist/{start-vJdt2MiM.js → start-DSqU8d8h.js} +3 -3
- package/dist/{start-vJdt2MiM.js.map → start-DSqU8d8h.js.map} +1 -1
- package/dist/state-B8adscCv.js +51 -0
- package/dist/state-B8adscCv.js.map +1 -0
- package/dist/{stop-gate-hook-DQnh_KfI.js → stop-gate-hook-CJOk28zd.js} +3 -3
- package/dist/{stop-gate-hook-DQnh_KfI.js.map → stop-gate-hook-CJOk28zd.js.map} +1 -1
- package/dist/{stop-gate-policy-DMr3KVmw.js → stop-gate-policy-zhzRIj6G.js} +2 -2
- package/dist/{stop-gate-policy-DMr3KVmw.js.map → stop-gate-policy-zhzRIj6G.js.map} +1 -1
- package/dist/{token-BtJhjXXu.js → token-CbuFyx-B.js} +4 -50
- package/dist/token-CbuFyx-B.js.map +1 -0
- package/dist/{worker-dispatch-BEHkTbnH.js → worker-dispatch-DgP5yT26.js} +2 -2
- package/dist/{worker-dispatch-BEHkTbnH.js.map → worker-dispatch-DgP5yT26.js.map} +1 -1
- package/package.json +1 -1
- package/dist/attribution-settings-pkIop1NU.js.map +0 -1
- package/dist/claude-DNmxk-Rm.js.map +0 -1
- package/dist/engine-XnluJUs6.js +0 -2
- package/dist/internal-fast-dispatch-guard-Xyu17k9X.js.map +0 -1
- package/dist/lifecycle-CGLt1cJQ.js +0 -2
- package/dist/lifecycle-DoUwpVDB.js +0 -2
- package/dist/paths-GD7bgGGy.js +0 -2
- package/dist/peer-mcp-personas-BwNtC8jt.js.map +0 -1
- package/dist/server-setup-DsGJnJ_O.js.map +0 -1
- package/dist/token-BtJhjXXu.js.map +0 -1
|
@@ -1,27 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { o as removeOwnClaudeConfigMirror, r as ensureClaudeConfigMirror, t as PATHS, u as writeArtifactCredsToMirror } from "./paths-
|
|
3
|
-
import {
|
|
1
|
+
import { At as scribeModel, Bn as resolveLeadSlugArg, Ct as generalPurposeFastModel, D as toolbeltEnabled, Dt as reviewerFastModel, E as buildToolbeltAwareness, En as shouldUseInsecureTls, Et as resolveGeminiReviewModel, Jt as resolveLaunchProfile, Mt as workerToolsEnabled, Ot as reviewerModel, Pt as LUNA_DRIVER_ALIAS_ID, Rn as isBudgetClaudeLead, Sn as warmTreeSitterPool, St as geminiAvailable, T as availableToolCommands, Tt as nativeSubagentModel, Ut as formatFastPrerequisiteFailure, Xt as validateFastProfilePrerequisites, Zt as validateMaxProfileLaunch, _t as fastOracleModel, an as registerLaunch, at as FAST_IMPLEMENTER_EFFORT, bt as fastScoutModel, ct as FAST_SCOUT_EFFORT, dt as brainstormModel, ft as browseAgentEnabled, gn as provisionBrowserAssets, gt as fastImplementerModel, ht as fastCriticModel, it as FAST_CRITIC_EFFORT, jn as DEFAULT_CLAUDE_MODEL_FALLBACKS, jt as standInToolEnabled, kt as scoutModel, lt as agentToolsEnabled, mt as browserToolsEnabled, o as buildPeerAwarenessSnippet, on as unregisterLaunch, ot as FAST_PLANNER_EFFORT, pt as browserCompoundToolsEnabled, qt as profileDescriptor, r as agentNamesForToolAllowlist, s as buildPeerAwarenessSummary, st as FAST_REVIEWER_EFFORT, ut as artifactToolsEnabled, vn as colbertDegradedWarning, vt as fastPlannerModel, wt as implementerFastModel, xt as fleetToolsEnabled, yn as provisionAndIndexColbert, yt as fastReviewerModel, zn as pickClaudeDefault } from "./peer-mcp-personas-DwEiYeJS.js";
|
|
2
|
+
import { o as removeOwnClaudeConfigMirror, r as ensureClaudeConfigMirror, t as PATHS, u as writeArtifactCredsToMirror } from "./paths-IcZW8gZx.js";
|
|
3
|
+
import { t as state } from "./state-B8adscCv.js";
|
|
4
|
+
import { d as resolveModel } from "./token-CbuFyx-B.js";
|
|
4
5
|
import { r as parseBoolEnv } from "./exec-y8C_MU8A.js";
|
|
5
|
-
import { a as sharedServerArgs, c as stopKeepAwake, d as runSelfUpdate, f as checkClaudeVersion, i as setupAndServe, l as listModelsForEndpoint, o as LAUNCH_SECRET_HEADER, p as updateClaude, r as parseSharedArgs, s as startKeepAwake, t as getClaudeCodeEnvVars, u as enableFileLogging } from "./server-setup-
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { t as
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
6
|
+
import { a as sharedServerArgs, c as stopKeepAwake, d as runSelfUpdate, f as checkClaudeVersion, i as setupAndServe, l as listModelsForEndpoint, o as LAUNCH_SECRET_HEADER, p as updateClaude, r as parseSharedArgs, s as startKeepAwake, t as getClaudeCodeEnvVars, u as enableFileLogging } from "./server-setup-Zn5wkosb.js";
|
|
7
|
+
import { t as FAST_PROFILE_ADVISOR_CLIENT_MODEL } from "./fast-profile-contract-K3P58nj3.js";
|
|
8
|
+
import { n as hookLauncherDegradedWarning, r as resolveSelfInvocation } from "./self-invocation-BJWbA8ka.js";
|
|
9
|
+
import { c as formatMaxPrerequisiteFailure, f as maxGeminiModel, i as MAX_PROFILE_MODELS, m as maxOpusModel, p as maxGrokModel } from "./max-profile-contract-BTXowh6k.js";
|
|
10
|
+
import { i as launchChild, r as getCodexVersion, t as provisionToolbelt } from "./provision-BLT1pCFy.js";
|
|
11
|
+
import { i as captureLaunchBaseline, l as stopGateDisabled, n as buildSessionBindHookCommand, r as buildStopHookCommand, s as injectStopHookIntoSettingsFile, t as buildArtifactOpenHookCommand, u as stopGateId } from "./stop-gate-hook-CJOk28zd.js";
|
|
12
|
+
import { t as liveExec } from "./orchestration-CYyp9w-t.js";
|
|
13
|
+
import { c as repoRoot, d as trustRepo, l as stopGateEnabledForRepo, s as repoFingerprint, t as fileBaselineStore } from "./stop-gate-policy-zhzRIj6G.js";
|
|
14
|
+
import { l as guardToolMatcher, n as activeDispatchModes, r as buildWorkerGuardHookCommand } from "./worker-dispatch-DgP5yT26.js";
|
|
15
|
+
import { S as writePeerMcpRuntimeFiles, a as OPERATING_DEFAULTS_DIGEST, b as resolveGroupKeysFromMirror, c as buildOperatingDefaultsDirective, d as prependStyleDirectiveToMirroredClaudeMd, h as planModeAllowRules, i as writeInjectedSkill, l as prependArtifactPanelDirectiveToMirroredClaudeMd, m as injectAllowRules, o as appendPeerAwarenessToMirroredClaudeMd, r as injectedSkillsForLaunch, s as appendToolbeltAwarenessToMirroredClaudeMd, t as injectAttributionSuppressionIntoSettingsFile, u as prependOperatingDefaultsToMirroredClaudeMd, v as injectPeerMcpIntoMirror, x as workersKeyOf, y as resolveCodexCliBackend } from "./attribution-settings-B1xutIts.js";
|
|
13
16
|
import { r as hookMcpRuntimeFromEnv } from "./hook-mcp-client-DBvm9608.js";
|
|
14
|
-
import { i as planReviewEnabled, t as buildPlanReviewHookCommand } from "./plan-review-hook-
|
|
15
|
-
import { a as checksForDescriptor, i as writeDiscoveredGate, n as readDiscoveredGate, o as descriptorHash, r as sourcesHash, s as parseGateDescriptor, t as discoverGateCommands } from "./gate-discovery-
|
|
16
|
-
import { t as buildPromptSubmitHookCommand } from "./prompt-submit-hook-
|
|
17
|
-
import { i as assertShapingInstalled, n as buildFirstMateGuardHookCommand, t as FIRST_MATE_GUARD_MATCHER } from "./internal-first-mate-guard-
|
|
18
|
-
import { r as FAST_DISPATCH_TOOL_MATCHER, t as buildFastDispatchGuardHookCommand } from "./internal-fast-dispatch-guard-
|
|
17
|
+
import { i as planReviewEnabled, t as buildPlanReviewHookCommand } from "./plan-review-hook-szSNt6uU.js";
|
|
18
|
+
import { a as checksForDescriptor, i as writeDiscoveredGate, n as readDiscoveredGate, o as descriptorHash, r as sourcesHash, s as parseGateDescriptor, t as discoverGateCommands } from "./gate-discovery-BTRVyKWu.js";
|
|
19
|
+
import { t as buildPromptSubmitHookCommand } from "./prompt-submit-hook-ZUxo_jEl.js";
|
|
20
|
+
import { i as assertShapingInstalled, n as buildFirstMateGuardHookCommand, t as FIRST_MATE_GUARD_MATCHER } from "./internal-first-mate-guard-Bcb5JwiO.js";
|
|
21
|
+
import { r as FAST_DISPATCH_TOOL_MATCHER, t as buildFastDispatchGuardHookCommand } from "./internal-fast-dispatch-guard-D2HcfXZv.js";
|
|
22
|
+
import { i as assertMaxDispatchGuardInstalled, r as MAX_DISPATCH_TOOL_MATCHER, t as buildMaxDispatchGuardHookCommand } from "./internal-max-dispatch-guard-BjSVXMvC.js";
|
|
19
23
|
import { defineCommand } from "citty";
|
|
20
24
|
import consola from "consola";
|
|
21
25
|
import path from "node:path";
|
|
22
26
|
import { randomBytes } from "node:crypto";
|
|
23
27
|
import { tmpdir } from "node:os";
|
|
24
|
-
import process from "node:process";
|
|
28
|
+
import process$1 from "node:process";
|
|
25
29
|
//#region src/lib/orchestration/fast-dispatch-hook.ts
|
|
26
30
|
/** Sentinel preserved through claude.ts's optional codex-MCP catch. */
|
|
27
31
|
var FastDispatchGuardInstallError = class extends Error {
|
|
@@ -132,10 +136,57 @@ function createFastLaunchCleanup(deps) {
|
|
|
132
136
|
};
|
|
133
137
|
}
|
|
134
138
|
//#endregion
|
|
135
|
-
//#region src/
|
|
136
|
-
|
|
137
|
-
|
|
139
|
+
//#region src/lib/fast-advisor-client.ts
|
|
140
|
+
const ADVISOR_FLAG = "--advisor";
|
|
141
|
+
function featureEnvEnabled(value) {
|
|
142
|
+
if (value === void 0) return true;
|
|
143
|
+
return ![
|
|
144
|
+
"",
|
|
145
|
+
"0",
|
|
146
|
+
"false",
|
|
147
|
+
"no",
|
|
148
|
+
"off"
|
|
149
|
+
].includes(value.trim().toLowerCase());
|
|
150
|
+
}
|
|
151
|
+
/** Match Claude Code's hard-disable and experimental-enable opt-out semantics. */
|
|
152
|
+
function fastAdvisorClientEnabled(env = process.env) {
|
|
153
|
+
if (env.CLAUDE_CODE_DISABLE_ADVISOR_TOOL) return false;
|
|
154
|
+
return featureEnvEnabled(env.CLAUDE_CODE_ENABLE_EXPERIMENTAL_ADVISOR_TOOL);
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Remove every caller-supplied Advisor option and insert the fixed fast value.
|
|
158
|
+
*
|
|
159
|
+
* This parser intentionally keeps scanning after `--`: that separator marks
|
|
160
|
+
* github-router-to-Claude passthrough, not an exemption from the fixed profile.
|
|
161
|
+
* The fixed option is inserted before the first separator so Claude Code parses
|
|
162
|
+
* it as an option rather than positional input. A separate `--advisor` consumes
|
|
163
|
+
* its next token only when it is a value rather than another option; malformed
|
|
164
|
+
* missing-value forms are simply removed.
|
|
165
|
+
*/
|
|
166
|
+
function withFixedFastAdvisorArg(args, enabled = fastAdvisorClientEnabled()) {
|
|
167
|
+
const sanitized = [];
|
|
168
|
+
for (let index = 0; index < args.length; index++) {
|
|
169
|
+
const token = args[index];
|
|
170
|
+
if (token === ADVISOR_FLAG) {
|
|
171
|
+
const next = args[index + 1];
|
|
172
|
+
if (next !== void 0 && next !== "--" && !next.startsWith("-")) index++;
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
if (token.startsWith(`${ADVISOR_FLAG}=`)) continue;
|
|
176
|
+
sanitized.push(token);
|
|
177
|
+
}
|
|
178
|
+
if (!enabled) return sanitized;
|
|
179
|
+
const separator = sanitized.indexOf("--");
|
|
180
|
+
const fixed = [ADVISOR_FLAG, FAST_PROFILE_ADVISOR_CLIENT_MODEL];
|
|
181
|
+
if (separator < 0) return [...sanitized, ...fixed];
|
|
182
|
+
return [
|
|
183
|
+
...sanitized.slice(0, separator),
|
|
184
|
+
...fixed,
|
|
185
|
+
...sanitized.slice(separator)
|
|
186
|
+
];
|
|
138
187
|
}
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region src/claude.ts
|
|
139
190
|
const claudeArgs = {
|
|
140
191
|
...sharedServerArgs,
|
|
141
192
|
model: {
|
|
@@ -246,17 +297,22 @@ const claude = defineCommand({
|
|
|
246
297
|
},
|
|
247
298
|
args: claudeArgs,
|
|
248
299
|
async run({ args, rawArgs }) {
|
|
249
|
-
const headlessProbeRequested = process.env.GH_ROUTER_ALLOW_HEADLESS_CLAUDE === "1" && rawArgs.includes("--print") && rawArgs.includes("--input-format") && rawArgs.includes("--output-format") && rawArgs.filter((arg) => arg === "stream-json").length >= 2;
|
|
250
|
-
if (!process.stdout.isTTY && !headlessProbeRequested) {
|
|
300
|
+
const headlessProbeRequested = process$1.env.GH_ROUTER_ALLOW_HEADLESS_CLAUDE === "1" && rawArgs.includes("--print") && rawArgs.includes("--input-format") && rawArgs.includes("--output-format") && rawArgs.filter((arg) => arg === "stream-json").length >= 2;
|
|
301
|
+
if (!process$1.stdout.isTTY && !headlessProbeRequested) {
|
|
251
302
|
consola.error("The claude subcommand requires a TTY (interactive terminal).");
|
|
252
|
-
process.exit(1);
|
|
303
|
+
process$1.exit(1);
|
|
253
304
|
}
|
|
254
305
|
const parsed = parseSharedArgs(args);
|
|
255
306
|
const requestedLaunchProfileId = resolveLaunchProfile(args.model);
|
|
256
307
|
const codexMcpEnabled = args["codex-mcp"] !== false;
|
|
257
|
-
if (requestedLaunchProfileId === "
|
|
258
|
-
process.stderr.write(`
|
|
259
|
-
process.exit(1);
|
|
308
|
+
if (requestedLaunchProfileId === "max" && args["codex-cli"]) {
|
|
309
|
+
process$1.stderr.write(`Max profile uses its fixed HTTP MCP surface; --codex-cli is not supported in max profile.\n`);
|
|
310
|
+
process$1.exit(1);
|
|
311
|
+
}
|
|
312
|
+
if ((requestedLaunchProfileId === "fast" || requestedLaunchProfileId === "max") && !codexMcpEnabled) {
|
|
313
|
+
const message = `github-router claude -m ${requestedLaunchProfileId === "fast" ? "fast" : "max"} requires codex MCP wiring for its native roster and dispatch ACL; remove --no-codex-mcp or choose a standard model.`;
|
|
314
|
+
process$1.stderr.write(`${message}\n`);
|
|
315
|
+
process$1.exit(1);
|
|
260
316
|
}
|
|
261
317
|
if (args.stealth) {
|
|
262
318
|
parsed.extendedBetas = false;
|
|
@@ -288,7 +344,7 @@ const claude = defineCommand({
|
|
|
288
344
|
serverUrl = result.serverUrl;
|
|
289
345
|
} catch (error) {
|
|
290
346
|
consola.error("Failed to start server:", error instanceof Error ? error.message : error);
|
|
291
|
-
process.exit(1);
|
|
347
|
+
process$1.exit(1);
|
|
292
348
|
}
|
|
293
349
|
runSelfUpdate({ selfUpdate: args["self-update"] !== false });
|
|
294
350
|
const cleanupPreMirrorFailure = createFastLaunchCleanup({
|
|
@@ -301,7 +357,7 @@ const claude = defineCommand({
|
|
|
301
357
|
} catch (err) {
|
|
302
358
|
consola.error(`Failed to provision CLAUDE_CONFIG_DIR mirror: ${err instanceof Error ? err.message : String(err)}. Spawned Claude Code would not be able to authenticate.`);
|
|
303
359
|
await cleanupPreMirrorFailure();
|
|
304
|
-
process.exit(1);
|
|
360
|
+
process$1.exit(1);
|
|
305
361
|
}
|
|
306
362
|
enableFileLogging();
|
|
307
363
|
let fastRuntimeCleanup;
|
|
@@ -326,9 +382,9 @@ const claude = defineCommand({
|
|
|
326
382
|
});
|
|
327
383
|
const fastFatal = async (message) => {
|
|
328
384
|
consola.error(message);
|
|
329
|
-
process.stderr.write(`${message}\n`);
|
|
385
|
+
process$1.stderr.write(`${message}\n`);
|
|
330
386
|
await cleanupFastLaunch();
|
|
331
|
-
process.exit(1);
|
|
387
|
+
process$1.exit(1);
|
|
332
388
|
throw new Error("process.exit returned unexpectedly");
|
|
333
389
|
};
|
|
334
390
|
const usingDefault = !args.model?.trim();
|
|
@@ -337,6 +393,9 @@ const claude = defineCommand({
|
|
|
337
393
|
if (launchProfileId === "fast") {
|
|
338
394
|
const prereqCheck = validateFastProfilePrerequisites(state.models);
|
|
339
395
|
if (!prereqCheck.ok) await fastFatal(formatFastPrerequisiteFailure(prereqCheck.missing));
|
|
396
|
+
} else if (launchProfileId === "max") {
|
|
397
|
+
const prereqCheck = validateMaxProfileLaunch(state.models);
|
|
398
|
+
if (!prereqCheck.ok) await fastFatal(formatMaxPrerequisiteFailure(prereqCheck.missing));
|
|
340
399
|
}
|
|
341
400
|
let chosenSlug = launchProfileId === "fast" ? requestedSlug.endsWith("[1m]") ? `${LUNA_DRIVER_ALIAS_ID}[1m]` : LUNA_DRIVER_ALIAS_ID : requestedSlug;
|
|
342
401
|
let resolvedSlug = launchProfileId === "fast" ? resolveModel(requestedSlug) : resolveModel(chosenSlug);
|
|
@@ -358,9 +417,10 @@ const claude = defineCommand({
|
|
|
358
417
|
consola.warn(`Model "${resolvedSlug}" not found. Available claude models: ${available.join(", ")}`);
|
|
359
418
|
}
|
|
360
419
|
const banner = chosenSlug === resolvedSlug ? chosenSlug : `${chosenSlug} → ${resolvedSlug}`;
|
|
361
|
-
process.stderr.write(`Server ready on ${serverUrl}, launching Claude Code (${banner})...\n`);
|
|
420
|
+
process$1.stderr.write(`Server ready on ${serverUrl}, launching Claude Code (${banner})...\n`);
|
|
362
421
|
const envVars = getClaudeCodeEnvVars(serverUrl, chosenSlug, launchProfileId);
|
|
363
|
-
|
|
422
|
+
let extraArgs = collectChildPassthroughArgs(rawArgs, claudeArgs);
|
|
423
|
+
if (launchProfileId === "fast") extraArgs = withFixedFastAdvisorArg(extraArgs, fastAdvisorClientEnabled(process$1.env));
|
|
364
424
|
if (toolbeltEnabled()) {
|
|
365
425
|
provisionToolbelt().catch((err) => consola.debug("Toolbelt provisioning failed:", err));
|
|
366
426
|
const toolbeltLine = buildToolbeltAwareness(availableToolCommands());
|
|
@@ -372,7 +432,7 @@ const claude = defineCommand({
|
|
|
372
432
|
}
|
|
373
433
|
provisionAndIndexColbert();
|
|
374
434
|
colbertDegradedWarning(void 0, { logsToFile: true }).then((warning) => {
|
|
375
|
-
if (warning) process.stderr.write(`${warning}\n`);
|
|
435
|
+
if (warning) process$1.stderr.write(`${warning}\n`);
|
|
376
436
|
}).catch(() => {});
|
|
377
437
|
warmTreeSitterPool();
|
|
378
438
|
startKeepAwake();
|
|
@@ -386,11 +446,18 @@ const claude = defineCommand({
|
|
|
386
446
|
let peerAwarenessSummary;
|
|
387
447
|
let fastWiringComplete = launchProfileId !== "fast";
|
|
388
448
|
const nativeAgentModels = launchProfileId === "fast" ? {
|
|
389
|
-
|
|
449
|
+
Explore: fastScoutModel(),
|
|
390
450
|
implementer: fastImplementerModel(),
|
|
391
451
|
reviewer: fastReviewerModel(),
|
|
392
452
|
planner: fastPlannerModel(),
|
|
393
453
|
critic: fastCriticModel()
|
|
454
|
+
} : launchProfileId === "max" ? {
|
|
455
|
+
Explore: MAX_PROFILE_MODELS.luna,
|
|
456
|
+
Plan: MAX_PROFILE_MODELS.sol,
|
|
457
|
+
"general-purpose": MAX_PROFILE_MODELS.luna,
|
|
458
|
+
implementer: MAX_PROFILE_MODELS.gemini,
|
|
459
|
+
reviewer: maxGeminiModel() ?? maxGrokModel() ?? MAX_PROFILE_MODELS.grok,
|
|
460
|
+
brainstorm: maxGrokModel() ?? maxGeminiModel() ?? MAX_PROFILE_MODELS.grok
|
|
394
461
|
} : {
|
|
395
462
|
implementer: nativeSubagentModel(),
|
|
396
463
|
"implementer-fast": implementerFastModel(),
|
|
@@ -402,7 +469,7 @@ const claude = defineCommand({
|
|
|
402
469
|
"general-purpose-fast": generalPurposeFastModel()
|
|
403
470
|
};
|
|
404
471
|
const nativeAvailability = {
|
|
405
|
-
scoutAvailable: nativeAgentModels.scout != null,
|
|
472
|
+
scoutAvailable: (launchProfileId === "fast" ? nativeAgentModels.Explore : nativeAgentModels.scout) != null,
|
|
406
473
|
implementerFastAvailable: nativeAgentModels["implementer-fast"] != null,
|
|
407
474
|
reviewerFastAvailable: nativeAgentModels["reviewer-fast"] != null,
|
|
408
475
|
generalPurposeFastAvailable: nativeAgentModels["general-purpose-fast"] != null,
|
|
@@ -412,45 +479,50 @@ const claude = defineCommand({
|
|
|
412
479
|
const selfInvocation = await resolveSelfInvocation();
|
|
413
480
|
{
|
|
414
481
|
const warning = hookLauncherDegradedWarning(selfInvocation);
|
|
415
|
-
if (warning) process.stderr.write(`${warning}\n`);
|
|
482
|
+
if (warning) process$1.stderr.write(`${warning}\n`);
|
|
416
483
|
}
|
|
417
484
|
if (codexMcpEnabled) try {
|
|
418
485
|
const requestedCli = args["codex-cli"] ?? false;
|
|
419
486
|
const isFastProfile = launchProfileId === "fast";
|
|
420
|
-
|
|
421
|
-
|
|
487
|
+
const isMaxProfile = launchProfileId === "max";
|
|
488
|
+
if (isFastProfile && requestedCli) process$1.stderr.write("Fast profile uses its fixed HTTP MCP surface; ignoring --codex-cli.\n");
|
|
489
|
+
const backend = isFastProfile || isMaxProfile ? "http" : resolveCodexCliBackend({
|
|
422
490
|
requested: requestedCli,
|
|
423
491
|
codexInfo: requestedCli ? getCodexVersion() : null
|
|
424
492
|
});
|
|
425
|
-
const geminiModelsAvailable = geminiAvailable();
|
|
426
|
-
if (!geminiModelsAvailable) consola.info("gemini-3.1-pro-preview not found in your Copilot model catalog; gemini-critic persona will not be registered.");
|
|
493
|
+
const geminiModelsAvailable = isMaxProfile ? maxGeminiModel() !== void 0 : geminiAvailable();
|
|
494
|
+
if (!geminiModelsAvailable) consola.info(isMaxProfile ? "Neither Grok 4.6/high nor Gemini 3.7 Flash 1M/high is usable; max third-lab personas and stand_in will not be registered." : "gemini-3.1-pro-preview not found in your Copilot model catalog; gemini-critic persona will not be registered.");
|
|
427
495
|
const fastDescriptor = profileDescriptor(launchProfileId);
|
|
428
|
-
const baseGroups = [
|
|
496
|
+
const baseGroups = isMaxProfile ? ["peers", "search"] : [
|
|
429
497
|
"peers",
|
|
430
498
|
"search",
|
|
431
499
|
"orchestrate"
|
|
432
500
|
];
|
|
433
|
-
if (workerToolsEnabled()) baseGroups.push("workers");
|
|
501
|
+
if (workerToolsEnabled() && !isMaxProfile) baseGroups.push("workers");
|
|
502
|
+
if (isMaxProfile && browseAgentEnabled()) baseGroups.push("workers");
|
|
434
503
|
const enabledGroups = fastDescriptor.allowedGroups ? baseGroups.filter((g) => fastDescriptor.allowedGroups.has(g)) : baseGroups;
|
|
435
|
-
if (!isFastProfile && standInToolEnabled()) enabledGroups.push("decide");
|
|
504
|
+
if (!isFastProfile && !isMaxProfile && standInToolEnabled()) enabledGroups.push("decide");
|
|
505
|
+
if (isMaxProfile && maxOpusModel() !== void 0 && standInToolEnabled({ maxProfile: true })) enabledGroups.push("decide");
|
|
436
506
|
if (browserToolsEnabled() && (!fastDescriptor.allowedGroups || fastDescriptor.allowedGroups.has("browser"))) enabledGroups.push("browser");
|
|
437
|
-
if (!isFastProfile && fleetToolsEnabled()) enabledGroups.push("fleet");
|
|
438
|
-
if (!isFastProfile && agentToolsEnabled()) enabledGroups.push("first-mate");
|
|
507
|
+
if (!isFastProfile && !isMaxProfile && fleetToolsEnabled()) enabledGroups.push("fleet");
|
|
508
|
+
if (!isFastProfile && !isMaxProfile && agentToolsEnabled()) enabledGroups.push("first-mate");
|
|
509
|
+
if (isMaxProfile && fleetToolsEnabled()) enabledGroups.push("fleet");
|
|
510
|
+
if (isMaxProfile && agentToolsEnabled()) enabledGroups.push("first-mate");
|
|
439
511
|
const { keys: groupKeys, skipped: skippedGroups } = await resolveGroupKeysFromMirror(enabledGroups);
|
|
440
512
|
if (isFastProfile && (fastOracleModel() == null || fastCriticModel() == null)) throw new Error("fast profile prerequisite drift: exact Oracle or critic model no longer resolves");
|
|
441
513
|
const runtime = await writePeerMcpRuntimeFiles(serverUrl, {
|
|
442
514
|
codexCli: backend === "cli",
|
|
443
515
|
selfInvocation,
|
|
444
516
|
geminiAvailable: geminiModelsAvailable,
|
|
445
|
-
geminiModel: resolveGeminiReviewModel(),
|
|
517
|
+
geminiModel: isMaxProfile ? maxGeminiModel() : resolveGeminiReviewModel(),
|
|
446
518
|
groupKeys,
|
|
447
|
-
workerToolsAvailable: !isFastProfile && workerToolsEnabled(),
|
|
448
|
-
browseAvailable: !isFastProfile && browseAgentEnabled(),
|
|
519
|
+
workerToolsAvailable: !isFastProfile && !isMaxProfile && workerToolsEnabled(),
|
|
520
|
+
browseAvailable: isMaxProfile ? browseAgentEnabled() : !isFastProfile && browseAgentEnabled(),
|
|
449
521
|
nativeSubagentModel: nativeAgentModels.implementer,
|
|
450
522
|
reviewerModel: nativeAgentModels.reviewer,
|
|
451
523
|
reviewerFastModel: nativeAgentModels["reviewer-fast"],
|
|
452
524
|
brainstormModel: nativeAgentModels.brainstorm,
|
|
453
|
-
scoutModel: nativeAgentModels.scout,
|
|
525
|
+
scoutModel: isFastProfile ? nativeAgentModels.Explore : nativeAgentModels.scout,
|
|
454
526
|
scribeModel: nativeAgentModels.scribe,
|
|
455
527
|
implementerFastModel: nativeAgentModels["implementer-fast"],
|
|
456
528
|
generalPurposeFastModel: nativeAgentModels["general-purpose-fast"],
|
|
@@ -462,13 +534,32 @@ const claude = defineCommand({
|
|
|
462
534
|
plannerModel: nativeAgentModels.planner,
|
|
463
535
|
criticModel: nativeAgentModels.critic,
|
|
464
536
|
scoutEffort: FAST_SCOUT_EFFORT,
|
|
465
|
-
implementerEffort:
|
|
537
|
+
implementerEffort: FAST_IMPLEMENTER_EFFORT,
|
|
466
538
|
reviewerEffort: FAST_REVIEWER_EFFORT,
|
|
467
539
|
plannerEffort: FAST_PLANNER_EFFORT,
|
|
468
540
|
criticEffort: FAST_CRITIC_EFFORT
|
|
541
|
+
} : isMaxProfile ? {
|
|
542
|
+
maxProfile: true,
|
|
543
|
+
workerToolsAvailable: false,
|
|
544
|
+
browseAvailable: browseAgentEnabled(),
|
|
545
|
+
maxExploreModel: MAX_PROFILE_MODELS.luna,
|
|
546
|
+
maxPlanModel: MAX_PROFILE_MODELS.sol,
|
|
547
|
+
maxGeneralPurposeModel: MAX_PROFILE_MODELS.luna,
|
|
548
|
+
maxImplementerModel: MAX_PROFILE_MODELS.gemini,
|
|
549
|
+
maxReviewerModel: maxGeminiModel() ?? maxGrokModel() ?? MAX_PROFILE_MODELS.grok,
|
|
550
|
+
maxBrainstormModel: maxGrokModel() ?? maxGeminiModel() ?? MAX_PROFILE_MODELS.grok,
|
|
551
|
+
maxGeminiModel: maxGeminiModel(),
|
|
552
|
+
maxGrokModel: maxGrokModel(),
|
|
553
|
+
maxPeerModels: {
|
|
554
|
+
sol: MAX_PROFILE_MODELS.sol,
|
|
555
|
+
luna: MAX_PROFILE_MODELS.luna,
|
|
556
|
+
opus: maxOpusModel(),
|
|
557
|
+
gemini: maxGeminiModel(),
|
|
558
|
+
grok: maxGrokModel()
|
|
559
|
+
}
|
|
469
560
|
} : {}
|
|
470
561
|
});
|
|
471
|
-
if (isFastProfile) fastRuntimeCleanup = runtime.cleanup;
|
|
562
|
+
if (isFastProfile || isMaxProfile) fastRuntimeCleanup = runtime.cleanup;
|
|
472
563
|
const launchSecret = randomBytes(32).toString("hex");
|
|
473
564
|
const launchEntry = registerLaunch({
|
|
474
565
|
profileId: launchProfileId,
|
|
@@ -477,11 +568,11 @@ const claude = defineCommand({
|
|
|
477
568
|
allowedGroups: fastDescriptor.allowedGroups,
|
|
478
569
|
allowedPersonas: fastDescriptor.personaAllowlist
|
|
479
570
|
});
|
|
480
|
-
if (isFastProfile) fastLaunchId = launchEntry.launchId;
|
|
571
|
+
if (isFastProfile || isMaxProfile) fastLaunchId = launchEntry.launchId;
|
|
481
572
|
envVars.ANTHROPIC_CUSTOM_HEADERS = envVars.ANTHROPIC_CUSTOM_HEADERS ? `${envVars.ANTHROPIC_CUSTOM_HEADERS}\n${LAUNCH_SECRET_HEADER}: ${launchSecret}` : `${LAUNCH_SECRET_HEADER}: ${launchSecret}`;
|
|
482
573
|
envVars.GH_ROUTER_HOOK_MCP_URL = serverUrl;
|
|
483
574
|
envVars.GH_ROUTER_HOOK_NONCE = runtime.nonce;
|
|
484
|
-
onShutdown = isFastProfile ? async () => {
|
|
575
|
+
onShutdown = isFastProfile || isMaxProfile ? async () => {
|
|
485
576
|
try {
|
|
486
577
|
unregisterLaunch(launchEntry.launchId);
|
|
487
578
|
} finally {
|
|
@@ -529,24 +620,37 @@ const claude = defineCommand({
|
|
|
529
620
|
}
|
|
530
621
|
assertFastDispatchGuardInstalled(true, fastGuardInstalled);
|
|
531
622
|
fastWiringComplete = true;
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
const skippedNote = skippedGroups.length > 0 ? ` WARNING: groups [${skippedGroups.join(", ")}] skipped — both the bare and \`gh-router-<group>\` keys collide with your own mcpServers; those tools are unavailable this session (rename the user-side server to re-enable).` : "";
|
|
535
|
-
process.stderr.write(`Peer MCP wired (backend=${backend}, personas=[${personaNames}], subagent .md files=${runtime.agentMdPaths.length}, ${subagentVisibility}).${skippedNote}\n`);
|
|
536
|
-
const sessionCwd = process.cwd();
|
|
537
|
-
const workerSkillsActive = workerToolsEnabled() && !isFastProfile;
|
|
538
|
-
let skillsWritten = 0;
|
|
539
|
-
let skillsToWrite = [];
|
|
540
|
-
if (workerSkillsActive) {
|
|
541
|
-
skillsToWrite = INJECTED_SKILLS.filter((s) => !isFirstMateSkillName(s.name) || agentToolsEnabled());
|
|
542
|
-
for (const s of skillsToWrite) if ((await writeInjectedSkill(s.name, s.md).catch(() => ({ written: false }))).written) skillsWritten++;
|
|
623
|
+
} else if (isMaxProfile) {
|
|
624
|
+
let maxGuardInstalled = false;
|
|
543
625
|
try {
|
|
544
626
|
const settingsPath = path.join(PATHS.CLAUDE_CONFIG_DIR, "settings.json");
|
|
545
|
-
const
|
|
546
|
-
await injectStopHookIntoSettingsFile(settingsPath,
|
|
627
|
+
const guardCommand = buildMaxDispatchGuardHookCommand(selfInvocation);
|
|
628
|
+
await injectStopHookIntoSettingsFile(settingsPath, guardCommand, "PreToolUse", 10, MAX_DISPATCH_TOOL_MATCHER);
|
|
629
|
+
maxGuardInstalled = true;
|
|
547
630
|
} catch (err) {
|
|
548
|
-
consola.
|
|
631
|
+
consola.error(`Could not register the max native dispatch ACL hook: ${String(err)}`);
|
|
549
632
|
}
|
|
633
|
+
assertMaxDispatchGuardInstalled(true, maxGuardInstalled);
|
|
634
|
+
fastWiringComplete = true;
|
|
635
|
+
}
|
|
636
|
+
const personaNames = runtime.personas.map((p) => p.agentName).join(", ");
|
|
637
|
+
const skippedNote = skippedGroups.length > 0 ? ` WARNING: groups [${skippedGroups.join(", ")}] skipped — both the bare and \`gh-router-<group>\` keys collide with your own mcpServers; those tools are unavailable this session (rename the user-side server to re-enable).` : "";
|
|
638
|
+
process$1.stderr.write(`Peer MCP wired (backend=${backend}, personas=[${personaNames}], subagent .md files=${runtime.agentMdPaths.length}, ${subagentVisibility}).${skippedNote}\n`);
|
|
639
|
+
const sessionCwd = process$1.cwd();
|
|
640
|
+
const workerSkillsActive = workerToolsEnabled() && launchProfileId === "standard";
|
|
641
|
+
const skillsToWrite = injectedSkillsForLaunch({
|
|
642
|
+
profileId: launchProfileId,
|
|
643
|
+
workerSkillsActive,
|
|
644
|
+
firstMateEnabled: agentToolsEnabled()
|
|
645
|
+
});
|
|
646
|
+
let skillsWritten = 0;
|
|
647
|
+
for (const s of skillsToWrite) if ((await writeInjectedSkill(s.name, s.md).catch(() => ({ written: false }))).written) skillsWritten++;
|
|
648
|
+
if (workerSkillsActive) try {
|
|
649
|
+
const settingsPath = path.join(PATHS.CLAUDE_CONFIG_DIR, "settings.json");
|
|
650
|
+
const cmd = buildPromptSubmitHookCommand(selfInvocation);
|
|
651
|
+
await injectStopHookIntoSettingsFile(settingsPath, cmd, "UserPromptSubmit", 45);
|
|
652
|
+
} catch (err) {
|
|
653
|
+
consola.warn(`Could not register the UserPromptSubmit hook: ${String(err)}`);
|
|
550
654
|
}
|
|
551
655
|
try {
|
|
552
656
|
const settingsPath = path.join(PATHS.CLAUDE_CONFIG_DIR, "settings.json");
|
|
@@ -556,23 +660,21 @@ const claude = defineCommand({
|
|
|
556
660
|
} catch (err) {
|
|
557
661
|
consola.warn(`Could not auto-approve injected tools: ${String(err)}`);
|
|
558
662
|
}
|
|
559
|
-
if (workerSkillsActive)
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
process.stderr.write(`Injected skills (${skillsWritten}/${skillsToWrite.length}): ${skillNames}.\n`);
|
|
575
|
-
}
|
|
663
|
+
if (workerSkillsActive || isMaxProfile && browseAgentEnabled()) if (!injected?.ok) consola.warn("Workers non-blocking guard NOT registered: subagent MCP injection fell back to parent-only (--mcp-config), so worker-* dispatchers cannot reach the workers server. Raw (blocking) worker tools remain usable on the main thread this session.");
|
|
664
|
+
else if (process$1.env.GH_ROUTER_DISABLE_WORKER_GUARD === "1") consola.info("Workers non-blocking guard disabled via GH_ROUTER_DISABLE_WORKER_GUARD=1 — raw mcp__workers__* is callable on the main thread (blocking); the worker-* background agents remain the steered, non-blocking default.");
|
|
665
|
+
else try {
|
|
666
|
+
const settingsPath = path.join(PATHS.CLAUDE_CONFIG_DIR, "settings.json");
|
|
667
|
+
const workersKey = workersKeyOf(groupKeys);
|
|
668
|
+
const modes = isMaxProfile ? ["browse"] : activeDispatchModes({ browse: browseAgentEnabled() });
|
|
669
|
+
const cmd = buildWorkerGuardHookCommand(selfInvocation, workersKey, modes);
|
|
670
|
+
const matcher = guardToolMatcher(workersKey, modes);
|
|
671
|
+
await injectStopHookIntoSettingsFile(settingsPath, cmd, "PreToolUse", 10, matcher);
|
|
672
|
+
} catch (err) {
|
|
673
|
+
consola.warn(`Could not register the workers PreToolUse guard hook: ${String(err)}`);
|
|
674
|
+
}
|
|
675
|
+
if (skillsWritten > 0) {
|
|
676
|
+
const skillNames = skillsToWrite.map((s) => `/${s.name}`).join(", ");
|
|
677
|
+
process$1.stderr.write(`Injected skills (${skillsWritten}/${skillsToWrite.length}): ${skillNames}.\n`);
|
|
576
678
|
}
|
|
577
679
|
if (agentToolsEnabled()) {
|
|
578
680
|
let shapingInstalled = false;
|
|
@@ -585,9 +687,9 @@ const claude = defineCommand({
|
|
|
585
687
|
consola.error(`Could not register the operator worker/orchestrate guard hook: ${String(err)}`);
|
|
586
688
|
}
|
|
587
689
|
assertShapingInstalled(true, shapingInstalled);
|
|
588
|
-
if (!process.env.GH_ROUTER_FM_SCAFFOLD_REPOS?.trim()) consola.info("first-mate: scaffold_repo is disabled (it writes to real repositories). Set GH_ROUTER_FM_SCAFFOLD_REPOS to a comma-separated list of owner/name entries, or owner/* for a whole org, to enable it.");
|
|
690
|
+
if (!process$1.env.GH_ROUTER_FM_SCAFFOLD_REPOS?.trim()) consola.info("first-mate: scaffold_repo is disabled (it writes to real repositories). Set GH_ROUTER_FM_SCAFFOLD_REPOS to a comma-separated list of owner/name entries, or owner/* for a whole org, to enable it.");
|
|
589
691
|
}
|
|
590
|
-
const aiordieSidecar = (process.env.AIORDIE_CLAUDE_BIND ?? "").trim();
|
|
692
|
+
const aiordieSidecar = (process$1.env.AIORDIE_CLAUDE_BIND ?? "").trim();
|
|
591
693
|
if (aiordieSidecar.length > 0 && !aiordieSidecar.includes("\"")) try {
|
|
592
694
|
const settingsPath = path.join(PATHS.CLAUDE_CONFIG_DIR, "settings.json");
|
|
593
695
|
const command = buildSessionBindHookCommand(selfInvocation, aiordieSidecar);
|
|
@@ -604,7 +706,7 @@ const claude = defineCommand({
|
|
|
604
706
|
consola.warn(`Artifact-panel directive prepend failed: ${String(err)}`);
|
|
605
707
|
}
|
|
606
708
|
if (!isFastProfile) try {
|
|
607
|
-
await writeArtifactCredsToMirror(shouldUseInsecureTls(process.env.AIORDIE_BASE_URL ?? ""));
|
|
709
|
+
await writeArtifactCredsToMirror(shouldUseInsecureTls(process$1.env.AIORDIE_BASE_URL ?? ""));
|
|
608
710
|
const settingsPath = path.join(PATHS.CLAUDE_CONFIG_DIR, "settings.json");
|
|
609
711
|
const cmd = buildArtifactOpenHookCommand(selfInvocation);
|
|
610
712
|
await injectStopHookIntoSettingsFile(settingsPath, cmd, "PostToolUse", void 0, "ExitPlanMode");
|
|
@@ -619,15 +721,15 @@ const claude = defineCommand({
|
|
|
619
721
|
} catch (err) {
|
|
620
722
|
consola.warn(`Could not register the advisory plan-review hook: ${String(err)}`);
|
|
621
723
|
}
|
|
622
|
-
if (!isFastProfile && args["trust-gate"] === true) try {
|
|
724
|
+
if (!isFastProfile && !isMaxProfile && args["trust-gate"] === true) try {
|
|
623
725
|
const root = await trustRepo(sessionCwd);
|
|
624
|
-
process.stderr.write(`Structural gate trusted for this repo (${root}); it will run on launch here from now on.\n`);
|
|
726
|
+
process$1.stderr.write(`Structural gate trusted for this repo (${root}); it will run on launch here from now on.\n`);
|
|
625
727
|
} catch (err) {
|
|
626
728
|
consola.warn(`Could not record gate trust: ${String(err)}`);
|
|
627
729
|
}
|
|
628
|
-
const gateDisabled = isFastProfile || stopGateDisabled(args);
|
|
629
|
-
const forceEnabled = parseBoolEnv(process.env.GH_ROUTER_ENABLE_STOP_GATE) === true;
|
|
630
|
-
const includeTests = parseBoolEnv(process.env.GH_ROUTER_STOP_GATE_RUN_TESTS) === true;
|
|
730
|
+
const gateDisabled = isFastProfile || isMaxProfile || stopGateDisabled(args);
|
|
731
|
+
const forceEnabled = parseBoolEnv(process$1.env.GH_ROUTER_ENABLE_STOP_GATE) === true;
|
|
732
|
+
const includeTests = parseBoolEnv(process$1.env.GH_ROUTER_STOP_GATE_RUN_TESTS) === true;
|
|
631
733
|
const gateRoot = await repoRoot(sessionCwd).catch(() => sessionCwd);
|
|
632
734
|
let descriptor = null;
|
|
633
735
|
let discovering = false;
|
|
@@ -642,7 +744,7 @@ const claude = defineCommand({
|
|
|
642
744
|
workdir: gateRoot,
|
|
643
745
|
evidence: cached.evidence
|
|
644
746
|
};
|
|
645
|
-
else if (!forceEnabled && workerToolsEnabled() && parseBoolEnv(process.env.GH_ROUTER_ENABLE_GATE_DISCOVERY) === true) discovering = true;
|
|
747
|
+
else if (!forceEnabled && workerToolsEnabled() && parseBoolEnv(process$1.env.GH_ROUTER_ENABLE_GATE_DISCOVERY) === true) discovering = true;
|
|
646
748
|
}
|
|
647
749
|
}
|
|
648
750
|
let gateEnabled = gateDisabled ? false : await stopGateEnabledForRepo(sessionCwd).catch(() => false);
|
|
@@ -686,17 +788,17 @@ const claude = defineCommand({
|
|
|
686
788
|
})().catch(() => {});
|
|
687
789
|
}
|
|
688
790
|
const tail = "A regression or a gate-weakening diff blocks stopping until fixed (per-prompt, max 2). Opt out with GH_ROUTER_DISABLE_STOP_GATE=1.\n";
|
|
689
|
-
if (armed.kind === "sealed") process.stderr.write((autoTrusted ? `Structural-gate Stop hook enabled by default for this repo (gate=${armed.gateId}; runs typecheck/test/lint at stop). ` : `Structural-gate Stop hook enabled (gate=${armed.gateId}). `) + tail);
|
|
791
|
+
if (armed.kind === "sealed") process$1.stderr.write((autoTrusted ? `Structural-gate Stop hook enabled by default for this repo (gate=${armed.gateId}; runs typecheck/test/lint at stop). ` : `Structural-gate Stop hook enabled (gate=${armed.gateId}). `) + tail);
|
|
690
792
|
else {
|
|
691
793
|
const ids = checksForDescriptor(armed).map((c) => c.id).join(", ");
|
|
692
794
|
const testNote = includeTests ? "Full test suite ON. " : "Full test suite off by default (enable with GH_ROUTER_STOP_GATE_RUN_TESTS=1). ";
|
|
693
|
-
process.stderr.write(`Structural-gate Stop hook armed for this ${armed.ecosystem} repo (checks: ${ids}; from ${armed.evidence.join(", ")}). ${testNote}${tail}`);
|
|
795
|
+
process$1.stderr.write(`Structural-gate Stop hook armed for this ${armed.ecosystem} repo (checks: ${ids}; from ${armed.evidence.join(", ")}). ${testNote}${tail}`);
|
|
694
796
|
}
|
|
695
797
|
} catch (err) {
|
|
696
798
|
consola.warn(`Could not register the structural-gate Stop hook: ${String(err)}`);
|
|
697
799
|
}
|
|
698
800
|
} else if (gateEnabled && discovering) {
|
|
699
|
-
process.stderr.write("Structural Stop-gate: no checks parsed for this repo — discovering check commands in the background (arms on the next launch). Disable with GH_ROUTER_ENABLE_GATE_DISCOVERY=0.\n");
|
|
801
|
+
process$1.stderr.write("Structural Stop-gate: no checks parsed for this repo — discovering check commands in the background (arms on the next launch). Disable with GH_ROUTER_ENABLE_GATE_DISCOVERY=0.\n");
|
|
700
802
|
(async () => {
|
|
701
803
|
try {
|
|
702
804
|
const disc = await discoverGateCommands(gateRoot, {
|
|
@@ -719,16 +821,17 @@ const claude = defineCommand({
|
|
|
719
821
|
}
|
|
720
822
|
} catch {}
|
|
721
823
|
})().catch(() => {});
|
|
722
|
-
} else if (!gateDisabled && !descriptor && !discovering) process.stderr.write("Structural Stop-gate not enabled: no checks found in this repo (looked at package.json scripts / CI workflows / Makefile / Cargo.toml / go.mod / pyproject). Force a sealed gate with GH_ROUTER_ENABLE_STOP_GATE=1" + (workerToolsEnabled() ? ", or let a model discover them with GH_ROUTER_ENABLE_GATE_DISCOVERY=1" : "") + ".\n");
|
|
824
|
+
} else if (!gateDisabled && !descriptor && !discovering) process$1.stderr.write("Structural Stop-gate not enabled: no checks found in this repo (looked at package.json scripts / CI workflows / Makefile / Cargo.toml / go.mod / pyproject). Force a sealed gate with GH_ROUTER_ENABLE_STOP_GATE=1" + (workerToolsEnabled() ? ", or let a model discover them with GH_ROUTER_ENABLE_GATE_DISCOVERY=1" : "") + ".\n");
|
|
723
825
|
const peerSnippet = buildPeerAwarenessSnippet({
|
|
724
826
|
codexCli: backend === "cli",
|
|
725
827
|
geminiAvailable: geminiModelsAvailable,
|
|
726
|
-
geminiModel: resolveGeminiReviewModel(),
|
|
727
|
-
workerToolsAvailable: workerToolsEnabled(),
|
|
728
|
-
standInAvailable: standInToolEnabled(),
|
|
729
|
-
browseAvailable: browserToolsEnabled(),
|
|
730
|
-
|
|
731
|
-
|
|
828
|
+
geminiModel: isMaxProfile ? maxGeminiModel() : resolveGeminiReviewModel(),
|
|
829
|
+
workerToolsAvailable: isMaxProfile ? false : workerToolsEnabled(),
|
|
830
|
+
standInAvailable: isMaxProfile ? maxOpusModel() !== void 0 && standInToolEnabled({ maxProfile: true }) : standInToolEnabled(),
|
|
831
|
+
browseAvailable: isMaxProfile ? browseAgentEnabled() : browserToolsEnabled(),
|
|
832
|
+
browserToolsAvailable: browserToolsEnabled(),
|
|
833
|
+
compoundBrowseAvailable: isMaxProfile ? false : browserCompoundToolsEnabled(),
|
|
834
|
+
powerBrowseAvailable: isMaxProfile ? false : state.powerBrowseEnabled,
|
|
732
835
|
fleetAvailable: fleetToolsEnabled(),
|
|
733
836
|
agentToolsAvailable: agentToolsEnabled(),
|
|
734
837
|
...nativeAvailability,
|
|
@@ -737,9 +840,10 @@ const claude = defineCommand({
|
|
|
737
840
|
});
|
|
738
841
|
peerAwarenessSnippet = peerSnippet;
|
|
739
842
|
peerAwarenessSummary = buildPeerAwarenessSummary({
|
|
740
|
-
workerToolsAvailable: workerToolsEnabled(),
|
|
741
|
-
standInAvailable: standInToolEnabled(),
|
|
742
|
-
browseAvailable: browserToolsEnabled(),
|
|
843
|
+
workerToolsAvailable: isMaxProfile ? false : workerToolsEnabled(),
|
|
844
|
+
standInAvailable: isMaxProfile ? maxOpusModel() !== void 0 && standInToolEnabled({ maxProfile: true }) : standInToolEnabled(),
|
|
845
|
+
browseAvailable: isMaxProfile ? browseAgentEnabled() : browserToolsEnabled(),
|
|
846
|
+
browserToolsAvailable: browserToolsEnabled(),
|
|
743
847
|
fleetAvailable: fleetToolsEnabled(),
|
|
744
848
|
agentToolsAvailable: agentToolsEnabled(),
|
|
745
849
|
...nativeAvailability,
|
|
@@ -758,16 +862,16 @@ const claude = defineCommand({
|
|
|
758
862
|
consola.warn(`Style-directive CLAUDE.md prepend failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
759
863
|
}
|
|
760
864
|
} catch (err) {
|
|
761
|
-
if (launchProfileId === "fast") {
|
|
865
|
+
if (launchProfileId === "fast" || launchProfileId === "max") {
|
|
762
866
|
if (fastLaunchId) unregisterLaunch(fastLaunchId);
|
|
763
867
|
await disposeFastRuntime().catch(() => {});
|
|
764
868
|
await server.close(true).catch(() => {});
|
|
765
869
|
await baseShutdown().catch(() => {});
|
|
766
870
|
resetFastRuntimeOwnership();
|
|
767
|
-
const message =
|
|
871
|
+
const message = `${launchProfileId === "fast" ? "Fast" : "Max"} profile wiring failed; refusing to launch an unguarded session: ${err instanceof Error ? err.message : String(err)}`;
|
|
768
872
|
consola.error(message);
|
|
769
|
-
process.stderr.write(`${message}\n`);
|
|
770
|
-
process.exit(1);
|
|
873
|
+
process$1.stderr.write(`${message}\n`);
|
|
874
|
+
process$1.exit(1);
|
|
771
875
|
}
|
|
772
876
|
consola.warn(`Peer MCP wiring failed (claude will launch without it): ${err instanceof Error ? err.message : String(err)}`);
|
|
773
877
|
}
|
|
@@ -780,7 +884,7 @@ const claude = defineCommand({
|
|
|
780
884
|
} catch (err) {
|
|
781
885
|
consola.warn(`Operating-defaults CLAUDE.md prepend failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
782
886
|
}
|
|
783
|
-
if (process.env.GH_ROUTER_DISABLE_NO_ATTRIBUTION !== "1") try {
|
|
887
|
+
if (process$1.env.GH_ROUTER_DISABLE_NO_ATTRIBUTION !== "1") try {
|
|
784
888
|
const settingsPath = path.join(PATHS.CLAUDE_CONFIG_DIR, "settings.json");
|
|
785
889
|
await injectAttributionSuppressionIntoSettingsFile(settingsPath);
|
|
786
890
|
} catch (err) {
|
|
@@ -797,4 +901,4 @@ const claude = defineCommand({
|
|
|
797
901
|
//#endregion
|
|
798
902
|
export { claude };
|
|
799
903
|
|
|
800
|
-
//# sourceMappingURL=claude-
|
|
904
|
+
//# sourceMappingURL=claude-uRuzEH0W.js.map
|