@event4u/agent-config 9.31.0 → 9.33.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 (107) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +146 -0
  3. package/dist/agent-src/commands/review/routing.md +3 -4
  4. package/dist/agent-src/contexts/communication/rules-auto/reply-close-mechanics.md +65 -0
  5. package/dist/agent-src/contexts/execution/host-capability-manifest.md +32 -1
  6. package/dist/agent-src/contexts/execution/orchestration-telemetry.md +3 -0
  7. package/dist/agent-src/rules/delegation-policy.md +17 -1
  8. package/dist/agent-src/scripts/roadmap_gates.ts +107 -3
  9. package/dist/agent-src/skills/docker/SKILL.md +11 -0
  10. package/dist/agent-src/skills/laravel/SKILL.md +11 -0
  11. package/dist/agent-src/skills/review-routing/SKILL.md +23 -6
  12. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  13. package/dist/agent-src/templates/scripts/ownership-map.example.yml +1 -1
  14. package/dist/agent-src/templates/scripts/work_engine/delivery_state.ts +6 -0
  15. package/dist/agent-src/templates/scripts/work_engine/directives/backend/_self_fix.ts +332 -0
  16. package/dist/agent-src/templates/scripts/work_engine/directives/backend/refine.ts +106 -1
  17. package/dist/agent-src/templates/scripts/work_engine/directives/backend/test.ts +50 -15
  18. package/dist/agent-src/templates/scripts/work_engine/directives/backend/verify.ts +49 -15
  19. package/dist/agent-src/templates/scripts/work_engine/state.ts +74 -0
  20. package/dist/agent-src/templates/scripts/work_engine/state_io.ts +6 -0
  21. package/dist/cli/registry.js +4 -4
  22. package/dist/cli/registry.js.map +1 -1
  23. package/dist/cli-delegate/chunk-2WELHO3P.js +582 -0
  24. package/dist/cli-delegate/chunk-HTIU3W56.js +66 -0
  25. package/dist/cli-delegate/{chunk-ITIQSGOQ.js → chunk-MA4GFWDY.js} +7 -4
  26. package/dist/cli-delegate/{chunk-2WCLVDWC.js → chunk-PMQ6Z3T3.js} +1642 -165
  27. package/dist/cli-delegate/chunk-PZWRPRWP.js +38 -0
  28. package/dist/cli-delegate/{chunk-PFBV6XRT.js → chunk-Q26HT4QT.js} +1 -63
  29. package/dist/cli-delegate/{chunk-LVRYBKTI.js → chunk-YPAWXXXR.js} +158 -0
  30. package/dist/cli-delegate/cmd_conformance.js +308 -227
  31. package/dist/cli-delegate/cmd_doctor.js +4 -2
  32. package/dist/cli-delegate/cmd_export.js +1 -1
  33. package/dist/cli-delegate/cmd_handoff.js +160 -58
  34. package/dist/cli-delegate/cmd_prune.js +1 -1
  35. package/dist/cli-delegate/cmd_session_recycle.js +30 -5
  36. package/dist/cli-delegate/cmd_settings_get.js +4 -2
  37. package/dist/cli-delegate/cmd_settings_migrate.js +1 -1
  38. package/dist/cli-delegate/cmd_settings_set.js +5 -3
  39. package/dist/cli-delegate/cmd_sync.js +1 -1
  40. package/dist/cli-delegate/cmd_uninstall.js +1 -1
  41. package/dist/cli-delegate/cmd_validate.js +1 -1
  42. package/dist/discovery/deprecation-report.md +1 -1
  43. package/dist/discovery/discovery-manifest.json +8 -8
  44. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  45. package/dist/discovery/discovery-manifest.summary.md +1 -1
  46. package/dist/discovery/orphan-report.md +1 -1
  47. package/dist/discovery/packs.json +2 -2
  48. package/dist/discovery/trust-report.md +1 -1
  49. package/dist/discovery/workspaces.json +2 -2
  50. package/dist/hooks/dispatch.js +1136 -690
  51. package/dist/install/install.mjs +7 -4
  52. package/dist/mcp/registry-manifest.json +2 -2
  53. package/dist/mcp/server.json +2 -2
  54. package/dist/mcp/server.mjs +3688 -1159
  55. package/package.json +1 -1
  56. package/src/agent-src/scripts/roadmap_gates.ts +107 -3
  57. package/src/agent-src/templates/scripts/ownership-map.example.yml +1 -1
  58. package/src/agent-src/templates/scripts/work_engine/delivery_state.ts +6 -0
  59. package/src/agent-src/templates/scripts/work_engine/directives/backend/_self_fix.ts +332 -0
  60. package/src/agent-src/templates/scripts/work_engine/directives/backend/refine.ts +106 -1
  61. package/src/agent-src/templates/scripts/work_engine/directives/backend/test.ts +50 -15
  62. package/src/agent-src/templates/scripts/work_engine/directives/backend/verify.ts +49 -15
  63. package/src/agent-src/templates/scripts/work_engine/state.ts +74 -0
  64. package/src/agent-src/templates/scripts/work_engine/state_io.ts +6 -0
  65. package/src/config/cost-parity-budget.json +167 -0
  66. package/src/config/gate-coverage.yml +44 -5
  67. package/src/config/quorum-attendance-budget.json +39 -0
  68. package/src/scripts/_cli/cmd_doctor.ts +69 -1
  69. package/src/scripts/_cli/cmd_session_recycle.ts +44 -3
  70. package/src/scripts/_cli/handoff_generate.ts +36 -1
  71. package/src/scripts/_cli/handoff_sessions.ts +140 -9
  72. package/src/scripts/_dispatch.bash +5 -3
  73. package/src/scripts/_lib/carrier_divergence.ts +98 -27
  74. package/src/scripts/_lib/envelope_grounding.ts +206 -0
  75. package/src/scripts/_lib/host_capability.ts +79 -0
  76. package/src/scripts/_lib/orchestration_record.ts +45 -0
  77. package/src/scripts/_lib/session_eol.ts +85 -0
  78. package/src/scripts/_lib/subagent_capsule.ts +256 -1
  79. package/src/scripts/ai_council/clients.ts +31 -0
  80. package/src/scripts/ai_council/events_log.ts +128 -6
  81. package/src/scripts/ai_council/orchestrator.ts +12 -3
  82. package/src/scripts/ai_council/pricing.ts +48 -1
  83. package/src/scripts/ai_council/quorum.ts +20 -0
  84. package/src/scripts/ai_council/session.ts +11 -0
  85. package/src/scripts/ask_transport.ts +20 -1
  86. package/src/scripts/cache_realization_report.ts +38 -0
  87. package/src/scripts/check_release_highlights.ts +7 -1
  88. package/src/scripts/check_secret_leak.test.ts +43 -0
  89. package/src/scripts/check_secret_leak.ts +12 -0
  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/dispatch_economy_report.ts +5 -2
  95. package/src/scripts/handoff_context_hook.ts +66 -18
  96. package/src/scripts/hooks/session_eol_hook.ts +12 -12
  97. package/src/scripts/install.ts +20 -6
  98. package/src/scripts/lint_budget_ownership.ts +81 -0
  99. package/src/scripts/lint_skill_frontmatter_safety.ts +55 -1
  100. package/src/scripts/lint_workflow_paths.ts +384 -0
  101. package/src/scripts/preamble_byte_census.ts +9 -1
  102. package/src/scripts/report_carrier_divergence.ts +104 -29
  103. package/src/scripts/report_conformance_funnel.ts +51 -4
  104. package/src/scripts/routing_doctor.ts +25 -2
  105. package/src/scripts/schemas/dod.schema.json +45 -0
  106. package/src/scripts/schemas/subagent.schema.json +3 -2
  107. package/dist/cli-delegate/chunk-RVGBH4XK.js +0 -142
