@event4u/agent-config 17.3.0 → 17.4.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 (137) 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 +164 -342
  5. package/CREDITS.md +2 -2
  6. package/README.md +1 -1
  7. package/dist/agent-src/skills/code-intelligence/SKILL.md +3 -0
  8. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  9. package/dist/cli/registry.js +2 -2
  10. package/dist/cli-delegate/{chunk-DHSSP7V3.js → chunk-5AYJGUA3.js} +0 -2
  11. package/dist/cli-delegate/chunk-DIFZBP4G.js +1336 -0
  12. package/dist/cli-delegate/{chunk-MT2WOOCY.js → chunk-WY5ZZPGL.js} +2 -2
  13. package/dist/cli-delegate/{chunk-ORJPBER2.js → chunk-X6LZ7W5A.js} +73 -10
  14. package/dist/cli-delegate/cmd_conformance.js +175 -183
  15. package/dist/cli-delegate/cmd_doctor.js +5 -5
  16. package/dist/cli-delegate/cmd_doctor_neighbours.js +3 -3
  17. package/dist/cli-delegate/cmd_explain.js +1 -1
  18. package/dist/cli-delegate/cmd_handoff.js +2 -2
  19. package/dist/cli-delegate/cmd_memory_get.js +1 -1
  20. package/dist/cli-delegate/cmd_route_audit.js +1 -1
  21. package/dist/cli-delegate/cmd_session_recycle.js +2 -2
  22. package/dist/cli-delegate/cmd_update.js +24 -13
  23. package/dist/cli-delegate/cmd_upgrade.js +2 -2
  24. package/dist/cli-delegate/dist-25AZAHOP.js +3240 -0
  25. package/dist/cli-delegate/dist-P7MFPMF3.js +411 -0
  26. package/dist/cli-delegate/dist-XAS5ZLQB.js +6 -0
  27. package/dist/cli-delegate/{upgrade_unattended-VVL6JLSX.js → upgrade_unattended-QCWOKTUN.js} +178 -163
  28. package/dist/discovery/deprecation-report.md +1 -1
  29. package/dist/discovery/discovery-manifest.json +3 -3
  30. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  31. package/dist/discovery/discovery-manifest.summary.md +1 -1
  32. package/dist/discovery/dormancy-report.md +1 -1
  33. package/dist/discovery/orphan-report.md +1 -1
  34. package/dist/discovery/packs.json +2 -2
  35. package/dist/discovery/trust-report.md +1 -1
  36. package/dist/discovery/workspaces.json +2 -2
  37. package/dist/hooks/code_graph_refresh.chunk.cjs +56 -27
  38. package/dist/hooks/code_graph_refresh.chunk.cjs.sha256 +1 -1
  39. package/dist/hooks/dispatch.js +982 -929
  40. package/dist/hooks/dispatch.sha256 +1 -1
  41. package/dist/hooks/egress_engine.chunk.cjs +56 -6
  42. package/dist/hooks/egress_engine.chunk.cjs.sha256 +1 -1
  43. package/dist/hooks/update_notice.chunk.cjs +914 -0
  44. package/dist/hooks/update_notice.chunk.cjs.sha256 +1 -0
  45. package/dist/mcp/registry-manifest.json +1 -1
  46. package/dist/mcp/server.json +2 -2
  47. package/dist/mcp/server.mjs +71259 -66437
  48. package/dist/scripts/condense.js +9 -6
  49. package/package.json +4 -1
  50. package/src/config/evaluator-budgets.json +9 -8
  51. package/src/config/gate-violation-baselines.json +2 -2
  52. package/src/config/hook-bundle-budget.json +31 -6
  53. package/src/config/packed-binary-manifest.json +9 -0
  54. package/src/config/sigstore/npm_keys.json +50 -0
  55. package/src/config/sigstore/trust-material.json +9 -0
  56. package/src/config/sigstore/trusted_root.json +126 -0
  57. package/src/config/skill-body-budget.json +7 -1
  58. package/src/scripts/_cli/cmd_update.ts +48 -20
  59. package/src/scripts/_cli/cmd_upgrade.ts +7 -1
  60. package/src/scripts/_cli/upgrade_unattended.ts +90 -76
  61. package/src/scripts/_dispatch.bash +3 -2
  62. package/src/scripts/_lib/confusables.ts +0 -19
  63. package/src/scripts/_lib/egress_normalize.ts +53 -23
  64. package/src/scripts/_lib/egress_text.ts +5 -3
  65. package/src/scripts/_lib/egress_token.ts +7 -5
  66. package/src/scripts/_lib/gate_collector_experimental.ts +633 -0
  67. package/src/scripts/_lib/git_common_dir.ts +10 -0
  68. package/src/scripts/_lib/graph_feeder_record.ts +3 -2
  69. package/src/scripts/_lib/install_reach_checks.ts +32 -2
  70. package/src/scripts/_lib/lineage_backfill.ts +136 -0
  71. package/src/scripts/_lib/lineage_ledger.ts +211 -0
  72. package/src/scripts/_lib/lineage_map.ts +55 -0
  73. package/src/scripts/_lib/lineage_query.ts +140 -0
  74. package/src/scripts/_lib/lineage_seed.ts +116 -0
  75. package/src/scripts/_lib/lineage_watch.ts +249 -0
  76. package/src/scripts/_lib/link_crypto.ts +8 -4
  77. package/src/scripts/_lib/production_reach.ts +3 -3
  78. package/src/scripts/_lib/project_registry.ts +227 -0
  79. package/src/scripts/_lib/provenance_verify.ts +14 -242
  80. package/src/scripts/_lib/sigstore_provenance.ts +177 -0
  81. package/src/scripts/_lib/source_id.ts +48 -0
  82. package/src/scripts/_lib/source_shape.ts +4 -0
  83. package/src/scripts/_lib/unattended_gates.ts +6 -1
  84. package/src/scripts/advisories.ts +26 -10
  85. package/src/scripts/ai_council/council_egress.ts +5 -6
  86. package/src/scripts/bench_graph_feeder_latency.ts +10 -3
  87. package/src/scripts/check_dependency_floors.ts +7 -0
  88. package/src/scripts/check_egress_mutations.ts +1 -0
  89. package/src/scripts/code_graph/build.ts +67 -3
  90. package/src/scripts/code_graph/cli.ts +131 -28
  91. package/src/scripts/code_graph/conventions_default.ts +20 -1
  92. package/src/scripts/code_graph/detect.ts +5 -5
  93. package/src/scripts/code_graph/estate_cli.ts +135 -0
  94. package/src/scripts/code_graph/estate_index.ts +394 -0
  95. package/src/scripts/code_graph/estate_manifests.ts +223 -0
  96. package/src/scripts/code_graph/estate_map.ts +141 -0
  97. package/src/scripts/code_graph/extract.ts +4 -1
  98. package/src/scripts/code_graph/extract_more.ts +137 -2
  99. package/src/scripts/code_graph/graph_budget.ts +158 -0
  100. package/src/scripts/code_graph/graph_home.ts +80 -0
  101. package/src/scripts/code_graph/lineage_cli.ts +315 -0
  102. package/src/scripts/code_graph/map.ts +22 -13
  103. package/src/scripts/code_graph/map_model.ts +67 -12
  104. package/src/scripts/code_graph/map_verify.ts +68 -5
  105. package/src/scripts/code_graph/map_viewer/viewer.css +12 -0
  106. package/src/scripts/code_graph/map_viewer/viewer.js +45 -15
  107. package/src/scripts/code_graph/project_ref.ts +25 -0
  108. package/src/scripts/code_graph/projects_cli.ts +254 -0
  109. package/src/scripts/code_graph/providers/catalog.ts +14 -5
  110. package/src/scripts/code_graph/providers/django.ts +52 -9
  111. package/src/scripts/code_graph/providers/index.ts +2 -0
  112. package/src/scripts/code_graph/providers/rails.ts +204 -0
  113. package/src/scripts/code_graph/providers/spring.ts +38 -1
  114. package/src/scripts/code_graph/query.ts +9 -9
  115. package/src/scripts/code_graph/refresh_lock.ts +12 -8
  116. package/src/scripts/code_graph/repo_identity.ts +169 -0
  117. package/src/scripts/code_graph/sqlite_store.ts +22 -25
  118. package/src/scripts/code_graph/types.ts +6 -2
  119. package/src/scripts/condense.ts +6 -6
  120. package/src/scripts/hook_chunks.mjs +7 -0
  121. package/src/scripts/hook_manifest.json +1 -1
  122. package/src/scripts/hook_manifest.yaml +20 -17
  123. package/src/scripts/hooks/code_graph_refresh_hook.ts +10 -7
  124. package/src/scripts/hooks/dispatch_hook.ts +6 -7
  125. package/src/scripts/hooks/host_semantics.ts +72 -0
  126. package/src/scripts/hooks/lazy_concern.ts +4 -0
  127. package/src/scripts/hooks/user_notice.ts +105 -0
  128. package/src/scripts/lint_harvest_provenance.ts +137 -11
  129. package/src/scripts/mcp_server/consumer_tool_catalog.json +69 -15
  130. package/src/scripts/mcp_server/graph_tools.ts +161 -41
  131. package/src/scripts/network_sources.ts +24 -6
  132. package/src/scripts/schemas/provenance-mechanism.schema.json +46 -0
  133. package/src/scripts/update_notice_hook.ts +75 -7
  134. package/src/vendor/grammars/README.md +7 -6
  135. package/src/vendor/grammars/tree-sitter-ruby.wasm +0 -0
  136. /package/dist/cli-delegate/{chunk-FKYZOWVD.js → chunk-QBAFP67O.js} +0 -0
  137. /package/dist/cli-delegate/{chunk-BMGUGSY6.js → chunk-TQG6UMPC.js} +0 -0
