opencode-swarm 7.148.5 → 7.149.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 (73) hide show
  1. package/dist/cli/{config-doctor-6z7x0jnz.js → config-doctor-fx8d6pma.js} +3 -3
  2. package/dist/cli/{core-0ph6pb2y.js → core-0v762txd.js} +3 -3
  3. package/dist/cli/{curation-policy-fbvctttr.js → curation-policy-4jxx3ey4.js} +6 -6
  4. package/dist/cli/{curator-pffqw3br.js → curator-6w4frzdz.js} +32 -31
  5. package/dist/cli/{curator-llm-factory-mbsn281q.js → curator-llm-factory-8fstpeqh.js} +32 -31
  6. package/dist/cli/{evidence-summary-service-9ajw5tpc.js → evidence-summary-service-x00z38n2.js} +15 -14
  7. package/dist/cli/{gate-evidence-wc8wzwaw.js → gate-evidence-ejdek2td.js} +9 -9
  8. package/dist/cli/{guardrail-explain-a8706sq1.js → guardrail-explain-nynjhbzk.js} +33 -32
  9. package/dist/cli/{guardrail-log-wx43bj32.js → guardrail-log-6bktj08e.js} +6 -4
  10. package/dist/cli/{guardrail-reset-sy0vztrd.js → guardrail-reset-hsfd5ykq.js} +32 -31
  11. package/dist/cli/{hive-promoter-jvyzykgx.js → hive-promoter-32artf8c.js} +32 -31
  12. package/dist/cli/{index-1w5nnyew.js → index-01q7mb83.js} +6 -6
  13. package/dist/cli/{index-yezd5ks6.js → index-41n0thtd.js} +2 -1
  14. package/dist/cli/{index-jzz52as5.js → index-42habrdv.js} +4 -4
  15. package/dist/cli/{index-haf092ak.js → index-5q5ws00e.js} +11 -11
  16. package/dist/cli/{index-x3d9asnz.js → index-6thxr1q7.js} +3 -3
  17. package/dist/cli/{index-q7ke7kwd.js → index-79pwr8hc.js} +9 -12
  18. package/dist/cli/{index-kj6m9ry3.js → index-8hkxm9mh.js} +4 -4
  19. package/dist/cli/{index-0yzt06r5.js → index-8yan955h.js} +2 -2
  20. package/dist/cli/{index-vrp2zva8.js → index-a90c1gtn.js} +1 -1
  21. package/dist/cli/{index-kg4knw6r.js → index-ame8ek9g.js} +7 -6
  22. package/dist/cli/{index-3aev3a0c.js → index-bcfcekx9.js} +268 -355
  23. package/dist/cli/{index-nq4tkfpc.js → index-bmaz2yy4.js} +1 -1
  24. package/dist/cli/{index-k1s8gxjh.js → index-c1h0rdkr.js} +1 -1
  25. package/dist/cli/index-c83bztkp.js +881 -0
  26. package/dist/cli/{index-5r2mcgpa.js → index-ccyve4pb.js} +1 -1
  27. package/dist/cli/{index-vhefvcta.js → index-cfvbd3dg.js} +2 -2
  28. package/dist/cli/{index-vyg5b8ee.js → index-ef0wracg.js} +5 -5
  29. package/dist/cli/{index-qbsc2btq.js → index-hbhw2qd7.js} +3 -3
  30. package/dist/cli/{index-ag9bv589.js → index-ka2vav7t.js} +34 -33
  31. package/dist/cli/{index-zhn0q7nf.js → index-kb1p6dpx.js} +18 -17
  32. package/dist/cli/{index-5zq3892p.js → index-mza55jmc.js} +4 -4
  33. package/dist/cli/{index-t25evmna.js → index-n6jykega.js} +1 -1
  34. package/dist/cli/{index-ne45ew6z.js → index-pgfn8h50.js} +10 -10
  35. package/dist/cli/{index-59wqcatm.js → index-q8e2yd98.js} +1 -1
  36. package/dist/cli/{index-zf2vwa7y.js → index-s7t2c9jd.js} +2 -2
  37. package/dist/cli/{index-j382eh60.js → index-vfv4vnnc.js} +1 -1
  38. package/dist/cli/{index-qwmrt51t.js → index-wbz365gn.js} +1 -1
  39. package/dist/cli/{index-ghbkknjz.js → index-wj0gnab0.js} +72 -41
  40. package/dist/cli/{index-arjq717j.js → index-wsar7d91.js} +1 -1
  41. package/dist/cli/{index-c6jqkx9d.js → index-xdp0bx28.js} +2 -2
  42. package/dist/cli/{index-8djgxw2w.js → index-z6471b7r.js} +2 -2
  43. package/dist/cli/{index-579qg534.js → index-zkcwan96.js} +1 -1
  44. package/dist/cli/index.js +32 -31
  45. package/dist/cli/{knowledge-escalator-bvrtfdyb.js → knowledge-escalator-ty2kesdj.js} +14 -14
  46. package/dist/cli/{knowledge-events-rpvkevbm.js → knowledge-events-x3rd7r3j.js} +12 -12
  47. package/dist/cli/{knowledge-link-spw879rs.js → knowledge-link-a5f89833.js} +5 -5
  48. package/dist/cli/{knowledge-store-wjy2kshh.js → knowledge-store-zsz4dxjq.js} +6 -6
  49. package/dist/cli/{knowledge-validator-cq2cgfcx.js → knowledge-validator-bdhgkw9f.js} +8 -8
  50. package/dist/cli/{pending-delegations-f4wvyzbf.js → pending-delegations-aez8ebdr.js} +3 -3
  51. package/dist/cli/{pr-subscriptions-f4xw1rxy.js → pr-subscriptions-cpnwvc6y.js} +3 -3
  52. package/dist/cli/{runner-rk26nk58.js → runner-9mnkfjw7.js} +6 -6
  53. package/dist/cli/{scan-cursor-7n0zs72g.js → scan-cursor-3ba1spad.js} +7 -7
  54. package/dist/cli/{schema-e59spg93.js → schema-h251vmd1.js} +1 -1
  55. package/dist/cli/{scope-persistence-d75p900m.js → scope-persistence-h1b31ba2.js} +8 -10
  56. package/dist/cli/{skill-generator-c65y1h6a.js → skill-generator-esrn40th.js} +16 -16
  57. package/dist/cli/{telemetry-1pnsftp0.js → telemetry-jtq6px7k.js} +1 -1
  58. package/dist/cli/{workspace-snapshot-nq25j94x.js → workspace-snapshot-8269e1p9.js} +2 -2
  59. package/dist/cli/{worktree-collision-ownership-wqy7mgb3.js → worktree-collision-ownership-r8j31h06.js} +8 -8
  60. package/dist/cli/{worktree-isolation-ay9d58w4.js → worktree-isolation-pbr4d5m9.js} +32 -31
  61. package/dist/commands/close.d.ts +1 -0
  62. package/dist/events/core-events.d.ts +250 -0
  63. package/dist/full-auto/oversight.d.ts +5 -3
  64. package/dist/hooks/full-auto-delegation.d.ts +24 -0
  65. package/dist/hooks/full-auto-input-probe.d.ts +11 -0
  66. package/dist/hooks/steering-consumed.d.ts +12 -4
  67. package/dist/index.js +583 -601
  68. package/dist/observability/catalog.d.ts +9 -7
  69. package/dist/services/spec-drift-recovery.d.ts +9 -2
  70. package/dist/telemetry.d.ts +24 -1
  71. package/package.json +2 -1
  72. package/dist/cli/{curator-drift-fv4rttf4.js → curator-drift-2h1d2fnq.js} +1 -1
  73. package/dist/cli/{index-g8wwj0sz.js → index-vnn7qq8c.js} +3 -3
