github-router 0.3.297 → 0.3.303

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.
Files changed (104) hide show
  1. package/dist/{attribution-settings-B70GmZ68.js → attribution-settings-dta8MTnd.js} +322 -95
  2. package/dist/attribution-settings-dta8MTnd.js.map +1 -0
  3. package/dist/{auth-CluG5e-l.js → auth-CpjOjoUG.js} +4 -3
  4. package/dist/{auth-CluG5e-l.js.map → auth-CpjOjoUG.js.map} +1 -1
  5. package/dist/browser-ext/manifest.json +1 -1
  6. package/dist/{check-usage-iOzfnKJe.js → check-usage-BsN3S4Fu.js} +4 -4
  7. package/dist/{check-usage-iOzfnKJe.js.map → check-usage-BsN3S4Fu.js.map} +1 -1
  8. package/dist/{claude-DMMfvfns.js → claude-kr-Augld.js} +169 -170
  9. package/dist/claude-kr-Augld.js.map +1 -0
  10. package/dist/{codex-DVOyVv2B.js → codex-B1qnVlzG.js} +6 -5
  11. package/dist/{codex-DVOyVv2B.js.map → codex-B1qnVlzG.js.map} +1 -1
  12. package/dist/{debug-DsEwleGg.js → debug-BXRPyeqO.js} +2 -2
  13. package/dist/{debug-DsEwleGg.js.map → debug-BXRPyeqO.js.map} +1 -1
  14. package/dist/engine-B3w1TDgR.js +2 -0
  15. package/dist/{fast-profile-contract-K3P58nj3.js → fast-profile-contract-B6xn-Rzo.js} +26 -23
  16. package/dist/fast-profile-contract-B6xn-Rzo.js.map +1 -0
  17. package/dist/{gate-discovery-G6PAG61j.js → gate-discovery-DOIm3XHF.js} +5 -5
  18. package/dist/{gate-discovery-G6PAG61j.js.map → gate-discovery-DOIm3XHF.js.map} +1 -1
  19. package/dist/{get-copilot-usage-B7Z4XVWj.js → get-copilot-usage-ByjQqhdi.js} +3 -2
  20. package/dist/{get-copilot-usage-B7Z4XVWj.js.map → get-copilot-usage-ByjQqhdi.js.map} +1 -1
  21. package/dist/hooks.mjs +393 -40
  22. package/dist/hooks.sha256 +1 -1
  23. package/dist/{internal-artifact-open-D6tKMg8v.js → internal-artifact-open-DRSxShAW.js} +2 -2
  24. package/dist/{internal-artifact-open-D6tKMg8v.js.map → internal-artifact-open-DRSxShAW.js.map} +1 -1
  25. package/dist/{internal-fast-dispatch-guard-Bkr_iGOu.js → internal-fast-dispatch-guard-BhpZ6LvO.js} +72 -16
  26. package/dist/internal-fast-dispatch-guard-BhpZ6LvO.js.map +1 -0
  27. package/dist/{internal-fast-dispatch-guard-N-RaLrOn.js → internal-fast-dispatch-guard-C6BNoOnn.js} +1 -1
  28. package/dist/{internal-first-mate-guard-C9BV7J4U.js → internal-first-mate-guard-Bcb5JwiO.js} +3 -3
  29. package/dist/{internal-first-mate-guard-C9BV7J4U.js.map → internal-first-mate-guard-Bcb5JwiO.js.map} +1 -1
  30. package/dist/{internal-first-mate-guard-WJApyc8j.js → internal-first-mate-guard-Brh_uois.js} +1 -1
  31. package/dist/internal-max-dispatch-guard-DhAr8N_o.js +215 -0
  32. package/dist/internal-max-dispatch-guard-DhAr8N_o.js.map +1 -0
  33. package/dist/internal-max-dispatch-guard-k52H-PdC.js +2 -0
  34. package/dist/{internal-plan-review-t3PuNfuL.js → internal-plan-review-DVY-iV2x.js} +3 -3
  35. package/dist/{internal-plan-review-t3PuNfuL.js.map → internal-plan-review-DVY-iV2x.js.map} +1 -1
  36. package/dist/{internal-prompt-submit-C3KovHQG.js → internal-prompt-submit-BTqRn4FW.js} +4 -4
  37. package/dist/{internal-prompt-submit-C3KovHQG.js.map → internal-prompt-submit-BTqRn4FW.js.map} +1 -1
  38. package/dist/{internal-session-bind-d2uoja8I.js → internal-session-bind-YfH656lt.js} +2 -2
  39. package/dist/{internal-session-bind-d2uoja8I.js.map → internal-session-bind-YfH656lt.js.map} +1 -1
  40. package/dist/{internal-stop-hook-BjzrF1zd.js → internal-stop-hook-CWffknT2.js} +5 -5
  41. package/dist/{internal-stop-hook-BjzrF1zd.js.map → internal-stop-hook-CWffknT2.js.map} +1 -1
  42. package/dist/{internal-stop-review-YtDUGXpX.js → internal-stop-review-B8MmEyQ1.js} +2 -2
  43. package/dist/{internal-stop-review-YtDUGXpX.js.map → internal-stop-review-B8MmEyQ1.js.map} +1 -1
  44. package/dist/{internal-worker-guard-CdkeS9PN.js → internal-worker-guard-Dr6W83TC.js} +2 -2
  45. package/dist/{internal-worker-guard-CdkeS9PN.js.map → internal-worker-guard-Dr6W83TC.js.map} +1 -1
  46. package/dist/{internal-workspace-header-tuBXJV22.js → internal-workspace-header-Cep0WSIb.js} +2 -2
  47. package/dist/{internal-workspace-header-tuBXJV22.js.map → internal-workspace-header-Cep0WSIb.js.map} +1 -1
  48. package/dist/lifecycle-4TZrJuAa.js +2 -0
  49. package/dist/{lifecycle-CM9eTzvk.js → lifecycle-CmPJ6e_6.js} +2 -2
  50. package/dist/{lifecycle-CM9eTzvk.js.map → lifecycle-CmPJ6e_6.js.map} +1 -1
  51. package/dist/{lifecycle-Bg6doY3-.js → lifecycle-DgsJ_8Am.js} +2 -2
  52. package/dist/{lifecycle-Bg6doY3-.js.map → lifecycle-DgsJ_8Am.js.map} +1 -1
  53. package/dist/lifecycle-O91Vzzb-.js +2 -0
  54. package/dist/main.js +19 -18
  55. package/dist/main.js.map +1 -1
  56. package/dist/max-profile-contract-Ct62mtAR.js +276 -0
  57. package/dist/max-profile-contract-Ct62mtAR.js.map +1 -0
  58. package/dist/{mcp-workspace-header-dERl2YTT.js → mcp-workspace-header-NzFD0Wgd.js} +2 -2
  59. package/dist/{mcp-workspace-header-dERl2YTT.js.map → mcp-workspace-header-NzFD0Wgd.js.map} +1 -1
  60. package/dist/{models-DZ4hYsR7.js → models-1KwEUgzd.js} +3 -3
  61. package/dist/{models-DZ4hYsR7.js.map → models-1KwEUgzd.js.map} +1 -1
  62. package/dist/{orchestration-BiGCEwbH.js → orchestration-CYyp9w-t.js} +2 -2
  63. package/dist/{orchestration-BiGCEwbH.js.map → orchestration-CYyp9w-t.js.map} +1 -1
  64. package/dist/paths-DDAiPVto.js +2 -0
  65. package/dist/{paths-Ci485qSJ.js → paths-IcZW8gZx.js} +4 -4
  66. package/dist/{paths-Ci485qSJ.js.map → paths-IcZW8gZx.js.map} +1 -1
  67. package/dist/{peer-mcp-personas-ce6_YMnX.js → peer-mcp-personas-BU5dNLxQ.js} +737 -459
  68. package/dist/peer-mcp-personas-BU5dNLxQ.js.map +1 -0
  69. package/dist/{plan-review-hook-DuW0pSoM.js → plan-review-hook-szSNt6uU.js} +3 -3
  70. package/dist/{plan-review-hook-DuW0pSoM.js.map → plan-review-hook-szSNt6uU.js.map} +1 -1
  71. package/dist/{prompt-submit-hook-IMl7ssfr.js → prompt-submit-hook-ZUxo_jEl.js} +3 -3
  72. package/dist/{prompt-submit-hook-IMl7ssfr.js.map → prompt-submit-hook-ZUxo_jEl.js.map} +1 -1
  73. package/dist/{provision-BhCtm3md.js → provision-qNJgF5XD.js} +4 -4
  74. package/dist/{provision-BhCtm3md.js.map → provision-qNJgF5XD.js.map} +1 -1
  75. package/dist/{self-invocation-DAB_od0C.js → self-invocation-BJWbA8ka.js} +2 -2
  76. package/dist/{self-invocation-DAB_od0C.js.map → self-invocation-BJWbA8ka.js.map} +1 -1
  77. package/dist/{serve-Blj_dRSr.js → serve-T64kVeQN.js} +13 -12
  78. package/dist/{serve-Blj_dRSr.js.map → serve-T64kVeQN.js.map} +1 -1
  79. package/dist/{server-setup-DhG3YZPj.js → server-setup-C_LAE8NI.js} +222 -40
  80. package/dist/server-setup-C_LAE8NI.js.map +1 -0
  81. package/dist/{start-8QaqICtd.js → start-DHRToEyb.js} +3 -3
  82. package/dist/{start-8QaqICtd.js.map → start-DHRToEyb.js.map} +1 -1
  83. package/dist/state-B8adscCv.js +51 -0
  84. package/dist/state-B8adscCv.js.map +1 -0
  85. package/dist/{stop-gate-hook-DQnh_KfI.js → stop-gate-hook-CJOk28zd.js} +3 -3
  86. package/dist/{stop-gate-hook-DQnh_KfI.js.map → stop-gate-hook-CJOk28zd.js.map} +1 -1
  87. package/dist/{stop-gate-policy-DMr3KVmw.js → stop-gate-policy-zhzRIj6G.js} +2 -2
  88. package/dist/{stop-gate-policy-DMr3KVmw.js.map → stop-gate-policy-zhzRIj6G.js.map} +1 -1
  89. package/dist/{token-BtJhjXXu.js → token-CbuFyx-B.js} +4 -50
  90. package/dist/token-CbuFyx-B.js.map +1 -0
  91. package/dist/{worker-dispatch-BEHkTbnH.js → worker-dispatch-DgP5yT26.js} +2 -2
  92. package/dist/{worker-dispatch-BEHkTbnH.js.map → worker-dispatch-DgP5yT26.js.map} +1 -1
  93. package/package.json +1 -1
  94. package/dist/attribution-settings-B70GmZ68.js.map +0 -1
  95. package/dist/claude-DMMfvfns.js.map +0 -1
  96. package/dist/engine-BkGRuUNs.js +0 -2
  97. package/dist/fast-profile-contract-K3P58nj3.js.map +0 -1
  98. package/dist/internal-fast-dispatch-guard-Bkr_iGOu.js.map +0 -1
  99. package/dist/lifecycle-CGLt1cJQ.js +0 -2
  100. package/dist/lifecycle-DoUwpVDB.js +0 -2
  101. package/dist/paths-GD7bgGGy.js +0 -2
  102. package/dist/peer-mcp-personas-ce6_YMnX.js.map +0 -1
  103. package/dist/server-setup-DhG3YZPj.js.map +0 -1
  104. package/dist/token-BtJhjXXu.js.map +0 -1
