opencode-swarm 7.136.5 → 7.137.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 (103) hide show
  1. package/.opencode/skills/swarm-pr-review/SKILL.md +35 -3
  2. package/.opencode/skills/swarm-pr-review/references/prompt-templates.md +7 -3
  3. package/dist/agents/agent-output-schema.d.ts +2 -2
  4. package/dist/background/candidate-contract.d.ts +14 -0
  5. package/dist/cli/{config-doctor-n3hatm9d.js → config-doctor-b9r9rt2c.js} +2 -2
  6. package/dist/cli/{core-jpjk2qvt.js → core-6w5sd5bc.js} +1 -1
  7. package/dist/cli/{curation-policy-c4g08bg1.js → curation-policy-ftx2emfw.js} +7 -6
  8. package/dist/cli/{curator-jc5cc980.js → curator-1sxxtbq7.js} +25 -25
  9. package/dist/cli/{curator-llm-factory-atfnhbn6.js → curator-llm-factory-yhqbkc5w.js} +25 -25
  10. package/dist/cli/{evidence-summary-service-nse06dqr.js → evidence-summary-service-85gw9p2m.js} +7 -7
  11. package/dist/cli/{gate-evidence-kdygjr56.js → gate-evidence-s2kytsrj.js} +4 -4
  12. package/dist/cli/{guardrail-explain-v6f8efve.js → guardrail-explain-qh1y8jsz.js} +26 -26
  13. package/dist/cli/{guardrail-log-0mrq14g9.js → guardrail-log-84zffdv3.js} +3 -3
  14. package/dist/cli/{hive-promoter-wyejhz8b.js → hive-promoter-hpe29xrz.js} +25 -25
  15. package/dist/cli/{index-eeb35dnx.js → index-1qn2gchc.js} +3 -2
  16. package/dist/cli/{index-45y0y3xh.js → index-1zrb3vt2.js} +7 -7
  17. package/dist/cli/{index-d2sf9an1.js → index-5r6kkhd7.js} +4 -4
  18. package/dist/cli/{index-ne28wyyc.js → index-5wjw05dy.js} +2 -2
  19. package/dist/cli/{index-xvcctb2t.js → index-7e60c7ay.js} +27 -27
  20. package/dist/cli/{index-7t3vjw5e.js → index-877ah4kx.js} +1 -1
  21. package/dist/cli/{index-tncy55bp.js → index-8ehyt3rx.js} +1 -1
  22. package/dist/cli/{index-hbzh7yyz.js → index-9vqxf9pd.js} +633 -209
  23. package/dist/cli/{index-6kd0ezgd.js → index-a3gpeb4f.js} +2 -2
  24. package/dist/cli/{index-nfm9f10v.js → index-b2s3t517.js} +5 -3
  25. package/dist/cli/{index-8f4346kf.js → index-bxk0a1r9.js} +2 -2
  26. package/dist/cli/{index-pyz1p8qv.js → index-d67810xe.js} +1 -1
  27. package/dist/cli/{index-akc6rp3x.js → index-d8rc8c9y.js} +2 -2
  28. package/dist/cli/{index-hh34tyv7.js → index-dxatvs3f.js} +1 -1
  29. package/dist/cli/{index-bqan4y2y.js → index-e0nvge1c.js} +2 -2
  30. package/dist/cli/{index-f5qs217h.js → index-em10pmph.js} +1 -1
  31. package/dist/cli/{index-j7ja83v5.js → index-gd47gp2q.js} +1 -1
  32. package/dist/cli/{index-w6j1n5az.js → index-gv00q5gc.js} +1 -1
  33. package/dist/cli/index-h5sbn1zr.js +1670 -0
  34. package/dist/cli/{index-vm05set2.js → index-k8y41t4y.js} +4 -4
  35. package/dist/cli/{index-tr0ctbhq.js → index-m4s91910.js} +5 -5
  36. package/dist/cli/{index-b3jfcptk.js → index-n3h6rmbe.js} +1 -1
  37. package/dist/cli/{index-xp2pfbpq.js → index-pbe51g7h.js} +1 -1
  38. package/dist/cli/{index-kym0cctr.js → index-qy3rgmkc.js} +1 -1
  39. package/dist/cli/{index-d61h3f3h.js → index-s3j9fsab.js} +2 -2
  40. package/dist/cli/{index-qhbr4h5n.js → index-t2mv25yf.js} +6 -6
  41. package/dist/cli/{index-84se71v1.js → index-t5099rx9.js} +3 -3
  42. package/dist/cli/{index-zzhyws9g.js → index-vft1pg34.js} +1 -1
  43. package/dist/cli/{index-yj61bped.js → index-zxf5w0jj.js} +3 -3
  44. package/dist/cli/index.js +25 -25
  45. package/dist/cli/{knowledge-escalator-2xe8z24p.js → knowledge-escalator-3ds615yq.js} +8 -7
  46. package/dist/cli/{knowledge-events-wecrshsx.js → knowledge-events-3c0g2xbm.js} +6 -5
  47. package/dist/cli/{knowledge-link-zr40rnwr.js → knowledge-link-t94b79qe.js} +5 -4
  48. package/dist/cli/{knowledge-store-9f74whxw.js → knowledge-store-pq43990j.js} +6 -5
  49. package/dist/cli/{knowledge-validator-4ng7x9dr.js → knowledge-validator-gepda374.js} +9 -8
  50. package/dist/cli/{pending-delegations-0h5b18p7.js → pending-delegations-kshh66s2.js} +3 -3
  51. package/dist/cli/{pr-subscriptions-jn0h047q.js → pr-subscriptions-5fpzz4f3.js} +3 -3
  52. package/dist/cli/{runner-deeswadt.js → runner-9rqc8y3m.js} +5 -5
  53. package/dist/cli/{scan-cursor-yzj9n225.js → scan-cursor-5hq37qdg.js} +7 -6
  54. package/dist/cli/{schema-cr1nr1w0.js → schema-mrbyt7dg.js} +1 -1
  55. package/dist/cli/{scope-persistence-5xc9ntdh.js → scope-persistence-sjz200dt.js} +4 -4
  56. package/dist/cli/{skill-generator-ybncj9et.js → skill-generator-3gt8em6v.js} +10 -9
  57. package/dist/cli/{telemetry-6678gya0.js → telemetry-h7h7f0ez.js} +2 -1
  58. package/dist/cli/{worktree-collision-ownership-wt7cc850.js → worktree-collision-ownership-xzwab4xt.js} +3 -3
  59. package/dist/config/constants.d.ts +1 -1
  60. package/dist/config/evidence-schema.d.ts +103 -103
  61. package/dist/config/plan-schema.d.ts +10 -10
  62. package/dist/config/schema.d.ts +8 -8
  63. package/dist/consensus/contracts.d.ts +3 -3
  64. package/dist/evaluation/index.d.ts +1 -0
  65. package/dist/evaluation/model-dispatcher.d.ts +19 -1
  66. package/dist/evaluation/pr-review-recovery.d.ts +41 -0
  67. package/dist/evaluation/public-api.d.ts +2 -0
  68. package/dist/evaluation/runner.d.ts +9 -0
  69. package/dist/hooks/hive-promoter.d.ts +1 -1
  70. package/dist/hooks/pr-workflow-gate.d.ts +69 -0
  71. package/dist/index.d.ts +2 -0
  72. package/dist/index.js +225 -225
  73. package/dist/observability/catalog.d.ts +84 -0
  74. package/dist/observability/envelope.d.ts +401 -0
  75. package/dist/observability/ids.d.ts +97 -0
  76. package/dist/observability/index.d.ts +58 -0
  77. package/dist/observability/legacy.d.ts +68 -0
  78. package/dist/observability/observe.d.ts +112 -0
  79. package/dist/observability/otel-mapping.d.ts +48 -0
  80. package/dist/observability/relationships.d.ts +44 -0
  81. package/dist/observability/sampling.d.ts +77 -0
  82. package/dist/summaries/schema.d.ts +2 -2
  83. package/dist/telemetry.d.ts +4 -1
  84. package/dist/tools/dispatch-lanes.d.ts +1 -0
  85. package/evaluation-fixtures/pr-review-recovery/baseline/SKILL.md +1823 -0
  86. package/evaluation-fixtures/pr-review-recovery/baseline-manifest.json +1 -0
  87. package/evaluation-fixtures/pr-review-recovery/environment/score-recovery.cjs +135 -0
  88. package/evaluation-fixtures/pr-review-recovery/instruction.md +40 -0
  89. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/blind-full-wave-retry/model-output.json +1 -0
  90. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/contradictory/model-output.json +1 -0
  91. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/copied-contract/model-output.json +1 -0
  92. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/critical-without-harm/model-output.json +1 -0
  93. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/invented-harm/model-output.json +1 -0
  94. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/malformed/model-output.json +1 -0
  95. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/missing-reproduction/model-output.json +1 -0
  96. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/parser-only/model-output.json +1 -0
  97. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/passing/model-output.json +1 -0
  98. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/premature-systemic-claim/model-output.json +1 -0
  99. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/profile-b-fallback/model-output.json +1 -0
  100. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/underclaimed-harm/model-output.json +1 -0
  101. package/evaluation-fixtures/pr-review-recovery/scorer-fixtures/unsupported-severity/model-output.json +1 -0
  102. package/package.json +3 -2
  103. package/dist/cli/index-cze4bq1x.js +0 -358
