@event4u/agent-config 14.19.0 → 14.20.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 (101) 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 +108 -156
  5. package/dist/agent-src/commands/agent-handoff.md +42 -41
  6. package/dist/agent-src/contexts/execution/host-capability-manifest.md +7 -1
  7. package/dist/agent-src/rules/untrusted-input-defense.md +0 -2
  8. package/dist/agent-src/skills/evaluate-llm-feature/SKILL.md +1 -1
  9. package/dist/agent-src/skills/markitdown/SKILL.md +1 -1
  10. package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +28 -6
  11. package/dist/agent-src/skills/test-driven-development/SKILL.md +1 -3
  12. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  13. package/dist/agent-src/templates/roadmaps.md +14 -1
  14. package/dist/agent-src/templates/scripts/telemetry/mcp_lite.ts +213 -0
  15. package/dist/agent-src/templates/scripts/telemetry/report_renderer.ts +16 -0
  16. package/dist/agent-src/templates/scripts/telemetry_report.ts +22 -2
  17. package/dist/cli/mcp/dispatch.js +10 -0
  18. package/dist/cli/mcp/stdio.js +33 -2
  19. package/dist/cli/mcp/telemetry.js +227 -0
  20. package/dist/cli-delegate/{chunk-GZTMRYCN.js → chunk-C6IPZRDA.js} +79 -12
  21. package/dist/cli-delegate/{chunk-CYH5SP6M.js → chunk-I6RHFQEG.js} +151 -16
  22. package/dist/cli-delegate/{chunk-IDHUQIXP.js → chunk-NUMQHLS5.js} +21 -4
  23. package/dist/cli-delegate/{chunk-PMEKGDED.js → chunk-PI2GU3DP.js} +163 -1
  24. package/dist/cli-delegate/{chunk-7PRE6ZV2.js → chunk-YS6XTLEK.js} +199 -4
  25. package/dist/cli-delegate/chunk-ZVBOHSVF.js +1109 -0
  26. package/dist/cli-delegate/cmd_conformance.js +73 -109
  27. package/dist/cli-delegate/cmd_doctor.js +2 -2
  28. package/dist/cli-delegate/cmd_export.js +2 -2
  29. package/dist/cli-delegate/cmd_handoff.js +41 -11
  30. package/dist/cli-delegate/cmd_memory_get.js +1 -1
  31. package/dist/cli-delegate/cmd_prune.js +2 -2
  32. package/dist/cli-delegate/cmd_route_audit.js +1 -1
  33. package/dist/cli-delegate/cmd_session_recycle.js +59 -902
  34. package/dist/cli-delegate/cmd_settings_migrate.js +2 -2
  35. package/dist/cli-delegate/cmd_sync.js +2 -2
  36. package/dist/cli-delegate/cmd_uninstall.js +2 -2
  37. package/dist/cli-delegate/cmd_validate.js +2 -2
  38. package/dist/discovery/deprecation-report.md +1 -1
  39. package/dist/discovery/discovery-manifest.json +9 -9
  40. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  41. package/dist/discovery/discovery-manifest.summary.md +1 -1
  42. package/dist/discovery/dormancy-report.md +1 -1
  43. package/dist/discovery/orphan-report.md +1 -1
  44. package/dist/discovery/packs.json +2 -2
  45. package/dist/discovery/trust-report.md +1 -1
  46. package/dist/discovery/workspaces.json +2 -2
  47. package/dist/hooks/dispatch.js +7257 -6497
  48. package/dist/install/install.mjs +393 -168
  49. package/dist/mcp/registry-manifest.json +2 -2
  50. package/dist/mcp/server.json +2 -2
  51. package/dist/mcp/server.mjs +497 -118
  52. package/dist/scripts/mcp_server/telemetry.js +148 -0
  53. package/docs/guidelines/agent-infra/naming.md +1 -1
  54. package/docs/guidelines/agent-infra/security-lint-containment.md +46 -6
  55. package/docs/guidelines/agent-infra/self-improvement-pipeline.md +4 -4
  56. package/docs/guidelines/agent-infra/untrusted-input-spotlighting.md +1 -1
  57. package/docs/guidelines/redundancy-taxonomy.md +28 -0
  58. package/package.json +1 -1
  59. package/src/agent-src/templates/scripts/telemetry/mcp_lite.ts +213 -0
  60. package/src/agent-src/templates/scripts/telemetry/report_renderer.ts +16 -0
  61. package/src/agent-src/templates/scripts/telemetry_report.ts +22 -2
  62. package/src/config/assurance-capability-registry.json +9 -0
  63. package/src/config/gate-coverage.yml +55 -0
  64. package/src/config/gate-violation-baselines.json +15 -3
  65. package/src/scripts/_cli/cmd_session_recycle.ts +51 -3
  66. package/src/scripts/_lib/audit_field_provenance.ts +44 -3
  67. package/src/scripts/_lib/host_capability.ts +38 -0
  68. package/src/scripts/_lib/install_reach_checks.ts +33 -1
  69. package/src/scripts/_lib/mcp_bridge.ts +222 -10
  70. package/src/scripts/_lib/mcp_consent_residual.ts +173 -0
  71. package/src/scripts/_lib/orchestration_record.ts +23 -1
  72. package/src/scripts/_lib/recycle_envelope_paths.ts +190 -0
  73. package/src/scripts/_lib/release_position.ts +96 -0
  74. package/src/scripts/_lib/review_skipped_record.ts +17 -1
  75. package/src/scripts/_lib/security_lint.ts +179 -7
  76. package/src/scripts/_lib/self_repair.ts +141 -6
  77. package/src/scripts/_lib/self_repair_store.ts +273 -7
  78. package/src/scripts/_lib/subagent_capsule.ts +155 -3
  79. package/src/scripts/build_rule_trigger_matrix.ts +5 -0
  80. package/src/scripts/check_mcp_doc_drift.ts +217 -0
  81. package/src/scripts/check_pack_size.ts +321 -3
  82. package/src/scripts/handoff_context_hook.ts +54 -7
  83. package/src/scripts/hooks/session_eol_hook.ts +18 -7
  84. package/src/scripts/install.ts +4 -4
  85. package/src/scripts/lint_agent_security.ts +316 -25
  86. package/src/scripts/lint_confusables.ts +42 -6
  87. package/src/scripts/lint_handoffs.ts +0 -132
  88. package/src/scripts/lint_hidden_unicode.ts +49 -7
  89. package/src/scripts/lint_instruction_smuggling.ts +42 -6
  90. package/src/scripts/lint_mcp_config_security.ts +42 -6
  91. package/src/scripts/lint_roadmap_later_disposition.ts +217 -27
  92. package/src/scripts/lint_skill_frontmatter_safety.ts +43 -7
  93. package/src/scripts/mcp_server/resources.ts +41 -0
  94. package/src/scripts/mcp_server/telemetry.ts +19 -4
  95. package/src/scripts/orchestration_record.ts +12 -1
  96. package/src/scripts/release.ts +24 -24
  97. package/src/scripts/release_publication.ts +6 -2
  98. package/src/scripts/self_repair_cli.ts +31 -1
  99. package/src/scripts/skill_scout.ts +69 -0
  100. package/dist/cli-delegate/chunk-2GNWGMAL.js +0 -172
  101. package/dist/cli-delegate/chunk-LPPWO5CE.js +0 -161
