opencode-swarm 6.27.1 → 8.0.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (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 +49007 -48213
  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,117 +0,0 @@
1
- /** Type definitions for the opencode-swarm v6.17 two-tier knowledge system. */
2
- export type KnowledgeCategory = 'process' | 'architecture' | 'tooling' | 'security' | 'testing' | 'debugging' | 'performance' | 'integration' | 'other';
3
- export interface PhaseConfirmationRecord {
4
- phase_number: number;
5
- confirmed_at: string;
6
- project_name: string;
7
- }
8
- export interface ProjectConfirmationRecord {
9
- project_name: string;
10
- confirmed_at: string;
11
- phase_number?: number;
12
- }
13
- export interface RetrievalOutcome {
14
- applied_count: number;
15
- succeeded_after_count: number;
16
- failed_after_count: number;
17
- last_applied_at?: string;
18
- }
19
- export interface KnowledgeEntryBase {
20
- id: string;
21
- tier: 'swarm' | 'hive';
22
- lesson: string;
23
- category: KnowledgeCategory;
24
- tags: string[];
25
- scope: string;
26
- confidence: number;
27
- status: 'candidate' | 'established' | 'promoted';
28
- confirmed_by: PhaseConfirmationRecord[] | ProjectConfirmationRecord[];
29
- retrieval_outcomes: RetrievalOutcome;
30
- schema_version: number;
31
- created_at: string;
32
- updated_at: string;
33
- hive_eligible?: boolean;
34
- auto_generated?: boolean;
35
- }
36
- export interface SwarmKnowledgeEntry extends KnowledgeEntryBase {
37
- tier: 'swarm';
38
- confirmed_by: PhaseConfirmationRecord[];
39
- project_name: string;
40
- }
41
- export interface HiveKnowledgeEntry extends KnowledgeEntryBase {
42
- tier: 'hive';
43
- confirmed_by: ProjectConfirmationRecord[];
44
- source_project: string;
45
- /** Weighted encounter score for hive advancement. Starts at 1.0 for originating project. */
46
- encounter_score: number;
47
- /** @deprecated Legacy field for backward compatibility. Use encounter_score for weighting. */
48
- encounter_count?: number;
49
- }
50
- export interface RejectedLesson {
51
- id: string;
52
- lesson: string;
53
- rejection_reason: string;
54
- rejected_at: string;
55
- rejection_layer: 1 | 2 | 3;
56
- }
57
- export interface KnowledgeConfig {
58
- /** Enable or disable the entire knowledge system. Default: true */
59
- enabled: boolean;
60
- /** Maximum entries to keep in swarm knowledge.jsonl. Default: 100 */
61
- swarm_max_entries: number;
62
- /** Maximum entries to keep in hive shared-learnings.jsonl. Default: 200 */
63
- hive_max_entries: number;
64
- /** Days before auto-promotion to hive tier. Default: 90 */
65
- auto_promote_days: number;
66
- /** Maximum knowledge entries to inject per architect message. Default: 5 */
67
- max_inject_count: number;
68
- /** Jaccard bigram similarity threshold for deduplication. Default: 0.6 */
69
- dedup_threshold: number;
70
- /** Scope filters to apply when reading knowledge. Default: ['global'] */
71
- scope_filter: string[];
72
- /** Enable hive (cross-project) tier reads and writes. Default: true */
73
- hive_enabled: boolean;
74
- /** Maximum rejected lesson fingerprints to retain. Default: 20 */
75
- rejected_max_entries: number;
76
- /** Enable validation gate before storing lessons. Default: true */
77
- validation_enabled: boolean;
78
- /** Confidence threshold for marking an entry evergreen. Default: 0.9 */
79
- evergreen_confidence: number;
80
- /** Utility score threshold for marking an entry evergreen. Default: 0.8 */
81
- evergreen_utility: number;
82
- /** Utility score at or below which an entry is considered low-utility. Default: 0.3 */
83
- low_utility_threshold: number;
84
- /** Minimum retrieval count before utility scoring begins. Default: 3 */
85
- min_retrievals_for_utility: number;
86
- /** JSONL schema version. Default: 1 */
87
- schema_version: number;
88
- /** Weighted scoring: multiplier for encounters from the source project. Default: 1.0 */
89
- same_project_weight: number;
90
- /** Weighted scoring: multiplier for encounters from other projects. Default: 0.5 */
91
- cross_project_weight: number;
92
- /** Weighted scoring: minimum encounter score floor. Default: 0.1 */
93
- min_encounter_score: number;
94
- /** Weighted scoring: initial score for newly promoted hive entries. Default: 1.0 */
95
- initial_encounter_score: number;
96
- /** Weighted scoring: score increment per encounter. Default: 0.1 */
97
- encounter_increment: number;
98
- /** Weighted scoring: maximum encounter score cap. Default: 10.0 */
99
- max_encounter_score: number;
100
- }
101
- export interface MessageInfo {
102
- role: string;
103
- agent?: string;
104
- sessionID?: string;
105
- modelID?: string;
106
- providerID?: string;
107
- [key: string]: unknown;
108
- }
109
- export interface MessagePart {
110
- type: string;
111
- text?: string;
112
- [key: string]: unknown;
113
- }
114
- export interface MessageWithParts {
115
- info: MessageInfo;
116
- parts: MessagePart[];
117
- }
@@ -1,28 +0,0 @@
1
- /** Three-layer validation gate for the opencode-swarm v6.17 knowledge system. */
2
- import type { KnowledgeCategory, KnowledgeEntryBase } from './knowledge-types.js';
3
- export interface ValidationResult {
4
- valid: boolean;
5
- layer: 1 | 2 | 3 | null;
6
- reason: string | null;
7
- severity: 'error' | 'warning' | null;
8
- }
9
- export declare const DANGEROUS_COMMAND_PATTERNS: RegExp[];
10
- export declare const SECURITY_DEGRADING_PATTERNS: RegExp[];
11
- export declare const INJECTION_PATTERNS: RegExp[];
12
- export declare function validateLesson(candidate: string, existingLessons: string[], meta: {
13
- category: KnowledgeCategory;
14
- scope: string;
15
- confidence: number;
16
- }): ValidationResult;
17
- export interface QuarantinedEntry extends KnowledgeEntryBase {
18
- quarantine_reason: string;
19
- quarantined_at: string;
20
- reported_by: 'architect' | 'user' | 'auto';
21
- }
22
- export interface EntryHealthResult {
23
- healthy: boolean;
24
- concern?: string;
25
- }
26
- export declare function auditEntryHealth(entry: KnowledgeEntryBase): EntryHealthResult;
27
- export declare function quarantineEntry(directory: string, entryId: string, reason: string, reportedBy: 'architect' | 'user' | 'auto'): Promise<void>;
28
- export declare function restoreEntry(directory: string, entryId: string): Promise<void>;
@@ -1,105 +0,0 @@
1
- /**
2
- * Message Priority Classifier Hook
3
- *
4
- * Provides zero-cost message priority classification to enable intelligent
5
- * context pruning. Messages are tagged with priority tiers (0-4) so that
6
- * low-priority messages are removed first during context budget pressure.
7
- *
8
- * Priority tiers:
9
- * - CRITICAL (0): System prompt, plan state, active instructions
10
- * - HIGH (1): User messages, current task context, tool definitions
11
- * - MEDIUM (2): Recent assistant responses, recent tool results
12
- * - LOW (3): Old assistant responses, old tool results, confirmations
13
- * - DISPOSABLE (4): Duplicate reads, superseded writes, stale errors
14
- */
15
- /**
16
- * Message priority tiers for context pruning decisions.
17
- * Lower values = higher priority (kept longer during pruning).
18
- */
19
- export declare const MessagePriority: {
20
- /** System prompt, plan state, active instructions - never prune */
21
- readonly CRITICAL: 0;
22
- /** User messages, current task context, tool definitions */
23
- readonly HIGH: 1;
24
- /** Recent assistant responses, recent tool results (within recentWindowSize) */
25
- readonly MEDIUM: 2;
26
- /** Old assistant responses, old tool results */
27
- readonly LOW: 3;
28
- /** Duplicate reads, superseded writes, stale errors - prune first */
29
- readonly DISPOSABLE: 4;
30
- };
31
- export type MessagePriorityType = (typeof MessagePriority)[keyof typeof MessagePriority];
32
- /** Message structure matching the format from context-budget.ts */
33
- interface MessageInfo {
34
- role?: string;
35
- agent?: string;
36
- sessionID?: string;
37
- modelID?: string;
38
- providerID?: string;
39
- toolName?: string;
40
- toolArgs?: unknown;
41
- [key: string]: unknown;
42
- }
43
- interface MessagePart {
44
- type?: string;
45
- text?: string;
46
- [key: string]: unknown;
47
- }
48
- export interface MessageWithParts {
49
- info?: MessageInfo;
50
- parts?: MessagePart[];
51
- }
52
- /**
53
- * Checks if text contains .swarm/plan or .swarm/context references
54
- * indicating swarm state that should be preserved.
55
- *
56
- * @param text - The text content to check
57
- * @returns true if the text contains plan/context references
58
- */
59
- export declare function containsPlanContent(text: string): boolean;
60
- /**
61
- * Checks if a message is a tool result (assistant message with tool call).
62
- *
63
- * @param message - The message to check
64
- * @returns true if the message appears to be a tool result
65
- */
66
- export declare function isToolResult(message: MessageWithParts): boolean;
67
- /**
68
- * Checks if two consecutive tool read calls are duplicates
69
- * (same tool with same first argument).
70
- *
71
- * @param current - The current message
72
- * @param previous - The previous message
73
- * @returns true if this is a duplicate tool read
74
- */
75
- export declare function isDuplicateToolRead(current: MessageWithParts, previous: MessageWithParts): boolean;
76
- /**
77
- * Checks if a message contains an error pattern and is stale
78
- * (more than the specified number of turns old).
79
- *
80
- * @param text - The message text to check
81
- * @param turnsAgo - How many turns ago the message was sent
82
- * @returns true if the message is a stale error
83
- */
84
- export declare function isStaleError(text: string, turnsAgo: number): boolean;
85
- /**
86
- * Classifies a message by priority tier for intelligent pruning.
87
- *
88
- * @param message - The message to classify
89
- * @param index - Position in messages array (0-indexed)
90
- * @param totalMessages - Total number of messages
91
- * @param recentWindowSize - Number of recent messages to consider MEDIUM (default 10)
92
- * @returns Priority tier (0=CRITICAL, 1=HIGH, 2=MEDIUM, 3=LOW, 4=DISPOSABLE)
93
- */
94
- export declare function classifyMessage(message: MessageWithParts, index: number, totalMessages: number, recentWindowSize?: number): MessagePriorityType;
95
- /**
96
- * Classifies a batch of messages with duplicate detection.
97
- * This function should be called in order (oldest to newest) to properly
98
- * detect consecutive duplicate tool reads.
99
- *
100
- * @param messages - Array of messages to classify
101
- * @param recentWindowSize - Number of recent messages to consider MEDIUM (default 10)
102
- * @returns Array of priority classifications matching message order
103
- */
104
- export declare function classifyMessages(messages: MessageWithParts[], recentWindowSize?: number): MessagePriorityType[];
105
- export {};
@@ -1,13 +0,0 @@
1
- /**
2
- * Consolidates multiple system messages into a single system message at index 0.
3
- *
4
- * Note: Merged content order matches original insertion order (OpenCode base prompt
5
- * first, then swarm agent prompt) - this assumes sequential message construction.
6
- */
7
- type Message = {
8
- role: string;
9
- content: unknown;
10
- [key: string]: unknown;
11
- };
12
- export declare function consolidateSystemMessages(messages: Message[]): Message[];
13
- export {};
@@ -1,96 +0,0 @@
1
- /**
2
- * Provider-Aware Model Limit Resolution
3
- *
4
- * Resolves context window limits based on the model and provider platform.
5
- * The same model has different context limits depending on the provider:
6
- * - Claude Sonnet 4.6: 200k native, 128k on Copilot
7
- * - GPT-5: 400k native, 128k on Copilot
8
- * - Copilot caps ALL models at 128k prompt, regardless of native limit
9
- */
10
- /**
11
- * Native model context limits (in tokens) when used on their native platform.
12
- */
13
- export declare const NATIVE_MODEL_LIMITS: Record<string, number>;
14
- /**
15
- * Provider-specific context caps that override native limits.
16
- * These are typically lower than native limits (e.g., Copilot caps at 128k).
17
- */
18
- export declare const PROVIDER_CAPS: Record<string, number>;
19
- /**
20
- * Message structure from experimental.chat.messages.transform hook.
21
- */
22
- interface MessageInfo {
23
- role: string;
24
- agent?: string;
25
- sessionID?: string;
26
- modelID?: string;
27
- providerID?: string;
28
- [key: string]: unknown;
29
- }
30
- interface MessagePart {
31
- type: string;
32
- text?: string;
33
- [key: string]: unknown;
34
- }
35
- interface MessageWithParts {
36
- info: MessageInfo;
37
- parts: MessagePart[];
38
- }
39
- /**
40
- * Extracts modelID and providerID from the most recent assistant message.
41
- *
42
- * @param messages - Array of messages from experimental.chat.messages.transform hook
43
- * @returns Object containing modelID and/or providerID if found
44
- *
45
- * @example
46
- * const info = extractModelInfo(messages);
47
- * // Returns: { modelID: 'claude-sonnet-4-6', providerID: 'anthropic' }
48
- * // Or: {} if no assistant messages or fields not found
49
- */
50
- export declare function extractModelInfo(messages: MessageWithParts[]): {
51
- modelID?: string;
52
- providerID?: string;
53
- };
54
- /**
55
- * Resolves the context limit for a given model/provider combination.
56
- *
57
- * Resolution order (first match wins):
58
- * 1. Check configOverrides["provider/model"] (e.g., "copilot/claude-sonnet-4-6": 200000)
59
- * 2. Check configOverrides[modelID] (e.g., "claude-sonnet-4-6": 200000)
60
- * 3. Check PROVIDER_CAPS[providerID] (e.g., copilot → 128000)
61
- * 4. Check NATIVE_MODEL_LIMITS with prefix matching (e.g., "claude-sonnet-4" matches "claude-sonnet-4-6-20260301")
62
- * 5. Check configOverrides.default
63
- * 6. Fall back to 128000
64
- *
65
- * @param modelID - The model identifier (e.g., "claude-sonnet-4-6", "gpt-5")
66
- * @param providerID - The provider identifier (e.g., "copilot", "anthropic")
67
- * @param configOverrides - User configuration overrides
68
- * @returns The resolved context limit in tokens
69
- *
70
- * @example
71
- * // Provider cap (copilot)
72
- * resolveModelLimit("claude-sonnet-4-6", "copilot", {})
73
- * // Returns: 128000
74
- *
75
- * @example
76
- * // Native limit (anthropic)
77
- * resolveModelLimit("claude-sonnet-4-6", "anthropic", {})
78
- * // Returns: 200000
79
- *
80
- * @example
81
- * // Override beats cap
82
- * resolveModelLimit("gpt-5", "copilot", { "copilot/gpt-5": 200000 })
83
- * // Returns: 200000
84
- *
85
- * @example
86
- * // Prefix match for model variants
87
- * resolveModelLimit("claude-sonnet-4-6-20260301", "anthropic", {})
88
- * // Returns: 200000
89
- *
90
- * @example
91
- * // Full fallback
92
- * resolveModelLimit(undefined, undefined, {})
93
- * // Returns: 128000
94
- */
95
- export declare function resolveModelLimit(modelID?: string, providerID?: string, configOverrides?: Record<string, number>): number;
96
- export {};
@@ -1,22 +0,0 @@
1
- /**
2
- * Phase Monitor Hook
3
- *
4
- * Detects phase transitions by reading plan state on each system prompt transform.
5
- * When a phase change is detected, triggers preflight via PreflightTriggerManager.
6
- * Wrapped in safeHook — errors must never propagate.
7
- */
8
- import type { PreflightTriggerManager } from '../background/trigger';
9
- import type { CuratorConfig, CuratorInitResult } from './curator-types';
10
- /** Injectable curator runner type — allows test injection without module mocking. */
11
- export type CuratorInitRunner = (directory: string, config: CuratorConfig) => Promise<CuratorInitResult>;
12
- /**
13
- * Creates a hook that monitors plan phase transitions and triggers preflight.
14
- *
15
- * @param directory - Project directory (where .swarm/ lives)
16
- * @param preflightManager - Optional PreflightTriggerManager to call on phase change.
17
- * When undefined, preflight checks are skipped but curator initialization still runs
18
- * at session start (useful when knowledge.enabled but phase_preflight is disabled).
19
- * @param curatorRunner - Optional curator init runner (defaults to runCuratorInit; injectable for tests)
20
- * @returns A safeHook-wrapped system.transform handler
21
- */
22
- export declare function createPhaseMonitorHook(directory: string, preflightManager?: PreflightTriggerManager, curatorRunner?: CuratorInitRunner): (input: unknown, output: unknown) => Promise<void>;
@@ -1,41 +0,0 @@
1
- /**
2
- * Pipeline Tracker Hook
3
- *
4
- * Injects phase reminders into messages to keep the Architect on track.
5
- * Uses experimental.chat.messages.transform so it doesn't show in UI.
6
- *
7
- * Research: "LLMs Get Lost In Multi-Turn Conversation" shows ~40% compliance
8
- * drop after 2-3 turns without reminders.
9
- */
10
- import type { PluginConfig } from '../config';
11
- /**
12
- * Build dynamic phase reminder with compliance escalation based on phase number.
13
- * Counteracts temporal compliance decay discovered during field testing.
14
- */
15
- export declare function buildPhaseReminder(phaseNumber: number | null): string;
16
- interface MessageInfo {
17
- role: string;
18
- agent?: string;
19
- sessionID?: string;
20
- }
21
- interface MessagePart {
22
- type: string;
23
- text?: string;
24
- [key: string]: unknown;
25
- }
26
- interface MessageWithParts {
27
- info: MessageInfo;
28
- parts: MessagePart[];
29
- }
30
- /**
31
- * Creates the experimental.chat.messages.transform hook for pipeline tracking.
32
- * Only injects for the architect agent.
33
- */
34
- export declare function createPipelineTrackerHook(config: PluginConfig, directory?: string): {
35
- 'experimental.chat.messages.transform'?: undefined;
36
- } | {
37
- 'experimental.chat.messages.transform': (input: Record<string, never>, output: {
38
- messages?: MessageWithParts[];
39
- }) => Promise<void>;
40
- };
41
- export {};
@@ -1,30 +0,0 @@
1
- /**
2
- * Steering consumed hook for OpenCode Swarm
3
- *
4
- * Provides mechanisms for recording and tracking steering directive consumption.
5
- * Writes steering-consumed events to .swarm/events.jsonl for health check verification.
6
- */
7
- /**
8
- * Event written to .swarm/events.jsonl when a steering directive is consumed
9
- */
10
- export interface SteeringConsumedEvent {
11
- type: 'steering-consumed';
12
- directiveId: string;
13
- timestamp: string;
14
- }
15
- /**
16
- * Records a steering-consumed event to the events.jsonl file.
17
- * Synchronous function that appends a single JSON line.
18
- *
19
- * @param directory - The project directory containing the .swarm folder
20
- * @param directiveId - The ID of the steering directive that was consumed
21
- */
22
- export declare function recordSteeringConsumed(directory: string, directiveId: string): void;
23
- /**
24
- * Creates a hook that records steering-consumed events for any unconsumed directives.
25
- * Reads events.jsonl to find steering-directive events without matching consumed events.
26
- *
27
- * @param directory - The project directory containing the .swarm folder
28
- * @returns A fire-and-forget hook function
29
- */
30
- export declare function createSteeringConsumedHook(directory: string): (input: unknown, output: unknown) => Promise<void>;
@@ -1,30 +0,0 @@
1
- /**
2
- * System Enhancer Hook
3
- *
4
- * Enhances the system prompt with current phase information from the plan
5
- * and cross-agent context from the activity log.
6
- * Reads plan.md and injects phase context into the system prompt.
7
- */
8
- import type { PluginConfig } from '../config';
9
- /**
10
- * Build a retrospective injection string for the architect system message.
11
- * Tier 1: direct phase-scoped lookup for same-plan previous phase.
12
- * Tier 2: cross-project historical lessons (Phase 1 only).
13
- * Returns null if no valid retrospective found.
14
- */
15
- export declare function buildRetroInjection(directory: string, currentPhaseNumber: number, currentPlanTitle?: string): Promise<string | null>;
16
- /**
17
- * Creates the experimental.chat.system.transform hook for system enhancement.
18
- */
19
- export declare function createSystemEnhancerHook(config: PluginConfig, directory: string): Record<string, unknown>;
20
- /**
21
- * Architect operational mode derived from plan state.
22
- */
23
- export type ArchitectMode = 'DISCOVER' | 'PLAN' | 'EXECUTE' | 'PHASE-WRAP' | 'UNKNOWN';
24
- /**
25
- * Detect the current architect operational mode based on plan state.
26
- *
27
- * @param directory - The project directory to check
28
- * @returns The current architect mode based on plan state
29
- */
30
- export declare function detectArchitectMode(directory: string): Promise<ArchitectMode>;
@@ -1,28 +0,0 @@
1
- /**
2
- * Tool Output Summarizer Hook
3
- *
4
- * Intercepts oversized tool outputs in tool.execute.after,
5
- * stores the full content to .swarm/summaries/, and replaces
6
- * the output with a compact summary containing a retrieval ID.
7
- */
8
- import type { SummaryConfig } from '../config/schema';
9
- /**
10
- * Reset the summary ID counter. Used for testing.
11
- */
12
- export declare function resetSummaryIdCounter(): void;
13
- /**
14
- * Creates a tool.execute.after hook that summarizes oversized tool outputs.
15
- *
16
- * @param config - Summary configuration including enabled, thresholds, and limits
17
- * @param directory - Base directory for storing full outputs
18
- * @returns Async hook function for tool.execute.after
19
- */
20
- export declare function createToolSummarizerHook(config: SummaryConfig, directory: string): (input: {
21
- tool: string;
22
- sessionID: string;
23
- callID: string;
24
- }, output: {
25
- title: string;
26
- output: string;
27
- metadata: unknown;
28
- }) => Promise<void>;
@@ -1,20 +0,0 @@
1
- /**
2
- * Shared hook utilities for OpenCode Swarm
3
- *
4
- * This module provides common utilities for working with hooks,
5
- * including error handling, handler composition, file I/O, and
6
- * token estimation for swarm-related operations.
7
- */
8
- export declare function safeHook<I, O>(fn: (input: I, output: O) => Promise<void>): (input: I, output: O) => Promise<void>;
9
- export declare function composeHandlers<I, O>(...fns: Array<(input: I, output: O) => Promise<void>>): (input: I, output: O) => Promise<void>;
10
- /**
11
- * Validates that a filename is safe to use within the .swarm directory
12
- *
13
- * @param directory - The base directory containing the .swarm folder
14
- * @param filename - The filename to validate
15
- * @returns The resolved absolute path if validation passes
16
- * @throws Error if the filename is invalid or attempts path traversal
17
- */
18
- export declare function validateSwarmPath(directory: string, filename: string): string;
19
- export declare function readSwarmFileAsync(directory: string, filename: string): Promise<string | null>;
20
- export declare function estimateTokens(text: string): number;
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,25 +0,0 @@
1
- /** Project Identity Management for opencode-swarm.
2
- * Handles creation and retrieval of project identity files.
3
- */
4
- export interface ProjectIdentity {
5
- projectHash: string;
6
- projectName: string;
7
- repoUrl?: string;
8
- absolutePath: string;
9
- createdAt: string;
10
- swarmVersion: string;
11
- }
12
- /**
13
- * Get identity file path for a project hash.
14
- * Path: {platform-config-dir}/projects/{projectHash}/identity.json
15
- */
16
- export declare function resolveIdentityPath(projectHash: string): string;
17
- /**
18
- * Read existing identity.json or return null if it doesn't exist.
19
- */
20
- export declare function readProjectIdentity(projectHash: string): Promise<ProjectIdentity | null>;
21
- /**
22
- * Create or update identity.json for a project.
23
- * Uses atomic write pattern (write to temp file, then rename).
24
- */
25
- export declare function writeProjectIdentity(directory: string, projectHash: string, projectName: string): Promise<ProjectIdentity>;
@@ -1,2 +0,0 @@
1
- /** Knowledge system exports for opencode-swarm. */
2
- export * from './identity.js';
@@ -1,20 +0,0 @@
1
- /**
2
- * Language Detection Utilities
3
- *
4
- * Provides detectProjectLanguages() for scanning a project directory
5
- * and getProfileForFile() for resolving a language profile from a file path.
6
- * No tool logic — pure detection only.
7
- */
8
- import { type LanguageProfile } from './profiles.js';
9
- /**
10
- * Resolve a language profile from a file path based on its extension.
11
- * Returns undefined for files with no extension or unknown extensions.
12
- */
13
- export declare function getProfileForFile(filePath: string): LanguageProfile | undefined;
14
- /**
15
- * Scan a project directory (and immediate subdirectories) to detect active languages.
16
- * Detection is based on presence of build indicator files or source files with known extensions.
17
- * Returns unique profiles in priority order (Tier 1 first, then Tier 2, then Tier 3).
18
- * Skips unreadable directories silently.
19
- */
20
- export declare function detectProjectLanguages(projectDir: string): Promise<LanguageProfile[]>;
@@ -1,4 +0,0 @@
1
- export * from './detector';
2
- export * from './profiles';
3
- export * from './registry';
4
- export * from './runtime';