opencode-swarm 6.36.0 → 6.38.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.
@@ -5,7 +5,7 @@
5
5
  * Events flow through the system without external dependencies.
6
6
  */
7
7
  /** Automation event types */
8
- export type AutomationEventType = 'queue.item.enqueued' | 'queue.item.dequeued' | 'queue.item.completed' | 'queue.item.failed' | 'queue.item.retry scheduled' | 'worker.started' | 'worker.stopped' | 'worker.error' | 'circuit.breaker.opened' | 'circuit.breaker.half-open' | 'circuit.breaker.closed' | 'loop.protection.triggered' | 'automation.started' | 'automation.stopped' | 'preflight.requested' | 'preflight.triggered' | 'preflight.skipped' | 'preflight.completed' | 'phase.boundary.detected' | 'phase.status.checked' | 'task.completed' | 'evidence.summary.generated' | 'evidence.summary.error' | 'curator.init.completed' | 'curator.phase.completed' | 'curator.drift.completed' | 'curator.error';
8
+ export type AutomationEventType = 'queue.item.enqueued' | 'queue.item.dequeued' | 'queue.item.completed' | 'queue.item.failed' | 'queue.item.retry scheduled' | 'worker.started' | 'worker.stopped' | 'worker.error' | 'circuit.breaker.opened' | 'circuit.breaker.half-open' | 'circuit.breaker.closed' | 'loop.protection.triggered' | 'automation.started' | 'automation.stopped' | 'preflight.requested' | 'preflight.triggered' | 'preflight.skipped' | 'preflight.completed' | 'phase.boundary.detected' | 'phase.status.checked' | 'task.completed' | 'evidence.summary.generated' | 'evidence.summary.error' | 'curator.init.completed' | 'curator.init.llm_completed' | 'curator.init.llm_fallback' | 'curator.phase.completed' | 'curator.phase.llm_completed' | 'curator.phase.llm_fallback' | 'curator.drift.completed' | 'curator.error';
9
9
  /** Base automation event */
