opencode-swarm 7.41.1 → 7.43.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.
@@ -2,8 +2,8 @@ import type { ToolName } from '../tools/tool-names';
2
2
  export declare const QA_AGENTS: readonly ["reviewer", "critic", "critic_oversight"];
3
3
  export declare const PIPELINE_AGENTS: readonly ["explorer", "coder", "test_engineer"];
4
4
  export declare const ORCHESTRATOR_NAME: "architect";
5
- export declare const ALL_SUBAGENT_NAMES: readonly ["sme", "docs", "designer", "critic_sounding_board", "critic_drift_verifier", "critic_hallucination_verifier", "curator_init", "curator_phase", "council_generalist", "council_skeptic", "council_domain_expert", "skill_improver", "spec_writer", "reviewer", "critic", "critic_oversight", "explorer", "coder", "test_engineer"];
6
- export declare const ALL_AGENT_NAMES: readonly ["architect", "sme", "docs", "designer", "critic_sounding_board", "critic_drift_verifier", "critic_hallucination_verifier", "curator_init", "curator_phase", "council_generalist", "council_skeptic", "council_domain_expert", "skill_improver", "spec_writer", "reviewer", "critic", "critic_oversight", "explorer", "coder", "test_engineer"];
5
+ export declare const ALL_SUBAGENT_NAMES: readonly ["sme", "docs", "designer", "critic_sounding_board", "critic_drift_verifier", "critic_hallucination_verifier", "critic_architecture_supervisor", "curator_init", "curator_phase", "council_generalist", "council_skeptic", "council_domain_expert", "skill_improver", "spec_writer", "reviewer", "critic", "critic_oversight", "explorer", "coder", "test_engineer"];
6
+ export declare const ALL_AGENT_NAMES: readonly ["architect", "sme", "docs", "designer", "critic_sounding_board", "critic_drift_verifier", "critic_hallucination_verifier", "critic_architecture_supervisor", "curator_init", "curator_phase", "council_generalist", "council_skeptic", "council_domain_expert", "skill_improver", "spec_writer", "reviewer", "critic", "critic_oversight", "explorer", "coder", "test_engineer"];
7
7
  export declare const OPENCODE_NATIVE_AGENTS: Set<"compaction" | "title" | "build" | "general" | "plan" | "explore" | "summary">;
8
8
  export declare const CLAUDE_CODE_NATIVE_COMMANDS: ReadonlySet<string>;
9
9
  export type QAAgentName = (typeof QA_AGENTS)[number];
@@ -557,6 +557,30 @@ export declare const CuratorConfigSchema: z.ZodObject<{
557
557
  min_skill_confirmations: z.ZodDefault<z.ZodNumber>;
558
558
  }, z.core.$strip>;
559
559
  export type CuratorConfig = z.infer<typeof CuratorConfigSchema>;
