opencode-swarm 6.80.2 → 6.81.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.
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ /**
2
+ * PRM Pattern Detector Tests
3
+ * Comprehensive tests for all 5 pattern detectors and orchestration function
4
+ */
5
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ /**
2
+ * TRAJECTORY STORE TESTS
3
+ *
4
+ * Unit tests for the session-level trajectory storage module.
5
+ * Uses real file operations in a temp directory to verify behavior.
6
+ */
7
+ export {};
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Course Correction Module
3
+ * Generates structured guidance messages from pattern detection results
4
+ */
5
+ import type { CourseCorrection, PatternMatch, TrajectoryEntry } from './types';
6
+ /**
7
+ * Generates a structured CourseCorrection guidance message from a PatternMatch and trajectory context
8
+ *
9
+ * @param match - The pattern match result from pattern detection
10
+ * @param trajectory - The trajectory entries providing context for the correction
11
+ * @returns A structured CourseCorrection object with alert, category, guidance, action, pattern, and stepRange
12
+ */
13
+ export declare function generateCourseCorrection(match: PatternMatch, trajectory: TrajectoryEntry[]): CourseCorrection;
14
+ /**
15
+ * Formats a CourseCorrection for injection into agent messages
16
+ *
17
+ * @param correction - The course correction to format
18
+ * @returns A formatted string suitable for injection into messages
19
+ */
20
+ export declare function formatCourseCorrectionForInjection(correction: CourseCorrection): string;
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Escalation Tracker Module
3
+ * Implements a 3-strike protocol for pattern detection escalation
4
+ */
5
+ import type { CourseCorrection, EscalationState, PatternMatch } from './types';
6
+ /**
7
+ * Creates a default EscalationState with all counters reset and flags cleared.
8
+ * Exported for testing purposes.
9
+ *
10
+ * @returns A fresh EscalationState with default values
11
+ */
12
+ export declare function createDefaultEscalationState(): EscalationState;
13
+ /**
14
+ * EscalationTracker
15
+ *
16
+ * Tracks pattern detection counts per session and implements a 3-strike escalation protocol:
17
+ * - Level 1 (1st detection): Guidance via pendingAdvisoryMessages
18
+ * - Level 2 (2nd detection): Stronger guidance + architect alert via telemetry
19
+ * - Level 3 (3rd+ detection): Hard stop flag that is read by messagesTransform
20
+ *
21
+ * All methods are safe and never throw errors.
22
+ */
23
+ export declare class EscalationTracker {
24
+ private readonly _sessionId;
25
+ private _state;
26
+ /**
27
+ * Creates a new EscalationTracker for the given session.
28
+ *
29
+ * @param sessionId - The session identifier
30
+ * @param initialState - Optional initial state to restore (for session resumption)
31
+ */
32
+ constructor(sessionId: string, initialState?: EscalationState);
33
+ /**
34
+ * Records a pattern detection and determines the escalation level.
35
+ * Updates internal state based on the 3-strike protocol.
36
+ *
37
+ * @param match - The pattern match to record
38
+ * @returns An object containing the escalation level, correction (if any), and hard stop flag
39
+ */
40
+ recordDetection(match: PatternMatch): {
41
+ level: number;
42
+ correction: CourseCorrection | null;
43
+ hardStop: boolean;
44
+ };
45
+ /**
46
+ * Returns the current escalation state.
47
+ *
48
+ * @returns The current EscalationState (reference, not a copy)
49
+ */
50
+ getState(): EscalationState;
51
+ /**
52
+ * Resets all escalation counts and flags to their default values.
53
+ * Clears pattern counts, corrections pending, and all flags.
54
+ */
55
+ reset(): void;
56
+ /**
57
+ * Returns all pending course corrections.
58
+ *
59
+ * @returns Array of pending CourseCorrection objects
60
+ */
61
+ getPendingCorrections(): CourseCorrection[];
62
+ /**
63
+ * Clears all pending course corrections.
64
+ */
65
+ clearPendingCorrections(): void;
66
+ /**
67
+ * Returns whether a hard stop is pending.
68
+ * This flag is read by messagesTransform to halt agent execution.
69
+ *
70
+ * @returns true if hard stop is pending, false otherwise
71
+ */
72
+ isHardStopPending(): boolean;
73
+ }
@@ -0,0 +1,58 @@
1
+ /**
2
+ * PRM (Process Remediation Manager) Facade
3
+ *
4
+ * Integration layer that wires together all PRM components:
5
+ * - Trajectory logging via trajectory-store
6
+ * - Pattern detection via pattern-detector
7
+ * - Course correction via course-correction
8
+ * - Escalation tracking via escalation
9
+ *
10
+ * This module provides the createPrmHook factory that returns the toolAfter
11
+ * handler used by the swarm hook system. PRM replaces loop-detector.ts for
12
+ * repetition_loop detection, but loop-detector.ts is kept as a fast circuit
13
+ * breaker for backward compatibility.
14
+ */
15
+ export { formatCourseCorrectionForInjection, generateCourseCorrection, } from './course-correction';
16
+ export { createDefaultEscalationState, EscalationTracker } from './escalation';
17
+ export { detectContextThrash, detectExpansionDrift, detectPatterns, detectPingPong, detectRepetitionLoop, detectStuckOnTest, } from './pattern-detector';
18
+ export type { CourseCorrection, EscalationState, PatternDetectionResult, PatternMatch, PatternSeverity, PatternType, PrmConfig, TaxonomyCategory, TrajectoryEntry, } from './types';
19
+ import type { PrmConfig } from './types';
20
+ /**
21
+ * Context passed to toolAfter handler
22
+ */
23
+ interface ToolAfterContext {
24
+ sessionID: string;
25
+ tool?: string;
26
+ args_summary?: string;
27
+ result?: 'success' | 'failure' | 'pending';
28
+ }
29
+ /**
30
+ * PRM hook interface returned by createPrmHook
31
+ */
32
+ interface PrmHook {
33
+ toolAfter: (context: ToolAfterContext) => Promise<void>;
34
+ }
35
+ /**
36
+ * Creates a PRM hook for the given configuration.
37
+ *
38
+ * The returned toolAfter handler:
39
+ * - Runs after each tool execution when PRM is enabled
40
+ * - Reads the session trajectory
41
+ * - Runs pattern detection
42
+ * - Generates course corrections for detected patterns
43
+ * - Updates session state with corrections and escalation level
44
+ * - Emits telemetry events
45
+ *
46
+ * This function is non-blocking: errors are caught and logged, never thrown.
47
+ *
48
+ * @param config - PRM configuration (enabled, thresholds, etc.)
49
+ * @param directory - Project directory for trajectory storage
50
+ * @returns PrmHook with toolAfter handler
51
+ *
52
+ * @example
53
+ * ```typescript
54
+ * const prmHook = createPrmHook(prmConfig, directory);
55
+ * // Wire prmHook.toolAfter into your tool.execute.after hook
56
+ * ```
57
+ */
58
+ export declare function createPrmHook(config: PrmConfig, directory: string): PrmHook;
@@ -0,0 +1,71 @@
1
+ /**
2
+ * PRM Pattern Detector
3
+ * Rule-based pattern detection for trajectory analysis
4
+ */
5
+ import type { PatternDetectionResult, PatternMatch, PrmConfig, TrajectoryEntry } from './types';
6
+ /**
7
+ * Sanitize a string to prevent prompt injection attacks.
8
+ * Removes newlines, carriage returns, backticks, and common injection patterns.
9
+ * Limits length to prevent overflow.
10
+ *
11
+ * @param input - The string to sanitize
12
+ * @returns Sanitized string safe for embedding in prompts
13
+ */
14
+ export declare function sanitizeString(input: string): string;
15
+ /**
16
+ * Detect repetition_loop pattern
17
+ * Same agent targets same file with same action within N steps
18
+ *
19
+ * @param trajectory - Array of trajectory entries
20
+ * @param config - PRM configuration
21
+ * @returns Array of detected pattern matches
22
+ */
23
+ export declare function detectRepetitionLoop(trajectory: TrajectoryEntry[], config: PrmConfig): PatternMatch[];
24
+ /**
25
+ * Detect ping_pong pattern
26
+ * Agent A delegates to B, B completes, A delegates to B again
27
+ * Alternating agent patterns with same target
28
+ *
29
+ * @param trajectory - Array of trajectory entries
30
+ * @param config - PRM configuration
31
+ * @returns Array of detected pattern matches
32
+ */
33
+ export declare function detectPingPong(trajectory: TrajectoryEntry[], config: PrmConfig): PatternMatch[];
34
+ /**
35
+ * Detect expansion_drift pattern
36
+ * Successive plans grow in scope (unique targets increase >50%)
37
+ *
38
+ * @param trajectory - Array of trajectory entries
39
+ * @param config - PRM configuration
40
+ * @returns Array of detected pattern matches
41
+ */
42
+ export declare function detectExpansionDrift(trajectory: TrajectoryEntry[], config: PrmConfig): PatternMatch[];
43
+ /**
44
+ * Detect stuck_on_test pattern
45
+ * Edit -> test fail -> edit same file cycle
46
+ *
47
+ * @param trajectory - Array of trajectory entries
48
+ * @param config - PRM configuration
49
+ * @returns Array of detected pattern matches
50
+ */
51
+ export declare function detectStuckOnTest(trajectory: TrajectoryEntry[], config: PrmConfig): PatternMatch[];
52
+ /**
53
+ * Detect context_thrash pattern
54
+ * Agent requests increasingly large file sets (monotonic increase in unique targets)
55
+ * Context thrash is detected when the agent keeps introducing NEW targets without
56
+ * revisiting old ones - i.e., the unique target count increases for consecutive steps
57
+ * with NO plateaus in between.
58
+ *
59
+ * @param trajectory - Array of trajectory entries
60
+ * @param config - PRM configuration
61
+ * @returns Array of detected pattern matches
62
+ */
63
+ export declare function detectContextThrash(trajectory: TrajectoryEntry[], config: PrmConfig): PatternMatch[];
64
+ /**
65
+ * Run all pattern detectors on a trajectory
66
+ *
67
+ * @param trajectory - Array of trajectory entries to analyze
68
+ * @param config - PRM configuration with thresholds
69
+ * @returns PatternDetectionResult with all matches and timing info
70
+ */
71
+ export declare function detectPatterns(trajectory: TrajectoryEntry[], config: PrmConfig, lastProcessedStep?: number): PatternDetectionResult;
@@ -0,0 +1,44 @@
1
+ /**
2
+ * PRM Replay System
3
+ *
4
+ * Provides deterministic replay functionality for PRM (Process Remediation Manager).
5
+ * Records all LLM requests/responses and tool I/O during a run for replay.
6
+ *
7
+ * Replay artifacts are stored in `.swarm/replays/{sessionId}-{timestamp}.jsonl`
8
+ */
9
+ /**
10
+ * Entry types for replay recording
11
+ */
12
+ export type ReplayEntryType = 'llm_request' | 'llm_response' | 'tool_call' | 'tool_result' | 'pattern_detected' | 'course_correction' | 'escalation' | 'hard_stop';
13
+ /**
14
+ * A single entry in the replay log
15
+ */
16
+ export interface ReplayEntry {
17
+ /** ISO 8601 timestamp when entry was recorded */
18
+ timestamp: string;
19
+ /** Session identifier */
20
+ sessionID: string;
21
+ /** Type of replay entry */
22
+ type: ReplayEntryType;
23
+ /** Entry data payload */
24
+ data: Record<string, unknown>;
25
+ }
26
+ /**
27
+ * Initializes replay recording for a session.
28
+ * Creates the replay directory if it doesn't exist.
29
+ * Non-blocking: errors are caught and logged, returns null on failure.
30
+ *
31
+ * @param sessionID - Session identifier
32
+ * @param directory - Project directory
33
+ * @returns Path to the replay artifact file, or null on error
34
+ */
35
+ export declare function startReplayRecording(sessionID: string, directory: string): Promise<string | null>;
36
+ /**
37
+ * Appends a ReplayEntry to the replay artifact file.
38
+ * Non-blocking: errors are caught and logged, never thrown.
39
+ *
40
+ * @param artifactPath - Path to the replay artifact file
41
+ * @param sessionID - Session identifier
42
+ * @param entry - Entry to record (without timestamp/sessionID)
43
+ */
44
+ export declare function recordReplayEntry(artifactPath: string, sessionID: string, entry: Omit<ReplayEntry, 'timestamp' | 'sessionID'>): Promise<void>;
@@ -0,0 +1,66 @@
1
+ /**
2
+ * TRAJECTORY STORE (Session-Level)
3
+ *
4
+ * Per-session trajectory storage for PRM pattern detection.
5
+ * Writes to .swarm/trajectories/{sessionId}.jsonl
6
+ *
7
+ * Coexists with task-level trajectory-logger.ts which writes to
8
+ * .swarm/evidence/{taskId}/trajectory.jsonl for audit/evidence.
9
+ */
10
+ import type { TrajectoryEntry } from './types';
11
+ /**
12
+ * Returns cached trajectory entries for a session (empty array if not cached).
13
+ */
14
+ export declare function getInMemoryTrajectory(sessionId: string): TrajectoryEntry[];
15
+ /**
16
+ * Clears trajectory cache (for test isolation or session cleanup).
17
+ */
18
+ export declare function clearTrajectoryCache(sessionId?: string): void;
19
+ /**
20
+ * Appends a single TrajectoryEntry to the session's trajectory file.
21
+ *
22
+ * @param sessionId - Session identifier
23
+ * @param entry - Trajectory entry to append
24
+ * @param directory - Base directory (workspace root)
25
+ * @param maxLines - Maximum lines before in-memory cache trimming (default 1000)
26
+ */
27
+ export declare function appendTrajectoryEntry(sessionId: string, entry: TrajectoryEntry, directory: string, maxLines?: number): Promise<void>;
28
+ /**
29
+ * Reads all TrajectoryEntry records from a session's trajectory file.
30
+ *
31
+ * @param sessionId - Session identifier
32
+ * @param directory - Base directory (workspace root)
33
+ * @returns Array of trajectory entries (empty array if file doesn't exist)
34
+ */
35
+ export declare function readTrajectory(sessionId: string, directory: string): Promise<TrajectoryEntry[]>;
36
+ /**
37
+ * Alias for readTrajectory - retrieves trajectory entries for a session.
38
+ *
39
+ * @param sessionId - Session identifier
40
+ * @param directory - Base directory (workspace root)
41
+ * @returns Array of trajectory entries
42
+ */
43
+ export declare function getTrajectoryForSession(sessionId: string, directory: string): Promise<TrajectoryEntry[]>;
44
+ /**
45
+ * Truncates the trajectory file to the newest half if lines exceed maxLines.
46
+ *
47
+ * @param sessionId - Session identifier
48
+ * @param directory - Base directory (workspace root)
49
+ * @param maxLines - Maximum number of lines to retain
50
+ */
51
+ export declare function truncateTrajectoryIfNeeded(sessionId: string, directory: string, maxLines: number): Promise<void>;
52
+ /**
53
+ * Returns the highest step number in the session's trajectory.
54
+ * Used to determine the next step number when appending.
55
+ *
56
+ * @param sessionId - Session identifier
57
+ * @param directory - Base directory (workspace root)
58
+ * @returns Highest step number, or 0 if no trajectory exists
59
+ */
60
+ export declare function getCurrentStep(sessionId: string, directory: string): Promise<number>;
61
+ /**
62
+ * Deletes trajectory and replay files older than maxAgeDays.
63
+ * Runs against .swarm/trajectories/ and .swarm/replays/ directories.
64
+ * Non-blocking: errors logged, not thrown.
65
+ */
66
+ export declare function cleanupOldTrajectoryFiles(directory: string, maxAgeDays?: number): Promise<void>;
@@ -0,0 +1,120 @@
1
+ /**
2
+ * PRM (Prompt Response Monitoring) Type Definitions
3
+ * Core types for trajectory logging, pattern detection, and course correction
4
+ */
5
+ /**
6
+ * All detectable pattern types in the SWE-PRM system
7
+ */
8
+ export type PatternType = 'repetition_loop' | 'ping_pong' | 'expansion_drift' | 'stuck_on_test' | 'context_thrash';
9
+ /**
10
+ * SWE-PRM taxonomy classification for categorizing pattern root causes
11
+ */
12
+ export type TaxonomyCategory = 'specification_error' | 'reasoning_error' | 'coordination_error';
13
+ /**
14
+ * Severity levels for pattern detection responses
15
+ */
16
+ export type PatternSeverity = 'low' | 'medium' | 'high' | 'critical';
17
+ /**
18
+ * A single trajectory log entry recording one agent action
19
+ */
20
+ export interface TrajectoryEntry {
21
+ /** Sequential step number (1-indexed) */
22
+ step: number;
23
+ /** Agent name */
24
+ agent: string;
25
+ /** Action type (plan, edit, review, test, delegate, etc.) */
26
+ action: string;
27
+ /** File or task being targeted */
28
+ target: string;
29
+ /** Human-readable description of intended outcome */
30
+ intent: string;
31
+ /** ISO 8601 timestamp */
32
+ timestamp: string;
33
+ /** Outcome of the action */
34
+ result: 'success' | 'failure' | 'pending';
35
+ /** Optional: tool name (for compatibility with existing logger) */
36
+ tool?: string;
37
+ /** Optional: tool arguments summary */
38
+ args_summary?: string;
39
+ /** Optional: elapsed time in milliseconds */
40
+ elapsed_ms?: number;
41
+ }
42
+ /**
43
+ * Result of pattern detection indicating a detected problematic trajectory pattern
44
+ */
45
+ export interface PatternMatch {
46
+ /** The type of pattern detected */
47
+ pattern: PatternType;
48
+ /** Severity level of the detected pattern */
49
+ severity: PatternSeverity;
50
+ /** Taxonomy category for the pattern */
51
+ category: TaxonomyCategory;
52
+ /** Start and end step numbers of the pattern occurrence */
53
+ stepRange: [number, number];
54
+ /** Human-readable description of the pattern */
55
+ description: string;
56
+ /** Agents involved in the pattern */
57
+ affectedAgents: string[];
58
+ /** Files/tasks involved in the pattern */
59
+ affectedTargets: string[];
60
+ /** How many times this pattern has been detected */
61
+ occurrenceCount: number;
62
+ }
63
+ /**
64
+ * Structured guidance message for steering agent behavior
65
+ */
66
+ export interface CourseCorrection {
67
+ /** Alert header with pattern context */
68
+ alert: string;
69
+ /** Taxonomy category of the underlying issue */
70
+ category: TaxonomyCategory;
71
+ /** Concrete next-step instruction */
72
+ guidance: string;
73
+ /** Specific action to take */
74
+ action: string;
75
+ /** Pattern type being addressed */
76
+ pattern: PatternType;
77
+ /** Step range where the pattern was detected */
78
+ stepRange: [number, number];
79
+ }
80
+ /**
81
+ * Aggregate result from running all pattern detectors
82
+ */
83
+ export interface PatternDetectionResult {
84
+ /** All pattern matches found in this detection pass */
85
+ matches: PatternMatch[];
86
+ /** Time taken to run detection in milliseconds */
87
+ detectionTimeMs: number;
88
+ /** Number of patterns checked in this pass */
89
+ patternsChecked: number;
90
+ }
91
+ /**
92
+ * Configuration for the PRM system
93
+ */
94
+ export interface PrmConfig {
95
+ /** Whether PRM is enabled */
96
+ enabled: boolean;
97
+ /** Threshold per pattern type (number of occurrences before alert) */
98
+ pattern_thresholds: Record<PatternType, number>;
99
+ /** Max trajectory lines before truncation */
100
+ max_trajectory_lines: number;
101
+ /** Whether 3-strike escalation is active */
102
+ escalation_enabled: boolean;
103
+ /** Max time for detection in milliseconds */
104
+ detection_timeout_ms: number;
105
+ }
106
+ /**
107
+ * Per-session escalation tracking state
108
+ */
109
+ export interface EscalationState {
110
+ /** Pattern type to detection count mapping */
111
+ patternCounts: Map<PatternType, number>;
112
+ /** Current escalation level (0=none, 1=guidance, 2=strong guidance, 3=hard stop) */
113
+ escalationLevel: number;
114
+ /** Last pattern detected (if any) */
115
+ lastPatternDetected: PatternMatch | null;
116
+ /** Whether a hard stop has been triggered */
117
+ hardStopPending: boolean;
118
+ /** Queue of correction messages to inject */
119
+ correctionsPending: CourseCorrection[];
120
+ }
package/dist/state.d.ts CHANGED
@@ -9,6 +9,8 @@
9
9
  import type { OpencodeClient } from '@opencode-ai/sdk';