@@ -0,0 +1,38 @@
1
+ import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
2
+
3
+ // src/scripts/_lib/git_common_dir.ts
4
+ import fs from "node:fs";
5
+ import path from "node:path";
6
+ function realpath_or_self(p) {
7
+ try {
8
+ return fs.realpathSync(p);
9
+ } catch {
10
+ return p;
11
+ }
12
+ }
13
+ function git_common_dir(project_root) {
14
+ const dot_git = path.join(project_root, ".git");
15
+ try {
16
+ const st = fs.statSync(dot_git);
17
+ if (st.isDirectory()) {
18
+ return realpath_or_self(dot_git);
19
+ }
20
+ const m = fs.readFileSync(dot_git, "utf-8").match(/^gitdir:\s*(.+)\s*$/m);
21
+ if (m === null) {
22
+ return null;
23
+ }
24
+ const gitdir = path.resolve(project_root, m[1].trim());
25
+ const commondir_file = path.join(gitdir, "commondir");
26
+ if (fs.existsSync(commondir_file)) {
27
+ const common = path.resolve(gitdir, fs.readFileSync(commondir_file, "utf-8").trim());
28
+ return realpath_or_self(common);
29
+ }
30
+ return realpath_or_self(gitdir);
31
+ } catch {
32
+ return null;
33
+ }
34
+ }
35
+
36
+ export {
37
+ git_common_dir
38
+ };
@@ -2934,71 +2934,9 @@ function dump(input, options = {}) {
2934
2934
  });