@@ -23,17 +23,17 @@ import {
23
23
  validateLesson,
24
24
  validateSkillCandidatePath,
25
25
  validateSkillPath
26
- } from "./index-kj6m9ry3.js";
27
- import"./index-nq4tkfpc.js";
26
+ } from "./index-8hkxm9mh.js";
27
+ import"./index-bmaz2yy4.js";
28
28
  import"./index-rtry5xyf.js";
29
- import"./index-1w5nnyew.js";
29
+ import"./index-01q7mb83.js";
30
30
  import"./index-ae75rja9.js";
31
- import"./index-k1s8gxjh.js";
32
- import"./index-vhefvcta.js";
31
+ import"./index-c1h0rdkr.js";
32
+ import"./index-cfvbd3dg.js";
33
33
  import"./index-bk5tah7q.js";
34
- import"./index-kg4knw6r.js";
35
- import"./index-vrp2zva8.js";
36
- import"./index-ghbkknjz.js";
34
+ import"./index-ame8ek9g.js";
35
+ import"./index-a90c1gtn.js";
36
+ import"./index-wj0gnab0.js";
37
37
  import"./index-7g4c7s5r.js";
38
38
  import"./index-bpmtbmy9.js";
39
39
  import"./index-ed5ykebp.js";
@@ -58,13 +58,13 @@ import {
58
58
  sweepStaleDelegations,
59
59
  updateCoderSettlement,
60
60
  writeDelegationFallback
61
- } from "./index-t25evmna.js";
61
+ } from "./index-n6jykega.js";
62
62
  import"./index-4cgee5vh.js";
63
63
  import"./index-z6xqpmqg.js";
64
64
  import"./index-r3mvsbtq.js";
65
65
  import"./index-zjygnfay.js";
66
- import"./index-vrp2zva8.js";
67
- import"./index-ghbkknjz.js";
66
+ import"./index-a90c1gtn.js";
67
+ import"./index-wj0gnab0.js";
68
68
  import"./index-7g4c7s5r.js";
69
69
  import"./index-bpmtbmy9.js";
70
70
  import"./index-ed5ykebp.js";
@@ -9,13 +9,13 @@ import {
9
9
  sweepStale,
10
10
  unsubscribe,
11
11
  updateSnapshot
12
- } from "./index-qwmrt51t.js";
12
+ } from "./index-wbz365gn.js";
13
13
  import"./index-4cgee5vh.js";
14
14
  import"./index-z6xqpmqg.js";
15
15
  import"./index-r3mvsbtq.js";
16
16
  import"./index-zjygnfay.js";
17
- import"./index-vrp2zva8.js";
18
- import"./index-ghbkknjz.js";
17
+ import"./index-a90c1gtn.js";
18
+ import"./index-wj0gnab0.js";
19
19
  import"./index-7g4c7s5r.js";
