github-router 0.3.346 → 0.3.348
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/README.md +6 -6
- package/dist/{attribution-settings-DyzvcqWL.js → attribution-settings-P_vba-ri.js} +28 -18
- package/dist/attribution-settings-P_vba-ri.js.map +1 -0
- package/dist/{balanced-profile-contract-C6AgFJNp.js → balanced-profile-contract-XiIj4O1U.js} +7 -7
- package/dist/balanced-profile-contract-XiIj4O1U.js.map +1 -0
- package/dist/browser-ext/manifest.json +1 -1
- package/dist/{claude-Bc-4s27I.js → claude-D26fp1ih.js} +21 -20
- package/dist/claude-D26fp1ih.js.map +1 -0
- package/dist/{codex-D6ZfS7hJ.js → codex-DM97sCtu.js} +5 -5
- package/dist/{codex-D6ZfS7hJ.js.map → codex-DM97sCtu.js.map} +1 -1
- package/dist/copilot-discount-CilBhKQW.js.map +1 -1
- package/dist/engine-VTQo0qUy.js +2 -0
- package/dist/{gate-discovery-TC3k4dr1.js → gate-discovery-V-mslLHt.js} +4 -4
- package/dist/{gate-discovery-TC3k4dr1.js.map → gate-discovery-V-mslLHt.js.map} +1 -1
- package/dist/hooks.mjs +258 -10
- package/dist/hooks.sha256 +1 -1
- package/dist/{internal-artifact-open-lta2UPnE.js → internal-artifact-open-CXJbMXpq.js} +2 -2
- package/dist/{internal-artifact-open-lta2UPnE.js.map → internal-artifact-open-CXJbMXpq.js.map} +1 -1
- package/dist/{internal-fast-dispatch-guard-7UiD_vM5.js → internal-fast-dispatch-guard-DRsZJ-Rg.js} +2 -2
- package/dist/{internal-fast-dispatch-guard-7UiD_vM5.js.map → internal-fast-dispatch-guard-DRsZJ-Rg.js.map} +1 -1
- package/dist/{internal-fast-dispatch-guard-ByXUE5oO.js → internal-fast-dispatch-guard-DeZ6KilC.js} +1 -1
- package/dist/{internal-max-dispatch-guard-CioyE9wn.js → internal-max-dispatch-guard-DSjJwVH2.js} +3 -3
- package/dist/internal-max-dispatch-guard-DSjJwVH2.js.map +1 -0
- package/dist/{internal-max-dispatch-guard-BSRTtOit.js → internal-max-dispatch-guard-KmbYwh7h.js} +1 -1
- package/dist/{internal-plan-review-B4f0dpss.js → internal-plan-review-F-WbltsT.js} +3 -3
- package/dist/{internal-plan-review-B4f0dpss.js.map → internal-plan-review-F-WbltsT.js.map} +1 -1
- package/dist/{internal-prompt-submit-BMJ0A7vR.js → internal-prompt-submit-B1nd4y4V.js} +92 -6
- package/dist/internal-prompt-submit-B1nd4y4V.js.map +1 -0
- package/dist/{internal-session-bind-IpZ5hJzR.js → internal-session-bind-LrYEo-kg.js} +2 -2
- package/dist/{internal-session-bind-IpZ5hJzR.js.map → internal-session-bind-LrYEo-kg.js.map} +1 -1
- package/dist/{internal-stop-hook-BjdKy6On.js → internal-stop-hook-v5WF6Kc2.js} +5 -5
- package/dist/{internal-stop-hook-BjdKy6On.js.map → internal-stop-hook-v5WF6Kc2.js.map} +1 -1
- package/dist/{internal-stop-review-C7bOxX1q.js → internal-stop-review-nL003JIj.js} +2 -2
- package/dist/{internal-stop-review-C7bOxX1q.js.map → internal-stop-review-nL003JIj.js.map} +1 -1
- package/dist/main.js +13 -13
- package/dist/{max-profile-contract-LTJstj1e.js → max-profile-contract--dAYkEG1.js} +5 -4
- package/dist/max-profile-contract--dAYkEG1.js.map +1 -0
- package/dist/{orchestration-BMISq91N.js → orchestration-DjuJRhXn.js} +2 -2
- package/dist/{orchestration-BMISq91N.js.map → orchestration-DjuJRhXn.js.map} +1 -1
- package/dist/{peer-mcp-personas-CIV3aDP6.js → peer-mcp-personas-C200IycG.js} +107 -71
- package/dist/peer-mcp-personas-C200IycG.js.map +1 -0
- package/dist/{pi-CugyWYp7.js → pi-BWGfNpi7.js} +8 -5
- package/dist/pi-BWGfNpi7.js.map +1 -0
- package/dist/{plan-review-hook-BTvxvCCo.js → plan-review-hook-DMqPHBBN.js} +2 -2
- package/dist/{plan-review-hook-BTvxvCCo.js.map → plan-review-hook-DMqPHBBN.js.map} +1 -1
- package/dist/prompt-submit-hook-wjuHUrpS.js +352 -0
- package/dist/prompt-submit-hook-wjuHUrpS.js.map +1 -0
- package/dist/{provision-J68elA3c.js → provision-BFTONLfA.js} +3 -3
- package/dist/{provision-J68elA3c.js.map → provision-BFTONLfA.js.map} +1 -1
- package/dist/{serve-BEY7EjEv.js → serve-D9xQeGqi.js} +8 -8
- package/dist/{serve-BEY7EjEv.js.map → serve-D9xQeGqi.js.map} +1 -1
- package/dist/{server-setup-tNMUzFgE.js → server-setup-R1HQtpR9.js} +77 -35
- package/dist/server-setup-R1HQtpR9.js.map +1 -0
- package/dist/{start-BDxUhfDG.js → start-vg2n8UjI.js} +4 -4
- package/dist/{start-BDxUhfDG.js.map → start-vg2n8UjI.js.map} +1 -1
- package/dist/{stop-gate-hook-DBcxPgkF.js → stop-gate-hook-DRcYQAtf.js} +3 -3
- package/dist/{stop-gate-hook-DBcxPgkF.js.map → stop-gate-hook-DRcYQAtf.js.map} +1 -1
- package/dist/{stop-gate-policy-Gd_cNT9-.js → stop-gate-policy-CbLklfV2.js} +21 -2
- package/dist/{stop-gate-policy-Gd_cNT9-.js.map → stop-gate-policy-CbLklfV2.js.map} +1 -1
- package/package.json +1 -1
- package/dist/attribution-settings-DyzvcqWL.js.map +0 -1
- package/dist/balanced-profile-contract-C6AgFJNp.js.map +0 -1
- package/dist/claude-Bc-4s27I.js.map +0 -1
- package/dist/engine-PexAztE4.js +0 -2
- package/dist/internal-max-dispatch-guard-CioyE9wn.js.map +0 -1
- package/dist/internal-prompt-submit-BMJ0A7vR.js.map +0 -1
- package/dist/max-profile-contract-LTJstj1e.js.map +0 -1
- package/dist/peer-mcp-personas-CIV3aDP6.js.map +0 -1
- package/dist/pi-CugyWYp7.js.map +0 -1
- package/dist/prompt-submit-hook-BeLUDy_m.js +0 -173
- package/dist/prompt-submit-hook-BeLUDy_m.js.map +0 -1
- package/dist/server-setup-tNMUzFgE.js.map +0 -1
package/dist/hooks.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import g, { stdin, stdout } from "node:process";
|
|
|
6
6
|
import * as tty from "node:tty";
|
|
7
7
|
import { WriteStream } from "node:tty";
|
|
8
8
|
import f from "node:readline";
|
|
9
|
-
import fs, { existsSync, mkdirSync, promises, readFileSync, realpathSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
|
|
9
|
+
import fs, { existsSync, mkdirSync, promises, readFileSync, readdirSync, realpathSync, renameSync, unlinkSync, writeFileSync } from "node:fs";
|
|
10
10
|
import { fileURLToPath } from "node:url";
|
|
11
11
|
import { spawn, spawnSync } from "node:child_process";
|
|
12
12
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
@@ -3647,6 +3647,25 @@ function fileLastPromptStore(stateDir) {
|
|
|
3647
3647
|
}
|
|
3648
3648
|
};
|
|
3649
3649
|
}
|
|
3650
|
+
function fileRewriteFlagStore(stateDir) {
|
|
3651
|
+
const fileFor = (sid) => path.join(stateDir, `rewrite-done-${createHash("sha256").update(sid).digest("hex").slice(0, 32)}`);
|
|
3652
|
+
return {
|
|
3653
|
+
async hasRun(sid) {
|
|
3654
|
+
try {
|
|
3655
|
+
await promises.access(fileFor(sid));
|
|
3656
|
+
return true;
|
|
3657
|
+
} catch {
|
|
3658
|
+
return false;
|
|
3659
|
+
}
|
|
3660
|
+
},
|
|
3661
|
+
async markRun(sid) {
|
|
3662
|
+
await promises.mkdir(stateDir, { recursive: true });
|
|
3663
|
+
const tmp = `${fileFor(sid)}.${process.pid}.tmp`;
|
|
3664
|
+
await promises.writeFile(tmp, "1", { mode: 384 });
|
|
3665
|
+
await promises.rename(tmp, fileFor(sid));
|
|
3666
|
+
}
|
|
3667
|
+
};
|
|
3668
|
+
}
|
|
3650
3669
|
var repoRootMemo;
|
|
3651
3670
|
var init_stop_gate_policy = __esmMin((() => {
|
|
3652
3671
|
init_exec();
|
|
@@ -11230,10 +11249,10 @@ var init_aic_ledger = __esmMin((() => {
|
|
|
11230
11249
|
})), BALANCED_PROFILE_MODELS, BALANCED_PROFILE_DELEGATION_GRAPH;
|
|
11231
11250
|
var init_balanced_profile_contract = __esmMin((() => {
|
|
11232
11251
|
BALANCED_PROFILE_MODELS = Object.freeze({
|
|
11233
|
-
lead: "gpt-6-sol",
|
|
11252
|
+
lead: "gpt-5.6-sol",
|
|
11234
11253
|
explore: "gpt-6-luna",
|
|
11235
11254
|
"General-Purpose": "gpt-6-luna",
|
|
11236
|
-
reviewer: "gpt-6-sol",
|
|
11255
|
+
reviewer: "gpt-5.6-sol",
|
|
11237
11256
|
oracle: "grok-4.6",
|
|
11238
11257
|
astra: "gpt-6-astra"
|
|
11239
11258
|
});
|
|
@@ -11257,17 +11276,17 @@ var init_balanced_profile_contract = __esmMin((() => {
|
|
|
11257
11276
|
var init_fast_profile_contract = __esmMin((() => {
|
|
11258
11277
|
FAST_PROFILE_MODELS = Object.freeze({
|
|
11259
11278
|
luna: "gpt-6-luna",
|
|
11260
|
-
sol: "gpt-6-sol",
|
|
11279
|
+
sol: "gpt-5.6-sol",
|
|
11261
11280
|
gemini: "gemini-3.8-flash",
|
|
11262
11281
|
grok: "grok-4.6",
|
|
11263
11282
|
opus: "claude-opus-5.5",
|
|
11264
11283
|
sonnet: "claude-sonnet-5",
|
|
11265
11284
|
lead: "gemini-3.8-flash",
|
|
11266
11285
|
explore: "gpt-6-luna",
|
|
11267
|
-
plan: "gpt-6-sol",
|
|
11286
|
+
plan: "gpt-5.6-sol",
|
|
11268
11287
|
"General-Purpose": "gemini-3.8-flash",
|
|
11269
11288
|
reviewer: "claude-sonnet-5",
|
|
11270
|
-
advisor: "gpt-6-sol",
|
|
11289
|
+
advisor: "gpt-5.6-sol",
|
|
11271
11290
|
oracle: "claude-opus-5.5",
|
|
11272
11291
|
astra: "gpt-6-astra"
|
|
11273
11292
|
});
|
|
@@ -11308,7 +11327,7 @@ var init_max_profile_contract = __esmMin((() => {
|
|
|
11308
11327
|
init_max_profile_prompts();
|
|
11309
11328
|
init_state();
|
|
11310
11329
|
MAX_PROFILE_MODELS = Object.freeze({
|
|
11311
|
-
sol: "gpt-6-sol",
|
|
11330
|
+
sol: "gpt-5.6-sol",
|
|
11312
11331
|
luna: "gpt-6-luna",
|
|
11313
11332
|
gemini: "gemini-3.8-flash",
|
|
11314
11333
|
grok: "grok-4.6",
|
|
@@ -11352,6 +11371,7 @@ var init_max_profile_contract = __esmMin((() => {
|
|
|
11352
11371
|
]);
|
|
11353
11372
|
Object.freeze([
|
|
11354
11373
|
MAX_PROFILE_MODELS.sol,
|
|
11374
|
+
"gpt-6-sol",
|
|
11355
11375
|
MAX_PROFILE_MODELS.luna,
|
|
11356
11376
|
MAX_PROFILE_MODELS.gemini,
|
|
11357
11377
|
MAX_PROFILE_MODELS.opus
|
|
@@ -35428,6 +35448,136 @@ var init_internal_stop_hook = __esmMin((() => {
|
|
|
35428
35448
|
});
|
|
35429
35449
|
}));
|
|
35430
35450
|
//#endregion
|
|
35451
|
+
//#region src/lib/cheapest-prompt-rewrite.ts
|
|
35452
|
+
function isCheapestRewriteDisabledEnv(env = process.env) {
|
|
35453
|
+
const v = (env.GH_ROUTER_DISABLE_CHEAPEST_REWRITE ?? "").trim().toLowerCase();
|
|
35454
|
+
return v === "1" || v === "true" || v === "yes" || v === "on";
|
|
35455
|
+
}
|
|
35456
|
+
function isCheapestRewriteEligible(input) {
|
|
35457
|
+
if (!input.steerEnabled) return false;
|
|
35458
|
+
if (input.rewriteDisabled) return false;
|
|
35459
|
+
if (input.profile !== "cheapest") return false;
|
|
35460
|
+
return input.promptIsNonTrivial;
|
|
35461
|
+
}
|
|
35462
|
+
/** Adaptive budget: 5 only on Sol's explicit deep-grounding flag, else 3. */
|
|
35463
|
+
function resolveRewriteTurnBudget(solText) {
|
|
35464
|
+
if (typeof solText === "string" && solText.includes("needs_deep_grounding=true")) return 5;
|
|
35465
|
+
return 3;
|
|
35466
|
+
}
|
|
35467
|
+
/** Extract a single follow-up query Sol names via `NEED_MORE: <query>. */
|
|
35468
|
+
function parseNeedMoreQuery(solText) {
|
|
35469
|
+
const idx = solText.indexOf(NEED_MORE_PREFIX);
|
|
35470
|
+
if (idx < 0) return "";
|
|
35471
|
+
return solText.slice(idx + 10).split("\n", 1)[0]?.trim().slice(0, 280) ?? "";
|
|
35472
|
+
}
|
|
35473
|
+
/**
|
|
35474
|
+
* System prompt for the Sol rewriter. Names the turn budget explicitly so
|
|
35475
|
+
* Sol knows what it is doing, how many turns it has, that zero-tool
|
|
35476
|
+
* immediate rewrite is allowed, and that the output serves Luna (mini-tier:
|
|
35477
|
+
* explicit, short, flat, outcome-first with stop rules).
|
|
35478
|
+
*/
|
|
35479
|
+
function buildSolRewriteSystem(opts) {
|
|
35480
|
+
const searchNoun = opts.bluebirdEnabled ? "Bluebird lexical + semantic code search" : opts.searchEnabled ? "local lexical + semantic code search" : "lexical code search";
|
|
35481
|
+
return `You are a prompt-rewriting advisor for a coding agent. A cheap mini-tier model (Luna) will execute the user's request. Your job is to rewrite it into a SHORT structured brief that lets Luna do its best work.
|
|
35482
|
+
Turn budget: you have at most ${opts.turnBudget} tool turns TOTAL (search/read). You may use ZERO tools and rewrite immediately when the static context already suffices — do not pad turns. 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.\nGrounding available: ${searchNoun} results, repo guidance (AGENTS.md/CLAUDE.md), and repo structure are in your context. Prefer targeted reads over full-file reads.\nRules for the brief (tuned for a mini-tier executor):\n1. Outcome-first: state the user's OWN goal as one measurable objective, in their terms. Do NOT invent new requirements or acceptance criteria.\n2. Explicit + literal: flat numbered steps in order; front-load the key constraints; no nested hierarchies; no contradictory instructions.\n3. Tool rules: lexical search first (exact symbols/files/errors, zero model cost), semantic second for intent drift, Explore only when search is insufficient.\n4. Scope: name the files/symbols in play with file:line when known, or state the gap explicitly — never guess.\n5. Stop rules: when Luna is done, what check settles it (build/test/read), and when to ask vs proceed.\n6. Keep it SHORT (under ~300 words). Respond with the brief body only, no preamble.`;
|
|
35483
|
+
}
|
|
35484
|
+
/** Assemble the capped static pack Sol sees (static-first for cache hits). */
|
|
35485
|
+
function buildStaticContextPack(pack) {
|
|
35486
|
+
const parts = [`USER REQUEST:\n${pack.prompt}`];
|
|
35487
|
+
if (pack.agentsMd.trim().length > 0) parts.push(`REPO GUIDANCE (AGENTS.md):\n${pack.agentsMd.slice(0, CHEAPEST_REWRITE_GUIDANCE_CAP)}`);
|
|
35488
|
+
if (pack.claudeMd.trim().length > 0) parts.push(`REPO GUIDANCE (CLAUDE.md):\n${pack.claudeMd.slice(0, CHEAPEST_REWRITE_GUIDANCE_CAP)}`);
|
|
35489
|
+
if (pack.repoStructure.trim().length > 0) parts.push(`REPO STRUCTURE:\n${pack.repoStructure.slice(0, CHEAPEST_REWRITE_STRUCTURE_CAP)}`);
|
|
35490
|
+
if (pack.searchContext.trim().length > 0) parts.push(pack.searchContext);
|
|
35491
|
+
return parts.join("\n\n");
|
|
35492
|
+
}
|
|
35493
|
+
/**
|
|
35494
|
+
* Wrap Sol's raw brief as the additive Luna-facing block. Returns "" when
|
|
35495
|
+
* Sol produced nothing usable (caller treats that as fail-open).
|
|
35496
|
+
*/
|
|
35497
|
+
function wrapLunaBrief(solText) {
|
|
35498
|
+
const body = solText.replace(DEEP_GROUNDING_FLAG, "").split("\n").filter((line) => !line.trimStart().startsWith(NEED_MORE_PREFIX)).join("\n").trim();
|
|
35499
|
+
if (body.length === 0) return "";
|
|
35500
|
+
return `LUNA BRIEF (advisory, additive — the original request above still stands):\n${body.length > 2e3 ? `${body.slice(0, CHEAPEST_REWRITE_BRIEF_CAP).trimEnd()}…` : body}`;
|
|
35501
|
+
}
|
|
35502
|
+
/**
|
|
35503
|
+
* Run the adaptive rewrite. Returns the wrapped Luna brief, or null when
|
|
35504
|
+
* anything is missing/empty/over-budget so the caller falls back to the
|
|
35505
|
+
* existing V2 scope/goal path. Never throws to the orchestrator.
|
|
35506
|
+
*/
|
|
35507
|
+
async function runCheapestRewrite(input) {
|
|
35508
|
+
const timeoutMs = input.io.timeoutMs ?? 2e4;
|
|
35509
|
+
const controller = new AbortController();
|
|
35510
|
+
let timer;
|
|
35511
|
+
try {
|
|
35512
|
+
const work = (async () => {
|
|
35513
|
+
const semanticAvailable = input.searchEnabled || input.bluebirdEnabled;
|
|
35514
|
+
const [lexical, semantic, statik] = await Promise.all([
|
|
35515
|
+
input.io.searchCode(input.prompt, "lexical", controller.signal).catch(() => ""),
|
|
35516
|
+
semanticAvailable ? input.io.searchCode(input.prompt, "semantic", controller.signal).catch(() => "") : Promise.resolve(""),
|
|
35517
|
+
input.io.staticPack().catch(() => ({
|
|
35518
|
+
agentsMd: "",
|
|
35519
|
+
claudeMd: "",
|
|
35520
|
+
repoStructure: ""
|
|
35521
|
+
}))
|
|
35522
|
+
]);
|
|
35523
|
+
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)}`;
|
|
35524
|
+
const user = buildStaticContextPack({
|
|
35525
|
+
prompt: input.prompt,
|
|
35526
|
+
agentsMd: statik.agentsMd,
|
|
35527
|
+
claudeMd: statik.claudeMd,
|
|
35528
|
+
repoStructure: statik.repoStructure,
|
|
35529
|
+
searchContext
|
|
35530
|
+
});
|
|
35531
|
+
const first = await input.io.inferSol(buildSolRewriteSystem({
|
|
35532
|
+
searchEnabled: input.searchEnabled,
|
|
35533
|
+
bluebirdEnabled: input.bluebirdEnabled,
|
|
35534
|
+
turnBudget: 3
|
|
35535
|
+
}), user, controller.signal).catch(() => "");
|
|
35536
|
+
if (!first || first.trim().length === 0) return null;
|
|
35537
|
+
const budget = resolveRewriteTurnBudget(first);
|
|
35538
|
+
const followUp = parseNeedMoreQuery(first);
|
|
35539
|
+
if (budget !== 5 || followUp.length === 0) {
|
|
35540
|
+
const brief = wrapLunaBrief(first);
|
|
35541
|
+
return brief.length > 0 ? brief : null;
|
|
35542
|
+
}
|
|
35543
|
+
const extra = await input.io.searchCode(followUp, "lexical", controller.signal).catch(() => "");
|
|
35544
|
+
if (extra.trim().length === 0) {
|
|
35545
|
+
const brief = wrapLunaBrief(first);
|
|
35546
|
+
return brief.length > 0 ? brief : null;
|
|
35547
|
+
}
|
|
35548
|
+
const second = await input.io.inferSol(buildSolRewriteSystem({
|
|
35549
|
+
searchEnabled: input.searchEnabled,
|
|
35550
|
+
bluebirdEnabled: input.bluebirdEnabled,
|
|
35551
|
+
turnBudget: 5
|
|
35552
|
+
}), `${user}\n\nFOLLOW-UP GROUNDING for "${followUp}":\n${extra.slice(0, CHEAPEST_REWRITE_SEARCH_CAP)}\n\nRewrite the brief with this grounding (same rules, short).`, controller.signal).catch(() => "");
|
|
35553
|
+
const brief = wrapLunaBrief(second.trim().length > 0 ? second : first);
|
|
35554
|
+
return brief.length > 0 ? brief : null;
|
|
35555
|
+
})();
|
|
35556
|
+
work.catch(() => {});
|
|
35557
|
+
const raced = await Promise.race([work, new Promise((resolve) => {
|
|
35558
|
+
timer = setTimeout(() => resolve("__timeout__"), timeoutMs);
|
|
35559
|
+
})]);
|
|
35560
|
+
if (raced === "__timeout__" || raced === null) return null;
|
|
35561
|
+
return raced;
|
|
35562
|
+
} catch {
|
|
35563
|
+
return null;
|
|
35564
|
+
} finally {
|
|
35565
|
+
if (timer) clearTimeout(timer);
|
|
35566
|
+
controller.abort();
|
|
35567
|
+
}
|
|
35568
|
+
}
|
|
35569
|
+
var CHEAPEST_REWRITE_MODEL, CHEAPEST_REWRITE_EFFORT, CHEAPEST_REWRITE_SEARCH_CAP, CHEAPEST_REWRITE_GUIDANCE_CAP, CHEAPEST_REWRITE_STRUCTURE_CAP, CHEAPEST_REWRITE_BRIEF_CAP, DEEP_GROUNDING_FLAG, NEED_MORE_PREFIX;
|
|
35570
|
+
var init_cheapest_prompt_rewrite = __esmMin((() => {
|
|
35571
|
+
CHEAPEST_REWRITE_MODEL = "gpt-5.6-sol";
|
|
35572
|
+
CHEAPEST_REWRITE_EFFORT = "medium";
|
|
35573
|
+
CHEAPEST_REWRITE_SEARCH_CAP = 6144;
|
|
35574
|
+
CHEAPEST_REWRITE_GUIDANCE_CAP = 4096;
|
|
35575
|
+
CHEAPEST_REWRITE_STRUCTURE_CAP = 2048;
|
|
35576
|
+
CHEAPEST_REWRITE_BRIEF_CAP = 2e3;
|
|
35577
|
+
DEEP_GROUNDING_FLAG = "needs_deep_grounding=true";
|
|
35578
|
+
NEED_MORE_PREFIX = "NEED_MORE:";
|
|
35579
|
+
}));
|
|
35580
|
+
//#endregion
|
|
35431
35581
|
//#region src/lib/orchestration/prompt-submit-hook.ts
|
|
35432
35582
|
/**
|
|
35433
35583
|
* Cheap, conservative complexity heuristic — a long prompt, an imperative
|
|
@@ -35536,6 +35686,28 @@ async function decidePromptSubmitV2(input) {
|
|
|
35536
35686
|
const bluebirdEnabled = input.bluebirdEnabled === true;
|
|
35537
35687
|
const semanticAvailable = searchEnabled || bluebirdEnabled;
|
|
35538
35688
|
const searchTip = getPromptSearchTip(searchEnabled, bluebirdEnabled);
|
|
35689
|
+
if (input.rewrite && isCheapestRewriteEligible({
|
|
35690
|
+
profile: input.profile,
|
|
35691
|
+
promptIsNonTrivial: isNonTrivialPrompt(prompt),
|
|
35692
|
+
steerEnabled: input.steerEnabled,
|
|
35693
|
+
rewriteDisabled: input.rewriteDisabled === true
|
|
35694
|
+
}) && sessionId.length > 0 && !await input.rewrite.hasRewriteRun(sessionId).catch(() => true)) {
|
|
35695
|
+
await input.rewrite.markRewriteRun(sessionId).catch(() => {});
|
|
35696
|
+
const brief = await runCheapestRewrite({
|
|
35697
|
+
prompt,
|
|
35698
|
+
searchEnabled,
|
|
35699
|
+
bluebirdEnabled,
|
|
35700
|
+
io: input.rewrite
|
|
35701
|
+
}).catch(() => null);
|
|
35702
|
+
if (brief && brief.length > 0) {
|
|
35703
|
+
decision.inject = joinSections([
|
|
35704
|
+
searchTip,
|
|
35705
|
+
brief,
|
|
35706
|
+
findingsBlock
|
|
35707
|
+
]);
|
|
35708
|
+
return decision;
|
|
35709
|
+
}
|
|
35710
|
+
}
|
|
35539
35711
|
const scopeSystem = getPromptScopeSystem(searchEnabled, bluebirdEnabled);
|
|
35540
35712
|
const timeoutMs = input.io.timeoutMs ?? 22e3;
|
|
35541
35713
|
let goal = PROMPT_STEER_GOAL;
|
|
@@ -35569,6 +35741,7 @@ async function decidePromptSubmitV2(input) {
|
|
|
35569
35741
|
}
|
|
35570
35742
|
var PROMPT_STEER_GOAL, SEARCH_CONTEXT_CAP;
|
|
35571
35743
|
var init_prompt_submit_hook = __esmMin((() => {
|
|
35744
|
+
init_cheapest_prompt_rewrite();
|
|
35572
35745
|
init_self_invocation();
|
|
35573
35746
|
init_stop_gate_policy();
|
|
35574
35747
|
PROMPT_STEER_GOAL = "GOAL (advisory): for a non-trivial task, FIRST run /gh-research on this ask to information saturation — verify the load-bearing claims against the actual code before planning, and do not plan or write code until research is saturated. THEN, for an implementation or change task, run /gh-orchestrate to compose and run a floor-raising workflow (it checkpoints before expensive work). Skip both for a trivial ask; you may decline if they do not fit.";
|
|
@@ -35576,7 +35749,10 @@ var init_prompt_submit_hook = __esmMin((() => {
|
|
|
35576
35749
|
}));
|
|
35577
35750
|
//#endregion
|
|
35578
35751
|
//#region src/internal-prompt-submit.ts
|
|
35579
|
-
var internal_prompt_submit_exports = /* @__PURE__ */ __exportAll({
|
|
35752
|
+
var internal_prompt_submit_exports = /* @__PURE__ */ __exportAll({
|
|
35753
|
+
buildStaticPack: () => buildStaticPack,
|
|
35754
|
+
internalPromptSubmit: () => internalPromptSubmit
|
|
35755
|
+
});
|
|
35580
35756
|
/**
|
|
35581
35757
|
* Read the hook payload from stdin SYNCHRONOUSLY (`readFileSync(0)`). An async
|
|
35582
35758
|
* stdin read leaves an in-flight libuv FS request that, on Windows, races the
|
|
@@ -35604,9 +35780,46 @@ function workspaceFromStdin(stdin) {
|
|
|
35604
35780
|
} catch {}
|
|
35605
35781
|
return process.cwd();
|
|
35606
35782
|
}
|
|
35607
|
-
|
|
35783
|
+
/** Read a text file best-effort, capped; missing/unreadable -> "". */
|
|
35784
|
+
function readCappedFile(absPath, cap) {
|
|
35785
|
+
try {
|
|
35786
|
+
return readFileSync(absPath, "utf8").slice(0, cap);
|
|
35787
|
+
} catch {
|
|
35788
|
+
return "";
|
|
35789
|
+
}
|
|
35790
|
+
}
|
|
35791
|
+
/**
|
|
35792
|
+
* Static repo context for the cheapest rewrite: AGENTS.md (preferred) +
|
|
35793
|
+
* CLAUDE.md fallback + top-level structure + package.json scripts snippet.
|
|
35794
|
+
* All synchronous (tiny reads) and capped; missing files yield "".
|
|
35795
|
+
*/
|
|
35796
|
+
function buildStaticPack(workspace) {
|
|
35797
|
+
const agentsMd = readCappedFile(path.join(workspace, "AGENTS.md"), CHEAPEST_REWRITE_GUIDANCE_CAP);
|
|
35798
|
+
const claudeMd = agentsMd.length > 0 ? "" : readCappedFile(path.join(workspace, "CLAUDE.md"), CHEAPEST_REWRITE_GUIDANCE_CAP);
|
|
35799
|
+
let listing;
|
|
35800
|
+
try {
|
|
35801
|
+
listing = readdirSync(workspace, { withFileTypes: true }).slice(0, 60).map((e) => e.isDirectory() ? `${e.name}/` : e.name).join(", ");
|
|
35802
|
+
} catch {
|
|
35803
|
+
listing = "";
|
|
35804
|
+
}
|
|
35805
|
+
let pkgSnippet;
|
|
35806
|
+
try {
|
|
35807
|
+
const raw = readFileSync(path.join(workspace, "package.json"), "utf8");
|
|
35808
|
+
const pkg = JSON.parse(raw);
|
|
35809
|
+
pkgSnippet = `scripts: [${pkg.scripts ? Object.keys(pkg.scripts).slice(0, 20).join(", ") : ""}] deps: [${pkg.dependencies ? Object.keys(pkg.dependencies).slice(0, 20).join(", ") : ""}]`;
|
|
35810
|
+
} catch {
|
|
35811
|
+
pkgSnippet = "";
|
|
35812
|
+
}
|
|
35813
|
+
return {
|
|
35814
|
+
agentsMd,
|
|
35815
|
+
claudeMd,
|
|
35816
|
+
repoStructure: [`top-level: ${listing}`, pkgSnippet].filter((s) => s.trim().length > 0 && s !== "top-level: ").join("\n").slice(0, CHEAPEST_REWRITE_STRUCTURE_CAP)
|
|
35817
|
+
};
|
|
35818
|
+
}
|
|
35819
|
+
var SEARCH_TIMEOUT_MS, INFER_TIMEOUT_MS, REWRITE_TIMEOUT_MS, internalPromptSubmit;
|
|
35608
35820
|
var init_internal_prompt_submit = __esmMin((() => {
|
|
35609
35821
|
init_dist$1();
|
|
35822
|
+
init_cheapest_prompt_rewrite();
|
|
35610
35823
|
init_exec();
|
|
35611
35824
|
init_hook_mcp_client();
|
|
35612
35825
|
init_stop_gate_hook();
|
|
@@ -35614,6 +35827,7 @@ var init_internal_prompt_submit = __esmMin((() => {
|
|
|
35614
35827
|
init_stop_gate_policy();
|
|
35615
35828
|
SEARCH_TIMEOUT_MS = 8e3;
|
|
35616
35829
|
INFER_TIMEOUT_MS = 18e3;
|
|
35830
|
+
REWRITE_TIMEOUT_MS = 18e3;
|
|
35617
35831
|
internalPromptSubmit = defineCommand({
|
|
35618
35832
|
meta: {
|
|
35619
35833
|
name: "internal-prompt-submit",
|
|
@@ -35634,6 +35848,40 @@ var init_internal_prompt_submit = __esmMin((() => {
|
|
|
35634
35848
|
steerEnabled,
|
|
35635
35849
|
searchEnabled,
|
|
35636
35850
|
bluebirdEnabled,
|
|
35851
|
+
profile: (process.env.GH_ROUTER_PROFILE ?? "").trim().toLowerCase(),
|
|
35852
|
+
rewriteDisabled: isCheapestRewriteDisabledEnv(),
|
|
35853
|
+
rewrite: {
|
|
35854
|
+
searchCode: async (query, mode, signal) => {
|
|
35855
|
+
const r = await callMcpTool({
|
|
35856
|
+
runtime,
|
|
35857
|
+
group: "search",
|
|
35858
|
+
tool: "code",
|
|
35859
|
+
args: {
|
|
35860
|
+
query,
|
|
35861
|
+
workspace,
|
|
35862
|
+
mode,
|
|
35863
|
+
limit: 10,
|
|
35864
|
+
summary: false
|
|
35865
|
+
},
|
|
35866
|
+
timeoutMs: SEARCH_TIMEOUT_MS,
|
|
35867
|
+
signal
|
|
35868
|
+
});
|
|
35869
|
+
return r.isError ? "" : r.text;
|
|
35870
|
+
},
|
|
35871
|
+
inferSol: (system, user, signal) => callInference({
|
|
35872
|
+
serverUrl: runtime.serverUrl,
|
|
35873
|
+
model: CHEAPEST_REWRITE_MODEL,
|
|
35874
|
+
instructions: system,
|
|
35875
|
+
input: user,
|
|
35876
|
+
effort: CHEAPEST_REWRITE_EFFORT,
|
|
35877
|
+
timeoutMs: INFER_TIMEOUT_MS,
|
|
35878
|
+
signal
|
|
35879
|
+
}),
|
|
35880
|
+
staticPack: async () => buildStaticPack(workspace),
|
|
35881
|
+
hasRewriteRun: (sid) => fileRewriteFlagStore(stopReviewStateDir()).hasRun(sid),
|
|
35882
|
+
markRewriteRun: (sid) => fileRewriteFlagStore(stopReviewStateDir()).markRun(sid),
|
|
35883
|
+
timeoutMs: REWRITE_TIMEOUT_MS
|
|
35884
|
+
},
|
|
35637
35885
|
io: {
|
|
35638
35886
|
searchCode: async (query, mode, signal) => {
|
|
35639
35887
|
const r = await callMcpTool({
|
|
@@ -38604,7 +38852,7 @@ function normalizeMaxDispatchModel(model) {
|
|
|
38604
38852
|
function normalizeMaxDispatchEffort(model, effort) {
|
|
38605
38853
|
if (effort === void 0 || effort === null) return void 0;
|
|
38606
38854
|
if (typeof effort !== "string") return void 0;
|
|
38607
|
-
if ((model === "gpt-6-sol" || model === "gpt-6-sol" ? [
|
|
38855
|
+
if ((model === "gpt-5.6-sol" || model === "gpt-6-sol" ? [
|
|
38608
38856
|
"high",
|
|
38609
38857
|
"xhigh",
|
|
38610
38858
|
"max"
|
package/dist/hooks.sha256
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
729c327dfa6dd86d73b113a80bab71a0eeaecc3e444a9ef99d0bb8e50ee60ce3
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as ArtifactClient } from "./client-CQMfroGV.js";
|
|
2
|
-
import {
|
|
2
|
+
import { o as isSubagentContext } from "./stop-gate-policy-CbLklfV2.js";
|
|
3
3
|
import { defineCommand } from "citty";
|
|
4
4
|
import { readFileSync, realpathSync, writeFileSync } from "node:fs";
|
|
5
5
|
import path from "node:path";
|
|
@@ -316,4 +316,4 @@ const internalArtifactOpen = defineCommand({
|
|
|
316
316
|
//#endregion
|
|
317
317
|
export { internalArtifactOpen };
|
|
318
318
|
|
|
319
|
-
//# sourceMappingURL=internal-artifact-open-
|
|
319
|
+
//# sourceMappingURL=internal-artifact-open-CXJbMXpq.js.map
|
package/dist/{internal-artifact-open-lta2UPnE.js.map → internal-artifact-open-CXJbMXpq.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal-artifact-open-lta2UPnE.js","names":[],"sources":["../src/lib/artifact/plan-html.ts","../src/internal-artifact-open.ts"],"sourcesContent":["/**\n * Render a plan's markdown into a self-contained, styled HTML document for the\n * ai-or-die Artifact panel. HTML is the canonical review artifact (lavish's\n * model); converting here means the hands-off auto-open shows a formatted,\n * annotatable page instead of raw markdown.\n *\n * Security: the iframe ai-or-die serves this into runs with\n * `allow-scripts allow-same-origin`, so a `<script>` smuggled into the plan\n * markdown could read the per-session asset token. Two defenses:\n * 1. marked is configured to ESCAPE raw HTML tokens (render as visible text).\n * 2. `link`/`image` hrefs with script-bearing schemes (javascript:, vbscript:,\n * non-image data:) are neutralised before rendering.\n * No separate sanitizer/dep needed.\n */\nimport { Marked } from \"marked\"\n\nfunction escapeHtml(s: string): string {\n return s\n .replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n .replace(/\"/g, \""\")\n .replace(/'/g, \"'\")\n}\n\n/** Decode the HTML character references a browser would resolve in an attribute\n * value, so an entity-obfuscated scheme (`javascript:`, `javascript:`)\n * cannot slip past the scheme check below. Numeric refs cover any letter; the\n * small named map covers the scheme-relevant punctuation. */\nconst NAMED_REFS: Record<string, string> = {\n colon: \":\", tab: \"\\t\", newline: \"\\n\", sol: \"/\", semi: \";\", amp: \"&\", lpar: \"(\", rpar: \")\",\n}\nfunction decodeEntities(s: string): string {\n return s.replace(/&(#[xX][0-9a-fA-F]+|#[0-9]+|[a-zA-Z]+);?/g, (m, body: string) => {\n if (body[0] === \"#\") {\n const code = body[1] === \"x\" || body[1] === \"X\"\n ? Number.parseInt(body.slice(2), 16)\n : Number.parseInt(body.slice(1), 10)\n return Number.isFinite(code) && code > 0 && code <= 0x10ffff ? String.fromCodePoint(code) : m\n }\n return NAMED_REFS[body.toLowerCase()] ?? m\n })\n}\n\n/** Block script-bearing URL schemes (defense-in-depth on top of HTML escaping). */\nfunction isDangerousUrl(url: string, isImage: boolean): boolean {\n // Decode entities first (a browser resolves them in href), then drop ASCII\n // control chars + spaces (code <= 0x20) a browser ignores inside a scheme.\n const v = Array.from(decodeEntities(url)).filter((c) => c.charCodeAt(0) > 0x20).join(\"\").toLowerCase()\n if (v.startsWith(\"javascript:\") || v.startsWith(\"vbscript:\")) return true\n if (v.startsWith(\"data:\")) {\n // Allow only raster image data URIs (and only for <img>); SVG can script.\n return !(isImage && v.startsWith(\"data:image/\") && !v.startsWith(\"data:image/svg\"))\n }\n return false\n}\n\n/** A marked instance that escapes raw HTML (raw markup never becomes live). */\nfunction makeMarked(): Marked {\n const m = new Marked({ gfm: true, breaks: false })\n m.use({\n renderer: {\n // Raw HTML in the source is rendered as escaped text, never live markup.\n html(token: unknown): string {\n const text = typeof token === \"string\" ? token : ((token as { text?: string }).text ?? \"\")\n return escapeHtml(text)\n },\n },\n })\n return m\n}\n\ninterface MdToken {\n type?: string\n href?: string\n tokens?: MdToken[]\n items?: MdToken[]\n header?: Array<{ tokens?: MdToken[] }>\n rows?: Array<Array<{ tokens?: MdToken[] }>>\n}\n\n/**\n * Recursively neutralise script-bearing link/image hrefs in the lexed token tree.\n * Done as an explicit walk (not marked's `walkTokens` hook) because we render via\n * the low-level `lexer`+`parser` split, which does not run registered walkTokens.\n */\nfunction neutralizeUrls(tokens: MdToken[]): void {\n for (const t of tokens) {\n if ((t.type === \"link\" || t.type === \"image\") && typeof t.href === \"string\") {\n if (isDangerousUrl(t.href, t.type === \"image\")) t.href = \"#\"\n }\n if (t.tokens) neutralizeUrls(t.tokens)\n if (t.items) neutralizeUrls(t.items)\n if (t.header) for (const cell of t.header) if (cell.tokens) neutralizeUrls(cell.tokens)\n if (t.rows) for (const row of t.rows) for (const cell of row) if (cell.tokens) neutralizeUrls(cell.tokens)\n }\n}\n\n/** Add `data-source-line=\"N\"` to the first opening tag of a rendered block. */\nfunction tagSourceLine(html: string, line: number): string {\n return html.replace(/^(\\s*)<([a-zA-Z][\\w-]*)/, `$1<$2 data-source-line=\"${line}\"`)\n}\n\n/**\n * Render markdown to inner HTML, tagging each top-level block with its 1-based\n * source line so an annotation in the panel can map back to a plan line.\n */\nexport function renderMarkdownBody(source: string): string {\n const m = makeMarked()\n let tokens: Array<{ raw?: string }>\n try {\n tokens = m.lexer(source) as Array<{ raw?: string }>\n } catch {\n // Lexing should not fail, but never throw out of the hook path.\n return `<pre>${escapeHtml(source)}</pre>`\n }\n neutralizeUrls(tokens as MdToken[])\n let line = 1\n let out = \"\"\n for (const tok of tokens) {\n let html: string\n try {\n html = m.parser([tok] as Parameters<typeof m.parser>[0])\n } catch {\n html = \"\"\n }\n if (html.trim()) out += tagSourceLine(html, line)\n line += (tok.raw?.match(/\\n/g)?.length ?? 0)\n }\n return out || `<pre>${escapeHtml(source)}</pre>`\n}\n\n/**\n * Wrap rendered markdown in a complete, self-contained HTML document with\n * readable typography (works even before ai-or-die injects its annotation SDK).\n */\nexport function renderPlanHtml(source: string, title = \"Plan\"): string {\n return wrapArtifactDocument(renderMarkdownBody(source), title)\n}\n\nconst BASE_STYLE = ` :root {\n --bg: #0f1115; --fg: #f7f3ea; --muted: #aeb6c6; --border: #2a2f3a;\n --accent: #f4c95d; --code-bg: #171a21;\n --serif: 'Iowan Old Style', Georgia, 'Times New Roman', serif;\n --sans: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;\n --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n }\n * { box-sizing: border-box; }\n html, body { margin: 0; background: var(--bg); color: var(--fg); }\n body { font-family: var(--serif); font-size: 16px; line-height: 1.6;\n padding: 32px clamp(16px, 5vw, 56px); }\n main { max-width: 78ch; margin: 0 auto; }\n h1, h2, h3, h4 { font-family: var(--sans); line-height: 1.25; margin: 1.6em 0 0.5em; }\n h1 { font-size: 1.9em; } h2 { font-size: 1.45em; padding-bottom: 0.2em;\n border-bottom: 1px solid var(--border); } h3 { font-size: 1.2em; }\n p, li { color: var(--fg); }\n a { color: var(--accent); }\n code { font-family: var(--mono); font-size: 0.9em; background: var(--code-bg);\n padding: 0.12em 0.35em; border-radius: 5px; }\n pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px;\n padding: 12px 14px; overflow: auto; }\n pre code { background: none; padding: 0; }\n blockquote { margin: 1em 0; padding: 0.2em 1em; border-left: 3px solid var(--accent);\n color: var(--muted); }\n table { border-collapse: collapse; width: 100%; margin: 1em 0; font-family: var(--sans);\n font-size: 0.95em; }\n th, td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }\n th { background: var(--code-bg); }\n hr { border: 0; border-top: 1px solid var(--border); margin: 1.5em 0; }\n ul, ol { padding-left: 1.4em; }`\n\nconst INTERACTIVE_STYLE = `\n .aod-group { margin: 1.4em 0; padding: 14px 16px; border: 1px solid var(--border);\n border-radius: 10px; background: var(--code-bg); }\n .aod-prompt { font-family: var(--sans); font-weight: 600; margin: 0 0 0.6em; }\n .aod-options { display: flex; flex-wrap: wrap; gap: 8px; }\n .aod-multi-select .aod-options { flex-direction: column; gap: 6px; }\n .aod-action, .aod-submit { font-family: var(--sans); font-size: 0.95em; font-weight: 600;\n cursor: pointer; border: 1px solid var(--border); border-radius: 8px;\n padding: 8px 12px; background: var(--bg); color: var(--fg); }\n .aod-action:hover, .aod-submit:hover { border-color: var(--accent); }\n .aod-submit { margin-top: 10px; background: var(--accent); color: #17130a; border-color: var(--accent); }\n .aod-check { display: flex; align-items: center; gap: 8px; font-family: var(--sans); cursor: pointer; }\n .aod-steps { list-style: decimal; }\n .aod-step { margin: 0.5em 0; }\n .aod-step-actions { display: inline-flex; gap: 6px; margin-left: 8px; }`\n\n/**\n * Wrap rendered inner HTML in the self-contained document shell. `extraStyle` is\n * appended to the inline stylesheet so the interactive variant can add its own\n * rules without a second `<style>` block. Static callers pass \"\" (default), so\n * the static document is byte-identical to the pre-refactor output.\n */\nfunction wrapArtifactDocument(body: string, title: string, extraStyle = \"\"): string {\n return `<!doctype html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<title>${escapeHtml(title)}</title>\n<style>\n${BASE_STYLE}${extraStyle}\n</style>\n</head>\n<body>\n<main>\n${body}\n</main>\n</body>\n</html>\n`\n}\n\n/* -------------------------------------------------------------------------- */\n/* Interactive artifacts (contract v2.2 §4: declarative data-aod-* vocab) */\n/* -------------------------------------------------------------------------- */\n\nexport interface InteractiveOption {\n /** Stable id echoed back as `elementId` in the action event. Required. */\n elementId: string\n /** Human-visible label. */\n label: string\n /** Optional value echoed as `data-aod-value` (checkbox submits use \"true\"/\"false\"). */\n value?: string\n}\n\n/** One immediate-fire choice group: each option posts an action the instant it is clicked. */\nexport interface ChooseOneBlock {\n kind: \"choose-one\"\n /** `data-aod-group` shared by the options (marks them as one decision). */\n group: string\n prompt?: string\n /** `data-aod-action` verb for every option (default \"choose\"). */\n action?: string\n options: InteractiveOption[]\n}\n\n/** A multi-select group: checkbox toggles plus one submit that carries {group, selected}. */\nexport interface MultiSelectBlock {\n kind: \"multi-select\"\n group: string\n prompt?: string\n submitLabel?: string\n submitElementId?: string\n options: InteractiveOption[]\n}\n\nexport interface StepAction {\n /** `data-aod-action` verb (e.g. \"approve\", \"skip\"). */\n action: string\n label: string\n value?: string\n}\n\nexport interface StepItem {\n /** Stable `data-aod-id` echoed as `elementId`. */\n elementId: string\n label: string\n sourceLine?: number\n actions: StepAction[]\n}\n\n/** An ordered list of plan steps, each with its own inline action buttons. */\nexport interface StepsBlock {\n kind: \"steps\"\n steps: StepItem[]\n}\n\nexport type InteractiveBlock = ChooseOneBlock | MultiSelectBlock | StepsBlock\n\nexport interface InteractivePlanModel {\n /** Optional prose rendered above the interactive blocks (same escaping as static). */\n markdown?: string\n blocks: InteractiveBlock[]\n}\n\n/** Build a ` data-x=\"y\"` attribute string, dropping undefined values, all escaped. */\nfunction dataAttrs(pairs: Array<[string, string | undefined]>): string {\n let out = \"\"\n for (const [name, value] of pairs) {\n if (value === undefined) continue\n out += ` ${name}=\"${escapeHtml(value)}\"`\n }\n return out\n}\n\nfunction renderChooseOne(block: ChooseOneBlock): string {\n const action = block.action && block.action.trim() ? block.action : \"choose\"\n const prompt = block.prompt ? `<p class=\"aod-prompt\">${escapeHtml(block.prompt)}</p>` : \"\"\n const options = block.options\n .filter((o) => o.elementId.trim() !== \"\")\n .map((o) => {\n const attrs = dataAttrs([\n [\"data-aod-action\", action],\n [\"data-aod-group\", block.group],\n [\"data-aod-id\", o.elementId],\n [\"data-aod-value\", o.value],\n ])\n return `<button type=\"button\" class=\"aod-action\"${attrs}>${escapeHtml(o.label)}</button>`\n })\n .join(\"\\n\")\n return `<div class=\"aod-group aod-choose-one\"${dataAttrs([[\"data-aod-group\", block.group]])}>\n${prompt}<div class=\"aod-options\">\n${options}\n</div>\n</div>`\n}\n\nfunction renderMultiSelect(block: MultiSelectBlock): string {\n const prompt = block.prompt ? `<p class=\"aod-prompt\">${escapeHtml(block.prompt)}</p>` : \"\"\n const options = block.options\n .filter((o) => o.elementId.trim() !== \"\")\n .map((o) => {\n const attrs = dataAttrs([\n [\"data-aod-action\", \"check\"],\n [\"data-aod-group\", block.group],\n [\"data-aod-id\", o.elementId],\n [\"data-aod-value\", o.value],\n ])\n return `<label class=\"aod-check\"><input type=\"checkbox\"${attrs}> <span>${escapeHtml(o.label)}</span></label>`\n })\n .join(\"\\n\")\n const submitId = block.submitElementId && block.submitElementId.trim()\n ? block.submitElementId\n : `${block.group}-submit`\n const submitAttrs = dataAttrs([\n [\"data-aod-action\", \"submit\"],\n [\"data-aod-group\", block.group],\n [\"data-aod-id\", submitId],\n ])\n const submitLabel = block.submitLabel && block.submitLabel.trim() ? block.submitLabel : \"Submit\"\n return `<div class=\"aod-group aod-multi-select\"${dataAttrs([[\"data-aod-group\", block.group]])}>\n${prompt}<div class=\"aod-options\">\n${options}\n</div>\n<button type=\"button\" class=\"aod-submit\"${submitAttrs}>${escapeHtml(submitLabel)}</button>\n</div>`\n}\n\nfunction renderSteps(block: StepsBlock): string {\n const items = block.steps\n .filter((s) => s.elementId.trim() !== \"\")\n .map((s) => {\n const liAttrs = dataAttrs([\n [\"data-aod-id\", s.elementId],\n [\"data-source-line\", s.sourceLine === undefined ? undefined : String(s.sourceLine)],\n ])\n const actions = s.actions\n .map((a) => {\n const attrs = dataAttrs([\n [\"data-aod-action\", a.action],\n [\"data-aod-id\", s.elementId],\n [\"data-aod-value\", a.value],\n ])\n return `<button type=\"button\" class=\"aod-action\"${attrs}>${escapeHtml(a.label)}</button>`\n })\n .join(\"\")\n return `<li class=\"aod-step\"${liAttrs}><span class=\"aod-step-label\">${escapeHtml(s.label)}</span><span class=\"aod-step-actions\">${actions}</span></li>`\n })\n .join(\"\\n\")\n return `<ol class=\"aod-steps\">\n${items}\n</ol>`\n}\n\nfunction renderInteractiveBlock(block: InteractiveBlock): string {\n switch (block.kind) {\n case \"choose-one\":\n return renderChooseOne(block)\n case \"multi-select\":\n return renderMultiSelect(block)\n case \"steps\":\n return renderSteps(block)\n default:\n return \"\"\n }\n}\n\n/**\n * Render a typed interactive plan model into a self-contained HTML document that\n * carries the declarative `data-aod-*` action vocabulary the ai-or-die panel SDK\n * wires (contract v2.2 §4). Optional prose (`markdown`) is rendered with the SAME\n * escaping + dangerous-URL neutralization as the static path; all control\n * attributes and labels are HTML-escaped, so no author string can break out of an\n * attribute or inject live markup.\n */\nexport function renderInteractivePlanHtml(model: InteractivePlanModel, title = \"Plan\"): string {\n const prose = model.markdown && model.markdown.trim() ? renderMarkdownBody(model.markdown) : \"\"\n const blocks = model.blocks.map(renderInteractiveBlock).filter((h) => h.trim() !== \"\").join(\"\\n\")\n const body = [prose, blocks].filter((s) => s.trim() !== \"\").join(\"\\n\")\n return wrapArtifactDocument(body || `<pre>${escapeHtml(JSON.stringify(model))}</pre>`, title, INTERACTIVE_STYLE)\n}\n","/**\n * The internal `internal-artifact-open` subcommand: invoked by a spawned Claude\n * Code session's `PostToolUse` hook (matcher `ExitPlanMode`), registered into the\n * mirrored settings.json by the launcher when running inside an ai-or-die tab\n * (`AIORDIE_SESSION_ID` set). It auto-opens the just-finalized plan in the\n * ai-or-die Artifact review panel so the human reviews it WITHOUT the model\n * having to call artifact_open itself.\n *\n * Auth: AIORDIE_TOKEN is stripped from the child env, so the token can't come via\n * env or argv (argv leaks to `ps`). The launcher writes a mode-600\n * `.aiordie-artifact.json` into CLAUDE_CONFIG_DIR; this hook reads it.\n *\n * Plan: the EXACT plan for THIS session comes from the ExitPlanMode payload —\n * `tool_input.planFilePath` (per-session; never the globally-newest file in the\n * shared plans dir) with `tool_input.plan` as the markdown fallback. The plan\n * markdown is rendered to a self-contained styled HTML file (HTML is the\n * canonical artifact, lavish's model — formatted + annotatable, not raw md), and\n * THAT `.html` is opened.\n *\n * Side-effect only: never writes stdout, never throws, always exits 0. Skips\n * subagent payloads (agent_id/agent_type) like the other hooks.\n */\n\nimport { defineCommand } from \"citty\"\n\nimport { readFileSync, realpathSync, writeFileSync } from \"node:fs\"\nimport { homedir } from \"node:os\"\nimport path from \"node:path\"\n\nimport { ArtifactClient } from \"./lib/artifact/client\"\nimport { renderPlanHtml } from \"./lib/artifact/plan-html\"\nimport { isSubagentContext } from \"./lib/orchestration/stop-gate-policy\"\n\ninterface ArtifactCreds {\n baseUrl: string\n token: string\n sessionId: string\n insecureTLS: boolean\n}\n\ninterface ExitPlanPayload {\n planFilePath?: string\n planMarkdown?: string\n}\n\nfunction readStdin(): string {\n try {\n if (process.stdin.isTTY) return \"\"\n return readFileSync(0, \"utf8\")\n } catch {\n return \"\"\n }\n}\n\nfunction credsPath(): string {\n const dir = process.env.CLAUDE_CONFIG_DIR || path.join(homedir(), \".claude\")\n return path.join(dir, \".aiordie-artifact.json\")\n}\n\nfunction isSubagent(payload: unknown): boolean {\n try {\n return isSubagentContext(payload as Parameters<typeof isSubagentContext>[0])\n } catch {\n return false\n }\n}\n\n/** Pull the per-session plan path + markdown content out of the hook payload. */\nexport function parseExitPlanPayload(raw: string): ExitPlanPayload {\n try {\n const obj = JSON.parse(raw) as { tool_input?: { planFilePath?: unknown; plan?: unknown } }\n const ti = obj.tool_input ?? {}\n const planFilePath = typeof ti.planFilePath === \"string\" && ti.planFilePath.trim() ? ti.planFilePath : undefined\n const planMarkdown = typeof ti.plan === \"string\" && ti.plan.trim() ? ti.plan : undefined\n return { planFilePath, planMarkdown }\n } catch {\n return {}\n }\n}\n\nfunction readCreds(): ArtifactCreds | undefined {\n try {\n const parsed = JSON.parse(readFileSync(credsPath(), \"utf8\")) as Partial<ArtifactCreds>\n if (!parsed.baseUrl || !parsed.token || !parsed.sessionId) return undefined\n return {\n baseUrl: parsed.baseUrl,\n token: parsed.token,\n sessionId: parsed.sessionId,\n insecureTLS: parsed.insecureTLS === true,\n }\n } catch {\n return undefined\n }\n}\n\n/**\n * Resolve the plan markdown + a title, preferring the file at `planFilePath`\n * (the source of truth, may be newer than the payload's snapshot), falling back\n * to the inline `tool_input.plan` content.\n */\nfunction resolvePlanMarkdown(p: ExitPlanPayload): { markdown: string; title: string; nearPath?: string } | undefined {\n if (p.planFilePath) {\n try {\n const md = readFileSync(p.planFilePath, \"utf8\")\n if (md.trim()) return { markdown: md, title: path.basename(p.planFilePath, path.extname(p.planFilePath)), nearPath: p.planFilePath }\n } catch {\n /* fall through to inline content */\n }\n }\n if (p.planMarkdown) return { markdown: p.planMarkdown, title: \"Plan\" }\n return undefined\n}\n\n/**\n * Write the rendered HTML next to the plan (an allowed root) when we have a real\n * path, else into the plans dir under CLAUDE_CONFIG_DIR. Returns the realpath of\n * the written `.html`, or undefined on failure.\n */\nfunction writePlanHtml(html: string, nearPath: string | undefined): string | undefined {\n let target: string\n if (nearPath) {\n // `<plan>.md` -> `<plan>.aiordie.html` (or append when there is no .md ext).\n const base = nearPath.replace(/\\.(md|markdown)$/i, \"\")\n target = `${base}.aiordie.html`\n } else {\n const dir = path.join(process.env.CLAUDE_CONFIG_DIR || path.join(homedir(), \".claude\"), \"plans\")\n target = path.join(dir, `aiordie-plan-${process.pid}.html`)\n }\n try {\n writeFileSync(target, html, \"utf8\")\n try {\n return realpathSync.native(target)\n } catch {\n return target\n }\n } catch {\n return undefined\n }\n}\n\nexport const internalArtifactOpen = defineCommand({\n meta: { name: \"internal-artifact-open\", description: \"Open the finalized plan in the ai-or-die panel\" },\n async run() {\n try {\n const raw = readStdin()\n let payload: unknown\n try {\n payload = JSON.parse(raw)\n } catch {\n payload = undefined\n }\n if (isSubagent(payload)) return\n const creds = readCreds()\n if (!creds) return\n const plan = resolvePlanMarkdown(parseExitPlanPayload(raw))\n if (!plan) return\n const htmlPath = writePlanHtml(renderPlanHtml(plan.markdown, plan.title), plan.nearPath)\n if (!htmlPath) return\n const client = new ArtifactClient(creds)\n await client.open(htmlPath)\n } catch {\n /* side-effect only: never block, never throw */\n }\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAgBA,SAAS,WAAW,GAAmB;CACrC,OAAO,EACJ,QAAQ,MAAM,OAAO,CAAC,CACtB,QAAQ,MAAM,MAAM,CAAC,CACrB,QAAQ,MAAM,MAAM,CAAC,CACrB,QAAQ,MAAM,QAAQ,CAAC,CACvB,QAAQ,MAAM,OAAO;A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["../src/lib/artifact/plan-html.ts","../src/internal-artifact-open.ts"],"sourcesContent":["/**\n * Render a plan's markdown into a self-contained, styled HTML document for the\n * ai-or-die Artifact panel. HTML is the canonical review artifact (lavish's\n * model); converting here means the hands-off auto-open shows a formatted,\n * annotatable page instead of raw markdown.\n *\n * Security: the iframe ai-or-die serves this into runs with\n * `allow-scripts allow-same-origin`, so a `<script>` smuggled into the plan\n * markdown could read the per-session asset token. Two defenses:\n * 1. marked is configured to ESCAPE raw HTML tokens (render as visible text).\n * 2. `link`/`image` hrefs with script-bearing schemes (javascript:, vbscript:,\n * non-image data:) are neutralised before rendering.\n * No separate sanitizer/dep needed.\n */\nimport { Marked } from \"marked\"\n\nfunction escapeHtml(s: string): string {\n return s\n .replace(/&/g, \"&\")\n .replace(/</g, \"<\")\n .replace(/>/g, \">\")\n .replace(/\"/g, \""\")\n .replace(/'/g, \"'\")\n}\n\n/** Decode the HTML character references a browser would resolve in an attribute\n * value, so an entity-obfuscated scheme (`javascript:`, `javascript:`)\n * cannot slip past the scheme check below. Numeric refs cover any letter; the\n * small named map covers the scheme-relevant punctuation. */\nconst NAMED_REFS: Record<string, string> = {\n colon: \":\", tab: \"\\t\", newline: \"\\n\", sol: \"/\", semi: \";\", amp: \"&\", lpar: \"(\", rpar: \")\",\n}\nfunction decodeEntities(s: string): string {\n return s.replace(/&(#[xX][0-9a-fA-F]+|#[0-9]+|[a-zA-Z]+);?/g, (m, body: string) => {\n if (body[0] === \"#\") {\n const code = body[1] === \"x\" || body[1] === \"X\"\n ? Number.parseInt(body.slice(2), 16)\n : Number.parseInt(body.slice(1), 10)\n return Number.isFinite(code) && code > 0 && code <= 0x10ffff ? String.fromCodePoint(code) : m\n }\n return NAMED_REFS[body.toLowerCase()] ?? m\n })\n}\n\n/** Block script-bearing URL schemes (defense-in-depth on top of HTML escaping). */\nfunction isDangerousUrl(url: string, isImage: boolean): boolean {\n // Decode entities first (a browser resolves them in href), then drop ASCII\n // control chars + spaces (code <= 0x20) a browser ignores inside a scheme.\n const v = Array.from(decodeEntities(url)).filter((c) => c.charCodeAt(0) > 0x20).join(\"\").toLowerCase()\n if (v.startsWith(\"javascript:\") || v.startsWith(\"vbscript:\")) return true\n if (v.startsWith(\"data:\")) {\n // Allow only raster image data URIs (and only for <img>); SVG can script.\n return !(isImage && v.startsWith(\"data:image/\") && !v.startsWith(\"data:image/svg\"))\n }\n return false\n}\n\n/** A marked instance that escapes raw HTML (raw markup never becomes live). */\nfunction makeMarked(): Marked {\n const m = new Marked({ gfm: true, breaks: false })\n m.use({\n renderer: {\n // Raw HTML in the source is rendered as escaped text, never live markup.\n html(token: unknown): string {\n const text = typeof token === \"string\" ? token : ((token as { text?: string }).text ?? \"\")\n return escapeHtml(text)\n },\n },\n })\n return m\n}\n\ninterface MdToken {\n type?: string\n href?: string\n tokens?: MdToken[]\n items?: MdToken[]\n header?: Array<{ tokens?: MdToken[] }>\n rows?: Array<Array<{ tokens?: MdToken[] }>>\n}\n\n/**\n * Recursively neutralise script-bearing link/image hrefs in the lexed token tree.\n * Done as an explicit walk (not marked's `walkTokens` hook) because we render via\n * the low-level `lexer`+`parser` split, which does not run registered walkTokens.\n */\nfunction neutralizeUrls(tokens: MdToken[]): void {\n for (const t of tokens) {\n if ((t.type === \"link\" || t.type === \"image\") && typeof t.href === \"string\") {\n if (isDangerousUrl(t.href, t.type === \"image\")) t.href = \"#\"\n }\n if (t.tokens) neutralizeUrls(t.tokens)\n if (t.items) neutralizeUrls(t.items)\n if (t.header) for (const cell of t.header) if (cell.tokens) neutralizeUrls(cell.tokens)\n if (t.rows) for (const row of t.rows) for (const cell of row) if (cell.tokens) neutralizeUrls(cell.tokens)\n }\n}\n\n/** Add `data-source-line=\"N\"` to the first opening tag of a rendered block. */\nfunction tagSourceLine(html: string, line: number): string {\n return html.replace(/^(\\s*)<([a-zA-Z][\\w-]*)/, `$1<$2 data-source-line=\"${line}\"`)\n}\n\n/**\n * Render markdown to inner HTML, tagging each top-level block with its 1-based\n * source line so an annotation in the panel can map back to a plan line.\n */\nexport function renderMarkdownBody(source: string): string {\n const m = makeMarked()\n let tokens: Array<{ raw?: string }>\n try {\n tokens = m.lexer(source) as Array<{ raw?: string }>\n } catch {\n // Lexing should not fail, but never throw out of the hook path.\n return `<pre>${escapeHtml(source)}</pre>`\n }\n neutralizeUrls(tokens as MdToken[])\n let line = 1\n let out = \"\"\n for (const tok of tokens) {\n let html: string\n try {\n html = m.parser([tok] as Parameters<typeof m.parser>[0])\n } catch {\n html = \"\"\n }\n if (html.trim()) out += tagSourceLine(html, line)\n line += (tok.raw?.match(/\\n/g)?.length ?? 0)\n }\n return out || `<pre>${escapeHtml(source)}</pre>`\n}\n\n/**\n * Wrap rendered markdown in a complete, self-contained HTML document with\n * readable typography (works even before ai-or-die injects its annotation SDK).\n */\nexport function renderPlanHtml(source: string, title = \"Plan\"): string {\n return wrapArtifactDocument(renderMarkdownBody(source), title)\n}\n\nconst BASE_STYLE = ` :root {\n --bg: #0f1115; --fg: #f7f3ea; --muted: #aeb6c6; --border: #2a2f3a;\n --accent: #f4c95d; --code-bg: #171a21;\n --serif: 'Iowan Old Style', Georgia, 'Times New Roman', serif;\n --sans: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;\n --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n }\n * { box-sizing: border-box; }\n html, body { margin: 0; background: var(--bg); color: var(--fg); }\n body { font-family: var(--serif); font-size: 16px; line-height: 1.6;\n padding: 32px clamp(16px, 5vw, 56px); }\n main { max-width: 78ch; margin: 0 auto; }\n h1, h2, h3, h4 { font-family: var(--sans); line-height: 1.25; margin: 1.6em 0 0.5em; }\n h1 { font-size: 1.9em; } h2 { font-size: 1.45em; padding-bottom: 0.2em;\n border-bottom: 1px solid var(--border); } h3 { font-size: 1.2em; }\n p, li { color: var(--fg); }\n a { color: var(--accent); }\n code { font-family: var(--mono); font-size: 0.9em; background: var(--code-bg);\n padding: 0.12em 0.35em; border-radius: 5px; }\n pre { background: var(--code-bg); border: 1px solid var(--border); border-radius: 8px;\n padding: 12px 14px; overflow: auto; }\n pre code { background: none; padding: 0; }\n blockquote { margin: 1em 0; padding: 0.2em 1em; border-left: 3px solid var(--accent);\n color: var(--muted); }\n table { border-collapse: collapse; width: 100%; margin: 1em 0; font-family: var(--sans);\n font-size: 0.95em; }\n th, td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }\n th { background: var(--code-bg); }\n hr { border: 0; border-top: 1px solid var(--border); margin: 1.5em 0; }\n ul, ol { padding-left: 1.4em; }`\n\nconst INTERACTIVE_STYLE = `\n .aod-group { margin: 1.4em 0; padding: 14px 16px; border: 1px solid var(--border);\n border-radius: 10px; background: var(--code-bg); }\n .aod-prompt { font-family: var(--sans); font-weight: 600; margin: 0 0 0.6em; }\n .aod-options { display: flex; flex-wrap: wrap; gap: 8px; }\n .aod-multi-select .aod-options { flex-direction: column; gap: 6px; }\n .aod-action, .aod-submit { font-family: var(--sans); font-size: 0.95em; font-weight: 600;\n cursor: pointer; border: 1px solid var(--border); border-radius: 8px;\n padding: 8px 12px; background: var(--bg); color: var(--fg); }\n .aod-action:hover, .aod-submit:hover { border-color: var(--accent); }\n .aod-submit { margin-top: 10px; background: var(--accent); color: #17130a; border-color: var(--accent); }\n .aod-check { display: flex; align-items: center; gap: 8px; font-family: var(--sans); cursor: pointer; }\n .aod-steps { list-style: decimal; }\n .aod-step { margin: 0.5em 0; }\n .aod-step-actions { display: inline-flex; gap: 6px; margin-left: 8px; }`\n\n/**\n * Wrap rendered inner HTML in the self-contained document shell. `extraStyle` is\n * appended to the inline stylesheet so the interactive variant can add its own\n * rules without a second `<style>` block. Static callers pass \"\" (default), so\n * the static document is byte-identical to the pre-refactor output.\n */\nfunction wrapArtifactDocument(body: string, title: string, extraStyle = \"\"): string {\n return `<!doctype html>\n<html lang=\"en\">\n<head>\n<meta charset=\"utf-8\">\n<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n<title>${escapeHtml(title)}</title>\n<style>\n${BASE_STYLE}${extraStyle}\n</style>\n</head>\n<body>\n<main>\n${body}\n</main>\n</body>\n</html>\n`\n}\n\n/* -------------------------------------------------------------------------- */\n/* Interactive artifacts (contract v2.2 §4: declarative data-aod-* vocab) */\n/* -------------------------------------------------------------------------- */\n\nexport interface InteractiveOption {\n /** Stable id echoed back as `elementId` in the action event. Required. */\n elementId: string\n /** Human-visible label. */\n label: string\n /** Optional value echoed as `data-aod-value` (checkbox submits use \"true\"/\"false\"). */\n value?: string\n}\n\n/** One immediate-fire choice group: each option posts an action the instant it is clicked. */\nexport interface ChooseOneBlock {\n kind: \"choose-one\"\n /** `data-aod-group` shared by the options (marks them as one decision). */\n group: string\n prompt?: string\n /** `data-aod-action` verb for every option (default \"choose\"). */\n action?: string\n options: InteractiveOption[]\n}\n\n/** A multi-select group: checkbox toggles plus one submit that carries {group, selected}. */\nexport interface MultiSelectBlock {\n kind: \"multi-select\"\n group: string\n prompt?: string\n submitLabel?: string\n submitElementId?: string\n options: InteractiveOption[]\n}\n\nexport interface StepAction {\n /** `data-aod-action` verb (e.g. \"approve\", \"skip\"). */\n action: string\n label: string\n value?: string\n}\n\nexport interface StepItem {\n /** Stable `data-aod-id` echoed as `elementId`. */\n elementId: string\n label: string\n sourceLine?: number\n actions: StepAction[]\n}\n\n/** An ordered list of plan steps, each with its own inline action buttons. */\nexport interface StepsBlock {\n kind: \"steps\"\n steps: StepItem[]\n}\n\nexport type InteractiveBlock = ChooseOneBlock | MultiSelectBlock | StepsBlock\n\nexport interface InteractivePlanModel {\n /** Optional prose rendered above the interactive blocks (same escaping as static). */\n markdown?: string\n blocks: InteractiveBlock[]\n}\n\n/** Build a ` data-x=\"y\"` attribute string, dropping undefined values, all escaped. */\nfunction dataAttrs(pairs: Array<[string, string | undefined]>): string {\n let out = \"\"\n for (const [name, value] of pairs) {\n if (value === undefined) continue\n out += ` ${name}=\"${escapeHtml(value)}\"`\n }\n return out\n}\n\nfunction renderChooseOne(block: ChooseOneBlock): string {\n const action = block.action && block.action.trim() ? block.action : \"choose\"\n const prompt = block.prompt ? `<p class=\"aod-prompt\">${escapeHtml(block.prompt)}</p>` : \"\"\n const options = block.options\n .filter((o) => o.elementId.trim() !== \"\")\n .map((o) => {\n const attrs = dataAttrs([\n [\"data-aod-action\", action],\n [\"data-aod-group\", block.group],\n [\"data-aod-id\", o.elementId],\n [\"data-aod-value\", o.value],\n ])\n return `<button type=\"button\" class=\"aod-action\"${attrs}>${escapeHtml(o.label)}</button>`\n })\n .join(\"\\n\")\n return `<div class=\"aod-group aod-choose-one\"${dataAttrs([[\"data-aod-group\", block.group]])}>\n${prompt}<div class=\"aod-options\">\n${options}\n</div>\n</div>`\n}\n\nfunction renderMultiSelect(block: MultiSelectBlock): string {\n const prompt = block.prompt ? `<p class=\"aod-prompt\">${escapeHtml(block.prompt)}</p>` : \"\"\n const options = block.options\n .filter((o) => o.elementId.trim() !== \"\")\n .map((o) => {\n const attrs = dataAttrs([\n [\"data-aod-action\", \"check\"],\n [\"data-aod-group\", block.group],\n [\"data-aod-id\", o.elementId],\n [\"data-aod-value\", o.value],\n ])\n return `<label class=\"aod-check\"><input type=\"checkbox\"${attrs}> <span>${escapeHtml(o.label)}</span></label>`\n })\n .join(\"\\n\")\n const submitId = block.submitElementId && block.submitElementId.trim()\n ? block.submitElementId\n : `${block.group}-submit`\n const submitAttrs = dataAttrs([\n [\"data-aod-action\", \"submit\"],\n [\"data-aod-group\", block.group],\n [\"data-aod-id\", submitId],\n ])\n const submitLabel = block.submitLabel && block.submitLabel.trim() ? block.submitLabel : \"Submit\"\n return `<div class=\"aod-group aod-multi-select\"${dataAttrs([[\"data-aod-group\", block.group]])}>\n${prompt}<div class=\"aod-options\">\n${options}\n</div>\n<button type=\"button\" class=\"aod-submit\"${submitAttrs}>${escapeHtml(submitLabel)}</button>\n</div>`\n}\n\nfunction renderSteps(block: StepsBlock): string {\n const items = block.steps\n .filter((s) => s.elementId.trim() !== \"\")\n .map((s) => {\n const liAttrs = dataAttrs([\n [\"data-aod-id\", s.elementId],\n [\"data-source-line\", s.sourceLine === undefined ? undefined : String(s.sourceLine)],\n ])\n const actions = s.actions\n .map((a) => {\n const attrs = dataAttrs([\n [\"data-aod-action\", a.action],\n [\"data-aod-id\", s.elementId],\n [\"data-aod-value\", a.value],\n ])\n return `<button type=\"button\" class=\"aod-action\"${attrs}>${escapeHtml(a.label)}</button>`\n })\n .join(\"\")\n return `<li class=\"aod-step\"${liAttrs}><span class=\"aod-step-label\">${escapeHtml(s.label)}</span><span class=\"aod-step-actions\">${actions}</span></li>`\n })\n .join(\"\\n\")\n return `<ol class=\"aod-steps\">\n${items}\n</ol>`\n}\n\nfunction renderInteractiveBlock(block: InteractiveBlock): string {\n switch (block.kind) {\n case \"choose-one\":\n return renderChooseOne(block)\n case \"multi-select\":\n return renderMultiSelect(block)\n case \"steps\":\n return renderSteps(block)\n default:\n return \"\"\n }\n}\n\n/**\n * Render a typed interactive plan model into a self-contained HTML document that\n * carries the declarative `data-aod-*` action vocabulary the ai-or-die panel SDK\n * wires (contract v2.2 §4). Optional prose (`markdown`) is rendered with the SAME\n * escaping + dangerous-URL neutralization as the static path; all control\n * attributes and labels are HTML-escaped, so no author string can break out of an\n * attribute or inject live markup.\n */\nexport function renderInteractivePlanHtml(model: InteractivePlanModel, title = \"Plan\"): string {\n const prose = model.markdown && model.markdown.trim() ? renderMarkdownBody(model.markdown) : \"\"\n const blocks = model.blocks.map(renderInteractiveBlock).filter((h) => h.trim() !== \"\").join(\"\\n\")\n const body = [prose, blocks].filter((s) => s.trim() !== \"\").join(\"\\n\")\n return wrapArtifactDocument(body || `<pre>${escapeHtml(JSON.stringify(model))}</pre>`, title, INTERACTIVE_STYLE)\n}\n","/**\n * The internal `internal-artifact-open` subcommand: invoked by a spawned Claude\n * Code session's `PostToolUse` hook (matcher `ExitPlanMode`), registered into the\n * mirrored settings.json by the launcher when running inside an ai-or-die tab\n * (`AIORDIE_SESSION_ID` set). It auto-opens the just-finalized plan in the\n * ai-or-die Artifact review panel so the human reviews it WITHOUT the model\n * having to call artifact_open itself.\n *\n * Auth: AIORDIE_TOKEN is stripped from the child env, so the token can't come via\n * env or argv (argv leaks to `ps`). The launcher writes a mode-600\n * `.aiordie-artifact.json` into CLAUDE_CONFIG_DIR; this hook reads it.\n *\n * Plan: the EXACT plan for THIS session comes from the ExitPlanMode payload —\n * `tool_input.planFilePath` (per-session; never the globally-newest file in the\n * shared plans dir) with `tool_input.plan` as the markdown fallback. The plan\n * markdown is rendered to a self-contained styled HTML file (HTML is the\n * canonical artifact, lavish's model — formatted + annotatable, not raw md), and\n * THAT `.html` is opened.\n *\n * Side-effect only: never writes stdout, never throws, always exits 0. Skips\n * subagent payloads (agent_id/agent_type) like the other hooks.\n */\n\nimport { defineCommand } from \"citty\"\n\nimport { readFileSync, realpathSync, writeFileSync } from \"node:fs\"\nimport { homedir } from \"node:os\"\nimport path from \"node:path\"\n\nimport { ArtifactClient } from \"./lib/artifact/client\"\nimport { renderPlanHtml } from \"./lib/artifact/plan-html\"\nimport { isSubagentContext } from \"./lib/orchestration/stop-gate-policy\"\n\ninterface ArtifactCreds {\n baseUrl: string\n token: string\n sessionId: string\n insecureTLS: boolean\n}\n\ninterface ExitPlanPayload {\n planFilePath?: string\n planMarkdown?: string\n}\n\nfunction readStdin(): string {\n try {\n if (process.stdin.isTTY) return \"\"\n return readFileSync(0, \"utf8\")\n } catch {\n return \"\"\n }\n}\n\nfunction credsPath(): string {\n const dir = process.env.CLAUDE_CONFIG_DIR || path.join(homedir(), \".claude\")\n return path.join(dir, \".aiordie-artifact.json\")\n}\n\nfunction isSubagent(payload: unknown): boolean {\n try {\n return isSubagentContext(payload as Parameters<typeof isSubagentContext>[0])\n } catch {\n return false\n }\n}\n\n/** Pull the per-session plan path + markdown content out of the hook payload. */\nexport function parseExitPlanPayload(raw: string): ExitPlanPayload {\n try {\n const obj = JSON.parse(raw) as { tool_input?: { planFilePath?: unknown; plan?: unknown } }\n const ti = obj.tool_input ?? {}\n const planFilePath = typeof ti.planFilePath === \"string\" && ti.planFilePath.trim() ? ti.planFilePath : undefined\n const planMarkdown = typeof ti.plan === \"string\" && ti.plan.trim() ? ti.plan : undefined\n return { planFilePath, planMarkdown }\n } catch {\n return {}\n }\n}\n\nfunction readCreds(): ArtifactCreds | undefined {\n try {\n const parsed = JSON.parse(readFileSync(credsPath(), \"utf8\")) as Partial<ArtifactCreds>\n if (!parsed.baseUrl || !parsed.token || !parsed.sessionId) return undefined\n return {\n baseUrl: parsed.baseUrl,\n token: parsed.token,\n sessionId: parsed.sessionId,\n insecureTLS: parsed.insecureTLS === true,\n }\n } catch {\n return undefined\n }\n}\n\n/**\n * Resolve the plan markdown + a title, preferring the file at `planFilePath`\n * (the source of truth, may be newer than the payload's snapshot), falling back\n * to the inline `tool_input.plan` content.\n */\nfunction resolvePlanMarkdown(p: ExitPlanPayload): { markdown: string; title: string; nearPath?: string } | undefined {\n if (p.planFilePath) {\n try {\n const md = readFileSync(p.planFilePath, \"utf8\")\n if (md.trim()) return { markdown: md, title: path.basename(p.planFilePath, path.extname(p.planFilePath)), nearPath: p.planFilePath }\n } catch {\n /* fall through to inline content */\n }\n }\n if (p.planMarkdown) return { markdown: p.planMarkdown, title: \"Plan\" }\n return undefined\n}\n\n/**\n * Write the rendered HTML next to the plan (an allowed root) when we have a real\n * path, else into the plans dir under CLAUDE_CONFIG_DIR. Returns the realpath of\n * the written `.html`, or undefined on failure.\n */\nfunction writePlanHtml(html: string, nearPath: string | undefined): string | undefined {\n let target: string\n if (nearPath) {\n // `<plan>.md` -> `<plan>.aiordie.html` (or append when there is no .md ext).\n const base = nearPath.replace(/\\.(md|markdown)$/i, \"\")\n target = `${base}.aiordie.html`\n } else {\n const dir = path.join(process.env.CLAUDE_CONFIG_DIR || path.join(homedir(), \".claude\"), \"plans\")\n target = path.join(dir, `aiordie-plan-${process.pid}.html`)\n }\n try {\n writeFileSync(target, html, \"utf8\")\n try {\n return realpathSync.native(target)\n } catch {\n return target\n }\n } catch {\n return undefined\n }\n}\n\nexport const internalArtifactOpen = defineCommand({\n meta: { name: \"internal-artifact-open\", description: \"Open the finalized plan in the ai-or-die panel\" },\n async run() {\n try {\n const raw = readStdin()\n let payload: unknown\n try {\n payload = JSON.parse(raw)\n } catch {\n payload = undefined\n }\n if (isSubagent(payload)) return\n const creds = readCreds()\n if (!creds) return\n const plan = resolvePlanMarkdown(parseExitPlanPayload(raw))\n if (!plan) return\n const htmlPath = writePlanHtml(renderPlanHtml(plan.markdown, plan.title), plan.nearPath)\n if (!htmlPath) return\n const client = new ArtifactClient(creds)\n await client.open(htmlPath)\n } catch {\n /* side-effect only: never block, never throw */\n }\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAgBA,SAAS,WAAW,GAAmB;CACrC,OAAO,EACJ,QAAQ,MAAM,OAAO,CAAC,CACtB,QAAQ,MAAM,MAAM,CAAC,CACrB,QAAQ,MAAM,MAAM,CAAC,CACrB,QAAQ,MAAM,QAAQ,CAAC,CACvB,QAAQ,MAAM,OAAO;AAC1B;;;;;AAMA,MAAM,aAAqC;CACzC,OAAO;CAAK,KAAK;CAAM,SAAS;CAAM,KAAK;CAAK,MAAM;CAAK,KAAK;CAAK,MAAM;CAAK,MAAM;AACxF;AACA,SAAS,eAAe,GAAmB;CACzC,OAAO,EAAE,QAAQ,8CAA8C,GAAG,SAAiB;EACjF,IAAI,KAAK,OAAO,KAAK;GACnB,MAAM,OAAO,KAAK,OAAO,OAAO,KAAK,OAAO,MACxC,OAAO,SAAS,KAAK,MAAM,CAAC,GAAG,EAAE,IACjC,OAAO,SAAS,KAAK,MAAM,CAAC,GAAG,EAAE;GACrC,OAAO,OAAO,SAAS,IAAI,KAAK,OAAO,KAAK,QAAQ,UAAW,OAAO,cAAc,IAAI,IAAI;EAC9F;EACA,OAAO,WAAW,KAAK,YAAY,MAAM;CAC3C,CAAC;AACH;;AAGA,SAAS,eAAe,KAAa,SAA2B;CAG9D,MAAM,IAAI,MAAM,KA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N,OAAO;EACT;CACF,QAAQ;EACN;CACF;AACF;AAEA,MAAa,uBAAuB,cAAc;CAChD,MAAM;EAAE,MAAM;EAA0B,aAAa;CAAiD;CACtG,MAAM,MAAM;EACV,IAAI;GACF,MAAM,MAAM,UAAU;GACtB,IAAI;GACJ,IAAI;IACF,UAAU,KAAK,MAAM,GAAG;GAC1B,QAAQ;IACN,UAAU,KAAA;GACZ;GACA,IAAI,WAAW,OAAO,GAAG;GACzB,MAAM,QAAQ,UAAU;GACxB,IAAI,CAAC,OAAO;GACZ,MAAM,OAAO,oBAAoB,qBAAqB,GAAG,CAAC;GAC1D,IAAI,CAAC,MAAM;GACX,MAAM,WAAW,cAAc,eAAe,KAAK,UAAU,KAAK,KAAK,GAAG,KAAK,QAAQ;GACvF,IAAI,CAAC,UAAU;GAEf,MAAM,IADa,eAAe,KACvB,CAAC,CAAC,KAAK,QAAQ;EAC5B,QAAQ,CAER;CACF;AACF,CAAC"}
|
package/dist/{internal-fast-dispatch-guard-7UiD_vM5.js → internal-fast-dispatch-guard-DRsZJ-Rg.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as FAST_PROFILE_DELEGATION_GRAPH, t as BALANCED_PROFILE_DELEGATION_GRAPH, v as FAST_PROFILE_NATIVE_AGENT_NAMES } from "./balanced-profile-contract-
|
|
1
|
+
import { g as FAST_PROFILE_DELEGATION_GRAPH, t as BALANCED_PROFILE_DELEGATION_GRAPH, v as FAST_PROFILE_NATIVE_AGENT_NAMES } from "./balanced-profile-contract-XiIj4O1U.js";
|
|
2
2
|
import { t as buildSelfCommand } from "./self-invocation-DIUyoRgL.js";
|
|
3
3
|
import { defineCommand } from "citty";
|
|
4
4
|
import { readFileSync } from "node:fs";
|
|
@@ -266,4 +266,4 @@ function buildFastDispatchGuardHookCommand(invocation, opts) {
|
|
|
266
266
|
//#endregion
|
|
267
267
|
export { internalFastDispatchGuard as n, FAST_DISPATCH_TOOL_MATCHER as r, buildFastDispatchGuardHookCommand as t };
|
|
268
268
|
|
|
269
|
-
//# sourceMappingURL=internal-fast-dispatch-guard-
|
|
269
|
+
//# sourceMappingURL=internal-fast-dispatch-guard-DRsZJ-Rg.js.map
|