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
package/dist/hooks.mjs CHANGED
@@ -10919,50 +10919,148 @@ var init_harness_parse = __esmMin((() => {
10919
10919
  init_exec();
10920
10920
  init_gate_registry();
10921
10921
  STATIC_IDS = /* @__PURE__ */ new Set(["typecheck", "lint"]);
10922
+ }));
10923
+ //#endregion
10924
+ //#region src/lib/state.ts
10925
+ var DEFAULT_LAUNCH_ID, state;
10926
+ var init_state = __esmMin((() => {
10927
+ DEFAULT_LAUNCH_ID = "__default__";
10928
+ state = {
10929
+ accountType: "enterprise",
10930
+ copilotTokenGeneration: 0,
10931
+ manualApprove: false,
10932
+ rateLimitWait: false,
10933
+ showToken: false,
10934
+ extendedBetas: false,
10935
+ browseEnabled: false,
10936
+ fleetEnabled: false,
10937
+ agentsEnabled: false,
10938
+ powerBrowseEnabled: false,
10939
+ humanlikeForce: "auto",
10940
+ sessionId: randomUUID(),
10941
+ machineId: randomBytes(32).toString("hex"),
10942
+ launchRegistry: /* @__PURE__ */ new Map()
10943
+ };
10944
+ Object.defineProperty(state, "peerMcpNonce", {
10945
+ enumerable: true,
10946
+ configurable: true,
10947
+ get() {
10948
+ return state.launchRegistry.get(DEFAULT_LAUNCH_ID)?.nonce;
10949
+ },
10950
+ set(value) {
10951
+ if (value === void 0) {
10952
+ state.launchRegistry.delete(DEFAULT_LAUNCH_ID);
10953
+ return;
10954
+ }
10955
+ const existing = state.launchRegistry.get(DEFAULT_LAUNCH_ID);
10956
+ state.launchRegistry.set(DEFAULT_LAUNCH_ID, {
10957
+ launchId: DEFAULT_LAUNCH_ID,
10958
+ nonce: value,
10959
+ secret: existing?.secret ?? "",
10960
+ profileId: existing?.profileId ?? "standard",
10961
+ allowedGroups: existing?.allowedGroups,
10962
+ allowedPersonas: existing?.allowedPersonas,
10963
+ createdAt: existing?.createdAt ?? Date.now()
10964
+ });
10965
+ }
10966
+ });
10922
10967
  })), FAST_PROFILE_MODELS, FAST_PROFILE_NATIVE_AGENT_NAMES, FAST_PROFILE_ADVISOR_MODEL, FAST_PROFILE_DELEGATION_GRAPH;
