@event4u/agent-config 17.0.0 → 17.2.0

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 (164) hide show
  1. package/.augment-plugin/marketplace.json +3 -3
  2. package/.augment-plugin/plugin.json +1 -1
  3. package/.claude-plugin/marketplace.json +1 -1
  4. package/CHANGELOG.md +157 -468
  5. package/README.md +4 -3
  6. package/dist/agent-src/commands/project/analyze.md +9 -6
  7. package/dist/agent-src/commands/project/map.md +58 -0
  8. package/dist/agent-src/commands/project.md +5 -3
  9. package/dist/agent-src/contexts/execution/host-capability-manifest.md +5 -3
  10. package/dist/agent-src/skills/code-intelligence/SKILL.md +6 -0
  11. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  12. package/dist/agent-src/templates/roadmaps.md +5 -1
  13. package/dist/cli/registry.js +1 -1
  14. package/dist/cli-delegate/{chunk-IROAQ77A.js → chunk-3PK3VZHB.js} +107 -9
  15. package/dist/cli-delegate/{chunk-2SFOOFJJ.js → chunk-BZJ4Y3CI.js} +1 -1
  16. package/dist/cli-delegate/{chunk-CAL76ADI.js → chunk-CMZEKSNN.js} +52 -10
  17. package/dist/cli-delegate/{chunk-ESUNQ5XR.js → chunk-E3CFULNX.js} +22 -4
  18. package/dist/cli-delegate/{chunk-GOMILC3O.js → chunk-QBHEI5N4.js} +4 -3
  19. package/dist/cli-delegate/{chunk-SIOMDAKL.js → chunk-VYZGJLCA.js} +29 -39
  20. package/dist/cli-delegate/chunk-W5JXMF2T.js +77 -0
  21. package/dist/cli-delegate/{chunk-4SHNERBL.js → chunk-XIAPY44N.js} +1 -1
  22. package/dist/cli-delegate/{chunk-JHMMWNJ2.js → chunk-YHAPONWV.js} +1 -1
  23. package/dist/cli-delegate/cmd_conformance.js +32 -47
  24. package/dist/cli-delegate/cmd_doctor.js +4 -4
  25. package/dist/cli-delegate/cmd_doctor_neighbours.js +2 -2
  26. package/dist/cli-delegate/cmd_explain.js +1 -1
  27. package/dist/cli-delegate/cmd_export.js +6 -6
  28. package/dist/cli-delegate/cmd_fleet.js +3 -3
  29. package/dist/cli-delegate/cmd_preflight.js +3 -3
  30. package/dist/cli-delegate/cmd_prune.js +6 -6
  31. package/dist/cli-delegate/cmd_settings_migrate.js +6 -6
  32. package/dist/cli-delegate/cmd_settings_set.js +1 -1
  33. package/dist/cli-delegate/cmd_sync.js +6 -6
  34. package/dist/cli-delegate/cmd_uninstall.js +6 -6
  35. package/dist/cli-delegate/cmd_update.js +9 -13
  36. package/dist/cli-delegate/cmd_validate.js +6 -6
  37. package/dist/discovery/deprecation-report.md +1 -1
  38. package/dist/discovery/discovery-manifest.json +41 -15
  39. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  40. package/dist/discovery/discovery-manifest.summary.md +3 -3
  41. package/dist/discovery/dormancy-report.md +1 -1
  42. package/dist/discovery/orphan-report.md +1 -1
  43. package/dist/discovery/packs.json +6 -5
  44. package/dist/discovery/trust-report.md +2 -2
  45. package/dist/discovery/workspaces.json +5 -4
  46. package/dist/hooks/dispatch.js +163 -148
  47. package/dist/hooks/dispatch.sha256 +1 -1
  48. package/dist/hooks/instructions_observer.chunk.cjs +301 -0
  49. package/dist/hooks/instructions_observer.chunk.cjs.sha256 +1 -0
  50. package/dist/install/claudeRuleRewrite.js +10 -3
  51. package/dist/install/conflict.js +24 -2
  52. package/dist/install/conflictTracker.js +14 -3
  53. package/dist/install/install.mjs +222 -117
  54. package/dist/install/installThinLayer.js +1 -0
  55. package/dist/install/loggedWrites.js +142 -0
  56. package/dist/install/paths.js +12 -2
  57. package/dist/install/preserve.js +25 -4
  58. package/dist/install/txlog.js +10 -6
  59. package/dist/mcp/registry-manifest.json +3 -3
  60. package/dist/mcp/server.json +2 -2
  61. package/dist/mcp/server.mjs +33595 -22916
  62. package/dist/scripts/_lib/egress_rules.js +4 -1
  63. package/dist/scripts/_lib/identifier_redaction.js +35 -2
  64. package/dist/scripts/ai_council/seat_policy.js +7 -1
  65. package/dist/server/schemas/settings.js +1 -1
  66. package/package.json +4 -1
  67. package/src/config/ci-local-parity.yml +1 -1
  68. package/src/config/continuity-surface.json +7 -0
  69. package/src/config/evaluator-budgets.json +4 -4
  70. package/src/config/gate-coverage.yml +27 -7
  71. package/src/config/gate-violation-baselines.json +9 -3
  72. package/src/config/gitignore-block.txt +6 -0
  73. package/src/config/hook-bundle-budget.json +19 -4
  74. package/src/config/hook-token-budget.json +1 -1
  75. package/src/config/packed-binary-manifest.json +27 -0
  76. package/src/config/production-entries.json +18 -0
  77. package/src/config/release-gate-locality.yml +0 -7
  78. package/src/config/skill-body-budget.json +7 -1
  79. package/src/install/claudeRuleRewrite.ts +10 -1
  80. package/src/install/conflict.ts +24 -1
  81. package/src/install/conflictTracker.ts +18 -2
  82. package/src/install/installThinLayer.ts +6 -0
  83. package/src/install/loggedWrites.ts +148 -0
  84. package/src/install/paths.ts +11 -2
  85. package/src/install/preserve.ts +40 -4
  86. package/src/install/txlog.ts +10 -6
  87. package/src/scripts/_cli/cmd_conformance.ts +3 -2
  88. package/src/scripts/_cli/cmd_update.ts +15 -17
  89. package/src/scripts/_lib/bench_ab_complexity.ts +14 -2
  90. package/src/scripts/_lib/collector_record.ts +1 -0
  91. package/src/scripts/_lib/council_settings_block.ts +9 -2
  92. package/src/scripts/_lib/egress_rules.ts +4 -1
  93. package/src/scripts/_lib/host_capability.ts +10 -5
  94. package/src/scripts/_lib/identifier_redaction.ts +38 -2
  95. package/src/scripts/_lib/price_freshness.ts +112 -0
  96. package/src/scripts/_lib/production_reach.ts +194 -0
  97. package/src/scripts/_lib/quota_parked.ts +17 -28
  98. package/src/scripts/_lib/release_findings_ingest.ts +13 -335
  99. package/src/scripts/_lib/runtime_journal.ts +7 -7
  100. package/src/scripts/_lib/tier_downshift_verdict.ts +81 -35
  101. package/src/scripts/ai_council/chairman.ts +5 -2
  102. package/src/scripts/ai_council/clients.ts +4 -3
  103. package/src/scripts/ai_council/free_hand_shadow.ts +24 -12
  104. package/src/scripts/ai_council/free_route_catalog.ts +142 -5
  105. package/src/scripts/ai_council/free_route_client.ts +4 -0
  106. package/src/scripts/ai_council/hand_payload.ts +115 -7
  107. package/src/scripts/ai_council/orchestrator.ts +7 -10
  108. package/src/scripts/ai_council/route_chooser.ts +1 -1
  109. package/src/scripts/ai_council/route_member.ts +66 -4
  110. package/src/scripts/ai_council/seat_policy.ts +8 -1
  111. package/src/scripts/ai_council/self_hosted_probe.ts +327 -0
  112. package/src/scripts/ai_council/status_surface.ts +2 -0
  113. package/src/scripts/ask_transport.ts +137 -15
  114. package/src/scripts/check_finding_dispositions.ts +25 -71
  115. package/src/scripts/check_release_pr_shape.ts +3 -3
  116. package/src/scripts/check_step_production_reach.ts +257 -0
  117. package/src/scripts/code_graph/build.ts +210 -10
  118. package/src/scripts/code_graph/cli.ts +168 -46
  119. package/src/scripts/code_graph/detect.ts +5 -4
  120. package/src/scripts/code_graph/docs_layer.ts +57 -0
  121. package/src/scripts/code_graph/extract.ts +58 -13
  122. package/src/scripts/code_graph/extract_more.ts +314 -0
  123. package/src/scripts/code_graph/laravel_overlay.ts +454 -0
  124. package/src/scripts/code_graph/map.ts +846 -0
  125. package/src/scripts/code_graph/map_model.ts +977 -0
  126. package/src/scripts/code_graph/map_verify.ts +140 -0
  127. package/src/scripts/code_graph/map_viewer/viewer.css +278 -0
  128. package/src/scripts/code_graph/map_viewer/viewer.js +756 -0
  129. package/src/scripts/code_graph/scip_reader.ts +201 -0
  130. package/src/scripts/code_graph/sqlite_store.ts +8 -1
  131. package/src/scripts/code_graph/types.ts +81 -15
  132. package/src/scripts/code_graph/validate.ts +16 -26
  133. package/src/scripts/code_graph/verbs.ts +7 -0
  134. package/src/scripts/council_cli.ts +10 -8
  135. package/src/scripts/hook_chunks.mjs +7 -0
  136. package/src/scripts/hook_manifest.json +1 -1
  137. package/src/scripts/hook_manifest.yaml +23 -0
  138. package/src/scripts/hooks/dispatch_hook.ts +4 -4
  139. package/src/scripts/hooks/instructions_observer_hook.ts +25 -6
  140. package/src/scripts/hooks/lazy_concern.ts +4 -0
  141. package/src/scripts/hooks/payload_stub.ts +27 -0
  142. package/src/scripts/hooks/spawn_guard_shadow_hook.ts +29 -70
  143. package/src/scripts/hooks/subagent_ledger_hook.ts +80 -0
  144. package/src/scripts/install-hooks.sh +5 -0
  145. package/src/scripts/install.ts +2 -2
  146. package/src/scripts/lint_agents_layout.ts +2 -0
  147. package/src/scripts/lint_decision_classes.ts +34 -0
  148. package/src/scripts/lint_hook_manifest.ts +25 -0
  149. package/src/scripts/lint_roadmap_blockers.ts +52 -3
  150. package/src/scripts/mcp_server/consumer_tool_catalog.json +53 -6
  151. package/src/scripts/mcp_server/graph_tools.ts +73 -1
  152. package/src/scripts/mcp_server/tools.ts +19 -36
  153. package/src/scripts/release.ts +5 -9
  154. package/src/scripts/release_drill.ts +11 -165
  155. package/src/scripts/release_publication.ts +0 -9
  156. package/src/scripts/report_production_reach.ts +35 -0
  157. package/src/scripts/worker_reuse_shadow_report.ts +399 -1
  158. package/src/server/schemas/settings.ts +1 -1
  159. package/src/vendor/grammars/README.md +10 -5
  160. package/src/vendor/grammars/tree-sitter-go.wasm +0 -0
  161. package/src/vendor/grammars/tree-sitter-java.wasm +0 -0
  162. package/src/vendor/grammars/tree-sitter-python.wasm +0 -0
  163. package/dist/cli-delegate/chunk-A4QJ6ENT.js +0 -50
  164. /package/dist/cli-delegate/{chunk-E6XNBVE4.js → chunk-KR5ZIFPO.js} +0 -0