20
20
  import"./index-bpmtbmy9.js";
21
21
  import"./index-ed5ykebp.js";
@@ -3,14 +3,14 @@ import {
3
3
  _internals,
4
4
  createModelEvaluationExecutor,
5
5
  runEvaluation
6
- } from "./index-j382eh60.js";
7
- import"./index-8djgxw2w.js";
6
+ } from "./index-vfv4vnnc.js";
7
+ import"./index-z6471b7r.js";
8
8
  import"./index-y8552snf.js";
9
9
  import"./index-r3mvsbtq.js";
10
- import"./index-vhefvcta.js";
11
- import"./index-kg4knw6r.js";
12
- import"./index-vrp2zva8.js";
13
- import"./index-ghbkknjz.js";
10
+ import"./index-cfvbd3dg.js";
11
+ import"./index-ame8ek9g.js";
12
+ import"./index-a90c1gtn.js";
13
+ import"./index-wj0gnab0.js";
14
14
  import"./index-7g4c7s5r.js";
15
15
  import"./index-bpmtbmy9.js";
16
16
  import"./index-ed5ykebp.js";
@@ -4,17 +4,17 @@ import {
4
4
  alreadyCuratedThisGeneration,
5
5
  claimNextScanBatch,
6
6
  getScanStatus
7
- } from "./index-zf2vwa7y.js";
8
- import"./index-1w5nnyew.js";
7
+ } from "./index-s7t2c9jd.js";
8
+ import"./index-01q7mb83.js";
9
9
  import"./index-9e6fdz2h.js";
10
10
  import"./index-4rhhvd1a.js";
11
11
  import"./index-ae75rja9.js";
12
- import"./index-k1s8gxjh.js";
13
- import"./index-vhefvcta.js";
12
+ import"./index-c1h0rdkr.js";
13
+ import"./index-cfvbd3dg.js";
14
14
  import"./index-bk5tah7q.js";
15
- import"./index-kg4knw6r.js";
16
- import"./index-vrp2zva8.js";
17
- import"./index-ghbkknjz.js";
15
+ import"./index-ame8ek9g.js";
16
+ import"./index-a90c1gtn.js";
17
+ import"./index-wj0gnab0.js";
18
18
  import"./index-7g4c7s5r.js";
19
19
  import"./index-bpmtbmy9.js";
20
20
  import"./index-ed5ykebp.js";
@@ -99,7 +99,7 @@ import {
99
99
  resolveGeneratedAgentRole,
100
100
  resolveGuardrailsConfig,
101
101
  stripKnownSwarmPrefix
102
- } from "./index-yezd5ks6.js";
102
+ } from "./index-41n0thtd.js";
103
103
  import"./index-cpg98bh1.js";
104
104
  import"./index-zjygnfay.js";
105
105
  import"./index-bk5tah7q.js";
@@ -23,22 +23,20 @@ import {
23
23
  tombstoneScopeBinding,
24
24
  writeScopeBindingToDisk,
25
25
  writeScopeToDisk
26
- } from "./index-q7ke7kwd.js";
27
- import"./index-x3d9asnz.js";
26
+ } from "./index-79pwr8hc.js";
27
+ import"./index-6thxr1q7.js";
28
+ import"./index-c83bztkp.js";
28
29
  import"./index-556ja8an.js";
29
- import"./index-59wqcatm.js";
30
- import"./index-yezd5ks6.js";
30
+ import"./index-q8e2yd98.js";
31
+ import"./index-41n0thtd.js";
31
32
  import"./index-cpg98bh1.js";
32
33
  import"./index-9e6fdz2h.js";
33
34
  import"./index-4rhhvd1a.js";
34
- import"./index-4cgee5vh.js";
35
- import"./index-z6xqpmqg.js";
36
- import"./index-r3mvsbtq.js";
37
35
  import"./index-zjygnfay.js";
38
36
  import"./index-bk5tah7q.js";
39
- import"./index-kg4knw6r.js";
40
- import"./index-vrp2zva8.js";
41
- import"./index-ghbkknjz.js";
37
+ import"./index-ame8ek9g.js";
38
+ import"./index-a90c1gtn.js";
39
+ import"./index-wj0gnab0.js";
42
40
  import"./index-7g4c7s5r.js";
43
41
  import"./index-bpmtbmy9.js";
44
42
  import"./index-ed5ykebp.js";
@@ -33,32 +33,32 @@ import {
33
33
  sanitizeSlug,
34
34
  selectCandidateEntries,
35
35
  writeEvalStub
36
- } from "./index-jzz52as5.js";
37
- import"./index-kj6m9ry3.js";
38
- import"./index-nq4tkfpc.js";
36
+ } from "./index-42habrdv.js";
37
+ import"./index-8hkxm9mh.js";
38
+ import"./index-bmaz2yy4.js";
39
39
  import"./index-rtry5xyf.js";
40
40
  import"./index-q7sjgr1y.js";
41
- import"./index-1w5nnyew.js";
42
- import"./index-ne45ew6z.js";
43
- import"./index-c6jqkx9d.js";
41
+ import"./index-01q7mb83.js";
42
+ import"./index-pgfn8h50.js";
43
+ import"./index-xdp0bx28.js";
44
44
  import"./index-gprxjmm7.js";
