opencode-swarm 6.6.1 → 6.8.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 (133) hide show
  1. package/README.md +121 -6
  2. package/dist/index.js +26976 -22154
  3. package/dist/src/agents/architect.d.ts +8 -0
  4. package/dist/{agents/test-engineer.d.ts → src/agents/coder.d.ts} +2 -1
  5. package/dist/src/agents/critic.d.ts +3 -0
  6. package/dist/src/agents/designer.d.ts +3 -0
  7. package/dist/src/agents/docs.d.ts +3 -0
  8. package/dist/src/agents/explorer.d.ts +3 -0
  9. package/dist/src/agents/model.d.ts +2 -0
  10. package/dist/{agents → src/agents}/reviewer.d.ts +2 -1
  11. package/dist/src/agents/sme.d.ts +3 -0
  12. package/dist/src/agents/test-engineer.d.ts +3 -0
  13. package/dist/src/agents/test-engineer.security.test.d.ts +1 -0
  14. package/dist/src/background/circuit-breaker.d.ts +149 -0
  15. package/dist/src/background/event-bus.d.ts +60 -0
  16. package/dist/src/background/evidence-summary-integration.d.ts +73 -0
  17. package/dist/src/background/index.d.ts +22 -0
  18. package/dist/src/background/manager.d.ts +122 -0
  19. package/dist/src/background/plan-sync-worker.d.ts +117 -0
  20. package/dist/src/background/queue.d.ts +116 -0
  21. package/dist/src/background/status-artifact.d.ts +115 -0
  22. package/dist/src/background/trigger.d.ts +159 -0
  23. package/dist/src/background/trigger.vulnerability.test.d.ts +1 -0
  24. package/dist/src/background/worker.d.ts +92 -0
  25. package/dist/src/commands/command-adapters.security.test.d.ts +14 -0
  26. package/dist/src/commands/commands.test.d.ts +1 -0
  27. package/dist/src/commands/diagnose.d.ts +1 -0
  28. package/dist/src/commands/doctor.d.ts +5 -0
  29. package/dist/src/commands/evidence.d.ts +1 -0
  30. package/dist/src/commands/export.d.ts +1 -0
  31. package/dist/src/commands/history.d.ts +1 -0
  32. package/dist/{commands → src/commands}/index.d.ts +3 -0
  33. package/dist/src/commands/plan.d.ts +1 -0
  34. package/dist/src/commands/preflight.d.ts +1 -0
  35. package/dist/src/commands/status.d.ts +1 -0
  36. package/dist/src/commands/sync-plan.d.ts +8 -0
  37. package/dist/{config → src/config}/index.d.ts +2 -2
  38. package/dist/src/config/loader.d.ts +16 -0
  39. package/dist/{config → src/config}/schema.d.ts +224 -0
  40. package/dist/{hooks → src/hooks}/index.d.ts +1 -0
  41. package/dist/src/hooks/phase-monitor.d.ts +16 -0
  42. package/dist/src/index.d.ts +5 -0
  43. package/dist/{plan → src/plan}/manager.d.ts +13 -6
  44. package/dist/src/services/config-doctor.d.ts +125 -0
  45. package/dist/src/services/config-doctor.security.test.d.ts +1 -0
  46. package/dist/src/services/config-doctor.test.d.ts +1 -0
  47. package/dist/src/services/decision-drift-analyzer.d.ts +96 -0
  48. package/dist/src/services/diagnose-service.d.ts +31 -0
  49. package/dist/src/services/evidence-service.d.ts +65 -0
  50. package/dist/src/services/evidence-summary-service.d.ts +75 -0
  51. package/dist/src/services/export-service.d.ts +23 -0
  52. package/dist/src/services/history-service.d.ts +35 -0
  53. package/dist/src/services/index.d.ts +11 -0
  54. package/dist/src/services/plan-service.d.ts +25 -0
  55. package/dist/src/services/preflight-integration.d.ts +38 -0
  56. package/dist/src/services/preflight-service.d.ts +62 -0
  57. package/dist/src/services/status-service.d.ts +28 -0
  58. package/dist/{state.d.ts → src/state.d.ts} +5 -0
  59. package/dist/{tools → src/tools}/gitingest.d.ts +2 -1
  60. package/dist/{tools → src/tools}/secretscan.d.ts +4 -0
  61. package/dist/{tools/test-runner.d.ts → src/tools/test-runner/constants.d.ts} +0 -4
  62. package/dist/src/tools/test-runner/detect.d.ts +2 -0
  63. package/dist/src/tools/test-runner/discover.d.ts +4 -0
  64. package/dist/src/tools/test-runner/index.d.ts +6 -0
  65. package/dist/src/tools/test-runner/run.d.ts +2 -0
  66. package/dist/src/tools/test-runner/validate.d.ts +2 -0
  67. package/dist/src/utils/index.d.ts +8 -0
  68. package/package.json +1 -1
  69. package/dist/agents/architect.d.ts +0 -7
  70. package/dist/agents/coder.d.ts +0 -2
  71. package/dist/agents/critic.d.ts +0 -2
  72. package/dist/agents/designer.d.ts +0 -2
  73. package/dist/agents/docs.d.ts +0 -2
  74. package/dist/agents/explorer.d.ts +0 -2
  75. package/dist/agents/sme.d.ts +0 -2
  76. package/dist/commands/diagnose.d.ts +0 -5
  77. package/dist/commands/evidence.d.ts +0 -5
  78. package/dist/commands/export.d.ts +0 -5
  79. package/dist/commands/history.d.ts +0 -5
  80. package/dist/commands/plan.d.ts +0 -1
  81. package/dist/commands/status.d.ts +0 -2
  82. package/dist/config/loader.d.ts +0 -32
  83. package/dist/index.d.ts +0 -15
  84. package/dist/utils/index.d.ts +0 -3
  85. package/dist/{agents/test-engineer.security.test.d.ts → src/__tests__/security-adversarial.test.d.ts} +0 -0
  86. package/dist/{agents → src/agents}/index.d.ts +0 -0
  87. package/dist/{agents → src/agents}/test-engineer.adversarial.test.d.ts +0 -0
  88. package/dist/{cli → src/cli}/index.d.ts +0 -0
  89. package/dist/{commands → src/commands}/agents.d.ts +0 -0
  90. package/dist/{commands → src/commands}/archive.d.ts +0 -0
  91. package/dist/{commands → src/commands}/benchmark.d.ts +0 -0
  92. package/dist/{commands → src/commands}/config.d.ts +0 -0
  93. package/dist/{commands → src/commands}/reset.d.ts +0 -0
  94. package/dist/{commands → src/commands}/retrieve.d.ts +0 -0
  95. package/dist/{config → src/config}/constants.d.ts +0 -0
  96. package/dist/{config → src/config}/evidence-schema.d.ts +0 -0
  97. package/dist/{config → src/config}/plan-schema.d.ts +4 -4
  98. /package/dist/{evidence → src/evidence}/index.d.ts +0 -0
  99. /package/dist/{evidence → src/evidence}/manager.d.ts +0 -0
  100. /package/dist/{hooks → src/hooks}/agent-activity.d.ts +0 -0
  101. /package/dist/{hooks → src/hooks}/compaction-customizer.d.ts +0 -0
  102. /package/dist/{hooks → src/hooks}/context-budget.d.ts +0 -0
  103. /package/dist/{hooks → src/hooks}/context-scoring.d.ts +0 -0
  104. /package/dist/{hooks → src/hooks}/delegation-gate.d.ts +0 -0
  105. /package/dist/{hooks → src/hooks}/delegation-tracker.d.ts +0 -0
  106. /package/dist/{hooks → src/hooks}/extractors.d.ts +0 -0
  107. /package/dist/{hooks → src/hooks}/guardrails.d.ts +0 -0
  108. /package/dist/{hooks → src/hooks}/pipeline-tracker.d.ts +0 -0
  109. /package/dist/{hooks → src/hooks}/system-enhancer.d.ts +0 -0
  110. /package/dist/{hooks → src/hooks}/tool-summarizer.d.ts +0 -0
  111. /package/dist/{hooks → src/hooks}/utils.d.ts +0 -0
  112. /package/dist/{plan → src/plan}/index.d.ts +0 -0
  113. /package/dist/{summaries → src/summaries}/index.d.ts +0 -0
  114. /package/dist/{summaries → src/summaries}/manager.d.ts +0 -0
  115. /package/dist/{summaries → src/summaries}/summarizer.d.ts +0 -0
  116. /package/dist/{tools → src/tools}/checkpoint.d.ts +0 -0
  117. /package/dist/{tools → src/tools}/complexity-hotspots.d.ts +0 -0
  118. /package/dist/{tools → src/tools}/diff.d.ts +0 -0
  119. /package/dist/{tools → src/tools}/domain-detector.d.ts +0 -0
  120. /package/dist/{tools → src/tools}/evidence-check.d.ts +0 -0
  121. /package/dist/{tools → src/tools}/file-extractor.d.ts +0 -0
  122. /package/dist/{tools → src/tools}/imports.d.ts +0 -0
  123. /package/dist/{tools → src/tools}/index.d.ts +0 -0
  124. /package/dist/{tools → src/tools}/lint.d.ts +0 -0
  125. /package/dist/{tools → src/tools}/pkg-audit.d.ts +0 -0
  126. /package/dist/{tools → src/tools}/retrieve-summary.d.ts +0 -0
  127. /package/dist/{tools → src/tools}/schema-drift.d.ts +0 -0
  128. /package/dist/{tools → src/tools}/symbols.d.ts +0 -0
  129. /package/dist/{tools → src/tools}/test-runner.security-adversarial.test.d.ts +0 -0
  130. /package/dist/{tools → src/tools}/todo-extract.d.ts +0 -0
  131. /package/dist/{utils → src/utils}/errors.d.ts +0 -0
  132. /package/dist/{utils → src/utils}/logger.d.ts +0 -0
  133. /package/dist/{utils → src/utils}/merge.d.ts +0 -0
