opencode-swarm 7.147.1 → 7.148.1

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 (77) hide show
  1. package/.opencode/skills/swarm-pr-review/SKILL.md +26 -11
  2. package/.opencode/skills/swarm-pr-review/references/findings-persistence-contract.md +39 -13
  3. package/dist/background/pr-review-collection-receipt.d.ts +2 -2
  4. package/dist/cli/{config-doctor-8nskdpgd.js → config-doctor-w6zphy4w.js} +2 -2
  5. package/dist/cli/{core-9rt6kbk1.js → core-65qyqw2f.js} +1 -1
  6. package/dist/cli/{curation-policy-9d7jx7cg.js → curation-policy-166wdjs4.js} +6 -6
  7. package/dist/cli/{curator-xvymjgan.js → curator-2jhdfjqg.js} +27 -27
  8. package/dist/cli/{curator-llm-factory-8xdxbmnz.js → curator-llm-factory-y43mx297.js} +27 -27
  9. package/dist/cli/{evidence-summary-service-k7a2s8f8.js → evidence-summary-service-7qpganmn.js} +11 -11
  10. package/dist/cli/{gate-evidence-bbpvx28c.js → gate-evidence-p79xv25a.js} +6 -6
  11. package/dist/cli/{guardrail-explain-qz2hfyb2.js → guardrail-explain-76sy950j.js} +28 -28
  12. package/dist/cli/{guardrail-log-6098jxes.js → guardrail-log-pm0w6ney.js} +3 -3
  13. package/dist/cli/{guardrail-reset-2bcccwmx.js → guardrail-reset-tkkg0bfz.js} +27 -27
  14. package/dist/cli/{hive-promoter-9xzf0r98.js → hive-promoter-w4batwr6.js} +27 -27
  15. package/dist/cli/{index-q85xv7t6.js → index-2bsnwcmp.js} +1 -1
  16. package/dist/cli/{index-pgvx3rkq.js → index-2n9rwvcc.js} +1 -1
  17. package/dist/cli/{index-axcvb5kf.js → index-3yh2e5ca.js} +6 -4
  18. package/dist/cli/{index-by1f9ghd.js → index-5wypz451.js} +1 -1
  19. package/dist/cli/{index-b7qzwv3t.js → index-627mz27c.js} +3 -3
  20. package/dist/cli/{index-1k41c7kt.js → index-81n4ky69.js} +2 -2
  21. package/dist/cli/{index-6cxb7ng4.js → index-c23yxr1s.js} +4 -4
  22. package/dist/cli/{index-d3bdr78h.js → index-ch6sjm8q.js} +1 -1
  23. package/dist/cli/{index-kbp4xssa.js → index-dwg0z10h.js} +4 -4
  24. package/dist/cli/{index-gkhx2vkh.js → index-e9d2829t.js} +1 -1
  25. package/dist/cli/{index-2qapn7fk.js → index-f115c8y6.js} +3 -3
  26. package/dist/cli/{index-1xvxd02x.js → index-fv5cc1rd.js} +2 -2
  27. package/dist/cli/{index-q81s0m8k.js → index-ghbkknjz.js} +79 -38
  28. package/dist/cli/{index-n5wzwz8x.js → index-hxqjf4me.js} +4 -4
  29. package/dist/cli/{index-avcqq7xc.js → index-jtnk7k6w.js} +1 -1
  30. package/dist/cli/{index-7tvbvecm.js → index-k5ze5v89.js} +1 -1
  31. package/dist/cli/{index-b834mas0.js → index-kpgj4ha6.js} +1 -1
  32. package/dist/cli/{index-8861hfbt.js → index-kztxn1ww.js} +4205 -2866
  33. package/dist/cli/{index-aahyrzmm.js → index-m97qwwrk.js} +2 -2
  34. package/dist/cli/{index-9b50bt13.js → index-mfhpk4c6.js} +1 -1
  35. package/dist/cli/{index-8k9hw17k.js → index-py2rsw1a.js} +4 -4
  36. package/dist/cli/{index-t4xa2yss.js → index-q0gfmyzx.js} +5 -5
  37. package/dist/cli/{index-qy5yz7fn.js → index-qwzpsh3w.js} +1 -1
  38. package/dist/cli/{index-zwc96x0a.js → index-qzstn430.js} +1 -1
  39. package/dist/cli/{index-6q35swn2.js → index-rsn4jm90.js} +1 -1
  40. package/dist/cli/{index-b99vp668.js → index-s3s2egzn.js} +29 -29
  41. package/dist/cli/{index-bp5n93w5.js → index-shazb5b6.js} +2 -2
  42. package/dist/cli/{index-vpzvmp21.js → index-shm69en5.js} +2 -2
  43. package/dist/cli/{index-014mntpw.js → index-t6ys1386.js} +6 -6
  44. package/dist/cli/{index-59q7jma6.js → index-w49v4xd6.js} +7 -7
  45. package/dist/cli/{index-5qfp2kt4.js → index-x46mmaep.js} +14 -10
  46. package/dist/cli/index.js +27 -27
  47. package/dist/cli/{knowledge-escalator-300p0bvr.js → knowledge-escalator-21n4ztqx.js} +11 -11
  48. package/dist/cli/{knowledge-events-5ncg5xv1.js → knowledge-events-h5d5eayv.js} +9 -9
  49. package/dist/cli/{knowledge-link-stzsjagk.js → knowledge-link-vgxe7gz9.js} +5 -5
  50. package/dist/cli/{knowledge-store-mn75hsww.js → knowledge-store-y10m7x4f.js} +8 -6
  51. package/dist/cli/{knowledge-validator-763r7qpn.js → knowledge-validator-dzm9sg0f.js} +8 -8
  52. package/dist/cli/{pending-delegations-k4x00mqc.js → pending-delegations-78zaaxz4.js} +3 -3
  53. package/dist/cli/{pr-subscriptions-x2mqc3f1.js → pr-subscriptions-9mg6mwc0.js} +3 -3
  54. package/dist/cli/{runner-26bc3x73.js → runner-rarzeth8.js} +6 -6
  55. package/dist/cli/{scan-cursor-b7kyjefy.js → scan-cursor-zn2qf06a.js} +7 -7
  56. package/dist/cli/{schema-zjhwka27.js → schema-ynwy7abm.js} +1 -1
  57. package/dist/cli/{scope-persistence-aa7gkgz0.js → scope-persistence-sh30937s.js} +7 -7
  58. package/dist/cli/{skill-generator-nsa7ay0c.js → skill-generator-r3knfwrp.js} +13 -13
  59. package/dist/cli/{telemetry-xzy0qeap.js → telemetry-1pnsftp0.js} +1 -1
  60. package/dist/cli/{worktree-collision-ownership-q2gswg16.js → worktree-collision-ownership-29md3k1n.js} +3 -3
  61. package/dist/cli/{worktree-isolation-3pw7nwnh.js → worktree-isolation-yj7ssh24.js} +27 -27
  62. package/dist/consensus/contracts.d.ts +5 -1
  63. package/dist/consensus/corpus.d.ts +26 -3
  64. package/dist/consensus/miner.d.ts +5 -1
  65. package/dist/hooks/curator.d.ts +41 -1
  66. package/dist/hooks/knowledge-store.d.ts +26 -2
  67. package/dist/hooks/pr-workflow-gate.d.ts +64 -3
  68. package/dist/hooks/skill-scoring.d.ts +13 -3
  69. package/dist/hooks/skill-usage-log.d.ts +140 -17
  70. package/dist/hooks/skill-usage-pending.d.ts +392 -0
  71. package/dist/index.js +546 -502
  72. package/dist/lang/symbol-visibility.d.ts +10 -7
  73. package/dist/observability/catalog.d.ts +6 -4
  74. package/dist/telemetry.d.ts +35 -1
  75. package/dist/tools/dispatch-lanes.d.ts +8 -1
  76. package/dist/tools/repo-graph/types.d.ts +6 -4
  77. package/package.json +1 -1