10
10
  import { type QaGates } from './db/qa-gate-profile.js';
11
11
  import { type EnvironmentProfile } from './environment/profile.js';
12
+ import type { EscalationTracker } from './prm/escalation.js';
13
+ import type { PatternMatch } from './prm/types.js';
12
14
  import { AgentRunContext } from './state/agent-run-context.js';
13
15
  export { AgentRunContext } from './state/agent-run-context.js';
14
16
  /**
@@ -179,6 +181,18 @@ export interface AgentSessionState {
179
181
  pendingAdvisoryMessages?: string[];
180
182
  /** Timestamp when session was rehydrated from snapshot (0 if never rehydrated) */
181
183
  sessionRehydratedAt: number;
184
+ /** Pattern type to detection count mapping */
185
+ prmPatternCounts: Map<string, number>;
186
+ /** Current escalation level (0=none, 1=guidance, 2=strong guidance, 3=hard stop) */
187
+ prmEscalationLevel: number;
188
+ /** Last pattern detected (if any) */
189
+ prmLastPatternDetected: PatternMatch | null;
190
+ /** Current trajectory step counter */
191
+ prmTrajectoryStep: number;
192
+ /** Whether a hard stop has been triggered */
193
+ prmHardStopPending: boolean;
194
+ /** Per-session escalation tracker instance (set lazily by PRM hook) */
195
+ prmEscalationTracker?: EscalationTracker;
182
196
  }