@@ -1,10 +1,11 @@
1
- import { Ft as LUNA_IMPLEMENTER_ALIAS_ID, Lt as LUNA_SCOUT_ALIAS_ID, Mt as FAST_CRITIC_ALIAS_ID, Rn as oneMContextDisabled, _n as CONDENSED_OPERATING_SEQUENCE, a as buildAgentPrompt, l as personasFor, n as MCP_GROUPS, t as GROUP_META, vn as DEFINITION_OF_GREATNESS, zn as withOneMSuffix } from "./peer-mcp-personas-ce6_YMnX.js";
2
- import { a as isUnderClaudeConfigMirror, d as writeRuntimeFileSecure, t as PATHS } from "./paths-Ci485qSJ.js";
3
- import { o as FAST_PROFILE_NATIVE_AGENT_NAMES } from "./fast-profile-contract-K3P58nj3.js";
4
- import "./self-invocation-DAB_od0C.js";
5
- import { a as STRIPPED_AUTH_ROUTING_ENV_KEYS, n as buildCodexProviderConfigFlags } from "./provision-BhCtm3md.js";
6
- import { n as buildWorkspaceHeaderHelperCommand } from "./mcp-workspace-header-dERl2YTT.js";
7
- import { a as dispatcherAgentName, c as dispatcherTools, n as activeDispatchModes, o as dispatcherDescription, s as dispatcherPrompt } from "./worker-dispatch-BEHkTbnH.js";
1
+ import { Cn as withOneMSuffix, On as LUNA_SCOUT_ALIAS_ID, Sn as oneMContextDisabled, a as buildAgentPrompt, l as maxPersonasFor, n as MCP_GROUPS, nn as DEFINITION_OF_GREATNESS, t as GROUP_META, tn as CONDENSED_OPERATING_SEQUENCE, u as personasFor } from "./peer-mcp-personas-BU5dNLxQ.js";
2
+ import { a as isUnderClaudeConfigMirror, d as writeRuntimeFileSecure, t as PATHS } from "./paths-IcZW8gZx.js";
3
+ import { a as FAST_PROFILE_MODELS, c as FAST_PROFILE_NATIVE_MODELS, o as FAST_PROFILE_NATIVE_AGENT_NAMES, s as FAST_PROFILE_NATIVE_EFFORTS } from "./fast-profile-contract-B6xn-Rzo.js";
4
+ import { a as MAX_PROFILE_NATIVE_AGENT_NAMES, i as MAX_PROFILE_MODELS, o as MAX_PROFILE_NATIVE_EFFORTS, s as MAX_PROFILE_NATIVE_MODELS } from "./max-profile-contract-Ct62mtAR.js";
5
+ import "./self-invocation-BJWbA8ka.js";
6
+ import { a as STRIPPED_AUTH_ROUTING_ENV_KEYS, n as buildCodexProviderConfigFlags } from "./provision-qNJgF5XD.js";
7
+ import { n as buildWorkspaceHeaderHelperCommand } from "./mcp-workspace-header-NzFD0Wgd.js";
8
+ import { a as dispatcherAgentName, c as dispatcherTools, n as activeDispatchModes, o as dispatcherDescription, s as dispatcherPrompt } from "./worker-dispatch-DgP5yT26.js";
8
9
  import consola from "consola";
9
10
  import path from "node:path";
10
11
  import { randomBytes } from "node:crypto";
@@ -272,89 +273,196 @@ function decorateGuaranteedOneM(id) {
272
273
  if (oneMContextDisabled() || /\[1m\]$/i.test(id)) return id;
273
274
  return `${id}[1m]`;
274
275
  }