@@ -54,13 +54,13 @@ import {
54
54
  sweepStaleDelegations,
55
55
  updateCoderSettlement,
56
56
  writeDelegationFallback
57
- } from "./index-d3bdr78h.js";
57
+ } from "./index-ch6sjm8q.js";
58
58
  import"./index-4cgee5vh.js";
59
59
  import"./index-z6xqpmqg.js";
60
60
  import"./index-r3mvsbtq.js";
61
61
  import"./index-zjygnfay.js";
62
- import"./index-6q35swn2.js";
63
- import"./index-q81s0m8k.js";
62
+ import"./index-rsn4jm90.js";
63
+ import"./index-ghbkknjz.js";
64
64
  import"./index-7g4c7s5r.js";
65
65
  import"./index-bpmtbmy9.js";
66
66
  import"./index-ed5ykebp.js";
@@ -9,13 +9,13 @@ import {
9
9
  sweepStale,
10
10
  unsubscribe,
11
11
  updateSnapshot
12
- } from "./index-pgvx3rkq.js";
12
+ } from "./index-2n9rwvcc.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-6q35swn2.js";
18
- import"./index-q81s0m8k.js";
17
+ import"./index-rsn4jm90.js";
18
+ import"./index-ghbkknjz.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-b834mas0.js";
7
- import"./index-1xvxd02x.js";
6
+ } from "./index-kpgj4ha6.js";
7
+ import"./index-fv5cc1rd.js";
8
8
  import"./index-y8552snf.js";
9
9
  import"./index-r3mvsbtq.js";
10
- import"./index-bp5n93w5.js";
11
- import"./index-axcvb5kf.js";
12
- import"./index-6q35swn2.js";
13
- import"./index-q81s0m8k.js";
10
+ import"./index-shazb5b6.js";
11
+ import"./index-3yh2e5ca.js";
12
+ import"./index-rsn4jm90.js";
13
+ import"./index-ghbkknjz.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-1k41c7kt.js";
8
- import"./index-5qfp2kt4.js";
7
+ } from "./index-81n4ky69.js";
8
+ import"./index-x46mmaep.js";
9
9
  import"./index-9e6fdz2h.js";
10
10
  import"./index-4rhhvd1a.js";
11
11
  import"./index-ae75rja9.js";