560
+ /**
561
+ * Architectural supervision (issue #893): hierarchical summary review. Agents emit
562
+ * short structured summaries (summarize_work) that roll up per phase; an expensive
563
+ * read-only critic (critic_architecture_supervisor) reviews the compressed summaries to
564
+ * catch cross-task contradictions, drift, and repeated failure loops. The agent itself
565
+ * is configured via the normal critic override flow; this block configures the feature
566
+ * and the cheap aggregation pass (not an agent model).
567
+ */
568
+ export declare const ArchitecturalSupervisionConfigSchema: z.ZodObject<{
569
+ enabled: z.ZodDefault<z.ZodBoolean>;
570
+ mode: z.ZodDefault<z.ZodEnum<{
571
+ gate: "gate";
572
+ advisory: "advisory";
573
+ }>>;
574
+ run_on: z.ZodDefault<z.ZodEnum<{
575
+ phase_complete: "phase_complete";
576
+ }>>;
577
+ summary_model: z.ZodOptional<z.ZodString>;
578
+ max_agent_summary_words: z.ZodDefault<z.ZodNumber>;
579
+ max_phase_summary_words: z.ZodDefault<z.ZodNumber>;
580
+ allow_concerns_to_complete: z.ZodDefault<z.ZodBoolean>;
581
+ persist_knowledge_recommendations: z.ZodDefault<z.ZodBoolean>;
582
+ }, z.core.$strip>;
583
+ export type ArchitecturalSupervisionConfig = z.infer<typeof ArchitecturalSupervisionConfigSchema>;
560
584
  export declare const KnowledgeApplicationConfigSchema: z.ZodObject<{
561
585
  enabled: z.ZodDefault<z.ZodBoolean>;
562
586
  mode: z.ZodDefault<z.ZodEnum<{
@@ -566,6 +590,7 @@ export declare const KnowledgeApplicationConfigSchema: z.ZodObject<{
566
590
  min_confidence: z.ZodDefault<z.ZodNumber>;
567
591
  critical_requires_ack: z.ZodDefault<z.ZodBoolean>;
568
592
  require_skill_refs: z.ZodDefault<z.ZodBoolean>;
593
+ high_risk_tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
569
594
  }, z.core.$strip>;
570
595
  export type KnowledgeApplicationConfig = z.infer<typeof KnowledgeApplicationConfigSchema>;
571
596
  export declare const SkillImproverConfigSchema: z.ZodObject<{
@@ -1224,6 +1249,21 @@ export declare const PluginConfigSchema: z.ZodObject<{
1224
1249
  min_skill_confidence: z.ZodDefault<z.ZodNumber>;
1225
1250
  min_skill_confirmations: z.ZodDefault<z.ZodNumber>;
1226
1251
  }, z.core.$strip>>;
1252
+ architectural_supervision: z.ZodOptional<z.ZodObject<{
1253
+ enabled: z.ZodDefault<z.ZodBoolean>;
1254
+ mode: z.ZodDefault<z.ZodEnum<{
1255
+ gate: "gate";
1256
+ advisory: "advisory";
1257
+ }>>;
1258
+ run_on: z.ZodDefault<z.ZodEnum<{
1259
+ phase_complete: "phase_complete";
1260
+ }>>;
1261
+ summary_model: z.ZodOptional<z.ZodString>;
1262
+ max_agent_summary_words: z.ZodDefault<z.ZodNumber>;
1263
+ max_phase_summary_words: z.ZodDefault<z.ZodNumber>;
1264
+ allow_concerns_to_complete: z.ZodDefault<z.ZodBoolean>;
1265
+ persist_knowledge_recommendations: z.ZodDefault<z.ZodBoolean>;
1266
+ }, z.core.$strip>>;
1227
1267
  knowledge_application: z.ZodOptional<z.ZodObject<{
1228
1268
  enabled: z.ZodDefault<z.ZodBoolean>;
1229
1269
  mode: z.ZodDefault<z.ZodEnum<{
@@ -1233,6 +1273,7 @@ export declare const PluginConfigSchema: z.ZodObject<{
1233
1273
  min_confidence: z.ZodDefault<z.ZodNumber>;
1234
1274
  critical_requires_ack: z.ZodDefault<z.ZodBoolean>;
1235
1275
  require_skill_refs: z.ZodDefault<z.ZodBoolean>;
1276
+ high_risk_tools: z.ZodDefault<z.ZodArray<z.ZodString>>;
1236
1277
  }, z.core.$strip>>;
1237
1278
  skill_improver: z.ZodOptional<z.ZodObject<{
1238
1279
  enabled: z.ZodDefault<z.ZodBoolean>;
@@ -94,6 +94,8 @@ export interface CuratorPhaseResult {
94
94
  compliance: ComplianceObservation[];
95
95
  knowledge_recommendations: KnowledgeRecommendation[];
96
96
  summary_updated: boolean;
97
+ /** True when this phase was already digested in a prior call. */
98
+ already_digested?: boolean;
97
99
  /** v2: per-knowledge-entry application audit (applied/ignored/violated/n/a). */
98
100
  knowledge_application_findings?: KnowledgeApplicationFinding[];
99
101
  /** v2: candidate clusters the curator suggests compiling into SKILL.md. */
@@ -24,8 +24,11 @@
24
24
  * This dual dispatch means agent lists are incomplete — they capture factory-dispatched
25
25
  * curators but omit hook-dispatched ones. This is by design for hook-internal operations.
26
26
  */
27
+ import { listSkills, parseDraftFrontmatter, retireSkill } from '../services/skill-generator.js';
27
28
  import type { ComplianceObservation, CuratorConfig, CuratorInitResult, CuratorPhaseResult, CuratorSummary, KnowledgeRecommendation } from './curator-types.js';
29
+ import { readKnowledge } from './knowledge-store.js';
28
30
  import type { KnowledgeConfig } from './knowledge-types.js';
31
+ import { readSkillUsageEntries } from './skill-usage-log.js';
29
32
  /**
30
33
  * Optional LLM delegate callback type.
31
34
  * Takes a system prompt and user input, returns the LLM output text.
@@ -39,7 +42,22 @@ export declare const _internals: {
39
42
  filterPhaseEvents: typeof filterPhaseEvents;
40
43
  checkPhaseCompliance: typeof checkPhaseCompliance;
41
44
  normalizeAgentName: typeof normalizeAgentName;
45
+ autoRetireSkills: typeof autoRetireSkills;
46
+ readSkillUsageEntries: typeof readSkillUsageEntries;
47
+ listSkills: typeof listSkills;
48
+ parseDraftFrontmatter: typeof parseDraftFrontmatter;
49
+ retireSkill: typeof retireSkill;
50
+ readFileAsync: (filePath: string, encoding: string) => Promise<string>;
51
+ readKnowledge: typeof readKnowledge;
42
52
  };
53
+ /**
54
+ * Auto-retire generated skills whose violation rate exceeds 30% or
55
+ * whose source knowledge entries are all archived.
56
+ *
57
+ * Non-blocking: errors are caught and logged but never propagated.
58
+ * Returns an array of observation strings to include in the phase digest.
59
+ */
60
+ declare function autoRetireSkills(directory: string, curatorKnowledgePath: string): Promise<string[]>;
43
61
  /**
44
62
  * Parse OBSERVATIONS section from curator LLM output.
45
63
  * Expected format per line: "- entry <uuid> (<observable>): [text]"
@@ -65,6 +65,7 @@ export interface KnowledgeApplicationConfig {
65
65
  min_confidence: number;
66
66
  critical_requires_ack: boolean;
67
67
  require_skill_refs: boolean;
68
+ high_risk_tools?: string[];
68
69
  }
69
70
  export declare const DEFAULT_KNOWLEDGE_APPLICATION_CONFIG: KnowledgeApplicationConfig;
70
71
  export interface GateResult {
@@ -11,7 +11,9 @@ export declare function isWriteToEvidenceFile(input: unknown): boolean;
11
11
  */
12
12
  export declare function curateAndStoreSwarm(lessons: string[], projectName: string, phaseInfo: {
13
13
  phase_number: number;
14
- }, directory: string, config: KnowledgeConfig): Promise<{
14
+ }, directory: string, config: KnowledgeConfig, options?: {
15
+ skipAutoPromotion?: boolean;
16
+ }): Promise<{
15
17
  stored: number;
16
18
  skipped: number;
17
19
  rejected: number;
@@ -41,6 +41,26 @@ export declare function findNearDuplicate<T extends {
41
41
  }>(candidate: string, entries: T[], threshold?: number): T | undefined;
42
42
  export declare function computeConfidence(confirmedByCount: number, autoGenerated: boolean): number;
43
43
  export declare function inferTags(lesson: string): string[];
44
+ /**
45
+ * Batch-update confidence scores on knowledge entries identified by their UUIDs.
46
+ *
47
+ * For each delta, the function:
48
+ * 1. Searches the swarm knowledge file for an entry with the given `id`.
49
+ * 2. Falls back to the hive knowledge file if not found in swarm.
50
+ * 3. Clamps the resulting confidence to [0.1, 1.0].
51
+ * 4. Updates `confidence` and `updated_at`, then rewrites the file.
52
+ *
53
+ * The full read-modify-write cycle is atomic under a directory lock
54
+ * (same pattern as `enforceKnowledgeCap`). Errors are logged but never
55
+ * thrown — the function is fail-open.
56
+ *
57
+ * @param directory - Project root directory (used to resolve `.swarm/knowledge.jsonl`).
58
+ * @param deltas - Array of {id, delta} tuples. Delta may be positive (boost) or negative (decay).
59
+ */
60
+ export declare function bumpKnowledgeConfidenceBatch(directory: string, deltas: Array<{
61
+ id: string;
62
+ delta: number;
63
+ }>): Promise<void>;
44
64
  export declare const _internals: {
45
65
  getPlatformConfigDir: typeof getPlatformConfigDir;
46
66
  resolveSwarmKnowledgePath: typeof resolveSwarmKnowledgePath;
@@ -61,4 +81,5 @@ export declare const _internals: {
61
81
  findNearDuplicate: typeof findNearDuplicate;
62
82
  computeConfidence: typeof computeConfidence;
63
83
  inferTags: typeof inferTags;
84
+ bumpKnowledgeConfidenceBatch: typeof bumpKnowledgeConfidenceBatch;
64
85
  };
@@ -66,6 +66,9 @@ export declare const _internals: {
66
66
  openSync: typeof fs.openSync;
67
67
  readSync: typeof fs.readSync;
68
68
  closeSync: typeof fs.closeSync;
69
+ resolveSourceKnowledgeIds: typeof resolveSourceKnowledgeIds;
70
+ applySkillUsageFeedback: typeof applySkillUsageFeedback;
71
+ parseGeneratedFromKnowledge: typeof parseGeneratedFromKnowledge;
69
72
  };
70
73
  /**
71
74
  * Validate and append a single skill-usage entry to the JSONL log.
@@ -107,3 +110,48 @@ export declare function readSkillUsageEntriesTail(directory: string, filters: {
107
110
  * @returns Stats about how many entries were pruned and how many remain.
108
111
  */
109
112
  export declare function pruneSkillUsageLog(directory: string, maxEntriesPerSkill?: number): PruneResult;
113
+ /**
114
+ * Read a SKILL.md file and extract the `generated_from_knowledge` UUIDs
115
+ * from its YAML frontmatter.
116
+ *
117
+ * Expected frontmatter shape:
118
+ * ```yaml
119
+ * ---
120
+ * name: some-skill
121
+ * generated_from_knowledge:
122
+ * - uuid-1
123
+ * - uuid-2
124
+ * ---
125
+ * ```
126
+ *
127
+ * Returns an empty array if the file doesn't exist, has no frontmatter,
128
+ * or the `generated_from_knowledge` key is absent.
129
+ */
130
+ export declare function resolveSourceKnowledgeIds(directory: string, skillPath: string): Promise<string[]>;
131
+ /**
132
+ * Pure helper: parse `generated_from_knowledge:` YAML list from frontmatter.
133
+ * Uses a minimal regex-based parser — the SKILL.md format is well-known and narrow.
134
+ * Does NOT use a full YAML parser to avoid adding a dependency.
135
+ */
136
+ declare function parseGeneratedFromKnowledge(content: string): string[];
137
+ /**
138
+ * Read skill-usage entries, resolve source knowledge IDs for each skill,
139
+ * and apply confidence bumps/decays to the originating knowledge entries.
140
+ *
141
+ * For each unique skillPath with at least one compliance or violation entry:
142
+ * 1. Resolve source knowledge UUIDs from the skill's SKILL.md frontmatter.
143
+ * 2. Count compliant and violation events for that skill.
144
+ * 3. Compute net delta: if compliant count > violation count → +0.05; else → -0.1.
145
+ * 4. Call `bumpKnowledgeConfidenceBatch` with the aggregated deltas.
146
+ *
147
+ * @param directory - Project root directory.
148
+ * @param options.sinceTimestamp - Optional ISO 8601 cutoff; only process entries after this time.
149
+ * @returns Count of processed skills and total confidence bumps/decays applied.
150
+ */
151
+ export declare function applySkillUsageFeedback(directory: string, options?: {
152
+ sinceTimestamp?: string;
153
+ }): Promise<{
154
+ processed: number;
155
+ bumps: number;
156
+ }>;
157
+ export {};