45
45
  import"./index-n832052r.js";
46
- import"./index-59wqcatm.js";
47
- import"./index-yezd5ks6.js";
48
- import"./index-cpg98bh1.js";
49
- import"./index-9e6fdz2h.js";
50
- import"./index-4rhhvd1a.js";
51
46
  import"./index-4cgee5vh.js";
52
47
  import"./index-z6xqpmqg.js";
53
48
  import"./index-r3mvsbtq.js";
49
+ import"./index-q8e2yd98.js";
50
+ import"./index-41n0thtd.js";
51
+ import"./index-cpg98bh1.js";
52
+ import"./index-9e6fdz2h.js";
53
+ import"./index-4rhhvd1a.js";
54
54
  import"./index-zjygnfay.js";
55
55
  import"./index-ae75rja9.js";
56
- import"./index-k1s8gxjh.js";
57
- import"./index-vhefvcta.js";
56
+ import"./index-c1h0rdkr.js";
57
+ import"./index-cfvbd3dg.js";
58
58
  import"./index-bk5tah7q.js";
59
- import"./index-kg4knw6r.js";
60
- import"./index-vrp2zva8.js";
61
- import"./index-ghbkknjz.js";
59
+ import"./index-ame8ek9g.js";
60
+ import"./index-a90c1gtn.js";
61
+ import"./index-wj0gnab0.js";
62
62
  import"./index-7g4c7s5r.js";
63
63
  import"./index-bpmtbmy9.js";
64
64
  import"./index-ed5ykebp.js";
@@ -13,7 +13,7 @@ import {
13
13
  startHeartbeatTracking,
14
14
  stopHeartbeatTracking,
15
15
  telemetry
16
- } from "./index-ghbkknjz.js";
16
+ } from "./index-wj0gnab0.js";
17
17
  import"./index-bpmtbmy9.js";
18
18
  import"./index-a76rekgs.js";
19
19
  export {
@@ -38,10 +38,10 @@ import {
38
38
  resolveRemoteRefsContainingHeadAsync,
39
39
  switchPrFeedbackTrackingCandidateAsync,
40
40
  workspaceSnapshotMatches
41
- } from "./index-g8wwj0sz.js";
41
+ } from "./index-vnn7qq8c.js";
42
+ import"./index-r3mvsbtq.js";
42
43
  import"./index-9e6fdz2h.js";
43
44
  import"./index-4rhhvd1a.js";
44
- import"./index-r3mvsbtq.js";
45
45
  import"./index-zgwm4ryv.js";
46
46
  import"./index-a76rekgs.js";
47
47
  export {
@@ -5,25 +5,25 @@ import {
5
5
  import {
6
6
  scanDelegationFallbacksForRecovery,
7
7
  scanDelegationsForRecovery
8
- } from "./index-t25evmna.js";
8
+ } from "./index-n6jykega.js";
9
9
  import {
10
10
  WORKTREE_PROVISIONING_OWNER_LEASE_MS,
11
11
  removeWorktreeProvisioningOwner,
12
12
  scanWorktreeProvisioningOwnersForRecovery
13
13
  } from "./index-fxvgaeq4.js";
14
- import {
15
- init_git_executable,
16
- resolveGitExecutable
17
- } from "./index-9e6fdz2h.js";
18
- import"./index-4rhhvd1a.js";
19
14
  import"./index-4cgee5vh.js";
20
15
  import"./index-z6xqpmqg.js";
21
16
  import {
22
17
  bunSpawn
23
18
  } from "./index-r3mvsbtq.js";
19
+ import {
20
+ init_git_executable,
21
+ resolveGitExecutable
22
+ } from "./index-9e6fdz2h.js";
23
+ import"./index-4rhhvd1a.js";
24
24
  import"./index-zjygnfay.js";
25
- import"./index-vrp2zva8.js";
26
- import"./index-ghbkknjz.js";
25
+ import"./index-a90c1gtn.js";
26
+ import"./index-wj0gnab0.js";
27
27
  import"./index-7g4c7s5r.js";
28
28
  import"./index-bpmtbmy9.js";
29
29
  import"./index-ed5ykebp.js";
@@ -21,61 +21,62 @@ import {
21
21
  sanitizeWorktreeTaskId,
22
22
  standardWorktreeByCallID,
23
23
  standardWorktreeSerializationSessions
24
- } from "./index-3aev3a0c.js";
25
- import"./index-j382eh60.js";
26
- import"./index-arjq717j.js";
27
- import"./index-5r2mcgpa.js";
28
- import"./index-zhn0q7nf.js";
29
- import"./index-8djgxw2w.js";
24
+ } from "./index-bcfcekx9.js";
25
+ import"./index-vfv4vnnc.js";
26
+ import"./index-wsar7d91.js";
27
+ import"./index-ccyve4pb.js";
28
+ import"./index-kb1p6dpx.js";
29
+ import"./index-z6471b7r.js";
30
30
  import"./index-134d35c1.js";
31
31
  import"./index-nj6rmyeh.js";
32
32
  import"./index-y8552snf.js";
