opencode-swarm 7.148.0 → 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 (71) hide show
  1. package/dist/background/pr-review-collection-receipt.d.ts +2 -2
  2. package/dist/cli/{config-doctor-z2wam5wn.js → config-doctor-w6zphy4w.js} +2 -2
  3. package/dist/cli/{core-k7m76ce0.js → core-65qyqw2f.js} +1 -1
  4. package/dist/cli/{curation-policy-kd8j8cne.js → curation-policy-166wdjs4.js} +6 -6
  5. package/dist/cli/{curator-jwpm52kg.js → curator-2jhdfjqg.js} +27 -27
  6. package/dist/cli/{curator-llm-factory-4qt8b15s.js → curator-llm-factory-y43mx297.js} +27 -27
  7. package/dist/cli/{evidence-summary-service-90z295j3.js → evidence-summary-service-7qpganmn.js} +11 -11
  8. package/dist/cli/{gate-evidence-3q6q71fw.js → gate-evidence-p79xv25a.js} +6 -6
  9. package/dist/cli/{guardrail-explain-44xt373y.js → guardrail-explain-76sy950j.js} +28 -28
  10. package/dist/cli/{guardrail-log-kbp5jztb.js → guardrail-log-pm0w6ney.js} +3 -3
  11. package/dist/cli/{guardrail-reset-vpazhh8k.js → guardrail-reset-tkkg0bfz.js} +27 -27
  12. package/dist/cli/{hive-promoter-tdrkz9nh.js → hive-promoter-w4batwr6.js} +27 -27
  13. package/dist/cli/{index-jpa03jcc.js → index-2bsnwcmp.js} +1 -1
  14. package/dist/cli/{index-pgvx3rkq.js → index-2n9rwvcc.js} +1 -1
  15. package/dist/cli/{index-2y14mjfn.js → index-3yh2e5ca.js} +4 -2
  16. package/dist/cli/{index-9pmmexsd.js → index-5wypz451.js} +1 -1
  17. package/dist/cli/{index-x4rxh8j9.js → index-627mz27c.js} +3 -3
  18. package/dist/cli/{index-016708th.js → index-81n4ky69.js} +2 -2
  19. package/dist/cli/{index-52gnz782.js → index-c23yxr1s.js} +4 -4
  20. package/dist/cli/{index-d3bdr78h.js → index-ch6sjm8q.js} +1 -1
  21. package/dist/cli/{index-n96wwf56.js → index-dwg0z10h.js} +4 -4
  22. package/dist/cli/{index-sycndcwd.js → index-e9d2829t.js} +1 -1
  23. package/dist/cli/{index-h879g4r4.js → index-f115c8y6.js} +3 -3
  24. package/dist/cli/{index-y586zet4.js → index-fv5cc1rd.js} +2 -2
  25. package/dist/cli/{index-q81s0m8k.js → index-ghbkknjz.js} +79 -38
  26. package/dist/cli/{index-dmbaaz6d.js → index-hxqjf4me.js} +4 -4
  27. package/dist/cli/{index-zwpttdgn.js → index-jtnk7k6w.js} +1 -1
  28. package/dist/cli/{index-ffevkn7k.js → index-k5ze5v89.js} +1 -1
  29. package/dist/cli/{index-p62we2ar.js → index-kpgj4ha6.js} +1 -1
  30. package/dist/cli/{index-crpb0qke.js → index-kztxn1ww.js} +4034 -2834
  31. package/dist/cli/{index-qwj7qjjp.js → index-m97qwwrk.js} +2 -2
  32. package/dist/cli/{index-7ac5z627.js → index-mfhpk4c6.js} +1 -1
  33. package/dist/cli/{index-n0fpefqx.js → index-py2rsw1a.js} +4 -4
  34. package/dist/cli/{index-k6h5yc1j.js → index-q0gfmyzx.js} +5 -5
  35. package/dist/cli/{index-702zx3rk.js → index-qwzpsh3w.js} +1 -1
  36. package/dist/cli/{index-qcm97jfh.js → index-qzstn430.js} +1 -1
  37. package/dist/cli/{index-6q35swn2.js → index-rsn4jm90.js} +1 -1
  38. package/dist/cli/{index-dfvh1r8g.js → index-s3s2egzn.js} +29 -29
  39. package/dist/cli/{index-7hctrdk8.js → index-shazb5b6.js} +2 -2
  40. package/dist/cli/{index-rcjq8dm4.js → index-shm69en5.js} +2 -2
  41. package/dist/cli/{index-ykjjqg79.js → index-t6ys1386.js} +6 -6
  42. package/dist/cli/{index-gwrv6c56.js → index-w49v4xd6.js} +7 -7
  43. package/dist/cli/{index-07zgs6y0.js → index-x46mmaep.js} +14 -10
  44. package/dist/cli/index.js +27 -27
  45. package/dist/cli/{knowledge-escalator-0qnm48g8.js → knowledge-escalator-21n4ztqx.js} +11 -11
  46. package/dist/cli/{knowledge-events-3zv81nzp.js → knowledge-events-h5d5eayv.js} +9 -9
  47. package/dist/cli/{knowledge-link-w91bcyx2.js → knowledge-link-vgxe7gz9.js} +5 -5
  48. package/dist/cli/{knowledge-store-njtx6wj1.js → knowledge-store-y10m7x4f.js} +8 -6
  49. package/dist/cli/{knowledge-validator-7eqj5afv.js → knowledge-validator-dzm9sg0f.js} +8 -8
  50. package/dist/cli/{pending-delegations-k4x00mqc.js → pending-delegations-78zaaxz4.js} +3 -3
  51. package/dist/cli/{pr-subscriptions-x2mqc3f1.js → pr-subscriptions-9mg6mwc0.js} +3 -3
  52. package/dist/cli/{runner-gfzkp9nv.js → runner-rarzeth8.js} +6 -6
  53. package/dist/cli/{scan-cursor-a6dhyf55.js → scan-cursor-zn2qf06a.js} +7 -7
  54. package/dist/cli/{schema-p0vn1zgh.js → schema-ynwy7abm.js} +1 -1
  55. package/dist/cli/{scope-persistence-zs97zkt7.js → scope-persistence-sh30937s.js} +7 -7
  56. package/dist/cli/{skill-generator-5qg15q1j.js → skill-generator-r3knfwrp.js} +13 -13
  57. package/dist/cli/{telemetry-xzy0qeap.js → telemetry-1pnsftp0.js} +1 -1
  58. package/dist/cli/{worktree-collision-ownership-q2gswg16.js → worktree-collision-ownership-29md3k1n.js} +3 -3
  59. package/dist/cli/{worktree-isolation-ndb5fwys.js → worktree-isolation-yj7ssh24.js} +27 -27
  60. package/dist/consensus/contracts.d.ts +5 -1
  61. package/dist/consensus/corpus.d.ts +26 -3
  62. package/dist/consensus/miner.d.ts +5 -1
  63. package/dist/hooks/curator.d.ts +41 -1
  64. package/dist/hooks/knowledge-store.d.ts +26 -2
  65. package/dist/hooks/skill-scoring.d.ts +13 -3
  66. package/dist/hooks/skill-usage-log.d.ts +140 -17
  67. package/dist/hooks/skill-usage-pending.d.ts +392 -0
  68. package/dist/index.js +500 -499
  69. package/dist/observability/catalog.d.ts +6 -4
  70. package/dist/telemetry.d.ts +35 -1
  71. 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-p62we2ar.js";