@@ -49,25 +49,6 @@ export const CONFUSABLE_FOREIGN: ReadonlySet<number> = new Set([
49
49
  0x03a1 /*Ρ→P*/, 0x03a4 /*Τ→T*/, 0x03a5 /*Υ→Y*/, 0x03a7 /*Χ→X*/, 0x0392 /*Β→B*/,
50
50
  ]);
51
51
 
52
- /**
53
- * The basic-Latin twin of each confusable foreign letter that has one, for a
54
- * detector that folds a lookalike back before matching. Every key is in
55
- * `CONFUSABLE_FOREIGN`, which a test holds.
56
- */
57
- export const LATIN_TWIN: ReadonlyMap<number, string> = new Map([
58
- [0x0430, 'a'], [0x0435, 'e'], [0x043e, 'o'], [0x0440, 'p'], [0x0441, 'c'],
59
- [0x0443, 'y'], [0x0445, 'x'], [0x0455, 's'], [0x0456, 'i'], [0x0458, 'j'],
60
- [0x04bb, 'h'], [0x0501, 'd'], [0x051b, 'q'],
61
- [0x0410, 'A'], [0x0412, 'B'], [0x0415, 'E'], [0x041a, 'K'], [0x041c, 'M'],
62
- [0x041d, 'H'], [0x041e, 'O'], [0x0420, 'P'], [0x0421, 'C'], [0x0422, 'T'],
63
- [0x0423, 'Y'], [0x0425, 'X'], [0x0405, 'S'], [0x0406, 'I'], [0x0408, 'J'],
64
- [0x03b1, 'a'], [0x03b5, 'e'], [0x03bf, 'o'], [0x03bd, 'v'], [0x03c1, 'p'],
65
- [0x03c5, 'u'], [0x03c7, 'x'], [0x03ba, 'k'],
66
- [0x0391, 'A'], [0x0392, 'B'], [0x0395, 'E'], [0x0396, 'Z'], [0x0397, 'H'],
67
- [0x0399, 'I'], [0x039a, 'K'], [0x039c, 'M'], [0x039d, 'N'], [0x039f, 'O'],
68
- [0x03a1, 'P'], [0x03a4, 'T'], [0x03a5, 'Y'], [0x03a7, 'X'],
69
- ]);
70
-
71
52
  type ScriptName = 'latin' | 'cyrillic' | 'greek' | 'other';