12
- import"./index-zwc96x0a.js";
13
- import"./index-bp5n93w5.js";
12
+ import"./index-qzstn430.js";
13
+ import"./index-shazb5b6.js";
14
14
  import"./index-bk5tah7q.js";
15
- import"./index-axcvb5kf.js";
16
- import"./index-6q35swn2.js";
17
- import"./index-q81s0m8k.js";
15
+ import"./index-3yh2e5ca.js";
16
+ import"./index-rsn4jm90.js";
17
+ import"./index-ghbkknjz.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-qy5yz7fn.js";
102
+ } from "./index-qwzpsh3w.js";
103
103
  import"./index-cpg98bh1.js";
104
104
  import"./index-zjygnfay.js";
105
105
  import"./index-bk5tah7q.js";
@@ -23,11 +23,11 @@ import {
23
23
  tombstoneScopeBinding,
24
24
  writeScopeBindingToDisk,
25
25
  writeScopeToDisk
26
- } from "./index-6cxb7ng4.js";
27
- import"./index-2qapn7fk.js";
26
+ } from "./index-c23yxr1s.js";
27
+ import"./index-f115c8y6.js";
28
28
  import"./index-556ja8an.js";
29
- import"./index-7tvbvecm.js";
30
- import"./index-qy5yz7fn.js";
29
+ import"./index-k5ze5v89.js";
30
+ import"./index-qwzpsh3w.js";
31
31
  import"./index-cpg98bh1.js";
32
32
  import"./index-9e6fdz2h.js";
33
33
  import"./index-4rhhvd1a.js";
@@ -36,9 +36,9 @@ import"./index-z6xqpmqg.js";
36
36
  import"./index-r3mvsbtq.js";
37
37
  import"./index-zjygnfay.js";
38
38
  import"./index-bk5tah7q.js";
39
- import"./index-axcvb5kf.js";
40
- import"./index-6q35swn2.js";
41
- import"./index-q81s0m8k.js";
39
+ import"./index-3yh2e5ca.js";
40
+ import"./index-rsn4jm90.js";
41
+ import"./index-ghbkknjz.js";
42
42
  import"./index-7g4c7s5r.js";
43
43
  import"./index-bpmtbmy9.js";
44
44
  import"./index-ed5ykebp.js";
@@ -33,18 +33,18 @@ import {
33
33
  sanitizeSlug,
34
34
  selectCandidateEntries,
35
35
  writeEvalStub
36
- } from "./index-n5wzwz8x.js";
37
- import"./index-kbp4xssa.js";
38
- import"./index-avcqq7xc.js";
36
+ } from "./index-hxqjf4me.js";
37
+ import"./index-dwg0z10h.js";
38
+ import"./index-jtnk7k6w.js";
39
39
  import"./index-rtry5xyf.js";
40
40
  import"./index-q7sjgr1y.js";
41
- import"./index-5qfp2kt4.js";
42
- import"./index-59q7jma6.js";
43
- import"./index-vpzvmp21.js";
41
+ import"./index-x46mmaep.js";
42
+ import"./index-w49v4xd6.js";
43
+ import"./index-shm69en5.js";
44
44
  import"./index-gprxjmm7.js";
45
45
  import"./index-n832052r.js";
46
- import"./index-7tvbvecm.js";
47
- import"./index-qy5yz7fn.js";
46
+ import"./index-k5ze5v89.js";
47
+ import"./index-qwzpsh3w.js";
48
48
  import"./index-cpg98bh1.js";
49
49
  import"./index-9e6fdz2h.js";
50
50
  import"./index-4rhhvd1a.js";
@@ -53,12 +53,12 @@ import"./index-z6xqpmqg.js";
53
53
  import"./index-r3mvsbtq.js";
54
54
  import"./index-zjygnfay.js";
55
55
  import"./index-ae75rja9.js";
56
- import"./index-zwc96x0a.js";
57
- import"./index-bp5n93w5.js";
56
+ import"./index-qzstn430.js";
57
+ import"./index-shazb5b6.js";
58
58
  import"./index-bk5tah7q.js";
59
- import"./index-axcvb5kf.js";
60
- import"./index-6q35swn2.js";
61
- import"./index-q81s0m8k.js";
59
+ import"./index-3yh2e5ca.js";
60
+ import"./index-rsn4jm90.js";
61
+ import"./index-ghbkknjz.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-q81s0m8k.js";
16
+ } from "./index-ghbkknjz.js";
17
17
  import"./index-bpmtbmy9.js";
18
18
  import"./index-a76rekgs.js";