276
+ /** Build the literal `-m max` native roster. Max shadows the client built-ins
277
+ * and every emitted role carries an explicit model and effort. */
278
+ function buildMaxProfileAgentDefinitions(opts) {
279
+ const modelFor = (value, fallback) => nonEmptyModel(value) ?? fallback;
280
+ const exploreModel = modelFor(opts.maxExploreModel, MAX_PROFILE_NATIVE_MODELS.Explore);
281
+ const planModel = modelFor(opts.maxPlanModel, MAX_PROFILE_NATIVE_MODELS.Plan);
282
+ const generalModel = modelFor(opts.maxGeneralPurposeModel, MAX_PROFILE_NATIVE_MODELS["general-purpose"]);
283
+ const implementerModel = modelFor(opts.maxImplementerModel, MAX_PROFILE_NATIVE_MODELS.implementer);
284
+ const reviewerModel = modelFor(opts.maxReviewerModel, MAX_PROFILE_NATIVE_MODELS.reviewer);
285
+ const brainstormModel = modelFor(opts.maxBrainstormModel, modelFor(opts.maxGrokModel, modelFor(opts.maxGeminiModel, MAX_PROFILE_NATIVE_MODELS.brainstorm)));
286
+ const peersKey = peersKeyOf(opts.groupKeys);
287
+ const searchKey = opts.groupKeys.search ?? GROUP_META.search.preferredKey;
288
+ const searchMcpServers = opts.serverUrl ? { [searchKey]: httpEntryFor(opts.serverUrl, "search", opts.nonce, opts.workspaceHeaderCmd) } : void 0;
289
+ const peersMcpServers = opts.serverUrl ? { [peersKey]: httpEntryFor(opts.serverUrl, "peers", opts.nonce, opts.workspaceHeaderCmd) } : void 0;
290
+ const oneM = (model) => model === MAX_PROFILE_MODELS.grok ? model : decorateGuaranteedOneM(model);
291
+ const effort = (name) => MAX_PROFILE_NATIVE_EFFORTS[name];
292
+ const base = (name, model, roleEffort) => ({
293
+ description: `Max-profile ${name} subagent running ${model}. This model is the deliberate default for the role; use it first and override only after a concrete failure or task-model mismatch. Max dispatch strips Claude Code's required built-in model placeholder so the roster model remains authoritative; clients that can send catalog ids may override only to Luna, Gemini 3.7 Flash, or Grok 4.6.`,
294
+ prompt: `You are the max-profile ${name} subagent. Work from the supplied brief, verify against the actual repository, and return concrete evidence with file:line references. You do not have Advisor. Do not spawn further agents.`,
295
+ model: oneM(model),
296
+ effort: roleEffort
297
+ });
298
+ const researchTools = [
299
+ "Read",
300
+ "Grep",
301
+ "Glob",
302
+ "Bash",
303
+ "WebFetch",
304
+ "WebSearch",
305
+ `mcp__${searchKey}__*`
306
+ ];
307
+ const peerList = (opts.maxPersonaNames ?? maxPersonasFor({
308
+ solModel: opts.maxPeerModels?.sol,
309
+ lunaModel: opts.maxPeerModels?.luna,
310
+ opusModel: opts.maxPeerModels?.opus,
311
+ geminiModel: opts.maxPeerModels?.gemini ?? opts.maxGeminiModel,
312
+ grokModel: opts.maxPeerModels?.grok ?? opts.maxGrokModel
313
+ }).map((persona) => persona.toolNameHttp)).map((name) => `\`${name}\``).join(", ");
314
+ const out = {
315
+ Explore: {
316
+ ...base("Explore", exploreModel, opts.maxExploreEffort ?? effort("Explore")),
317
+ description: `Max-profile read-only exploration subagent running ${exploreModel}. Best suited to broad, multi-file discovery that should return conclusions and file:line evidence without filling the lead's context.`,
318
+ prompt: "Role: read-only repository exploration. Answer the supplied question with a concise evidence packet: conclusions, load-bearing file:line citations, relevant commands or sources checked, and explicit gaps. The caller retains planning and implementation. " + readOnlyToolSteer(),
319
+ tools: researchTools,
320
+ ...searchMcpServers ? { mcpServers: searchMcpServers } : {}
321
+ },
322
+ Plan: {
323
+ ...base("Plan", planModel, opts.maxPlanEffort ?? effort("Plan")),
324
+ description: `Max-profile plan consultant running ${planModel} at high effort. Best suited to non-trivial changes where sequencing, interfaces, migration risk, or explicit acceptance criteria benefit from a separate planning view.`,
325
+ prompt: "Role: implementation planning. Given the goal, constraints, and available evidence, return a coherent plan with affected files or symbols, important invariants and risks, acceptance criteria, and useful verification. Surface assumptions or missing decisions; the lead owns plan acceptance and execution. " + readOnlyToolSteer(),
326
+ tools: researchTools,
327
+ ...searchMcpServers ? { mcpServers: searchMcpServers } : {}
328
+ },
329
+ "general-purpose": {
330
+ ...base("general-purpose", generalModel, opts.maxGeneralPurposeEffort ?? effort("general-purpose")),
331
+ description: `Max-profile general-purpose execution subagent running ${generalModel}. Best suited to mixed or unusual work that does not fit the narrower discovery, planning, implementation, review, or ideation roles.`,
332
+ prompt: "Role: catch-all execution for the supplied bounded task. Deliver the requested outcome within its stated scope and return the files or artifacts changed, verification evidence, and unresolved risks. The lead owns integration and final decisions. " + fileToolSteer("builds, tests, and git"),
333
+ ...searchMcpServers ? { mcpServers: searchMcpServers } : {}
334
+ },
335
+ implementer: {
336
+ ...base("implementer", implementerModel, opts.maxImplementerEffort ?? effort("implementer")),
337
+ description: `Max-profile implementation subagent running ${implementerModel} at high effort. Best suited to a bounded coding change whose desired outcome and constraints are known but whose implementation still needs judgment.`,
338
+ prompt: "Role: coding implementation for a settled desired outcome. Make a coherent, scoped change consistent with repository conventions and acceptance criteria. Return the files changed, observable behavior, checks and results, and unresolved risks; surface material ambiguity rather than silently deciding product or architecture questions. " + fileToolSteer("builds, tests, and git"),
339
+ ...searchMcpServers ? { mcpServers: searchMcpServers } : {}
340
+ },
341
+ reviewer: {
342
+ ...base("reviewer", reviewerModel, opts.maxReviewerEffort ?? effort("reviewer")),
343
+ description: `Max-profile repository-aware verifier running ${reviewerModel}. Best suited to assessing an implementation or reproducing a failure when code execution and surrounding repository context matter.`,
344
+ prompt: "Role: independent repository-aware verification. Assess the supplied artifact against its intent and the actual repository or runtime state. Return verified or clearly plausible findings, severity, file:line evidence, concrete failure scenarios, checks run and results, and a go/no-go; distinguish no findings from checks not run. The lead owns remediation and approval. " + fileToolSteer("builds, tests, and reproductions"),
345
+ tools: researchTools,
346
+ ...searchMcpServers ? { mcpServers: searchMcpServers } : {}
347
+ },
348
+ brainstorm: {
349
+ ...base("brainstorm", brainstormModel, opts.maxBrainstormEffort ?? effort("brainstorm")),
350
+ description: `Max-profile divergent-options subagent running ${brainstormModel}. Best suited to an open decision where materially different repository-feasible approaches remain plausible.`,
351
+ prompt: "Role: divergent option generation. Return materially distinct, repository-feasible alternatives with trade-offs, assumptions, failure modes, and evidence that would discriminate among them. A recommendation is useful when the available evidence supports one; the lead owns the decision and planning. " + readOnlyToolSteer(),
352
+ tools: researchTools,
353
+ ...searchMcpServers ? { mcpServers: searchMcpServers } : {}
354
+ },
355
+ "peer-review-coordinator": {
356
+ description: `Max-profile peer-review coordinator running ${MAX_PROFILE_MODELS.luna} at maximum effort. Best suited to consequential plans or diffs where several independent, cross-family lenses are likely to add value beyond one review.`,
357
+ prompt: `Role: synthesize independent fresh-context review of the supplied artifact and constraints. Available peers: ${peerList || "(none)"}. Select a risk-proportionate set with distinct useful lenses, preserving independence and avoiding redundant same-model calls unless their scopes differ. Return deduplicated, severity-ranked findings with sources, file:line evidence where applicable, concrete failure scenarios, disagreements, confidence, and evidence gaps. Peer output is advisory; the lead owns go/no-go and remediation.`,
358
+ model: oneM(MAX_PROFILE_MODELS.luna),
359
+ effort: opts.maxCoordinatorEffort ?? effort("peer-review-coordinator"),
360
+ tools: [`mcp__${peersKey}__*`],
361
+ ...peersMcpServers ? { mcpServers: peersMcpServers } : {}
362
+ }
363
+ };
364
+ if (opts.browseAvailable && opts.groupKeys.workers) {
365
+ const workersKey = workersKeyOf(opts.groupKeys);
366
+ out["worker-browse"] = {
367
+ description: dispatcherDescription("browse"),
368
+ prompt: dispatcherPrompt("browse", workersKey),
369
+ model: oneM(MAX_PROFILE_MODELS.luna),
370
+ effort: "high",
371
+ tools: dispatcherTools("browse", workersKey),
372
+ ...opts.serverUrl ? { mcpServers: { [workersKey]: httpEntryFor(opts.serverUrl, "workers", opts.nonce, opts.workspaceHeaderCmd) } } : {}
373
+ };
374
+ }
375
+ const roster = opts.nativeRoster == null ? new Set(MAX_PROFILE_NATIVE_AGENT_NAMES) : opts.nativeRoster instanceof Set ? opts.nativeRoster : new Set(opts.nativeRoster);
376
+ for (const name of Object.keys(out)) if (name !== "worker-browse" && !roster.has(name)) delete out[name];
377
+ return out;
378
+ }
275
379
  /** Build the literal `-m fast` native roster. This is intentionally separate
276
380
  * from the standard definitions: the names overlap, but their role bodies,
277
381
  * fixed model assignments, and efforts are profile contracts. */