72
53
 
73
54
  function _script_of(ch: string): ScriptName {
@@ -8,9 +8,20 @@
8
8
  * back to the original offsets, so a replacement removes the disguised bytes
9
9
  * too. Pure: no I/O.
10
10
  */
11
- import { LATIN_TWIN } from './confusables.js';
12
11
  import { detect, EGRESS_RULES, type EgressRule, type EgressSpan } from './egress_rules.js';
13
12
 
13
+ // Aligned: the n-th code point of FOREIGN, three hex digits each, folds to the
14
+ // n-th letter of LATIN. Kept here, not in confusables.ts, so the engine chunk
15
+ // does not carry that module's script regexes.
16
+ const FOREIGN = '43043543e4404414434454554564584bb50151b41041241541a41c41d41e4204214224234254054064083b13b53bf3bd3c13c53c73ba39139239539639739939a39c39d39f3a13a43a53a7';
17
+ const LATIN = 'aeopcyxsijhdqABEKMHOPCTYXSIJaeovpuxkABEZHIKMNOPTYX';
18
+
19
+ /**
20
+ * The basic-Latin twin of each confusable foreign letter that has one. Every
21
+ * key is in `CONFUSABLE_FOREIGN` (confusables.ts), which a test holds.
22
+ */
23
+ export const LATIN_TWIN: ReadonlyMap<number, string> = new Map([...LATIN].map((c, i) => [parseInt(FOREIGN.slice(i * 3, i * 3 + 3), 16), c]));
24
+
14
25
  /**
15
26
  * Invisible and bidirectional-control characters: soft hyphen, zero-width
16
27
  * marks, bidi embeddings and isolates, word joiners, the BOM and the Tag block.
@@ -19,17 +30,15 @@ export const HIDDEN_UNICODE_RE = /[­​-‏‪-‮⁠-⁤⁦-⁩\u{E0000}-\u
19
30
 
20
31
  export interface Normalized {
21
32
  readonly text: string;
22
- /** For each UTF-16 unit of `text`, the original offsets of the character it came from. */
23
- readonly originStart: readonly number[];
24
- readonly originEnd: readonly number[];
33
+ /** For each UTF-16 unit of `text`, the original offset of the character it came from. */
34
+ readonly origin: readonly number[];
25
35
  readonly hidden: number;
26
36
  readonly folded: number;
27
37
  }