19
19
  export {
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  scanDelegationFallbacksForRecovery,
7
7
  scanDelegationsForRecovery
8
- } from "./index-d3bdr78h.js";
8
+ } from "./index-ch6sjm8q.js";
9
9
  import {
10
10
  WORKTREE_PROVISIONING_OWNER_LEASE_MS,
11
11
  removeWorktreeProvisioningOwner,
@@ -22,8 +22,8 @@ import {
22
22
  bunSpawn
23
23
  } from "./index-r3mvsbtq.js";
24
24
  import"./index-zjygnfay.js";
25
- import"./index-6q35swn2.js";
26
- import"./index-q81s0m8k.js";
25
+ import"./index-rsn4jm90.js";
26
+ import"./index-ghbkknjz.js";
27
27
  import"./index-7g4c7s5r.js";
28
28
  import"./index-bpmtbmy9.js";
29
29
  import"./index-ed5ykebp.js";
@@ -21,47 +21,47 @@ import {
21
21
  sanitizeWorktreeTaskId,
22
22
  standardWorktreeByCallID,
23
23
  standardWorktreeSerializationSessions
24
- } from "./index-8861hfbt.js";
25
- import"./index-b834mas0.js";
26
- import"./index-q85xv7t6.js";
27
- import"./index-by1f9ghd.js";
28
- import"./index-014mntpw.js";
29
- import"./index-1xvxd02x.js";
24
+ } from "./index-kztxn1ww.js";
25
+ import"./index-kpgj4ha6.js";
26
+ import"./index-2bsnwcmp.js";
27
+ import"./index-5wypz451.js";
28
+ import"./index-t6ys1386.js";
29
+ import"./index-fv5cc1rd.js";
30
30
  import"./index-134d35c1.js";
31
31
  import"./index-nj6rmyeh.js";
32
32
  import"./index-y8552snf.js";
33
- import"./index-t4xa2yss.js";
34
- import"./index-1k41c7kt.js";
33
+ import"./index-q0gfmyzx.js";
34
+ import"./index-81n4ky69.js";
35
35
  import"./index-70ha9e09.js";
36
36
  import"./index-c8s9a3zh.js";
37
37
  import"./index-9ss2m4rs.js";
38
38
  import"./index-g8wwj0sz.js";
39
- import"./index-pgvx3rkq.js";
40
- import"./index-n5wzwz8x.js";
41
- import"./index-kbp4xssa.js";
42
- import"./index-avcqq7xc.js";
39
+ import"./index-2n9rwvcc.js";
40
+ import"./index-hxqjf4me.js";
41
+ import"./index-dwg0z10h.js";
42
+ import"./index-jtnk7k6w.js";
43
43
  import"./index-rtry5xyf.js";
44
44
  import"./index-zsrtt42s.js";
45
- import"./index-d3bdr78h.js";
45
+ import"./index-ch6sjm8q.js";
46
46
  import"./index-fxvgaeq4.js";
47
- import"./index-8k9hw17k.js";
48
- import"./index-9b50bt13.js";
49
- import"./index-6cxb7ng4.js";
50
- import"./index-2qapn7fk.js";
47
+ import"./index-py2rsw1a.js";
48
+ import"./index-mfhpk4c6.js";
49
+ import"./index-c23yxr1s.js";
50
+ import"./index-f115c8y6.js";
51
51
  import"./index-556ja8an.js";
52
52
  import"./index-b43rt5ph.js";
53
53
  import"./index-q7sjgr1y.js";
54
54
  import"./index-3g0xk6tk.js";
55
55
  import"./index-85gkedsf.js";
56
- import"./index-5qfp2kt4.js";
57
- import"./index-59q7jma6.js";
56
+ import"./index-x46mmaep.js";
57
+ import"./index-w49v4xd6.js";
58
58
  import {
59
59
  resolveWorktreeIsolationConfig
60
- } from "./index-vpzvmp21.js";
60
+ } from "./index-shm69en5.js";
61
61
  import"./index-gprxjmm7.js";
62
62
  import"./index-n832052r.js";
63
- import"./index-7tvbvecm.js";
64
- import"./index-qy5yz7fn.js";
63
+ import"./index-k5ze5v89.js";
64
+ import"./index-qwzpsh3w.js";
65
65
  import"./index-cpg98bh1.js";
66
66
  import"./index-9e6fdz2h.js";
67
67
  import"./index-4rhhvd1a.js";
@@ -70,12 +70,12 @@ import"./index-z6xqpmqg.js";
70
70
  import"./index-r3mvsbtq.js";
71
71
  import"./index-zjygnfay.js";
72
72
  import"./index-ae75rja9.js";
73
- import"./index-zwc96x0a.js";
74
- import"./index-bp5n93w5.js";
73
+ import"./index-qzstn430.js";
74
+ import"./index-shazb5b6.js";
75
75
  import"./index-bk5tah7q.js";
76
- import"./index-axcvb5kf.js";
77
- import"./index-6q35swn2.js";
78
- import"./index-q81s0m8k.js";
76
+ import"./index-3yh2e5ca.js";
77
+ import"./index-rsn4jm90.js";
78
+ import"./index-ghbkknjz.js";
79
79
  import"./index-7g4c7s5r.js";
80
80
  import"./index-bpmtbmy9.js";
81
81
  import"./index-ed5ykebp.js";
