opencode-swarm 6.27.0 → 7.0.0-beta.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 (281) hide show
  1. package/README.md +40 -1179
  2. package/dist/{agents/architect.d.ts → architect.d.ts} +1 -5
  3. package/dist/checkpoint.d.ts +7 -0
  4. package/dist/cli/index.js +11353 -20907
  5. package/dist/co-change-analyzer.d.ts +1 -0
  6. package/dist/compat.d.ts +12 -0
  7. package/dist/config-doctor.d.ts +1 -0
  8. package/dist/{config/loader.d.ts → config.d.ts} +6 -11
  9. package/dist/detector.d.ts +7 -0
  10. package/dist/diagnose-service.d.ts +1 -0
  11. package/dist/evidence-schema.d.ts +2 -0
  12. package/dist/evidence-service.d.ts +1 -0
  13. package/dist/export-service.d.ts +1 -0
  14. package/dist/handoff-service.d.ts +1 -0
  15. package/dist/history-service.d.ts +1 -0
  16. package/dist/hive-promoter.d.ts +2 -0
  17. package/dist/index.d.ts +1 -15
  18. package/dist/index.js +48739 -47886
  19. package/dist/knowledge-migrator.d.ts +2 -0
  20. package/dist/knowledge-store.d.ts +1 -0
  21. package/dist/knowledge-types.d.ts +1 -0
  22. package/dist/knowledge-validator.d.ts +2 -0
  23. package/dist/loader.d.ts +1 -0
  24. package/dist/manager.d.ts +1 -0
  25. package/dist/models.d.ts +1 -0
  26. package/dist/plan-service.d.ts +1 -0
  27. package/dist/preflight-service.d.ts +1 -0
  28. package/dist/profiles.d.ts +7 -0
  29. package/dist/register.d.ts +36 -0
  30. package/dist/schema.d.ts +2 -0
  31. package/dist/snapshot-writer.d.ts +1 -0
  32. package/dist/state.d.ts +1 -292
  33. package/dist/status-service.d.ts +15 -0
  34. package/dist/telemetry/src/events.d.ts +308 -0
  35. package/dist/telemetry/src/guards.d.ts +14 -0
  36. package/dist/telemetry/src/index.d.ts +4 -0
  37. package/dist/telemetry/src/version.d.ts +1 -0
  38. package/dist/utils.d.ts +1 -0
  39. package/dist/write-retro.d.ts +1 -0
  40. package/package.json +12 -13
  41. package/LICENSE +0 -21
  42. package/dist/__tests__/security-adversarial.test.d.ts +0 -1
  43. package/dist/agents/architect-permission.adversarial.test.d.ts +0 -5
  44. package/dist/agents/architect.turbo-banner.test.d.ts +0 -1
  45. package/dist/agents/coder.d.ts +0 -2
  46. package/dist/agents/critic.d.ts +0 -3
  47. package/dist/agents/designer.d.ts +0 -2
  48. package/dist/agents/docs.d.ts +0 -2
  49. package/dist/agents/explorer.d.ts +0 -3
  50. package/dist/agents/index.d.ts +0 -27
  51. package/dist/agents/reviewer.d.ts +0 -5
  52. package/dist/agents/sme.d.ts +0 -2
  53. package/dist/agents/test-engineer.adversarial.test.d.ts +0 -5
  54. package/dist/agents/test-engineer.d.ts +0 -2
  55. package/dist/agents/test-engineer.security.test.d.ts +0 -1
  56. package/dist/background/circuit-breaker.d.ts +0 -149
  57. package/dist/background/event-bus.d.ts +0 -60
  58. package/dist/background/evidence-summary-integration.d.ts +0 -73
  59. package/dist/background/index.d.ts +0 -22
  60. package/dist/background/manager.d.ts +0 -122
  61. package/dist/background/plan-sync-worker.d.ts +0 -122
  62. package/dist/background/queue.d.ts +0 -117
  63. package/dist/background/status-artifact.d.ts +0 -115
  64. package/dist/background/trigger.d.ts +0 -179
  65. package/dist/background/trigger.vulnerability.test.d.ts +0 -1
  66. package/dist/background/worker.d.ts +0 -92
  67. package/dist/cli/index.d.ts +0 -6
  68. package/dist/commands/checkpoint.d.ts +0 -5
  69. package/dist/commands/command-adapters.security.test.d.ts +0 -14
  70. package/dist/commands/commands.test.d.ts +0 -1
  71. package/dist/commands/config.d.ts +0 -5
  72. package/dist/commands/curate.test.d.ts +0 -1
  73. package/dist/commands/index.d.ts +0 -39
  74. package/dist/commands/turbo-registration.test.d.ts +0 -5
  75. package/dist/commands/turbo-sessionid.test.d.ts +0 -5
  76. package/dist/commands/turbo.regression.test.d.ts +0 -11
  77. package/dist/commands/turbo.test.d.ts +0 -5
  78. package/dist/config/constants.architect-whitelist.test.d.ts +0 -1
  79. package/dist/config/constants.d.ts +0 -37
  80. package/dist/config/evidence-schema.d.ts +0 -1152
  81. package/dist/config/index.d.ts +0 -9
  82. package/dist/config/plan-schema.d.ts +0 -151
  83. package/dist/config/schema.d.ts +0 -700
  84. package/dist/context/role-filter.d.ts +0 -27
  85. package/dist/context/zone-classifier.d.ts +0 -17
  86. package/dist/diff/ast-diff.d.ts +0 -20
  87. package/dist/evidence/index.d.ts +0 -2
  88. package/dist/evidence/manager.d.ts +0 -74
  89. package/dist/gate-evidence.d.ts +0 -70
  90. package/dist/gate-evidence.test.d.ts +0 -1
  91. package/dist/git/branch.d.ts +0 -50
  92. package/dist/git/index.d.ts +0 -22
  93. package/dist/git/pr.d.ts +0 -28
  94. package/dist/hooks/adversarial-detector.d.ts +0 -34
  95. package/dist/hooks/agent-activity.d.ts +0 -38
  96. package/dist/hooks/co-change-suggester.d.ts +0 -51
  97. package/dist/hooks/compaction-customizer.d.ts +0 -11
  98. package/dist/hooks/context-budget.d.ts +0 -34
  99. package/dist/hooks/context-scoring.d.ts +0 -70
  100. package/dist/hooks/curator-drift.d.ts +0 -30
  101. package/dist/hooks/curator-types.d.ts +0 -99
  102. package/dist/hooks/curator.d.ts +0 -70
  103. package/dist/hooks/dark-matter-detector.d.ts +0 -38
  104. package/dist/hooks/delegation-gate.d.ts +0 -53
  105. package/dist/hooks/delegation-gate.evidence.test.d.ts +0 -4
  106. package/dist/hooks/delegation-gate.plan-fallback-security.test.d.ts +0 -13
  107. package/dist/hooks/delegation-gate.plan-fallback.test.d.ts +0 -5
  108. package/dist/hooks/delegation-gate.seed-state.test.d.ts +0 -1
  109. package/dist/hooks/delegation-gate.turbo-evidence.test.d.ts +0 -8
  110. package/dist/hooks/delegation-sanitizer.d.ts +0 -24
  111. package/dist/hooks/delegation-tracker.d.ts +0 -14
  112. package/dist/hooks/extractors.d.ts +0 -53
  113. package/dist/hooks/guardrails.d.ts +0 -73
  114. package/dist/hooks/hive-promoter.d.ts +0 -40
  115. package/dist/hooks/index.d.ts +0 -16
  116. package/dist/hooks/knowledge-curator.d.ts +0 -22
  117. package/dist/hooks/knowledge-injector.d.ts +0 -20
  118. package/dist/hooks/knowledge-migrator.d.ts +0 -10
  119. package/dist/hooks/knowledge-reader.d.ts +0 -22
  120. package/dist/hooks/knowledge-store.d.ts +0 -20
  121. package/dist/hooks/knowledge-types.d.ts +0 -117
  122. package/dist/hooks/knowledge-validator.d.ts +0 -28
  123. package/dist/hooks/message-priority.d.ts +0 -105
  124. package/dist/hooks/messages-transform.d.ts +0 -13
  125. package/dist/hooks/model-limits.d.ts +0 -96
  126. package/dist/hooks/phase-monitor.d.ts +0 -22
  127. package/dist/hooks/pipeline-tracker.d.ts +0 -41
  128. package/dist/hooks/steering-consumed.d.ts +0 -30
  129. package/dist/hooks/system-enhancer.d.ts +0 -30
  130. package/dist/hooks/tool-summarizer.d.ts +0 -28
  131. package/dist/hooks/utils.d.ts +0 -20
  132. package/dist/index.adversarial-bootstrap.test.d.ts +0 -1
  133. package/dist/index.bootstrap-adversarial.test.d.ts +0 -1
  134. package/dist/index.bootstrap-directory.test.d.ts +0 -1
  135. package/dist/knowledge/identity.d.ts +0 -25
  136. package/dist/knowledge/index.d.ts +0 -2
  137. package/dist/lang/detector.d.ts +0 -20
  138. package/dist/lang/grammars/tree-sitter-dart.wasm +0 -0
  139. package/dist/lang/grammars/tree-sitter-kotlin.wasm +0 -0
  140. package/dist/lang/grammars/tree-sitter-swift.wasm +0 -0
  141. package/dist/lang/index.d.ts +0 -4
  142. package/dist/lang/profiles.d.ts +0 -71
  143. package/dist/lang/registry.d.ts +0 -24
  144. package/dist/lang/runtime.d.ts +0 -35
  145. package/dist/output/agent-writer.d.ts +0 -27
  146. package/dist/output/index.d.ts +0 -1
  147. package/dist/parallel/dependency-graph.d.ts +0 -34
  148. package/dist/parallel/file-locks.d.ts +0 -33
  149. package/dist/parallel/index.d.ts +0 -4
  150. package/dist/parallel/meta-indexer.d.ts +0 -32
  151. package/dist/parallel/review-router.d.ts +0 -29
  152. package/dist/plan/index.d.ts +0 -1
  153. package/dist/plan/manager.d.ts +0 -40
  154. package/dist/plan/manager.update-task-status.test.d.ts +0 -1
  155. package/dist/quality/index.d.ts +0 -1
  156. package/dist/quality/metrics.d.ts +0 -20
  157. package/dist/sast/rules/c.d.ts +0 -9
  158. package/dist/sast/rules/csharp.d.ts +0 -9
  159. package/dist/sast/rules/go.d.ts +0 -9
  160. package/dist/sast/rules/index.d.ts +0 -72
  161. package/dist/sast/rules/java.d.ts +0 -9
  162. package/dist/sast/rules/javascript.d.ts +0 -9
  163. package/dist/sast/rules/php.d.ts +0 -9
  164. package/dist/sast/rules/python.d.ts +0 -9
  165. package/dist/sast/semgrep.d.ts +0 -68
  166. package/dist/sast/semgrep.test.d.ts +0 -1
  167. package/dist/sbom/cyclonedx.d.ts +0 -101
  168. package/dist/sbom/detectors/dart.d.ts +0 -7
  169. package/dist/sbom/detectors/dotnet.d.ts +0 -7
  170. package/dist/sbom/detectors/go.d.ts +0 -7
  171. package/dist/sbom/detectors/index.d.ts +0 -53
  172. package/dist/sbom/detectors/java.d.ts +0 -7
  173. package/dist/sbom/detectors/nodejs.d.ts +0 -7
  174. package/dist/sbom/detectors/python.d.ts +0 -7
  175. package/dist/sbom/detectors/rust.d.ts +0 -7
  176. package/dist/sbom/detectors/swift.d.ts +0 -7
  177. package/dist/services/config-doctor.d.ts +0 -125
  178. package/dist/services/config-doctor.security.test.d.ts +0 -1
  179. package/dist/services/config-doctor.test.d.ts +0 -1
  180. package/dist/services/context-budget-service.d.ts +0 -101
  181. package/dist/services/decision-drift-analyzer.d.ts +0 -96
  182. package/dist/services/diagnose-service.d.ts +0 -31
  183. package/dist/services/evidence-service.d.ts +0 -65
  184. package/dist/services/evidence-summary-service.d.ts +0 -75
  185. package/dist/services/export-service.d.ts +0 -23
  186. package/dist/services/handoff-service.d.ts +0 -61
  187. package/dist/services/history-service.d.ts +0 -35
  188. package/dist/services/index.d.ts +0 -13
  189. package/dist/services/plan-service.d.ts +0 -25
  190. package/dist/services/preflight-integration.d.ts +0 -38
  191. package/dist/services/preflight-service.d.ts +0 -62
  192. package/dist/services/run-memory.d.ts +0 -66
  193. package/dist/services/status-service.d.ts +0 -29
  194. package/dist/services/status-service.turbo-indicator.test.d.ts +0 -5
  195. package/dist/session/snapshot-reader.d.ts +0 -37
  196. package/dist/session/snapshot-writer.d.ts +0 -89
  197. package/dist/skills/index.d.ts +0 -30
  198. package/dist/state.rehydrate.test.d.ts +0 -1
  199. package/dist/state.rehydration-adversarial.test.d.ts +0 -1
  200. package/dist/state.rehydration-integration.test.d.ts +0 -1
  201. package/dist/state.session-restart.test.d.ts +0 -7
  202. package/dist/summaries/index.d.ts +0 -2
  203. package/dist/summaries/manager.d.ts +0 -29
  204. package/dist/summaries/summarizer.d.ts +0 -38
  205. package/dist/tools/barrel-export-check-gate-status.test.d.ts +0 -6
  206. package/dist/tools/build-check.d.ts +0 -50
  207. package/dist/tools/check-gate-status.adversarial.test.d.ts +0 -1
  208. package/dist/tools/check-gate-status.d.ts +0 -7
  209. package/dist/tools/check-gate-status.gates.test.d.ts +0 -1
  210. package/dist/tools/check-gate-status.plugin-registration.test.d.ts +0 -1
  211. package/dist/tools/checkpoint.d.ts +0 -2
  212. package/dist/tools/co-change-analyzer.d.ts +0 -45
  213. package/dist/tools/complexity-hotspots.d.ts +0 -2
  214. package/dist/tools/declare-scope.d.ts +0 -49
  215. package/dist/tools/diff.d.ts +0 -18
  216. package/dist/tools/domain-detector.d.ts +0 -6
  217. package/dist/tools/evidence-check.d.ts +0 -8
  218. package/dist/tools/file-extractor.d.ts +0 -9
  219. package/dist/tools/gitingest.d.ts +0 -18
  220. package/dist/tools/imports.d.ts +0 -5
  221. package/dist/tools/index.d.ts +0 -31
  222. package/dist/tools/knowledge-query.d.ts +0 -5
  223. package/dist/tools/lint.d.ts +0 -50
  224. package/dist/tools/phase-complete.d.ts +0 -25
  225. package/dist/tools/pkg-audit.d.ts +0 -2
  226. package/dist/tools/placeholder-scan.d.ts +0 -26
  227. package/dist/tools/plugin-registration-adversarial.test.d.ts +0 -1
  228. package/dist/tools/pre-check-batch.d.ts +0 -56
  229. package/dist/tools/quality-budget.d.ts +0 -24
  230. package/dist/tools/retrieve-summary.d.ts +0 -2
  231. package/dist/tools/sast-scan.d.ts +0 -60
  232. package/dist/tools/save-plan.d.ts +0 -63
  233. package/dist/tools/sbom-generate.d.ts +0 -26
  234. package/dist/tools/schema-drift.d.ts +0 -2
  235. package/dist/tools/secretscan.d.ts +0 -35
  236. package/dist/tools/symbols.d.ts +0 -2
  237. package/dist/tools/syntax-check.d.ts +0 -35
  238. package/dist/tools/test-runner.d.ts +0 -49
  239. package/dist/tools/test-runner.security-adversarial.test.d.ts +0 -5
  240. package/dist/tools/todo-extract.d.ts +0 -2
  241. package/dist/tools/tool-names.d.ts +0 -10
  242. package/dist/tools/update-task-status.d.ts +0 -74
  243. package/dist/tools/update-task-status.gates.test.d.ts +0 -1
  244. package/dist/tools/update-task-status.turbo-bypass.test.d.ts +0 -1
  245. package/dist/tools/write-retro.d.ts +0 -53
  246. package/dist/types/delegation.d.ts +0 -24
  247. package/dist/types/events.d.ts +0 -55
  248. package/dist/utils/errors.d.ts +0 -33
  249. package/dist/utils/index.d.ts +0 -4
  250. package/dist/utils/logger.d.ts +0 -3
  251. package/dist/utils/merge.d.ts +0 -5
  252. package/dist/utils/regex.d.ts +0 -30
  253. package/dist/utils/tool-output.d.ts +0 -10
  254. /package/dist/{commands/agents.d.ts → agents.d.ts} +0 -0
  255. /package/dist/{commands/analyze.d.ts → analyze.d.ts} +0 -0
  256. /package/dist/{commands/archive.d.ts → archive.d.ts} +0 -0
  257. /package/dist/{commands/benchmark.d.ts → benchmark.d.ts} +0 -0
  258. /package/dist/{commands/clarify.d.ts → clarify.d.ts} +0 -0
  259. /package/dist/{tools/create-tool.d.ts → create-tool.d.ts} +0 -0
  260. /package/dist/{commands/curate.d.ts → curate.d.ts} +0 -0
  261. /package/dist/{commands/dark-matter.d.ts → dark-matter.d.ts} +0 -0
  262. /package/dist/{commands/diagnose.d.ts → diagnose.d.ts} +0 -0
  263. /package/dist/{build/discovery.d.ts → discovery.d.ts} +0 -0
  264. /package/dist/{commands/doctor.d.ts → doctor.d.ts} +0 -0
  265. /package/dist/{commands/evidence.d.ts → evidence.d.ts} +0 -0
  266. /package/dist/{commands/export.d.ts → export.d.ts} +0 -0
  267. /package/dist/{commands/handoff.d.ts → handoff.d.ts} +0 -0
  268. /package/dist/{commands/history.d.ts → history.d.ts} +0 -0
  269. /package/dist/{commands/knowledge.d.ts → knowledge.d.ts} +0 -0
  270. /package/dist/{commands/plan.d.ts → plan.d.ts} +0 -0
  271. /package/dist/{commands/preflight.d.ts → preflight.d.ts} +0 -0
  272. /package/dist/{commands/promote.d.ts → promote.d.ts} +0 -0
  273. /package/dist/{commands/reset.d.ts → reset.d.ts} +0 -0
  274. /package/dist/{commands/retrieve.d.ts → retrieve.d.ts} +0 -0
  275. /package/dist/{commands/rollback.d.ts → rollback.d.ts} +0 -0
  276. /package/dist/{commands/simulate.d.ts → simulate.d.ts} +0 -0
  277. /package/dist/{commands/specify.d.ts → specify.d.ts} +0 -0
  278. /package/dist/{commands/status.d.ts → status.d.ts} +0 -0
  279. /package/dist/{commands/sync-plan.d.ts → sync-plan.d.ts} +0 -0
  280. /package/dist/{commands/turbo.d.ts → turbo.d.ts} +0 -0
  281. /package/dist/{commands/write_retro.d.ts → write_retro.d.ts} +0 -0