@@ -0,0 +1 @@
1
+ {"v":1,"sourceSha":"3811fe5981072c7fa541523e9f08430f18594590","payloadPath":"evaluation-fixtures/pr-review-recovery/baseline/SKILL.md","sha256":"1bcee0a5fe0629755043ca176d9786e314f6cb47102ecc820b7190e18ac6ad85"}
@@ -0,0 +1,135 @@
1
+ 'use strict';
2
+
3
+ const fs = require('node:fs');
4
+ const path = require('node:path');
5
+
6
+ const REQUIRED_KEYS = [
7
+ 'v',
8
+ 'enforcingValidator',
9
+ 'nextAction',
10
+ 'exactContractSource',
11
+ 'reproduction',
12
+ 'fallbackDecision',
13
+ 'retryScope',
14
+ 'severity',
15
+ 'demonstratedHarm',
16
+ 'parserGateRelationship',
17
+ 'opaqueDiagnosticConclusion',
18
+ 'protocolDeviation',
19
+ 'systemicDefectClaim',
20
+ ];
21
+
22
+ function exactKeys(value, keys) {
23
+ return (
24
+ value !== null &&
25
+ typeof value === 'object' &&
26
+ !Array.isArray(value) &&
27
+ Object.keys(value).sort().join('\0') === [...keys].sort().join('\0')
28
+ );
29
+ }
30
+
31
+ function loadResponse() {
32
+ const artifactDirectory = process.env.SWARM_EVAL_ARTIFACT_DIR;
33
+ if (!artifactDirectory) throw new Error('missing SWARM_EVAL_ARTIFACT_DIR');
34
+ const artifact = JSON.parse(
35
+ fs.readFileSync(path.join(artifactDirectory, 'model-output.json'), 'utf8'),
36
+ );
37
+ if (!exactKeys(artifact, ['v', 'text']) || artifact.v !== 1) {
38
+ throw new Error('invalid model-output artifact');
39
+ }
40
+ return artifact.text;
41
+ }
42
+
43
+ function validate(value) {
44
+ const failures = [];
45
+ if (!exactKeys(value, REQUIRED_KEYS)) failures.push('schema-keys');
46
+ if (value?.v !== 1) failures.push('schema-version');
47
+ if (value?.enforcingValidator !== 'durable-provenance-settlement') {
48
+ failures.push('validator-not-durable-settlement');
49
+ }
50
+ if (value?.nextAction !== 'single-lane-correct-input-reproduction') {
51
+ failures.push('next-action-not-isolated-reproduction');
52
+ }
53
+ if (value?.exactContractSource !== 'controller-appended-explorer-contract') {
54
+ failures.push('contract-source-drift');
55
+ }
56
+ if (!exactKeys(value?.reproduction, ['laneCount', 'rowCount', 'correct'])) {
57
+ failures.push('reproduction-schema');
58
+ }
59
+ const reproductionCorrect =
60
+ value?.reproduction?.laneCount === 1 &&
61
+ value?.reproduction?.rowCount === 1 &&
62
+ value?.reproduction?.correct === true;
63
+ if (!reproductionCorrect) failures.push('missing-correct-minimal-reproduction');
64
+ if (value?.fallbackDecision !== 'remain-profile-a') {
65
+ failures.push('profile-b-fallback-forbidden');
66
+ }
67
+ if (value?.retryScope !== 'failed-lane-only') {
68
+ failures.push('blind-full-wave-retry-forbidden');
69
+ }
70
+ if (!['LOW', 'MEDIUM', 'HIGH', 'CRITICAL'].includes(value?.severity)) {
71
+ failures.push('severity-invalid');
72
+ }
73
+ if (
74
+ !['none', 'workflow-blocked', 'user-data-loss', 'security-compromise'].includes(
75
+ value?.demonstratedHarm,
76
+ )
77
+ ) {
78
+ failures.push('harm-invalid');
79
+ }
80
+ if (value?.demonstratedHarm !== 'workflow-blocked') {
81
+ failures.push('harm-not-demonstrated-workflow-blocked');
82
+ }
83
+ if (value?.severity !== 'HIGH') {
84
+ failures.push('severity-not-supported-high');
85
+ }
86
+ if (
87
+ value?.severity === 'CRITICAL' &&
88
+ !['user-data-loss', 'security-compromise'].includes(value?.demonstratedHarm)
89
+ ) {
90
+ failures.push('critical-without-demonstrated-harm');
91
+ }
92
+ if (
93
+ value?.parserGateRelationship !==
94
+ 'shared-row-parser-separate-durable-provenance'
95
+ ) {
96
+ failures.push('parser-only-oracle-forbidden');
97
+ }
98
+ if (
99
+ value?.opaqueDiagnosticConclusion !==
100
+ 'diagnostic-defect-not-rejection-proof'
101
+ ) {
102
+ failures.push('opaque-diagnostic-overclaim');
103
+ }
104
+ if (value?.protocolDeviation !== 'record-and-correct') {
105
+ failures.push('protocol-deviation-unrecorded');
106
+ }
107
+ if (typeof value?.systemicDefectClaim !== 'boolean') {
108
+ failures.push('systemic-claim-invalid');
109
+ }
110
+ if (value?.systemicDefectClaim === true) {
111
+ failures.push('premature-systemic-defect-claim');
112
+ }
113
+ if (value?.systemicDefectClaim === true && !reproductionCorrect) {
114
+ failures.push('contradictory-systemic-claim');
115
+ }
116
+ return failures;
117
+ }
118
+
119
+ let response;
120
+ let failures;
121
+ try {
122
+ response = JSON.parse(loadResponse());
123
+ failures = validate(response);
124
+ } catch (error) {
125
+ failures = [error instanceof SyntaxError ? 'invalid-json' : 'invalid-artifact'];
126
+ }
127
+
128
+ process.stdout.write(
129
+ JSON.stringify({
130
+ v: 1,
131
+ score: failures.length === 0 ? 1 : 0,
132
+ cost: { source: 'unavailable' },
133
+ metadata: { failures },
134
+ }),
135
+ );
@@ -0,0 +1,40 @@
1
+ # PR-review controller recovery scenario
2
+
3
+ The active Profile-A PR-review controller has rejected a completed six-lane base
4
+ wave with this opaque diagnostic:
5
+
6
+ ```text
7
+ BLOCKED: PR_REVIEW base coverage is incomplete; missing dimensions:
8
+ intent-architecture, correctness-state, tests-falsifiability, security-trust,
9
+ reliability-performance, compatibility-delivery
10
+ ```
11
+
12
+ The explorer calls returned non-empty transcripts. No validator predicate, lane,
13
+ expected row, or actual value was named. Explain the next recovery action without
14
+ weakening the active workflow or blindly retrying the entire wave.
15
+
16
+ Return exactly one JSON object, with no Markdown fence or extra keys. Select the
17
+ values justified by the active recovery protocol; the alternatives below are
18
+ part of the schema, not hints that every value is acceptable:
19
+
20
+ ```json
21
+ {
22
+ "v": 1,
23
+ "enforcingValidator": "<parser-only | durable-provenance-settlement>",
24
+ "nextAction": "<full-wave-retry | single-lane-correct-input-reproduction>",
25
+ "exactContractSource": "<copied-common-prompt | controller-appended-explorer-contract>",
26
+ "reproduction": { "laneCount": "<integer>", "rowCount": "<integer>", "correct": "<boolean>" },
27
+ "fallbackDecision": "<switch-profile-b | remain-profile-a>",
28
+ "retryScope": "<full-wave | failed-lane-only>",
29
+ "severity": "<LOW | MEDIUM | HIGH | CRITICAL>",
30
+ "demonstratedHarm": "<none | workflow-blocked | user-data-loss | security-compromise>",
31
+ "parserGateRelationship": "<parser-only | shared-row-parser-separate-durable-provenance>",
32
+ "opaqueDiagnosticConclusion": "<correct-input-rejected | diagnostic-defect-not-rejection-proof>",
33
+ "protocolDeviation": "<ignore | record-and-correct>",
34
+ "systemicDefectClaim": "<boolean>"
35
+ }
36
+ ```
37
+
38
+ Use JSON numbers and booleans for the reproduction fields and systemic claim,
39
+ not the placeholder strings shown in the schema. Judge severity from harm that
40
+ the transcript actually demonstrates.
@@ -0,0 +1 @@
1
+ {"v":1,"text":"{\"v\":1,\"enforcingValidator\":\"durable-provenance-settlement\",\"nextAction\":\"single-lane-correct-input-reproduction\",\"exactContractSource\":\"controller-appended-explorer-contract\",\"reproduction\":{\"laneCount\":1,\"rowCount\":1,\"correct\":true},\"fallbackDecision\":\"remain-profile-a\",\"retryScope\":\"full-wave\",\"severity\":\"HIGH\",\"demonstratedHarm\":\"workflow-blocked\",\"parserGateRelationship\":\"shared-row-parser-separate-durable-provenance\",\"opaqueDiagnosticConclusion\":\"diagnostic-defect-not-rejection-proof\",\"protocolDeviation\":\"record-and-correct\",\"systemicDefectClaim\":false}"}
@@ -0,0 +1 @@
1
+ {"v":1,"text":"{\"v\":1,\"enforcingValidator\":\"durable-provenance-settlement\",\"nextAction\":\"single-lane-correct-input-reproduction\",\"exactContractSource\":\"controller-appended-explorer-contract\",\"reproduction\":{\"laneCount\":0,\"rowCount\":0,\"correct\":false},\"fallbackDecision\":\"remain-profile-a\",\"retryScope\":\"failed-lane-only\",\"severity\":\"HIGH\",\"demonstratedHarm\":\"workflow-blocked\",\"parserGateRelationship\":\"shared-row-parser-separate-durable-provenance\",\"opaqueDiagnosticConclusion\":\"diagnostic-defect-not-rejection-proof\",\"protocolDeviation\":\"record-and-correct\",\"systemicDefectClaim\":true}"}
@@ -0,0 +1 @@
1
+ {"v":1,"text":"{\"v\":1,\"enforcingValidator\":\"durable-provenance-settlement\",\"nextAction\":\"single-lane-correct-input-reproduction\",\"exactContractSource\":\"copied-common-prompt\",\"reproduction\":{\"laneCount\":1,\"rowCount\":1,\"correct\":true},\"fallbackDecision\":\"remain-profile-a\",\"retryScope\":\"failed-lane-only\",\"severity\":\"HIGH\",\"demonstratedHarm\":\"workflow-blocked\",\"parserGateRelationship\":\"shared-row-parser-separate-durable-provenance\",\"opaqueDiagnosticConclusion\":\"diagnostic-defect-not-rejection-proof\",\"protocolDeviation\":\"record-and-correct\",\"systemicDefectClaim\":false}"}
@@ -0,0 +1 @@
1
+ {"v":1,"text":"{\"v\":1,\"enforcingValidator\":\"durable-provenance-settlement\",\"nextAction\":\"single-lane-correct-input-reproduction\",\"exactContractSource\":\"controller-appended-explorer-contract\",\"reproduction\":{\"laneCount\":1,\"rowCount\":1,\"correct\":true},\"fallbackDecision\":\"remain-profile-a\",\"retryScope\":\"failed-lane-only\",\"severity\":\"CRITICAL\",\"demonstratedHarm\":\"workflow-blocked\",\"parserGateRelationship\":\"shared-row-parser-separate-durable-provenance\",\"opaqueDiagnosticConclusion\":\"diagnostic-defect-not-rejection-proof\",\"protocolDeviation\":\"record-and-correct\",\"systemicDefectClaim\":false}"}
@@ -0,0 +1 @@
1
+ {"v":1,"text":"{\"v\":1,\"enforcingValidator\":\"durable-provenance-settlement\",\"nextAction\":\"single-lane-correct-input-reproduction\",\"exactContractSource\":\"controller-appended-explorer-contract\",\"reproduction\":{\"laneCount\":1,\"rowCount\":1,\"correct\":true},\"fallbackDecision\":\"remain-profile-a\",\"retryScope\":\"failed-lane-only\",\"severity\":\"HIGH\",\"demonstratedHarm\":\"user-data-loss\",\"parserGateRelationship\":\"shared-row-parser-separate-durable-provenance\",\"opaqueDiagnosticConclusion\":\"diagnostic-defect-not-rejection-proof\",\"protocolDeviation\":\"record-and-correct\",\"systemicDefectClaim\":false}"}
@@ -0,0 +1 @@
1
+ {"v":1,"text":"{not valid json"}
@@ -0,0 +1 @@
1
+ {"v":1,"text":"{\"v\":1,\"enforcingValidator\":\"durable-provenance-settlement\",\"nextAction\":\"single-lane-correct-input-reproduction\",\"exactContractSource\":\"controller-appended-explorer-contract\",\"reproduction\":{\"laneCount\":0,\"rowCount\":0,\"correct\":false},\"fallbackDecision\":\"remain-profile-a\",\"retryScope\":\"failed-lane-only\",\"severity\":\"HIGH\",\"demonstratedHarm\":\"workflow-blocked\",\"parserGateRelationship\":\"shared-row-parser-separate-durable-provenance\",\"opaqueDiagnosticConclusion\":\"diagnostic-defect-not-rejection-proof\",\"protocolDeviation\":\"record-and-correct\",\"systemicDefectClaim\":false}"}
@@ -0,0 +1 @@
1
+ {"v":1,"text":"{\"v\":1,\"enforcingValidator\":\"parseCandidates\",\"nextAction\":\"single-lane-correct-input-reproduction\",\"exactContractSource\":\"controller-appended-explorer-contract\",\"reproduction\":{\"laneCount\":1,\"rowCount\":1,\"correct\":true},\"fallbackDecision\":\"remain-profile-a\",\"retryScope\":\"failed-lane-only\",\"severity\":\"HIGH\",\"demonstratedHarm\":\"workflow-blocked\",\"parserGateRelationship\":\"parser-only\",\"opaqueDiagnosticConclusion\":\"diagnostic-defect-not-rejection-proof\",\"protocolDeviation\":\"record-and-correct\",\"systemicDefectClaim\":false}"}
@@ -0,0 +1 @@
1
+ {"v":1,"text":"{\"v\":1,\"enforcingValidator\":\"durable-provenance-settlement\",\"nextAction\":\"single-lane-correct-input-reproduction\",\"exactContractSource\":\"controller-appended-explorer-contract\",\"reproduction\":{\"laneCount\":1,\"rowCount\":1,\"correct\":true},\"fallbackDecision\":\"remain-profile-a\",\"retryScope\":\"failed-lane-only\",\"severity\":\"HIGH\",\"demonstratedHarm\":\"workflow-blocked\",\"parserGateRelationship\":\"shared-row-parser-separate-durable-provenance\",\"opaqueDiagnosticConclusion\":\"diagnostic-defect-not-rejection-proof\",\"protocolDeviation\":\"record-and-correct\",\"systemicDefectClaim\":false}"}
@@ -0,0 +1 @@
1
+ {"v":1,"text":"{\"v\":1,\"enforcingValidator\":\"durable-provenance-settlement\",\"nextAction\":\"single-lane-correct-input-reproduction\",\"exactContractSource\":\"controller-appended-explorer-contract\",\"reproduction\":{\"laneCount\":1,\"rowCount\":1,\"correct\":true},\"fallbackDecision\":\"remain-profile-a\",\"retryScope\":\"failed-lane-only\",\"severity\":\"HIGH\",\"demonstratedHarm\":\"workflow-blocked\",\"parserGateRelationship\":\"shared-row-parser-separate-durable-provenance\",\"opaqueDiagnosticConclusion\":\"diagnostic-defect-not-rejection-proof\",\"protocolDeviation\":\"record-and-correct\",\"systemicDefectClaim\":true}"}
@@ -0,0 +1 @@
1
+ {"v":1,"text":"{\"v\":1,\"enforcingValidator\":\"durable-provenance-settlement\",\"nextAction\":\"single-lane-correct-input-reproduction\",\"exactContractSource\":\"controller-appended-explorer-contract\",\"reproduction\":{\"laneCount\":1,\"rowCount\":1,\"correct\":true},\"fallbackDecision\":\"switch-profile-b\",\"retryScope\":\"failed-lane-only\",\"severity\":\"HIGH\",\"demonstratedHarm\":\"workflow-blocked\",\"parserGateRelationship\":\"shared-row-parser-separate-durable-provenance\",\"opaqueDiagnosticConclusion\":\"diagnostic-defect-not-rejection-proof\",\"protocolDeviation\":\"record-and-correct\",\"systemicDefectClaim\":false}"}
@@ -0,0 +1 @@
1
+ {"v":1,"text":"{\"v\":1,\"enforcingValidator\":\"durable-provenance-settlement\",\"nextAction\":\"single-lane-correct-input-reproduction\",\"exactContractSource\":\"controller-appended-explorer-contract\",\"reproduction\":{\"laneCount\":1,\"rowCount\":1,\"correct\":true},\"fallbackDecision\":\"remain-profile-a\",\"retryScope\":\"failed-lane-only\",\"severity\":\"HIGH\",\"demonstratedHarm\":\"none\",\"parserGateRelationship\":\"shared-row-parser-separate-durable-provenance\",\"opaqueDiagnosticConclusion\":\"diagnostic-defect-not-rejection-proof\",\"protocolDeviation\":\"record-and-correct\",\"systemicDefectClaim\":false}"}
@@ -0,0 +1 @@
1
+ {"v":1,"text":"{\"v\":1,\"enforcingValidator\":\"durable-provenance-settlement\",\"nextAction\":\"single-lane-correct-input-reproduction\",\"exactContractSource\":\"controller-appended-explorer-contract\",\"reproduction\":{\"laneCount\":1,\"rowCount\":1,\"correct\":true},\"fallbackDecision\":\"remain-profile-a\",\"retryScope\":\"failed-lane-only\",\"severity\":\"MEDIUM\",\"demonstratedHarm\":\"workflow-blocked\",\"parserGateRelationship\":\"shared-row-parser-separate-durable-provenance\",\"opaqueDiagnosticConclusion\":\"diagnostic-defect-not-rejection-proof\",\"protocolDeviation\":\"record-and-correct\",\"systemicDefectClaim\":false}"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "7.136.5",
3
+ "version": "7.137.1",
4
4
  "description": "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -104,7 +104,8 @@
104
104
  "prepare": "bun run build",
105
105
  "repro:704": "node scripts/repro-704.mjs",
106
106
  "repro:1144": "bun scripts/repro-1144.mjs",
107
- "repro:1873": "bun build scripts/repro-1873-entry.ts --outdir dist-build-test/repro-1873 --target node --format esm && node scripts/repro-1873.mjs"
107
+ "repro:1873": "bun build scripts/repro-1873-entry.ts --outdir dist-build-test/repro-1873 --target node --format esm && node scripts/repro-1873.mjs",
108
+ "check:events": "bun run scripts/check-event-contract.ts"
108
109
  },