10923
10968
  var init_fast_profile_contract = __esmMin((() => {
10924
10969
  FAST_PROFILE_MODELS = Object.freeze({
10925
10970
  luna: "gpt-5.6-luna",
10971
+ sol: "gpt-5.6-sol",
10972
+ gemini: "gemini-3.7-flash",
10973
+ grok: "grok-4.6",
10974
+ opus: "claude-opus-5",
10975
+ explore: "gpt-5.6-luna",
10976
+ plan: "gpt-5.6-sol",
10977
+ "general-purpose": "gpt-5.6-luna",
10978
+ implementer: "gemini-3.7-flash",
10926
10979
  reviewer: "grok-4.6",
10927
- planner: "gpt-5.6-sol",
10928
- critic: "gemini-3.7-flash",
10980
+ advisor: "gemini-3.7-flash",
10929
10981
  oracle: "claude-opus-5"
10930
10982
  });
10931
10983
  FAST_PROFILE_NATIVE_AGENT_NAMES = [
10932
10984
  "Explore",
10985
+ "Plan",
10986
+ "general-purpose",
10933
10987
  "implementer",
10934
- "reviewer",
10935
- "planner",
10936
- "critic"
10988
+ "reviewer"
10937
10989
  ];
10938
10990
  Object.freeze({
10939
10991
  Explore: FAST_PROFILE_MODELS.luna,
10940
- implementer: FAST_PROFILE_MODELS.luna,
10941
- reviewer: FAST_PROFILE_MODELS.reviewer,
10942
- planner: FAST_PROFILE_MODELS.planner,
10943
- critic: FAST_PROFILE_MODELS.critic
10992
+ Plan: FAST_PROFILE_MODELS.sol,
10993
+ "general-purpose": FAST_PROFILE_MODELS.luna,
10994
+ implementer: FAST_PROFILE_MODELS.gemini,
10995
+ reviewer: FAST_PROFILE_MODELS.reviewer
10944
10996
  });
10945
10997
  Object.freeze({
10946
10998
  Explore: "high",
10947
- implementer: "max",
10948
- reviewer: "medium",
10949
- planner: "high",
10950
- critic: "medium"
10999
+ Plan: "high",
11000
+ "general-purpose": "max",
11001
+ implementer: "high",
11002
+ reviewer: "medium"
10951
11003
  });
10952
- FAST_PROFILE_ADVISOR_MODEL = FAST_PROFILE_MODELS.critic;
11004
+ FAST_PROFILE_ADVISOR_MODEL = FAST_PROFILE_MODELS.advisor;
10953
11005
  `${FAST_PROFILE_ADVISOR_MODEL}`;
10954
11006
  FAST_PROFILE_MODELS.oracle;
10955
11007
  FAST_PROFILE_DELEGATION_GRAPH = Object.freeze({
10956
11008
  Explore: Object.freeze([]),
10957
- implementer: Object.freeze(["reviewer", "critic"]),
10958
- reviewer: Object.freeze([]),
10959
- planner: Object.freeze([
10960
- "reviewer",
10961
- "Explore",
10962
- "critic"
10963
- ]),
10964
- critic: Object.freeze([])
11009
+ Plan: Object.freeze(["Explore", "reviewer"]),
11010
+ "general-purpose": Object.freeze(["reviewer"]),
11011
+ implementer: Object.freeze(["reviewer"]),
11012
+ reviewer: Object.freeze([])
11013
+ });
11014
+ })), MAX_PROFILE_MODELS, MAX_PROFILE_NATIVE_AGENT_NAMES, MAX_PROFILE_NATIVE_MODELS;
11015
+ var init_max_profile_contract = __esmMin((() => {
11016
+ init_state();
11017
+ MAX_PROFILE_MODELS = Object.freeze({
11018
+ sol: "gpt-5.6-sol",
11019
+ luna: "gpt-5.6-luna",
11020
+ gemini: "gemini-3.7-flash",
11021
+ grok: "grok-4.6",
11022
+ opus: "claude-opus-5"
11023
+ });
11024
+ MAX_PROFILE_NATIVE_AGENT_NAMES = [
11025
+ "Explore",
11026
+ "Plan",
11027
+ "general-purpose",
11028
+ "implementer",
11029
+ "reviewer",
11030
+ "brainstorm",
11031
+ "peer-review-coordinator"
11032
+ ];
11033
+ Object.freeze({
11034
+ Explore: "high",
11035
+ Plan: "high",
11036
+ "general-purpose": "max",
11037
+ implementer: "high",
11038
+ reviewer: "high",
11039
+ brainstorm: "medium",
11040
+ "peer-review-coordinator": "max"
11041
+ });
11042
+ MAX_PROFILE_NATIVE_MODELS = Object.freeze({
11043
+ Explore: MAX_PROFILE_MODELS.luna,
11044
+ Plan: MAX_PROFILE_MODELS.sol,
11045
+ "general-purpose": MAX_PROFILE_MODELS.luna,
11046
+ implementer: MAX_PROFILE_MODELS.gemini,
11047
+ reviewer: MAX_PROFILE_MODELS.grok,
11048
+ brainstorm: MAX_PROFILE_MODELS.grok,
11049
+ "peer-review-coordinator": MAX_PROFILE_MODELS.luna
10965
11050
  });
11051
+ MAX_PROFILE_MODELS.sol;
11052
+ MAX_PROFILE_MODELS.opus;
11053
+ Object.freeze([
11054
+ MAX_PROFILE_MODELS.luna,
11055
+ MAX_PROFILE_MODELS.gemini,
11056
+ MAX_PROFILE_MODELS.grok
11057
+ ]);
11058
+ Object.freeze([
11059
+ MAX_PROFILE_MODELS.sol,
11060
+ MAX_PROFILE_MODELS.luna,
11061
+ MAX_PROFILE_MODELS.gemini,
11062
+ MAX_PROFILE_MODELS.opus
11063
+ ]);
10966
11064
  }));
