opencode-swarm 6.57.0 → 6.59.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 (33) hide show
  1. package/dist/__tests__/acknowledge-spec-drift.test.d.ts +1 -0
  2. package/dist/__tests__/critic_drift_verifier-whitelist.test.d.ts +1 -0
  3. package/dist/__tests__/lint-spec.test.d.ts +1 -0
  4. package/dist/__tests__/preflight-phase.test.d.ts +1 -0
  5. package/dist/__tests__/req-coverage.test.d.ts +1 -0
  6. package/dist/__tests__/spec-hash.test.d.ts +1 -0
  7. package/dist/__tests__/spec-schema.test.d.ts +1 -0
  8. package/dist/__tests__/write-drift-evidence-requirement-coverage.test.d.ts +4 -0
  9. package/dist/agents/critic.d.ts +4 -4
  10. package/dist/agents/explorer-consumer-contract.test.d.ts +1 -0
  11. package/dist/agents/explorer-role-boundary.test.d.ts +1 -0
  12. package/dist/agents/explorer.d.ts +3 -3
  13. package/dist/cli/index.js +3627 -3183
  14. package/dist/commands/acknowledge-spec-drift.d.ts +5 -0
  15. package/dist/commands/index.d.ts +1 -0
  16. package/dist/commands/registry.d.ts +4 -0
  17. package/dist/config/index.d.ts +2 -0
  18. package/dist/config/plan-schema.d.ts +10 -0
  19. package/dist/config/spec-schema.d.ts +113 -0
  20. package/dist/evidence/manager.d.ts +8 -0
  21. package/dist/hooks/curator.d.ts +21 -2
  22. package/dist/index.js +12674 -11481
  23. package/dist/plan/ledger.d.ts +91 -1
  24. package/dist/plan/manager.d.ts +2 -2
  25. package/dist/services/preflight-service.d.ts +1 -1
  26. package/dist/tools/index.d.ts +2 -0
  27. package/dist/tools/lint-spec.d.ts +2 -0
  28. package/dist/tools/req-coverage.d.ts +47 -0
  29. package/dist/tools/tool-names.d.ts +1 -1
  30. package/dist/tools/write-drift-evidence.d.ts +2 -0
  31. package/dist/types/events.d.ts +19 -1
  32. package/dist/utils/spec-hash.d.ts +15 -0
  33. package/package.json +1 -1
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Handle /swarm acknowledge-spec-drift command
3
+ * Acknowledges and clears a previously detected spec drift staleness warning
4
+ */
5
+ export declare function handleAcknowledgeSpecDriftCommand(directory: string, _args: string[]): Promise<string>;
@@ -1,4 +1,5 @@
1
1
  import type { AgentDefinition } from '../agents/index.js';
2
+ export { handleAcknowledgeSpecDriftCommand } from './acknowledge-spec-drift';
2
3
  export { handleAgentsCommand } from './agents';
3
4
  export { handleAnalyzeCommand } from './analyze';
4
5
  export { handleArchiveCommand } from './archive';
@@ -14,6 +14,10 @@ export type CommandEntry = {
14
14
  subcommandOf?: string;
15
15
  };