33
- import"./index-vyg5b8ee.js";
34
- import"./index-zf2vwa7y.js";
33
+ import"./index-ef0wracg.js";
34
+ import"./index-s7t2c9jd.js";
35
35
  import"./index-70ha9e09.js";
36
36
  import"./index-c8s9a3zh.js";
37
37
  import"./index-9ss2m4rs.js";
38
- import"./index-g8wwj0sz.js";
39
- import"./index-qwmrt51t.js";
40
- import"./index-jzz52as5.js";
41
- import"./index-kj6m9ry3.js";
42
- import"./index-nq4tkfpc.js";
38
+ import"./index-vnn7qq8c.js";
39
+ import"./index-wbz365gn.js";
40
+ import"./index-42habrdv.js";
41
+ import"./index-8hkxm9mh.js";
42
+ import"./index-bmaz2yy4.js";
43
43
  import"./index-rtry5xyf.js";
44
44
  import"./index-zsrtt42s.js";
45
- import"./index-t25evmna.js";
45
+ import"./index-n6jykega.js";
46
46
  import"./index-fxvgaeq4.js";
47
- import"./index-haf092ak.js";
48
- import"./index-5zq3892p.js";
49
- import"./index-q7ke7kwd.js";
50
- import"./index-x3d9asnz.js";
47
+ import"./index-5q5ws00e.js";
48
+ import"./index-mza55jmc.js";
49
+ import"./index-79pwr8hc.js";
50
+ import"./index-6thxr1q7.js";
51
+ import"./index-c83bztkp.js";
51
52
  import"./index-556ja8an.js";
52
53
  import"./index-b43rt5ph.js";
53
54
  import"./index-q7sjgr1y.js";
54
55
  import"./index-3g0xk6tk.js";
55
56
  import"./index-85gkedsf.js";
56
- import"./index-1w5nnyew.js";
57
- import"./index-ne45ew6z.js";
57
+ import"./index-01q7mb83.js";
58
+ import"./index-pgfn8h50.js";
58
59
  import {
59
60
  resolveWorktreeIsolationConfig
60
- } from "./index-c6jqkx9d.js";
61
+ } from "./index-xdp0bx28.js";
61
62
  import"./index-gprxjmm7.js";
62
63
  import"./index-n832052r.js";
63
- import"./index-59wqcatm.js";
64
- import"./index-yezd5ks6.js";
65
- import"./index-cpg98bh1.js";
66
- import"./index-9e6fdz2h.js";
67
- import"./index-4rhhvd1a.js";
68
64
  import"./index-4cgee5vh.js";
69
65
  import"./index-z6xqpmqg.js";
70
66
  import"./index-r3mvsbtq.js";
67
+ import"./index-q8e2yd98.js";
68
+ import"./index-41n0thtd.js";
69
+ import"./index-cpg98bh1.js";
70
+ import"./index-9e6fdz2h.js";
71
+ import"./index-4rhhvd1a.js";
71
72
  import"./index-zjygnfay.js";
72
73
  import"./index-ae75rja9.js";
73
- import"./index-k1s8gxjh.js";
74
- import"./index-vhefvcta.js";
74
+ import"./index-c1h0rdkr.js";
75
+ import"./index-cfvbd3dg.js";
75
76
  import"./index-bk5tah7q.js";
76
- import"./index-kg4knw6r.js";
77
- import"./index-vrp2zva8.js";
78
- import"./index-ghbkknjz.js";
77
+ import"./index-ame8ek9g.js";
78
+ import"./index-a90c1gtn.js";
79
+ import"./index-wj0gnab0.js";
79
80
  import"./index-7g4c7s5r.js";
80
81
  import"./index-bpmtbmy9.js";
81
82
  import"./index-ed5ykebp.js";
@@ -303,5 +303,6 @@ export declare const _internals: {
303
303
  endAgentSession: typeof endAgentSession;
304
304
  flushAndDrainTelemetry: () => Promise<void>;
305
305
  finalizeContextTelemetry: (directory: string) => void;
306
+ finalizeCoreEvents: (directory: string) => void;
306
307
  };
307
308
  export {};
