opencode-swarm 6.56.0 → 6.58.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.
@@ -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
@@ -474,6 +474,7 @@ export type CompactionConfig = z.infer<typeof CompactionConfigSchema>;
474
474
  export declare const AgentAuthorityRuleSchema: z.ZodObject<{
475
475
  readOnly: z.ZodOptional<z.ZodBoolean>;
476
476
  blockedExact: z.ZodOptional<z.ZodArray<z.ZodString>>;
477
+ allowedExact: z.ZodOptional<z.ZodArray<z.ZodString>>;
477
478
  blockedPrefix: z.ZodOptional<z.ZodArray<z.ZodString>>;
478
479
  allowedPrefix: z.ZodOptional<z.ZodArray<z.ZodString>>;
479
480
  blockedZones: z.ZodOptional<z.ZodArray<z.ZodEnum<{
@@ -484,6 +485,8 @@ export declare const AgentAuthorityRuleSchema: z.ZodObject<{
484
485
  generated: "generated";
485
486
  build: "build";
486
487
  }>>>;
488
+ blockedGlobs: z.ZodOptional<z.ZodArray<z.ZodString>>;
489
+ allowedGlobs: z.ZodOptional<z.ZodArray<z.ZodString>>;
487
490
  }, z.core.$strip>;
488
491
  export type AgentAuthorityRule = z.infer<typeof AgentAuthorityRuleSchema>;
489
492
  export declare const AuthorityConfigSchema: z.ZodObject<{
@@ -491,6 +494,7 @@ export declare const AuthorityConfigSchema: z.ZodObject<{
491
494
  rules: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
492
495
  readOnly: z.ZodOptional<z.ZodBoolean>;
493
496
  blockedExact: z.ZodOptional<z.ZodArray<z.ZodString>>;
497
+ allowedExact: z.ZodOptional<z.ZodArray<z.ZodString>>;
494
498
  blockedPrefix: z.ZodOptional<z.ZodArray<z.ZodString>>;
495
499
  allowedPrefix: z.ZodOptional<z.ZodArray<z.ZodString>>;
496
500
  blockedZones: z.ZodOptional<z.ZodArray<z.ZodEnum<{
@@ -501,6 +505,8 @@ export declare const AuthorityConfigSchema: z.ZodObject<{
501
505
  generated: "generated";
502
506
  build: "build";
503
507
  }>>>;
508
+ blockedGlobs: z.ZodOptional<z.ZodArray<z.ZodString>>;
509
+ allowedGlobs: z.ZodOptional<z.ZodArray<z.ZodString>>;
504
510
  }, z.core.$strip>>>;
505
511
  }, z.core.$strip>;
506
512
  export type AuthorityConfig = z.infer<typeof AuthorityConfigSchema>;
@@ -668,6 +674,7 @@ export declare const PluginConfigSchema: z.ZodObject<{
668
674
  rules: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodObject<{
669
675
  readOnly: z.ZodOptional<z.ZodBoolean>;
670
676
  blockedExact: z.ZodOptional<z.ZodArray<z.ZodString>>;
677
+ allowedExact: z.ZodOptional<z.ZodArray<z.ZodString>>;
671
678
  blockedPrefix: z.ZodOptional<z.ZodArray<z.ZodString>>;
672
679
  allowedPrefix: z.ZodOptional<z.ZodArray<z.ZodString>>;
673
680
  blockedZones: z.ZodOptional<z.ZodArray<z.ZodEnum<{
@@ -678,6 +685,8 @@ export declare const PluginConfigSchema: z.ZodObject<{
678
685
  generated: "generated";
679
686
  build: "build";
680
687
  }>>>;
688
+ blockedGlobs: z.ZodOptional<z.ZodArray<z.ZodString>>;
689
+ allowedGlobs: z.ZodOptional<z.ZodArray<z.ZodString>>;
681
690
  }, z.core.$strip>>>;
682
691
  }, z.core.$strip>>;
683
692
  plan_cursor: z.ZodOptional<z.ZodObject<{
@@ -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.
@@ -106,9 +106,12 @@ export declare function validateAndRecordAttestation(dir: string, findingId: str
106
106
  type AgentRule = {
107
107
  readOnly?: boolean;
108
108
  blockedExact?: string[];
109
+ allowedExact?: string[];
109
110
  blockedPrefix?: string[];
110
111
  allowedPrefix?: string[];
111
112
  blockedZones?: FileZone[];
113
+ blockedGlobs?: string[];
114
+ allowedGlobs?: string[];
112
115
  };
113
116
  export declare const DEFAULT_AGENT_AUTHORITY_RULES: Record<string, AgentRule>;
114
117
  /**