@event4u/agent-config 9.32.0 → 9.34.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 (109) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +85 -72
  3. package/dist/agent-src/commands/agent-handoff.md +15 -3
  4. package/dist/agent-src/commands/review/routing.md +3 -4
  5. package/dist/agent-src/contexts/communication/rules-auto/reply-close-mechanics.md +65 -0
  6. package/dist/agent-src/contexts/execution/orchestration-telemetry.md +3 -0
  7. package/dist/agent-src/rules/delegation-policy.md +6 -0
  8. package/dist/agent-src/scripts/archive_completed_roadmaps.ts +35 -1
  9. package/dist/agent-src/scripts/roadmap_gates.ts +107 -3
  10. package/dist/agent-src/skills/corpus-grounding/SKILL.md +21 -12
  11. package/dist/agent-src/skills/design-tokens/SKILL.md +15 -0
  12. package/dist/agent-src/skills/docker/SKILL.md +11 -0
  13. package/dist/agent-src/skills/laravel/SKILL.md +11 -0
  14. package/dist/agent-src/skills/react-shadcn-ui/SKILL.md +24 -0
  15. package/dist/agent-src/skills/review-routing/SKILL.md +23 -6
  16. package/dist/agent-src/skills/rule-writing/SKILL.md +23 -0
  17. package/dist/agent-src/skills/skill-writing/SKILL.md +80 -2
  18. package/dist/agent-src/skills/systematic-debugging/SKILL.md +5 -3
  19. package/dist/agent-src/skills/tailwind-engineer/SKILL.md +24 -0
  20. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  21. package/dist/agent-src/templates/scripts/ownership-map.example.yml +1 -1
  22. package/dist/cli/registry.js +4 -4
  23. package/dist/cli/registry.js.map +1 -1
  24. package/dist/cli-delegate/chunk-HTIU3W56.js +66 -0
  25. package/dist/cli-delegate/{chunk-2WELHO3P.js → chunk-I5EAFRII.js} +35 -0
  26. package/dist/cli-delegate/{chunk-ITIQSGOQ.js → chunk-MA4GFWDY.js} +7 -4
  27. package/dist/cli-delegate/{chunk-PFBV6XRT.js → chunk-Q26HT4QT.js} +1 -63
  28. package/dist/cli-delegate/{chunk-542DZR4P.js → chunk-REMEZSVP.js} +1660 -146
  29. package/dist/cli-delegate/{chunk-3EWYC3YK.js → chunk-UEZ7D35A.js} +4 -3
  30. package/dist/cli-delegate/{chunk-LVRYBKTI.js → chunk-YPAWXXXR.js} +158 -0
  31. package/dist/cli-delegate/cmd_conformance.js +256 -226
  32. package/dist/cli-delegate/cmd_doctor.js +3 -2
  33. package/dist/cli-delegate/cmd_export.js +1 -1
  34. package/dist/cli-delegate/cmd_handoff.js +21 -28
  35. package/dist/cli-delegate/cmd_memory_get.js +1 -1
  36. package/dist/cli-delegate/cmd_prune.js +1 -1
  37. package/dist/cli-delegate/cmd_route_audit.js +1 -1
  38. package/dist/cli-delegate/cmd_session_recycle.js +20 -5
  39. package/dist/cli-delegate/cmd_settings_get.js +4 -2
  40. package/dist/cli-delegate/cmd_settings_migrate.js +1 -1
  41. package/dist/cli-delegate/cmd_settings_set.js +5 -3
  42. package/dist/cli-delegate/cmd_sync.js +1 -1
  43. package/dist/cli-delegate/cmd_uninstall.js +1 -1
  44. package/dist/cli-delegate/cmd_validate.js +1 -1
  45. package/dist/discovery/deprecation-report.md +1 -1
  46. package/dist/discovery/discovery-manifest.json +17 -17
  47. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  48. package/dist/discovery/discovery-manifest.summary.md +2 -2
  49. package/dist/discovery/dormancy-report.md +17 -0
  50. package/dist/discovery/orphan-report.md +1 -1
  51. package/dist/discovery/packs.json +3 -3
  52. package/dist/discovery/trust-report.md +1 -1
  53. package/dist/discovery/workspaces.json +3 -3
  54. package/dist/hooks/dispatch.js +114 -7
  55. package/dist/install/install.mjs +7 -4
  56. package/dist/mcp/registry-manifest.json +3 -3
  57. package/dist/mcp/server.json +2 -2
  58. package/dist/mcp/server.mjs +3755 -1168
  59. package/docs/guidelines/agent-infra/failure-signatures.md +47 -12
  60. package/package.json +2 -2
  61. package/src/agent-src/scripts/archive_completed_roadmaps.ts +35 -1
  62. package/src/agent-src/scripts/roadmap_gates.ts +107 -3
  63. package/src/agent-src/templates/scripts/ownership-map.example.yml +1 -1
  64. package/src/config/cost-parity-budget.json +167 -0
  65. package/src/config/gate-coverage.yml +44 -5
  66. package/src/config/quorum-attendance-budget.json +39 -0
  67. package/src/scripts/_cli/cmd_doctor.ts +69 -1
  68. package/src/scripts/_cli/cmd_session_recycle.ts +25 -4
  69. package/src/scripts/_dispatch.bash +5 -3
  70. package/src/scripts/_lib/env_kill_switch.ts +37 -0
  71. package/src/scripts/_lib/orchestration_record.ts +45 -0
  72. package/src/scripts/_lib/security_lint.ts +18 -4
  73. package/src/scripts/_lib/self_repair.ts +60 -0
  74. package/src/scripts/_lib/self_repair_store.ts +65 -5
  75. package/src/scripts/_lib/subagent_capsule.ts +78 -1
  76. package/src/scripts/ai_council/clients.ts +31 -0
  77. package/src/scripts/ai_council/events_log.ts +130 -8
  78. package/src/scripts/ai_council/orchestrator.ts +50 -3
  79. package/src/scripts/ai_council/pricing.ts +48 -1
  80. package/src/scripts/ai_council/prompts.ts +165 -3
  81. package/src/scripts/ai_council/quorum.ts +30 -0
  82. package/src/scripts/ai_council/session.ts +11 -0
  83. package/src/scripts/ai_team/review_gate.ts +2 -2
  84. package/src/scripts/ask_transport.ts +20 -1
  85. package/src/scripts/build_discovery_manifest.ts +165 -0
  86. package/src/scripts/cache_realization_report.ts +38 -0
  87. package/src/scripts/check_claims.ts +51 -2
  88. package/src/scripts/check_release_highlights.ts +7 -1
  89. package/src/scripts/ci_time_ratio.ts +3 -1
  90. package/src/scripts/conformance_scan.ts +105 -0
  91. package/src/scripts/cost/track.mjs +39 -0
  92. package/src/scripts/cost_summary.ts +104 -1
  93. package/src/scripts/council_cli.ts +131 -13
  94. package/src/scripts/discovery_graph.ts +201 -27
  95. package/src/scripts/dispatch_economy_report.ts +5 -2
  96. package/src/scripts/dispatch_r2_reviewer.ts +102 -1
  97. package/src/scripts/install.ts +20 -6
  98. package/src/scripts/lint_budget_ownership.ts +81 -0
  99. package/src/scripts/lint_handoffs.ts +92 -2
  100. package/src/scripts/lint_hedge_words.ts +317 -0
  101. package/src/scripts/lint_mcp_config_security.ts +1 -1
  102. package/src/scripts/lint_skill_frontmatter_safety.ts +56 -2
  103. package/src/scripts/lint_workflow_paths.ts +384 -0
  104. package/src/scripts/preamble_byte_census.ts +9 -1
  105. package/src/scripts/report_carrier_divergence.ts +10 -0
  106. package/src/scripts/report_conformance_funnel.ts +40 -0
  107. package/src/scripts/schemas/subagent.schema.json +3 -2
  108. package/src/scripts/self_repair_cli.ts +26 -1
  109. package/src/scripts/skill_linter.ts +58 -2