28
38
 
29
39
  export function normalizeForDetection(text: string): Normalized {
30
- const out: string[] = [];
31
- const originStart: number[] = [];
32
- const originEnd: number[] = [];
40
+ let out = '';
41
+ const origin: number[] = [];
33
42
  let hidden = 0;
34
43
  let folded = 0;
35
44
  let at = 0;
@@ -38,30 +47,51 @@ export function normalizeForDetection(text: string): Normalized {
38
47
  if (HIDDEN_UNICODE_RE.test(ch)) {
39
48
  hidden += 1;
40
49
  } else {
41
- const twin = LATIN_TWIN.get(ch.codePointAt(0) as number);
42
- if (twin !== undefined) folded += 1;
43
- const emit = twin ?? ch;
44
- for (let k = 0; k < emit.length; k += 1) {
45
- originStart.push(at);
46
- originEnd.push(at + ch.length);
47
- }
48
- out.push(emit);
50
+ const emit = LATIN_TWIN.get(ch.codePointAt(0) as number) ?? ch;
51
+ if (emit !== ch) folded += 1;
52
+ out += emit;
53
+ for (let k = 0; k < emit.length; k += 1) origin.push(at);
49
54
  }
50
55
  at += ch.length;
51
56
  }
52
- return { text: out.join(''), originStart, originEnd, hidden, folded };
57
+ return { text: out, origin, hidden, folded };
58
+ }
59
+
60
+ export interface NormalizedDetection {
61
+ readonly spans: EgressSpan[];
62
+ /**
63
+ * An extent reader such as a rule's `through`, applied to the text the spans
64
+ * were found in, with its end in original offsets. A disguised END marker is
65
+ * then seen by the reader exactly as the disguised BEGIN was by the rule.
66
+ */
67
+ end<S extends EgressSpan>(span: S, read: (text: string, span: S) => number | null): number | null;
53
68
  }
54
69
 
55
70
  /**
56
71
  * `detect`, run on the normalised text with spans in original offsets. With no
57
72
  * invisible or confusable character the result is `detect(text)` exactly.
58
73
  */