183
197
  /**
184
198
  * Represents a single agent invocation window with isolated guardrail budgets.
@@ -1,4 +1,4 @@
1
- export type TelemetryEvent = 'session_started' | 'session_ended' | 'agent_activated' | 'delegation_begin' | 'delegation_end' | 'task_state_changed' | 'gate_passed' | 'gate_failed' | 'phase_changed' | 'budget_updated' | 'model_fallback' | 'hard_limit_hit' | 'revision_limit_hit' | 'loop_detected' | 'scope_violation' | 'qa_skip_violation' | 'heartbeat' | 'turbo_mode_changed' | 'auto_oversight_escalation' | 'environment_detected' | 'evidence_lock_acquired' | 'evidence_lock_contended' | 'evidence_lock_stale_recovered' | 'plan_ledger_cas_retry';
1
+ export type TelemetryEvent = 'session_started' | 'session_ended' | 'agent_activated' | 'delegation_begin' | 'delegation_end' | 'task_state_changed' | 'gate_passed' | 'gate_failed' | 'phase_changed' | 'budget_updated' | 'model_fallback' | 'hard_limit_hit' | 'revision_limit_hit' | 'loop_detected' | 'scope_violation' | 'qa_skip_violation' | 'heartbeat' | 'turbo_mode_changed' | 'auto_oversight_escalation' | 'environment_detected' | 'evidence_lock_acquired' | 'evidence_lock_contended' | 'evidence_lock_stale_recovered' | 'plan_ledger_cas_retry' | 'prm_pattern_detected' | 'prm_course_correction_injected' | 'prm_escalation_triggered' | 'prm_hard_stop';
2
2
  export type TelemetryListener = (event: TelemetryEvent, data: Record<string, unknown>) => void;
3
3
  /** @internal - For testing only */