10
10
  export interface AutomationEvent<T = unknown> {
11
11
  type: AutomationEventType;
package/dist/cli/index.js CHANGED
@@ -18185,7 +18185,7 @@ var KnowledgeConfigSchema = exports_external.object({
18185
18185
  max_encounter_score: exports_external.number().min(1).max(20).default(10)
18186
18186
  });
18187
18187
  var CuratorConfigSchema = exports_external.object({
18188
- enabled: exports_external.boolean().default(false),
18188
+ enabled: exports_external.boolean().default(true),
18189
18189
  init_enabled: exports_external.boolean().default(true),
18190
18190
  phase_enabled: exports_external.boolean().default(true),
18191
18191
  max_summary_tokens: exports_external.number().min(500).max(8000).default(2000),
@@ -36582,7 +36582,7 @@ function isExcluded(entry, relPath, exactNames, globPatterns) {
36582
36582
  return false;
36583
36583
  }
36584
36584
  function containsControlChars(str) {
36585
- return /[\0\r]/.test(str);
36585
+ return /[\0\t\r\n]/.test(str);
36586
36586
  }
36587
36587
  function validateDirectoryInput(dir) {
36588
36588
  if (!dir || dir.length === 0) {
@@ -38,4 +38,13 @@ export declare function handleDebuggingSpiral(match: AdversarialPatternMatch, ta
38
38
  checkpointCreated: boolean;
39
39
  message: string;
40
40
  }>;
41
+ /**
42
+ * Record a tool call for debugging spiral detection.
43
+ * Call this from toolAfter to track repetitive patterns.
44
+ */
45
+ export declare function recordToolCall(tool: string, args: unknown): void;
46
+ /**
47
+ * Detect debugging spiral: same tool called 5+ times in a row with similar args
48
+ * within a 5-minute window. Indicates the agent is stuck in a loop.
49
+ */
41
50
  export declare function detectDebuggingSpiral(_directory: string): Promise<AdversarialPatternMatch | null>;
@@ -2,9 +2,25 @@
2
2
  * Curator core — file I/O for curator summary persistence.
3
3
  * Extended incrementally: filterPhaseEvents, checkPhaseCompliance,
4
4
  * runCuratorInit, runCuratorPhase, applyCuratorKnowledgeUpdates added in subsequent tasks.
5
+ *
6
+ * LLM delegation: runCuratorPhase and runCuratorInit accept an optional llmDelegate
7
+ * callback for LLM-based analysis. When provided, the prepared data context is sent
8
+ * to the explorer agent in CURATOR_PHASE/CURATOR_INIT mode for richer analysis.
9
+ * When the delegate is absent or fails, falls back to data-only behavior.
5
10
  */
6
11
  import type { ComplianceObservation, CuratorConfig, CuratorInitResult, CuratorPhaseResult, CuratorSummary, KnowledgeRecommendation } from './curator-types.js';
7
12
  import type { KnowledgeConfig } from './knowledge-types.js';
13
+ /**
14
+ * Optional LLM delegate callback type.
15
+ * Takes a system prompt and user input, returns the LLM output text.
16
+ * Used to delegate analysis to the explorer agent in CURATOR mode.
17
+ */
18
+ export type CuratorLLMDelegate = (systemPrompt: string, userInput: string) => Promise<string>;
19
+ /**
20
+ * Parse KNOWLEDGE_UPDATES section from curator LLM output.
21
+ * Expected format per line: "- [action] [entry_id or "new"]: [reason]"
22
+ */
23
+ export declare function parseKnowledgeRecommendations(llmOutput: string): KnowledgeRecommendation[];
8
24
  /**
9
25
  * Read curator summary from .swarm/curator-summary.json
10
26
  * @param directory - The workspace directory
@@ -36,26 +52,29 @@ export declare function filterPhaseEvents(eventsJsonl: string, phase: number, si
36
52
  export declare function checkPhaseCompliance(phaseEvents: object[], agentsDispatched: string[], requiredAgents: string[], phase: number): ComplianceObservation[];
37
53
  /**
38
54
  * Prepare curator init data: reads prior summary, knowledge entries, and context.md.
39
- * Returns a structured briefing result. Does NOT make LLM calls.
40
- * The caller (phase-monitor integration) is responsible for the actual agent delegation.
55
+ * When an llmDelegate is provided, delegates to the explorer agent in CURATOR_INIT mode
56
+ * for LLM-based analysis that enhances the data-only briefing.
41
57
  * @param directory - The workspace directory
42
58
  * @param config - Curator configuration
59
+ * @param llmDelegate - Optional LLM delegate for enhanced analysis
43
60
  * @returns CuratorInitResult with briefing text, contradictions, and stats
44
61
  */
45
- export declare function runCuratorInit(directory: string, config: CuratorConfig): Promise<CuratorInitResult>;
62
+ export declare function runCuratorInit(directory: string, config: CuratorConfig, llmDelegate?: CuratorLLMDelegate): Promise<CuratorInitResult>;
46
63
  /**
47
64
  * Run curator phase analysis: reads events, runs compliance, updates and writes summary.
48
- * Does NOT make LLM calls. The caller is responsible for agent delegation.
65
+ * When an llmDelegate is provided, delegates to the explorer agent in CURATOR_PHASE mode
66
+ * for LLM-based architectural drift analysis and knowledge recommendations.
49
67
  * @param directory - The workspace directory
50
68
  * @param phase - The phase number that just completed
51
69
  * @param agentsDispatched - List of agent names dispatched in this phase
52
70
  * @param config - Curator configuration
53
71
  * @param knowledgeConfig - Knowledge configuration (used for knowledge path resolution)
72
+ * @param llmDelegate - Optional LLM delegate for enhanced analysis
54
73
  * @returns CuratorPhaseResult with digest, compliance, and recommendations
55
74
  */
56
75
  export declare function runCuratorPhase(directory: string, phase: number, agentsDispatched: string[], _config: CuratorConfig, _knowledgeConfig: {
57
76
  directory?: string;
58
- }): Promise<CuratorPhaseResult>;
77
+ }, llmDelegate?: CuratorLLMDelegate): Promise<CuratorPhaseResult>;
59
78
  /**
60
79
  * Apply curator knowledge recommendations: promote, archive, or flag contradictions.
61
80
  * Uses readKnowledge + rewriteKnowledge pattern for atomic updates.
@@ -50,6 +50,13 @@ export declare function createDelegationGateHook(config: PluginConfig, directory
50
50
  messagesTransform: (input: Record<string, never>, output: {
51
51
  messages?: MessageWithParts[];
52
52
  }) => Promise<void>;
53
+ toolBefore: (input: {
54
+ tool: string;
55
+ sessionID: string;
56
+ callID: string;
57
+ }, output: {
58
+ args: unknown;
59
+ }) => Promise<void>;
53
60
  toolAfter: (input: {
54
61
  tool: string;
55
62
  sessionID: string;
@@ -6,9 +6,10 @@
6
6
  * Wrapped in safeHook — errors must never propagate.
7
7
  */
8
8
  import type { PreflightTriggerManager } from '../background/trigger';
9
+ import { type CuratorLLMDelegate } from './curator';
9
10
  import type { CuratorConfig, CuratorInitResult } from './curator-types';
10
11
  /** Injectable curator runner type — allows test injection without module mocking. */
11
- export type CuratorInitRunner = (directory: string, config: CuratorConfig) => Promise<CuratorInitResult>;
12
+ export type CuratorInitRunner = (directory: string, config: CuratorConfig, llmDelegate?: CuratorLLMDelegate) => Promise<CuratorInitResult>;
12
13
  /**
13
14
  * Creates a hook that monitors plan phase transitions and triggers preflight.
14
15
  *