@@ -271,7 +271,7 @@ function* iter_corpus(roots = DEFAULT_SCAN_ROOTS, exts = [".md"]) {
271
271
  function report(findings, opts) {
272
272
  const check_label = opts.check_label;
273
273
  if (findings.length === 0) {
274
- process.stdout.write(`\u2705 ${check_label}: clean (${_corpus_note()}).
274
+ process.stdout.write(`\u2705 ${check_label}: clean (${_corpus_note(opts.scanned_roots)}).
275
275
  `);
276
276
  return 0;
277
277
  }
@@ -311,8 +311,9 @@ function _pyG(n) {
311
311
  }
312
312
  return s;
313
313
  }
314
- function _corpus_note() {
315
- return "scanned " + DEFAULT_SCAN_ROOTS.join(", ");
314
+ function _corpus_note(scanned_roots) {
315
+ const roots = scanned_roots && scanned_roots.length > 0 ? scanned_roots : DEFAULT_SCAN_ROOTS;
316
+ return "scanned " + roots.join(", ");
316
317
  }
317
318
  var PyFloat = class {
318
319
  constructor(value) {
@@ -1340,6 +1340,159 @@ function _pyTruthy(value) {
1340
1340
  return Object.keys(value).length > 0;
1341
1341
  }
1342
1342
 
1343
+ // src/scripts/_lib/cc_transcript.ts
1344
+ import * as fs2 from "node:fs";
1345
+ import * as path2 from "node:path";
1346
+ import { homedir as homedir2 } from "node:os";
1347
+ var DEFAULT_PROJECTS_ROOT = path2.join(homedir2(), ".claude", "projects");
1348
+ function billableInputTokens(u) {
1349
+ return u.input_tokens + u.cache_read_input_tokens + u.cache_creation_input_tokens;
1350
+ }
1351
+ function weightedInputUnits(u) {
1352
+ const knownSplit = u.ephemeral_5m_input_tokens + u.ephemeral_1h_input_tokens;
1353
+ const unaccounted = Math.max(0, u.cache_creation_input_tokens - knownSplit);
1354
+ return u.input_tokens * 1 + u.cache_read_input_tokens * 0.1 + (u.ephemeral_5m_input_tokens + unaccounted) * 1.25 + u.ephemeral_1h_input_tokens * 2;
1355
+ }
1356
+ function numOr0(value) {
1357
+ return typeof value === "number" && Number.isFinite(value) ? value : 0;
1358
+ }
1359
+ function toTokenCounts(raw) {
1360
+ const cc = raw?.cache_creation ?? {};
1361
+ return {
1362
+ input_tokens: numOr0(raw?.input_tokens),
1363
+ cache_read_input_tokens: numOr0(raw?.cache_read_input_tokens),
1364
+ cache_creation_input_tokens: numOr0(raw?.cache_creation_input_tokens),
1365
+ output_tokens: numOr0(raw?.output_tokens),
1366
+ ephemeral_5m_input_tokens: numOr0(cc.ephemeral_5m_input_tokens),
1367
+ ephemeral_1h_input_tokens: numOr0(cc.ephemeral_1h_input_tokens)
1368
+ };
1369
+ }
1370
+ function classifyBucket(raw) {
1371
+ const hasAgentId = typeof raw.agentId === "string" && raw.agentId.length > 0;
1372
+ return hasAgentId || raw.isSidechain === true ? "subagent" : "main";
1373
+ }
1374
+ function dedupKey(raw) {
1375
+ const id = typeof raw.message?.id === "string" ? raw.message.id : "";
1376
+ const reqId = typeof raw.requestId === "string" ? raw.requestId : "";
1377
+ return `${id}\0${reqId}`;
1378
+ }
1379
+ function parseLine(line) {
1380
+ if (line.trim().length === 0) return null;
1381
+ try {
1382
+ return JSON.parse(line);
1383
+ } catch {
1384
+ return null;
1385
+ }
1386
+ }
1387
+ function listTranscriptFiles(opts = {}) {
1388
+ const root = opts.root ?? DEFAULT_PROJECTS_ROOT;
1389
+ const base = opts.projectDir ? path2.isAbsolute(opts.projectDir) ? opts.projectDir : path2.join(root, opts.projectDir) : root;
1390
+ if (!fs2.existsSync(base)) return [];
1391
+ const cutoffMs = opts.maxAgeDays !== void 0 ? (opts.now ?? /* @__PURE__ */ new Date()).getTime() - opts.maxAgeDays * 24 * 60 * 60 * 1e3 : null;
1392
+ const out = [];
1393
+ const stack = [base];
1394
+ while (stack.length > 0) {
1395
+ const dir = stack.pop();
1396
+ let entries;
1397
+ try {
1398
+ entries = fs2.readdirSync(dir, { withFileTypes: true });
1399
+ } catch {
1400
+ continue;
1401
+ }
1402
+ for (const entry of entries) {
1403
+ const full = path2.join(dir, entry.name);
1404
+ if (entry.isDirectory()) {
1405
+ stack.push(full);
1406
+ continue;
1407
+ }
1408
+ if (!entry.isFile() || !entry.name.endsWith(".jsonl")) continue;
1409
+ if (cutoffMs !== null) {
1410
+ let mtimeMs;
1411
+ try {
1412
+ mtimeMs = fs2.statSync(full).mtimeMs;
1413
+ } catch {
1414
+ continue;
1415
+ }
1416
+ if (mtimeMs < cutoffMs) continue;
1417
+ }
1418
+ out.push(full);
1419
+ }
1420
+ }
1421
+ return out.sort();
1422
+ }
1423
+ function scanTranscripts(opts = {}) {
1424
+ const files = listTranscriptFiles(opts);
1425
+ const seen = /* @__PURE__ */ new Set();
1426
+ const records = [];
1427
+ let totalSeen = 0;
1428
+ for (const file of files) {
1429
+ let text;
1430
+ try {
1431
+ text = fs2.readFileSync(file, "utf-8");
1432
+ } catch {
1433
+ continue;
1434
+ }
1435
+ for (const line of text.split("\n")) {
1436
+ const raw = parseLine(line);
1437
+ if (!raw || raw.type !== "assistant" || !raw.message?.usage) continue;
1438
+ totalSeen += 1;
1439
+ const key = dedupKey(raw);
1440
+ if (seen.has(key)) continue;
1441
+ seen.add(key);
1442
+ records.push({
1443
+ bucket: classifyBucket(raw),
1444
+ agentId: typeof raw.agentId === "string" ? raw.agentId : null,
1445
+ model: typeof raw.message.model === "string" ? raw.message.model : "unknown",
1446
+ timestamp: typeof raw.timestamp === "string" ? raw.timestamp : null,
1447
+ usage: toTokenCounts(raw.message.usage)
1448
+ });
1449
+ }
1450
+ }
1451
+ const dedupedCount = records.length;
1452
+ return {
1453
+ records,
1454
+ totalSeen,
1455
+ dedupedCount,
1456
+ dedup_ratio: totalSeen > 0 ? (totalSeen - dedupedCount) / totalSeen : 0
1457
+ };
1458
+ }
1459
+ function emptyAggregate(bucket) {
1460
+ return {
1461
+ bucket,
1462
+ calls: 0,
1463
+ input_tokens: 0,
1464
+ cache_read_input_tokens: 0,
1465
+ cache_creation_input_tokens: 0,
1466
+ output_tokens: 0,
1467
+ ephemeral_5m_input_tokens: 0,
1468
+ ephemeral_1h_input_tokens: 0,
1469
+ read_share: 0,
1470
+ weighted_input_units: 0
1471
+ };
1472
+ }
1473
+ function aggregateByBucket(records) {
1474
+ const buckets = {
1475
+ main: emptyAggregate("main"),
1476
+ subagent: emptyAggregate("subagent")
1477
+ };
1478
+ for (const rec of records) {
1479
+ const agg = buckets[rec.bucket];
1480
+ agg.calls += 1;
1481
+ agg.input_tokens += rec.usage.input_tokens;
1482
+ agg.cache_read_input_tokens += rec.usage.cache_read_input_tokens;
1483
+ agg.cache_creation_input_tokens += rec.usage.cache_creation_input_tokens;
1484
+ agg.output_tokens += rec.usage.output_tokens;
1485
+ agg.ephemeral_5m_input_tokens += rec.usage.ephemeral_5m_input_tokens;
1486
+ agg.ephemeral_1h_input_tokens += rec.usage.ephemeral_1h_input_tokens;
1487
+ }
1488
+ for (const bucket of Object.values(buckets)) {
1489
+ const billable = billableInputTokens(bucket);
1490
+ bucket.read_share = billable > 0 ? bucket.cache_read_input_tokens / billable : 0;
1491
+ bucket.weighted_input_units = weightedInputUnits(bucket);
1492
+ }
1493
+ return buckets;
1494
+ }
1495
+
1343
1496
  // src/scripts/_lib/spawn_env.ts
1344
1497
  var DENY_EXACT = /* @__PURE__ */ new Set([
1345
1498
  // dynamic loader
@@ -1405,6 +1558,11 @@ function hardenedSpawnEnv(overrides = {}) {
1405
1558
  }
1406
1559
 
1407
1560
  export {
1561
+ DEFAULT_PROJECTS_ROOT,
1562
+ billableInputTokens,
1563
+ weightedInputUnits,
1564
+ scanTranscripts,
1565
+ aggregateByBucket,
1408
1566
  hardenedSpawnEnv,
1409
1567
  _RAW_KEY_PREFIXES,
1410
1568
  config_exports