opencode-swarm 7.70.0 → 7.71.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,7 +16,33 @@ export { formatCourseCorrectionForInjection, generateCourseCorrection, } from '.
16
16
  export { createDefaultEscalationState, EscalationTracker } from './escalation';
17
17
  export { detectContextThrash, detectExpansionDrift, detectPatterns, detectPingPong, detectRepetitionLoop, detectStuckOnTest, } from './pattern-detector';
18
18
  export type { CourseCorrection, EscalationState, PatternDetectionResult, PatternMatch, PatternSeverity, PatternType, PrmConfig, TaxonomyCategory, TrajectoryEntry, } from './types';
19
+ import { getAgentSession } from '../state';
20
+ import { telemetry } from '../telemetry';
21
+ import { formatCourseCorrectionForInjection, generateCourseCorrection } from './course-correction';
22
+ import { detectPatterns } from './pattern-detector';
23
+ import { recordReplayEntry, startReplayRecording } from './replay';
24
+ import { cleanupOldTrajectoryFiles, getInMemoryTrajectory, readTrajectory } from './trajectory-store';
19
25
  import type { PrmConfig } from './types';
26
+ /**
27
+ * Test-only dependency-injection seam — see `gitignore-warning.ts:_internals`.
28
+ *
29
+ * Production code calls `_internals.fn(...)` so tests can replace each
30
+ * function on this object without touching the real module. `vi.spyOn` from
31
+ * `bun:test` leaks across files in Bun's shared test-runner process, which
32
+ * would corrupt unrelated suites that import the same modules.
33
+ */
34
+ export declare const _internals: {
35
+ getAgentSession: typeof getAgentSession;
36
+ readTrajectory: typeof readTrajectory;
37
+ getInMemoryTrajectory: typeof getInMemoryTrajectory;
38
+ detectPatterns: typeof detectPatterns;
39
+ generateCourseCorrection: typeof generateCourseCorrection;
40
+ formatCourseCorrectionForInjection: typeof formatCourseCorrectionForInjection;
41
+ cleanupOldTrajectoryFiles: typeof cleanupOldTrajectoryFiles;
42
+ recordReplayEntry: typeof recordReplayEntry;
43
+ startReplayRecording: typeof startReplayRecording;
44
+ telemetry: typeof telemetry;
45
+ };
20
46
  /**
21
47
  * Context passed to toolAfter handler
22
48
  */
package/dist/state.d.ts CHANGED
@@ -310,6 +310,7 @@ export declare const swarmState: {
310
310
  * name at call time by matching the active session's agent prefix. */
311
311
  curatorInitAgentNames: string[];
312
312
  curatorPhaseAgentNames: string[];
313
+ curatorPostmortemAgentNames: string[];
313
314
  /** All registered skill_improver / spec_writer agent names across swarms,
314
315
  * mirroring curatorInitAgentNames so the LLM delegate factory can resolve
315
316
  * the correct prefixed agent under multi-swarm configs. */
@@ -356,18 +357,18 @@ export declare const swarmState: {
356
357
  */
357
358
  export declare function resetSwarmState(): void;
358
359
  /**
359
- * Reset swarm state while preserving the 7 module-scoped singletons that are
360
+ * Reset swarm state while preserving the 8 module-scoped singletons that are
360
361
  * populated once at plugin init and must survive a /swarm close + re-init
361
362
  * within the same process lifetime.
362
363
  *
363
364
  * The preserved fields are:
364
365
  * - opencodeClient (SDK client for curator/full-auto delegation)
365
366
  * - fullAutoEnabledInConfig (config flag read at init)
366
- * - curatorInitAgentNames, curatorPhaseAgentNames (curator registry)
367
+ * - curatorInitAgentNames, curatorPhaseAgentNames, curatorPostmortemAgentNames (curator registry)
367
368
  * - skillImproverAgentNames, specWriterAgentNames (skill/spec registry)
368
369
  * - generatedAgentNames (full-auto delegation guard registry)
369
370
  *
370
- * Implementation: save all 7 to locals, call resetSwarmState(), restore all 7.
371
+ * Implementation: save all 8 to locals, call resetSwarmState(), restore all 8.
371
372
  * Synchronous (matches resetSwarmState contract). Errors from resetSwarmState
372
373
  * propagate to caller (no try/catch wrapper).
373
374
  */
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Shared preamble helpers for QA-gate modules.
3
+ *
4
+ * Multiple gates (mutation, hallucination, drift, phase-council, final-council)
5
+ * repeat the same loadPlan → derivePlanId → getProfile → resolve session
6
+ * overrides → getEffectiveGates sequence. This module extracts that
7
+ * preamble into a single reusable function so each gate only contains its
8
+ * unique verdict logic.
9
+ */
10
+ import type { RuntimePlan } from '../../../config/plan-schema';
11
+ import type { QaGates } from '../../../db/qa-gate-profile.js';
12
+ /**
13
+ * Result of resolving the shared QA-gate preamble.
14
+ *
15
+ * - `resolved === false` → plan or profile could not be loaded.
16
+ * Gates that default to *disabled* when the
17
+ * preamble fails should return pass-through.
18
+ * - `resolved === true` → `plan`, `profile`, and `effectiveGates`
19
+ * are all populated and the gate can inspect
20
+ * the flag it cares about.
21
+ */
22
+ export interface GatePreambleResult {
23
+ resolved: boolean;
24
+ plan?: RuntimePlan;
25
+ effectiveGates?: QaGates;
26
+ }
27
+ /**
28
+ * Load the plan, derive its identity, look up the QA-gate profile, resolve
29
+ * any session-level overrides, and compute the effective gate flags.
30
+ *
31
+ * Returns `{ resolved: false }` for expected soft-failure cases (plan or
32
+ * profile missing). Unexpected errors (e.g. JSON parse errors, file
33
+ * system errors) are allowed to propagate so that each gate's outer
34
+ * catch block can report them with gate-specific diagnostics via
35
+ * `safeWarn()`.
36
+ */
37
+ export declare function resolveGatePreamble(dir: string, sessionID: string | undefined): Promise<GatePreambleResult>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "7.70.0",
3
+ "version": "7.71.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",