opencode-swarm 7.79.4 → 7.79.6

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.
@@ -1 +1,5 @@
1
+ import { computeLearningMetrics } from '../services/learning-metrics.js';
1
2
  export declare function handleLearningCommand(directory: string, args: string[]): Promise<string>;
3
+ export declare const _internals: {
4
+ computeLearningMetrics: typeof computeLearningMetrics;
5
+ };
@@ -9,13 +9,13 @@ export interface CuratorSummary {
9
9
  session_id: string;
10
10
  last_updated: string;
11
11
  last_phase_covered: number;
12
- /** Running digest extended each phase, never regenerated */
12
+ /** Running digest rebuilt from the capped phase_digests projection */
13
13
  digest: string;
14
- /** Phase-level digests for lookup */
14
+ /** Phase-level digests for lookup, capped to the most recent phases */
15
15
  phase_digests: PhaseDigestEntry[];
16
16
  /** Accumulated compliance observations */
17
17
  compliance_observations: ComplianceObservation[];
18
- /** Knowledge update recommendations from the last curator run */
18
+ /** Accumulated knowledge update recommendations from curator runs */
19
19
  knowledge_recommendations: KnowledgeRecommendation[];
20
20
  }
21
21
  export interface PhaseDigestEntry {
@@ -100,12 +100,17 @@ export interface CuratorConfig {
100
100
  enabled: boolean;
101
101
  init_enabled: boolean;
102
102
  phase_enabled: boolean;
103
+ postmortem_enabled?: boolean;
103
104
  max_summary_tokens: number;
104
105
  min_knowledge_confidence: number;
105
106
  compliance_report: boolean;
106
107
  suppress_warnings: boolean;
107
108
  drift_inject_max_chars: number;
108
109
  llm_timeout_ms?: number;
110
+ skill_generation_enabled?: boolean;
111
+ skill_generation_mode?: 'draft' | 'active';
112
+ min_skill_confidence?: number;
113
+ min_skill_confirmations?: number;
109
114
  }
110
115
  export interface CuratorInitResult {
111
116
  briefing: string;
@@ -38,6 +38,7 @@ import { readSkillUsageEntries } from './skill-usage-log.js';
38
38
  export type CuratorLLMDelegate = (systemPrompt: string, userInput: string, signal?: AbortSignal) => Promise<string>;
39
39
  export declare const _internals: {
40
40
  parseKnowledgeRecommendations: typeof parseKnowledgeRecommendations;
41
+ parseKnowledgeRecommendationsWithDiagnostics: typeof parseKnowledgeRecommendationsWithDiagnostics;
41
42
  readCuratorSummary: typeof readCuratorSummary;
42
43
  writeCuratorSummary: typeof writeCuratorSummary;
43
44
  filterPhaseEvents: typeof filterPhaseEvents;
@@ -53,6 +54,11 @@ export declare const _internals: {
53
54
  reviseSkill: typeof reviseSkill;
54
55
  getSkillVersion: typeof getSkillVersion;
55
56
  };
57
+ export interface RecommendationParseDiagnostic {
58
+ section: 'OBSERVATIONS' | 'KNOWLEDGE_UPDATES';
59
+ line: string;
60
+ reason: string;
61
+ }
56
62
  /**
57
63
  * Auto-retire generated skills whose violation rate exceeds 30% or
58
64
  * whose source knowledge entries are all archived.
@@ -69,6 +75,10 @@ declare function autoRetireSkills(directory: string, curatorKnowledgePath: strin
69
75
  * Action hints are extracted from parenthetical directives like "(suggests boost confidence, mark hive_eligible)"
70
76
  */
71
77
  export declare function parseKnowledgeRecommendations(llmOutput: string): KnowledgeRecommendation[];
78
+ export declare function parseKnowledgeRecommendationsWithDiagnostics(llmOutput: string): {
79
+ recommendations: KnowledgeRecommendation[];
80
+ diagnostics: RecommendationParseDiagnostic[];
81
+ };
72
82
  /**
73
83
  * v2: Strict-JSON parser for the new curator output blocks.
74
84
  *
@@ -82,12 +92,19 @@ export declare function parseKnowledgeRecommendations(llmOutput: string): Knowle
82
92
  * [{ "slug": "...", "title": "...", ... }]
83
93
  * ```
84
94
  *
85
- * Malformed JSON or unexpected types are silently dropped: no knowledge or
86
- * skill writes happen when curator output is malformed.
95
+ * Malformed JSON or unexpected types are skipped with diagnostics: no knowledge
96
+ * or skill writes happen when curator output is malformed.
87
97
  */
98
+ export interface StructuredCuratorDiagnostic {
99
+ block: 'knowledge_application_findings' | 'skill_candidates';
100
+ reason: 'malformed_json' | 'expected_array' | 'invalid_finding' | 'invalid_skill_candidate';
101
+ index?: number;
102
+ detail?: string;
103
+ }
88
104
  export declare function parseStructuredCuratorBlocks(llmOutput: string): {
89
105
  findings: import('./curator-types.js').KnowledgeApplicationFinding[];
90
106
  candidates: import('./curator-types.js').SkillCandidate[];
107
+ diagnostics: StructuredCuratorDiagnostic[];
91
108
  };
92
109
  /**
93
110
  * Read curator summary from .swarm/curator-summary.json
@@ -156,7 +173,7 @@ export declare function runCuratorInit(directory: string, config: CuratorConfig,
156
173
  * @param llmDelegate - Optional LLM delegate for enhanced analysis
157
174
  * @returns CuratorPhaseResult with digest, compliance, and recommendations
158
175
  */
159
- export declare function runCuratorPhase(directory: string, phase: number, agentsDispatched: string[], config: CuratorConfig, _knowledgeConfig: {
176
+ export declare function runCuratorPhase(directory: string, phase: number, agentsDispatched: string[], config: CuratorConfig, knowledgeConfig: {
160
177
  directory?: string;
161
178
  }, llmDelegate?: CuratorLLMDelegate): Promise<CuratorPhaseResult>;
162
179
  /**
@@ -15,6 +15,7 @@ declare const seenRetroSections: Map<string, {
15
15
  declare function capSeenRetroSections(): void;
16
16
  /** Record a seen-section hash and enforce the size cap in one step. */
17
17
  declare function recordSeenRetroSection(key: string, value: string, timestamp: number): void;
18
+ declare function hashContent(content: string): string;
18
19
  /**
19
20
  * Check if the input is a write operation targeting an evidence file.
20
21
  * Exported for testing purposes only.
@@ -107,6 +108,7 @@ export declare const _internals: {
107
108
  createKnowledgeCuratorHook: typeof createKnowledgeCuratorHook;
108
109
  seenRetroSections: typeof seenRetroSections;
109
110
  recordSeenRetroSection: typeof recordSeenRetroSection;
111
+ hashContent: typeof hashContent;
110
112
  capSeenRetroSections: typeof capSeenRetroSections;
111
113
  MAX_TRACKED_RETRO_SECTIONS: number;
112
114
  };
@@ -12,6 +12,20 @@ export declare const DANGEROUS_COMMAND_PATTERNS: RegExp[];
12
12
  export declare const SECURITY_DEGRADING_PATTERNS: RegExp[];
13
13
  export declare const INVISIBLE_FORMAT_CHARS: RegExp;
14
14
  export declare const INJECTION_PATTERNS: RegExp[];
15
+ /**
16
+ * Extract context words around each occurrence of a target word (single tokens within a window).
17
+ * Context window is 3 words before and after, excluding the target word itself.
18
+ * Handles multi-word terms (e.g. "must not", "don't use") by scanning word slices.
19
+ *
20
+ * Note: this is an exact-word-match heuristic. Synonyms (e.g. "use" / "utilize")
21
+ * will not match across lessons. The 3-token window is bounded; more distant
22
+ * negation attachments will not be detected as contradictions.
23
+ */
24
+ declare function extractContextWords(text: string, word: string, contextWindow?: number): Set<string>;
25
+ /**
26
+ * Check if two sets of words have significant overlap (at least one word in common).
27
+ */
28
+ declare function hasSignificantOverlap(set1: Set<string>, set2: Set<string>): boolean;
15
29
  export declare function validateLesson(candidate: string, existingLessons: string[], meta: {
16
30
  category: KnowledgeCategory;
17
31
  scope: string;
@@ -90,4 +104,6 @@ export declare const _internals: {
90
104
  auditEntryHealth: typeof auditEntryHealth;
91
105
  quarantineEntry: typeof quarantineEntry;
92
106
  restoreEntry: typeof restoreEntry;
107
+ extractContextWords: typeof extractContextWords;
108
+ hasSignificantOverlap: typeof hasSignificantOverlap;
93
109
  };
@@ -58,6 +58,12 @@ export declare function createTrajectoryLoggerHook(config: Partial<TrajectoryCon
58
58
  * @param sessionId - Session identifier
59
59
  */
60
60
  export declare function resetTrajectoryStep(sessionId: string): void;
61
+ /**
62
+ * Clears trajectory step counters for one session, or all sessions when omitted.
63
+ *
64
+ * @param sessionId - Optional session identifier
65
+ */
66
+ export declare function clearTrajectoryStep(sessionId?: string): void;
61
67
  /**
62
68
  * Records the start time for a tool call (called from toolBefore).
63
69
  * Stored in a module-level Map for correlation with toolAfter.
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Module-level trajectory step counters shared by runtime reset code and the
3
+ * trajectory logger without creating a state <-> hook import cycle.
4
+ */
5
+ export declare function nextTrajectoryStep(sessionId: string): number;
6
+ export declare function resetTrajectoryStepCounter(sessionId: string): void;
7
+ export declare function clearTrajectoryStepCounters(sessionId?: string): void;
8
+ export declare const _test_exports: {
9
+ MAX_TRACKED_STEP_SESSIONS: number;
10
+ getTrackedStepSessionCount: () => number;
11
+ };