2935
2935
  }
2936
2936
 
2937
- // src/shared/settingsClasses.ts
2938
- var SETTINGS_CLASSES = ["A", "B", "C"];
2939
- function isSettingsClass(value) {
2940
- return SETTINGS_CLASSES.includes(value);
2941
- }
2942
- var ROW_RE = /^\|\s*`([^`]+)`\s*\|\s*([^|]*?)\s*\|/;
2943
- function parseSettingsClassRows(markdown) {
2944
- const rows = [];
2945
- const lines = markdown.split("\n");
2946
- for (let i = 0; i < lines.length; i++) {
2947
- const m = ROW_RE.exec(lines[i] ?? "");
2948
- if (m === null) {
2949
- continue;
2950
- }
2951
- const key = m[1] ?? "";
2952
- const cls = m[2] ?? "";
2953
- if (!/^[A-Za-z]$/.test(cls)) {
2954
- continue;
2955
- }
2956
- rows.push({ key, cls, line: i + 1 });
2957
- }
2958
- return rows;
2959
- }
2960
- function buildSettingsClassIndex(rows) {
2961
- const index = /* @__PURE__ */ new Map();
2962
- for (const row of rows) {
2963
- if (!isSettingsClass(row.cls) || index.has(row.key)) {
2964
- continue;
2965
- }
2966
- index.set(row.key, row.cls);
2967
- }
2968
- return index;
2969
- }
2970
- function getSettingsLeaf(root, dotted) {
2971
- let node = root;
2972
- for (const part of dotted.split(".")) {
2973
- if (typeof node !== "object" || node === null || Array.isArray(node)) {
2974
- return void 0;
2975
- }
2976
- node = node[part];
2977
- }
2978
- return node;
2979
- }
2980
- function classOfPath(index, dotted) {
2981
- const exact = index.get(dotted);
2982
- if (exact !== void 0) {
2983
- return exact;
2984
- }
2985
- const parts = dotted.split(".");
2986
- for (let end = parts.length - 1; end > 0; end--) {
2987
- const ancestor = index.get(parts.slice(0, end).join("."));
2988
- if (ancestor !== void 0) {
2989
- return ancestor;
2990
- }
2991
- }
2992
- return void 0;
2993
- }
2994
-
2995
2937
  export {
2996
2938
  load,
2997
- dump,
2998
- parseSettingsClassRows,
2999
- buildSettingsClassIndex,
3000
- getSettingsLeaf,
3001
- classOfPath
2939
+ dump
3002
2940
  };
3003
2941
  /*! Bundled license information:
3004
2942
 
@@ -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