10967
11065
  //#endregion
10968
11066
  //#region node_modules/undici/lib/core/symbols.js
@@ -37773,7 +37871,7 @@ var internal_first_mate_guard_exports = /* @__PURE__ */ __exportAll({
37773
37871
  buildFirstMateGuardHookCommand: () => buildFirstMateGuardHookCommand,
37774
37872
  internalFirstMateGuard: () => internalFirstMateGuard
37775
37873
  });
37776
- function readStdinSync$1() {
37874
+ function readStdinSync$2() {
37777
37875
  try {
37778
37876
  return readFileSync(0, "utf8");
37779
37877
  } catch {
@@ -37799,7 +37897,7 @@ var init_internal_first_mate_guard = __esmMin((() => {
37799
37897
  let hookInput;
37800
37898
  let parsed;
37801
37899
  try {
37802
- const payload = JSON.parse(readStdinSync$1());
37900
+ const payload = JSON.parse(readStdinSync$2());
37803
37901
  if (typeof payload.tool_name === "string") toolName = payload.tool_name;
37804
37902
  if (typeof payload.agent_type === "string") hookInput = { agent_type: payload.agent_type };
37805
37903
  parsed = true;
@@ -37932,7 +38030,7 @@ function deny(reason, target, caller) {
37932
38030
  * ordinary-tool hook therefore passes through, while a recognized Task/Agent
37933
38031
  * dispatch fails closed on malformed input or identity.
37934
38032
  */
37935
- function decideFastDispatchGuard(stdin) {
38033
+ function decideFastDispatchGuard(stdin, opts) {
37936
38034
  let parsed;
37937
38035
  try {
37938
38036
  parsed = typeof stdin === "string" ? JSON.parse(stdin) : stdin;
@@ -37948,13 +38046,19 @@ function decideFastDispatchGuard(stdin) {
37948
38046
  verdict: "allow-non-dispatch"
37949
38047
  };
37950
38048
  if (!payload.tool_input || typeof payload.tool_input !== "object" || Array.isArray(payload.tool_input)) return deny(`fast dispatch denied: ${toolName} payload has malformed tool_input`);
37951
- const targetResult = resolveAliasedString(payload.tool_input, ["subagent_type", "subagentType"]);
38049
+ const toolInput = payload.tool_input;
38050
+ for (const field of CONTINUATION_FIELDS) if (hasOwn(toolInput, field)) {
38051
+ const val = toolInput[field];
38052
+ if (val !== void 0 && val !== null && val !== false) return deny(`fast dispatch denied: ${toolName} continuation/reattachment (${field}) is not permitted in fast profile`);
38053
+ }
38054
+ const targetResult = resolveAliasedString(toolInput, ["subagent_type", "subagentType"]);
37952
38055
  if (targetResult.malformed) return deny(`fast dispatch denied: ${toolName} target identity is malformed`);
37953
38056
  if (targetResult.conflict) return deny(`fast dispatch denied: ${toolName} target aliases conflict`);
37954
38057
  const targetValue = targetResult.value;
37955
- if (!targetValue || !FAST_NATIVE_AGENT_SET.has(targetValue)) return deny(`fast dispatch denied: ${toolName} target must be one of ${FAST_NATIVE_AGENT_NAMES.join(", ")}`);
38058
+ const effectiveAllowedTargets = opts?.allowedTargets ? new Set(opts.allowedTargets) : /* @__PURE__ */ new Set([...FAST_NATIVE_AGENT_NAMES, ...opts?.allowBrowse ? [FAST_BROWSE_DISPATCH_AGENT] : []]);
38059
+ if (!targetValue || !effectiveAllowedTargets.has(targetValue)) return deny(`fast dispatch denied: ${toolName} target must be one of ${[...effectiveAllowedTargets].join(", ")}`);
37956
38060
  const target = targetValue;
37957
- const updatedInput = { ...payload.tool_input };
38061
+ const updatedInput = { ...toolInput };
37958
38062
  delete updatedInput.model;
37959
38063
  const callerType = resolveAliasedString(payload, ["agent_type", "agentType"]);
37960
38064
  const callerId = resolveAliasedString(payload, ["agent_id", "agentId"]);
@@ -37982,9 +38086,9 @@ function decideFastDispatchGuard(stdin) {
37982
38086
  verdict: "allow"
37983
38087
  };
37984
38088
  }
37985
- if (!FAST_NATIVE_AGENT_SET.has(callerTypeValue)) return deny(`fast dispatch denied: unknown caller role ${JSON.stringify(callerTypeValue)}`, target);
38089
+ if (!(/* @__PURE__ */ new Set([...FAST_NATIVE_AGENT_NAMES, "worker-browse"])).has(callerTypeValue)) return deny(`fast dispatch denied: unknown caller role ${JSON.stringify(callerTypeValue)}`, target);
37986
38090
  const caller = callerTypeValue;
37987
- if (!FAST_DISPATCH_GRAPH[caller].has(target)) return deny(`fast dispatch denied: ${caller} cannot invoke ${target}`, target, caller);
38091
+ if (!(FAST_DISPATCH_GRAPH[caller] ?? /* @__PURE__ */ new Set()).has(target)) return deny(`fast dispatch denied: ${caller} cannot invoke ${target}`, target, caller);
37988
38092
  return {
37989
38093
  allowed: true,
37990
38094
  caller,
@@ -38009,18 +38113,44 @@ function fastDispatchDenyOutput(reason) {
38009
38113
  permissionDecisionReason: reason
38010
38114
  } });
38011
38115
  }
38012
- var FAST_NATIVE_AGENT_NAMES, FAST_NATIVE_AGENT_SET, FAST_DISPATCH_GRAPH;
38116
+ var FAST_BROWSE_DISPATCH_AGENT, FAST_NATIVE_AGENT_NAMES, FAST_DISPATCH_GRAPH, CONTINUATION_FIELDS;
38013
38117
  var init_fast_dispatch_acl = __esmMin((() => {
38014
38118
  init_fast_profile_contract();
38119
+ FAST_BROWSE_DISPATCH_AGENT = "worker-browse";
38015
38120
  FAST_NATIVE_AGENT_NAMES = FAST_PROFILE_NATIVE_AGENT_NAMES;
38016
- FAST_NATIVE_AGENT_SET = new Set(FAST_NATIVE_AGENT_NAMES);
38121
+ new Set(FAST_NATIVE_AGENT_NAMES);
38017
38122
  FAST_DISPATCH_GRAPH = Object.freeze({
38018
38123
  Explore: new Set(FAST_PROFILE_DELEGATION_GRAPH.Explore),
38124
+ Plan: new Set(FAST_PROFILE_DELEGATION_GRAPH.Plan),
38125
+ "general-purpose": new Set(FAST_PROFILE_DELEGATION_GRAPH["general-purpose"]),
38019
38126
  implementer: new Set(FAST_PROFILE_DELEGATION_GRAPH.implementer),
38020
38127
  reviewer: new Set(FAST_PROFILE_DELEGATION_GRAPH.reviewer),
38021
- planner: new Set(FAST_PROFILE_DELEGATION_GRAPH.planner),
38022
- critic: new Set(FAST_PROFILE_DELEGATION_GRAPH.critic)
38128
+ "worker-browse": /* @__PURE__ */ new Set([])
38023
38129
  });
38130
+ CONTINUATION_FIELDS = [
38131
+ "resume",
38132
+ "resume_session",
38133
+ "resumeSession",
38134
+ "resume_agent_id",
38135
+ "resumeAgentId",
38136
+ "continuation",
38137
+ "continue",
38138
+ "continue_session",
38139
+ "continueSession",
38140
+ "agent_id",
38141
+ "agentId",
38142
+ "session_id",
38143
+ "sessionId",
38144
+ "thread_id",
38145
+ "threadId",
38146
+ "task_id",
38147
+ "taskId",
38148
+ "target_agent_id",
38149
+ "targetAgentId",
38150
+ "reattach",
38151
+ "reattach_session",
38152
+ "reattachSession"
38153
+ ];
38024
38154
  }));
38025
38155
  //#endregion
38026
38156
  //#region src/internal-fast-dispatch-guard.ts
@@ -38028,7 +38158,7 @@ var internal_fast_dispatch_guard_exports = /* @__PURE__ */ __exportAll({
38028
38158
  buildFastDispatchGuardHookCommand: () => buildFastDispatchGuardHookCommand,
38029
38159
  internalFastDispatchGuard: () => internalFastDispatchGuard
38030
38160
  });
38031
- function readStdinSync() {
38161
+ function readStdinSync$1() {
38032
38162
  try {
38033
38163
  if (process.stdin.isTTY) return "";
38034
38164
  return readFileSync(0, "utf8");
@@ -38037,8 +38167,11 @@ function readStdinSync() {
38037
38167
  }
38038
38168
  }
38039
38169
  /** Build the persisted command for the fast-profile PreToolUse hook. */
38040
- function buildFastDispatchGuardHookCommand(invocation) {
38041
- return buildSelfCommand(invocation, "internal-fast-dispatch-guard");
38170
+ function buildFastDispatchGuardHookCommand(invocation, opts) {
38171
+ const flags = [];
38172
+ if (opts?.allowBrowse) flags.push("--allowBrowse");
38173
+ if (opts?.allowedTargets && opts.allowedTargets.length > 0) flags.push(`--allowedTargets "${opts.allowedTargets.join(",")}"`);
38174
+ return buildSelfCommand(invocation, ["internal-fast-dispatch-guard", ...flags].join(" "));
38042
38175
  }
38043
38176
  var internalFastDispatchGuard;
38044
38177
  var init_internal_fast_dispatch_guard = __esmMin((() => {
@@ -38050,8 +38183,24 @@ var init_internal_fast_dispatch_guard = __esmMin((() => {
38050
38183
  name: "internal-fast-dispatch-guard",
38051
38184
  description: "Internal: PreToolUse guard enforcing the fast-profile native Task/Agent ACL."
38052
38185
  },
38053
- run() {
38054
- const decision = decideFastDispatchGuard(readStdinSync());
38186
+ args: {
38187
+ allowBrowse: {
38188
+ type: "boolean",
38189
+ description: "Whether worker-browse is allowed as a target.",
38190
+ default: false
38191
+ },
38192
+ allowedTargets: {
38193
+ type: "string",
38194
+ description: "Comma-separated list of allowed target subagents."
38195
+ }
38196
+ },
38197
+ run({ args }) {
38198
+ const allowedTargets = args.allowedTargets ? args.allowedTargets.split(",").map((s) => s.trim()).filter(Boolean) : void 0;
38199
+ const allowBrowse = args.allowBrowse === true || (allowedTargets ? allowedTargets.includes("worker-browse") : false);
38200
+ const decision = decideFastDispatchGuard(readStdinSync$1(), {
38201
+ allowedTargets,
38202
+ allowBrowse
38203
+ });
38055
38204
  if (!decision.allowed && decision.reason) process.stdout.write(fastDispatchDenyOutput(decision.reason));
38056
38205
  else if (decision.verdict === "allow" && decision.updatedInput) process.stdout.write(fastDispatchAllowOutput(decision.updatedInput));
38057
38206
  process.exitCode = 0;
@@ -38059,6 +38208,209 @@ var init_internal_fast_dispatch_guard = __esmMin((() => {
38059
38208
  });
38060
38209
  }));
38061
38210
  //#endregion
38211
+ //#region src/lib/max-dispatch-acl.ts
38212
+ function isMaxAgentSchemaModelAlias(model) {
38213
+ if (typeof model !== "string") return false;
38214
+ return MAX_AGENT_SCHEMA_MODEL_ALIAS_SET.has(baseModel(model.trim()).toLowerCase());
38215
+ }
38216
+ function stringField(input, ...keys) {
38217
+ const values = keys.filter((key) => Object.prototype.hasOwnProperty.call(input, key)).map((key) => input[key]).filter((value) => value !== void 0 && value !== null);
38218
+ if (values.length === 0) return void 0;
38219
+ if (values.some((value) => typeof value !== "string" || value.trim().length === 0)) return void 0;
38220
+ const distinct = [...new Set(values.map((value) => value.trim()))];
38221
+ return distinct.length === 1 ? distinct[0] : void 0;
38222
+ }
38223
+ function baseModel(model) {
38224
+ return model.replace(/(?:\[1m\])+$/i, "");
38225
+ }
38226
+ function normalizeMaxDispatchModel(model) {
38227
+ if (typeof model !== "string" || model.trim().length === 0) return void 0;
38228
+ const base = baseModel(model.trim());
38229
+ return MAX_ALLOWED_MODEL_BASES.has(base) ? base === "grok-4.6" ? base : `${base}[1m]` : void 0;
38230
+ }
38231
+ function normalizeMaxDispatchEffort(model, effort) {
38232
+ if (effort === void 0 || effort === null) return void 0;
38233
+ if (typeof effort !== "string") return void 0;
38234
+ if ((model === "gpt-5.6-sol" ? [
38235
+ "high",
38236
+ "xhigh",
38237
+ "max"
38238
+ ] : model === "gpt-5.6-luna" ? [
38239
+ "none",
38240
+ "low",
38241
+ "medium",
38242
+ "high",
38243
+ "xhigh",
38244
+ "max"
38245
+ ] : model === "grok-4.6" || model === "gemini-3.7-flash" ? [
38246
+ "low",
38247
+ "medium",
38248
+ "high"
38249
+ ] : []).includes(effort)) return effort;
38250
+ }
38251
+ /**
38252
+ * Native max Task/Agent ACL. Role frontmatter owns the fixed model. Required
38253
+ * public-schema aliases are stripped as transport placeholders; a client that
38254
+ * can express custom ids may override only to Luna, Gemini, or Grok with a
38255
+ * live-ladder effort. Sol/Codex/unknown/private ids are rejected. The lead may
38256
+ * target any emitted max role; role-to-role edges are unrestricted here.
38257
+ */
38258
+ function decideMaxDispatchGuard(stdin, opts = {}) {
38259
+ let parsed;
38260
+ try {
38261
+ parsed = typeof stdin === "string" ? JSON.parse(stdin) : stdin;
38262
+ } catch {
38263
+ return {
38264
+ allowed: false,
38265
+ reason: "max dispatch denied: malformed hook payload",
38266
+ verdict: "deny"
38267
+ };
38268
+ }
38269
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return {
38270
+ allowed: false,
38271
+ reason: "max dispatch denied: hook payload must be an object",
38272
+ verdict: "deny"
38273
+ };
38274
+ const payload = parsed;
38275
+ if (typeof payload.tool_name !== "string") return {
38276
+ allowed: false,
38277
+ reason: "max dispatch denied: hook payload has no tool_name",
38278
+ verdict: "deny"
38279
+ };
38280
+ if (!/^(Task|Agent)$/.test(payload.tool_name)) return {
38281
+ allowed: true,
38282
+ verdict: "allow-non-dispatch"
38283
+ };
38284
+ if (!payload.tool_input || typeof payload.tool_input !== "object" || Array.isArray(payload.tool_input)) return {
38285
+ allowed: false,
38286
+ reason: `max dispatch denied: ${payload.tool_name} payload has malformed tool_input`,
38287
+ verdict: "deny"
38288
+ };
38289
+ const toolInput = payload.tool_input;
38290
+ const target = stringField(toolInput, "subagent_type", "subagentType");
38291
+ if (!target || !MAX_NATIVE_AGENT_SET.has(target)) return {
38292
+ allowed: false,
38293
+ reason: `max dispatch denied: target must be one of ${[...MAX_PROFILE_NATIVE_AGENT_NAMES, MAX_BROWSE_DISPATCH_AGENT].join(", ")}`,
38294
+ verdict: "deny"
38295
+ };
38296
+ const nativeTarget = target;
38297
+ const modelValue = toolInput.model;
38298
+ const schemaAlias = isMaxAgentSchemaModelAlias(modelValue);
38299
+ const normalizedModel = modelValue === void 0 || schemaAlias ? void 0 : normalizeMaxDispatchModel(modelValue);
38300
+ if (modelValue !== void 0 && !schemaAlias && !normalizedModel) return {
38301
+ allowed: false,
38302
+ reason: "max dispatch denied: model must be a Claude Code Agent schema alias, Luna[1m], Gemini 3.7 Flash[1m], or bare Grok 4.6",
38303
+ target,
38304
+ verdict: "deny"
38305
+ };
38306
+ const requestedEffort = toolInput.thinking ?? toolInput.effort;
38307
+ const effort = normalizeMaxDispatchEffort(normalizedModel ? baseModel(normalizedModel) : nativeTarget === "worker-browse" ? "gpt-5.6-luna" : nativeTarget === "reviewer" && opts.reviewerModel ? baseModel(opts.reviewerModel) : MAX_PROFILE_NATIVE_MODELS[nativeTarget], requestedEffort);
38308
+ if ((toolInput.thinking !== void 0 || toolInput.effort !== void 0) && !effort) return {
38309
+ allowed: false,
38310
+ reason: "max dispatch denied: reasoning override is not supported by the selected model",
38311
+ target,
38312
+ verdict: "deny"
38313
+ };
38314
+ const effectiveEffort = (nativeTarget === "reviewer" && !normalizedModel && opts.reviewerModel ? opts.reviewerEffort ?? (baseModel(opts.reviewerModel) === "gpt-5.6-luna" ? "max" : "high") : void 0) ?? effort;
38315
+ const updatedInput = { ...toolInput };
38316
+ if (normalizedModel) updatedInput.model = normalizedModel;
38317
+ else delete updatedInput.model;
38318
+ if (effectiveEffort) if (toolInput.thinking !== void 0) updatedInput.thinking = effectiveEffort;
38319
+ else updatedInput.effort = effectiveEffort;
38320
+ if (toolInput.thinking !== void 0 && toolInput.effort !== void 0) delete updatedInput.effort;
38321
+ if (toolInput.model === void 0 && normalizedModel === void 0) delete updatedInput.model;
38322
+ return {
38323
+ allowed: true,
38324
+ target,
38325
+ effort: effectiveEffort,
38326
+ updatedInput,
38327
+ verdict: "allow"
38328
+ };
38329
+ }
38330
+ function maxDispatchAllowOutput(updatedInput) {
38331
+ return JSON.stringify({ hookSpecificOutput: {
38332
+ hookEventName: "PreToolUse",
38333
+ permissionDecision: "allow",
38334
+ updatedInput
38335
+ } });
38336
+ }
38337
+ function maxDispatchDenyOutput(reason) {
38338
+ return JSON.stringify({ hookSpecificOutput: {
38339
+ hookEventName: "PreToolUse",
38340
+ permissionDecision: "deny",
38341
+ permissionDecisionReason: reason
38342
+ } });
38343
+ }
38344
+ var MAX_BROWSE_DISPATCH_AGENT, MAX_NATIVE_AGENT_SET, MAX_ALLOWED_MODEL_BASES, MAX_AGENT_SCHEMA_MODEL_ALIASES, MAX_AGENT_SCHEMA_MODEL_ALIAS_SET;
38345
+ var init_max_dispatch_acl = __esmMin((() => {
38346
+ init_max_profile_contract();
38347
+ MAX_BROWSE_DISPATCH_AGENT = "worker-browse";
38348
+ MAX_NATIVE_AGENT_SET = /* @__PURE__ */ new Set([...MAX_PROFILE_NATIVE_AGENT_NAMES, MAX_BROWSE_DISPATCH_AGENT]);
38349
+ MAX_ALLOWED_MODEL_BASES = /* @__PURE__ */ new Set([
38350
+ "gpt-5.6-luna",
38351
+ "gemini-3.7-flash",
38352
+ "grok-4.6"
38353
+ ]);
38354
+ MAX_AGENT_SCHEMA_MODEL_ALIASES = Object.freeze([
38355
+ "sonnet",
38356
+ "opus",
38357
+ "haiku",
38358
+ "fable"
38359
+ ]);
38360
+ MAX_AGENT_SCHEMA_MODEL_ALIAS_SET = new Set(MAX_AGENT_SCHEMA_MODEL_ALIASES);
38361
+ }));
38362
+ //#endregion
38363
+ //#region src/internal-max-dispatch-guard.ts
38364
+ var internal_max_dispatch_guard_exports = /* @__PURE__ */ __exportAll({
38365
+ buildMaxDispatchGuardHookCommand: () => buildMaxDispatchGuardHookCommand,
38366
+ internalMaxDispatchGuard: () => internalMaxDispatchGuard
38367
+ });
38368
+ function readStdinSync() {
38369
+ try {
38370
+ if (process.stdin.isTTY) return "";
38371
+ return readFileSync(0, "utf8");
38372
+ } catch {
38373
+ return "";
38374
+ }
38375
+ }
38376
+ function buildMaxDispatchGuardHookCommand(invocation, opts = {}) {
38377
+ const flags = [];
38378
+ if (opts.reviewerModel) flags.push(`--reviewerModel "${opts.reviewerModel}"`);
38379
+ if (opts.reviewerEffort) flags.push(`--reviewerEffort ${opts.reviewerEffort}`);
38380
+ return buildSelfCommand(invocation, ["internal-max-dispatch-guard", ...flags].join(" "));
38381
+ }
38382
+ var internalMaxDispatchGuard;
38383
+ var init_internal_max_dispatch_guard = __esmMin((() => {
38384
+ init_dist$1();
38385
+ init_max_dispatch_acl();
38386
+ init_self_invocation();
38387
+ internalMaxDispatchGuard = defineCommand({
38388
+ meta: {
38389
+ name: "internal-max-dispatch-guard",
38390
+ description: "Internal: PreToolUse guard enforcing the max-profile native Task/Agent policy."
38391
+ },
38392
+ args: {
38393
+ reviewerModel: {
38394
+ type: "string",
38395
+ description: "Catalog-resolved Max reviewer model for this launch."
38396
+ },
38397
+ reviewerEffort: {
38398
+ type: "string",
38399
+ description: "Fixed Max reviewer effort for this launch."
38400
+ }
38401
+ },
38402
+ run({ args }) {
38403
+ const decision = decideMaxDispatchGuard(readStdinSync(), {
38404
+ reviewerModel: args.reviewerModel,
38405
+ reviewerEffort: args.reviewerEffort === "max" ? "max" : "high"
38406
+ });
38407
+ if (!decision.allowed && decision.reason) process.stdout.write(maxDispatchDenyOutput(decision.reason));
38408
+ else if (decision.verdict === "allow" && decision.updatedInput) process.stdout.write(maxDispatchAllowOutput(decision.updatedInput));
38409
+ process.exitCode = 0;
38410
+ }
38411
+ });
38412
+ }));
38413
+ //#endregion
38062
38414
  //#region src/hooks.ts
38063
38415
  init_dist$1();
38064
38416
  init_dist();
@@ -38088,7 +38440,8 @@ await runMain(defineCommand({
38088
38440
  "internal-artifact-open": () => Promise.resolve().then(() => (init_internal_artifact_open(), internal_artifact_open_exports)).then((m) => m.internalArtifactOpen),
38089
38441
  "internal-first-mate-guard": () => Promise.resolve().then(() => (init_internal_first_mate_guard(), internal_first_mate_guard_exports)).then((m) => m.internalFirstMateGuard),
38090
38442
  "internal-worker-guard": () => Promise.resolve().then(() => (init_internal_worker_guard(), internal_worker_guard_exports)).then((m) => m.internalWorkerGuard),
38091
- "internal-fast-dispatch-guard": () => Promise.resolve().then(() => (init_internal_fast_dispatch_guard(), internal_fast_dispatch_guard_exports)).then((m) => m.internalFastDispatchGuard)
38443
+ "internal-fast-dispatch-guard": () => Promise.resolve().then(() => (init_internal_fast_dispatch_guard(), internal_fast_dispatch_guard_exports)).then((m) => m.internalFastDispatchGuard),
38444
+ "internal-max-dispatch-guard": () => Promise.resolve().then(() => (init_internal_max_dispatch_guard(), internal_max_dispatch_guard_exports)).then((m) => m.internalMaxDispatchGuard)
38092
38445
  }
38093
38446
  }), { rawArgs: argv });
38094
38447
  //#endregion
package/dist/hooks.sha256 CHANGED
@@ -1 +1 @@
1
- c04dc9bea5da9812a46182da6c555cbfac40b3fb549aa28f16046ca72f2ecd36
1
+ d50ce1714ea8a0b817f63de404f710f29c3bb7956f90a7b0aa765917648abd00
@@ -1,5 +1,5 @@
1
1
  import { t as ArtifactClient } from "./client-CQMfroGV.js";
2
- import { a as isSubagentContext } from "./stop-gate-policy-DMr3KVmw.js";
2
+ import { a as isSubagentContext } from "./stop-gate-policy-zhzRIj6G.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-D6tKMg8v.js.map
319
+ //# sourceMappingURL=internal-artifact-open-DRSxShAW.js.map