59
- export function detectNormalized(text: string, rules: readonly EgressRule[] = EGRESS_RULES): EgressSpan[] {
74
+ export function detectWithExtent(text: string, rules: readonly EgressRule[] = EGRESS_RULES): NormalizedDetection {
60
75
  const n = normalizeForDetection(text);
61
- if (n.hidden === 0 && n.folded === 0) return detect(text, rules);
62
- return detect(n.text, rules).map((s) => ({
63
- ...s,
64
- start: n.originStart[s.start] as number,
65
- end: n.originEnd[s.end - 1] as number,
66
- }));
76
+ if (n.hidden === 0 && n.folded === 0) return { spans: detect(text, rules), end: (s, read) => read(text, s) };
77
+ const back = (i: number): number => {
78
+ const o = n.origin[i - 1] as number;
79
+ return o + ((text.codePointAt(o) as number) > 0xffff ? 2 : 1);
80
+ };
81
+ const fwd = (o: number): number => {
82
+ let i = 0;
83
+ while (i < n.origin.length && (n.origin[i] as number) < o) i += 1;
84
+ return i;
85
+ };
86
+ return {
87
+ spans: detect(n.text, rules).map((s) => ({ ...s, start: n.origin[s.start] as number, end: back(s.end) })),
88
+ end: (s, read) => {
89
+ const e = read(n.text, { ...s, start: fwd(s.start), end: fwd(s.end) });
90
+ return e === null ? null : back(e);
91
+ },
92
+ };
93
+ }
94
+
95
+ export function detectNormalized(text: string, rules: readonly EgressRule[] = EGRESS_RULES): EgressSpan[] {
96
+ return detectWithExtent(text, rules).spans;
67
97
  }
@@ -3,7 +3,8 @@
3
3
  // (`egress_engine.ts`, D9), so the stage keeps the field walk and the chunk
4
4
  // keeps everything that reads a rule.
5
5
 
6
- import { detect, EGRESS_RULES, type EgressClass } from './egress_rules.js';
6
+ import { detectWithExtent } from './egress_normalize.js';
7
+ import { EGRESS_RULES, type EgressClass } from './egress_rules.js';
7
8
  import { EgressRefusedError, replaceValues, type TokenScope } from './egress_token.js';
8
9
 
9
10
  const RULE_BY_ID = new Map(EGRESS_RULES.map((r) => [r.rule, r]));
@@ -19,10 +20,11 @@ export interface TextTally {
19
20
  export function tallyText(text: string): TextTally {
20
21
  const found: Array<{ class: EgressClass; type: string }> = [];
21
22
  const refused: string[] = [];
22
- for (const span of detect(text)) {
23
+ const at = detectWithExtent(text);
24
+ for (const span of at.spans) {
23
25
  const policy = RULE_BY_ID.get(span.rule)?.replacement;
24
26
  if (policy !== undefined && policy !== 'detection') {
25
- const end = policy.through(text, span);
27
+ const end = at.end(span, policy.through);
26
28
  if (end === null || end < span.end) {
27
29
  refused.push(span.rule);
28
30
  continue;
@@ -5,7 +5,8 @@
5
5
 
6
6
  import { createHmac, randomBytes } from 'node:crypto';
7
7
 
8
- import { detect, EGRESS_RULES, type EgressClass, type EgressSpan, replaceSpans } from './egress_rules.js';
8
+ import { detectWithExtent, type NormalizedDetection } from './egress_normalize.js';
9
+ import { EGRESS_RULES, type EgressClass, type EgressSpan, replaceSpans } from './egress_rules.js';
9
10
 
10
11
  export const TOKEN_FP_LENGTH = 6;
11
12
 
@@ -209,12 +210,12 @@ const RULE_BY_ID = new Map(EGRESS_RULES.map((r) => [r.rule, r]));
209
210
  const CLASS_RANK: Readonly<Record<EgressClass, number>> = { credential: 1, identifier: 0 };
210
211
 
211
212
  /** The bytes each detection obliges a replacement to remove; overlapping extents merge. */
212
- function replacementSpans(text: string, detected: readonly EgressSpan[]): EgressSpan[] {
213
+ function replacementSpans(detected: readonly EgressSpan[], at: NormalizedDetection): EgressSpan[] {
213
214
  const extents = detected.map((s) => {
214
215
  const policy = RULE_BY_ID.get(s.rule)?.replacement;
215
216
  if (policy === undefined) throw new EgressRefusedError(s.rule);
216
217
  if (policy === 'detection') return s;
217
- const end = policy.through(text, s);
218
+ const end = at.end(s, policy.through);
218
219
  if (end === null || end < s.end) throw new EgressRefusedError(s.rule);
219
220
  return { ...s, end };
220
221
  });
@@ -243,8 +244,9 @@ function replacementSpans(text: string, detected: readonly EgressSpan[]): Egress
243
244
  */
244
245
  export function replaceValues(text: string, scope: TokenScope): string {
245
246
  const owned = parseTokens(text).filter((t) => scope.owns(text.slice(t.start, t.end)));
246
- const detected = detect(text).filter((s) => !owned.some((t) => t.start <= s.start && s.end <= t.end));
247
- const spans = replacementSpans(text, detected);
247
+ const at = detectWithExtent(text);
248
+ const detected = at.spans.filter((s) => !owned.some((t) => t.start <= s.start && s.end <= t.end));
249
+ const spans = replacementSpans(detected, at);
248
250
  // Mint in text order first: replaceSpans substitutes right to left, and minting
249
251
  // inside its callback would number the last value 1.
250
252
  const tokens = spans.map((s) => scope.mint(s.type, s.class, text.slice(s.start, s.end)));