opencode-swarm 6.17.3 → 6.18.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.
@@ -16,9 +16,12 @@ export { handlePlanCommand } from './plan';
16
16
  export { handlePreflightCommand } from './preflight';
17
17
  export { handleResetCommand } from './reset';
18
18
  export { handleRetrieveCommand } from './retrieve';
19
+ export { handleRollbackCommand } from './rollback';
20
+ export { handleSimulateCommand } from './simulate';
19
21
  export { handleSpecifyCommand } from './specify';
20
22
  export { handleStatusCommand } from './status';
21
23
  export { handleSyncPlanCommand } from './sync-plan';
24
+ export { handleWriteRetroCommand } from './write_retro';
22
25
  /**
23
26
  * Creates a command.execute.before handler for /swarm commands.
24
27
  * Uses factory pattern to close over directory and agents.
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Handles the /swarm reset command.
3
3
  * Clears plan.md and context.md from .swarm/ directory.
4
+ * Stops background automation and resets in-memory queues.
4
5
  * Requires --confirm flag as a safety gate.
5
6
  */
6
7
  export declare function handleResetCommand(directory: string, args: string[]): Promise<string>;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Handle /swarm rollback command
3
+ * Restores .swarm/ state from a checkpoint using direct overwrite
4
+ */
5
+ export declare function handleRollbackCommand(directory: string, args: string[]): Promise<string>;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Handle /swarm simulate command
3
+ * Performs read-only impact analysis using existing tools
4
+ */
5
+ export declare function handleSimulateCommand(directory: string, args: string[]): Promise<string>;
@@ -0,0 +1 @@
1
+ export declare function handleWriteRetroCommand(directory: string, args: string[]): Promise<string>;
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Co-Change Suggester Hook
3
+ *
4
+ * Analyzes file modifications and suggests co-change partners based on
5
+ * historical co-change data from .swarm/co-change.json. This hook fires
6
+ * after file-write tools complete and logs suggestions when co-change
7
+ * partners are detected.
8
+ */
9
+ /**
10
+ * Represents a single co-change entry from the JSON file
11
+ */
12
+ export interface CoChangeJsonEntry {
13
+ /** First file in the co-change pair */
14
+ fileA: string;
15
+ /** Second file in the co-change pair */
16
+ fileB: string;
17
+ /** Number of times these files were changed together */
18
+ coChangeCount: number;
19
+ /** Normalized Pointwise Mutual Information score (0-1) */
20
+ npmi: number;
21
+ }
22
+ /**
23
+ * Root structure of the co-change JSON file
24
+ */
25
+ export interface CoChangeJson {
26
+ /** File format version */
27
+ version: string;
28
+ /** ISO timestamp when the file was generated */
29
+ generated: string;
30
+ /** Array of co-change entries */
31
+ entries: CoChangeJsonEntry[];
32
+ }
33
+ /**
34
+ * Reads and parses the .swarm/co-change.json file
35
+ * @param directory - The project directory containing .swarm folder
36
+ * @returns Parsed CoChangeJson or null if not found/invalid
37
+ */
38
+ export declare function readCoChangeJson(directory: string): Promise<CoChangeJson | null>;
39
+ /**
40
+ * Finds co-change partners for a given file
41
+ * @param entries - Array of co-change entries to search
42
+ * @param filePath - The file path to find partners for
43
+ * @returns Array of entries where the file appears as fileA or fileB
44
+ */
45
+ export declare function getCoChangePartnersForFile(entries: CoChangeJsonEntry[], filePath: string): CoChangeJsonEntry[];
46
+ /**
47
+ * Creates the co-change suggester hook
48
+ * @param directory - The project directory containing .swarm folder
49
+ * @returns A hook function that analyzes file writes for co-change suggestions
50
+ */
51
+ export declare function createCoChangeSuggesterHook(directory: string): (input: unknown, output: unknown) => Promise<void>;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Dark Matter Detector Hook
3
+ *
4
+ * This hook reads `.swarm/dark-matter.md` — a markdown file that lists
5
+ * unresolved coupling gaps. When unconsumed items exist in this file,
6
+ * the hook logs a reminder hint to the user.
7
+ */
8
+ /**
9
+ * Parses dark matter gaps from markdown content
10
+ *
11
+ * @param content - The markdown content to parse
12
+ * @returns Object containing arrays of unresolved and resolved gap descriptions
13
+ */
14
+ export declare function parseDarkMatterGaps(content: string): {
15
+ unresolved: string[];
16
+ resolved: string[];
17
+ };
18
+ /**
19
+ * Reads and parses the dark matter gaps file
20
+ *
21
+ * @param directory - The project directory containing .swarm folder
22
+ * @returns Object with unresolved and resolved gaps, or null if file not found/empty
23
+ */
24
+ export declare function readDarkMatterMd(directory: string): Promise<{
25
+ unresolved: string[];
26
+ resolved: string[];
27
+ } | null>;
28
+ /**
29
+ * Creates the dark matter detector hook
30
+ *
31
+ * This hook fires on `toolAfter` and checks for unresolved coupling gaps
32
+ * in `.swarm/dark-matter.md`. It logs a reminder hint when gaps exist,
33
+ * with rate-limiting to avoid excessive file I/O.
34
+ *
35
+ * @param directory - The project directory containing .swarm folder
36
+ * @returns Hook function that checks for unresolved dark matter gaps
37
+ */
38
+ export declare function createDarkMatterDetectorHook(directory: string): (input: unknown, output: unknown) => Promise<void>;
@@ -9,10 +9,11 @@
9
9
  import { type GuardrailsConfig } from '../config/schema';
10
10
  /**
11
11
  * Creates guardrails hooks for circuit breaker protection
12
+ * @param directory Working directory (from plugin init context)
12
13
  * @param config Guardrails configuration
13
14
  * @returns Tool before/after hooks and messages transform hook
14
15
  */
15
- export declare function createGuardrailsHooks(config: GuardrailsConfig): {
16
+ export declare function createGuardrailsHooks(directory: string, config: GuardrailsConfig): {
16
17
  toolBefore: (input: {
17
18
  tool: string;
18
19
  sessionID: string;
@@ -1,5 +1,10 @@
1
1
  /** Knowledge curator hook for opencode-swarm v6.17 two-tier knowledge system. */
2
2
  import type { KnowledgeConfig } from './knowledge-types.js';
3
+ /**
4
+ * Check if the input is a write operation targeting an evidence file.
5
+ * Exported for testing purposes only.
6
+ */
7
+ export declare function isWriteToEvidenceFile(input: unknown): boolean;
3
8
  /**
4
9
  * Curate and store swarm knowledge entries from lessons.
5
10
  */
@@ -0,0 +1,30 @@
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>;