@@ -0,0 +1,250 @@
1
+ /**
2
+ * Core event store — the single append seam and bounded store for
3
+ * `.swarm/events.jsonl` (issue #2039, Observability PR 11/23).
4
+ *
5
+ * HISTORY: `.swarm/events.jsonl` was an ad hoc shared event bus with ~30
6
+ * direct append sites across ~29 modules and NO hard byte/age/count ceiling;
7
+ * nine production readers parsed the entire file, three of them
8
+ * (coder-retry escalation, spec-drift commit dedup, task-repair audit
9
+ * dedup) basing CORRECTNESS decisions on arbitrary-age lookups.
10
+ *
11
+ * NOW it is a BOUNDED single-file store in the `src/context-map/telemetry.ts`
12
+ * (#2037) house pattern:
13
+ *
14
+ * Line 1: `swarm-events-manifest` header carrying the size-bounded FOLDED
15
+ * aggregate (events compacted away: lifetime total, per-type
16
+ * counts ≤64 keys + "other", corrupt/dropped counters).
17
+ * Line 2+: raw event JSONL — the RECENT retained window, bounded to
18
+ * CORE_EVENT_LIMITS.activeMaxBytes / activeMaxEntries / ageMaxMs.
19
+ *
20
+ * Lifetime totals = folded aggregate (header) + retained window (file). Event
21
+ * lines are preserved byte-for-byte (both `event:` and `type:` discriminators
22
+ * pass through untouched — the store never normalizes producer schemas).
23
+ *
24
+ * AUTHORITATIVE PARTITION (issue #2039 requirement 2/5): the four
25
+ * correctness-relevant event types (`coder_retry_circuit_breaker`,
26
+ * `task_workflow_repaired`, `spec_drift_acknowledged`, `spec_drift_repaired`)
27
+ * are indexed into `.swarm/events-authority-index.json` at THREE points —
28
+ * append time, fold time (BEFORE a line leaves the window), and read time
29
+ * (self-healing) — so compaction can never make an authority answer wrong.
30
+ * Authority queries are index-first with a bounded retained-window fallback
31
+ * for legacy sessions; the only reachable "absent after compaction" case is
32
+ * FIFO eviction past authorityIndexMaxEntries (disclosed via health).
33
+ *
34
+ * CONCURRENCY (issue #2039 review C2/C4): EVERY write (append, compaction,
35
+ * index update, finalize) holds the exclusive `.swarm/events.lock` (`wx`
36
+ * create, stale-broken after 5 minutes) — there are NO lockless writes, so an
37
+ * append racing a compaction rewrite can never be silently discarded. The wx
38
+ * store lock is the ONLY lock on this store; producers' former
39
+ * `tryAcquireLock(..., 'events.jsonl', ...)` proper-lockfile calls are all
40
+ * removed. Lock acquisition retries briefly, then fails with a typed error
41
+ * the caller maps onto its existing error contract.
42
+ *
43
+ * All functions are synchronous (house pattern). The `_internals` DI seam
44
+ * lets tests override filesystem operations and limits without `mock.module`
45
+ * (AGENTS.md invariant 7). State lives exclusively under `.swarm/`
46
+ * (invariant 4) — every function takes an explicit project-root `directory`.
47
+ * No `bun:` imports — Node-ESM-loadable (invariant 2).
48
+ */
49
+ import * as fs from 'node:fs';
50
+ export interface CoreEventLimits {
51
+ /** Hard ceiling on the retained window (manifest line + event lines). */
52
+ activeMaxBytes: number;
53
+ /** Hard ceiling on the retained window (event lines). */
54
+ activeMaxEntries: number;
55
+ /** Operational-event retention age; aged events fold into the header. */
56
+ ageMaxMs: number;
57
+ /** Bounded fold work per maintenance pass (bytes of folded lines). */
58
+ compactMaxBytes: number;
59
+ /** Hard documented read bound for public reads, independent of history. */
60
+ readMaxBytes: number;
61
+ /** Appends between throttled maintenance checks. */
62
+ checkInterval: number;
63
+ /** Disk-pressure/failure warning cooldown. */
64
+ warnCooldownMs: number;
65
+ /** Upper bound for a serialized manifest header (single line). */
66
+ headerMaxBytes: number;
67
+ /** Hard ceiling on authority-index entries (FIFO-evicted, disclosed). */
68
+ authorityIndexMaxEntries: number;
69
+ /** Serialized single-event bound; larger appends fail with a typed error. */
70
+ maxLineBytes: number;
71
+ }
72
+ export declare const CORE_EVENT_LIMITS: CoreEventLimits;
73
+ export type CoderRetryEscalationAction = 'sounding_board_consultation' | 'simplification' | 'user_escalation';
74
+ /** Size-bounded folded aggregate persisted in the manifest header. FOLDED-ONLY:
75
+ * events compacted/cut away from the retained window. Retained events are NOT
76
+ * in here. Lifetime totals = folded + retained. */
77
+ export interface CoreEventFolded {
78
+ totalEvents: number;
79
+ /** Per-discriminator counts, capped at 64 distinct keys + "other". */
80
+ byType: Record<string, number>;
81
+ corrupt: number;
82
+ dropped: number;
83
+ oldestTimestamp: string | null;
84
+ newestTimestamp: string | null;
85
+ }
86
+ export interface CoreEventManifest {
87
+ v: 1;
88
+ type: 'swarm-events-manifest';
89
+ schemaVersion: number;
90
+ folded: CoreEventFolded;
91
+ updatedAt: string;
92
+ }
93
+ export declare const _internals: {
94
+ readonly appendFileSync: typeof fs.appendFileSync;
95
+ readonly readFileSync: typeof fs.readFileSync;
96
+ readonly existsSync: typeof fs.existsSync;
97
+ readonly mkdirSync: typeof fs.mkdirSync;
98
+ readonly statSync: fs.StatSyncFn;
99
+ readonly renameSync: typeof fs.renameSync;
100
+ readonly writeFileSync: typeof fs.writeFileSync;
101
+ readonly unlinkSync: typeof fs.unlinkSync;
102
+ readonly openSync: typeof fs.openSync;
103
+ readonly closeSync: typeof fs.closeSync;
104
+ readonly readSync: typeof fs.readSync;
105
+ readonly now: () => number;
106
+ readonly limits: CoreEventLimits;
107
+ readonly emitHealth: typeof emitCoreEventsHealth;
108
+ };
109
+ export type CoreEventCoverage = 'complete' | 'truncated' | 'empty';
110
+ /** The bounded view of the retained window. `text` is manifest-stripped event
111
+ * lines in append order (possibly starting mid-line when truncated). */
112
+ export interface CoreEventReadResult {
113
+ text: string;
114
+ truncated: boolean;
115
+ coverage: CoreEventCoverage;
116
+ }
117
+ interface AuthorityIndexFile {
118
+ version: 1;
119
+ entries: Record<string, string>;
120
+ evicted: number;
121
+ }
122
+ /** Result flavors: 'ok' carries the index; 'corrupt' means the index exists
123
+ * but is unreadable/malformed — authority consumers fail CLOSED on this
124
+ * (mirroring today's malformed-JSONL throws in the consumers they replace);
125
+ * 'absent' means no index file yet (fresh or legacy session — fall back to
126
+ * the retained-window scan). */
127
+ type AuthorityIndexState = {
128
+ kind: 'ok';
129
+ index: AuthorityIndexFile;
130
+ } | {
131
+ kind: 'absent';
132
+ } | {
133
+ kind: 'corrupt';
134
+ };
135
+ export interface CoreEventStoreLock {
136
+ /** Release the lock (idempotent). */
137
+ release: () => void;
138
+ }
139
+ /**
140
+ * Acquire the exclusive store lock with a brief bounded retry, then run `fn`
141
+ * while holding it. Returns null when the lock stays contended for the whole
142
+ * retry window — callers map that onto their existing error contract
143
+ * (operational producers catch+warn; the two hard-fail producers rethrow
144
+ * their pre-existing audit-locked codes).
145
+ */
146
+ export declare function withCoreEventStoreLock<T>(directory: string, fn: () => T): T | null;
147
+ /** Test seam (AGENTS.md invariant 7): reset module-scoped maintenance
148
+ * counters between tests. Restore by calling in `afterEach`. */
149
+ export declare function _resetMaintenanceCounters(): void;
150
+ /**
151
+ * Bounded read of the retained window: the newest `readMaxBytes` of event
152
+ * lines, manifest-stripped, in append order. `truncated` means older history
153
+ * exists beyond the read bound (a legacy header-less file larger than the
154
+ * bound, or a store mid-drain) — callers disclose it, never silently treat
155
+ * the window as complete history.
156
+ */
157
+ export declare function readCoreEvents(directory: string): CoreEventReadResult;
158
+ /** Coverage disclosure without reading the window body. */
159
+ export declare function getCoreEventCoverage(directory: string): CoreEventCoverage;
160
+ /**
161
+ * Lifetime event count = folded total (manifest) + retained window count.
162
+ * The explicit counter/projection the issue requires for turn estimation —
163
+ * O(header) once a manifest exists; a legacy header-less file falls back to
164
+ * a bounded window count (advisory consumers only).
165
+ *
166
+ * Point-in-time advisory: the manifest head read and the window read are two
167
+ * separate reads, so a maintenance fold racing between them can briefly
168
+ * underreport (old folded + new, smaller window). Consumers are display-only
169
+ * (context-budget turn estimate); exactness across a compaction boundary is
170
+ * not required.
171
+ */
172
+ export declare function getCoreEventLifetimeCount(directory: string): number;
173
+ /** Typed store-busy error — producers map it onto their existing contracts
174
+ * (catch+warn for operational producers; the two hard-fail audit producers
175
+ * rethrow their pre-existing locked codes). */
176
+ export declare const CORE_EVENT_LOCKED = "CORE_EVENT_STORE_LOCKED";
177
+ export declare const CORE_EVENT_LINE_TOO_LARGE = "CORE_EVENT_LINE_TOO_LARGE";
178
+ /**
179
+ * Append one event to `.swarm/events.jsonl` through the canonical seam.
180
+ *
181
+ * - Serializes the event EXACTLY as the producer shaped it (`event:` and
182
+ * `type:` discriminators preserved; no normalization).
183
+ * - Holds the store lock for the write; closed-set authority events index
184
+ * their authority key in the same lock scope, event-first (the crash
185
+ * window between the two is healed at fold time and read time).
186
+ * - `dedupeOnAuthorityKey` (authority events only): skips the append when
187
+ * the event's authority key is already indexed or present in the
188
+ * retained window — the at-most-once audit contract the two hard-fail
189
+ * producers previously enforced with lock-then-recheck reads.
190
+ * - Runs throttled maintenance (bounded compaction / legacy drain) every
191
+ * `checkInterval` appends, after the lock is released.
192
+ *
193
+ * Throws `CORE_EVENT_STORE_LOCKED` after bounded lock retry, or a typed
194
+ * serialize error for oversized lines — every producer's existing error
195
+ * handling applies unchanged.
196
+ */
197
+ export declare const CORE_EVENT_NO_STORE = "CORE_EVENT_NO_STORE";
198
+ export declare function appendCoreEventSync(directory: string, event: Record<string, unknown>, options?: {
199
+ dedupeOnAuthorityKey?: boolean;
200
+ ensureSwarmDir?: boolean;
201
+ }): void;
202
+ /**
203
+ * Batch append: identical semantics to {@link appendCoreEventSync} for each
204
+ * event, but ONE lock acquisition for the whole batch (reconciliation loops
205
+ * that correct many records at once — e.g. the steering hook's unconsumed
206
+ * set — must not pay a lock round-trip per line). Per-line error contracts
207
+ * are the caller's: a lock failure throws `CORE_EVENT_STORE_LOCKED` before
208
+ * any line lands; an oversized line throws `CORE_EVENT_LINE_TOO_LARGE` before
209
+ * the batch starts (all lines are validated first).
210
+ */
211
+ export declare function appendCoreEventsSync(directory: string, events: readonly Record<string, unknown>[], options?: {
212
+ dedupeOnAuthorityKey?: boolean;
213
+ ensureSwarmDir?: boolean;
214
+ }): void;
215
+ /** The set of escalation actions already durably emitted for a
216
+ * (taskId, retryEpoch) pair. Index answer UNION the bounded retained-window
217
+ * scan — identical verdicts to the pre-#2039 whole-file scan for everything
218
+ * within the window, and complete-after-compaction via the index. */
219
+ export declare function getCoderRetryEscalationActions(directory: string, taskId: string, retryEpoch: number): Set<CoderRetryEscalationAction>;
220
+ /** Spec-drift audit presence: the idempotency check that gates a drift WAL's
221
+ * transition to COMMITTED. Fails closed (typed throw) on a corrupt index,
222
+ * matching the malformed-JSONL throw it replaces. */
223
+ export declare function hasSpecDriftAuditEvent(directory: string, kind: 'spec_drift_acknowledged' | 'spec_drift_repaired', transitionId: string): boolean;
224
+ /** Task-repair audit presence: the idempotency check behind
225
+ * `ensureAuditEvent` (COMMITTED repair WALs are never deleted within a
226
+ * session, so this must answer for arbitrarily old repairs). */
227
+ export declare function hasTaskRepairAuditEvent(directory: string, taskId: string, transitionId: string): boolean;
228
+ /** External compaction trigger (diagnose maintenance). Fail-open. */
229
+ export declare function compactCoreEvents(directory: string): void;
230
+ /**
231
+ * Close finalize (issue #2039 requirement 5): under one lock acquisition,
232
+ * drain any legacy header-less file to convergence and fold the remaining
233
+ * window into a defined, VALIDATED cut (the atomicReplace pre-rename
234
+ * validation), which `/swarm close` then archives. Fail-open: never throws
235
+ * to the close pipeline.
236
+ */
237
+ export declare function finalizeCoreEventsForClose(directory: string): void;
238
+ declare function emitCoreEventsHealth(directory: string, payload: {
239
+ trigger: 'compaction' | 'close';
240
+ accepted: number;
241
+ compacted: number;
242
+ retained: number;
243
+ dropped: number;
244
+ corrupt: number;
245
+ oldest: string | null;
246
+ newest: string | null;
247
+ bytes: number;
248
+ limitBytes: number;
249
+ }, preloadedAuthorityState?: AuthorityIndexState): void;
250
+ export {};
@@ -65,9 +65,11 @@ export declare function parseFullAutoCriticResponse(rawResponse: string): FullAu
65
65
  * durably audited is not a real verdict — the dispatcher converts the