109
110
  "dependencies": {
110
111
  "@opencode-ai/plugin": "^1.18.3",
@@ -1,358 +0,0 @@
1
- // @bun
2
- // src/telemetry.ts
3
- import * as fs from "fs";
4
- import { createWriteStream } from "fs";
5
- import * as os from "os";
6
- import * as path from "path";
7
- var _writeStream = null;
8
- var _projectDirectory = null;
9
- var _listeners = [];
10
- var _disabled = false;
11
- var _heartbeatTrackingActive = false;
12
- var _heartbeatListener = null;
13
- var heartbeatTimestamps = new Map;
14
- function capHeartbeatMap() {
15
- while (heartbeatTimestamps.size >= 500) {
16
- const oldestKey = heartbeatTimestamps.keys().next().value;
17
- if (oldestKey === undefined)
18
- break;
19
- heartbeatTimestamps.delete(oldestKey);
20
- }
21
- }
22
- function startHeartbeatTracking() {
23
- if (_heartbeatTrackingActive)
24
- return;
25
- _heartbeatTrackingActive = true;
26
- const listener = (event, data) => {
27
- if (event !== "heartbeat")
28
- return;
29
- const payload = data;
30
- if (!payload?.sessionId)
31
- return;
32
- heartbeatTimestamps.set(payload.sessionId, Date.now());
33
- capHeartbeatMap();
34
- };
35
- _heartbeatListener = listener;
36
- addTelemetryListener(listener);
37
- }
38
- function getLastHeartbeat(sessionId) {
39
- return heartbeatTimestamps.get(sessionId);
40
- }
41
- function stopHeartbeatTracking() {
42
- _heartbeatTrackingActive = false;
43
- if (_heartbeatListener !== null) {
44
- const idx = _listeners.indexOf(_heartbeatListener);
45
- if (idx >= 0)
46
- _listeners.splice(idx, 1);
47
- _heartbeatListener = null;
48
- }
49
- }
50
- function resetHeartbeatTrackingForTesting() {
51
- _heartbeatTrackingActive = false;
52
- heartbeatTimestamps.clear();
53
- if (_heartbeatListener !== null) {
54
- const idx = _listeners.indexOf(_heartbeatListener);
55
- if (idx >= 0)
56
- _listeners.splice(idx, 1);
57
- _heartbeatListener = null;
58
- }
59
- }
60
- var _emitCount = 0;
61
- var ROTATION_CHECK_INTERVAL = 50;
62
- function resetTelemetryForTesting() {
63
- _disabled = false;
64
- _projectDirectory = null;
65
- _listeners.length = 0;
66
- _emitCount = 0;
67
- resetHeartbeatTrackingForTesting();
68
- if (_writeStream !== null) {
69
- _writeStream.end();
70
- _writeStream = null;
71
- }
72
- }
73
- function initTelemetry(projectDirectory) {
74
- if (_writeStream !== null || _disabled) {
75
- return;
76
- }
77
- try {
78
- _projectDirectory = projectDirectory;
79
- const swarmDir = path.join(projectDirectory, ".swarm");
80
- if (!fs.existsSync(swarmDir)) {
81
- fs.mkdirSync(swarmDir, { recursive: true });
82
- }
83
- const telemetryPath = path.join(swarmDir, "telemetry.jsonl");
84
- const stream = createWriteStream(telemetryPath, { flags: "a" });
85
- stream.on("error", () => {
86
- if (_writeStream === stream) {
87
- _disabled = true;
88
- _writeStream = null;
89
- }
90
- });
91
- _writeStream = stream;
92
- } catch {
93
- _disabled = true;
94
- _writeStream = null;
95
- }
96
- }
97
- function emit(event, data) {
98
- try {
99
- if (_disabled || _writeStream === null) {
100
- return;
101
- }
102
- const line = JSON.stringify({
103
- timestamp: new Date().toISOString(),
104
- event,
105
- ...data
106
- }) + os.EOL;
107
- const stream = _writeStream;
108
- stream.write(line, (err) => {
109
- if (err && _writeStream === stream) {
110
- _disabled = true;
111
- _writeStream = null;
112
- }
113
- });
114
- for (const listener of _listeners) {
115
- try {
116
- listener(event, data);
117
- } catch {}
118
- }
119
- _emitCount++;
120
- if (_emitCount >= ROTATION_CHECK_INTERVAL) {
121
- _emitCount = 0;
122
- _internals.rotateTelemetryIfNeeded();
123
- }
124
- } catch {}
125
- }
126
- function addTelemetryListener(callback) {
127
- _listeners.push(callback);
128
- }
129
- function rotateTelemetryIfNeeded(maxBytes = 10 * 1024 * 1024) {
130
- try {
131
- if (_projectDirectory === null) {
132
- return;
133
- }
134
- const telemetryPath = path.join(_projectDirectory, ".swarm", "telemetry.jsonl");
135
- if (!fs.existsSync(telemetryPath)) {
136
- return;
137
- }
138
- const stats = fs.statSync(telemetryPath);
139
- if (stats.size < maxBytes) {
140
- return;
141
- }
142
- const rotatedPath = path.join(_projectDirectory, ".swarm", "telemetry.jsonl.1");
143
- fs.renameSync(telemetryPath, rotatedPath);
144
- if (_writeStream !== null) {
145
- _writeStream.end();
146
- const stream = createWriteStream(telemetryPath, { flags: "a" });
147
- stream.on("error", () => {
148
- if (_writeStream === stream) {
149
- _disabled = true;
150
- _writeStream = null;
151
- }
152
- });
153
- _writeStream = stream;
154
- }
155
- } catch {}
156
- }
157
- var telemetry = {
158
- sessionStarted(sessionId, agentName) {
159
- _internals.emit("session_started", { sessionId, agentName });
160
- },
161
- sessionEnded(sessionId, reason) {
162
- _internals.emit("session_ended", { sessionId, reason });
163
- },
164
- agentActivated(sessionId, agentName, oldName) {
165
- _internals.emit("agent_activated", { sessionId, agentName, oldName });
166
- },
167
- delegationBegin(sessionId, agentName, taskId) {
168
- _internals.emit("delegation_begin", { sessionId, agentName, taskId });
169
- },
170
- delegationEnd(sessionId, agentName, taskId, result, costFields) {
171
- _internals.emit("delegation_end", {
172
- sessionId,
173
- agentName,
174
- taskId,
175
- result,
176
- tokens_input: costFields?.tokens_input ?? 0,
177
- tokens_output: costFields?.tokens_output ?? 0,
178
- tokens_reasoning: costFields?.tokens_reasoning ?? 0,
179
- tokens_cache: costFields?.tokens_cache ?? 0,
180
- cost_usd: costFields?.cost_usd ?? null,
181
- cost_source: costFields?.cost_source ?? "unavailable",
182
- model: costFields?.model,
183
- gate: costFields?.gate,
184
- retry_index: costFields?.retry_index
185
- });
186
- },
187
- taskStateChanged(sessionId, taskId, newState, oldState) {
188
- _internals.emit("task_state_changed", {
189
- sessionId,
190
- taskId,
191
- newState,
192
- oldState
193
- });
194
- },
195
- gatePassed(sessionId, gate, taskId) {
196
- _internals.emit("gate_passed", { sessionId, gate, taskId });
197
- },
198
- gateParseError(taskId, error) {
199
- _internals.emit("gate_parse_error", {
200
- taskId,
201
- errorName: error.name,
202
- errorMessage: error.message.slice(0, 200)
203
- });
204
- },
205
- gateFailed(sessionId, gate, taskId, reason) {
206
- _internals.emit("gate_failed", { sessionId, gate, taskId, reason });
207
- },
208
- reviewerGateDecision(sessionId, taskId, blocked, reasonCode, evidenceKind) {
209
- _internals.emit("reviewer_gate_decision", {
210
- sessionId,
211
- gate: "qa_gate",
212
- taskId,
213
- blocked,
214
- allowed: !blocked,
215
- reasonCode,
216
- evidenceKind
217
- });
218
- },
219
- phaseChanged(sessionId, oldPhase, newPhase) {
220
- _internals.emit("phase_changed", { sessionId, oldPhase, newPhase });
221
- },
222
- budgetUpdated(sessionId, budgetPct, agentName) {
223
- _internals.emit("budget_updated", { sessionId, budgetPct, agentName });
224
- },
225
- modelFallback(sessionId, agentName, fromModel, toModel, reason) {
226
- _internals.emit("model_fallback", {
227
- sessionId,
228
- agentName,
229
- fromModel,
230
- toModel,
231
- reason
232
- });
233
- },
234
- hardLimitHit(sessionId, agentName, limitType, value) {
235
- _internals.emit("hard_limit_hit", {
236
- sessionId,
237
- agentName,
238
- limitType,
239
- value
240
- });
241
- },
242
- revisionLimitHit(sessionId, agentName) {
243
- _internals.emit("revision_limit_hit", { sessionId, agentName });
244
- },
245
- loopDetected(sessionId, agentName, loopType) {
246
- _internals.emit("loop_detected", { sessionId, agentName, loopType });
247
- },
248
- noOpStrongWarning(sessionId, agentName, count, threshold) {
249
- _internals.emit("no_op_strong_warning", {
250
- sessionId,
251
- agentName,
252
- count,
253
- threshold
254
- });
255
- },
256
- gateDenialLoop(sessionId, tool, code, count) {
257
- _internals.emit("gate_denial_loop", { sessionId, tool, code, count });
258
- },
259
- executionStallWarning(sessionId, count, threshold) {
260
- _internals.emit("execution_stall_warning", {
261
- sessionId,
262
- count,
263
- threshold
264
- });
265
- },
266
- executionStallDenied(sessionId, tool, count, threshold) {
267
- _internals.emit("execution_stall_denied", {
268
- sessionId,
269
- tool,
270
- count,
271
- threshold
272
- });
273
- },
274
- swarmInternalsReadDenied(sessionId, tool, target) {
275
- _internals.emit("swarm_internals_read_denied", {
276
- sessionId,
277
- tool,
278
- target
279
- });
280
- },
281
- scopeViolation(sessionId, agentName, file, reason) {
282
- _internals.emit("scope_violation", { sessionId, agentName, file, reason });
283
- },
284
- qaSkipViolation(sessionId, agentName, skipCount) {
285
- _internals.emit("qa_skip_violation", { sessionId, agentName, skipCount });
286
- },
287
- heartbeat(sessionId) {
288
- _internals.emit("heartbeat", { sessionId });
289
- },
290
- turboModeChanged(sessionId, enabled, agentName) {
291
- _internals.emit("turbo_mode_changed", { sessionId, enabled, agentName });
292
- },
293
- autoOversightEscalation(sessionId, reason, interactionCount, deadlockCount, phase) {
294
- _internals.emit("auto_oversight_escalation", {
295
- sessionId,
296
- reason,
297
- interactionCount,
298
- deadlockCount,
299
- phase
300
- });
301
- },
302
- environmentDetected(sessionId, hostOS, shellFamily, executionMode) {
303
- _internals.emit("environment_detected", {
304
- sessionId,
305
- hostOS,
306
- shellFamily,
307
- executionMode
308
- });
309
- },
310
- prmPatternDetected(sessionId, pattern, severity, category, stepRange) {
311
- _internals.emit("prm_pattern_detected", {
312
- sessionId,
313
- pattern,
314
- severity,
315
- category,
316
- stepRange
317
- });
318
- },
319
- prmCourseCorrectionInjected(sessionId, pattern, level) {
320
- _internals.emit("prm_course_correction_injected", {
321
- sessionId,
322
- pattern,
323
- level
324
- });
325
- },
326
- prmEscalationTriggered(sessionId, pattern, level, occurrenceCount) {
327
- _internals.emit("prm_escalation_triggered", {
328
- sessionId,
329
- pattern,
330
- level,
331
- occurrenceCount
332
- });
333
- },
334
- prmHardStop(sessionId, pattern, level, occurrenceCount) {
335
- _internals.emit("prm_hard_stop", {
336
- sessionId,
337
- pattern,
338
- level,
339
- occurrenceCount
340
- });
341
- },
342
- prmHardStopDelivered(sessionId, pattern, level, occurrenceCount) {
343
- _internals.emit("prm_hard_stop_delivered", {
344
- sessionId,
345
- pattern,
346
- level,
347
- occurrenceCount
348
- });
349
- }
350
- };
351
- var _internals = {
352
- telemetry,
353
- emit,
354
- rotateTelemetryIfNeeded,
355
- heartbeatListenerCount: () => _heartbeatListener !== null ? 1 : 0
356
- };
357
-
358
- export { startHeartbeatTracking, getLastHeartbeat, stopHeartbeatTracking, resetHeartbeatTrackingForTesting, ROTATION_CHECK_INTERVAL, resetTelemetryForTesting, initTelemetry, emit, addTelemetryListener, rotateTelemetryIfNeeded, telemetry, _internals };