4
4
  export declare function resetTelemetryForTesting(): void;
@@ -52,4 +52,8 @@ export declare const telemetry: {
52
52
  turboModeChanged(sessionId: string, enabled: boolean, agentName: string): void;
53
53
  autoOversightEscalation(sessionId: string, reason: string, interactionCount: number, deadlockCount: number, phase?: number): void;
54
54
  environmentDetected(sessionId: string, hostOS: string, shellFamily: string, executionMode: string): void;
55
+ prmPatternDetected(sessionId: string, pattern: string, severity: string, category: string, stepRange: [number, number]): void;
56
+ prmCourseCorrectionInjected(sessionId: string, pattern: string, level: number): void;
57
+ prmEscalationTriggered(sessionId: string, pattern: string, level: number, occurrenceCount: number): void;
58
+ prmHardStop(sessionId: string, pattern: string, level: number, occurrenceCount: number): void;
55
59
  };
@@ -90,4 +90,36 @@ export interface SpecDriftAcknowledgedEvent {
90
90
  previousHash: string;
91
91
  newHash: string | null;
92
92
  }
93
- export type V619Event = SoundingBoardConsultedEvent | ArchitectLoopDetectedEvent | PrecedentManipulationDetectedEvent | CoderSelfAuditEvent | CoderRetryCircuitBreakerEvent | AgentConflictDetectedEvent | AuthorityHandoffResolvedEvent | SpecStaleDetectedEvent | SpecDriftAcknowledgedEvent;
93
+ export interface PrmPatternDetectedEvent {
94
+ type: 'prm_pattern_detected';
95
+ timestamp: string;
96
+ sessionId: string;
97
+ pattern: string;
98
+ severity: string;
99
+ category: string;
100
+ stepRange: [number, number];
101
+ }
102
+ export interface PrmCourseCorrectionInjectedEvent {
103
+ type: 'prm_course_correction_injected';
104
+ timestamp: string;
105
+ sessionId: string;
106
+ pattern: string;
107
+ level: number;
108
+ }
109
+ export interface PrmEscalationTriggeredEvent {
110
+ type: 'prm_escalation_triggered';
111
+ timestamp: string;
112
+ sessionId: string;
113
+ pattern: string;
114
+ level: number;
115
+ occurrenceCount: number;
116
+ }
117
+ export interface PrmHardStopEvent {
118
+ type: 'prm_hard_stop';
119
+ timestamp: string;
120
+ sessionId: string;
121
+ pattern: string;
122
+ level: number;
123
+ occurrenceCount: number;
124
+ }
125
+ export type V619Event = SoundingBoardConsultedEvent | ArchitectLoopDetectedEvent | PrecedentManipulationDetectedEvent | CoderSelfAuditEvent | CoderRetryCircuitBreakerEvent | AgentConflictDetectedEvent | AuthorityHandoffResolvedEvent | SpecStaleDetectedEvent | SpecDriftAcknowledgedEvent | PrmPatternDetectedEvent | PrmCourseCorrectionInjectedEvent | PrmEscalationTriggeredEvent | PrmHardStopEvent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "6.80.2",
3
+ "version": "6.81.1",
4
4
  "description": "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",