github-router 0.3.348 → 0.3.349
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/{aic-statusline-settings-YoDG20pq.js → aic-statusline-settings-DCFywz3N.js} +2 -2
- package/dist/aic-statusline-settings-DCFywz3N.js.map +1 -0
- package/dist/{attribution-settings-P_vba-ri.js → attribution-settings-BgYkynRc.js} +14 -12
- package/dist/{attribution-settings-P_vba-ri.js.map → attribution-settings-BgYkynRc.js.map} +1 -1
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/{claude-D26fp1ih.js → claude-Chtd07VA.js} +25 -10
- package/dist/{claude-D26fp1ih.js.map → claude-Chtd07VA.js.map} +1 -1
- package/dist/{codex-DM97sCtu.js → codex-DayPQ8t5.js} +4 -4
- package/dist/{codex-DM97sCtu.js.map → codex-DayPQ8t5.js.map} +1 -1
- package/dist/engine-T81FYVwK.js +2 -0
- package/dist/{gate-discovery-V-mslLHt.js → gate-discovery-CBOPoK9-.js} +2 -2
- package/dist/{gate-discovery-V-mslLHt.js.map → gate-discovery-CBOPoK9-.js.map} +1 -1
- package/dist/hooks.mjs +472 -49
- package/dist/hooks.sha256 +1 -1
- package/dist/{internal-aic-status-CCvU7zhC.js → internal-aic-status-lM0YNDaH.js} +52 -11
- package/dist/internal-aic-status-lM0YNDaH.js.map +1 -0
- package/dist/internal-prompt-submit-DRCJ5kWC.js +559 -0
- package/dist/internal-prompt-submit-DRCJ5kWC.js.map +1 -0
- package/dist/{internal-stop-hook-v5WF6Kc2.js → internal-stop-hook-CIe2kVss.js} +2 -2
- package/dist/{internal-stop-hook-v5WF6Kc2.js.map → internal-stop-hook-CIe2kVss.js.map} +1 -1
- package/dist/main.js +8 -8
- package/dist/{peer-mcp-personas-C200IycG.js → peer-mcp-personas-agpBeTgS.js} +233 -61
- package/dist/peer-mcp-personas-agpBeTgS.js.map +1 -0
- package/dist/{pi-BWGfNpi7.js → pi-BLDBFXg3.js} +5 -5
- package/dist/{pi-BWGfNpi7.js.map → pi-BLDBFXg3.js.map} +1 -1
- package/dist/{prompt-submit-hook-wjuHUrpS.js → prompt-submit-hook-CBGlhEpU.js} +94 -35
- package/dist/prompt-submit-hook-CBGlhEpU.js.map +1 -0
- package/dist/{provision-BFTONLfA.js → provision-BKdrO1Sv.js} +2 -2
- package/dist/{provision-BFTONLfA.js.map → provision-BKdrO1Sv.js.map} +1 -1
- package/dist/{serve-D9xQeGqi.js → serve-p_58sDJK.js} +6 -6
- package/dist/{serve-D9xQeGqi.js.map → serve-p_58sDJK.js.map} +1 -1
- package/dist/{server-setup-R1HQtpR9.js → server-setup-PAHohZ-u.js} +25 -14
- package/dist/server-setup-PAHohZ-u.js.map +1 -0
- package/dist/{start-vg2n8UjI.js → start-CTHcqkQL.js} +3 -3
- package/dist/{start-vg2n8UjI.js.map → start-CTHcqkQL.js.map} +1 -1
- package/package.json +1 -1
- package/dist/aic-statusline-settings-YoDG20pq.js.map +0 -1
- package/dist/engine-VTQo0qUy.js +0 -2
- package/dist/internal-aic-status-CCvU7zhC.js.map +0 -1
- package/dist/internal-prompt-submit-B1nd4y4V.js +0 -213
- package/dist/internal-prompt-submit-B1nd4y4V.js.map +0 -1
- package/dist/peer-mcp-personas-C200IycG.js.map +0 -1
- package/dist/prompt-submit-hook-wjuHUrpS.js.map +0 -1
- package/dist/server-setup-R1HQtpR9.js.map +0 -1
|
@@ -4,26 +4,34 @@ import { o as isSubagentContext } from "./stop-gate-policy-CbLklfV2.js";
|
|
|
4
4
|
/**
|
|
5
5
|
* Cheapest-only Sol → Luna prompt rewrite (additive, fail-open).
|
|
6
6
|
*
|
|
7
|
-
* The cheapest lead (`gpt-6-luna`) is the mini-tier analog:
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* decision + formatting layer for that rewrite. It never touches
|
|
11
|
-
* itself: all IO is injected so tests run with fakes and no
|
|
7
|
+
* The cheapest lead (`gpt-6-luna`) is the mini-tier analog: a stronger model
|
|
8
|
+
* (Sol) hands it a GROUNDED EXECUTION CONTRACT — repo facts and explicit
|
|
9
|
+
* constraints it cannot cheaply gather or reliably infer itself. This module
|
|
10
|
+
* is the pure decision + formatting layer for that rewrite. It never touches
|
|
11
|
+
* the network itself: all IO is injected so tests run with fakes and no
|
|
12
|
+
* Copilot spend.
|
|
12
13
|
*
|
|
13
|
-
* Design (
|
|
14
|
+
* Design (research-grounded):
|
|
14
15
|
* - cheapest profile only, initial top-level prompt only, non-trivial only
|
|
15
16
|
* (caller passes the `isNonTrivialPrompt` verdict in — this module does
|
|
16
17
|
* not import the hook to avoid a dependency cycle).
|
|
17
18
|
* - static context pack first (user prompt + AGENTS.md/CLAUDE.md + repo
|
|
18
|
-
* structure + search snippets), all capped for cache-friendliness
|
|
19
|
+
* structure + search snippets), all capped for cache-friendliness EXCEPT
|
|
20
|
+
* the user prompt, which is passed through in full.
|
|
19
21
|
* - rewriter is `gpt-5.6-sol` bare 200K at medium effort (the existing
|
|
20
22
|
* cheapest Advisor identity), via the caller's `inferSol`.
|
|
23
|
+
* - the contract leads with grounding + constraints (small models' documented
|
|
24
|
+
* weak spot) and explicitly avoids prescribing step-by-step procedure or
|
|
25
|
+
* CoT, which measurably degrade instruction-following; the ordered plan is
|
|
26
|
+
* optional.
|
|
21
27
|
* - adaptive turn budget: 3 tool turns by default, up to 5 only when Sol
|
|
22
28
|
* self-flags deep grounding. Sol is told the budget and may use zero
|
|
23
29
|
* tools and rewrite immediately.
|
|
24
|
-
* - output is an ADDITIVE
|
|
25
|
-
* never replaced
|
|
26
|
-
*
|
|
30
|
+
* - output is an ADDITIVE, non-authoritative contract for Luna; the original
|
|
31
|
+
* prompt is never replaced or truncated. A clean miss/empty yields
|
|
32
|
+
* `{ brief: null, timedOut: false }` and the caller falls back to the
|
|
33
|
+
* existing V2 scope/goal path; a wall-clock timeout yields
|
|
34
|
+
* `{ brief: null, timedOut: true }` and is TERMINAL for the prompt.
|
|
27
35
|
*/
|
|
28
36
|
const CHEAPEST_REWRITE_MODEL = "gpt-5.6-sol";
|
|
29
37
|
const CHEAPEST_REWRITE_EFFORT = "medium";
|
|
@@ -33,7 +41,7 @@ const CHEAPEST_REWRITE_SEARCH_CAP = 6144;
|
|
|
33
41
|
const CHEAPEST_REWRITE_GUIDANCE_CAP = 4096;
|
|
34
42
|
/** Max chars of structural repo info fed to Sol. */
|
|
35
43
|
const CHEAPEST_REWRITE_STRUCTURE_CAP = 2048;
|
|
36
|
-
/** Max chars of the wrapped
|
|
44
|
+
/** Max chars of the wrapped execution contract (keeps the Luna-facing block short). */
|
|
37
45
|
const CHEAPEST_REWRITE_BRIEF_CAP = 2e3;
|
|
38
46
|
/** Flag Sol emits when it needs the extended 5-turn budget. */
|
|
39
47
|
const DEEP_GROUNDING_FLAG = "needs_deep_grounding=true";
|
|
@@ -61,41 +69,65 @@ function parseNeedMoreQuery(solText) {
|
|
|
61
69
|
return solText.slice(idx + 10).split("\n", 1)[0]?.trim().slice(0, 280) ?? "";
|
|
62
70
|
}
|
|
63
71
|
/**
|
|
64
|
-
* System prompt for the Sol rewriter.
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
72
|
+
* System prompt for the Sol rewriter.
|
|
73
|
+
*
|
|
74
|
+
* The job is a GROUNDED EXECUTION CONTRACT for a fast mini-tier executor
|
|
75
|
+
* (Luna), not a step-by-step procedure. This is the strong-planner /
|
|
76
|
+
* weak-follower split (a strong model plans, a small one executes), adapted
|
|
77
|
+
* to Luna's level. Evidence-driven choices:
|
|
78
|
+
* - Lead with grounding + explicit constraints: small models' documented
|
|
79
|
+
* weak spot is instruction/constraint following, while their biggest gain
|
|
80
|
+
* comes from a stronger model handing them repo facts they cannot cheaply
|
|
81
|
+
* gather themselves.
|
|
82
|
+
* - Anti-CoT: explicit step-by-step reasoning prompts measurably degrade
|
|
83
|
+
* instruction-following (models neglect simple constraints and invent
|
|
84
|
+
* content), so the brief must NOT prescribe micro-steps, must NOT ask
|
|
85
|
+
* Luna to "reason through" anything, and the ordered plan is OPTIONAL.
|
|
86
|
+
* - Fidelity is the one hard invariant: never invent requirements or
|
|
87
|
+
* acceptance criteria; a stated unknown beats a confident guess.
|
|
88
|
+
* It also names the turn budget (and that zero tools is allowed) so Sol does
|
|
89
|
+
* not pad grounding.
|
|
68
90
|
*/
|
|
69
91
|
function buildSolRewriteSystem(opts) {
|
|
70
92
|
const searchNoun = opts.bluebirdEnabled ? "Bluebird lexical + semantic code search" : opts.searchEnabled ? "local lexical + semantic code search" : "lexical code search";
|
|
71
|
-
return `You are a
|
|
72
|
-
Turn budget: you have at most ${opts.turnBudget} tool turns TOTAL (search/read). You may use ZERO tools and
|
|
93
|
+
return `You are a planning advisor for a coding agent. A fast, cheap mini-tier model (Luna) will execute the user's request. Produce a SHORT, GROUNDED EXECUTION CONTRACT that lets Luna do its best work — not a procedure for it to follow blindly.
|
|
94
|
+
Turn budget: you have at most ${opts.turnBudget} tool turns TOTAL (search/read). You may use ZERO tools and write the contract immediately when the static context already suffices — do not pad turns. Stop grounding as soon as you can name exact content to change; prefer acting over more searching.\nIf the task is large/cross-cutting and the context is genuinely insufficient, you may emit "${DEEP_GROUNDING_FLAG}" plus one line "${NEED_MORE_PREFIX} <single targeted query>" to earn follow-up grounding; otherwise finish now.\nGrounding available: ${searchNoun} results, repo guidance (AGENTS.md/CLAUDE.md), and repo structure are in your context. Prefer targeted reads over full-file reads.\nThe user's original request is AUTHORITATIVE; your contract is counsel. Preserve the user's intent exactly — NEVER invent requirements, acceptance criteria, or scope the user did not ask for, and never change what "done" means to them. When grounding cannot resolve something, state it as an open question rather than guessing.\nEmit the contract with these sections, in order, using the section names as plain labels:\n- INTENT: the user's goal, in their terms (one or two lines).\n- GROUNDING: the load-bearing repo facts Luna would otherwise have to rediscover — exact files/symbols with file:line, the convention or existing pattern that applies. Name file:line because Luna cannot afford to re-discover it.\n- CONSTRAINTS: scope boundaries, explicit things NOT to do, and the success criterion — the constraints are the highest-value part of this contract.\n- VERIFY: the single check that settles "done" (the exact build/test/read command), or "unknown".\n- OPEN QUESTIONS: anything grounding could not resolve. Never fabricate an answer.\n- PLAN (OPTIONAL): include a short ordered plan ONLY when sequencing genuinely matters; omit it otherwise.\nDo NOT tell Luna to "think step by step" or "reason through" anything, and do NOT write a long procedural recipe — give it facts, constraints, and the check. Keep the contract short and flat. Respond with the contract body only, no preamble.`;
|
|
73
95
|
}
|
|
74
|
-
/** Assemble the capped static pack Sol sees (static-first for cache hits).
|
|
96
|
+
/** Assemble the capped static pack Sol sees (static-first for cache hits).
|
|
97
|
+
* The USER REQUEST is passed through IN FULL (never truncated) — only the
|
|
98
|
+
* repo-derived sections are capped. */
|
|
75
99
|
function buildStaticContextPack(pack) {
|
|
76
100
|
const parts = [`USER REQUEST:\n${pack.prompt}`];
|
|
77
101
|
if (pack.agentsMd.trim().length > 0) parts.push(`REPO GUIDANCE (AGENTS.md):\n${pack.agentsMd.slice(0, CHEAPEST_REWRITE_GUIDANCE_CAP)}`);
|
|
78
102
|
if (pack.claudeMd.trim().length > 0) parts.push(`REPO GUIDANCE (CLAUDE.md):\n${pack.claudeMd.slice(0, CHEAPEST_REWRITE_GUIDANCE_CAP)}`);
|
|
79
103
|
if (pack.repoStructure.trim().length > 0) parts.push(`REPO STRUCTURE:\n${pack.repoStructure.slice(0, CHEAPEST_REWRITE_STRUCTURE_CAP)}`);
|
|
104
|
+
if (pack.verifyCommand.trim().length > 0) parts.push(pack.verifyCommand.slice(0, 512));
|
|
80
105
|
if (pack.searchContext.trim().length > 0) parts.push(pack.searchContext);
|
|
81
106
|
return parts.join("\n\n");
|
|
82
107
|
}
|
|
83
108
|
/**
|
|
84
|
-
* Wrap Sol's raw
|
|
109
|
+
* Wrap Sol's raw contract as the additive Luna-facing block. Returns "" when
|
|
85
110
|
* Sol produced nothing usable (caller treats that as fail-open).
|
|
111
|
+
*
|
|
112
|
+
* The header states the trust/authority relationship explicitly (mirroring how
|
|
113
|
+
* prior-turn review findings are framed): this is a stronger model's distilled
|
|
114
|
+
* counsel about HOW to approach the request, while the user's own request
|
|
115
|
+
* above remains authoritative.
|
|
86
116
|
*/
|
|
87
117
|
function wrapLunaBrief(solText) {
|
|
88
118
|
const body = solText.replace(DEEP_GROUNDING_FLAG, "").split("\n").filter((line) => !line.trimStart().startsWith(NEED_MORE_PREFIX)).join("\n").trim();
|
|
89
119
|
if (body.length === 0) return "";
|
|
90
|
-
return `
|
|
120
|
+
return `EXECUTION BRIEF (a stronger model's distilled guidance — advisory, non-authoritative): how to approach the request above. The user's request remains authoritative; adapt this brief if the repo contradicts it.\n${body.length > 2e3 ? `${body.slice(0, CHEAPEST_REWRITE_BRIEF_CAP).trimEnd()}…` : body}`;
|
|
91
121
|
}
|
|
92
122
|
/**
|
|
93
|
-
* Run the adaptive rewrite. Returns
|
|
94
|
-
* anything is missing/empty/over-budget
|
|
95
|
-
* existing V2 scope/goal path
|
|
123
|
+
* Run the adaptive rewrite. Returns `{ brief, timedOut }`: `brief` is the
|
|
124
|
+
* wrapped additive contract, or null when anything is missing/empty/over-budget
|
|
125
|
+
* so the caller falls back to the existing V2 scope/goal path; `timedOut` is
|
|
126
|
+
* true only when the wall-clock budget elapsed first. Never throws to the
|
|
127
|
+
* orchestrator.
|
|
96
128
|
*/
|
|
97
129
|
async function runCheapestRewrite(input) {
|
|
98
|
-
const timeoutMs = input.io.timeoutMs ??
|
|
130
|
+
const timeoutMs = input.io.timeoutMs ?? 3e4;
|
|
99
131
|
const controller = new AbortController();
|
|
100
132
|
let timer;
|
|
101
133
|
try {
|
|
@@ -107,7 +139,8 @@ async function runCheapestRewrite(input) {
|
|
|
107
139
|
input.io.staticPack().catch(() => ({
|
|
108
140
|
agentsMd: "",
|
|
109
141
|
claudeMd: "",
|
|
110
|
-
repoStructure: ""
|
|
142
|
+
repoStructure: "",
|
|
143
|
+
verifyCommand: ""
|
|
111
144
|
}))
|
|
112
145
|
]);
|
|
113
146
|
const searchContext = semanticAvailable ? `Lexical search results:\n${lexical.slice(0, CHEAPEST_REWRITE_SEARCH_CAP)}\n\nSemantic search results:\n${semantic.slice(0, CHEAPEST_REWRITE_SEARCH_CAP)}` : `Lexical search results:\n${lexical.slice(0, CHEAPEST_REWRITE_SEARCH_CAP)}`;
|
|
@@ -116,6 +149,7 @@ async function runCheapestRewrite(input) {
|
|
|
116
149
|
agentsMd: statik.agentsMd,
|
|
117
150
|
claudeMd: statik.claudeMd,
|
|
118
151
|
repoStructure: statik.repoStructure,
|
|
152
|
+
verifyCommand: statik.verifyCommand,
|
|
119
153
|
searchContext
|
|
120
154
|
});
|
|
121
155
|
const first = await input.io.inferSol(buildSolRewriteSystem({
|
|
@@ -130,7 +164,8 @@ async function runCheapestRewrite(input) {
|
|
|
130
164
|
const brief = wrapLunaBrief(first);
|
|
131
165
|
return brief.length > 0 ? brief : null;
|
|
132
166
|
}
|
|
133
|
-
const
|
|
167
|
+
const [extraLexical, extraSemantic] = await Promise.all([input.io.searchCode(followUp, "lexical", controller.signal).catch(() => ""), semanticAvailable ? input.io.searchCode(followUp, "semantic", controller.signal).catch(() => "") : Promise.resolve("")]);
|
|
168
|
+
const extra = semanticAvailable ? `Lexical search results:\n${extraLexical.slice(0, CHEAPEST_REWRITE_SEARCH_CAP)}\n\nSemantic search results:\n${extraSemantic.slice(0, CHEAPEST_REWRITE_SEARCH_CAP)}` : `Lexical search results:\n${extraLexical.slice(0, CHEAPEST_REWRITE_SEARCH_CAP)}`;
|
|
134
169
|
if (extra.trim().length === 0) {
|
|
135
170
|
const brief = wrapLunaBrief(first);
|
|
136
171
|
return brief.length > 0 ? brief : null;
|
|
@@ -139,7 +174,7 @@ async function runCheapestRewrite(input) {
|
|
|
139
174
|
searchEnabled: input.searchEnabled,
|
|
140
175
|
bluebirdEnabled: input.bluebirdEnabled,
|
|
141
176
|
turnBudget: 5
|
|
142
|
-
}), `${user}\n\nFOLLOW-UP GROUNDING for "${followUp}":\n${extra
|
|
177
|
+
}), `${user}\n\nFOLLOW-UP GROUNDING for "${followUp}":\n${extra}\n\nRewrite the contract with this grounding (same rules, short).`, controller.signal).catch(() => "");
|
|
143
178
|
const brief = wrapLunaBrief(second.trim().length > 0 ? second : first);
|
|
144
179
|
return brief.length > 0 ? brief : null;
|
|
145
180
|
})();
|
|
@@ -147,10 +182,23 @@ async function runCheapestRewrite(input) {
|
|
|
147
182
|
const raced = await Promise.race([work, new Promise((resolve) => {
|
|
148
183
|
timer = setTimeout(() => resolve("__timeout__"), timeoutMs);
|
|
149
184
|
})]);
|
|
150
|
-
if (raced === "__timeout__"
|
|
151
|
-
|
|
185
|
+
if (raced === "__timeout__") return {
|
|
186
|
+
brief: null,
|
|
187
|
+
timedOut: true
|
|
188
|
+
};
|
|
189
|
+
if (raced === null) return {
|
|
190
|
+
brief: null,
|
|
191
|
+
timedOut: false
|
|
192
|
+
};
|
|
193
|
+
return {
|
|
194
|
+
brief: raced,
|
|
195
|
+
timedOut: false
|
|
196
|
+
};
|
|
152
197
|
} catch {
|
|
153
|
-
return
|
|
198
|
+
return {
|
|
199
|
+
brief: null,
|
|
200
|
+
timedOut: false
|
|
201
|
+
};
|
|
154
202
|
} finally {
|
|
155
203
|
if (timer) clearTimeout(timer);
|
|
156
204
|
controller.abort();
|
|
@@ -296,16 +344,27 @@ async function decidePromptSubmitV2(input) {
|
|
|
296
344
|
rewriteDisabled: input.rewriteDisabled === true
|
|
297
345
|
}) && sessionId.length > 0 && !await input.rewrite.hasRewriteRun(sessionId).catch(() => true)) {
|
|
298
346
|
await input.rewrite.markRewriteRun(sessionId).catch(() => {});
|
|
299
|
-
const
|
|
347
|
+
const rewrite = await runCheapestRewrite({
|
|
300
348
|
prompt,
|
|
301
349
|
searchEnabled,
|
|
302
350
|
bluebirdEnabled,
|
|
303
351
|
io: input.rewrite
|
|
304
|
-
}).catch(() =>
|
|
305
|
-
|
|
352
|
+
}).catch(() => ({
|
|
353
|
+
brief: null,
|
|
354
|
+
timedOut: false
|
|
355
|
+
}));
|
|
356
|
+
if (rewrite.brief && rewrite.brief.length > 0) {
|
|
357
|
+
decision.inject = joinSections([
|
|
358
|
+
searchTip,
|
|
359
|
+
rewrite.brief,
|
|
360
|
+
findingsBlock
|
|
361
|
+
]);
|
|
362
|
+
return decision;
|
|
363
|
+
}
|
|
364
|
+
if (rewrite.timedOut) {
|
|
306
365
|
decision.inject = joinSections([
|
|
307
366
|
searchTip,
|
|
308
|
-
|
|
367
|
+
PROMPT_STEER_GOAL,
|
|
309
368
|
findingsBlock
|
|
310
369
|
]);
|
|
311
370
|
return decision;
|
|
@@ -349,4 +408,4 @@ function buildPromptSubmitHookCommand(invocation) {
|
|
|
349
408
|
//#endregion
|
|
350
409
|
export { CHEAPEST_REWRITE_GUIDANCE_CAP as a, isCheapestRewriteDisabledEnv as c, CHEAPEST_REWRITE_EFFORT as i, decidePromptSubmit as n, CHEAPEST_REWRITE_MODEL as o, decidePromptSubmitV2 as r, CHEAPEST_REWRITE_STRUCTURE_CAP as s, buildPromptSubmitHookCommand as t };
|
|
351
410
|
|
|
352
|
-
//# sourceMappingURL=prompt-submit-hook-
|
|
411
|
+
//# sourceMappingURL=prompt-submit-hook-CBGlhEpU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt-submit-hook-CBGlhEpU.js","names":[],"sources":["../src/lib/cheapest-prompt-rewrite.ts","../src/lib/orchestration/prompt-submit-hook.ts"],"sourcesContent":["/**\n * Cheapest-only Sol → Luna prompt rewrite (additive, fail-open).\n *\n * The cheapest lead (`gpt-6-luna`) is the mini-tier analog: a stronger model\n * (Sol) hands it a GROUNDED EXECUTION CONTRACT — repo facts and explicit\n * constraints it cannot cheaply gather or reliably infer itself. This module\n * is the pure decision + formatting layer for that rewrite. It never touches\n * the network itself: all IO is injected so tests run with fakes and no\n * Copilot spend.\n *\n * Design (research-grounded):\n * - cheapest profile only, initial top-level prompt only, non-trivial only\n * (caller passes the `isNonTrivialPrompt` verdict in — this module does\n * not import the hook to avoid a dependency cycle).\n * - static context pack first (user prompt + AGENTS.md/CLAUDE.md + repo\n * structure + search snippets), all capped for cache-friendliness EXCEPT\n * the user prompt, which is passed through in full.\n * - rewriter is `gpt-5.6-sol` bare 200K at medium effort (the existing\n * cheapest Advisor identity), via the caller's `inferSol`.\n * - the contract leads with grounding + constraints (small models' documented\n * weak spot) and explicitly avoids prescribing step-by-step procedure or\n * CoT, which measurably degrade instruction-following; the ordered plan is\n * optional.\n * - adaptive turn budget: 3 tool turns by default, up to 5 only when Sol\n * self-flags deep grounding. Sol is told the budget and may use zero\n * tools and rewrite immediately.\n * - output is an ADDITIVE, non-authoritative contract for Luna; the original\n * prompt is never replaced or truncated. A clean miss/empty yields\n * `{ brief: null, timedOut: false }` and the caller falls back to the\n * existing V2 scope/goal path; a wall-clock timeout yields\n * `{ brief: null, timedOut: true }` and is TERMINAL for the prompt.\n */\n\nexport const CHEAPEST_REWRITE_MODEL = \"gpt-5.6-sol\" as const\nexport const CHEAPEST_REWRITE_EFFORT = \"medium\" as const\n\n/** Default tool-turn budget for ordinary non-trivial prompts. */\nexport const CHEAPEST_REWRITE_DEFAULT_TURNS = 3\n/** Extended budget reserved for the hardest prompts (Sol must flag it). */\nexport const CHEAPEST_REWRITE_MAX_TURNS = 5\n\n/** Wall-clock budget for the whole rewrite (search + Sol), ms. */\nexport const CHEAPEST_REWRITE_TIMEOUT_MS = 30_000\n/** Max chars per search-result blob fed to Sol. */\nexport const CHEAPEST_REWRITE_SEARCH_CAP = 6 * 1024\n/** Max chars of repo guidance files (AGENTS.md / CLAUDE.md) fed to Sol. */\nexport const CHEAPEST_REWRITE_GUIDANCE_CAP = 4 * 1024\n/** Max chars of the extracted verify-command line fed to Sol. */\nexport const CHEAPEST_REWRITE_TEST_CMD_CAP = 512\n/** Max chars of structural repo info fed to Sol. */\nexport const CHEAPEST_REWRITE_STRUCTURE_CAP = 2 * 1024\n/** Max chars of the wrapped execution contract (keeps the Luna-facing block short). */\nexport const CHEAPEST_REWRITE_BRIEF_CAP = 2_000\n\n/** Flag Sol emits when it needs the extended 5-turn budget. */\nexport const DEEP_GROUNDING_FLAG = \"needs_deep_grounding=true\" as const\n/** Follow-up signal: Sol names one more targeted query to ground. */\nexport const NEED_MORE_PREFIX = \"NEED_MORE:\" as const\n\nexport interface CheapestRewriteEligibility {\n /** Launch profile id (only `\"cheapest\"` is eligible). */\n profile?: string\n /** Caller-computed `isNonTrivialPrompt(prompt)` verdict (regex, zero cost). */\n promptIsNonTrivial: boolean\n /** Master steer switch already resolved (false = findings only). */\n steerEnabled: boolean\n /** True when `GH_ROUTER_DISABLE_CHEAPEST_REWRITE` opts out. */\n rewriteDisabled: boolean\n}\n\nexport function isCheapestRewriteDisabledEnv(env: NodeJS.ProcessEnv = process.env): boolean {\n const v = (env.GH_ROUTER_DISABLE_CHEAPEST_REWRITE ?? \"\").trim().toLowerCase()\n return v === \"1\" || v === \"true\" || v === \"yes\" || v === \"on\"\n}\n\nexport function isCheapestRewriteEligible(input: CheapestRewriteEligibility): boolean {\n if (!input.steerEnabled) return false\n if (input.rewriteDisabled) return false\n if (input.profile !== \"cheapest\") return false\n return input.promptIsNonTrivial\n}\n\n/** Adaptive budget: 5 only on Sol's explicit deep-grounding flag, else 3. */\nexport function resolveRewriteTurnBudget(solText: string | null | undefined): number {\n if (typeof solText === \"string\" && solText.includes(DEEP_GROUNDING_FLAG)) {\n return CHEAPEST_REWRITE_MAX_TURNS\n }\n return CHEAPEST_REWRITE_DEFAULT_TURNS\n}\n\n/** Extract a single follow-up query Sol names via `NEED_MORE: <query>. */\nexport function parseNeedMoreQuery(solText: string): string {\n const idx = solText.indexOf(NEED_MORE_PREFIX)\n if (idx < 0) return \"\"\n return solText\n .slice(idx + NEED_MORE_PREFIX.length)\n .split(\"\\n\", 1)[0]\n ?.trim()\n .slice(0, 280) ?? \"\"\n}\n\n/**\n * System prompt for the Sol rewriter.\n *\n * The job is a GROUNDED EXECUTION CONTRACT for a fast mini-tier executor\n * (Luna), not a step-by-step procedure. This is the strong-planner /\n * weak-follower split (a strong model plans, a small one executes), adapted\n * to Luna's level. Evidence-driven choices:\n * - Lead with grounding + explicit constraints: small models' documented\n * weak spot is instruction/constraint following, while their biggest gain\n * comes from a stronger model handing them repo facts they cannot cheaply\n * gather themselves.\n * - Anti-CoT: explicit step-by-step reasoning prompts measurably degrade\n * instruction-following (models neglect simple constraints and invent\n * content), so the brief must NOT prescribe micro-steps, must NOT ask\n * Luna to \"reason through\" anything, and the ordered plan is OPTIONAL.\n * - Fidelity is the one hard invariant: never invent requirements or\n * acceptance criteria; a stated unknown beats a confident guess.\n * It also names the turn budget (and that zero tools is allowed) so Sol does\n * not pad grounding.\n */\nexport function buildSolRewriteSystem(opts: {\n searchEnabled: boolean\n bluebirdEnabled: boolean\n turnBudget: number\n}): string {\n const searchNoun = opts.bluebirdEnabled\n ? \"Bluebird lexical + semantic code search\"\n : opts.searchEnabled\n ? \"local lexical + semantic code search\"\n : \"lexical code search\"\n return (\n `You are a planning advisor for a coding agent. A fast, cheap mini-tier model (Luna) `\n + `will execute the user's request. Produce a SHORT, GROUNDED EXECUTION CONTRACT that lets Luna do its best work — not a procedure for it to follow blindly.\\n`\n + `Turn budget: you have at most ${opts.turnBudget} tool turns TOTAL (search/read). You may use ZERO tools and write the contract immediately when the static context already suffices — do not pad turns. `\n + `Stop grounding as soon as you can name exact content to change; prefer acting over more searching.\\n`\n + `If the task is large/cross-cutting and the context is genuinely insufficient, you may emit \"${DEEP_GROUNDING_FLAG}\" plus one line \"${NEED_MORE_PREFIX} <single targeted query>\" to earn follow-up grounding; otherwise finish now.\\n`\n + `Grounding available: ${searchNoun} results, repo guidance (AGENTS.md/CLAUDE.md), and repo structure are in your context. Prefer targeted reads over full-file reads.\\n`\n + `The user's original request is AUTHORITATIVE; your contract is counsel. Preserve the user's intent exactly — NEVER invent requirements, acceptance criteria, or scope the user did not ask for, and never change what \"done\" means to them. When grounding cannot resolve something, state it as an open question rather than guessing.\\n`\n + `Emit the contract with these sections, in order, using the section names as plain labels:\\n`\n + `- INTENT: the user's goal, in their terms (one or two lines).\\n`\n + `- GROUNDING: the load-bearing repo facts Luna would otherwise have to rediscover — exact files/symbols with file:line, the convention or existing pattern that applies. Name file:line because Luna cannot afford to re-discover it.\\n`\n + `- CONSTRAINTS: scope boundaries, explicit things NOT to do, and the success criterion — the constraints are the highest-value part of this contract.\\n`\n + `- VERIFY: the single check that settles \"done\" (the exact build/test/read command), or \"unknown\".\\n`\n + `- OPEN QUESTIONS: anything grounding could not resolve. Never fabricate an answer.\\n`\n + `- PLAN (OPTIONAL): include a short ordered plan ONLY when sequencing genuinely matters; omit it otherwise.\\n`\n + `Do NOT tell Luna to \"think step by step\" or \"reason through\" anything, and do NOT write a long procedural recipe — give it facts, constraints, and the check. `\n + `Keep the contract short and flat. Respond with the contract body only, no preamble.`\n )\n}\n\nexport interface StaticContextPack {\n prompt: string\n agentsMd: string\n claudeMd: string\n repoStructure: string\n /** Extracted test/build/lint command line, or \"\". */\n verifyCommand: string\n searchContext: string\n}\n\n/** Assemble the capped static pack Sol sees (static-first for cache hits).\n * The USER REQUEST is passed through IN FULL (never truncated) — only the\n * repo-derived sections are capped. */\nexport function buildStaticContextPack(pack: StaticContextPack): string {\n const parts: Array<string> = [`USER REQUEST:\\n${pack.prompt}`]\n if (pack.agentsMd.trim().length > 0) {\n parts.push(`REPO GUIDANCE (AGENTS.md):\\n${pack.agentsMd.slice(0, CHEAPEST_REWRITE_GUIDANCE_CAP)}`)\n }\n if (pack.claudeMd.trim().length > 0) {\n parts.push(`REPO GUIDANCE (CLAUDE.md):\\n${pack.claudeMd.slice(0, CHEAPEST_REWRITE_GUIDANCE_CAP)}`)\n }\n if (pack.repoStructure.trim().length > 0) {\n parts.push(`REPO STRUCTURE:\\n${pack.repoStructure.slice(0, CHEAPEST_REWRITE_STRUCTURE_CAP)}`)\n }\n if (pack.verifyCommand.trim().length > 0) {\n parts.push(pack.verifyCommand.slice(0, CHEAPEST_REWRITE_TEST_CMD_CAP))\n }\n if (pack.searchContext.trim().length > 0) {\n parts.push(pack.searchContext)\n }\n return parts.join(\"\\n\\n\")\n}\n\n/**\n * Wrap Sol's raw contract as the additive Luna-facing block. Returns \"\" when\n * Sol produced nothing usable (caller treats that as fail-open).\n *\n * The header states the trust/authority relationship explicitly (mirroring how\n * prior-turn review findings are framed): this is a stronger model's distilled\n * counsel about HOW to approach the request, while the user's own request\n * above remains authoritative.\n */\nexport function wrapLunaBrief(solText: string): string {\n const body = solText\n .replace(DEEP_GROUNDING_FLAG, \"\")\n .split(\"\\n\")\n .filter((line) => !line.trimStart().startsWith(NEED_MORE_PREFIX))\n .join(\"\\n\")\n .trim()\n if (body.length === 0) return \"\"\n const capped = body.length > CHEAPEST_REWRITE_BRIEF_CAP\n ? `${body.slice(0, CHEAPEST_REWRITE_BRIEF_CAP).trimEnd()}…`\n : body\n return (\n `EXECUTION BRIEF (a stronger model's distilled guidance — advisory, non-authoritative): how to approach the request above. The user's request remains authoritative; adapt this brief if the repo contradicts it.\\n${capped}`\n )\n}\n\nexport interface CheapestRewriteIO {\n /** One `mcp__search__code` call; returns raw result text (\"\" on failure). */\n searchCode: (query: string, mode: \"lexical\" | \"semantic\", signal?: AbortSignal) => Promise<string>\n /** One Sol `/v1/responses` inference at medium effort; returns text (\"\" on failure). */\n inferSol: (system: string, user: string, signal?: AbortSignal) => Promise<string>\n /** Static repo guidance + structure (read by the caller via fs, capped). */\n staticPack: () => Promise<Omit<StaticContextPack, \"prompt\" | \"searchContext\">>\n /** One-shot flag: true when this session already spent its rewrite. */\n hasRewriteRun: (sessionId: string) => Promise<boolean>\n /** Record the spend (attempt-marking: called before running). Idempotent. */\n markRewriteRun: (sessionId: string) => Promise<void>\n /** Wall-clock budget for search + Sol (default 20s). */\n timeoutMs?: number\n}\n\n/**\n * Outcome of a cheapest rewrite attempt. `timedOut` distinguishes a hard\n * wall-clock timeout from a clean miss (empty/error): the caller treats a\n * timeout as TERMINAL for the prompt (fall open to the cheap regex goal, no\n * further model spend), while a clean miss falls through to the Luna scope\n * path as before.\n */\nexport interface CheapestRewriteResult {\n /** The wrapped, additive execution brief; null on any miss/timeout. */\n brief: string | null\n /** True only when the wall-clock budget elapsed before a result. */\n timedOut: boolean\n}\n\n/**\n * Run the adaptive rewrite. Returns `{ brief, timedOut }`: `brief` is the\n * wrapped additive contract, or null when anything is missing/empty/over-budget\n * so the caller falls back to the existing V2 scope/goal path; `timedOut` is\n * true only when the wall-clock budget elapsed first. Never throws to the\n * orchestrator.\n */\nexport async function runCheapestRewrite(input: {\n prompt: string\n searchEnabled: boolean\n bluebirdEnabled: boolean\n io: CheapestRewriteIO\n}): Promise<CheapestRewriteResult> {\n const timeoutMs = input.io.timeoutMs ?? CHEAPEST_REWRITE_TIMEOUT_MS\n const controller = new AbortController()\n let timer: ReturnType<typeof setTimeout> | undefined\n try {\n const work = (async (): Promise<string | null> => {\n const semanticAvailable = input.searchEnabled || input.bluebirdEnabled\n const [lexical, semantic, statik] = await Promise.all([\n input.io.searchCode(input.prompt, \"lexical\", controller.signal).catch(() => \"\"),\n semanticAvailable\n ? input.io.searchCode(input.prompt, \"semantic\", controller.signal).catch(() => \"\")\n : Promise.resolve(\"\"),\n input.io.staticPack().catch(() => ({ agentsMd: \"\", claudeMd: \"\", repoStructure: \"\", verifyCommand: \"\" })),\n ])\n const searchContext = semanticAvailable\n ? `Lexical search results:\\n${lexical.slice(0, CHEAPEST_REWRITE_SEARCH_CAP)}\\n\\nSemantic search results:\\n${semantic.slice(0, CHEAPEST_REWRITE_SEARCH_CAP)}`\n : `Lexical search results:\\n${lexical.slice(0, CHEAPEST_REWRITE_SEARCH_CAP)}`\n const user = buildStaticContextPack({\n prompt: input.prompt,\n agentsMd: statik.agentsMd,\n claudeMd: statik.claudeMd,\n repoStructure: statik.repoStructure,\n verifyCommand: statik.verifyCommand,\n searchContext,\n })\n const first = await input.io\n .inferSol(\n buildSolRewriteSystem({\n searchEnabled: input.searchEnabled,\n bluebirdEnabled: input.bluebirdEnabled,\n turnBudget: CHEAPEST_REWRITE_DEFAULT_TURNS,\n }),\n user,\n controller.signal,\n )\n .catch(() => \"\")\n if (!first || first.trim().length === 0) return null\n\n // Adaptive extension: only when Sol flags deep grounding AND names a\n // follow-up query AND turns remain (3 used → up to 5). One extra\n // grounding round + one final re-inference, then stop regardless.\n // Searches are free, so the follow-up round runs lexical AND semantic\n // (when available) in parallel — the same breadth as the initial round.\n const budget = resolveRewriteTurnBudget(first)\n const followUp = parseNeedMoreQuery(first)\n if (budget !== CHEAPEST_REWRITE_MAX_TURNS || followUp.length === 0) {\n const brief = wrapLunaBrief(first)\n return brief.length > 0 ? brief : null\n }\n const [extraLexical, extraSemantic] = await Promise.all([\n input.io.searchCode(followUp, \"lexical\", controller.signal).catch(() => \"\"),\n semanticAvailable\n ? input.io.searchCode(followUp, \"semantic\", controller.signal).catch(() => \"\")\n : Promise.resolve(\"\"),\n ])\n const extra = semanticAvailable\n ? `Lexical search results:\\n${extraLexical.slice(0, CHEAPEST_REWRITE_SEARCH_CAP)}\\n\\nSemantic search results:\\n${extraSemantic.slice(0, CHEAPEST_REWRITE_SEARCH_CAP)}`\n : `Lexical search results:\\n${extraLexical.slice(0, CHEAPEST_REWRITE_SEARCH_CAP)}`\n if (extra.trim().length === 0) {\n const brief = wrapLunaBrief(first)\n return brief.length > 0 ? brief : null\n }\n const second = await input.io\n .inferSol(\n buildSolRewriteSystem({\n searchEnabled: input.searchEnabled,\n bluebirdEnabled: input.bluebirdEnabled,\n turnBudget: CHEAPEST_REWRITE_MAX_TURNS,\n }),\n `${user}\\n\\nFOLLOW-UP GROUNDING for \"${followUp}\":\\n${extra}\\n\\nRewrite the contract with this grounding (same rules, short).`,\n controller.signal,\n )\n .catch(() => \"\")\n const brief = wrapLunaBrief(second.trim().length > 0 ? second : first)\n return brief.length > 0 ? brief : null\n })()\n work.catch(() => {})\n const raced = await Promise.race<string | null | \"__timeout__\">([\n work,\n new Promise<\"__timeout__\">((resolve) => {\n timer = setTimeout(() => resolve(\"__timeout__\"), timeoutMs)\n }),\n ])\n if (raced === \"__timeout__\") return { brief: null, timedOut: true }\n if (raced === null) return { brief: null, timedOut: false }\n return { brief: raced, timedOut: false }\n } catch {\n return { brief: null, timedOut: false }\n } finally {\n if (timer) clearTimeout(timer)\n controller.abort()\n }\n}\n","/**\n * Pure decision logic for the `UserPromptSubmit` hook (the front-end of the\n * floor-raising surface). It serves TWO duties on the one event:\n *\n * 1. Per-prompt budget reset — clears the Stop-gate's block counter for this\n * session so `maxBlocks` is \"per user prompt\", not \"per session lifetime\"\n * (the per-prompt scoping the Stop-gate relies on).\n * 2. Goal steer — for a NON-trivial prompt, inject an advisory GOAL directive\n * (additive context, never blocking) pointing the model at `/gh-research`\n * then `/gh-orchestrate`. It raises the prior; it does not force execution.\n *\n * Top-level only: like the Stop-gate, it stands down in a subagent/teammate\n * context (the payload carries `agent_type`/`agent_id` there) so it never\n * recurses into spawned workers. Fail-open and never blocking: any error or a\n * trivial prompt yields an empty injection.\n */\n\nimport {\n isCheapestRewriteEligible,\n runCheapestRewrite,\n type CheapestRewriteIO,\n} from \"../cheapest-prompt-rewrite\"\nimport { buildSelfCommand, type SelfInvocation } from \"../hook-launcher/self-invocation\"\nimport { isSubagentContext } from \"./stop-gate-policy\"\n\n/**\n * The advisory goal injected for a non-trivial prompt. Uses the skills' slash\n * invocation form. The model still decides whether to follow it; the Stop-gate\n * backstops correctness at the output end.\n */\nexport const PROMPT_STEER_GOAL =\n \"GOAL (advisory): for a non-trivial task, FIRST run /gh-research on this ask to \"\n + \"information saturation — verify the load-bearing claims against the actual code \"\n + \"before planning, and do not plan or write code until research is saturated. THEN, \"\n + \"for an implementation or change task, run /gh-orchestrate to compose and run a \"\n + \"floor-raising workflow (it checkpoints before expensive work). Skip both for a \"\n + \"trivial ask; you may decline if they do not fit.\"\n\n/**\n * Cheap, conservative complexity heuristic — a long prompt, an imperative\n * build/change verb, or an explicit multi-file scope. Trivial prompts get no\n * steer (no analysis-paralysis tax on quick asks).\n */\nexport function isNonTrivialPrompt(prompt: string): boolean {\n const p = prompt.trim()\n if (p.length === 0) return false\n if (p.length >= 280) return true\n const verb =\n /\\b(implement|build|refactor|migrate|fix|debug|diagnose|design|add|create|rewrite|optimi[sz]e|integrate|architect|investigate|audit)\\b/i\n if (verb.test(p)) return true\n // Multi-file / cross-cutting scope signal.\n return /\\b(across|throughout|every|all)\\b.*\\b(file|module|test|route|component)s?\\b/i.test(p)\n}\n\nexport interface PromptSubmitDecision {\n /** Session whose Stop-gate block budget to reset (undefined = none). */\n resetSession?: string\n /** Text to print to stdout (added to the model's context). Empty = nothing. */\n inject: string\n}\n\nexport function decidePromptSubmit(input: { stdin: string; steerEnabled: boolean }): PromptSubmitDecision {\n let payload: { session_id?: unknown; prompt?: unknown; agent_type?: unknown; agent_id?: unknown } = {}\n try {\n const p: unknown = JSON.parse(input.stdin)\n if (p && typeof p === \"object\") payload = p as typeof payload\n } catch {\n return { inject: \"\" }\n }\n // Top-level only: a subagent/teammate prompt gets neither reset nor steer.\n if (isSubagentContext(payload)) return { inject: \"\" }\n const decision: PromptSubmitDecision = { inject: \"\" }\n const sessionId = typeof payload.session_id === \"string\" && payload.session_id.length > 0 ? payload.session_id : \"\"\n if (sessionId) decision.resetSession = sessionId\n const prompt = typeof payload.prompt === \"string\" ? payload.prompt : \"\"\n if (input.steerEnabled && isNonTrivialPrompt(prompt)) decision.inject = PROMPT_STEER_GOAL\n return decision\n}\n\n// ─── UserPromptSubmit V2 (advisory: classify + grounded scope/goal) ──────────\n\n/**\n * Static encouragement injected only for a non-trivial prompt (no extra model\n * call, no latency tax): nudge parallel lexical+semantic search before\n * concluding. Mirrors the v1 advisory tone: additive, never blocking.\n *\n * @deprecated Prefer `getPromptSearchTip(searchEnabled, bluebirdEnabled)` so\n * the tip matches the launch's search backend. Kept for callers without flags;\n * built with semantic search enabled.\n */\nexport const PROMPT_SEARCH_TIP = getPromptSearchTip(true)\n\n/**\n * Build the search tip for the launch's search backend. When Bluebird is\n * enabled it owns both semantic and lexical calls; otherwise local ColBERT is\n * used when enabled, or lexical-only search when neither backend is enabled.\n */\nexport function getPromptSearchTip(\n searchEnabled: boolean,\n bluebirdEnabled: boolean = false,\n): string {\n if (bluebirdEnabled) {\n return (\n \"TIP (advisory): when this task needs code context, search Bluebird semantic + \"\n + \"lexical in parallel — two `mcp__search__code` calls issued in the same turn. \"\n + \"Bluebird failures are visible and do not fall back locally.\"\n )\n }\n if (searchEnabled) {\n return (\n \"TIP (advisory): when this task needs code context, search lexical + semantic in \"\n + \"parallel — one `mcp__search__code` call with mode:\\\"lexical\\\" and one with \"\n + \"mode:\\\"semantic\\\", issued in the same turn — before concluding.\"\n )\n }\n return (\n \"TIP (advisory): when this task needs code context, search lexical \"\n + \"(`mcp__search__code` with mode:\\\"lexical\\\"/\\\"exact\\\"/\\\"regex\\\" for exact \"\n + \"symbols, filenames, errors, routes, flags, and config keys), issuing \"\n + \"parallel calls in the same turn — before concluding.\"\n )\n}\n\n/**\n * Build the scope-inference system prompt for the launch's search backend.\n * Mirrors `getPromptSearchTip`: Bluebird and local ColBERT variants ground the\n * inference in lexical + semantic results; the local-only variant in lexical results.\n */\nexport function getPromptScopeSystem(\n searchEnabled: boolean,\n bluebirdEnabled: boolean = false,\n): string {\n const searchNoun = bluebirdEnabled\n ? \"a Bluebird lexical + semantic code search\"\n : searchEnabled\n ? \"a local lexical + semantic code search\"\n : \"a lexical code search\"\n return (\n \"You are a scoping assistant for a coding agent about to act on a user's request. \"\n + `You are given the user's request and the results of ${searchNoun} `\n + \"over the relevant repository. Produce a SHORT advisory note (<= 120 words), plain text only:\\n\"\n + \"1. SCOPE: one line — is this trivial, focused (one area), or large/cross-cutting — grounded in \"\n + \"what the search surfaced (reference the most relevant file(s) by name).\\n\"\n + \"2. GOAL: restate the user's OWN ask as a single measurable objective, in THEIR terms. Do NOT \"\n + \"invent new requirements or acceptance criteria beyond what they asked.\\n\"\n + \"3. Only if the task is large/cross-cutting, add a final line: \\\"Consider /gh-research first to \"\n + \"saturate understanding, then /gh-orchestrate to compose a floor-raising workflow.\\\" Omit it for a \"\n + \"focused or trivial task.\\n\"\n + \"This is advisory — the agent decides whether to follow it. Be concrete and concise; no preamble.\"\n )\n}\n\n/** System prompt for the single gpt-6-luna scope/goal inference. Steers a SHORT,\n * user-derived (not invented) advisory note grounded in the search results.\n *\n * @deprecated Prefer `getPromptScopeSystem(searchEnabled, bluebirdEnabled)` so\n * the prompt matches the launch's search backend. Kept for callers without flags;\n * built with local semantic search enabled. */\nexport const PROMPT_SCOPE_SYSTEM = getPromptScopeSystem(true)\n\n/** Injected IO for V2, all best-effort. Each network call returns its text and\n * never throws to the orchestrator (the orchestrator wraps the enrichment in a\n * timeout + try/catch and falls open to the regex goal).\n *\n * INVARIANT for live callers: each IO call MUST self-timeout (the live wiring\n * passes a per-call timeoutMs to callMcpTool / callInference). The orchestrator's\n * outer `timeoutMs` race only bounds how long it WAITS for a result before\n * failing open — it does NOT abort the in-flight call. A non-self-timing-out IO\n * would leave a socket open until the hook process's terminal `process.exit(0)`,\n * which is the hard backstop but not a substitute for the per-call bound. */\nexport interface PromptSubmitV2IO {\n /** One `mcp__search__code` call; returns the raw result text (\"\" on failure).\n * Receives the orchestrator's AbortSignal so a timed-out enrichment cancels\n * the in-flight request (live callers thread it into the HTTP fetch). */\n searchCode: (query: string, mode: \"lexical\" | \"semantic\", signal?: AbortSignal) => Promise<string>\n /** One gpt-6-luna `/v1/responses` inference; returns assistant text (\"\" on failure).\n * Receives the orchestrator's AbortSignal (see `searchCode`). */\n infer: (system: string, user: string, signal?: AbortSignal) => Promise<string>\n /** Pending advisory findings from the prior turn's background review. */\n readFindings: (sessionId: string) => Promise<string | null>\n clearFindings: (sessionId: string) => Promise<void>\n /** Stash this prompt so the next Stop review can judge the diff against it. */\n storePrompt: (sessionId: string, prompt: string) => Promise<void>\n /** Wall-clock budget for the substantive-prompt enrichment (search+infer);\n * on overrun the decision falls open to the regex goal. Default 22s. */\n timeoutMs?: number\n}\n\n/** Max chars of each search-result blob fed into the scope inference. */\nconst SEARCH_CONTEXT_CAP = 6 * 1024\n\n/** Wrap the prior-turn review findings in an explicitly NON-AUTHORITATIVE frame. */\nfunction framePendingFindings(findings: string): string {\n return (\n \"ADVISORY — independent review of your PREVIOUS change (NON-AUTHORITATIVE): an independent \"\n + \"gpt-6-luna reviewer flagged the following. Evaluate each on its merits — fix the real ones, and \"\n + \"ignore any wrong one with a one-line reason. You are NOT obligated to act on these.\\n\"\n + findings.trim()\n )\n}\n\nfunction joinSections(sections: Array<string>): string {\n return sections\n .map((s) => s.trim())\n .filter((s) => s.length > 0)\n .join(\"\\n\\n\")\n}\n\n/**\n * V2 decision: budget reset (via resetSession) + a grounded, user-derived scope\n * note + surfaced prior-turn findings. ASYNC and IO-driven, but every IO is\n * best-effort and the substantive enrichment is timeout-bounded with a fail-open\n * to the v1 regex goal — so this never blocks and never wedges the prompt.\n *\n * - subagent/teammate -> empty (top-level only, like v1).\n * - findings -> always surfaced (+ cleared) regardless of triviality.\n * - trivial prompt -> findings only (no search tip, no model call).\n * - substantive prompt -> search tip + grounded enrichment (parallel\n * lexical+semantic through Bluebird when enabled,\n * otherwise local semantic when enabled, else lexical-only)\n * -> ONE gpt-6-luna call\n * -> grounded scope/goal note. Fail-open to PROMPT_STEER_GOAL.\n * - steerEnabled=false -> findings only (no goal/tip).\n */\nexport async function decidePromptSubmitV2(input: {\n stdin: string\n steerEnabled: boolean\n io: PromptSubmitV2IO\n /** Whether local ColBERT semantic search is enabled for this launch. */\n searchEnabled?: boolean\n /** Whether Bluebird owns semantic and lexical search for this launch. */\n bluebirdEnabled?: boolean\n /** Launch profile id; only `\"cheapest\"` enables the Sol rewrite branch. */\n profile?: string\n /** True when `GH_ROUTER_DISABLE_CHEAPEST_REWRITE` opts out of the rewrite. */\n rewriteDisabled?: boolean\n /** Sol rewrite IO (cheapest only). Absent = existing Luna scope path. */\n rewrite?: CheapestRewriteIO\n}): Promise<PromptSubmitDecision> {\n let payload: { session_id?: unknown; prompt?: unknown; agent_type?: unknown; agent_id?: unknown } = {}\n try {\n const p: unknown = JSON.parse(input.stdin)\n if (p && typeof p === \"object\") payload = p as typeof payload\n } catch {\n return { inject: \"\" }\n }\n if (isSubagentContext(payload)) return { inject: \"\" }\n\n const decision: PromptSubmitDecision = { inject: \"\" }\n const sessionId = typeof payload.session_id === \"string\" && payload.session_id.length > 0 ? payload.session_id : \"\"\n if (sessionId) decision.resetSession = sessionId\n const prompt = typeof payload.prompt === \"string\" ? payload.prompt : \"\"\n\n // Stash the prompt for the next Stop review (best-effort, fire-and-await so a\n // slow disk doesn't matter — it's a tiny local write).\n if (sessionId) await input.io.storePrompt(sessionId, prompt).catch(() => {})\n\n // Read + clear any pending findings from the prior turn's background review.\n let findingsBlock = \"\"\n if (sessionId) {\n const pending = await input.io.readFindings(sessionId).catch(() => null)\n if (pending && pending.trim().length > 0) {\n findingsBlock = framePendingFindings(pending)\n await input.io.clearFindings(sessionId).catch(() => {})\n }\n }\n\n // steer disabled -> findings only.\n if (!input.steerEnabled) {\n decision.inject = findingsBlock\n return decision\n }\n\n // Trivial prompt -> no search tip and no model call; surface findings only.\n if (!isNonTrivialPrompt(prompt)) {\n decision.inject = findingsBlock\n return decision\n }\n\n // Substantive prompt -> search tip + grounded enrichment, timeout-bounded + fail-open.\n const searchEnabled = input.searchEnabled === true\n const bluebirdEnabled = input.bluebirdEnabled === true\n const semanticAvailable = searchEnabled || bluebirdEnabled\n const searchTip = getPromptSearchTip(searchEnabled, bluebirdEnabled)\n\n // Cheapest-only Sol → Luna rewrite: adaptive 3/5-turn grounded contract,\n // additive. Outcome is `{ brief, timedOut }`:\n // - brief present -> inject it and STOP (one voice; no Luna call).\n // - clean miss/empty -> fall through to the Luna scope path below.\n // - timedOut -> TERMINAL: inject the cheap regex goal only (no\n // second model call).\n // One-shot per session (first non-trivial prompt only): the flag is marked\n // BEFORE running (attempt-marking bounds spend even if Sol fails open), and\n // a missing session id fails closed (never spend blindly).\n // NOTE: non-triviality is recomputed here (not assumed from the early\n // return above) so this branch stays correct if the flow is refactored.\n if (\n input.rewrite\n && isCheapestRewriteEligible({\n profile: input.profile,\n promptIsNonTrivial: isNonTrivialPrompt(prompt),\n steerEnabled: input.steerEnabled,\n rewriteDisabled: input.rewriteDisabled === true,\n })\n && sessionId.length > 0\n && !(await input.rewrite.hasRewriteRun(sessionId).catch(() => true))\n ) {\n await input.rewrite.markRewriteRun(sessionId).catch(() => {})\n const rewrite = await runCheapestRewrite({\n prompt,\n searchEnabled,\n bluebirdEnabled,\n io: input.rewrite,\n }).catch(() => ({ brief: null, timedOut: false }))\n if (rewrite.brief && rewrite.brief.length > 0) {\n decision.inject = joinSections([searchTip, rewrite.brief, findingsBlock])\n return decision\n }\n if (rewrite.timedOut) {\n // Wall-clock timeout is TERMINAL for this prompt: fall open to the cheap\n // regex goal only (no second model call). A timed-out rewrite already\n // spent its one shot; running the Luna scope path would stack a second\n // model call under a budget we just exhausted.\n decision.inject = joinSections([searchTip, PROMPT_STEER_GOAL, findingsBlock])\n return decision\n }\n // else: a clean miss/empty — fall through to the existing Luna scope path.\n }\n\n const scopeSystem = getPromptScopeSystem(searchEnabled, bluebirdEnabled)\n const timeoutMs = input.io.timeoutMs ?? 22_000\n let goal = PROMPT_STEER_GOAL // fail-open default.\n let timer: ReturnType<typeof setTimeout> | undefined\n // One controller cancels BOTH search calls + the inference when the race ends\n // (timeout OR success), so a lost-race fetch never keeps the short-lived hook\n // process alive past its decision. Aborting after success is a harmless no-op.\n const controller = new AbortController()\n try {\n const enrich = (async (): Promise<string> => {\n if (!semanticAvailable) {\n const lexical = await input.io.searchCode(prompt, \"lexical\", controller.signal).catch(() => \"\")\n const searchContext = `Lexical search results:\\n${lexical.slice(0, SEARCH_CONTEXT_CAP)}`\n const note = await input.io.infer(\n scopeSystem,\n `USER REQUEST:\\n${prompt}\\n\\n${searchContext}`,\n controller.signal,\n )\n return note.trim()\n }\n const [lexical, semantic] = await Promise.all([\n input.io.searchCode(prompt, \"lexical\", controller.signal).catch(() => \"\"),\n input.io.searchCode(prompt, \"semantic\", controller.signal).catch(() => \"\"),\n ])\n const searchContext =\n `Lexical search results:\\n${lexical.slice(0, SEARCH_CONTEXT_CAP)}\\n\\n`\n + `Semantic search results:\\n${semantic.slice(0, SEARCH_CONTEXT_CAP)}`\n const note = await input.io.infer(\n scopeSystem,\n `USER REQUEST:\\n${prompt}\\n\\n${searchContext}`,\n controller.signal,\n )\n return note.trim()\n })()\n // Mark `enrich` handled so a post-race rejection (e.g. the inference aborting\n // after the timeout already won) can't surface as an unhandled rejection.\n enrich.catch(() => {})\n // The timer is cleared in `finally` (so when `enrich` wins, no live timer\n // lingers for the rest of `timeoutMs`).\n const raced = await Promise.race<string | \"__timeout__\">([\n enrich,\n new Promise<\"__timeout__\">((resolve) => {\n timer = setTimeout(() => resolve(\"__timeout__\"), timeoutMs)\n }),\n ])\n if (raced !== \"__timeout__\" && raced.length > 0) goal = raced\n } catch {\n // keep the fail-open regex goal.\n } finally {\n if (timer) clearTimeout(timer)\n controller.abort()\n }\n\n decision.inject = joinSections([searchTip, goal, findingsBlock])\n return decision\n}\n\n/** Build the shell command Claude Code runs for the `UserPromptSubmit` hook. */\nexport function buildPromptSubmitHookCommand(invocation: SelfInvocation): string {\n return buildSelfCommand(invocation, \"internal-prompt-submit\")\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiCA,MAAa,yBAAyB;AACtC,MAAa,0BAA0B;;AAUvC,MAAa,8BAA8B;;AAE3C,MAAa,gCAAgC;;AAI7C,MAAa,iCAAiC;;AAE9C,MAAa,6BAA6B;;AAG1C,MAAa,sBAAsB;;AAEnC,MAAa,mBAAmB;AAahC,SAAgB,6BAA6B,MAAyB,QAAQ,KAAc;CAC1F,MAAM,KAAK,IAAI,sCAAsC,GAAA,CAAI,KAAK,CAAC,CAAC,YAAY;CAC5E,OAAO,MAAM,OAAO,MAAM,UAAU,MAAM,SAAS,MAAM;AAC3D;AAEA,SAAg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|
|
1
1
|
import { E as extractZipMember, I as withInstallLock, T as extractTarGzMember } from "./service-backend-7SPDLUB9.js";
|
|
2
2
|
import { t as PATHS } from "./paths-CpbTHKeP.js";
|
|
3
3
|
import { i as parseBoolEnv, n as killChildProcessTree, o as resolveExecutable, s as runCommandCapture } from "./exec-MCU1H-KZ.js";
|
|
4
|
-
import { A as TOOLBELT_TOOLS, D as toolbeltEnabled, M as satisfiesMinVersion, O as toolbeltSkipSet, fn as collapsePathKeys, j as assetFor, k as vscodeRipgrepPath } from "./peer-mcp-personas-
|
|
4
|
+
import { A as TOOLBELT_TOOLS, D as toolbeltEnabled, M as satisfiesMinVersion, O as toolbeltSkipSet, fn as collapsePathKeys, j as assetFor, k as vscodeRipgrepPath } from "./peer-mcp-personas-agpBeTgS.js";
|
|
5
5
|
import { a as sweepRegistry } from "./lifecycle-kpLzHUgD.js";
|
|
6
6
|
import consola from "consola";
|
|
7
7
|
import { existsSync } from "node:fs";
|
|
@@ -693,4 +693,4 @@ async function exposedCommands(binDir) {
|
|
|
693
693
|
//#endregion
|
|
694
694
|
export { STRIPPED_AUTH_ROUTING_ENV_KEYS as a, launchChild as i, buildCodexProviderConfigFlags as n, getCodexVersion as r, provisionToolbelt as t };
|
|
695
695
|
|
|
696
|
-
//# sourceMappingURL=provision-
|
|
696
|
+
//# sourceMappingURL=provision-BKdrO1Sv.js.map
|