@@ -2,17 +2,15 @@ import { createRequire as __acCreateRequire } from 'node:module'; const require
2
2
  import {
3
3
  deriveSessionKey,
4
4
  foldRefusal,
5
- parseRecord,
6
- readInstallBoundary,
7
- sessionRefusalFile
8
- } from "./chunk-2GNWGMAL.js";
9
- import {
10
5
  isCiPoll,
11
6
  isVacuousOutput,
7
+ parseRecord,
12
8
  pendingCount,
9
+ readInstallBoundary,
10
+ sessionRefusalFile,
13
11
  statePathFor,
14
12
  validateAssumption
15
- } from "./chunk-7PRE6ZV2.js";
13
+ } from "./chunk-YS6XTLEK.js";
16
14
  import {
17
15
  readHookStdin
18
16
  } from "./chunk-F7DQWYR5.js";
@@ -36,7 +34,7 @@ import {
36
34
  frontmatterPaths,
37
35
  proseEqual,
38
36
  splitFrontmatter
39
- } from "./chunk-IDHUQIXP.js";
37
+ } from "./chunk-NUMQHLS5.js";
40
38
  import "./chunk-FTAISGDQ.js";
41
39
  import "./chunk-M2DPGFZ4.js";
42
40
  import "./chunk-BTWUYDGN.js";
@@ -60,8 +58,9 @@ import {
60
58
  import {
61
59
  atomicAppendLine,
62
60
  manifest_path,
61
+ probeHostCapabilities,
63
62
  read_manifest
64
- } from "./chunk-PMEKGDED.js";
63
+ } from "./chunk-PI2GU3DP.js";
65
64
  import "./chunk-MWRD5YOH.js";
66
65
  import "./chunk-T7L2QK3K.js";
67
66
  import "./chunk-DMSZHXZS.js";
@@ -84,7 +83,7 @@ var YAML = __toESM(require_dist(), 1);
84
83
  import * as fs13 from "node:fs";
85
84
  import * as os7 from "node:os";
86
85
  import * as path13 from "node:path";
87
- import process6 from "node:process";
86
+ import process5 from "node:process";
88
87
  import { spawnSync as spawnSync2 } from "node:child_process";
89
88
  import { fileURLToPath as fileURLToPath13, pathToFileURL as pathToFileURL13 } from "node:url";
90
89
 