16
16
  export declare const COMMAND_REGISTRY: {
17
+ readonly 'acknowledge-spec-drift': {
18
+ readonly handler: (ctx: CommandContext) => Promise<string>;
19
+ readonly description: "Acknowledge that the spec has drifted from the plan and suppress further warnings";
20
+ };
17
21
  readonly status: {
18
22
  readonly handler: (ctx: CommandContext) => Promise<string>;
19
23
  readonly description: "Show current swarm state";
@@ -7,3 +7,5 @@ export type { MigrationStatus, Phase, PhaseStatus, Plan, Task, TaskSize, TaskSta
7
7
  export { MigrationStatusSchema, PhaseSchema, PhaseStatusSchema, PlanSchema, TaskSchema, TaskSizeSchema, TaskStatusSchema, } from './plan-schema';
8
8
  export type { AgentOverrideConfig, AutomationCapabilities, AutomationConfig, AutomationMode, PhaseCompleteConfig, PipelineConfig, PluginConfig, SwarmConfig, } from './schema';
9
9
  export { AgentOverrideConfigSchema, AutomationCapabilitiesSchema, AutomationConfigSchema, AutomationModeSchema, PhaseCompleteConfigSchema, PipelineConfigSchema, PluginConfigSchema, SwarmConfigSchema, } from './schema';
10
+ export type { DeltaSpec, Obligation, SpecDelta, SpecRequirement, SpecScenario, SpecSection, SwarmSpec, } from './spec-schema';
11
+ export { DeltaSpecSchema, ObligationSchema, SpecDeltaSchema, SpecRequirementSchema, SpecScenarioSchema, SpecSectionSchema, SwarmSpecSchema, validateSpecContent, } from './spec-schema';
@@ -144,8 +144,18 @@ export declare const PlanSchema: z.ZodObject<{
144
144
  migrated: "migrated";
145
145
  migration_failed: "migration_failed";
146
146
  }>>;
147
+ specMtime: z.ZodOptional<z.ZodString>;
148
+ specHash: z.ZodOptional<z.ZodString>;
147
149
  }, z.core.$strip>;
148
150
  export type Plan = z.infer<typeof PlanSchema>;
151
+ /**
152
+ * Runtime plan with spec staleness tracking.
153
+ * Extends Plan with runtime-only fields that are not persisted.
154
+ */
155
+ export type RuntimePlan = Plan & {
156
+ _specStale?: boolean;
157
+ _specStaleReason?: string;
158
+ };
149
159
  /**
150
160
  * Find the first phase that is in progress.
151
161
  * @param phases - Array of phases
@@ -0,0 +1,113 @@
1
+ import { z } from 'zod';
2
+ export declare const ObligationSchema: z.ZodEnum<{
3
+ MUST: "MUST";
4
+ SHALL: "SHALL";
5
+ SHOULD: "SHOULD";
6
+ MAY: "MAY";
7
+ }>;
8
+ export type Obligation = z.infer<typeof ObligationSchema>;
9
+ export declare const SpecRequirementSchema: z.ZodObject<{
10
+ id: z.ZodString;
11
+ obligation: z.ZodEnum<{
12
+ MUST: "MUST";
13
+ SHALL: "SHALL";
14
+ SHOULD: "SHOULD";
15
+ MAY: "MAY";
16
+ }>;
17
+ text: z.ZodString;
18
+ }, z.core.$strip>;
19
+ export type SpecRequirement = z.infer<typeof SpecRequirementSchema>;
20
+ export declare const SpecScenarioSchema: z.ZodObject<{
21
+ name: z.ZodString;
22
+ given: z.ZodDefault<z.ZodOptional<z.ZodArray<z.ZodString>>>;
23
+ when: z.ZodArray<z.ZodString>;
24
+ thenClauses: z.ZodArray<z.ZodString>;
25
+ }, z.core.$strip>;
26
+ export type SpecScenario = z.infer<typeof SpecScenarioSchema>;
27
+ export declare const SpecSectionSchema: z.ZodObject<{
28
+ name: z.ZodString;
29
+ requirements: z.ZodDefault<z.ZodArray<z.ZodObject<{
30
+ id: z.ZodString;
31
+ obligation: z.ZodEnum<{
32
+ MUST: "MUST";
33
+ SHALL: "SHALL";
34
+ SHOULD: "SHOULD";
35
+ MAY: "MAY";
36
+ }>;
37
+ text: z.ZodString;
38
+ }, z.core.$strip>>>;
39
+ }, z.core.$strip>;
40
+ export type SpecSection = z.infer<typeof SpecSectionSchema>;
41
+ export declare const SwarmSpecSchema: z.ZodObject<{
42
+ title: z.ZodString;
43
+ purpose: z.ZodString;
44
+ sections: z.ZodArray<z.ZodObject<{
45
+ name: z.ZodString;
46
+ requirements: z.ZodDefault<z.ZodArray<z.ZodObject<{
47
+ id: z.ZodString;
48
+ obligation: z.ZodEnum<{
49
+ MUST: "MUST";
50
+ SHALL: "SHALL";
51
+ SHOULD: "SHOULD";
52
+ MAY: "MAY";
53
+ }>;
54
+ text: z.ZodString;
55
+ }, z.core.$strip>>>;
56
+ }, z.core.$strip>>;
57
+ }, z.core.$strip>;
58
+ export type SwarmSpec = z.infer<typeof SwarmSpecSchema>;
59
+ export declare const SpecDeltaSchema: z.ZodObject<{
60
+ added: z.ZodDefault<z.ZodArray<z.ZodObject<{
61
+ id: z.ZodString;
62
+ obligation: z.ZodEnum<{
63
+ MUST: "MUST";
64
+ SHALL: "SHALL";
65
+ SHOULD: "SHOULD";
66
+ MAY: "MAY";
67
+ }>;
68
+ text: z.ZodString;
69
+ }, z.core.$strip>>>;
70
+ modified: z.ZodDefault<z.ZodArray<z.ZodObject<{
71
+ id: z.ZodString;
72
+ obligation: z.ZodEnum<{
73
+ MUST: "MUST";
74
+ SHALL: "SHALL";
75
+ SHOULD: "SHOULD";
76
+ MAY: "MAY";
77
+ }>;
78
+ text: z.ZodString;
79
+ }, z.core.$strip>>>;
80
+ removed: z.ZodDefault<z.ZodArray<z.ZodObject<{
81
+ id: z.ZodString;
82
+ obligation: z.ZodEnum<{
83
+ MUST: "MUST";
84
+ SHALL: "SHALL";
85
+ SHOULD: "SHOULD";
86
+ MAY: "MAY";
87
+ }>;
88
+ text: z.ZodString;
89
+ }, z.core.$strip>>>;
90
+ }, z.core.$strip>;
91
+ export type SpecDelta = z.infer<typeof SpecDeltaSchema>;
92
+ export declare const DeltaSpecSchema: z.ZodType<SwarmSpec | SpecDelta>;
93
+ export type DeltaSpec = z.infer<typeof DeltaSpecSchema>;
94
+ interface ValidationIssue {
95
+ line: number;
96
+ message: string;
97
+ }
98
+ interface SpecContentValidationResult {
99
+ valid: boolean;
100
+ issues: ValidationIssue[];
101
+ }
102
+ /**
103
+ * Validate raw markdown spec content using regex patterns.
104
+ * Checks for:
105
+ * - FR-### requirement IDs
106
+ * - Obligation keywords (MUST, SHALL, SHOULD, MAY)
107
+ * - Section headers (## Section Name)
108
+ *
109
+ * @param content - Raw markdown string to validate
110
+ * @returns Validation result with issues array
111
+ */
112
+ export declare function validateSpecContent(content: string): SpecContentValidationResult;
113
+ export {};
@@ -71,6 +71,14 @@ export declare function listEvidenceTaskIds(directory: string): Promise<string[]
71
71
  * Returns true if deleted, false if didn't exist or deletion failed.
72
72
  */
73
73
  export declare function deleteEvidence(directory: string, taskId: string): Promise<boolean>;
74
+ /**
75
+ * Check if a requirement coverage file exists for a given phase.
76
+ * Looks for .swarm/evidence/req-coverage-phase-{N}.json
77
+ */
78
+ export declare function checkRequirementCoverage(phase: number, directory: string): Promise<{
79
+ exists: boolean;
80
+ path: string;
81
+ }>;
74
82
  /**
75
83
  * Archive old evidence bundles based on retention policy.
76
84
  * Removes evidence older than maxAgeDays.
@@ -7,6 +7,22 @@
7
7
  * callback for LLM-based analysis. When provided, the prepared data context is sent
8
8
  * to the explorer agent in CURATOR_PHASE/CURATOR_INIT mode for richer analysis.
9
9
  * When the delegate is absent or fails, falls back to data-only behavior.
10
+ *
11
+ * ## Curator Agent Dispatch Modes
12
+ *
13
+ * Curator agents are dispatched in two ways:
14
+ *
15
+ * 1. **Factory dispatch** (standard): Created via `createCuratorAgent` from curator-agent.ts,
16
+ * exposed through agents/index.ts. These appear in agent lists and are part of the
17
+ * standard agent factory.
18
+ *
19
+ * 2. **Hook dispatch** (internal): curator.ts imports CURATOR_INIT_PROMPT and CURATOR_PHASE_PROMPT
20
+ * from explorer.ts and dispatches curator analysis directly via hook callbacks. These
21
+ * hook-dispatched curators do NOT go through the standard agent factory and are NOT
22
+ * included in agent lists (e.g., AGENTS.md, agent discovery, the agent registry).
23
+ *
24
+ * This dual dispatch means agent lists are incomplete — they capture factory-dispatched
25
+ * curators but omit hook-dispatched ones. This is by design for hook-internal operations.
10
26
  */
11
27
  import type { ComplianceObservation, CuratorConfig, CuratorInitResult, CuratorPhaseResult, CuratorSummary, KnowledgeRecommendation } from './curator-types.js';
12
28
  import type { KnowledgeConfig } from './knowledge-types.js';
@@ -17,8 +33,11 @@ import type { KnowledgeConfig } from './knowledge-types.js';
17
33
  */
18
34
  export type CuratorLLMDelegate = (systemPrompt: string, userInput: string, signal?: AbortSignal) => Promise<string>;
19
35
  /**
20
- * Parse KNOWLEDGE_UPDATES section from curator LLM output.
21
- * Expected format per line: "- [action] [entry_id or "new"]: [reason]"
36
+ * Parse OBSERVATIONS section from curator LLM output.
37
+ * Expected format per line: "- entry <uuid> (<observable>): [text]"
38
+ * Observable types: appears high-confidence, appears stale, could be tighter,
39
+ * contradicts project state, new candidate
40
+ * Action hints are extracted from parenthetical directives like "(suggests boost confidence, mark hive_eligible)"
22
41
  */
23
42
  export declare function parseKnowledgeRecommendations(llmOutput: string): KnowledgeRecommendation[];
24
43
  /**