66
66
  * thrown error into a BLOCKED/pause outcome.
67
67
  *
68
- * The lock acquisition is best-effort (some platforms / test sandboxes
69
- * cannot acquire the cross-process lock); the actual append is the
70
- * mandatory step and any failure throws.
68
+ * The append goes through the canonical store seam (`appendCoreEventSync`),
69
+ * which holds the exclusive store lock for the write and throws a typed
70
+ * error when the store stays contended. The seam releases its lock before
71
+ * any throw, so the mandatory rethrow below preserves the original
72
+ * rethrow-after-lock-release contract.
71
73
  */
72
74
  export declare function writeFullAutoOversightEvent(directory: string, event: FullAutoOversightEvent): Promise<void>;
73
75
  /**
@@ -1,3 +1,27 @@
1
+ /**
2
+ * Full-Auto v2 subagent outbound and return checks.
3
+ *
4
+ * Composable hook that fires alongside the existing delegation-gate hooks.
5
+ * It does not replace delegation-gate; it adds Full-Auto-specific verification
6
+ * for outbound Task delegations and post-return safety review.
7
+ *
8
+ * Outbound (tool.execute.before, only for Task tool):
9
+ * - Require valid `subagent_type` matching a registered swarm role.
10
+ * - For coder delegation, require declared scope (warning if missing).
11
+ * - Reject delegation that targets a clearly invalid agent or that requests
12
+ * a write to a protected path inside the prompt body.
13
+ * - Out-of-policy outbound delegations escalate to the critic via the
14
+ * permission hook's escalate_critic path; this hook itself records
15
+ * advisories and structured denials for the most clear-cut cases.
16
+ *
17
+ * Return (tool.execute.after, only for Task tool):
18
+ * - Inspect subagent result text for skipped tests, tool timeouts, scope
19
+ * changes, "instructions from external content", missing evidence,
20
+ * and out-of-scope file generation.
21
+ * - On detected return warnings, write a `full_auto_subagent_warning`
22
+ * event and increment a per-session counter so the cadence/escalation
23
+ * layer can react.
24
+ */
1
25
  import type { PluginConfig } from '../config';
2
26
  export interface FullAutoDelegationHookOptions {
3
27
  config: PluginConfig;