@@ -150,7 +149,7 @@ function routeTargetPathsPosix(target) {
150
149
  import * as fs12 from "node:fs";
151
150
  import * as os6 from "node:os";
152
151
  import * as path12 from "node:path";
153
- import process5 from "node:process";
152
+ import process4 from "node:process";
154
153
  import { fileURLToPath as fileURLToPath12, pathToFileURL as pathToFileURL12 } from "node:url";
155
154
 
156
155
  // src/scripts/conformance_scan.ts
@@ -1953,6 +1952,19 @@ import * as os from "node:os";
1953
1952
  import * as path3 from "node:path";
1954
1953
  import { fileURLToPath as fileURLToPath3, pathToFileURL as pathToFileURL3 } from "node:url";
1955
1954
 
1955
+ // src/scripts/_lib/audit_field_provenance.ts
1956
+ var MAX_APPLIED_IDS = 32;
1957
+ function appliedIds(values) {
1958
+ const out = [];
1959
+ for (const raw of values ?? []) {
1960
+ const v = String(raw).trim();
1961
+ if (v === "" || out.includes(v)) continue;
1962
+ out.push(v);
1963
+ if (out.length >= MAX_APPLIED_IDS) break;
1964
+ }
1965
+ return out;
1966
+ }
1967
+
1956
1968
  // src/scripts/_lib/review_skipped_record.ts
1957
1969
  var PRODUCER_PRIVACY_CLASS = "ids-only";
1958
1970
  function isNonNegInt(n) {
@@ -1981,7 +1993,8 @@ function buildReviewSkippedLine(input) {
1981
1993
  risk_class: input.diff_lines >= HIGH_RISK_DIFF_LINES ? "high" : "medium",
1982
1994
  memory: { asks: 0, hits: 0 },
1983
1995
  verify: { claims: 0, first_try_passes: 0 },
1984
- rules_applied: ["delegation-policy"],
1996
+ // COMPUTED, never a producer constant.
1997
+ rules_applied: appliedIds(input.rules_applied),
1985
1998
  // MANDATORY on every audit line, same as the orchestration producer.
1986
1999
  privacy_class: PRODUCER_PRIVACY_CLASS,
1987
2000
  // `skills_applied` is OMITTED here, deliberately and not by oversight.
@@ -3451,55 +3464,6 @@ import fs7 from "node:fs";
3451
3464
  import path7 from "node:path";
3452
3465
  import { fileURLToPath as fileURLToPath7, pathToFileURL as pathToFileURL7 } from "node:url";
3453
3466
 
3454
- // src/scripts/_lib/host_capability.ts
3455
- import process2 from "node:process";
3456
- var SAFE_DEFAULT = {
3457
- schema_version: 1,
3458
- subagent_spawn: false,
3459
- parallel_spawn: false,
3460
- status_polling: false,
3461
- separate_quota_pool: false,
3462
- agent_teams: false,
3463
- worker_respawn: false
3464
- };
3465
- function asBool(value) {
3466
- return value === true;
3467
- }
3468
- function normalizeHostManifest(input) {
3469
- if (input === null || typeof input !== "object") {
3470
- return { ...SAFE_DEFAULT };
3471
- }
3472
- const src = input;
3473
- return {
3474
- schema_version: 1,
3475
- subagent_spawn: asBool(src.subagent_spawn),
3476
- parallel_spawn: asBool(src.parallel_spawn),
3477
- status_polling: asBool(src.status_polling),
3478
- separate_quota_pool: asBool(src.separate_quota_pool),
3479
- agent_teams: asBool(src.agent_teams),
3480
- worker_respawn: asBool(src.worker_respawn)
3481
- };
3482
- }
3483
- var HOST_CAPABILITY_REGISTRY = {
3484
- claude: { subagent_spawn: true, parallel_spawn: true }
3485
- };
3486
- function resolveHostCapabilities(hostId, override) {
3487
- if (override !== void 0 && override !== null && typeof override === "object" && !Array.isArray(override)) {
3488
- return normalizeHostManifest(override);
3489
- }
3490
- const row = hostId !== null && hostId !== void 0 ? HOST_CAPABILITY_REGISTRY[hostId] : void 0;
3491
- if (row === void 0) {
3492
- return { ...SAFE_DEFAULT };
3493
- }
3494
- return { ...SAFE_DEFAULT, ...row, schema_version: 1 };
3495
- }
3496
- function probeHostCapabilities(hostId) {
3497
- const base = resolveHostCapabilities(hostId);
3498
- const flag = process2.env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS;
3499
- const probedAgentTeams = typeof flag === "string" && flag !== "";
3500
- return { ...base, agent_teams: base.agent_teams || probedAgentTeams };
3501
- }
3502
-
3503
3467
  // src/scripts/_lib/auto_dispatch.ts
3504
3468
  var SIZE_FLOOR = 1;
3505
3469
  function inSession(reason) {
@@ -4668,7 +4632,7 @@ if (_isCliEntry8()) {
4668
4632
  import * as fs9 from "node:fs";
4669
4633
  import * as os3 from "node:os";
4670
4634
  import * as path9 from "node:path";
4671
- import process3 from "node:process";
4635
+ import process2 from "node:process";
4672
4636
  import { fileURLToPath as fileURLToPath9, pathToFileURL as pathToFileURL9 } from "node:url";
4673
4637
  var _HERE = fileURLToPath9(import.meta.url);
4674
4638
  var REPO_ROOT2 = path9.resolve(path9.dirname(_HERE), "..", "..");
@@ -4877,7 +4841,7 @@ function render2(d) {
4877
4841
  return lines.join("\n");
4878
4842
  }
4879
4843
  function main9(argv) {
4880
- const args = argv ?? process3.argv.slice(2);
4844
+ const args = argv ?? process2.argv.slice(2);
4881
4845
  let projectDir = path9.join(REPO_ROOT2, PROJECT_RULES);
4882
4846
  let globalDir = path9.join(os3.homedir(), GLOBAL_RULES);
4883
4847
  let sourceDir = path9.join(REPO_ROOT2, PROJECTION_SOURCE);
@@ -4890,7 +4854,7 @@ function main9(argv) {
4890
4854
  if (a === "--project" || a === "--global" || a === "--source") {
4891
4855
  const v = value(i);
4892
4856
  if (v === null) {
4893
- process3.stderr.write(`report_carrier_divergence: ${a} needs a directory
4857
+ process2.stderr.write(`report_carrier_divergence: ${a} needs a directory
4894
4858
  `);
4895
4859
  return 1;
4896
4860
  }
@@ -4900,31 +4864,31 @@ function main9(argv) {
4900
4864
  else sourceDir = resolved;
4901
4865
  i += 1;
4902
4866
  } else if (a === "--help" || a === "-h") {
4903
- process3.stdout.write(
4867
+ process2.stdout.write(
4904
4868
  "usage: report_carrier_divergence [--project DIR] [--global DIR] [--source DIR]\n"
4905
4869
  );
4906
4870
  return 0;
4907
4871
  } else if (a !== void 0 && a.startsWith("--") && a !== "--quiet") {
4908
- process3.stderr.write(`report_carrier_divergence: unknown flag ${a}
4872
+ process2.stderr.write(`report_carrier_divergence: unknown flag ${a}
4909
4873
  `);
4910
4874
  return 1;
4911
4875
  }
4912
4876
  }
4913
- process3.stdout.write(`${render2(compareCarriers(projectDir, globalDir, sourceDir))}
4877
+ process2.stdout.write(`${render2(compareCarriers(projectDir, globalDir, sourceDir))}
4914
4878
  `);
4915
4879
  return 0;
4916
4880
  }
4917
4881
  function _isCliEntry9() {
4918
- if (process3.argv[1] === void 0) return false;
4919
- if (import.meta.url === pathToFileURL9(path9.resolve(process3.argv[1])).href) return true;
4882
+ if (process2.argv[1] === void 0) return false;
4883
+ if (import.meta.url === pathToFileURL9(path9.resolve(process2.argv[1])).href) return true;
4920
4884
  try {
4921
- return fs9.realpathSync(_HERE) === fs9.realpathSync(path9.resolve(process3.argv[1]));
4885
+ return fs9.realpathSync(_HERE) === fs9.realpathSync(path9.resolve(process2.argv[1]));
4922
4886
  } catch {
4923
4887
  return false;
4924
4888
  }
4925
4889
  }
4926
4890
  if (_isCliEntry9()) {
4927
- process3.exit(main9());
4891
+ process2.exit(main9());
4928
4892
  }
4929
4893
 
4930
4894
  // src/scripts/report_skill_activation.ts
@@ -5241,7 +5205,7 @@ if (process.argv[1] !== void 0 && import.meta.url === pathToFileURL10(path10.res
5241
5205
  import * as fs11 from "node:fs";
5242
5206
  import * as os5 from "node:os";
5243
5207
  import * as path11 from "node:path";
5244
- import process4 from "node:process";
5208
+ import process3 from "node:process";
5245
5209
  import { fileURLToPath as fileURLToPath11, pathToFileURL as pathToFileURL11 } from "node:url";
5246
5210
  var _HERE3 = fileURLToPath11(import.meta.url);
5247
5211
  var REPO_ROOT4 = path11.resolve(path11.dirname(_HERE3), "..", "..");
@@ -5503,7 +5467,7 @@ function render4(r) {
5503
5467
  return lines.join("\n");
5504
5468
  }
5505
5469
  function main11(argv) {
5506
- const args = argv ?? process4.argv.slice(2);
5470
+ const args = argv ?? process3.argv.slice(2);
5507
5471
  let limit = 30;
5508
5472
  let json = false;
5509
5473
  const stores = [];
@@ -5516,7 +5480,7 @@ function main11(argv) {
5516
5480
  if (a === "--limit") {
5517
5481
  const v = value(i);
5518
5482
  if (v === null) {
5519
- process4.stderr.write("report_skill_obligation_violations: --limit needs a number\n");
5483
+ process3.stderr.write("report_skill_obligation_violations: --limit needs a number\n");
5520
5484
  return 1;
5521
5485
  }
5522
5486
  limit = Number.parseInt(v, 10);
@@ -5524,7 +5488,7 @@ function main11(argv) {
5524
5488
  } else if (a === "--store") {
5525
5489
  const v = value(i);
5526
5490
  if (v === null) {
5527
- process4.stderr.write("report_skill_obligation_violations: --store needs a path\n");
5491
+ process3.stderr.write("report_skill_obligation_violations: --store needs a path\n");
5528
5492
  return 1;
5529
5493
  }
5530
5494
  stores.push(v);
@@ -5532,40 +5496,40 @@ function main11(argv) {
5532
5496
  } else if (a === "--json") {
5533
5497
  json = true;
5534
5498
  } else if (a === "--help" || a === "-h") {
5535
- process4.stdout.write(
5499
+ process3.stdout.write(
5536
5500
  "usage: report_skill_obligation_violations [--limit N] [--store PATH]... [--json]\n"
5537
5501
  );
5538
5502
  return 0;
5539
5503
  } else if (a !== void 0 && a.startsWith("--") && a !== "--quiet") {
5540
- process4.stderr.write(`report_skill_obligation_violations: unknown flag ${a}
5504
+ process3.stderr.write(`report_skill_obligation_violations: unknown flag ${a}
5541
5505
  `);
5542
5506
  return 1;
5543
5507
  }
5544
5508
  }
5545
5509
  if (!Number.isFinite(limit) || limit <= 0) {
5546
- process4.stderr.write("report_skill_obligation_violations: --limit must be a positive integer\n");
5510
+ process3.stderr.write("report_skill_obligation_violations: --limit must be a positive integer\n");
5547
5511
  return 1;
5548
5512
  }
5549
5513
  if (stores.length === 0) stores.push(defaultStore3(REPO_ROOT4));
5550
5514
  for (const store of stores) {
5551
5515
  const r = scanStore2(REPO_ROOT4, store, limit);
5552
- process4.stdout.write(json ? `${JSON.stringify(r, null, 2)}
5516
+ process3.stdout.write(json ? `${JSON.stringify(r, null, 2)}
5553
5517
  ` : `${render4(r)}
5554
5518
  `);
5555
5519
  }
5556
5520
  return 0;
5557
5521
  }
5558
5522
  function _isCliEntry10() {
5559
- if (process4.argv[1] === void 0) return false;
5560
- if (import.meta.url === pathToFileURL11(path11.resolve(process4.argv[1])).href) return true;
5523
+ if (process3.argv[1] === void 0) return false;
5524
+ if (import.meta.url === pathToFileURL11(path11.resolve(process3.argv[1])).href) return true;
5561
5525
  try {
5562
- return fs11.realpathSync(_HERE3) === fs11.realpathSync(path11.resolve(process4.argv[1]));
5526
+ return fs11.realpathSync(_HERE3) === fs11.realpathSync(path11.resolve(process3.argv[1]));
5563
5527
  } catch {
5564
5528
  return false;
5565
5529
  }
5566
5530
  }
5567
5531
  if (_isCliEntry10()) {
5568
- process4.exit(main11());
5532
+ process3.exit(main11());
5569
5533
  }
5570
5534
 
5571
5535
  // src/scripts/report_conformance_funnel.ts
@@ -5709,7 +5673,7 @@ function render5(r) {
5709
5673
  return lines.join("\n");
5710
5674
  }
5711
5675
  function main12(argv) {
5712
- const args = argv ?? process5.argv.slice(2);
5676
+ const args = argv ?? process4.argv.slice(2);
5713
5677
  const opts = {};
5714
5678
  const value = (i) => {
5715
5679
  const v = args[i + 1];
@@ -5720,7 +5684,7 @@ function main12(argv) {
5720
5684
  if (a === "--store" || a === "--project" || a === "--global" || a === "--source") {
5721
5685
  const v = value(i);
5722
5686
  if (v === null) {
5723
- process5.stderr.write(`report_conformance_funnel: ${a} needs a value
5687
+ process4.stderr.write(`report_conformance_funnel: ${a} needs a value
5724
5688
  `);
5725
5689
  return 1;
5726
5690
  }
@@ -5734,37 +5698,37 @@ function main12(argv) {
5734
5698
  const v = value(i);
5735
5699
  const n = v === null ? Number.NaN : Number.parseInt(v, 10);
5736
5700
  if (!Number.isFinite(n) || n <= 0) {
5737
- process5.stderr.write("report_conformance_funnel: --limit must be a positive integer\n");
5701
+ process4.stderr.write("report_conformance_funnel: --limit must be a positive integer\n");
5738
5702
  return 1;
5739
5703
  }
5740
5704
  opts.limit = n;
5741
5705
  i += 1;
5742
5706
  } else if (a === "--help" || a === "-h") {
5743
- process5.stdout.write(
5707
+ process4.stdout.write(
5744
5708
  "usage: report_conformance_funnel [--store PATH] [--limit N]\n [--project DIR] [--global DIR] [--source DIR]\n"
5745
5709
  );
5746
5710
  return 0;
5747
5711
  } else if (a !== void 0 && a.startsWith("--") && a !== "--quiet") {
5748
- process5.stderr.write(`report_conformance_funnel: unknown flag ${a}
5712
+ process4.stderr.write(`report_conformance_funnel: unknown flag ${a}
5749
5713
  `);
5750
5714
  return 1;
5751
5715
  }
5752
5716
  }
5753
- process5.stdout.write(`${render5(buildFunnel(opts))}
5717
+ process4.stdout.write(`${render5(buildFunnel(opts))}
5754
5718
  `);
5755
5719
  return 0;
5756
5720
  }
5757
5721
  function _isCliEntry11() {
5758
- if (process5.argv[1] === void 0) return false;
5759
- if (import.meta.url === pathToFileURL12(path12.resolve(process5.argv[1])).href) return true;
5722
+ if (process4.argv[1] === void 0) return false;
5723
+ if (import.meta.url === pathToFileURL12(path12.resolve(process4.argv[1])).href) return true;
5760
5724
  try {
5761
- return fs12.realpathSync(_HERE4) === fs12.realpathSync(path12.resolve(process5.argv[1]));
5725
+ return fs12.realpathSync(_HERE4) === fs12.realpathSync(path12.resolve(process4.argv[1]));
5762
5726
  } catch {
5763
5727
  return false;
5764
5728
  }
5765
5729
  }
5766
5730
  if (_isCliEntry11()) {
5767
- process5.exit(main12());
5731
+ process4.exit(main12());
5768
5732
  }
5769
5733
 
5770
5734
  // src/scripts/_cli/cmd_conformance.ts
@@ -5779,22 +5743,22 @@ var CONFORMANCE_CHECK_IDS = [
5779
5743
  ];
5780
5744
  var THIN_STUB_MARKER = "Routed rule \u2014 load the body on trigger-match";
5781
5745
  function print(s = "") {
5782
- process6.stdout.write(`${s}
5746
+ process5.stdout.write(`${s}
5783
5747
  `);
5784
5748
  }
5785
5749
  function eprint(s = "") {
5786
- process6.stderr.write(`${s}
5750
+ process5.stderr.write(`${s}
5787
5751
  `);
5788
5752
  }
5789
5753
  function conformanceLogPath() {
5790
- const override = process6.env["AGENT_CONFIG_CONFORMANCE_LOG"];
5754
+ const override = process5.env["AGENT_CONFIG_CONFORMANCE_LOG"];
5791
5755
  if (override && override.trim().length > 0) {
5792
5756
  return override;
5793
5757
  }
5794
5758
  return path13.join(os7.homedir(), ".event4u", "agent-config", "conformance-log.jsonl");
5795
5759
  }
5796
5760
  function installLogPath() {
5797
- const override = process6.env["AGENT_CONFIG_INSTALL_LOG"];
5761
+ const override = process5.env["AGENT_CONFIG_INSTALL_LOG"];
5798
5762
  if (override && override.trim().length > 0) {
5799
5763
  return override;
5800
5764
  }
@@ -6092,7 +6056,7 @@ function _check_host_manifest(projectRoot) {
6092
6056
  };
6093
6057
  }
6094
6058
  function runConformanceChecks(opts = {}) {
6095
- const projectRoot = opts.projectRoot ?? process6.cwd();
6059
+ const projectRoot = opts.projectRoot ?? process5.cwd();
6096
6060
  const packageRoot = opts.packageRoot ?? PACKAGE_ROOT;
6097
6061
  const checks = [];
6098
6062
  checks.push(_check_txlog_clean());
@@ -6133,7 +6097,7 @@ function _parse(argv) {
6133
6097
  while (i < argv.length) {
6134
6098
  const a = argv[i];
6135
6099
  if (a === "-h" || a === "--help") {
6136
- process6.stdout.write(USAGE2);
6100
+ process5.stdout.write(USAGE2);
6137
6101
  throw new ArgparseExit(0);
6138
6102
  }
6139
6103
  if (a === "--json") {
@@ -6147,16 +6111,16 @@ function _parse(argv) {
6147
6111
  opts.project = a.slice(a.indexOf("=") + 1);
6148
6112
  } else {
6149
6113
  if (i + 1 >= argv.length) {
6150
- process6.stderr.write(USAGE2);
6151
- process6.stderr.write("agent-config conformance: error: --project expects a value\n");
6114
+ process5.stderr.write(USAGE2);
6115
+ process5.stderr.write("agent-config conformance: error: --project expects a value\n");
6152
6116
  throw new ArgparseExit(2);
6153
6117
  }
6154
6118
  opts.project = argv[i + 1];
6155
6119
  i += 1;
6156
6120
  }
6157
6121
  } else {
6158
- process6.stderr.write(USAGE2);
6159
- process6.stderr.write(`agent-config conformance: error: unrecognized argument ${a}
6122
+ process5.stderr.write(USAGE2);
6123
+ process5.stderr.write(`agent-config conformance: error: unrecognized argument ${a}
6160
6124
  `);
6161
6125
  throw new ArgparseExit(2);
6162
6126
  }
@@ -6165,7 +6129,7 @@ function _parse(argv) {
6165
6129
  return opts;
6166
6130
  }
6167
6131
  function main13(argv = null) {
6168
- const opts = _parse(argv !== null ? Array.from(argv) : process6.argv.slice(2));
6132
+ const opts = _parse(argv !== null ? Array.from(argv) : process5.argv.slice(2));
6169
6133
  if (opts.funnel) {
6170
6134
  print(render5(buildFunnel()));
6171
6135
  return 0;
@@ -6236,27 +6200,27 @@ function main13(argv = null) {
6236
6200
  return failed ? 1 : 0;
6237
6201
  }
6238
6202
  function _isCliEntry12() {
6239
- if (process6.argv[1] === void 0) {
6203
+ if (process5.argv[1] === void 0) {
6240
6204
  return false;
6241
6205
  }
6242
- const argvUrl = pathToFileURL13(path13.resolve(process6.argv[1])).href;
6206
+ const argvUrl = pathToFileURL13(path13.resolve(process5.argv[1])).href;
6243
6207
  if (import.meta.url === argvUrl) {
6244
6208
  return true;
6245
6209
  }
6246
6210
  try {
6247
6211
  const here = fs13.realpathSync(fileURLToPath13(import.meta.url));
6248
- const argv = fs13.realpathSync(path13.resolve(process6.argv[1]));
6212
+ const argv = fs13.realpathSync(path13.resolve(process5.argv[1]));
6249
6213
  return here === argv;
6250
6214
  } catch {
6251
6215
  return false;
6252
6216
  }
6253
6217
  }
6254
- if (_isCliEntry12() || process6.argv[1] === _HERE5) {
6218
+ if (_isCliEntry12() || process5.argv[1] === _HERE5) {
6255
6219
  try {
6256
- process6.exitCode = main13(process6.argv.slice(2));
6220
+ process5.exitCode = main13(process5.argv.slice(2));
6257
6221
  } catch (e) {
6258
6222
  if (e instanceof ArgparseExit) {
6259
- process6.exitCode = e.code;
6223
+ process5.exitCode = e.code;
6260
6224
  } else {
6261
6225
  throw e;
6262
6226
  }
@@ -66,13 +66,13 @@ import {
66
66
  _wizard_state_path,
67
67
  main,
68
68
  shutilWhich
69
- } from "./chunk-IDHUQIXP.js";
69
+ } from "./chunk-NUMQHLS5.js";
70
70
  import "./chunk-FTAISGDQ.js";
71
71
  import "./chunk-M2DPGFZ4.js";
72
72
  import "./chunk-BTWUYDGN.js";
73
73
  import "./chunk-KPBWFOPZ.js";
74
74
  import "./chunk-E4XIZDIB.js";
75
- import "./chunk-PMEKGDED.js";
75
+ import "./chunk-PI2GU3DP.js";
76
76
  import "./chunk-MWRD5YOH.js";
77
77
  import "./chunk-T7L2QK3K.js";
78
78
  import "./chunk-DMSZHXZS.js";
@@ -9,13 +9,13 @@ import {
9
9
  KIRO_MARKER,
10
10
  ROOCODE_MARKER,
11
11
  ZED_MARKER
12
- } from "./chunk-GZTMRYCN.js";
12
+ } from "./chunk-C6IPZRDA.js";
13
13
  import "./chunk-4FS4WRXP.js";
14
14
  import "./chunk-6RJA2F5A.js";
15
15
  import "./chunk-WOKWX5PL.js";
16
16
  import "./chunk-523HCFYO.js";
17
17
  import "./chunk-A4QJ6ENT.js";
18
- import "./chunk-PMEKGDED.js";
18
+ import "./chunk-PI2GU3DP.js";
19
19
  import "./chunk-MWRD5YOH.js";
20
20
  import "./chunk-T7L2QK3K.js";
21
21
  import "./chunk-DMSZHXZS.js";
@@ -6,19 +6,21 @@ import {
6
6
  read_entries
7
7
  } from "./chunk-PKOBQADP.js";
8
8
  import {
9
- RECYCLE_CONSUMED_REL,
10
- RECYCLE_ENVELOPE_REL,
11
9
  RECYCLE_MAX_AGE_HOURS,
12
10
  collectRepoAnchor,
13
- describeDrift
14
- } from "./chunk-LPPWO5CE.js";
15
- import "./chunk-CYH5SP6M.js";
11
+ describeDrift,
12
+ env_session_id,
13
+ predecessorTracePresent,
14
+ recycle_consumed_rel,
15
+ resolveContinuityRecord
16
+ } from "./chunk-ZVBOHSVF.js";
17
+ import "./chunk-I6RHFQEG.js";
16
18
  import {
17
19
  hasBoundaryMarker,
18
20
  scanEnvelopeDirectives,
19
21
  validateRecycleEnvelope,
20
22
  wrapAsPriorSessionData
21
- } from "./chunk-7PRE6ZV2.js";
23
+ } from "./chunk-YS6XTLEK.js";
22
24
  import {
23
25
  readHookStdin
24
26
  } from "./chunk-F7DQWYR5.js";
@@ -29,6 +31,8 @@ import {
29
31
  projectStoreSlug
30
32
  } from "./chunk-KPBWFOPZ.js";
31
33
  import "./chunk-E4XIZDIB.js";
34
+ import "./chunk-MWRD5YOH.js";
35
+ import "./chunk-T7L2QK3K.js";
32
36
  import "./chunk-OY53J6II.js";
33
37
  import "./chunk-NLP54U3J.js";
34
38
  import "./chunk-NDJLNC6Q.js";
@@ -264,8 +268,19 @@ function consume_handoff_context(root, now = /* @__PURE__ */ new Date()) {
264
268
  remove();
265
269
  return guardedInjection(block, `handoff consumed (session=${sourceSession})`);
266
270
  }
267
- function consume_recycle_envelope(root, now = /* @__PURE__ */ new Date()) {
268
- const target = process2.env.AGENT_RECYCLE_ENVELOPE_FILE || path.join(root, RECYCLE_ENVELOPE_REL);
271
+ function consume_recycle_envelope(root, now = /* @__PURE__ */ new Date(), session_id = void 0) {
272
+ const sessionId = session_id === void 0 ? env_session_id() : session_id;
273
+ const override = process2.env.AGENT_RECYCLE_ENVELOPE_FILE;
274
+ let target;
275
+ if (override !== void 0 && override !== "") {
276
+ target = override;
277
+ } else {
278
+ const resolved = resolveContinuityRecord(root, sessionId);
279
+ if (resolved.file === null) {
280
+ return { action: "absent", reason: resolved.reason };
281
+ }
282
+ target = resolved.file;
283
+ }
269
284
  let text;
270
285
  try {
271
286
  text = fs.readFileSync(target, "utf-8");
@@ -274,7 +289,10 @@ function consume_recycle_envelope(root, now = /* @__PURE__ */ new Date()) {
274
289
  }
275
290
  const consume = () => {
276
291
  try {
277
- fs.renameSync(target, path.join(path.dirname(target), path.basename(RECYCLE_CONSUMED_REL)));
292
+ fs.renameSync(
293
+ target,
294
+ path.join(path.dirname(target), path.basename(recycle_consumed_rel(sessionId)))
295
+ );
278
296
  } catch {
279
297
  try {
280
298
  fs.unlinkSync(target);
@@ -314,12 +332,20 @@ function consume_recycle_envelope(root, now = /* @__PURE__ */ new Date()) {
314
332
  consume();
315
333
  return { action: "discard", reason: "recycle envelope workspace does not resolve" };
316
334
  }
335
+ const predecessor = String(envelope["predecessor"] ?? "").trim();
336
+ if (predecessor !== "" && !predecessorTracePresent(root, predecessor)) {
337
+ consume();
338
+ return {
339
+ action: "discard",
340
+ reason: `recycle envelope names predecessor "${predecessor}", which has no trace in this workspace`
341
+ };
342
+ }
317
343
  const drift = describeDrift(envelope, collectRepoAnchor(root));
318
344
  const warnings = scanEnvelopeDirectives(envelope);
319
345
  const focus = (process2.env.AGENT_RESUME_FOCUS ?? "").trim();
320
346
  const block = wrapAsPriorSessionData(JSON.stringify(envelope, null, 2), {
321
347
  kind: "recycle-envelope",
322
- source: RECYCLE_ENVELOPE_REL,
348
+ source: path.relative(root, target) || path.basename(target),
323
349
  warnings: [
324
350
  ...drift,
325
351
  ...focus ? [`FOCUS: attack "${focus}" first \u2014 the rest of this envelope is context.`] : [],
@@ -353,7 +379,11 @@ function main() {
353
379
  }
354
380
  if (event === "session_start") {
355
381
  const handoff = consume_handoff_context(root);
356
- const recycle = consume_recycle_envelope(root);
382
+ const recycle = consume_recycle_envelope(
383
+ root,
384
+ /* @__PURE__ */ new Date(),
385
+ String(envelope["session_id"] ?? "").trim() || env_session_id()
386
+ );
357
387
  const blocks = [];
358
388
  const reasons = [];
359
389
  if (recycle.action === "inject" && recycle.context) {
@@ -2,7 +2,7 @@
2
2
  import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
3
3
  import {
4
4
  memory_get_v1
5
- } from "./chunk-CYH5SP6M.js";
5
+ } from "./chunk-I6RHFQEG.js";
6
6
  import "./chunk-I3EIN2YG.js";
7
7
  import "./chunk-OY53J6II.js";
8
8
  import "./chunk-J55WI3RR.js";
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
2
2
  import {
3
3
  PROJECT_BRIDGE_MARKERS
4
- } from "./chunk-GZTMRYCN.js";
4
+ } from "./chunk-C6IPZRDA.js";
5
5
  import "./chunk-4FS4WRXP.js";
6
6
  import "./chunk-6RJA2F5A.js";
7
7
  import "./chunk-WOKWX5PL.js";
@@ -10,7 +10,7 @@ import "./chunk-A4QJ6ENT.js";
10
10
  import {
11
11
  manifest_path,
12
12
  read_manifest
13
- } from "./chunk-PMEKGDED.js";
13
+ } from "./chunk-PI2GU3DP.js";
14
14
  import "./chunk-MWRD5YOH.js";
15
15
  import "./chunk-T7L2QK3K.js";
16
16
  import "./chunk-DMSZHXZS.js";
@@ -3,7 +3,7 @@ import { createRequire as __acCreateRequire } from 'node:module'; const require
3
3
  import {
4
4
  read_entries
5
5
  } from "./chunk-PKOBQADP.js";
6
- import "./chunk-CYH5SP6M.js";
6
+ import "./chunk-I6RHFQEG.js";
7
7
  import "./chunk-F7DQWYR5.js";
8
8
  import "./chunk-I3EIN2YG.js";
9
9
  import {