@@ -1,99 +0,0 @@
1
- /**
2
- * Curator types — phase context consolidation and drift detection.
3
- * No runtime logic. Types only.
4
- */
5
- /** Curator summary — anchored iterative format. Persisted to .swarm/curator-summary.json */
6
- export interface CuratorSummary {
7
- schema_version: 1;
8
- session_id: string;
9
- last_updated: string;
10
- last_phase_covered: number;
11
- /** Running digest — extended each phase, never regenerated */
12
- digest: string;
13
- /** Phase-level digests for lookup */
14
- phase_digests: PhaseDigestEntry[];
15
- /** Accumulated compliance observations */
16
- compliance_observations: ComplianceObservation[];
17
- /** Knowledge update recommendations from the last curator run */
18
- knowledge_recommendations: KnowledgeRecommendation[];
19
- }
20
- export interface PhaseDigestEntry {
21
- phase: number;
22
- timestamp: string;
23
- summary: string;
24
- agents_used: string[];
25
- tasks_completed: number;
26
- tasks_total: number;
27
- key_decisions: string[];
28
- blockers_resolved: string[];
29
- }
30
- export interface ComplianceObservation {
31
- phase: number;
32
- timestamp: string;
33
- type: 'missing_reviewer' | 'missing_retro' | 'missing_sme' | 'skipped_test' | 'workflow_deviation';
34
- description: string;
35
- severity: 'info' | 'warning';
36
- }
37
- export interface KnowledgeRecommendation {
38
- action: 'promote' | 'archive' | 'flag_contradiction';
39
- entry_id?: string;
40
- lesson: string;
41
- reason: string;
42
- }
43
- /** Drift report — produced by critic after curator phase run */
44
- export interface DriftReport {
45
- schema_version: 1;
46
- phase: number;
47
- timestamp: string;
48
- /** Overall alignment verdict */
49
- alignment: 'ALIGNED' | 'MINOR_DRIFT' | 'MAJOR_DRIFT' | 'OFF_SPEC';
50
- /** Severity score 0.0-1.0 (0 = perfectly aligned, 1 = completely off-spec) */
51
- drift_score: number;
52
- /** First deviation point if drift detected */
53
- first_deviation: {
54
- phase: number;
55
- task: string;
56
- description: string;
57
- } | null;
58
- /** Compounding effects across phases */
59
- compounding_effects: string[];
60
- /** Recommended course corrections */
61
- corrections: string[];
62
- /** Spec requirements checked */
63
- requirements_checked: number;
64
- /** Spec requirements satisfied */
65
- requirements_satisfied: number;
66
- /** Scope additions not in original plan */
67
- scope_additions: string[];
68
- /** Truncated summary for architect context injection */
69
- injection_summary: string;
70
- }
71
- export interface CuratorConfig {
72
- enabled: boolean;
73
- init_enabled: boolean;
74
- phase_enabled: boolean;
75
- max_summary_tokens: number;
76
- min_knowledge_confidence: number;
77
- compliance_report: boolean;
78
- suppress_warnings: boolean;
79
- drift_inject_max_chars: number;
80
- }
81
- export interface CuratorInitResult {
82
- briefing: string;
83
- contradictions: string[];
84
- knowledge_entries_reviewed: number;
85
- prior_phases_covered: number;
86
- }
87
- export interface CuratorPhaseResult {
88
- phase: number;
89
- digest: PhaseDigestEntry;
90
- compliance: ComplianceObservation[];
91
- knowledge_recommendations: KnowledgeRecommendation[];
92
- summary_updated: boolean;
93
- }
94
- export interface CriticDriftResult {
95
- phase: number;
96
- report: DriftReport;
97
- report_path: string;
98
- injection_text: string;
99
- }
@@ -1,70 +0,0 @@
1
- /**
2
- * Curator core — file I/O for curator summary persistence.
3
- * Extended incrementally: filterPhaseEvents, checkPhaseCompliance,
4
- * runCuratorInit, runCuratorPhase, applyCuratorKnowledgeUpdates added in subsequent tasks.
5
- */
6
- import type { ComplianceObservation, CuratorConfig, CuratorInitResult, CuratorPhaseResult, CuratorSummary, KnowledgeRecommendation } from './curator-types.js';
7
- import type { KnowledgeConfig } from './knowledge-types.js';
8
- /**
9
- * Read curator summary from .swarm/curator-summary.json
10
- * @param directory - The workspace directory
11
- * @returns CuratorSummary if valid, null if missing or invalid
12
- */
13
- export declare function readCuratorSummary(directory: string): Promise<CuratorSummary | null>;
14
- /**
15
- * Write curator summary to .swarm/curator-summary.json
16
- * @param directory - The workspace directory
17
- * @param summary - The curator summary to write
18
- */
19
- export declare function writeCuratorSummary(directory: string, summary: CuratorSummary): Promise<void>;
20
- /**
21
- * Filter events from JSONL by phase or timestamp.
22
- * @param eventsJsonl - Raw JSONL string of events
23
- * @param phase - Phase number to filter by
24
- * @param sinceTimestamp - Optional ISO 8601 timestamp to filter events after
25
- * @returns Array of parsed event objects
26
- */
27
- export declare function filterPhaseEvents(eventsJsonl: string, phase: number, sinceTimestamp?: string): object[];
28
- /**
29
- * Check compliance for a phase based on events and dispatched agents.
30
- * @param phaseEvents - Array of events for the phase
31
- * @param agentsDispatched - List of agent names that were dispatched
32
- * @param requiredAgents - List of required agent names for this phase
33
- * @param phase - Phase number
34
- * @returns Array of compliance observations
35
- */
36
- export declare function checkPhaseCompliance(phaseEvents: object[], agentsDispatched: string[], requiredAgents: string[], phase: number): ComplianceObservation[];
37
- /**
38
- * Prepare curator init data: reads prior summary, knowledge entries, and context.md.
39
- * Returns a structured briefing result. Does NOT make LLM calls.
40
- * The caller (phase-monitor integration) is responsible for the actual agent delegation.
41
- * @param directory - The workspace directory
42
- * @param config - Curator configuration
43
- * @returns CuratorInitResult with briefing text, contradictions, and stats
44
- */
45
- export declare function runCuratorInit(directory: string, config: CuratorConfig): Promise<CuratorInitResult>;
46
- /**
47
- * Run curator phase analysis: reads events, runs compliance, updates and writes summary.
48
- * Does NOT make LLM calls. The caller is responsible for agent delegation.
49
- * @param directory - The workspace directory
50
- * @param phase - The phase number that just completed
51
- * @param agentsDispatched - List of agent names dispatched in this phase
52
- * @param config - Curator configuration
53
- * @param knowledgeConfig - Knowledge configuration (used for knowledge path resolution)
54
- * @returns CuratorPhaseResult with digest, compliance, and recommendations
55
- */
56
- export declare function runCuratorPhase(directory: string, phase: number, agentsDispatched: string[], _config: CuratorConfig, _knowledgeConfig: {
57
- directory?: string;
58
- }): Promise<CuratorPhaseResult>;
59
- /**
60
- * Apply curator knowledge recommendations: promote, archive, or flag contradictions.
61
- * Uses readKnowledge + rewriteKnowledge pattern for atomic updates.
62
- * @param directory - The workspace directory
63
- * @param recommendations - Array of knowledge recommendations to apply
64
- * @param knowledgeConfig - Knowledge configuration (for path resolution)
65
- * @returns Counts of applied and skipped recommendations
66
- */
67
- export declare function applyCuratorKnowledgeUpdates(directory: string, recommendations: KnowledgeRecommendation[], _knowledgeConfig: KnowledgeConfig): Promise<{
68
- applied: number;
69
- skipped: number;
70
- }>;
@@ -1,38 +0,0 @@
1
- /**
2
- * Dark Matter Detector Hook
3
- *
4
- * This hook reads `.swarm/dark-matter.md` — a markdown file that lists
5
- * unresolved coupling gaps. When unconsumed items exist in this file,
6
- * the hook logs a reminder hint to the user.
7
- */
8
- /**
9
- * Parses dark matter gaps from markdown content
10
- *
11
- * @param content - The markdown content to parse
12
- * @returns Object containing arrays of unresolved and resolved gap descriptions
13
- */
14
- export declare function parseDarkMatterGaps(content: string): {
15
- unresolved: string[];
16
- resolved: string[];
17
- };
18
- /**
19
- * Reads and parses the dark matter gaps file
20
- *
21
- * @param directory - The project directory containing .swarm folder
22
- * @returns Object with unresolved and resolved gaps, or null if file not found/empty
23
- */
24
- export declare function readDarkMatterMd(directory: string): Promise<{
25
- unresolved: string[];
26
- resolved: string[];
27
- } | null>;
28
- /**
29
- * Creates the dark matter detector hook
30
- *
31
- * This hook fires on `toolAfter` and checks for unresolved coupling gaps
32
- * in `.swarm/dark-matter.md`. It logs a reminder hint when gaps exist,
33
- * with rate-limiting to avoid excessive file I/O.
34
- *
35
- * @param directory - The project directory containing .swarm folder
36
- * @returns Hook function that checks for unresolved dark matter gaps
37
- */
38
- export declare function createDarkMatterDetectorHook(directory: string): (input: unknown, output: unknown) => Promise<void>;
@@ -1,53 +0,0 @@
1
- /**
2
- * Delegation Gate Hook
3
- *
4
- * Warns the architect when coder delegations are too large or batched.
5
- * Uses experimental.chat.messages.transform to provide non-blocking guidance.
6
- */
7
- import type { PluginConfig } from '../config';
8
- import type { DelegationEnvelope, EnvelopeValidationResult } from '../types/delegation.js';
9
- /**
10
- * Parses a string to extract a DelegationEnvelope.
11
- * Returns null if no valid envelope is found.
12
- * Never throws - all errors are caught and result in null.
13
- */
14
- export declare function parseDelegationEnvelope(content: string): DelegationEnvelope | null;
15
- interface ValidationContext {
16
- planTasks: string[];
17
- validAgents: string[];
18
- }
19
- /**
20
- * Validates a DelegationEnvelope against the current plan and agent list.
21
- * Returns { valid: true } on success, or { valid: false; reason: string } on failure.
22
- */
23
- export declare function validateDelegationEnvelope(envelope: unknown, context: ValidationContext): EnvelopeValidationResult;
24
- interface MessageInfo {
25
- role: string;
26
- agent?: string;
27
- sessionID?: string;
28
- }
29
- interface MessagePart {
30
- type: string;
31
- text?: string;
32
- [key: string]: unknown;
33
- }
34
- interface MessageWithParts {
35
- info: MessageInfo;
36
- parts: MessagePart[];
37
- }
38
- /**
39
- * Creates the experimental.chat.messages.transform hook for delegation gating.
40
- * Inspects coder delegations and warns when tasks are oversized or batched.
41
- */
42
- export declare function createDelegationGateHook(config: PluginConfig, directory: string): {
43
- messagesTransform: (input: Record<string, never>, output: {
44
- messages?: MessageWithParts[];
45
- }) => Promise<void>;
46
- toolAfter: (input: {
47
- tool: string;
48
- sessionID: string;
49
- callID: string;
50
- args?: Record<string, unknown>;
51
- }, output: unknown) => Promise<void>;
52
- };
53
- export {};
@@ -1,4 +0,0 @@
1
- /**
2
- * Integration tests for evidence recording in delegation-gate.ts toolAfter.
3
- */
4
- export {};
@@ -1,13 +0,0 @@
1
- /**
2
- * Adversarial security tests for getEvidenceTaskId plan.json fallback.
3
- *
4
- * Tests security-hardened fallback mechanism that reads .swarm/plan.json only after
5
- * exhausting live task state. Focuses on attack vectors:
6
- * - Path traversal via plan.json path
7
- * - Malformed durable state (JSON bombs, circular refs)
8
- * - Invalid directory inputs
9
- * - Oversized/hostile inputs
10
- * - Boundary violations
11
- * - Symlink attacks
12
- */
13
- export {};
@@ -1,5 +0,0 @@
1
- /**
2
- * Tests for getEvidenceTaskId plan.json fallback behavior.
3
- * Verifies durable task ID recovery from .swarm/plan.json when in-memory state is empty.
4
- */
5
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
1
- /**
2
- * Tests for Task 3.16: Propagate turboMode through evidence recording
3
- *
4
- * This verifies that when a session has turboMode enabled, the turbo flag is
5
- * recorded in the evidence JSON files for all agent delegations (reviewer,
6
- * test_engineer, docs, designer, critic, explorer, sme, coder).
7
- */
8
- export {};
@@ -1,24 +0,0 @@
1
- /**
2
- * Delegation message sanitization - Layer 2 defense against inter-agent manipulation.
3
- * Strips attempt metadata, urgency references, and consequence claims from gate agent messages.
4
- */
5
- declare const SANITIZATION_PATTERNS: RegExp[];
6
- /**
7
- * Sanitize a message by stripping manipulation patterns.
8
- * Returns sanitized text and logs if any stripping occurred.
9
- */
10
- export declare function sanitizeMessage(text: string, patterns?: RegExp[]): {
11
- sanitized: string;
12
- modified: boolean;
13
- stripped: string[];
14
- };
15
- /**
16
- * Check if message is to a gate agent (reviewer, test_engineer, critic).
17
- */
18
- export declare function isGateAgentMessage(agentName: string): boolean;
19
- /**
20
- * Create a hook that sanitizes delegation messages to gate agents.
21
- * @param directory - The project directory containing the .swarm folder
22
- */
23
- export declare function createDelegationSanitizerHook(directory: string): (input: unknown, output: unknown) => Promise<void>;
24
- export { SANITIZATION_PATTERNS };
@@ -1,14 +0,0 @@
1
- /**
2
- * Delegation Tracker Hook
3
- *
4
- * Tracks agent delegation by monitoring chat.message events with agent fields.
5
- * Updates the active agent map and optionally logs delegation chain entries.
6
- */
7
- import type { PluginConfig } from '../config/schema';
8
- /**
9
- * Creates the chat.message hook for delegation tracking.
10
- */
11
- export declare function createDelegationTrackerHook(config: PluginConfig, guardrailsEnabled?: boolean): (input: {
12
- sessionID: string;
13
- agent?: string;
14
- }, output: Record<string, unknown>) => Promise<void>;
@@ -1,53 +0,0 @@
1
- import type { Plan } from '../config/plan-schema';
2
- /**
3
- * Swarm File Extractors
4
- *
5
- * Pure parsing functions for extracting structured data from .swarm/ files.
6
- * Used by system-enhancer and compaction-customizer hooks.
7
- */
8
- /**
9
- * Extracts the current phase information from plan content.
10
- */
11
- export declare function extractCurrentPhase(planContent: string): string | null;
12
- /**
13
- * Extracts the first incomplete task from the current IN PROGRESS phase.
14
- */
15
- export declare function extractCurrentTask(planContent: string): string | null;
16
- /**
17
- * Extracts decisions section from context content.
18
- */
19
- export declare function extractDecisions(contextContent: string, maxChars?: number): string | null;
20
- /**
21
- * Extracts incomplete tasks from plan content under the current IN PROGRESS phase.
22
- */
23
- export declare function extractIncompleteTasks(planContent: string, maxChars?: number): string | null;
24
- /**
25
- * Extracts patterns section from context content.
26
- */
27
- export declare function extractPatterns(contextContent: string, maxChars?: number): string | null;
28
- /**
29
- * Extracts current phase info from a Plan object.
30
- */
31
- export declare function extractCurrentPhaseFromPlan(plan: Plan): string | null;
32
- /**
33
- * Extracts the first incomplete task from the current phase of a Plan object.
34
- */
35
- export declare function extractCurrentTaskFromPlan(plan: Plan): string | null;
36
- /**
37
- * Extracts incomplete tasks from the current phase of a Plan object.
38
- */
39
- export declare function extractIncompleteTasksFromPlan(plan: Plan, maxChars?: number): string | null;
40
- /**
41
- * Extracts plan cursor - a concise summary of current phase, current task,
42
- * and lookahead tasks for context-aware agent communication.
43
- *
44
- * @param planContent - The raw plan markdown content
45
- * @param options - Optional configuration
46
- * @param options.maxTokens - Target max tokens (default 1500, ~6000 chars)
47
- * @param options.lookaheadTasks - Number of lookahead tasks (default 2)
48
- * @returns A [SWARM PLAN CURSOR] block with phase summaries and task details
49
- */
50
- export declare function extractPlanCursor(planContent: string, options?: {
51
- maxTokens?: number;
52
- lookaheadTasks?: number;
53
- }): string;
@@ -1,73 +0,0 @@
1
- /**
2
- * Guardrails Hook Module
3
- *
4
- * Circuit breaker for runaway LLM agents. Monitors tool usage via OpenCode Plugin API hooks
5
- * and implements two-layer protection:
6
- * - Layer 1 (Soft Warning @ warning_threshold): Sets warning flag for messagesTransform to inject warning
7
- * - Layer 2 (Hard Block @ 100%): Throws error in toolBefore to block further calls, injects STOP message
8
- */
9
- import { type GuardrailsConfig } from '../config/schema';
10
- /**
11
- * Retrieves stored input args for a given callID.
12
- * Used by other hooks (e.g., delegation-gate) to access tool input args.
13
- * @param callID The callID to look up
14
- * @returns The stored args or undefined if not found
15
- */
16
- export declare function getStoredInputArgs(callID: string): unknown | undefined;
17
- /**
18
- * Stores input args for a given callID.
19
- * Used by guardrails toolBefore hook; may be used by other hooks if needed.
20
- * @param callID The callID to store args under
21
- * @param args The tool input args to store
22
- */
23
- export declare function setStoredInputArgs(callID: string, args: unknown): void;
24
- /**
25
- * Deletes stored input args for a given callID (cleanup after retrieval).
26
- * @param callID The callID to delete
27
- */
28
- export declare function deleteStoredInputArgs(callID: string): void;
29
- /**
30
- * Creates guardrails hooks for circuit breaker protection
31
- * @param directoryOrConfig Working directory (from plugin init context) OR legacy config object for backward compatibility
32
- * @param config Guardrails configuration (optional if first arg is config)
33
- * @returns Tool before/after hooks and messages transform hook
34
- */
35
- export declare function createGuardrailsHooks(directoryOrConfig?: string | GuardrailsConfig, config?: GuardrailsConfig): {
36
- toolBefore: (input: {
37
- tool: string;
38
- sessionID: string;
39
- callID: string;
40
- }, output: {
41
- args: unknown;
42
- }) => Promise<void>;
43
- toolAfter: (input: {
44
- tool: string;
45
- sessionID: string;
46
- callID: string;
47
- args?: Record<string, unknown>;
48
- }, output: {
49
- title: string;
50
- output: string;
51
- metadata: unknown;
52
- }) => Promise<void>;
53
- messagesTransform: (input: Record<string, never>, output: {
54
- messages?: Array<{
55
- info: {
56
- role: string;
57
- agent?: string;
58
- sessionID?: string;
59
- };
60
- parts: Array<{
61
- type: string;
62
- text?: string;
63
- [key: string]: unknown;
64
- }>;
65
- }>;
66
- }) => Promise<void>;
67
- };
68
- /**
69
- * Hashes tool arguments for repetition detection
70
- * @param args Tool arguments to hash
71
- * @returns Numeric hash (0 if hashing fails)
72
- */
73
- export declare function hashArgs(args: unknown): number;
@@ -1,40 +0,0 @@
1
- /** Hive promoter hook for opencode-swarm v6.17 two-tier knowledge system. */
2
- import type { KnowledgeConfig, SwarmKnowledgeEntry } from './knowledge-types.js';
3
- /** Hive promotion summary for curator state */
4
- export interface HivePromotionSummary {
5
- timestamp: string;
6
- new_promotions: number;
7
- encounters_incremented: number;
8
- advancements: number;
9
- total_hive_entries: number;
10
- }
11
- /**
12
- * Main promotion logic: checks swarm entries and promotes eligible ones to hive.
13
- * Also updates existing hive entries with new project confirmations.
14
- * Returns a summary of the promotion activity for curator state.
15
- *
16
- * @note The 'hive-fast-track' tag is treated as privileged — it bypasses the
17
- * 3-phase confirmation requirement. It should only be set by authorized tooling
18
- * (inferTags() never produces it automatically).
19
- */
20
- export declare function checkHivePromotions(swarmEntries: SwarmKnowledgeEntry[], config: KnowledgeConfig): Promise<HivePromotionSummary>;
21
- /**
22
- * Create a hook that promotes swarm entries to the hive.
23
- * The hook fires unconditionally - the caller decides when to invoke it.
24
- */
25
- export declare function createHivePromoterHook(directory: string, config: KnowledgeConfig): (input: unknown, output: unknown) => Promise<void>;
26
- /**
27
- * Promote a lesson directly to the hive (manual promotion).
28
- * @param directory - Project directory
29
- * @param lesson - The lesson text to promote
30
- * @param category - Optional category (defaults to 'process')
31
- * @returns Confirmation message
32
- */
33
- export declare function promoteToHive(directory: string, lesson: string, category?: string): Promise<string>;
34
- /**
35
- * Promote a lesson from swarm knowledge to hive.
36
- * @param directory - Project directory
37
- * @param lessonId - The ID of the lesson to promote from swarm
38
- * @returns Confirmation message
39
- */
40
- export declare function promoteFromSwarm(directory: string, lessonId: string): Promise<string>;
@@ -1,16 +0,0 @@
1
- export { createAgentActivityHooks } from './agent-activity';
2
- export { createCompactionCustomizerHook } from './compaction-customizer';
3
- export { createContextBudgetHandler } from './context-budget';
4
- export { createDelegationGateHook } from './delegation-gate';
5
- export { createDelegationSanitizerHook } from './delegation-sanitizer';
6
- export { createDelegationTrackerHook } from './delegation-tracker';
7
- export { extractCurrentPhase, extractCurrentPhaseFromPlan, extractCurrentTask, extractCurrentTaskFromPlan, extractDecisions, extractIncompleteTasks, extractIncompleteTasksFromPlan, extractPatterns, } from './extractors';
8
- export { createGuardrailsHooks } from './guardrails';
9
- export { classifyMessage, classifyMessages, containsPlanContent, isDuplicateToolRead, isStaleError, isToolResult, MessagePriority, type MessagePriorityType, type MessageWithParts, } from './message-priority';
10
- export { consolidateSystemMessages } from './messages-transform';
11
- export { extractModelInfo, NATIVE_MODEL_LIMITS, PROVIDER_CAPS, resolveModelLimit, } from './model-limits';
12
- export { createPhaseMonitorHook } from './phase-monitor';
13
- export { createPipelineTrackerHook } from './pipeline-tracker';
14
- export { createSystemEnhancerHook } from './system-enhancer';
15
- export { createToolSummarizerHook, resetSummaryIdCounter, } from './tool-summarizer';
16
- export { composeHandlers, estimateTokens, readSwarmFileAsync, safeHook, validateSwarmPath, } from './utils';
@@ -1,22 +0,0 @@
1
- /** Knowledge curator hook for opencode-swarm v6.17 two-tier knowledge system. */
2
- import type { KnowledgeConfig } from './knowledge-types.js';
3
- /**
4
- * Check if the input is a write operation targeting an evidence file.
5
- * Exported for testing purposes only.
6
- */
7
- export declare function isWriteToEvidenceFile(input: unknown): boolean;
8
- /**
9
- * Curate and store swarm knowledge entries from lessons.
10
- */
11
- export declare function curateAndStoreSwarm(lessons: string[], projectName: string, phaseInfo: {
12
- phase_number: number;
13
- }, directory: string, config: KnowledgeConfig): Promise<void>;
14
- /**
15
- * Auto-promote swarm entries based on phase confirmations and age.
16
- */
17
- export declare function runAutoPromotion(directory: string, config: KnowledgeConfig): Promise<void>;
18
- /**
19
- * Create the knowledge curator hook.
20
- * Watches for writes to .swarm/plan.md and extracts lessons from the retrospective section.
21
- */
22
- export declare function createKnowledgeCuratorHook(directory: string, config: KnowledgeConfig): (input: unknown, output: unknown) => Promise<void>;
@@ -1,20 +0,0 @@
1
- /** Phase-Start Knowledge Injection Hook for opencode-swarm v6.17.
2
- *
3
- * Injects relevant knowledge (from both swarm + hive tiers) into the architect's
4
- * context at phase start. Caches the injection text for re-injection after
5
- * compaction. Skips for non-architect agents. Appends rejected-pattern warnings
6
- * to prevent re-learning loops.
7
- */
8
- import type { KnowledgeConfig, MessageWithParts } from './knowledge-types.js';
9
- /**
10
- * Creates a knowledge injection hook that injects relevant knowledge into the
11
- * architect's message context at phase start. Supports caching for re-injection
12
- * after compaction.
13
- *
14
- * @param directory - The project directory containing .swarm/
15
- * @param config - Knowledge system configuration
16
- * @returns A hook function that injects knowledge into messages
17
- */
18
- export declare function createKnowledgeInjectorHook(directory: string, config: KnowledgeConfig): (input: Record<string, never>, output: {
19
- messages?: MessageWithParts[];
20
- }) => Promise<void>;
@@ -1,10 +0,0 @@
1
- /** One-time migration from .swarm/context.md → .swarm/knowledge.jsonl for existing projects. */
2
- import type { KnowledgeConfig } from './knowledge-types.js';
3
- export interface MigrationResult {
4
- migrated: boolean;
5
- entriesMigrated: number;
6
- entriesDropped: number;
7
- entriesTotal: number;
8
- skippedReason?: 'sentinel-exists' | 'no-context-file' | 'empty-context';
9
- }
10
- export declare function migrateContextToKnowledge(directory: string, config: KnowledgeConfig): Promise<MigrationResult>;
@@ -1,22 +0,0 @@
1
- /** Read path for the opencode-swarm v6.17 two-tier knowledge system.
2
- * Merges swarm + hive knowledge, deduplicates (hive wins), ranks by composite score,
3
- * and provides utility tracking.
4
- */
5
- import type { KnowledgeConfig, KnowledgeEntryBase } from './knowledge-types.js';
6
- export interface ProjectContext {
7
- projectName: string;
8
- currentPhase: string;
9
- techStack?: string[];
10
- recentErrors?: string[];
11
- }
12
- export interface RankedEntry extends KnowledgeEntryBase {
13
- tier: 'swarm' | 'hive';
14
- relevanceScore: {
15
- category: number;
16
- confidence: number;
17
- keywords: number;
18
- };
19
- finalScore: number;
20
- }
21
- export declare function readMergedKnowledge(directory: string, config: KnowledgeConfig, context?: ProjectContext): Promise<RankedEntry[]>;
22
- export declare function updateRetrievalOutcome(directory: string, phaseInfo: string, phaseSucceeded: boolean): Promise<void>;
@@ -1,20 +0,0 @@
1
- /** Core storage layer for the opencode-swarm v6.17 two-tier knowledge system. */
2
- import type { RejectedLesson } from './knowledge-types.js';
3
- export declare function getPlatformConfigDir(): string;
4
- export declare function resolveSwarmKnowledgePath(directory: string): string;
5
- export declare function resolveSwarmRejectedPath(directory: string): string;
6
- export declare function resolveHiveKnowledgePath(): string;
7
- export declare function resolveHiveRejectedPath(): string;
8
- export declare function readKnowledge<T>(filePath: string): Promise<T[]>;
9
- export declare function readRejectedLessons(directory: string): Promise<RejectedLesson[]>;
10
- export declare function appendKnowledge<T>(filePath: string, entry: T): Promise<void>;
11
- export declare function rewriteKnowledge<T>(filePath: string, entries: T[]): Promise<void>;
12
- export declare function appendRejectedLesson(directory: string, lesson: RejectedLesson): Promise<void>;
13
- export declare function normalize(text: string): string;
14
- export declare function wordBigrams(text: string): Set<string>;
15
- export declare function jaccardBigram(a: Set<string>, b: Set<string>): number;
16
- export declare function findNearDuplicate<T extends {
17
- lesson: string;
18
- }>(candidate: string, entries: T[], threshold?: number): T | undefined;
19
- export declare function computeConfidence(confirmedByCount: number, autoGenerated: boolean): number;
20
- export declare function inferTags(lesson: string): string[];