@@ -9073,9 +9073,9 @@ function observeAssetRender(root, command, exitCode, shellCwd = root) {
9073
9073
  if (cd && !PLAIN_WORD.test(cd[1].trim())) return null;
9074
9074
  const cwd = path8.resolve(shellCwd, cd ? unquote(cd[1].trim()) : ".");
9075
9075
  const head = command.replace(/^\s*cd\s+[^;&|<>`$\n]+&&\s*/, "").replace(/\s\d?>&\d\b/g, " ").replace(/\s2>\s*\/dev\/null\b/g, " ").split("|")[0] ?? "";
9076
- const words2 = head.trim().split(/\s+/);
9077
- if (!words2.every((w) => PLAIN_WORD.test(w))) return null;
9078
- const tokens = words2.map(unquote);
9076
+ const words3 = head.trim().split(/\s+/);
9077
+ if (!words3.every((w) => PLAIN_WORD.test(w))) return null;
9078
+ const tokens = words3.map(unquote);
9079
9079
  const at = tokens.findIndex((t) => t === "ui:render");
9080
9080
  if (at === -1) return null;
9081
9081
  const opts = /* @__PURE__ */ new Map();
@@ -21044,6 +21044,23 @@ function _concern_body_classes(concern) {
21044
21044
  }
21045
21045
  return parseBodyClasses(concern["needs_payload_bodies"]);
21046
21046
  }
21047
+ function applyPayloadFields(concern, env) {
21048
+ const fields = concern["payload_fields"];
21049
+ const payload = env["payload"];
21050
+ if (!Array.isArray(fields) || !isObject2(payload) || concern["fail_closed"] === true || concern["severity"] === "blocking") {
21051
+ return env;
21052
+ }
21053
+ const keep = new Set(fields);
21054
+ const out = { ...payload };
21055
+ for (const cls of BODY_CLASSES) {
21056
+ for (const key of BODY_KEYS[cls]) {
21057
+ const v = payload[key];
21058
+ if (v === void 0 || v === null || isPayloadStub(v)) continue;
21059
+ out[key] = isObject2(v) ? Object.fromEntries(Object.entries(v).filter(([k]) => keep.has(k))) : makePayloadStub(key, cls, v, /* @__PURE__ */ new Map([[key, bodyBytes(v)]]));
21060
+ }
21061
+ }
21062
+ return { ...env, payload: out };
21063
+ }
21047
21064
  function planPayloadShapes(envelope, keepSets, placeholder) {
21048
21065
  const present = presentBodyClasses(envelope);
21049
21066
  const stubbedSomewhere = /* @__PURE__ */ new Set();
@@ -27712,8 +27729,8 @@ var VISUAL_RUNNERS = /* @__PURE__ */ new Set(["playwright", "test-storybook"]);
27712
27729
  var LAUNCHERS = /* @__PURE__ */ new Set(["npx", "bunx", "pnpx"]);
27713
27730
  var PACKAGE_MANAGERS = /* @__PURE__ */ new Set(["npm", "pnpm", "yarn", "bun"]);
27714
27731
  var VALUE_OPTIONS2 = /* @__PURE__ */ new Set(["-p", "--package", "--filter", "-F", "-C", "--dir", "--cwd", "-u", "--unset", "--chdir"]);
27715
- function runsSnapshotUpdate(words2) {
27716
- const at = (k) => words2[k] ?? "";
27732
+ function runsSnapshotUpdate(words3) {
27733
+ const at = (k) => words3[k] ?? "";
27717
27734
  let i = 0;
27718
27735
  const skipOptions = () => {
27719
27736
  while (at(i).startsWith("-") || /^[A-Za-z_]\w*=/.test(at(i))) i += VALUE_OPTIONS2.has(at(i)) ? 2 : 1;
@@ -27737,22 +27754,22 @@ function runsSnapshotUpdate(words2) {
27737
27754
  }
27738
27755
  skipOptions();
27739
27756
  if (!VISUAL_RUNNERS.has(at(i).split("/").pop() ?? "")) return false;
27740
- const args = words2.slice(i + 1);
27757
+ const args = words3.slice(i + 1);
27741
27758
  return !args.some((w) => /^(--list|--help|-h|--version)$/.test(w)) && args.some((w) => w === "-u" || /^--update-snapshots(=(?!(false|none)$).+)?$/.test(w));
27742
27759
  }
27743
27760
  function shellSegments(command) {
27744
27761
  const segments = [];
27745
- let words2 = [];
27762
+ let words3 = [];
27746
27763
  let word = null;
27747
27764
  let quote = null;
27748
27765
  const endWord = () => {
27749
- if (word !== null) words2.push(word);
27766
+ if (word !== null) words3.push(word);
27750
27767
  word = null;
27751
27768
  };
27752
27769
  const endSegment = () => {
27753
27770
  endWord();
27754
- if (words2.length > 0) segments.push(words2);
27755
- words2 = [];
27771
+ if (words3.length > 0) segments.push(words3);
27772
+ words3 = [];
27756
27773
  };
27757
27774
  for (let i = 0; i < command.length; i++) {
27758
27775
  const c = command[i] ?? "";
@@ -28427,13 +28444,13 @@ var WRAPPERS = /* @__PURE__ */ new Set([
28427
28444
  ]);
28428
28445
  var NON_READING_GIT = /* @__PURE__ */ new Set(["add", "rm", "mv", "check-ignore", "ls-files", "status"]);
28429
28446
  function commandWords(segment) {
28430
- const words2 = [];
28447
+ const words3 = [];
28431
28448
  let word = "";
28432
28449
  let inWord = false;
28433
28450
  for (let i = 0; i < segment.length; i += 1) {
28434
28451
  const ch = segment[i];
28435
28452
  if (/\s/.test(ch)) {
28436
- if (inWord) words2.push(word);
28453
+ if (inWord) words3.push(word);
28437
28454
  word = "";
28438
28455
  inWord = false;
28439
28456
  continue;
@@ -28461,8 +28478,8 @@ function commandWords(segment) {
28461
28478
  word += ch;
28462
28479
  }
28463
28480
  }
28464
- if (inWord) words2.push(word);
28465
- return words2;
28481
+ if (inWord) words3.push(word);
28482
+ return words3;
28466
28483
  }
28467
28484
  var ASSIGNMENT = /^[A-Za-z_][A-Za-z0-9_]*=/;
28468
28485
  var VARIABLE_NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
@@ -28495,8 +28512,8 @@ function mentionIn(text, host2) {
28495
28512
  }
28496
28513
  return null;
28497
28514
  }
28498
- function credentialAmong(words2, host2) {
28499
- for (const w of words2) {
28515
+ function credentialAmong(words3, host2) {
28516
+ for (const w of words3) {
28500
28517
  const v = mentionIn(w, host2);
28501
28518
  if (v !== null) return v;
28502
28519
  }
@@ -28554,11 +28571,11 @@ function copySources(args) {
28554
28571
  return targetGiven ? operands : operands.slice(0, -1);
28555
28572
  }
28556
28573
  function segmentVerdict(segment, host2 = HOST, depth = 0) {
28557
- const words2 = commandWords(segment);
28574
+ const words3 = commandWords(segment);
28558
28575
  let i = 0;
28559
- while (i < words2.length && ASSIGNMENT.test(words2[i])) i += 1;
28560
- const cmd = base(words2[i] ?? "");
28561
- const args = words2.slice(i + 1);
28576
+ while (i < words3.length && ASSIGNMENT.test(words3[i])) i += 1;
28577
+ const cmd = base(words3[i] ?? "");
28578
+ const args = words3.slice(i + 1);
28562
28579
  if (WRAPPERS.has(cmd)) {
28563
28580
  if (args.some((a) => base(a) === "env" || base(a) === "printenv")) {
28564
28581
  return { class: "process-environment", what: `\`${cmd} \u2026 env\`` };
@@ -30119,10 +30136,10 @@ var SLOP_RULES = [
30119
30136
  message: "Em-dash density above ~2 per 500 words is the #1 LLM syntactic tell (CP1).",
30120
30137
  detect: ({ content, ext }) => {
30121
30138
  const text = visibleText(content, ext);
30122
- const words2 = (text.match(/\S+/g) ?? []).length;
30139
+ const words3 = (text.match(/\S+/g) ?? []).length;
30123
30140
  const dashes = (text.match(/—/g) ?? []).length;
30124
- if (words2 >= 80 && dashes > Math.max(2, Math.round(words2 / 500 * 2))) {
30125
- return [{ line: 1, snippet: `${dashes} em-dashes in ~${words2} words` }];
30141
+ if (words3 >= 80 && dashes > Math.max(2, Math.round(words3 / 500 * 2))) {
30142
+ return [{ line: 1, snippet: `${dashes} em-dashes in ~${words3} words` }];
30126
30143
  }
30127
30144
  return [];
30128
30145
  }
@@ -31071,19 +31088,11 @@ import * as fs82 from "node:fs";
31071
31088
  import * as path86 from "node:path";
31072
31089
 
31073
31090
  // src/scripts/code_graph/types.ts
31074
- var GUESS_RESOLVED_VIA = /* @__PURE__ */ new Set([
31075
- "name-lookup",
31076
- "dynamic",
31077
- // The accepted-edge filter is a DENYLIST, so a new value is accepted by
31078
- // default — which is exactly backwards for this one. `foreign` must be
31079
- // listed here or a consumer's graph would silently answer the gate verbs
31080
- // as if this package had resolved its edges.
31081
- "foreign"
31082
- ]);
31091
+ var GUESS_RESOLVED_VIA = /* @__PURE__ */ new Set(["name-lookup", "dynamic", "foreign"]);
31083
31092
  function isStatedResolution(resolved_via) {
31084
31093
  return !GUESS_RESOLVED_VIA.has(resolved_via);
31085
31094
  }
31086
- var SCHEMA_VERSION2 = 4;
31095
+ var SCHEMA_VERSION2 = 5;
31087
31096
  var EXT_LANG = {
31088
31097
  ".php": "php",
31089
31098
  ".ts": "typescript",
@@ -31093,37 +31102,24 @@ var EXT_LANG = {
31093
31102
  ".js": "javascript",
31094
31103
  ".jsx": "javascript",
31095
31104
  ".mjs": "javascript",
31096
- ".cjs": "javascript"
31105
+ ".cjs": "javascript",
31106
+ ".py": "python",
31107
+ ".go": "go",
31108
+ ".java": "java",
31109
+ ".vue": "typescript"
31097
31110
  };
31098
31111
 
31099
31112
  // src/scripts/code_graph/validate.ts
31100
- var RELATIONS = /* @__PURE__ */ new Set(["calls", "imports", "uses", "inherits", "member", "tests"]);
31113
+ var words2 = (s) => new Set(s.split(" "));
31114
+ var RELATIONS = words2(
31115
+ "calls imports uses inherits member tests routes-to renders includes reads migrates persists relates documents"
31116
+ );
31101
31117
  var CONFIDENCES = /* @__PURE__ */ new Set(["EXTRACTED", "INFERRED", "AMBIGUOUS"]);
31102
- var RESOLVED_VIA = /* @__PURE__ */ new Set([
31103
- "same-file",
31104
- "import-specifier",
31105
- "path-alias",
31106
- "psr4",
31107
- "route-table",
31108
- "test-import",
31109
- "name-lookup",
31110
- "dynamic",
31111
- // Adapted from a consumer's own graph file; see `foreign.ts`.
31112
- "foreign"
31113
- ]);
31114
- var PROVIDERS = /* @__PURE__ */ new Set(["native", "foreign"]);
31115
- var KINDS = /* @__PURE__ */ new Set([
31116
- "file",
31117
- "class",
31118
- "interface",
31119
- "trait",
31120
- "function",
31121
- "method",
31122
- "constant",
31123
- "type",
31124
- "enum",
31125
- "skipped"
31126
- ]);
31118
+ var RESOLVED_VIA = words2(
31119
+ "same-file import-specifier path-alias psr4 route-table directive-scan schema-call eloquent-relation compiler-index test-import name-lookup dynamic foreign"
31120
+ );
31121
+ var PROVIDERS = /* @__PURE__ */ new Set(["native", "foreign", "scip"]);
31122
+ var KINDS = words2("file class interface trait function method constant type enum skipped route table");
31127
31123
  function validateGraph(g) {
31128
31124
  const errors = [];
31129
31125
  const push = (m) => {
@@ -31142,6 +31138,7 @@ function validateGraph(g) {
31142
31138
  if (typeof n !== "object" || n === null) return push(`node[${i}] not an object`);
31143
31139
  const nn = n;
31144
31140
  if (typeof nn["id"] !== "string") push(`node[${i}].id must be a string`);
31141
+ else if (ids.has(nn["id"])) push(`node[${i}].id is a duplicate: ${nn["id"]}`);
31145
31142
  else ids.add(nn["id"]);
31146
31143
  if (!KINDS.has(nn["kind"])) push(`node[${i}].kind invalid: ${String(nn["kind"])}`);
31147
31144
  if (typeof nn["source_file"] !== "string") push(`node[${i}].source_file must be a string`);
@@ -31253,7 +31250,7 @@ function detectSources(root, nativeCache) {
31253
31250
  } catch {
31254
31251
  }
31255
31252
  const scip = scipCandidates.find((p) => fs82.existsSync(p));
31256
- if (scip) out.push({ kind: "scip", path: scip, present: true, note: "SCIP detected \u2014 peer tooling required (no owned reader)" });
31253
+ if (scip) out.push({ kind: "scip", path: scip, present: true, note: "SCIP \u2014 index.scip merges into the build" });
31257
31254
  if (fs82.existsSync(nativeCache)) out.push({ kind: "native", path: nativeCache, present: true, ...freshness(abs, nativeCache, null) });
31258
31255
  return out;
31259
31256
  }
@@ -31338,16 +31335,16 @@ var VALUE_TAKING = /* @__PURE__ */ new Set([
31338
31335
  ]);
31339
31336
  var NOT_A_SEARCH = /* @__PURE__ */ new Set(["--help", "-h", "--version", "-V", "--usage"]);
31340
31337
  var FIND_SUBJECT = /* @__PURE__ */ new Set(["-name", "-iname", "-path", "-ipath", "-regex"]);
31341
- function segmentSearchToken(words2) {
31342
- if (words2.length === 0) return null;
31338
+ function segmentSearchToken(words3) {
31339
+ if (words3.length === 0) return null;
31343
31340
  let i = 0;
31344
- let head = words2[0].split("/").pop();
31341
+ let head = words3[0].split("/").pop();
31345
31342
  if (head === "git") {
31346
31343
  let j = 1;
31347
- while (j < words2.length && words2[j].startsWith("-")) {
31348
- j += VALUE_TAKING.has(words2[j]) || words2[j] === "-C" ? 2 : 1;
31344
+ while (j < words3.length && words3[j].startsWith("-")) {
31345
+ j += VALUE_TAKING.has(words3[j]) || words3[j] === "-C" ? 2 : 1;
31349
31346
  }
31350
- if (words2[j] !== "grep") return null;
31347
+ if (words3[j] !== "grep") return null;
31351
31348
  head = "git grep";
31352
31349
  i = j + 1;
31353
31350
  } else if (SEARCH_HEADS.has(head)) {
@@ -31355,7 +31352,7 @@ function segmentSearchToken(words2) {
31355
31352
  } else {
31356
31353
  return null;
31357
31354
  }
31358
- const rest = words2.slice(i);
31355
+ const rest = words3.slice(i);
31359
31356
  if (rest.some((w) => NOT_A_SEARCH.has(w))) return null;
31360
31357
  if (head === "find") {
31361
31358
  const at = rest.findIndex((w) => FIND_SUBJECT.has(w));
@@ -31376,8 +31373,8 @@ function strip(w) {
31376
31373
  }
31377
31374
  function bashSearchToken(command) {
31378
31375
  for (const segment of command.split(/\||&&|;/)) {
31379
- const words2 = segment.trim().split(/\s+/).filter((w) => w !== "");
31380
- const hit = segmentSearchToken(words2);
31376
+ const words3 = segment.trim().split(/\s+/).filter((w) => w !== "");
31377
+ const hit = segmentSearchToken(words3);
31381
31378
  if (hit !== null) return hit;
31382
31379
  }
31383
31380
  return null;
@@ -33030,7 +33027,8 @@ function probeHostCapabilities(hostId) {
33030
33027
  const base2 = resolveHostCapabilities(hostId);
33031
33028
  const flag = process9.env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS;
33032
33029
  const probedAgentTeams = typeof flag === "string" && flag !== "";
33033
- return { ...base2, agent_teams: base2.agent_teams || probedAgentTeams };
33030
+ const probedResume = probedAgentTeams && hostId === "claude";
33031
+ return { ...base2, agent_teams: base2.agent_teams || probedAgentTeams, worker_resume: base2.worker_resume || probedResume };
33034
33032
  }
33035
33033
 
33036
33034
  // src/scripts/_lib/auto_dispatch.ts
@@ -36724,6 +36722,7 @@ function emitSqliteTwin(graph, serialized, jsonPath) {
36724
36722
  db.exec(
36725
36723
  "CREATE TABLE meta (key TEXT PRIMARY KEY, value TEXT NOT NULL);CREATE TABLE nodes (id TEXT PRIMARY KEY, label TEXT NOT NULL, kind TEXT, source_file TEXT, l0 INTEGER, l1 INTEGER, l2 INTEGER, l3 INTEGER);CREATE TABLE edges (source TEXT NOT NULL, target TEXT NOT NULL, relation TEXT NOT NULL, confidence TEXT NOT NULL, candidates TEXT, ambiguity_reason TEXT, resolved_via TEXT, provider TEXT);CREATE INDEX edges_source ON edges(source);CREATE INDEX edges_target ON edges(target);CREATE INDEX nodes_label ON nodes(label);CREATE INDEX nodes_source_file ON nodes(source_file);"
36726
36724
  );
36725
+ db.exec("BEGIN");
36727
36726
  const meta = db.prepare("INSERT INTO meta (key, value) VALUES (?, ?)");
36728
36727
  meta.run("source_checksum", graph.source_checksum);
36729
36728
  meta.run("json_size", String(stat.size));
@@ -36762,14 +36761,17 @@ function emitSqliteTwin(graph, serialized, jsonPath) {
36762
36761
  e.provider
36763
36762
  );
36764
36763
  }
36764
+ db.exec("COMMIT");
36765
36765
  stampUserVersion(db, GRAPH_STORE_VERSION);
36766
36766
  } finally {
36767
36767
  db.close();
36768
36768
  }
36769
36769
  fs108.renameSync(tmp, twin);
36770
36770
  return true;
36771
- } catch {
36771
+ } catch (e) {
36772
36772
  fs108.rmSync(tmp, { force: true });
36773
+ process.stderr.write(`code-graph: index not written: ${e.message}
36774
+ `);
36773
36775
  return false;
36774
36776
  }
36775
36777
  }
@@ -37601,6 +37603,7 @@ function openSvgObligation(workspaceRoot3, toolCalls, recordedRaw = null) {
37601
37603
  }
37602
37604
 
37603
37605
  // src/scripts/hooks/subagent_ledger_hook.ts
37606
+ import { execFileSync as execFileSync9 } from "node:child_process";
37604
37607
  import * as crypto12 from "node:crypto";
37605
37608
  import * as fs112 from "node:fs";
37606
37609
  import * as path117 from "node:path";
@@ -37861,6 +37864,51 @@ function appendLedgerLine(root, ts, line) {
37861
37864
  fs112.appendFileSync(file, `${JSON.stringify(line)}
37862
37865
  `, "utf8");
37863
37866
  }
37867
+ var INDEX_SUBDIR = "index";
37868
+ function writeIndexEntry(root, ts, key, value) {
37869
+ if (is_replay_mode()) return;
37870
+ const dir = path117.join(root, LEDGER_DIR, INDEX_SUBDIR, ts.slice(0, 7));
37871
+ fs112.mkdirSync(dir, { recursive: true });
37872
+ const tmp = path117.join(dir, `.${key}.${process.pid}.tmp`);
37873
+ try {
37874
+ fs112.writeFileSync(tmp, value, "utf8");
37875
+ fs112.renameSync(tmp, path117.join(dir, key));
37876
+ } finally {
37877
+ fs112.rmSync(tmp, { force: true });
37878
+ }
37879
+ }
37880
+ function readIndexEntry(root, key, now2) {
37881
+ const prev = new Date(Date.UTC(now2.getUTCFullYear(), now2.getUTCMonth() - 1, 1));
37882
+ for (const month of [now2.toISOString().slice(0, 7), prev.toISOString().slice(0, 7)]) {
37883
+ try {
37884
+ return fs112.readFileSync(path117.join(root, LEDGER_DIR, INDEX_SUBDIR, month, key), "utf8");
37885
+ } catch {
37886
+ }
37887
+ }
37888
+ return null;
37889
+ }
37890
+ function headOf(dir) {
37891
+ try {
37892
+ const env = Object.fromEntries(Object.entries(process.env).filter(([k]) => !k.startsWith("GIT_")));
37893
+ return execFileSync9("git", ["-C", dir, "rev-parse", "HEAD"], { encoding: "utf8", timeout: 2e3, stdio: ["ignore", "pipe", "ignore"], env }).trim() || null;
37894
+ } catch {
37895
+ return null;
37896
+ }
37897
+ }
37898
+ function stateStamp(cwd) {
37899
+ let epoch = null;
37900
+ try {
37901
+ epoch = fs112.statSync(fileURLToPath59(import.meta.url)).mtimeMs;
37902
+ } catch {
37903
+ }
37904
+ return typeof cwd === "string" && cwd ? { head: headOf(cwd), cwd_key: refFor(cwd), epoch } : { head: null, cwd_key: null, epoch };
37905
+ }
37906
+ function stopIndexKey(sessionId3, ref) {
37907
+ return refFor(`subagent-stop\0${sessionId3}\0${ref}`);
37908
+ }
37909
+ function recordStopIndex(root, ts, sessionId3, ref) {
37910
+ writeIndexEntry(root, ts, stopIndexKey(sessionId3, ref), "");
37911
+ }
37864
37912
  var WALL_CLOCK_ARMS_MS = [
37865
37913
  { label: "5m", ms: 5 * 60 * 1e3 },
37866
37914
  { label: "15m", ms: 15 * 60 * 1e3 },
@@ -38028,8 +38076,13 @@ function handleStop(root, payload, nowIso, sessionId3) {
38028
38076
  // Beside the count, never instead of it: the count says how wrong the
38029
38077
  // candidate was, this says whether it was aimed at the envelope.
38030
38078
  envelope_field_hits: parse.field_hits,
38031
- concurrent_open: countOpen(root)
38079
+ concurrent_open: countOpen(root),
38080
+ ...stateStamp(payload["cwd"])
38032
38081
  });
38082
+ try {
38083
+ if (sessionId3 !== null) recordStopIndex(root, nowIso, sessionId3, ref);
38084
+ } catch {
38085
+ }
38033
38086
  }
38034
38087
  function processEnvelope3(envelope, consumerRoot) {
38035
38088
  try {
@@ -40819,12 +40872,13 @@ function markerFile(repoRoot, runId) {
40819
40872
  function writeQuotaParked(repoRoot, runId, providers, now2 = () => /* @__PURE__ */ new Date(), source = "council") {
40820
40873
  const file = markerFile(repoRoot, runId);
40821
40874
  const existing = readMarker(file);
40875
+ const host2 = source === "host";
40822
40876
  const merged = [.../* @__PURE__ */ new Set([...existing?.providers ?? [], ...providers])].sort();
40823
40877
  const marker = {
40824
40878
  run_id: runId,
40825
40879
  providers: merged,
40826
- parked_at: existing?.parked_at ?? now2().toISOString(),
40827
- source: existing?.source ?? source
40880
+ parked_at: (host2 ? null : existing?.parked_at) ?? now2().toISOString(),
40881
+ source: host2 ? source : existing?.source ?? source
40828
40882
  };
40829
40883
  fs126.mkdirSync(path130.dirname(file), { recursive: true });
40830
40884
  fs126.writeFileSync(file, `${JSON.stringify(marker, null, 2)}
@@ -40833,20 +40887,18 @@ function writeQuotaParked(repoRoot, runId, providers, now2 = () => /* @__PURE__
40833
40887
  }
40834
40888
  var HOST_RATE_WINDOW_MS = 5 * 36e5;
40835
40889
  function recentHostMarker(repoRoot, nowMs = Date.now(), windowMs = HOST_RATE_WINDOW_MS) {
40836
- let names;
40890
+ return allMarkers(repoRoot).some((m) => {
40891
+ const age = nowMs - Date.parse(m.parked_at);
40892
+ return m.source === "host" && age >= 0 && age < windowMs;
40893
+ });
40894
+ }
40895
+ function allMarkers(repoRoot) {
40896
+ const dir = path130.join(repoRoot, QUOTA_PARKED_DIR_REL);
40837
40897
  try {
40838
- names = fs126.readdirSync(path130.join(repoRoot, QUOTA_PARKED_DIR_REL));
40898
+ return fs126.readdirSync(dir).flatMap((n) => n.endsWith(".json") ? readMarker(path130.join(dir, n)) ?? [] : []);
40839
40899
  } catch {
40840
- return false;
40841
- }
40842
- for (const name of names) {
40843
- if (!name.endsWith(".json")) continue;
40844
- const m = readMarker(path130.join(repoRoot, QUOTA_PARKED_DIR_REL, name));
40845
- if (m === null || m.source !== "host") continue;
40846
- const at = Date.parse(m.parked_at);
40847
- if (Number.isFinite(at) && nowMs - at >= 0 && nowMs - at < windowMs) return true;
40900
+ return [];
40848
40901
  }
40849
- return false;
40850
40902
  }
40851
40903
  function readMarker(file) {
40852
40904
  try {
@@ -40916,72 +40968,19 @@ function isObject23(v) {
40916
40968
  }
40917
40969
  var DISPATCH_TOOL_NAMES2 = /* @__PURE__ */ new Set(["Agent", "Task"]);
40918
40970
  var RESUME_TOOL_NAMES = /* @__PURE__ */ new Set(["SendMessage"]);
40919
- var STOP_SCAN_BYTES = 1024 * 1024;
40920
- function tailOf(file) {
40921
- let fd;
40922
- try {
40923
- fd = fs127.openSync(file, "r");
40924
- } catch {
40925
- return "";
40926
- }
40927
- try {
40928
- const size = fs127.fstatSync(fd).size;
40929
- const length = Math.min(size, STOP_SCAN_BYTES);
40930
- const buf = Buffer.alloc(length);
40931
- fs127.readSync(fd, buf, 0, length, size - length);
40932
- return buf.toString("utf8");
40933
- } finally {
40934
- fs127.closeSync(fd);
40935
- }
40936
- }
40937
- function stoppedInSession(root, ref, sessionId3, now2) {
40938
- const prev = new Date(Date.UTC(now2.getUTCFullYear(), now2.getUTCMonth() - 1, 1));
40939
- for (const month of [now2.toISOString().slice(0, 7), prev.toISOString().slice(0, 7)]) {
40940
- for (const line of tailOf(path131.join(root, LEDGER_DIR, `${month}.jsonl`)).split("\n")) {
40941
- if (!line.includes(ref)) continue;
40942
- try {
40943
- const rec = JSON.parse(line);
40944
- if (rec["event"] === "subagent_stop" && rec["ref"] === ref && rec["session_id"] === sessionId3) {
40945
- return true;
40946
- }
40947
- } catch {
40948
- }
40949
- }
40950
- }
40951
- return false;
40952
- }
40953
40971
  var NAME_MAX = 128;
40954
40972
  function nameKey(sessionId3, name) {
40955
40973
  return refFor(`subagent-name\0${sessionId3}\0${name}`);
40956
40974
  }
40957
- function refForName(root, name, sessionId3, now2) {
40958
- if (name.length > NAME_MAX) return null;
40959
- const key = nameKey(sessionId3, name);
40960
- let found = null;
40961
- const prev = new Date(Date.UTC(now2.getUTCFullYear(), now2.getUTCMonth() - 1, 1));
40962
- for (const month of [prev.toISOString().slice(0, 7), now2.toISOString().slice(0, 7)]) {
40963
- for (const line of tailOf(path131.join(root, LEDGER_DIR, `${month}.jsonl`)).split("\n")) {
40964
- if (!line.includes("subagent_named")) continue;
40965
- try {
40966
- const rec = JSON.parse(line);
40967
- if (rec["event"] === "subagent_named" && rec["name_key"] === key && typeof rec["ref"] === "string") {
40968
- found = rec["ref"];
40969
- }
40970
- } catch {
40971
- }
40972
- }
40973
- }
40974
- return found;
40975
- }
40976
40975
  function classifySend(root, toolInput, sessionId3, now2 = /* @__PURE__ */ new Date()) {
40977
40976
  const input = isObject23(toolInput) ? toolInput : {};
40978
40977
  const recipient = input["to"];
40979
40978
  if (typeof recipient !== "string" || recipient === "") return "message_or_resume";
40980
40979
  if (sessionId3 === null || sessionId3 === "") return "message_or_resume";
40981
- const ref = input["recipient_kind"] === "name" ? refForName(root, recipient, sessionId3, now2) : refFor(recipient);
40982
- if (ref === null) return "message_or_resume";
40980
+ const ref = input["recipient_kind"] !== "name" ? refFor(recipient) : recipient.length > NAME_MAX ? null : readIndexEntry(root, nameKey(sessionId3, recipient), now2);
40981
+ if (!ref) return "message_or_resume";
40983
40982
  if (readOpenRecords(root).has(ref)) return "message_running";
40984
- return stoppedInSession(root, ref, sessionId3, now2) ? "resume" : "message_or_resume";
40983
+ return readIndexEntry(root, stopIndexKey(sessionId3, ref), now2) === null ? "message_or_resume" : "resume";
40985
40984
  }
40986
40985
  function recordNamedSpawn(root, payload, sessionId3, nowIso) {
40987
40986
  const input = isObject23(payload["tool_input"]) ? payload["tool_input"] : {};
@@ -40989,8 +40988,10 @@ function recordNamedSpawn(root, payload, sessionId3, nowIso) {
40989
40988
  const name = input["name"];
40990
40989
  const agentId = result["agentId"];
40991
40990
  if (typeof name !== "string" || name === "" || name.length > NAME_MAX || typeof agentId !== "string" || agentId === "") return;
40992
- if (sessionId3 === null) return;
40993
- appendLedgerLine(root, nowIso, { event: "subagent_named", ts: nowIso, ref: refFor(agentId), name_key: nameKey(sessionId3, name), session_id: sessionId3 });
40991
+ if (!sessionId3) return;
40992
+ const key = nameKey(sessionId3, name);
40993
+ appendLedgerLine(root, nowIso, { event: "subagent_named", ts: nowIso, ref: refFor(agentId), name_key: key, session_id: sessionId3 });
40994
+ writeIndexEntry(root, nowIso, key, refFor(agentId));
40994
40995
  }
40995
40996
  var RESUME_ADMISSION_OBSERVED = /* @__PURE__ */ new Set(["claude"]);
40996
40997
  var CANDIDATES = [
@@ -41034,6 +41035,12 @@ function processEnvelope5(envelope, consumerRoot, deps = {}) {
41034
41035
  const sessionRaw = payload["session_id"] ?? envelope["session_id"];
41035
41036
  const sessionId3 = typeof sessionRaw === "string" ? sessionRaw : null;
41036
41037
  const sendKind = isResume ? classifySend(consumerRoot, toolInput, sessionId3) : null;
41038
+ const reqName = toolInput["name"];
41039
+ const spawnFacts = isResume ? {} : {
41040
+ ...stateStamp(payload["cwd"]),
41041
+ agent_type: typeof toolInput["subagent_type"] === "string" ? toolInput["subagent_type"] : null,
41042
+ ...typeof reqName === "string" && reqName && reqName.length <= NAME_MAX && sessionId3 ? { name_key: nameKey(sessionId3, reqName) } : {}
41043
+ };
41037
41044
  const reuse = isResume ? null : shadowReuseVerdict({
41038
41045
  host_resume: deps.host_resume ?? probeHostCapabilities(platform).worker_resume,
41039
41046
  workers: deps.workers ?? null,
@@ -41064,6 +41071,7 @@ function processEnvelope5(envelope, consumerRoot, deps = {}) {
41064
41071
  // against a threshold that counts runs.
41065
41072
  ...sendKind === "message_running" ? {} : { candidates: verdicts.map((v) => ({ label: v.label, would_deny: v.would_deny, on: v.on })) },
41066
41073
  dispatch_kind: sendKind ?? "spawn",
41074
+ ...spawnFacts,
41067
41075
  resume_admission: platform !== null && RESUME_ADMISSION_OBSERVED.has(platform) ? "counted" : "unobserved",
41068
41076
  ...reuse === null ? {} : { reuse },
41069
41077
  // A recent host-sourced rate marker: a new spawn would have waited.
@@ -41576,7 +41584,8 @@ var RECORDED_EVENTS = /* @__PURE__ */ new Set([
41576
41584
  "pre_compact",
41577
41585
  "agent_error",
41578
41586
  "subagent_start",
41579
- "subagent_stop"
41587
+ "subagent_stop",
41588
+ "instructions_loaded"
41580
41589
  ]);
41581
41590
  var NOT_RECORDED = /* @__PURE__ */ new Map();
41582
41591
  var CONSUMPTION_STATES = ["consumed", "partially-consumed", "rejected-with-reason"];
@@ -42161,6 +42170,10 @@ var LAZY_CONCERNS = Object.freeze({
42161
42170
  "src/scripts/chat_history.ts": Object.freeze({
42162
42171
  chunk: "chat_history.chunk.cjs",
42163
42172
  source: path138.join("..", "chat_history")
42173
+ }),
42174
+ "src/scripts/hooks/instructions_observer_hook.ts": Object.freeze({
42175
+ chunk: "instructions_observer.chunk.cjs",
42176
+ source: "instructions_observer_hook"
42164
42177
  })
42165
42178
  });
42166
42179
  function isBundled3() {
@@ -43075,7 +43088,8 @@ var COLLECTOR_EVENTS = [
43075
43088
  "pre_compact",
43076
43089
  "agent_error",
43077
43090
  "subagent_start",
43078
- "subagent_stop"
43091
+ "subagent_stop",
43092
+ "instructions_loaded"
43079
43093
  ];
43080
43094
  var COLLECTOR_OUTCOMES = ["captured", "startup_failure", "write_failure"];
43081
43095
  var COLLECTOR_PLATFORMS = [
@@ -43338,7 +43352,8 @@ var EVENT_VOCABULARY = /* @__PURE__ */ new Set([
43338
43352
  "pre_compact",
43339
43353
  "agent_error",
43340
43354
  "subagent_start",
43341
- "subagent_stop"
43355
+ "subagent_stop",
43356
+ "instructions_loaded"
43342
43357
  ]);
43343
43358
  var _SEVERITY_BY_EXIT = {
43344
43359
  [EXIT_ALLOW]: "allow",
@@ -44050,7 +44065,7 @@ function main71(argv) {
44050
44065
  if (!_concern_matches_tool(concern, tool_name)) {
44051
44066
  continue;
44052
44067
  }
44053
- const concern_envelope = shapes.shapeFor(keep_classes, egressViewFor(concern));
44068
+ const concern_envelope = applyPayloadFields(concern, shapes.shapeFor(keep_classes, egressViewFor(concern)));
44054
44069
  const stubs_served = shapes.stubsFor(keep_classes);
44055
44070
  const served_classes = shapes.servedBy(keep_classes);
44056
44071
  const concern_started = _now_iso3();
@@ -1 +1 @@
1
- e52615d77445fea7d34fdf0ceb7413be798e18f51f257308e1efc6588d37c428 dispatch.js
1
+ 1089777b2ae58baebcf459eeaccfe7a043a8aa24de365e85cea9827d5a64be27 dispatch.js