@@ -292,7 +292,11 @@ export interface ConsensusCorpusHash {
292
292
  * the difference between an incomplete report and a misleading one.
293
293
  */
294
294
  export interface ConsensusTruncationV1 {
295
- /** `maxEvidenceItems` cut the corpus before tallying. */
295
+ /**
296
+ * `maxEvidenceItems` cut the corpus before tallying, OR skill-usage
297
+ * compaction evicted history the corpus would otherwise have covered
298
+ * (issue #2038).
299
+ */
296
300
  corpus: boolean;
297
301
  /** Observations actually tallied, after filtering and after the corpus cut. */
298
302
  observations: number;
@@ -29,7 +29,7 @@
29
29
  * `task_complexity` remap, which happens in `wrapFlatRetrospective` before the
30
30
  * write branch — so the corpus reads normalized values while the file on disk
31
31
  * keeps its legacy ones.
32
- * Three upstream readers do populate PROCESS-LOCAL caches, which is worth
32
+ * Four upstream readers do populate PROCESS-LOCAL caches, which is worth
33
33
  * stating rather than hiding behind the word "read-only": `readTrajectory`
34
34
  * fills the PRM in-memory trajectory cache (`src/prm/trajectory-store.ts`),
35
35
  * while `readKnowledge` and `loadEvidence` fill the two SEPARATE maps in
@@ -44,6 +44,13 @@
44
44
  * `floor(maxLines / 2)` = 500 ENTRIES. That 500 is unrelated to
45
45
  * `MAX_TRACKED_TRAJECTORY_SESSIONS` = 500, which bounds how many SESSIONS the
46
46
  * cache holds at once; the two constants merely happen to share a value.
47
+ * The fourth is `readPendingManifest` (issue #2038), which the skill-usage
48
+ * source calls for its coverage verdict: it memoizes the parsed sidecar
49
+ * manifest keyed by the resolved path and validated against that file's mtime
50
+ * and size, so a stale entry can never be served, and it holds one entry per
51
+ * project directory the process has touched. It takes no lock, never
52
+ * migrates, and never quarantines a corrupt sidecar — quarantine is reserved
53
+ * for lock-taking paths, so mining still cannot mutate what it counts.
47
54
  * None of these caches is on disk: nothing about them writes a file, and none
48
55
  * survives the process. (The readers themselves obviously do read files — the
49
56
  * claim above is that nothing here WRITES, not that nothing here touches the
@@ -73,7 +80,7 @@ import { readGateGroundTruth } from '../evaluation/gate-ground-truth.js';
73
80
  import { type GateAuditReadSummary } from '../evaluation/store.js';
74
81
  import { type LoadEvidenceResult } from '../evidence/manager.js';
75
82
  import type { RetrievalOutcome } from '../hooks/knowledge-types.js';
76
- import { readSkillUsageEntries } from '../hooks/skill-usage-log.js';
83
+ import { readSkillUsageEntries, type readSkillUsageEntriesWithCoverage } from '../hooks/skill-usage-log.js';
77
84
  import type { TrajectoryEntry } from '../prm/types.js';
78
85
  import type { ConsensusCorpusHash, ConsensusSourceKind } from './contracts.js';
79
86
  /**
@@ -99,7 +106,11 @@ export interface CorpusObservation {
99
106
  export interface ConsensusCorpus {
100
107
  observations: CorpusObservation[];
101
108
  hashes: ConsensusCorpusHash[];
102
- /** True when `maxEvidenceItems` truncated the stream. */
109
+ /**
110
+ * True when the returned stream is not the complete corpus — either
111
+ * `maxEvidenceItems` cut it, or a source could only return a bounded window
112
+ * (skill-usage under the issue #2038 compaction budget).
113
+ */
103
114
  truncated: boolean;
104
115
  /** Sources that threw while being read. Never fatal — the corpus degrades. */
105
116
  unreadableSources: ConsensusSourceKind[];
@@ -119,6 +130,18 @@ export interface CorpusReaders {
119
130
  listTrajectorySessions: (directory: string) => Promise<string[]>;
120
131
  readTrajectory: (sessionId: string, directory: string) => Promise<TrajectoryEntry[]>;
121
132
  readSkillUsageEntries: typeof readSkillUsageEntries;
133
+ /**
134
+ * Additive coverage seam (issue #2038 §7). Optional, and deliberately NOT
135
+ * part of `defaultReaders()`.
136
+ *
137
+ * The entries themselves keep coming from `readSkillUsageEntries` — which is
138
+ * already the bounded read funnel, so the observations are byte-identical —
139
+ * because `loadConsensusCorpus` merges as `{...defaultReaders(), ...options.readers}`.
140
+ * A default entry-bearing coverage reader would therefore silently outrank a
141
+ * caller that overrode only `readSkillUsageEntries`, turning an injected
142
+ * fixture into an empty corpus. Injecting this member overrides BOTH.
143
+ */
144
+ readSkillUsageEntriesWithCoverage?: typeof readSkillUsageEntriesWithCoverage;
122
145
  readKnowledgeEntries: (directory: string) => Promise<KnowledgeLike[]>;
123
146
  loadEvidence: (directory: string, taskId: string) => Promise<LoadEvidenceResult>;
124
147
  readRejectedLessons: (directory: string) => Promise<RejectedLessonLike[]>;
@@ -133,7 +133,11 @@ export interface MineConsensusDeps {
133
133
  }
134
134
  export interface MineConsensusResult {
135
135
  report: ConsensusReportV1;
136
- /** True when `maxEvidenceItems` truncated the corpus. */
136
+ /**
137
+ * True when `maxEvidenceItems` truncated the corpus, OR skill-usage
138
+ * compaction evicted history the corpus would otherwise have covered
139
+ * (issue #2038).
140
+ */
137
141
  truncated: boolean;
138
142
  /** Corpus sources that could not be read. */
139
143
  unreadableSources: string[];
@@ -30,7 +30,7 @@ import { getSkillVersion, reviseSkill } from '../services/skill-reviser.js';
30
30
  import type { ComplianceObservation, CuratorConfig, CuratorInitResult, CuratorPhaseResult, CuratorSummary, KnowledgeRecommendation, PhaseDigestEntry } from './curator-types.js';
31
31
  import { getArchivedKnowledgeIds, readKnowledge, transactFile } from './knowledge-store.js';
32
32
  import type { KnowledgeConfig } from './knowledge-types.js';
33
- import { readSkillUsageEntries } from './skill-usage-log.js';
33
+ import { readSkillUsageEntries, readSkillUsageEntriesWithCoverage } from './skill-usage-log.js';
34
34
  /**
35
35
  * Optional LLM delegate callback type.
36
36
  * Takes a system prompt and user input, returns the LLM output text.
@@ -51,7 +51,16 @@ export declare const _internals: {
51
51
  checkPhaseCompliance: typeof checkPhaseCompliance;
52
52
  normalizeAgentName: typeof normalizeAgentName;
53
53
  autoRetireSkills: typeof autoRetireSkills;
54
+ /**
55
+ * Retained deliberately (issue #2038 §7). The three curator decision sites
56
+ * now read through `readSkillUsageEntriesWithCoverage` because a coverage
57
+ * verdict and the entries it describes must come from ONE read, but this
58
+ * member keeps the `typeof readSkillUsageEntries` seam contract intact for
59
+ * existing callers and stubs rather than changing an exported symbol's type.
60
+ */
54
61
  readSkillUsageEntries: typeof readSkillUsageEntries;
62
+ readSkillUsageEntriesWithCoverage: typeof readSkillUsageEntriesWithCoverage;
63
+ recordCuratorSkips: typeof recordCuratorSkips;
55
64
  listSkills: typeof listSkills;
56
65
  parseDraftFrontmatter: typeof parseDraftFrontmatter;
57
66
  retireOrMarkStale: typeof retireOrMarkStale;
@@ -71,6 +80,37 @@ export interface RecommendationParseDiagnostic {
71
80
  reason: string;
72
81
  }
73
82
  export declare function normalizeRecommendationEntryIdToken(token: string): string | undefined;
83
+ /**
84
+ * Fold one curator pass's skipped decisions into the durable `curator_skipped`
85
+ * counter in `.swarm/skill-usage-pending.json`.
86
+ *
87
+ * Called ONCE per site with the pass total — never inside the per-skill loop,
88
+ * because it takes the skill-usage lock and a lock per skill would be O(skills)
89
+ * synchronous I/O on the curator path.
90
+ *
91
+ * Two deliberate non-behaviors:
92
+ * - **No health emit.** `emitSkillUsageHealth`'s trigger union has no curator
93
+ * value. `curator_skipped` is a lifetime counter, so the next compaction or
94
+ * consumption emit carries it; inventing a trigger here would widen a
95
+ * contract this change does not own.
96
+ * - **Lock failure drops the write.** Acquisition is non-blocking by design
97
+ * (approved plan §9): maintenance is skipped, never forced. An observability
98
+ * counter must never be the thing that blocks a curator pass.
99
+ *
100
+ * The `.swarm` guard is not defensiveness: the counter lives inside the store,
101
+ * and when the store directory does not exist there is no usage log either, so
102
+ * there is nothing to count into and nothing should be created on the way.
103
+ *
104
+ * **Why this lock-taking path does not run the legacy migration.** Approved plan
105
+ * §6/BLK-13 says `needsMigration` is evaluated on first touch by any path that
106
+ * takes the lock. This one deliberately does not: `ensureMigrated` is private to
107
+ * `skill-usage-log.ts`, and it is benign to omit here because the document this
108
+ * writes keeps whatever `migrated` value it loaded — `false` for an un-migrated
109
+ * store — so the next `pruneSkillUsageLog` / `applySkillUsageFeedback` still
110
+ * migrates on its own first touch. This path can advance a counter; it can never
111
+ * mark a store migrated, and therefore can never strand one.
112
+ */
113
+ declare function recordCuratorSkips(directory: string, skipped: number): void;
74
114
  /**
75
115
  * Auto-retire generated skills whose violation rate exceeds 30% or
76
116
  * whose source knowledge entries are all archived.
@@ -170,7 +170,9 @@ export declare function inferTags(lesson: string): string[];
170
170
  * @param directory - Project root directory (used to resolve `.swarm/knowledge.jsonl`).
171
171
  * @param deltas - Array of {id, delta} tuples. Delta may be positive (boost) or negative (decay).
172
172
  */
173
- export declare function bumpKnowledgeConfidenceBatch(directory: string, deltas: Array<{
173
+ export declare function bumpKnowledgeConfidenceBatch(directory: string, deltas: KnowledgeConfidenceDelta[], options?: ConfidenceFloorOptions): Promise<number>;
174
+ /** A single confidence adjustment request. */
175
+ export interface KnowledgeConfidenceDelta {
174
176
  id: string;
175
177
  delta: number;
176
178
  receipt_events?: Array<{
@@ -178,7 +180,29 @@ export declare function bumpKnowledgeConfidenceBatch(directory: string, deltas:
178
180
  timestamp: string;
179
181
  outcome: 'applied' | 'violated' | 'ignored';
180
182
  }>;
181
- }>, options?: ConfidenceFloorOptions): Promise<number>;
183
+ }
184
+ /**
185
+ * Discriminated result of a batch confidence bump (issue #2038, BLK-4).
186
+ *
187
+ * `bumpKnowledgeConfidenceBatch` returns `0` both for "no matching knowledge
188
+ * IDs" (permanent — the ids are archived, deleted, or mistyped) and for
189
+ * "threw / lock failed" (transient — contention or I/O). A single counter
190
+ * cannot decide dequeue-vs-retain for the skill-usage pending queue: dequeuing
191
+ * on the transient case silently drops feedback, retaining on the permanent
192
+ * case creates an unbounded exempt set. `failed` separates them.
193
+ */
194
+ export interface BumpKnowledgeConfidenceResult {
195
+ /** Number of knowledge entries actually touched. */
196
+ applied: number;
197
+ /** True when the batch threw or its lock could not be acquired. */
198
+ failed: boolean;
199
+ }
200
+ /**
201
+ * Additive variant of {@link bumpKnowledgeConfidenceBatch} that distinguishes
202
+ * "applied nothing" from "failed to run". Existing consumers are unchanged;
203
+ * `bumpKnowledgeConfidenceBatch` is a thin wrapper over this function.
204
+ */
205
+ export declare function bumpKnowledgeConfidenceBatchResult(directory: string, deltas: KnowledgeConfidenceDelta[], options?: ConfidenceFloorOptions): Promise<BumpKnowledgeConfidenceResult>;
182
206
  /** Options for the G2 confidence-floor action in bumpKnowledgeConfidenceBatch. */
183
207
  export interface ConfidenceFloorOptions {
184
208
  /** Action when a just-bumped entry sits at the confidence floor with a
@@ -529,6 +529,59 @@ declare function probeAlivePrWorkflowLaneSessions(directory: string, records: Ba
529
529
  alive: Set<string>;
530
530
  degradedReason?: PrWorkflowLaneProbeDegradedReason;
531
531
  }>;
532
+ /** One still-pending pr-review lane's host liveness reading (issue #2280 Part B). */
533
+ export interface PrWorkflowPendingLaneLiveness {
534
+ laneId: string;
535
+ /**
536
+ * Milliseconds since the lane record last changed — the same aging field
537
+ * (`updatedAt`) the 30-minute presumed-stale sweep measures age by, so the
538
+ * advisory and the terminal sweep can never disagree about how old a lane is.
539
+ */
540
+ pendingMs: number;
541
+ /**
542
+ * Host session status when known: `'busy'`/`'retry'` are live; any other
543
+ * reported type is an affirmative non-live reading; `'absent'` means the host
544
+ * enumerated sessions without ours; `'unknown'` means the probe degraded (or
545
+ * the record has no session id to probe at all).
546
+ */
547
+ hostStatus: string;
548
+ /**
549
+ * Past threshold AND the host did not affirmatively report the session live
550
+ * (non-live status, session absent, or probe degraded). DIAGNOSTIC ONLY — a
551
+ * `true` value never cancels, retries, replaces, or settles the lane.
552
+ */
553
+ stalledSuspect: boolean;
554
+ /**
555
+ * Why the reading is not a real host status: the probe's own failure reasons,
556
+ * plus `'advisory-unavailable'` when the advisory's surrounding accounting
557
+ * failed unexpectedly after the past-threshold set was already known — so an
558
+ * emitted entry always distinguishes "degraded" from a missing probe, and an
559
+ * ABSENT `pending_liveness` keeps meaning "no lane was past the threshold".
560
+ */
561
+ degradedReason?: PrWorkflowLaneProbeDegradedReason | 'advisory-unavailable';
562
+ }
563
+ /**
564
+ * Bounded, fail-open liveness advisory for still-pending pr-review lanes
565
+ * (issue #2280 Part B).
566
+ *
567
+ * ALERT-ONLY, by design: this reads host session status and reports it; it
568
+ * never cancels, retries, replaces, or settles anything. A stalled-suspect
569
+ * critic may still be thinking — automatic replacement would risk duplicate
570
+ * long-running critics racing on the same items — and the 30-minute
571
+ * presumed-stale sweep (issue #2251) remains the only terminal backstop.
572
+ *
573
+ * Cost model: below the threshold there is NO host round-trip at all; past it,
574
+ * exactly ONE session-status call regardless of how many lanes are pending,
575
+ * deadline-bounded through the same `_test_exports` seams as the #2251 probe
576
+ * and additionally clamped to the caller's remaining collection budget
577
+ * (`probeBudgetMs`) — the diagnostic must never add wait beyond the budget the
578
+ * caller already granted the collection itself. Any failure mode degrades
579
+ * (`hostStatus: 'unknown'`, `stalledSuspect: true`, reason named) instead of
580
+ * throwing — collection must never block or fail on this advisory.
581
+ */
582
+ export declare function collectPrWorkflowPendingLaneLiveness(directory: string, records: readonly BackgroundDelegationRecord[], options?: {
583
+ probeBudgetMs?: number;
584
+ }): Promise<PrWorkflowPendingLaneLiveness[]>;
532
585
  export interface PrWorkflowStaleLaneSettlement {
533
586
  /**
534
587
  * Every lane that still blocks: lanes with a fresh `updatedAt` PLUS lanes
@@ -595,9 +648,11 @@ export interface PrWorkflowStaleLaneSettlement {
595
648
  * Issue #2251 adds the second, stronger contradiction: a lane PAST the horizon
596
649
  * whose session the host affirmatively reports as `busy`/`retry` is genuinely
597
650
  * running (nothing heartbeats `updatedAt`, so age alone cannot see this) and is
598
- * retained instead of discarded. The probe is fail-open — see
599
- * {@link probeAlivePrWorkflowLaneSessions} so an unavailable, erroring or
600
- * empty probe leaves the age-only behaviour exactly as it was.
651
+ * retained instead of discarded. The probe is fail-open — the settlement
652
+ * consumes it through the alive-set wrapper {@link
653
+ * probeAlivePrWorkflowLaneSessions}; the fail-open taxonomy itself lives in
654
+ * {@link probePrWorkflowLaneSessionStatusTypes} — so an unavailable, erroring
655
+ * or empty probe leaves the age-only behaviour exactly as it was.
601
656
  */
602
657
  export declare function settlePresumedStalePrWorkflowLanes(directory: string, sessionID: string): Promise<PrWorkflowStaleLaneSettlement>;
603
658
  /**
@@ -863,6 +918,12 @@ export declare const _test_exports: {
863
918
  * `checkoutMutationActionTimeoutMs` above.
864
919
  */
865
920
  laneLivenessProbeTimeoutMs: number;
921
+ /**
922
+ * Pending-liveness advisory threshold (issue #2280 Part B), seam-read at
923
+ * call time for the same clock reason — a test drives the boundary by
924
+ * shortening the threshold, not by waiting minutes.
925
+ */
926
+ pendingLaneLivenessThresholdMs: number;
866
927
  resolveCurrentGitHead: typeof resolveCurrentGitHead;
867
928
  resolveCurrentGitHeadAsync: typeof resolveCurrentGitHeadAsync;
868
929
  resolveCurrentUpstreamPushTarget: typeof resolveCurrentUpstreamPushTarget;
@@ -3,11 +3,13 @@
3
3
  * usage data from `.swarm/skill-usage.jsonl`.
4
4
  *
5
5
  * All public functions are pure over their inputs. File I/O goes through
6
- * `readSkillUsageEntries` (imported from `skill-usage-log.ts`).
6
+ * `readSkillUsageEntriesWithCoverage` (imported from `skill-usage-log.ts`), the
7
+ * bounded read funnel of issue #2038: it reports whether the window it returned
8
+ * is the full history, which `formatSkillIndexWithContext` discloses.
7
9
  * An `_internals` DI seam mirrors the pattern in `skill-usage-log.ts`
8
10
  * and `skill-propagation-gate.ts` for testability.
9
11
  */
10
- import { type SkillUsageEntry } from './skill-usage-log.js';
12
+ import { type SkillUsageEntry, type SkillUsageReadCoverage } from './skill-usage-log.js';
11
13
  /** Per-skill ranking entry returned by `rankSkillsForContext`. */
12
14
  export interface SkillRankEntry {
13
15
  /** Repo-relative path to the skill file. */
@@ -32,6 +34,13 @@ export interface SkillStats {
32
34
  agent: string;
33
35
  count: number;
34
36
  }>;
37
+ /**
38
+ * What the window these stats were computed from could and could not see
39
+ * (issue #2038 §7). Absent only on a `SkillStats` built by hand; every
40
+ * value produced by {@link getSkillStats} carries it, so a consumer can tell
41
+ * "0% compliance" from "compaction evicted the compliant half".
42
+ */
43
+ coverage?: SkillUsageReadCoverage;
35
44
  }
36
45
  export type SkillRunner = 'opencode' | 'claude' | 'codex';
37
46
  /** Parsed state of an explicit (or absent) top-level audience declaration. */
@@ -158,7 +167,8 @@ export declare function rankSkillsForContext(skills: string[], taskContext: stri
158
167
  *
159
168
  * @param skillPath - Repo-relative path to the skill file.
160
169
  * @param directory - Project root directory.
161
- * @returns `SkillStats` with aggregate metrics. Returns zeros/empty when log is missing.
170
+ * @returns `SkillStats` with aggregate metrics, carrying the coverage of the
171
+ * window they were computed from. Returns zeros/empty when log is missing.
162
172
  */
163
173
  export declare function getSkillStats(skillPath: string, directory: string): SkillStats;
164
174
  /**