278
382
  function buildFastProfileAgentDefinitions(opts) {
279
- const scoutModel = nonEmptyModel(opts.scoutModel);
280
- const implementerModel = nonEmptyModel(opts.nativeSubagentModel);
281
- const reviewerModel = nonEmptyModel(opts.reviewerModel);
282
- const plannerModel = nonEmptyModel(opts.plannerModel);
283
- const criticModel = nonEmptyModel(opts.criticModel);
284
- if (!scoutModel || !implementerModel || !reviewerModel || !plannerModel || !criticModel) throw new Error("fast profile requires resolved Explore, implementer, reviewer, planner, and critic models");
383
+ const modelFor = (value, fallback) => nonEmptyModel(value) ?? fallback;
384
+ const exploreModel = modelFor(opts.fastExploreModel, FAST_PROFILE_NATIVE_MODELS.Explore);
385
+ const planModel = modelFor(opts.fastPlanModel, FAST_PROFILE_NATIVE_MODELS.Plan);
386
+ const generalModel = modelFor(opts.fastGeneralPurposeModel, FAST_PROFILE_NATIVE_MODELS["general-purpose"]);
387
+ const implementerModel = modelFor(opts.fastImplementerModel, FAST_PROFILE_NATIVE_MODELS.implementer);
388
+ const reviewerModel = modelFor(opts.fastReviewerModel, FAST_PROFILE_NATIVE_MODELS.reviewer);
285
389
  const searchKey = opts.groupKeys.search ?? GROUP_META.search.preferredKey;
286
390
  const peersKey = peersKeyOf(opts.groupKeys);
287
- const searchMcp = opts.serverUrl ? { mcpServers: { [searchKey]: httpEntryFor(opts.serverUrl, "search", opts.nonce, opts.workspaceHeaderCmd) } } : {};
288
- const peersMcp = opts.serverUrl && opts.groupKeys.peers ? { mcpServers: { [peersKey]: httpEntryFor(opts.serverUrl, "peers", opts.nonce, opts.workspaceHeaderCmd) } } : {};
391
+ const searchMcpServers = opts.serverUrl ? { [searchKey]: httpEntryFor(opts.serverUrl, "search", opts.nonce, opts.workspaceHeaderCmd) } : void 0;
392
+ const peersMcpServers = opts.serverUrl && opts.groupKeys.peers ? { [peersKey]: httpEntryFor(opts.serverUrl, "peers", opts.nonce, opts.workspaceHeaderCmd) } : void 0;
289
393
  const oracleTool = opts.groupKeys.peers ? `mcp__${peersKey}__oracle` : void 0;
290
394
  const readSearchTools = [
291
395
  "Read",
292
396
  "Grep",
293
397
  "Glob",
294
- "Bash"
295
- ];
296
- const scoutTools = [...readSearchTools, `mcp__${searchKey}__*`];
297
- const reviewerTools = [...scoutTools, ...oracleTool ? [oracleTool] : []];
298
- const plannerTools = [
299
- ...readSearchTools,
398
+ "Bash",
300
399
  "WebFetch",
301
400
  "WebSearch",
302
- `mcp__${searchKey}__*`,
401
+ `mcp__${searchKey}__*`
402
+ ];
403
+ const planTools = [
404
+ ...readSearchTools,
303
405
  ...oracleTool ? [oracleTool] : [],
304
406
  "Agent"
305
407
  ];
306
- const reviewerPrompt = "You are the fast profile's repository-aware reviewer. Verify what is actually true by reading the code and running the relevant build, tests, or end-to-end reproduction. Find root causes rather than symptoms. Do not modify production code. Report severity-ranked findings with `file:line` evidence and a clear go/no-go. You do not have Advisor; independently reach your verdict from repository evidence. Use Oracle only as a last resort for one precise unresolved question after your own investigation. " + fileToolSteer("builds and reproductions") + " Do not spawn further agents.";
307
- const criticPrompt = "You are the fast profile's fresh-context cross-lab critic. Assess the supplied plan, design, diff, or decision against its stated constraints. Look for overlooked failure modes, unsupported assumptions, and simpler safer alternatives. Do not modify files, run mutating commands, or spawn agents. Return concise severity-ranked findings with `file:line` evidence where applicable. " + readOnlyToolSteer();
408
+ const oneM = (model) => model === FAST_PROFILE_MODELS.grok ? model : decorateGuaranteedOneM(model);
409
+ const effort = (name) => FAST_PROFILE_NATIVE_EFFORTS[name];
308
410
  const out = {
309
411
  Explore: {
310
- description: `Read-only exploration subagent running ${scoutModel}. Use for broad repository discovery before the lead drafts a plan; return conclusions with file:line evidence, not file dumps.`,
311
- prompt: "Investigate the repository read-only. Cast a wide net, then return a concise evidence packet for the lead: conclusions, load-bearing `file:line` citations, commands checked, and explicit gaps. Do not plan, edit, or spawn agents. " + readOnlyToolSteer(),
312
- tools: scoutTools,
412
+ description: `Fast-profile read-only exploration subagent running ${exploreModel}. Use for broad repository discovery; return conclusions with file:line evidence, not file dumps.`,
413
+ prompt: "You are the fast-profile read-only exploration subagent. Investigate the repository to answer the question: cast a wide net, then return a concise evidence packet with file:line citations and checked commands. Do not plan, edit, or spawn agents. " + readOnlyToolSteer(),
414
+ tools: readSearchTools,
313
415
  model: decorateGuaranteedOneM(LUNA_SCOUT_ALIAS_ID),
314
- effort: opts.scoutEffort ?? "high",
315
- ...searchMcp
416
+ effort: effort("Explore"),
417
+ ...searchMcpServers ? { mcpServers: searchMcpServers } : {}
316
418
  },
317
- implementer: {
318
- description: `Implementation subagent running ${implementerModel}. Use for well-specified mechanical changes after the plan is approved; implement and verify end to end in its own context.`,
319
- prompt: "Implement the approved, well-specified change surgically. Match surrounding style, minimize unrelated churn, use dedicated file tools, and run the relevant build/tests. For verification, you may invoke only the fast-profile `reviewer` or `critic` native subagent; do not invoke any other role or redesign the plan. Report changes, verification, and unresolved risk. " + fileToolSteer("builds"),
320
- model: decorateGuaranteedOneM(LUNA_IMPLEMENTER_ALIAS_ID),
321
- effort: opts.implementerEffort ?? "max"
322
- },
323
- reviewer: {
324
- description: `Repository-aware reviewer running ${reviewerModel} at medium effort. Use after implementation or for failures that need reproduction, runtime checks, or repository context.`,
325
- prompt: reviewerPrompt,
326
- model: reviewerModel,
327
- effort: opts.reviewerEffort ?? "medium",
328
- tools: reviewerTools,
419
+ Plan: {
420
+ description: `Fast-profile plan architect running ${planModel} at high effort. Best suited to non-trivial changes where sequencing, interfaces, or verification benefit from a separate planning view.`,
421
+ prompt: "You are the fast-profile planning subagent. Given the goal, constraints, and available evidence, return an ordered implementation plan with affected files, invariants, risks, acceptance criteria, and verification. You do not have Advisor. Use Oracle only when one precise consequential uncertainty remains after your own investigation and available repository evidence cannot settle it. The Task/Agent capability is restricted by the fast in-session ACL: you may invoke only `Explore` or `reviewer`; do not invoke any other role. " + readOnlyToolSteer(),
422
+ tools: planTools,
423
+ model: oneM(planModel),
424
+ effort: effort("Plan"),
329
425
  mcpServers: {
330
- ...searchMcp.mcpServers ?? {},
331
- ...peersMcp.mcpServers ?? {}
426
+ ...searchMcpServers ?? {},
427
+ ...peersMcpServers ?? {}
332
428
  }
333
429
  },
334
- critic: {
335
- description: `Fresh-context cross-lab critic running ${criticModel} at medium effort. Use to challenge a plan, design, diff, or decision against its stated constraints and expose overlooked failure modes.`,
336
- prompt: criticPrompt,
337
- model: decorateGuaranteedOneM(FAST_CRITIC_ALIAS_ID),
338
- effort: opts.criticEffort ?? "medium",
339
- tools: scoutTools,
340
- ...searchMcp
430
+ "general-purpose": {
431
+ description: `Fast-profile general-purpose execution subagent running ${generalModel} at maximum effort. Best suited to mixed or multi-step execution tasks that do not fit narrower roles.`,
432
+ prompt: "You are the fast-profile general-purpose execution subagent. Work out what the task requires and deliver the outcome end to end using dedicated file tools, builds, tests, and git. For verification, you may invoke only `reviewer`. The lead owns final integration. " + fileToolSteer("builds, tests, and git"),
433
+ model: oneM(generalModel),
434
+ effort: effort("general-purpose"),
435
+ ...searchMcpServers ? { mcpServers: searchMcpServers } : {}
341
436
  },
342
- planner: {
343
- description: `Plan consultant and approver running ${plannerModel}. Invoke only after Luna has done the repository legwork and drafted a plan; pass a handcrafted evidence packet and the complete draft. The lead must not implement until this agent returns APPROVE.`,
344
- prompt: "You are the fast profile's final plan consultant and approver, not a first-pass planner. The caller must provide the user goal, acceptance criteria, repository/domain constraints, Luna's `file:line` and command/test evidence, the complete draft plan, settled decisions, and one focused review question. Selectively verify disputed citations or narrow evidence gaps with read/search tools, but do not repeat broad discovery, edit files, or execute the plan. Return exactly one leading verdict: `APPROVE`, `REVISE`, or `NEED_MORE_CONTEXT`. APPROVE only when the plan is safe, ordered, complete, and verifiable. REVISE must give concrete corrections. NEED_MORE_CONTEXT must name the exact evidence Luna should collect. You do not have Advisor; independently reach your verdict from the evidence packet and selective verification. Use Oracle only as a last resort for one precise unresolved question after your own review. The Task/Agent capability is restricted by the fast in-session ACL: you may invoke only `reviewer`, `Explore`, or `critic`; do not invoke any other role. Bash is for evidence commands only; this is not a shell sandbox. " + readOnlyToolSteer(),
345
- tools: plannerTools,
346
- model: decorateGuaranteedOneM(plannerModel),
347
- effort: opts.plannerEffort ?? "high",
348
- mcpServers: {
349
- ...searchMcp.mcpServers ?? {},
350
- ...peersMcp.mcpServers ?? {}
351
- }
437
+ implementer: {
438
+ description: `Fast-profile implementation subagent running ${implementerModel} at high effort. Best suited to bounded coding changes consistent with repository conventions.`,
439
+ prompt: "You are the fast-profile implementation subagent. Implement the change surgically, matching surrounding code style, minimizing unrelated churn, and running builds/tests. For verification, you may invoke only `reviewer`; do not invoke any other role. Report exact changes and risks. " + fileToolSteer("builds, tests, and git"),
440
+ model: oneM(implementerModel),
441
+ effort: effort("implementer"),
442
+ ...searchMcpServers ? { mcpServers: searchMcpServers } : {}
443
+ },
444
+ reviewer: {
445
+ description: `Fast-profile repository-aware reviewer running ${reviewerModel} at medium effort. Use for independent verification, test authoring, failure reproduction, or runtime checks.`,
446
+ prompt: "You are the fast-profile repository-aware reviewer. Verify what is actually true by reading code and running builds, tests, or reproductions. Report severity-ranked findings with `file:line` evidence and a clear go/no-go. You do not have Advisor. " + fileToolSteer("builds, tests, and reproductions") + " Do not spawn further agents.",
447
+ model: oneM(reviewerModel),
448
+ effort: effort("reviewer"),
449
+ tools: readSearchTools,
450
+ ...searchMcpServers ? { mcpServers: searchMcpServers } : {}
352
451
  }
353
452
  };
354
- const roster = opts.nativeRoster == null ? new Set(FAST_PROFILE_NATIVE_AGENT_NAMES) : opts.nativeRoster instanceof Set ? opts.nativeRoster : new Set(opts.nativeRoster);
355
- if (roster) {
356
- for (const name of Object.keys(out)) if (!roster.has(name)) delete out[name];
453
+ if (opts.browseAvailable && opts.groupKeys.workers) {
454
+ const workersKey = workersKeyOf(opts.groupKeys);
455
+ out["worker-browse"] = {
456
+ description: dispatcherDescription("browse"),
457
+ prompt: dispatcherPrompt("browse", workersKey),
458
+ model: oneM(FAST_PROFILE_MODELS.luna),
459
+ effort: "high",
460
+ tools: dispatcherTools("browse", workersKey),
461
+ ...opts.serverUrl ? { mcpServers: { [workersKey]: httpEntryFor(opts.serverUrl, "workers", opts.nonce, opts.workspaceHeaderCmd) } } : {}
462
+ };
357
463
  }
464
+ const roster = opts.nativeRoster == null ? new Set(FAST_PROFILE_NATIVE_AGENT_NAMES) : opts.nativeRoster instanceof Set ? opts.nativeRoster : new Set(opts.nativeRoster);
465
+ for (const name of Object.keys(out)) if (name !== "worker-browse" && !roster.has(name)) delete out[name];
358
466
  return out;
359
467
  }
360
468
  /**
@@ -367,9 +475,10 @@ function buildFastProfileAgentDefinitions(opts) {
367
475
  * per Phase 2A of the peer-MCP plan.
368
476
  */
369
477
  function buildPeerAgentDefinitions(opts) {
478
+ if (opts.maxProfile) return buildMaxProfileAgentDefinitions(opts);
370
479
  if (opts.fastProfile) return buildFastProfileAgentDefinitions(opts);
371
480
  const out = {};
372
- const personas = opts.fastProfile ? [] : personasFor({
481
+ const personas = personasFor({
373
482
  codexCli: opts.codexCli,
374
483
  geminiAvailable: opts.geminiAvailable,
375
484
  geminiModel: opts.geminiModel,
@@ -806,6 +915,11 @@ async function writePeerMcpRuntimeFiles(serverUrl, opts) {
806
915
  scribeModel: opts.scribeModel,
807
916
  implementerFastModel: opts.implementerFastModel,
808
917
  generalPurposeFastModel: opts.generalPurposeFastModel,
918
+ fastExploreModel: opts.fastExploreModel,
919
+ fastPlanModel: opts.fastPlanModel,
920
+ fastGeneralPurposeModel: opts.fastGeneralPurposeModel,
921
+ fastImplementerModel: opts.fastImplementerModel,
922
+ fastReviewerModel: opts.fastReviewerModel,
809
923
  nativeRoster: opts.nativeRoster,
810
924
  personaAllowlist: opts.personaAllowlist,
811
925
  includeCoordinator: opts.includeCoordinator,
@@ -813,12 +927,26 @@ async function writePeerMcpRuntimeFiles(serverUrl, opts) {
813
927
  implementerFastEffort: opts.implementerFastEffort,
814
928
  reviewerFastEffort: opts.reviewerFastEffort,
815
929
  fastProfile: opts.fastProfile,
816
- plannerModel: opts.plannerModel,
817
930
  implementerEffort: opts.implementerEffort,
818
931
  reviewerEffort: opts.reviewerEffort,
819
- plannerEffort: opts.plannerEffort,
820
- criticModel: opts.criticModel,
821
- criticEffort: opts.criticEffort,
932
+ maxProfile: opts.maxProfile,
933
+ maxExploreModel: opts.maxExploreModel,
934
+ maxPlanModel: opts.maxPlanModel,
935
+ maxGeneralPurposeModel: opts.maxGeneralPurposeModel,
936
+ maxImplementerModel: opts.maxImplementerModel,
937
+ maxReviewerModel: opts.maxReviewerModel,
938
+ maxBrainstormModel: opts.maxBrainstormModel,
939
+ maxGeminiModel: opts.maxGeminiModel,
940
+ maxGrokModel: opts.maxGrokModel,
941
+ maxExploreEffort: opts.maxExploreEffort,
942
+ maxPlanEffort: opts.maxPlanEffort,
943
+ maxGeneralPurposeEffort: opts.maxGeneralPurposeEffort,
944
+ maxImplementerEffort: opts.maxImplementerEffort,
945
+ maxReviewerEffort: opts.maxReviewerEffort,
946
+ maxBrainstormEffort: opts.maxBrainstormEffort,
947
+ maxCoordinatorEffort: opts.maxCoordinatorEffort,
948
+ maxPersonaNames: opts.maxPersonaNames,
949
+ maxPeerModels: opts.maxPeerModels,
822
950
  nonce,
823
951
  codexHome,
824
952
  serverUrl,
@@ -844,7 +972,13 @@ async function writePeerMcpRuntimeFiles(serverUrl, opts) {
844
972
  }
845
973
  const completeMdResult = mdResult;
846
974
  if (!completeMdResult) throw new Error("peer MCP agent files were not generated");
847
- const personas = opts.fastProfile ? [] : personasFor({
975
+ const personas = opts.maxProfile ? maxPersonasFor({
976
+ solModel: opts.maxPeerModels?.sol,
977
+ lunaModel: opts.maxPeerModels?.luna,
978
+ opusModel: opts.maxPeerModels?.opus,
979
+ geminiModel: opts.maxPeerModels?.gemini,
980
+ grokModel: opts.maxPeerModels?.grok
981
+ }) : opts.fastProfile ? [] : personasFor({
848
982
  codexCli: opts.codexCli,
849
983
  geminiAvailable: opts.geminiAvailable,
850
984
  geminiModel: opts.geminiModel,
@@ -1857,6 +1991,83 @@ The dispatcher calls the worker once and relays its result verbatim.
1857
1991
  `
1858
1992
  };
1859
1993
  //#endregion
1994
+ //#region src/lib/injected-skills/artifact-review-skill.ts
1995
+ function buildArtifactReviewSkill(peersKey = "peers") {
1996
+ const toolPrefix = `mcp__${peersKey}__artifact_`;
1997
+ return {
1998
+ name: "gh-artifact-review",
1999
+ md: `---
2000
+ name: gh-artifact-review
2001
+ description: Reviews plans and artifacts in the ai-or-die panel. Defaults to authoring a self-contained HTML artifact (rich, annotatable, optionally interactive) and opening THAT for the human, then drains feedback with artifact_await, revises, and ends the loop. Use when running inside an ai-or-die tab and there is a plan, comparison, diagram, table, diff, or report the user should see before proceeding.
2002
+ user-invocable: true
2003
+ ---
2004
+
2005
+ # gh-artifact-review: human review in the ai-or-die panel
2006
+
2007
+ Use this when you finish a plan or produce something a user should review and you are inside an ai-or-die tab (the \`${toolPrefix}*\` tools drive a live panel). The human can click any block or select text to attach a comment, and can click declarative action controls you emit — both come back to you as typed events.
2008
+
2009
+ ## Default: present HTML, not raw markdown
2010
+
2011
+ HTML is the canonical review artifact — it renders richly and is annotatable element-by-element. When the content is anything visual or structured (a comparison, table, diagram, diff, dashboard, or a plan you want to look polished), **author a self-contained \`.html\` file** (inline CSS, no external deps, readable typography) and open THAT.
2012
+
2013
+ - Plan-mode plans: the panel auto-opens them already rendered to HTML — you do not need to convert them by hand.
2014
+ - Do not paste raw markdown into an \`.html\`; write real HTML (headings, lists, tables, \`<pre>\` for code). Opening a raw \`.md\` still renders, but a purpose-built HTML artifact reads better and annotates cleanly.
2015
+
2016
+ ## When to reach for an artifact
2017
+
2018
+ Default to one for anything easier to grasp visually than as terminal prose: plans, design proposals, comparisons / trade-offs, decisions that need the user's input, diagrams / architecture, tables, code diffs, reports. Skip it only for trivial one-line answers.
2019
+
2020
+ ## Playbooks (what a good artifact of each type contains)
2021
+
2022
+ - **plan**: goal, current state, the proposed approach (high-level decisions, not every line), then risks and open questions at the end.
2023
+ - **comparison**: options as columns, trade-offs as rows, current-vs-target where relevant, and an explicit recommendation. Do not make the reader infer the winner.
2024
+ - **table**: scannable rows, a sticky header, aligned numeric columns; group/section dense records rather than one flat wall.
2025
+ - **diagram**: boxes + arrows. Mermaid when automatic layout matters; positioned SVG/CSS when each node needs prose, code, or controls.
2026
+ - **code / diff**: \`<pre>\` with before/after or unified-diff styling; keep line context tight; call out the changed lines.
2027
+ - **report / dashboard**: lead with the headline number / verdict, then supporting detail; keep one idea per section.
2028
+
2029
+ ## Design system
2030
+
2031
+ Artifacts stay portable (they must render identically opened standalone), so do not depend on a server-injected theme. Pick the look in priority order: (1) a look the user named; (2) the **subject project's** own design system, its Tailwind / theme config, CSS variables / tokens, component library, or existing styled pages, especially when the artifact previews that app's UI; (3) only when both come up empty, clean readable defaults (system font stack, generous spacing, a single accent).
2032
+
2033
+ ## Loop
2034
+
2035
+ 1. Open: \`${toolPrefix}open\` with the absolute path of the \`.html\` (or the file). Pass \`mode:"interactive"\` when the HTML carries \`data-aod-*\` action controls (below). Relay the returned \`viewUrl\` and tell the user to review in the panel.
2036
+ 2. Drain: \`${toolPrefix}await\`. It long-holds for the human's next events and returns \`{events, status, cursor}\`. **Pass the returned \`cursor\` on your next call** so you only receive newer events; if \`events\` is empty, call again with that cursor.
2037
+ 3. Act on each event by \`kind\`:
2038
+ - \`comment\` — a free-text note anchored to the artifact (\`selector\`, quoted \`text\`, \`sourceLine\`); apply the requested change at that exact spot.
2039
+ - \`action\` — the human clicked a control you emitted (\`action\` verb, \`elementId\`, optional \`value\`; a multi-select submit arrives as one action carrying the selected set). Do what the verb means (approve a step, choose an option, apply a toggle set).
2040
+ 4. Reply: \`${toolPrefix}reply\` with a concise summary of what you changed. Optionally \`${toolPrefix}update({file})\` or \`({html})\` to replace the artifact content in place, or \`${toolPrefix}refresh\` to reload it from disk.
2041
+ 5. Repeat 2-4 until the user is satisfied; then \`${toolPrefix}end\`. Use \`${toolPrefix}dismiss\` to hide the panel while keeping the review alive (queued feedback preserved) if the user wants it out of the way without ending.
2042
+
2043
+ ### Push arrival (you do not have to be polling)
2044
+
2045
+ When you are idle at the prompt, panel feedback can arrive on its own as a new turn (the tab injects it). Structured actions that answer a pending decision are routed to you directly. Either way, the durable record is the \`${toolPrefix}await\` drain, so when in doubt call \`${toolPrefix}await\` (with your last cursor) to reconcile — it replays anything you missed.
2046
+
2047
+ ### \`artifact_poll\` (frozen legacy)
2048
+
2049
+ \`${toolPrefix}poll\` still resolves for back-compat but returns the OLD payload (human comments only, no structured actions). Prefer \`${toolPrefix}await\`.
2050
+
2051
+ ## Interactive controls (data-aod-* authoring)
2052
+
2053
+ To let the human act on the artifact (not just comment), emit declarative controls; the panel wires them and delivers a typed \`action\` event. No JS in the artifact.
2054
+
2055
+ - **choose-one (fires immediately):** each option is a button that posts the moment it is clicked.
2056
+ \`<button data-aod-action="choose" data-aod-group="decision-1" data-aod-id="opt-jwt" data-aod-value="jwt">JWT</button>\`
2057
+ - **multi-select (toggle then submit):** checkboxes sharing a \`data-aod-group\`, plus one submit button with the same group. The submit delivers ONE action carrying \`{group, selected:[{elementId, value?}]}\`.
2058
+ \`<input type="checkbox" data-aod-action="check" data-aod-group="opts" data-aod-id="a" data-aod-value="a">\` … \`<button data-aod-action="submit" data-aod-group="opts" data-aod-id="opts-submit">Apply</button>\`
2059
+ - **plan steps:** \`<li class="aod-step" data-aod-id="plan-step-3" data-source-line="14">\` with per-step \`data-aod-action="approve"/"skip"\` buttons.
2060
+ - **Required attrs:** \`data-aod-action\` (verb), \`data-aod-id\` (stable, echoed back as \`elementId\`; a control missing it is ignored), optional \`data-aod-value\`. Keep \`data-source-line\` for comment mapping.
2061
+
2062
+ ## Honest limits
2063
+
2064
+ - If a tool errors (e.g. \`NOT_IN_AIORDIE_TAB\`, \`UNREACHABLE\`, \`INVALID_REQUEST\`), report the code/message verbatim; do not claim the panel opened.
2065
+ - The panel is a review surface, not an approver: outward/irreversible actions still need explicit user confirmation.
2066
+ `
2067
+ };
2068
+ }
2069
+ buildArtifactReviewSkill();
2070
+ //#endregion
1860
2071
  //#region src/lib/claude-md-injection.ts
1861
2072
  /**
1862
2073
  * Marker fences for each injection block. The literal text of each
@@ -1919,11 +2130,11 @@ function joinClauses(parts) {
1919
2130
  * tier; reserve `reviewer` for the higher-stakes assessment it is there for. */
1920
2131
  function buildNativeReachClauses(opts) {
1921
2132
  if (opts.profile === "fast") return joinClauses([
1922
- "`Explore` to find or understand something in the repo",
1923
- "`implementer` for approved mechanical coding changes",
1924
- "`reviewer` for repository-aware verification, reproduction, and root-causing",
1925
- "`planner` as the Sol plan consultant and approver after Luna has drafted with evidence",
1926
- "`critic` for a fresh-context cross-lab challenge to a plan, design, diff, or decision"
2133
+ "`Explore` for broad discovery and repo investigation",
2134
+ "`Plan` for non-trivial sequencing, interfaces, migration risk, or acceptance criteria",
2135
+ "`general-purpose` for mixed execution tasks",
2136
+ "`implementer` for bounded coding changes",
2137
+ "`reviewer` for repository-aware verification, reproduction, and root-causing"
1927
2138
  ]);
1928
2139
  const clauses = [];
1929
2140
  const implementerFast = opts.implementerFastAvailable !== false;
@@ -1944,10 +2155,31 @@ function buildNativeReachClauses(opts) {
1944
2155
  if (opts.generalPurposeFastAvailable !== false) clauses.push(opts.budgetLead === true ? "`general-purpose-fast` for work no specialist fits, in preference to carrying it inline yourself" : "`general-purpose-fast` for work no specialist fits");
1945
2156
  return joinClauses(clauses);
1946
2157
  }
2158
+ /**
2159
+ * Build the operating-defaults directive for one launch, naming only the
2160
+ * natives that launch actually emitted.
2161
+ *
2162
+ * Callers must pass the SAME availability booleans they used for the `.md`
2163
+ * generation and `buildPeerAwarenessSnippet`, so the three surfaces cannot
2164
+ * disagree about which agents exist.
2165
+ */
1947
2166
  function buildOperatingDefaultsDirective(opts = {}) {
2167
+ if (opts.profile === "max") {
2168
+ const peersKey = opts.peersKey ?? opts.groupKeys?.peers ?? "peers";
2169
+ return "## Operating defaults (apply when the user has not specified otherwise; the user's explicit direction and the domain's own standards always override)\n\nMax launch profile. The lead owns the outcome and may use the roster as a set of complementary capabilities, not a required sequence: direct tools suit narrow facts; `Explore` broad discovery; `brainstorm` open design choices; `Plan` changes where sequencing, interfaces, or acceptance criteria benefit from a separate view; `implementer` bounded coding; `general-purpose` mixed work; and `reviewer` (Grok 4.6/high with Luna 1M/max fallback) repository-aware verification. Independent work can run in parallel when that improves context isolation or latency. A fresh-context peer from another model family can be useful where correlated blind spots matter and deterministic evidence does not settle the issue; `peer-review-coordinator` is available when the risk justifies several lenses. Small or obvious tasks are often better handled directly, and model output remains evidence to synthesize rather than a vote. Each role's configured model is the deliberate default for role fit and diversity; overrides are most useful after a concrete mismatch. On every retained max surface, Gemini 3.1 Pro is replaced by Grok 4.6/high when available, otherwise Gemini 3.7 Flash 1M/high. Advisor is optional, non-binding counsel for one focused consequential uncertainty that the normal evidence and roles cannot settle; it has no approval or workflow authority, and a further consultation is useful only when materially new evidence changes the question." + (opts.artifactAvailable ? ` Live human review is available in the artifact panel via \`mcp__${peersKey}__artifact_*\`.` : "");
2170
+ }
1948
2171
  if (opts.profile === "fast") {
1949
- if (opts.fastRuntimeAvailable === false) return "## Operating defaults (apply when the user has not specified otherwise; the user's explicit direction and the domain's own standards always override)\n\nFast profile runtime wiring is unavailable, so no injected Task roster, search, or Oracle is available. Work directly, use only tools actually listed in this session, verify with the repository's relevant build/tests before declaring done, report uncertainty, and do not invent unavailable capabilities.";
1950
- return "## Operating defaults (apply when the user has not specified otherwise; the user's explicit direction and the domain's own standards always override)\n\nOrchestrate. Delegate research, implementation, and review to the right subagent. Reach for " + buildNativeReachClauses(opts) + "; Task subagents run in parallel. That keeps your own context free to reason and collaborate with the user. Delegate only when work is wide or slow; do trivial and surgical work directly. Luna investigates and drafts. The lead must give `planner` a handcrafted evidence packet and must not implement until `planner` returns `APPROVE`. Advisor is an optional, non-binding, lead-only transcript-aware sounding board for consequential unresolved uncertainty, conflicting evidence, or a genuinely stuck path; never use it for routine progress, waiting, directly verifiable facts, planner approval, reviewer verification, or completion ritual. `oracle` is exact Opus 5 (1M/high), stateless and last resort after the normal paths remain stuck. Before declaring work done, run the relevant build/tests and ask `reviewer` for repository-aware verification. Verify claims, report uncertainty, and stop named teammates when finished.";
2172
+ if (opts.fastRuntimeAvailable === false) return "## Operating defaults (apply when the user has not specified otherwise; the user's explicit direction and the domain's own standards always override)\n\nFast profile runtime wiring is unavailable. Work directly, use only tools actually listed in this session, verify with the repository's relevant build/tests before declaring done, report uncertainty, and do not invent unavailable capabilities.";
2173
+ const peersKey = opts.peersKey ?? opts.groupKeys?.peers ?? "peers";
2174
+ const searchKey = opts.groupKeys?.search ?? "search";
2175
+ const browserKey = opts.groupKeys?.browser ?? "browser";
2176
+ const workersKey = opts.groupKeys?.workers ?? "workers";
2177
+ const browserClause = opts.browserToolsAvailable ?? opts.browseAvailable ? ` \`mcp__${browserKey}__*\` provides direct browser control.` : "";
2178
+ const workerBrowseClause = opts.browseAvailable ? ` \`worker-browse\` runs delegated autonomous browsing tasks through \`mcp__${workersKey}__browse\`.` : "";
2179
+ const artifactClause = opts.artifactAvailable ? ` \`mcp__${peersKey}__artifact_*\` provides human review in the artifact panel with auto-open on plan completion.` : "";
2180
+ return "## Operating defaults (apply when the user has not specified otherwise; the user's explicit direction and the domain's own standards always override)\n\nFast launch profile. The lead coordinates execution across specialized native roles: " + buildNativeReachClauses(opts) + `. \`Plan\` is an advisory planning capability for nontrivial sequencing, interfaces, migration risk, or acceptance criteria, not an approval gate. Delegate only when work is wide, slow, or benefits from context isolation; do trivial, surgical, and narrow work directly. Independent Task subagents may run in parallel. Delegation graph: the lead may invoke all five; \`Plan\` may invoke \`Explore\` and \`reviewer\`; \`implementer\` and \`general-purpose\` may invoke \`reviewer\`; \`Explore\`, \`reviewer\`, and \`worker-browse\` cannot invoke native subagents.
2181
+
2182
+ Advisor is an optional, non-binding, lead-only transcript-aware sounding board for consequential unresolved uncertainty, conflicting evidence, or a genuinely stuck path; never use it for routine progress, waiting, directly verifiable facts, or completion ritual. \`mcp__${peersKey}__oracle\` is exact Opus 5 (1M/high), a stateless last-resort consultant available to the lead and \`Plan\` when required; \`reviewer\` and other subagents cannot call Oracle. \`mcp__${searchKey}__code\` provides semantic-first code search and \`mcp__${searchKey}__web\` provides citable sources.${browserClause}${workerBrowseClause}${artifactClause}\n\nVerify claims with concrete repository evidence and tests before declaring work done. Stop named teammates when finished.`;
1951
2183
  }
1952
2184
  return "## Operating defaults (apply when the user has not specified otherwise; the user's explicit direction and the domain's own standards always override)\n\nOrchestrate. Delegate research, implementation, review, and large reads to the right subagent, worker, or model. Reach for " + buildNativeReachClauses(opts) + "; worker-* agents for background non-blocking runs; Task subagents for parallel work; peer critics for review. That keeps your own context free to reason and collaborate with the user. Launch independent agents concurrently in a single message rather than serially. Delegation pays when the work is WIDE (many files or sources to sweep) or SLOW, and you need only the conclusion: the main thread is where you think with and respond to the user, and its context window is a finite shared resource. It does NOT pay merely because a sub-question is separable. A narrow, deep question whose whole value is file:line fidelity loses exactly that through a summarization layer, and a sub-question you could answer in one command is cheaper done directly than paying a subagent's startup. Do trivial, surgical, and last-mile work yourself. A named teammate persists after it reports so you can send it follow-ups, and nothing reaps it for you: its idle notice means available, not finished. Stop it once you are done with it.\n\nAdversarial review. The peer critics (`codex_critic` and `codex_reviewer`, `gemini_critic` and `gemini_reviewer`, `opus_critic`, and the `peer-review-coordinator` that fans out to several of them) are fresh-context models, so what they add is a blind spot that whoever produced the work cannot reach by thinking harder about it; prefer a critic from a different lab than the producer, since blind spots correlate within a lab. The `advisor` is a complement and not a substitute: it sees your transcript, so it catches your own drift and momentum, but it inherits your framing, which is exactly what a fresh-context critic does not. They earn their keep on consequential design choices, recommendations, and hard-to-reverse decisions: the cases where plausible alternatives remain and the conclusion rests on judgment rather than on something you can verify directly. That is where confabulation hides, so budget the wait even under delivery pressure. Always consult one when the change touches auth, user input, database queries, crypto, or serialization. They do NOT pay for read-only tracing, ordinary repository lookup, or a conclusion that a focused test, a direct reproduction, or unambiguous code evidence already settles. Asking a critic to re-derive a proven fact returns a confident answer either way, which is ritual skepticism rather than review, and skipping them there is the right call and not a shortcut. Match the lens to the artifact: a strategic critic for plans and trade-offs, a code reviewer for a concrete diff, the coordinator only when the risk warrants several independent lenses. Give whichever you pick the artifact and the constraints and not your rationale, since justification anchors the review and dulls it.\n\nAim high. Default to radical simplicity and a relentless focus on the user's real experience: design for the person and the job to be done, not the demo. Reason about the whole system from first principles, anticipating scale and the long arc rather than patching the surface. Work backwards from the outcome the user actually needs. Question every assumption and prefer what you can derive, reproduce, or test.\n\nEngineering excellence. When making technical decisions, give little weight to development cost; prefer quality, simplicity, robustness, scalability, and long-term maintainability. Fix a bug by first reproducing it end to end, as close to how a real user hits it as you can, so you solve the real problem and not a symptom. When testing a product end to end, be picky about the UI and obsessed with pixel perfection: if something clearly looks off, even when it is unrelated to your task, get it fixed along the way. Hold that same bar for the codebase itself: a lint error, a failing test, or a flaky test is worth fixing the moment you see it, whoever introduced it. Fold it into your current work rather than letting it derail the task the user actually asked for.";
1953
2185
  }
@@ -1956,23 +2188,12 @@ function buildOperatingDefaultsDirective(opts = {}) {
1956
2188
  * resolved; this const is the default for callers and tests that do not model
1957
2189
  * a thin catalog. */
1958
2190
  const OPERATING_DEFAULTS_DIRECTIVE = buildOperatingDefaultsDirective();
1959
- /**
1960
- * Condensed digest of OPERATING_DEFAULTS_DIRECTIVE for the spawned session's
1961
- * system prompt (--append-system-prompt). The FULL directive is prepended to
1962
- * the mirrored CLAUDE.md (read by the main agent and descendants); this digest
1963
- * keeps both behavioral directives at top salience without duplicating the full
1964
- * ~310-token block in the context window every turn. Points to the full copy.
1965
- *
1966
- * The unverifiable-claim rule is here rather than in CLAUDE.md alone because it
1967
- * fires at a moment that suppresses lookups: an agent racing to deliver a
1968
- * recommendation is precisely the one that will not stop to consult its project
1969
- * instructions, which is how the check got crowded out in the first place. It
1970
- * also closes a hole in the rule above it, which only covers claims that direct
1971
- * evidence CAN settle. The roster of critics, the lens-to-artifact match, and
1972
- * the reasoning stay in the directive; the always-resident copy carries only
1973
- * the trigger and the ritual exclusion.
1974
- */
1975
- const OPERATING_DEFAULTS_DIGEST = "## Operating defaults (the user's explicit direction and the domain's standards always override)\n\nDelegate when the work is WIDE (many files or sources to sweep) or SLOW and you need only the conclusion, to protect the main thread's finite context and keep it free for reasoning and interacting with the user; prefer parallel delegation for independent work. Do NOT delegate merely because a sub-question is separable: a narrow, deep question whose value is file:line fidelity loses exactly that through a summarization layer, and one answerable in a single command is cheaper done directly. Do trivial, surgical, and last-mile work yourself. Stop a named teammate once you are done with it: it persists for follow-ups, its idle notice means available rather than finished, and nothing reaps it for you.\n\nVerify, do not assert. Run the code, read the file, check the exit code. A claim in prose is worth nothing against state you did not check, and a check that cannot fail proves nothing. Reproduce a bug end to end, the way a real user hits it, before fixing it. Fix a lint error, failing test, or flake the moment you see it, whoever introduced it, without letting it derail the task at hand. Prefer quality and long-term maintainability over development cost.\n\nVerification has a blind spot: a consequential recommendation, a design or trade-off call, or a hard-to-reverse decision that still turns on judgment among plausible alternatives once the direct evidence is in. That is where confabulation hides, so put it past a peer critic before you ship it and budget the wait even under delivery pressure. When a test, a run, a reproduction, or a search would settle the claim, settle it that way instead; a critic asked to re-derive what you can already prove is ritual, not review.\n\nThe agent roster, the tool surface, and the reasoning behind these defaults are in your CLAUDE.md project instructions. Read them when choosing HOW to work; the rules above apply without a lookup.";
2191
+ const STANDARD_OPERATING_DEFAULTS_DIGEST = "## Operating defaults (the user's explicit direction and the domain's standards always override)\n\nDelegate when the work is WIDE (many files or sources to sweep) or SLOW and you need only the conclusion, to protect the main thread's finite context and keep it free for reasoning and interacting with the user; prefer parallel delegation for independent work. Do NOT delegate merely because a sub-question is separable: a narrow, deep question whose value is file:line fidelity loses exactly that through a summarization layer, and one answerable in a single command is cheaper done directly. Do trivial, surgical, and last-mile work yourself. Stop a named teammate once you are done with it: it persists for follow-ups, its idle notice means available rather than finished, and nothing reaps it for you.\n\nVerify, do not assert. Run the code, read the file, check the exit code. A claim in prose is worth nothing against state you did not check, and a check that cannot fail proves nothing. Reproduce a bug end to end, the way a real user hits it, before fixing it. Fix a lint error, failing test, or flake the moment you see it, whoever introduced it, without letting it derail the task at hand. Prefer quality and long-term maintainability over development cost.\n\nVerification has a blind spot: a consequential recommendation, a design or trade-off call, or a hard-to-reverse decision that still turns on judgment among plausible alternatives once the direct evidence is in. That is where confabulation hides, so put it past a peer critic before you ship it and budget the wait even under delivery pressure. When a test, a run, a reproduction, or a search would settle the claim, settle it that way instead; a critic asked to re-derive what you can already prove is ritual, not review.\n\nThe agent roster, the tool surface, and the reasoning behind these defaults are in your CLAUDE.md project instructions. Read them when choosing HOW to work; the rules above apply without a lookup.";
2192
+ function buildOperatingDefaultsDigest(opts = {}) {
2193
+ if (opts.profile === "max") return "## Operating defaults (the user's explicit direction and the domain's standards always override)\n\nMax launch profile. The lead owns the outcome and may use the roster as complementary capabilities: direct tools for narrow facts, `Explore` for broad discovery, `brainstorm` for open choices, `Plan` for a separate planning view, `implementer` and `general-purpose` for execution, and `reviewer` (Grok 4.6/high with Luna 1M/max fallback) for repository-aware verification. Delegate when work is wide or slow to protect the main thread's finite context; do trivial and surgical work directly. Prefer parallel delegation for independent work. Stop named teammates when finished.\n\nVerify claims against real evidence: run the code, check outputs and test results. Model output is evidence to synthesize rather than a vote. A fresh-context peer or `peer-review-coordinator` can reduce correlated blind spots on consequential decisions where judgment remains after direct evidence is in.\n\nAdvisor is optional, non-binding, primary-lead-only counsel for focused consequential uncertainty that direct evidence, Plan, reviewer, or peers cannot settle. It has no approval or workflow authority.";
2194
+ if (opts.profile === "fast") return "## Operating defaults (the user's explicit direction and the domain's standards always override)\n\nFast launch profile. The lead coordinates execution across `Explore` (broad discovery), `Plan` (sequencing, interfaces, migration risk, acceptance criteria), `general-purpose` (mixed execution), `implementer` (bounded coding), and `reviewer` (repository-aware verification). `Plan` is an advisory planning capability, not an approval gate. Delegate when work is wide or slow to protect main-thread context; do trivial and surgical work directly. Independent subagents may run in parallel. Stop named teammates when finished.\n\nVerify claims against real evidence: run relevant commands and tests. Advisor is optional, non-binding, transcript-aware, and lead-only for consequential unresolved uncertainty, not routine progress or workflow gates. `oracle` (Opus 5 1M/high) is a stateless last resort for the lead and `Plan` when normal paths remain stuck.";
2195
+ return STANDARD_OPERATING_DEFAULTS_DIGEST;
2196
+ }
1976
2197
  /**
1977
2198
  * Skip the helper if the user's `~/.claude/CLAUDE.md` (or, equivalently,
1978
2199
  * the would-be post-write file) has grown past this size.
@@ -2449,6 +2670,12 @@ const INJECTED_SKILLS = [
2449
2670
  FIRST_MATE_OPERATE_SKILL,
2450
2671
  FIRST_MATE_CONDUCT_SKILL
2451
2672
  ];
2673
+ function injectedSkillsForLaunch(selection) {
2674
+ if (selection.profileId === "fast") return [];
2675
+ if (selection.profileId === "max") return selection.firstMateEnabled ? INJECTED_SKILLS.filter((skill) => skill.name.startsWith("gh-first-mate")) : [];
2676
+ if (!selection.workerSkillsActive) return [];
2677
+ return INJECTED_SKILLS.filter((skill) => selection.firstMateEnabled || !skill.name.startsWith("gh-first-mate"));
2678
+ }
2452
2679
  //#endregion
2453
2680
  //#region src/lib/attribution-settings.ts
2454
2681
  /**
@@ -2514,6 +2741,6 @@ async function injectAttributionSuppressionIntoSettingsFile(settingsPath) {
2514
2741
  return { written: true };
2515
2742
  }
2516
2743
  //#endregion
2517
- export { injectPeerMcpIntoMirror as _, appendPeerAwarenessToMirroredClaudeMd as a, workersKeyOf as b, prependArtifactPanelDirectiveToMirroredClaudeMd as c, SEAMLESS_BUILTIN_TOOLS as d, configureServeDefaultPermissionMode as f, BUILTIN_SUBAGENT_DEFINITIONS as g, sanitizeServeSettingsEnv as h, OPERATING_DEFAULTS_DIGEST as i, prependOperatingDefaultsToMirroredClaudeMd as l, planModeAllowRules as m, INJECTED_SKILLS as n, appendToolbeltAwarenessToMirroredClaudeMd as o, injectAllowRules as p, writeInjectedSkill as r, buildOperatingDefaultsDirective as s, injectAttributionSuppressionIntoSettingsFile as t, prependStyleDirectiveToMirroredClaudeMd as u, resolveCodexCliBackend as v, writePeerMcpRuntimeFiles as x, resolveGroupKeysFromMirror as y };
2744
+ export { writePeerMcpRuntimeFiles as C, workersKeyOf as S, sanitizeServeSettingsEnv as _, appendPeerAwarenessToMirroredClaudeMd as a, resolveCodexCliBackend as b, buildOperatingDefaultsDirective as c, prependStyleDirectiveToMirroredClaudeMd as d, buildArtifactReviewSkill as f, planModeAllowRules as g, injectAllowRules as h, writeInjectedSkill as i, prependArtifactPanelDirectiveToMirroredClaudeMd as l, configureServeDefaultPermissionMode as m, INJECTED_SKILLS as n, appendToolbeltAwarenessToMirroredClaudeMd as o, SEAMLESS_BUILTIN_TOOLS as p, injectedSkillsForLaunch as r, buildOperatingDefaultsDigest as s, injectAttributionSuppressionIntoSettingsFile as t, prependOperatingDefaultsToMirroredClaudeMd as u, BUILTIN_SUBAGENT_DEFINITIONS as v, resolveGroupKeysFromMirror as x, injectPeerMcpIntoMirror as y };
2518
2745
 
2519
- //# sourceMappingURL=attribution-settings-B70GmZ68.js.map
2746
+ //# sourceMappingURL=attribution-settings-dta8MTnd.js.map