opencode-swarm 7.69.1 → 7.71.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.
@@ -0,0 +1,3 @@
1
+ export declare function handlePostMortemCommand(directory: string, args: string[], options?: {
2
+ sessionID?: string;
3
+ }): Promise<string>;
@@ -264,6 +264,13 @@ export declare const COMMAND_REGISTRY: {
264
264
  readonly aliasOf: "finalize";
265
265
  readonly deprecated: true;
266
266
  };
267
+ readonly 'post-mortem': {
268
+ readonly handler: (ctx: CommandContext) => Promise<string>;
269
+ readonly description: "Run the post-mortem agent: project-end synthesis, queue triage, and final curation pass";
270
+ readonly details: "Reads .swarm/ evidence (knowledge entries, events, curator digests, proposals, retrospectives, drift reports) and produces a post-mortem report at .swarm/post-mortem-{planId}.md. Idempotent: re-runs skip if report exists unless --force is passed.";
271
+ readonly args: "--force";
272
+ readonly category: "core";
273
+ };
267
274
  readonly concurrency: {
268
275
  readonly handler: (ctx: CommandContext) => Promise<string>;
269
276
  readonly description: "Manage runtime concurrency override for plan execution [set|status|reset]";
@@ -12,8 +12,8 @@
12
12
  export declare const QA_AGENTS: readonly ["reviewer", "critic", "critic_oversight"];
13
13
  export declare const PIPELINE_AGENTS: readonly ["explorer", "coder", "test_engineer"];
14
14
  export declare const ORCHESTRATOR_NAME: "architect";
15
- export declare const ALL_SUBAGENT_NAMES: readonly ["sme", "docs", "docs_design", "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"];
16
- export declare const ALL_AGENT_NAMES: readonly ["architect", "sme", "docs", "docs_design", "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"];
15
+ export declare const ALL_SUBAGENT_NAMES: readonly ["sme", "docs", "docs_design", "designer", "critic_sounding_board", "critic_drift_verifier", "critic_hallucination_verifier", "critic_architecture_supervisor", "curator_init", "curator_phase", "curator_postmortem", "council_generalist", "council_skeptic", "council_domain_expert", "skill_improver", "spec_writer", "reviewer", "critic", "critic_oversight", "explorer", "coder", "test_engineer"];
16
+ export declare const ALL_AGENT_NAMES: readonly ["architect", "sme", "docs", "docs_design", "designer", "critic_sounding_board", "critic_drift_verifier", "critic_hallucination_verifier", "critic_architecture_supervisor", "curator_init", "curator_phase", "curator_postmortem", "council_generalist", "council_skeptic", "council_domain_expert", "skill_improver", "spec_writer", "reviewer", "critic", "critic_oversight", "explorer", "coder", "test_engineer"];
17
17
  export type QAAgentName = (typeof QA_AGENTS)[number];
18
18
  export type PipelineAgentName = (typeof PIPELINE_AGENTS)[number];
19
19
  export type AgentName = (typeof ALL_AGENT_NAMES)[number];
@@ -66,12 +66,44 @@ export declare function resolveGeneratedAgentRole(agentName: string, generatedAg
66
66
  * extractor matches.
67
67
  */
68
68
  export declare function stripKnownSwarmPrefix(agentName: string): string;
69
+ export declare const AgentReasoningConfigSchema: z.ZodObject<{
70
+ effort: z.ZodOptional<z.ZodEnum<{
71
+ low: "low";
72
+ medium: "medium";
73
+ high: "high";
74
+ max: "max";
75
+ }>>;
76
+ }, z.core.$strip>;
77
+ export type AgentReasoningConfig = z.infer<typeof AgentReasoningConfigSchema>;
78
+ export declare const AgentThinkingConfigSchema: z.ZodObject<{
79
+ type: z.ZodOptional<z.ZodEnum<{
80
+ enabled: "enabled";
81
+ disabled: "disabled";
82
+ }>>;
83
+ budget_tokens: z.ZodOptional<z.ZodNumber>;
84
+ }, z.core.$strip>;
85
+ export type AgentThinkingConfig = z.infer<typeof AgentThinkingConfigSchema>;
69
86
  export declare const AgentOverrideConfigSchema: z.ZodObject<{
70
87
  model: z.ZodOptional<z.ZodString>;
71
88
  variant: z.ZodOptional<z.ZodString>;
72
89
  temperature: z.ZodOptional<z.ZodNumber>;
73
90
  disabled: z.ZodOptional<z.ZodBoolean>;
74
91
  fallback_models: z.ZodOptional<z.ZodArray<z.ZodString>>;
92
+ reasoning: z.ZodOptional<z.ZodObject<{
93
+ effort: z.ZodOptional<z.ZodEnum<{
94
+ low: "low";
95
+ medium: "medium";
96
+ high: "high";
97
+ max: "max";
98
+ }>>;
99
+ }, z.core.$strip>>;
100
+ thinking: z.ZodOptional<z.ZodObject<{
101
+ type: z.ZodOptional<z.ZodEnum<{
102
+ enabled: "enabled";
103
+ disabled: "disabled";
104
+ }>>;
105
+ budget_tokens: z.ZodOptional<z.ZodNumber>;
106
+ }, z.core.$strip>>;
75
107
  }, z.core.$strip>;
76
108
  export type AgentOverrideConfig = z.infer<typeof AgentOverrideConfigSchema>;
77
109
  export declare const SwarmConfigSchema: z.ZodObject<{
@@ -82,6 +114,21 @@ export declare const SwarmConfigSchema: z.ZodObject<{
82
114
  temperature: z.ZodOptional<z.ZodNumber>;
83
115
  disabled: z.ZodOptional<z.ZodBoolean>;
84
116
  fallback_models: z.ZodOptional<z.ZodArray<z.ZodString>>;
117
+ reasoning: z.ZodOptional<z.ZodObject<{
118
+ effort: z.ZodOptional<z.ZodEnum<{
119
+ low: "low";
120
+ medium: "medium";
121
+ high: "high";
122
+ max: "max";
123
+ }>>;
124
+ }, z.core.$strip>>;
125
+ thinking: z.ZodOptional<z.ZodObject<{
126
+ type: z.ZodOptional<z.ZodEnum<{
127
+ enabled: "enabled";
128
+ disabled: "disabled";
129
+ }>>;
130
+ budget_tokens: z.ZodOptional<z.ZodNumber>;
131
+ }, z.core.$strip>>;
85
132
  }, z.core.$strip>>>;
86
133
  }, z.core.$strip>;
87
134
  export type SwarmConfig = z.infer<typeof SwarmConfigSchema>;
@@ -570,6 +617,7 @@ export declare const CuratorConfigSchema: z.ZodObject<{
570
617
  enabled: z.ZodDefault<z.ZodBoolean>;
571
618
  init_enabled: z.ZodDefault<z.ZodBoolean>;
572
619
  phase_enabled: z.ZodDefault<z.ZodBoolean>;
620
+ postmortem_enabled: z.ZodDefault<z.ZodBoolean>;
573
621
  max_summary_tokens: z.ZodDefault<z.ZodNumber>;
574
622
  min_knowledge_confidence: z.ZodDefault<z.ZodNumber>;
575
623
  compliance_report: z.ZodDefault<z.ZodBoolean>;
@@ -1146,6 +1194,21 @@ export declare const PluginConfigSchema: z.ZodObject<{
1146
1194
  temperature: z.ZodOptional<z.ZodNumber>;
1147
1195
  disabled: z.ZodOptional<z.ZodBoolean>;
1148
1196
  fallback_models: z.ZodOptional<z.ZodArray<z.ZodString>>;
1197
+ reasoning: z.ZodOptional<z.ZodObject<{
1198
+ effort: z.ZodOptional<z.ZodEnum<{
1199
+ low: "low";
1200
+ medium: "medium";
1201
+ high: "high";
1202
+ max: "max";
1203
+ }>>;
1204
+ }, z.core.$strip>>;
1205
+ thinking: z.ZodOptional<z.ZodObject<{
1206
+ type: z.ZodOptional<z.ZodEnum<{
1207
+ enabled: "enabled";
1208
+ disabled: "disabled";
1209
+ }>>;
1210
+ budget_tokens: z.ZodOptional<z.ZodNumber>;
1211
+ }, z.core.$strip>>;
1149
1212
  }, z.core.$strip>>>;
1150
1213
  default_agent: z.ZodPipe<z.ZodOptional<z.ZodString>, z.ZodTransform<string | undefined, string | undefined>>;
1151
1214
  auto_select_architect: z.ZodPipe<z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>, z.ZodTransform<string | boolean | undefined, string | boolean | undefined>>;
@@ -1157,6 +1220,21 @@ export declare const PluginConfigSchema: z.ZodObject<{
1157
1220
  temperature: z.ZodOptional<z.ZodNumber>;
1158
1221
  disabled: z.ZodOptional<z.ZodBoolean>;
1159
1222
  fallback_models: z.ZodOptional<z.ZodArray<z.ZodString>>;
1223
+ reasoning: z.ZodOptional<z.ZodObject<{
1224
+ effort: z.ZodOptional<z.ZodEnum<{
1225
+ low: "low";
1226
+ medium: "medium";
1227
+ high: "high";
1228
+ max: "max";
1229
+ }>>;
1230
+ }, z.core.$strip>>;
1231
+ thinking: z.ZodOptional<z.ZodObject<{
1232
+ type: z.ZodOptional<z.ZodEnum<{
1233
+ enabled: "enabled";
1234
+ disabled: "disabled";
1235
+ }>>;
1236
+ budget_tokens: z.ZodOptional<z.ZodNumber>;
1237
+ }, z.core.$strip>>;
1160
1238
  }, z.core.$strip>>>;
1161
1239
  }, z.core.$strip>>>;
1162
1240
  max_iterations: z.ZodDefault<z.ZodNumber>;
@@ -1520,6 +1598,7 @@ export declare const PluginConfigSchema: z.ZodObject<{
1520
1598
  enabled: z.ZodDefault<z.ZodBoolean>;
1521
1599
  init_enabled: z.ZodDefault<z.ZodBoolean>;
1522
1600
  phase_enabled: z.ZodDefault<z.ZodBoolean>;
1601
+ postmortem_enabled: z.ZodDefault<z.ZodBoolean>;
1523
1602
  max_summary_tokens: z.ZodDefault<z.ZodNumber>;
1524
1603
  min_knowledge_confidence: z.ZodDefault<z.ZodNumber>;
1525
1604
  compliance_report: z.ZodDefault<z.ZodBoolean>;
@@ -7,8 +7,9 @@ import type { CuratorLLMDelegate } from './curator.js';
7
7
  * re-entrancy with the current session's message flow.
8
8
  *
9
9
  * The `mode` parameter determines which registered named agent is used:
10
- * - 'init' → curator_init (e.g. 'curator_init' or 'swarm1_curator_init')
11
- * - 'phase' → curator_phase (e.g. 'curator_phase' or 'swarm1_curator_phase')
10
+ * - 'init' → curator_init (e.g. 'curator_init' or 'swarm1_curator_init')
11
+ * - 'phase' → curator_phase (e.g. 'curator_phase' or 'swarm1_curator_phase')
12
+ * - 'postmortem' → curator_postmortem (e.g. 'curator_postmortem' or 'swarm1_curator_postmortem')
12
13
  *
13
14
  * The optional `sessionId` parameter enables deterministic swarm resolution:
14
15
  * when provided, the factory uses the calling session's registered agent to
@@ -17,4 +18,4 @@ import type { CuratorLLMDelegate } from './curator.js';
17
18
  *
18
19
  * Returns undefined if swarmState.opencodeClient is not set (e.g. in unit tests).
19
20
  */
20
- export declare function createCuratorLLMDelegate(directory: string, mode?: 'init' | 'phase', sessionId?: string): CuratorLLMDelegate | undefined;
21
+ export declare function createCuratorLLMDelegate(directory: string, mode?: 'init' | 'phase' | 'postmortem', sessionId?: string): CuratorLLMDelegate | undefined;
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Curator post-mortem — project-end synthesis agent (WP7, issue #1234).
3
+ *
4
+ * Reads structured .swarm/ evidence (knowledge entries, events, curator digests,
5
+ * pending proposals, retrospectives, drift reports) and produces a post-mortem
6
+ * report with: improvement agenda, final curation pass, queue triage, and
7
+ * learning metrics summary.
8
+ *
9
+ * Triggers: phase_complete plan completion, /swarm finalize, /swarm post-mortem.
10
+ * Fail-open: errors never block finalize or phase completion.
11
+ * Outputs route through existing gated paths (knowledge_add, skill proposals,
12
+ * hive promotion) — no new ungated injection source.
13
+ */
14
+ import type { CuratorLLMDelegate } from './curator.js';
15
+ export interface PostMortemResult {
16
+ success: boolean;
17
+ planId: string | null;
18
+ reportPath: string | null;
19
+ summary: string | null;
20
+ warnings: string[];
21
+ }
22
+ export interface PostMortemOptions {
23
+ llmDelegate?: CuratorLLMDelegate;
24
+ force?: boolean;
25
+ }
26
+ interface KnowledgeEventSummary {
27
+ id: string;
28
+ lesson: string;
29
+ applied: number;
30
+ violated: number;
31
+ ignored: number;
32
+ confidence: number;
33
+ status: string;
34
+ }
35
+ declare function collectKnowledgeSummary(directory: string): Promise<KnowledgeEventSummary[]>;
36
+ declare function readJsonlFile(filePath: string): unknown[];
37
+ declare function collectRetrospectives(directory: string): string[];
38
+ declare function collectDriftReports(directory: string): string[];
39
+ declare function collectPendingProposals(directory: string): Array<{
40
+ source: string;
41
+ content: string;
42
+ }>;
43
+ declare function buildDataOnlyReport(planId: string, planSummary: string, knowledgeSummary: KnowledgeEventSummary[], curatorDigest: string | null, proposals: Array<{
44
+ source: string;
45
+ content: string;
46
+ }>, unactionable: unknown[], retrospectives: string[], driftReports: string[]): string;
47
+ declare function assembleLLMInput(planId: string, planSummary: string, knowledgeSummary: KnowledgeEventSummary[], curatorDigest: string | null, proposals: Array<{
48
+ source: string;
49
+ content: string;
50
+ }>, unactionable: unknown[], retrospectives: string[], driftReports: string[]): string;
51
+ export declare function runCuratorPostMortem(directory: string, options?: PostMortemOptions): Promise<PostMortemResult>;
52
+ export declare const _internals: {
53
+ collectKnowledgeSummary: typeof collectKnowledgeSummary;
54
+ collectRetrospectives: typeof collectRetrospectives;
55
+ collectDriftReports: typeof collectDriftReports;
56
+ collectPendingProposals: typeof collectPendingProposals;
57
+ readJsonlFile: typeof readJsonlFile;
58
+ buildDataOnlyReport: typeof buildDataOnlyReport;
59
+ assembleLLMInput: typeof assembleLLMInput;
60
+ };
61
+ export {};
@@ -257,6 +257,23 @@ export declare function countEntryViolationsInWindow(directory: string, entryId:
257
257
  export declare function readKnowledgeCounterRollups(directory: string): Promise<Map<string, CounterRollup>>;
258
258
  /** Merge event-derived rollups over stored outcome counters for scoring only. */
259
259
  export declare function effectiveRetrievalOutcomes(stored: RetrievalOutcome | undefined, rollup: CounterRollup | undefined): RetrievalOutcome;
260
+ /**
261
+ * Read receipt events (applied/violated/ignored), aggregate per knowledge entry,
262
+ * and apply bounded confidence deltas via `bumpKnowledgeConfidenceBatch`.
263
+ *
264
+ * Complements `applySkillUsageFeedback` (skill-usage-log.ts) which bridges
265
+ * skill compliance → confidence. This function bridges raw knowledge verdict
266
+ * events → confidence, closing the loop where `entry.confidence` was static
267
+ * after creation regardless of how often the entry was applied or violated.
268
+ *
269
+ * Fail-open: errors are logged but never thrown.
270
+ */
271
+ export declare function applyKnowledgeVerdictFeedback(directory: string, options?: {
272
+ sinceTimestamp?: string;
273
+ }): Promise<{
274
+ processed: number;
275
+ bumps: number;
276
+ }>;
260
277
  export declare const _internals: {
261
278
  resolveKnowledgeEventsPath: typeof resolveKnowledgeEventsPath;
262
279
  appendKnowledgeEvent: typeof appendKnowledgeEvent;
@@ -266,6 +283,7 @@ export declare const _internals: {
266
283
  readKnowledgeCounterRollups: typeof readKnowledgeCounterRollups;
267
284
  effectiveRetrievalOutcomes: typeof effectiveRetrievalOutcomes;
268
285
  recomputeCounters: typeof recomputeCounters;
286
+ applyKnowledgeVerdictFeedback: typeof applyKnowledgeVerdictFeedback;
269
287
  newTraceId: typeof newTraceId;
270
288
  newEventId: typeof newEventId;
271
289
  };