7
- import"./index-y586zet4.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-7hctrdk8.js";
11
- import"./index-2y14mjfn.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-016708th.js";
8
- import"./index-07zgs6y0.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-qcm97jfh.js";
13
- import"./index-7hctrdk8.js";
12
+ import"./index-qzstn430.js";
13
+ import"./index-shazb5b6.js";
14
14
  import"./index-bk5tah7q.js";
15
- import"./index-2y14mjfn.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-702zx3rk.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-52gnz782.js";
27
- import"./index-h879g4r4.js";
26
+ } from "./index-c23yxr1s.js";
27
+ import"./index-f115c8y6.js";
28
28
  import"./index-556ja8an.js";
29
- import"./index-ffevkn7k.js";
30
- import"./index-702zx3rk.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-2y14mjfn.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-dmbaaz6d.js";
37
- import"./index-n96wwf56.js";
38
- import"./index-zwpttdgn.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-07zgs6y0.js";
42
- import"./index-gwrv6c56.js";
43
- import"./index-rcjq8dm4.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-ffevkn7k.js";
47
- import"./index-702zx3rk.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-qcm97jfh.js";
57
- import"./index-7hctrdk8.js";
56
+ import"./index-qzstn430.js";
57
+ import"./index-shazb5b6.js";
58
58
  import"./index-bk5tah7q.js";
59
- import"./index-2y14mjfn.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-crpb0qke.js";
25
- import"./index-p62we2ar.js";
26
- import"./index-jpa03jcc.js";
27
- import"./index-9pmmexsd.js";
28
- import"./index-ykjjqg79.js";
29
- import"./index-y586zet4.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-k6h5yc1j.js";
34
- import"./index-016708th.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-dmbaaz6d.js";
41
- import"./index-n96wwf56.js";
42
- import"./index-zwpttdgn.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-n0fpefqx.js";
48
- import"./index-7ac5z627.js";
49
- import"./index-52gnz782.js";
50
- import"./index-h879g4r4.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-07zgs6y0.js";
57
- import"./index-gwrv6c56.js";
56
+ import"./index-x46mmaep.js";
57
+ import"./index-w49v4xd6.js";
58
58
  import {
59
59
  resolveWorktreeIsolationConfig
60
- } from "./index-rcjq8dm4.js";
60
+ } from "./index-shm69en5.js";
61
61
  import"./index-gprxjmm7.js";
62
62
  import"./index-n832052r.js";
63
- import"./index-ffevkn7k.js";
64
- import"./index-702zx3rk.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-qcm97jfh.js";
74
- import"./index-7hctrdk8.js";
73
+ import"./index-qzstn430.js";
74
+ import"./index-shazb5b6.js";
75
75
  import"./index-bk5tah7q.js";
76
- import"./index-2y14mjfn.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
@@ -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
  /**