@@ -245,6 +245,205 @@ export declare const CheckpointConfigSchema: z.ZodObject<{
245
245
  auto_checkpoint_threshold: z.ZodDefault<z.ZodNumber>;
246
246
  }, z.core.$strip>;
247
247
  export type CheckpointConfig = z.infer<typeof CheckpointConfigSchema>;
248
+ export declare const GitingestConfigSchema: z.ZodObject<{
249
+ enabled: z.ZodDefault<z.ZodBoolean>;
250
+ endpoint: z.ZodDefault<z.ZodString>;
251
+ }, z.core.$strip>;
252
+ export type GitingestConfig = z.infer<typeof GitingestConfigSchema>;
253
+ export declare const AutomationModeSchema: z.ZodEnum<{
254
+ auto: "auto";
255
+ manual: "manual";
256
+ hybrid: "hybrid";
257
+ }>;
258
+ export type AutomationMode = z.infer<typeof AutomationModeSchema>;
259
+ export declare const AutomationCapabilitiesSchema: z.ZodObject<{
260
+ plan_sync: z.ZodDefault<z.ZodBoolean>;
261
+ phase_preflight: z.ZodDefault<z.ZodBoolean>;
262
+ config_doctor_on_startup: z.ZodDefault<z.ZodBoolean>;
263
+ config_doctor_autofix: z.ZodDefault<z.ZodBoolean>;
264
+ evidence_auto_summaries: z.ZodDefault<z.ZodBoolean>;
265
+ decision_drift_detection: z.ZodDefault<z.ZodBoolean>;
266
+ }, z.core.$strip>;
267
+ export type AutomationCapabilities = z.infer<typeof AutomationCapabilitiesSchema>;
268
+ declare const AutomationConfigSchemaBase: z.ZodObject<{
269
+ mode: z.ZodDefault<z.ZodEnum<{
270
+ auto: "auto";
271
+ manual: "manual";
272
+ hybrid: "hybrid";
273
+ }>>;
274
+ capabilities: z.ZodDefault<z.ZodObject<{
275
+ plan_sync: z.ZodDefault<z.ZodBoolean>;
276
+ phase_preflight: z.ZodDefault<z.ZodBoolean>;
277
+ config_doctor_on_startup: z.ZodDefault<z.ZodBoolean>;
278
+ config_doctor_autofix: z.ZodDefault<z.ZodBoolean>;
279
+ evidence_auto_summaries: z.ZodDefault<z.ZodBoolean>;
280
+ decision_drift_detection: z.ZodDefault<z.ZodBoolean>;
281
+ }, z.core.$strip>>;
282
+ }, z.core.$strip>;
283
+ export type AutomationConfig = z.infer<typeof AutomationConfigSchemaBase>;
284
+ export declare const AutomationConfigSchema: z.ZodType<AutomationConfig>;
285
+ export declare const pluginConfigShape: {
286
+ agents: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
287
+ model: z.ZodOptional<z.ZodString>;
288
+ temperature: z.ZodOptional<z.ZodNumber>;
289
+ disabled: z.ZodOptional<z.ZodBoolean>;
290
+ }, z.core.$strip>>>;
291
+ swarms: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
292
+ name: z.ZodOptional<z.ZodString>;
293
+ agents: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
294
+ model: z.ZodOptional<z.ZodString>;
295
+ temperature: z.ZodOptional<z.ZodNumber>;
296
+ disabled: z.ZodOptional<z.ZodBoolean>;
297
+ }, z.core.$strip>>>;
298
+ }, z.core.$strip>>>;
299
+ max_iterations: z.ZodDefault<z.ZodNumber>;
300
+ qa_retry_limit: z.ZodDefault<z.ZodNumber>;
301
+ inject_phase_reminders: z.ZodDefault<z.ZodBoolean>;
302
+ hooks: z.ZodOptional<z.ZodObject<{
303
+ system_enhancer: z.ZodDefault<z.ZodBoolean>;
304
+ compaction: z.ZodDefault<z.ZodBoolean>;
305
+ agent_activity: z.ZodDefault<z.ZodBoolean>;
306
+ delegation_tracker: z.ZodDefault<z.ZodBoolean>;
307
+ agent_awareness_max_chars: z.ZodDefault<z.ZodNumber>;
308
+ delegation_gate: z.ZodDefault<z.ZodBoolean>;
309
+ delegation_max_chars: z.ZodDefault<z.ZodNumber>;
310
+ }, z.core.$strip>>;
311
+ context_budget: z.ZodOptional<z.ZodObject<{
312
+ enabled: z.ZodDefault<z.ZodBoolean>;
313
+ warn_threshold: z.ZodDefault<z.ZodNumber>;
314
+ critical_threshold: z.ZodDefault<z.ZodNumber>;
315
+ model_limits: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodNumber>>;
316
+ max_injection_tokens: z.ZodDefault<z.ZodNumber>;
317
+ scoring: z.ZodOptional<z.ZodObject<{
318
+ enabled: z.ZodDefault<z.ZodBoolean>;
319
+ max_candidates: z.ZodDefault<z.ZodNumber>;
320
+ weights: z.ZodOptional<z.ZodObject<{
321
+ phase: z.ZodDefault<z.ZodNumber>;
322
+ current_task: z.ZodDefault<z.ZodNumber>;
323
+ blocked_task: z.ZodDefault<z.ZodNumber>;
324
+ recent_failure: z.ZodDefault<z.ZodNumber>;
325
+ recent_success: z.ZodDefault<z.ZodNumber>;
326
+ evidence_presence: z.ZodDefault<z.ZodNumber>;
327
+ decision_recency: z.ZodDefault<z.ZodNumber>;
328
+ dependency_proximity: z.ZodDefault<z.ZodNumber>;
329
+ }, z.core.$strip>>;
330
+ decision_decay: z.ZodOptional<z.ZodObject<{
331
+ mode: z.ZodDefault<z.ZodEnum<{
332
+ linear: "linear";
333
+ exponential: "exponential";
334
+ }>>;
335
+ half_life_hours: z.ZodDefault<z.ZodNumber>;
336
+ }, z.core.$strip>>;
337
+ token_ratios: z.ZodOptional<z.ZodObject<{
338
+ prose: z.ZodDefault<z.ZodNumber>;
339
+ code: z.ZodDefault<z.ZodNumber>;
340
+ markdown: z.ZodDefault<z.ZodNumber>;
341
+ json: z.ZodDefault<z.ZodNumber>;
342
+ }, z.core.$strip>>;
343
+ }, z.core.$strip>>;
344
+ }, z.core.$strip>>;
345
+ guardrails: z.ZodOptional<z.ZodObject<{
346
+ enabled: z.ZodDefault<z.ZodBoolean>;
347
+ max_tool_calls: z.ZodDefault<z.ZodNumber>;
348
+ max_duration_minutes: z.ZodDefault<z.ZodNumber>;
349
+ max_repetitions: z.ZodDefault<z.ZodNumber>;
350
+ max_consecutive_errors: z.ZodDefault<z.ZodNumber>;
351
+ warning_threshold: z.ZodDefault<z.ZodNumber>;
352
+ idle_timeout_minutes: z.ZodDefault<z.ZodNumber>;
353
+ profiles: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
354
+ max_tool_calls: z.ZodOptional<z.ZodNumber>;
355
+ max_duration_minutes: z.ZodOptional<z.ZodNumber>;
356
+ max_repetitions: z.ZodOptional<z.ZodNumber>;
357
+ max_consecutive_errors: z.ZodOptional<z.ZodNumber>;
358
+ warning_threshold: z.ZodOptional<z.ZodNumber>;
359
+ idle_timeout_minutes: z.ZodOptional<z.ZodNumber>;
360
+ }, z.core.$strip>>>;
361
+ }, z.core.$strip>>;
362
+ evidence: z.ZodOptional<z.ZodObject<{
363
+ enabled: z.ZodDefault<z.ZodBoolean>;
364
+ max_age_days: z.ZodDefault<z.ZodNumber>;
365
+ max_bundles: z.ZodDefault<z.ZodNumber>;
366
+ auto_archive: z.ZodDefault<z.ZodBoolean>;
367
+ }, z.core.$strip>>;
368
+ summaries: z.ZodOptional<z.ZodObject<{
369
+ enabled: z.ZodDefault<z.ZodBoolean>;
370
+ threshold_bytes: z.ZodDefault<z.ZodNumber>;
371
+ max_summary_chars: z.ZodDefault<z.ZodNumber>;
372
+ max_stored_bytes: z.ZodDefault<z.ZodNumber>;
373
+ retention_days: z.ZodDefault<z.ZodNumber>;
374
+ }, z.core.$strip>>;
375
+ review_passes: z.ZodOptional<z.ZodObject<{
376
+ always_security_review: z.ZodDefault<z.ZodBoolean>;
377
+ security_globs: z.ZodDefault<z.ZodArray<z.ZodString>>;
378
+ }, z.core.$strip>>;
379
+ integration_analysis: z.ZodOptional<z.ZodObject<{
380
+ enabled: z.ZodDefault<z.ZodBoolean>;
381
+ }, z.core.$strip>>;
382
+ docs: z.ZodOptional<z.ZodObject<{
383
+ enabled: z.ZodDefault<z.ZodBoolean>;
384
+ doc_patterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
385
+ }, z.core.$strip>>;
386
+ gitingest: z.ZodOptional<z.ZodObject<{
387
+ enabled: z.ZodDefault<z.ZodBoolean>;
388
+ endpoint: z.ZodDefault<z.ZodString>;
389
+ }, z.core.$strip>>;
390
+ ui_review: z.ZodOptional<z.ZodObject<{
391
+ enabled: z.ZodDefault<z.ZodBoolean>;
392
+ trigger_paths: z.ZodDefault<z.ZodArray<z.ZodString>>;
393
+ trigger_keywords: z.ZodDefault<z.ZodArray<z.ZodString>>;
394
+ }, z.core.$strip>>;
395
+ compaction_advisory: z.ZodOptional<z.ZodObject<{
396
+ enabled: z.ZodDefault<z.ZodBoolean>;
397
+ thresholds: z.ZodDefault<z.ZodArray<z.ZodNumber>>;
398
+ message: z.ZodDefault<z.ZodString>;
399
+ }, z.core.$strip>>;
400
+ lint: z.ZodOptional<z.ZodObject<{
401
+ enabled: z.ZodDefault<z.ZodBoolean>;
402
+ mode: z.ZodDefault<z.ZodEnum<{
403
+ check: "check";
404
+ fix: "fix";
405
+ }>>;
406
+ linter: z.ZodDefault<z.ZodEnum<{
407
+ biome: "biome";
408
+ eslint: "eslint";
409
+ auto: "auto";
410
+ }>>;
411
+ patterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
412
+ exclude: z.ZodDefault<z.ZodArray<z.ZodString>>;
413
+ }, z.core.$strip>>;
414
+ secretscan: z.ZodOptional<z.ZodObject<{
415
+ enabled: z.ZodDefault<z.ZodBoolean>;
416
+ patterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
417
+ exclude: z.ZodDefault<z.ZodArray<z.ZodString>>;
418
+ extensions: z.ZodDefault<z.ZodArray<z.ZodString>>;
419
+ }, z.core.$strip>>;
420
+ checkpoint: z.ZodOptional<z.ZodObject<{
421
+ enabled: z.ZodDefault<z.ZodBoolean>;
422
+ auto_checkpoint_threshold: z.ZodDefault<z.ZodNumber>;
423
+ }, z.core.$strip>>;
424
+ automation: z.ZodOptional<z.ZodType<{
425
+ mode: "auto" | "manual" | "hybrid";
426
+ capabilities: {
427
+ plan_sync: boolean;
428
+ phase_preflight: boolean;
429
+ config_doctor_on_startup: boolean;
430
+ config_doctor_autofix: boolean;
431
+ evidence_auto_summaries: boolean;
432
+ decision_drift_detection: boolean;
433
+ };
434
+ }, unknown, z.core.$ZodTypeInternals<{
435
+ mode: "auto" | "manual" | "hybrid";
436
+ capabilities: {
437
+ plan_sync: boolean;
438
+ phase_preflight: boolean;
439
+ config_doctor_on_startup: boolean;
440
+ config_doctor_autofix: boolean;
441
+ evidence_auto_summaries: boolean;
442
+ decision_drift_detection: boolean;
443
+ };
444
+ }, unknown>>>;
445
+ };
446
+ export declare const PLUGIN_CONFIG_ALLOWED_KEYS: Set<string>;
248
447
  export declare const PluginConfigSchema: z.ZodObject<{
249
448
  agents: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
250
449
  model: z.ZodOptional<z.ZodString>;
@@ -346,6 +545,10 @@ export declare const PluginConfigSchema: z.ZodObject<{
346
545
  enabled: z.ZodDefault<z.ZodBoolean>;
347
546
  doc_patterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
348
547
  }, z.core.$strip>>;
548
+ gitingest: z.ZodOptional<z.ZodObject<{
549
+ enabled: z.ZodDefault<z.ZodBoolean>;
550
+ endpoint: z.ZodDefault<z.ZodString>;
551
+ }, z.core.$strip>>;
349
552
  ui_review: z.ZodOptional<z.ZodObject<{
350
553
  enabled: z.ZodDefault<z.ZodBoolean>;
351
554
  trigger_paths: z.ZodDefault<z.ZodArray<z.ZodString>>;
@@ -380,6 +583,27 @@ export declare const PluginConfigSchema: z.ZodObject<{
380
583
  enabled: z.ZodDefault<z.ZodBoolean>;
381
584
  auto_checkpoint_threshold: z.ZodDefault<z.ZodNumber>;
382
585
  }, z.core.$strip>>;
586
+ automation: z.ZodOptional<z.ZodType<{
587
+ mode: "auto" | "manual" | "hybrid";
588
+ capabilities: {
589
+ plan_sync: boolean;
590
+ phase_preflight: boolean;
591
+ config_doctor_on_startup: boolean;
592
+ config_doctor_autofix: boolean;
593
+ evidence_auto_summaries: boolean;
594
+ decision_drift_detection: boolean;
595
+ };
596
+ }, unknown, z.core.$ZodTypeInternals<{
597
+ mode: "auto" | "manual" | "hybrid";
598
+ capabilities: {
599
+ plan_sync: boolean;
600
+ phase_preflight: boolean;
601
+ config_doctor_on_startup: boolean;
602
+ config_doctor_autofix: boolean;
603
+ evidence_auto_summaries: boolean;
604
+ decision_drift_detection: boolean;
605
+ };
606
+ }, unknown>>>;
383
607
  }, z.core.$strip>;
384
608
  export type PluginConfig = z.infer<typeof PluginConfigSchema>;
385
609
  export type { AgentName, PipelineAgentName, QAAgentName, } from './constants';
@@ -5,6 +5,7 @@ export { createDelegationGateHook } from './delegation-gate';
5
5
  export { createDelegationTrackerHook } from './delegation-tracker';
6
6
  export { extractCurrentPhase, extractCurrentPhaseFromPlan, extractCurrentTask, extractCurrentTaskFromPlan, extractDecisions, extractIncompleteTasks, extractIncompleteTasksFromPlan, extractPatterns, } from './extractors';
7
7
  export { createGuardrailsHooks } from './guardrails';
8
+ export { createPhaseMonitorHook } from './phase-monitor';
8
9
  export { createPipelineTrackerHook } from './pipeline-tracker';
9
10
  export { createSystemEnhancerHook } from './system-enhancer';
10
11
  export { createToolSummarizerHook, resetSummaryIdCounter, } from './tool-summarizer';
@@ -0,0 +1,16 @@
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
+ /**
10
+ * Creates a hook that monitors plan phase transitions and triggers preflight.
11
+ *
12
+ * @param directory - Project directory (where .swarm/ lives)
13
+ * @param preflightManager - The PreflightTriggerManager to call on phase change
14
+ * @returns A safeHook-wrapped system.transform handler
15
+ */
16
+ export declare function createPhaseMonitorHook(directory: string, preflightManager: PreflightTriggerManager): (input: unknown, output: unknown) => Promise<void>;
@@ -0,0 +1,5 @@
1
+ import type { Plugin } from '@opencode-ai/plugin';
2
+ declare const OpenCodeSwarm: Plugin;
3
+ export default OpenCodeSwarm;
4
+ export type { AgentDefinition } from './agents';
5
+ export type { AgentName, AutomationCapabilities, AutomationConfig, AutomationMode, PipelineAgentName, PluginConfig, QAAgentName, } from './config';
@@ -6,11 +6,17 @@ import { type Plan, type TaskStatus } from '../config/plan-schema';
6
6
  */
7
7
  export declare function loadPlanJsonOnly(directory: string): Promise<Plan | null>;
8
8
  /**
9
- * Load and validate plan from .swarm/plan.json with 4-step precedence:
10
- * 1. .swarm/plan.json exists AND validates → return parsed Plan
11
- * 2. .swarm/plan.json exists but FAILS validation → log warning, fall to step 3
12
- * 3. .swarm/plan.md exists call migrateLegacyPlan(), save result, return it
13
- * 4. Neither exists return null
9
+ * Load and validate plan from .swarm/plan.json with auto-heal sync.
10
+ *
11
+ * 4-step precedence with auto-heal:
12
+ * 1. .swarm/plan.json exists AND validates ->
13
+ * a) If plan.md missing or stale -> regenerate plan.md from plan.json
14
+ * b) Return parsed Plan
15
+ * 2. .swarm/plan.json exists but FAILS validation ->
16
+ * a) If plan.md exists -> migrate from plan.md, save valid plan.json, then derive plan.md
17
+ * b) Return migrated Plan
18
+ * 3. .swarm/plan.md exists only -> migrate from plan.md, save both files, return Plan
19
+ * 4. Neither exists -> return null
14
20
  */
15
21
  export declare function loadPlan(directory: string): Promise<Plan | null>;
16
22
  /**
@@ -24,7 +30,8 @@ export declare function savePlan(directory: string, plan: Plan): Promise<void>;
24
30
  */
25
31
  export declare function updateTaskStatus(directory: string, taskId: string, status: TaskStatus): Promise<Plan>;
26
32
  /**
27
- * Generate markdown view from plan object
33
+ * Generate deterministic markdown view from plan object.
34
+ * Ensures stable ordering: phases by ID (ascending), tasks by ID (natural numeric).
28
35
  */
29
36
  export declare function derivePlanMarkdown(plan: Plan): string;
30
37
  /**
@@ -0,0 +1,125 @@
1
+ /**
2
+ * Config Doctor Service
3
+ *
4
+ * Validates opencode-swarm config shape, detects stale/invalid settings,
5
+ * classifies findings by severity, and proposes safe auto-fixes.
6
+ */
7
+ import type { PluginConfig } from '../config/schema';
8
+ /** Severity levels for config findings */
9
+ export type FindingSeverity = 'info' | 'warn' | 'error';
10
+ /** A single config finding */
11
+ export interface ConfigFinding {
12
+ /** Unique identifier for this finding type */
13
+ id: string;
14
+ /** Human-readable title */
15
+ title: string;
16
+ /** Detailed description */
17
+ description: string;
18
+ /** Severity level */
19
+ severity: FindingSeverity;
20
+ /** Path to the config key (dot notation) */
21
+ path: string;
22
+ /** Current invalid/stale value */
23
+ currentValue?: unknown;
24
+ /** Proposed safe fix (if available) */
25
+ proposedFix?: ConfigFix;
26
+ /** Whether this is auto-fixable (safe, non-destructive) */
27
+ autoFixable: boolean;
28
+ }
29
+ /** A proposed config fix */
30
+ export interface ConfigFix {
31
+ /** Type of fix */
32
+ type: 'remove' | 'update' | 'add';
33
+ /** Path to the config key (dot notation) */
34
+ path: string;
35
+ /** Value to set (for update/add) */
36
+ value?: unknown;
37
+ /** Description of what the fix does */
38
+ description: string;
39
+ /** Risk level - only 'low' is auto-fixable */
40
+ risk: 'low' | 'medium' | 'high';
41
+ }
42
+ /** Result of running the config doctor */
43
+ export interface ConfigDoctorResult {
44
+ /** All findings from the doctor run */
45
+ findings: ConfigFinding[];
46
+ /** Findings by severity */
47
+ summary: {
48
+ info: number;
49
+ warn: number;
50
+ error: number;
51
+ };
52
+ /** Whether any auto-fixable issues were found */
53
+ hasAutoFixableIssues: boolean;
54
+ /** Timestamp of the run */
55
+ timestamp: number;
56
+ /** The config that was analyzed */
57
+ configSource: string;
58
+ }
59
+ /** Backup artifact for rollback */
60
+ export interface ConfigBackup {
61
+ /** When the backup was created */
62
+ createdAt: number;
63
+ /** The backed up config content */
64
+ configPath: string;
65
+ /** The raw config content */
66
+ content: string;
67
+ /** Hash of content for integrity verification */
68
+ contentHash: string;
69
+ }
70
+ /**
71
+ * Get config file paths
72
+ */
73
+ export declare function getConfigPaths(directory: string): {
74
+ userConfigPath: string;
75
+ projectConfigPath: string;
76
+ };
77
+ /**
78
+ * Create a backup of the current config
79
+ */
80
+ export declare function createConfigBackup(directory: string): ConfigBackup | null;
81
+ /**
82
+ * Write a backup artifact to .swarm directory
83
+ * Persists full backup content to support rollback/restore
84
+ */
85
+ export declare function writeBackupArtifact(directory: string, backup: ConfigBackup): string;
86
+ /**
87
+ * Restore config from a backup artifact
88
+ * @param backupPath - Path to the backup artifact file
89
+ * @param directory - The working directory (for validating config paths)
90
+ * @returns the path to the restored config file, or null if restore failed
91
+ */
92
+ export declare function restoreFromBackup(backupPath: string, directory: string): string | null;
93
+ /**
94
+ * Run the config doctor on a loaded config
95
+ */
96
+ export declare function runConfigDoctor(config: PluginConfig, directory: string): ConfigDoctorResult;
97
+ /**
98
+ * Apply safe auto-fixes to config
99
+ * Only applies low-risk, non-destructive fixes
100
+ */
101
+ export declare function applySafeAutoFixes(directory: string, result: ConfigDoctorResult): {
102
+ appliedFixes: ConfigFix[];
103
+ updatedConfigPath: string | null;
104
+ };
105
+ /**
106
+ * Write doctor result to .swarm directory for GUI consumption
107
+ */
108
+ export declare function writeDoctorArtifact(directory: string, result: ConfigDoctorResult): string;
109
+ /**
110
+ * Check if config doctor should run on startup
111
+ */
112
+ export declare function shouldRunOnStartup(automationConfig: {
113
+ mode: string;
114
+ capabilities?: Record<string, boolean>;
115
+ } | undefined): boolean;
116
+ /**
117
+ * Full config doctor run with backup and fix application
118
+ */
119
+ export declare function runConfigDoctorWithFixes(directory: string, config: PluginConfig, autoFix?: boolean): Promise<{
120
+ result: ConfigDoctorResult;
121
+ backupPath: string | null;
122
+ appliedFixes: ConfigFix[];
123
+ updatedConfigPath: string | null;
124
+ artifactPath: string | null;
125
+ }>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Decision Drift Analyzer Service
3
+ *
4
+ * Analyzes decisions from context.md and current plan state to detect:
5
+ * 1. Stale decisions (age/phase mismatch or no recent confirmation)
6
+ * 2. Contradictions (new decisions conflicting with existing ones)
7
+ *
8
+ * Results are integrated into architect context injection.
9
+ */
10
+ /**
11
+ * Drift signal severity levels
12
+ */
13
+ export type DriftSeverity = 'warning' | 'error';
14
+ /**
15
+ * A single decision extracted from context.md
16
+ */
17
+ export interface Decision {
18
+ /** Raw decision text */
19
+ text: string;
20
+ /** Phase when decision was made (extracted or inferred) */
21
+ phase: number | null;
22
+ /** Whether decision has a confirmation marker */
23
+ confirmed: boolean;
24
+ /** Timestamp if available */
25
+ timestamp: string | null;
26
+ /** Line number in source file */
27
+ line: number;
28
+ }
29
+ /**
30
+ * A detected drift signal
31
+ */
32
+ export interface DriftSignal {
33
+ /** Unique identifier for this drift */
34
+ id: string;
35
+ /** Severity level */
36
+ severity: DriftSeverity;
37
+ /** Type of drift */
38
+ type: 'stale' | 'contradiction';
39
+ /** Human-readable description */
40
+ message: string;
41
+ /** Source reference (file and line) */
42
+ source: {
43
+ file: string;
44
+ line: number;
45
+ };
46
+ /** Related decisions if applicable */
47
+ relatedDecisions?: string[];
48
+ /** Suggested resolution hint */
49
+ hint?: string;
50
+ }
51
+ /**
52
+ * Result of drift analysis
53
+ */
54
+ export interface DriftAnalysisResult {
55
+ /** Whether drift was detected */
56
+ hasDrift: boolean;
57
+ /** List of drift signals */
58
+ signals: DriftSignal[];
59
+ /** Summary text for context injection */
60
+ summary: string;
61
+ /** Timestamp of analysis */
62
+ analyzedAt: string;
63
+ }
64
+ /**
65
+ * Configuration for drift analyzer
66
+ */
67
+ export interface DriftAnalyzerConfig {
68
+ /** Maximum age in phases before a decision is considered stale */
69
+ staleThresholdPhases: number;
70
+ /** Whether to detect contradictions */
71
+ detectContradictions: boolean;
72
+ /** Maximum signals to return */
73
+ maxSignals: number;
74
+ }
75
+ /**
76
+ * Default configuration
77
+ */
78
+ export declare const DEFAULT_DRIFT_CONFIG: DriftAnalyzerConfig;
79
+ /**
80
+ * Extract decisions from context.md content
81
+ */
82
+ export declare function extractDecisionsFromContext(contextContent: string): Decision[];
83
+ /**
84
+ * Simple keyword-based contradiction detection
85
+ * Looks for decisions that express opposite intentions
86
+ */
87
+ export declare function findContradictions(decisions: Decision[]): DriftSignal[];
88
+ /**
89
+ * Analyze decision drift
90
+ */
91
+ export declare function analyzeDecisionDrift(directory: string, config?: Partial<DriftAnalyzerConfig>): Promise<DriftAnalysisResult>;
92
+ /**
93
+ * Format drift signals as a structured section for context injection
94
+ * Returns bounded output suitable for LLM context
95
+ */
96
+ export declare function formatDriftForContext(result: DriftAnalysisResult): string;
@@ -0,0 +1,31 @@
1
+ /**
2
+ * A single health check result.
3
+ */
4
+ export interface HealthCheck {
5
+ name: string;
6
+ status: '✅' | '❌';
7
+ detail: string;
8
+ }
9
+ /**
10
+ * Structured diagnose data returned by the diagnose service.
11
+ */
12
+ export interface DiagnoseData {
13
+ checks: HealthCheck[];
14
+ passCount: number;
15
+ totalCount: number;
16
+ allPassed: boolean;
17
+ }
18
+ /**
19
+ * Get diagnose data from the swarm directory.
20
+ * Returns structured health checks for GUI, background flows, or commands.
21
+ */
22
+ export declare function getDiagnoseData(directory: string): Promise<DiagnoseData>;
23
+ /**
24
+ * Format diagnose data as markdown for command output.
25
+ */
26
+ export declare function formatDiagnoseMarkdown(diagnose: DiagnoseData): string;
27
+ /**
28
+ * Handle diagnose command - delegates to service and formats output.
29
+ * Kept for backward compatibility - thin adapter.
30
+ */
31
+ export declare function handleDiagnoseCommand(directory: string, _args: string[]): Promise<string>;
@@ -0,0 +1,65 @@
1
+ import type { Evidence } from '../config/evidence-schema';
2
+ /**
3
+ * Structured evidence entry for a task.
4
+ */
5
+ export interface EvidenceEntryData {
6
+ index: number;
7
+ entry: Evidence;
8
+ type: string;
9
+ verdict: string;
10
+ verdictIcon: string;
11
+ agent: string;
12
+ summary: string;
13
+ timestamp: string;
14
+ details: Record<string, string | number | undefined>;
15
+ }
16
+ /**
17
+ * Structured evidence data for a single task.
18
+ */
19
+ export interface TaskEvidenceData {
20
+ hasEvidence: boolean;
21
+ taskId: string;
22
+ createdAt: string;
23
+ updatedAt: string;
24
+ entries: EvidenceEntryData[];
25
+ }
26
+ /**
27
+ * Structured evidence list data for all tasks.
28
+ */
29
+ export interface EvidenceListData {
30
+ hasEvidence: boolean;
31
+ tasks: Array<{
32
+ taskId: string;
33
+ entryCount: number;
34
+ lastUpdated: string;
35
+ }>;
36
+ }
37
+ /**
38
+ * Get emoji for verdict type (exported for use in entry formatting).
39
+ */
40
+ export declare function getVerdictEmoji(verdict: string): string;
41
+ /**
42
+ * Get evidence data for a specific task.
43
+ */
44
+ export declare function getTaskEvidenceData(directory: string, taskId: string): Promise<TaskEvidenceData>;
45
+ /**
46
+ * Get list of all evidence bundles.
47
+ */
48
+ export declare function getEvidenceListData(directory: string): Promise<EvidenceListData>;
49
+ /**
50
+ * Format evidence list as markdown for command output.
51
+ */
52
+ export declare function formatEvidenceListMarkdown(list: EvidenceListData): string;
53
+ /**
54
+ * Format task evidence as markdown for command output.
55
+ */
56
+ export declare function formatTaskEvidenceMarkdown(evidence: TaskEvidenceData): string;
57
+ /**
58
+ * Handle evidence command - delegates to service and formats output.
59
+ * Kept for backward compatibility - thin adapter.
60
+ */
61
+ export declare function handleEvidenceCommand(directory: string, args: string[]): Promise<string>;
62
+ /**
63
+ * Handle evidence summary command - generates completion ratio and blockers report.
64
+ */
65
+ export declare function handleEvidenceSummaryCommand(directory: string): Promise<string>;