opencode-swarm 7.70.0 → 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];
@@ -617,6 +617,7 @@ export declare const CuratorConfigSchema: z.ZodObject<{
617
617
  enabled: z.ZodDefault<z.ZodBoolean>;
618
618
  init_enabled: z.ZodDefault<z.ZodBoolean>;
619
619
  phase_enabled: z.ZodDefault<z.ZodBoolean>;
620
+ postmortem_enabled: z.ZodDefault<z.ZodBoolean>;
620
621
  max_summary_tokens: z.ZodDefault<z.ZodNumber>;
621
622
  min_knowledge_confidence: z.ZodDefault<z.ZodNumber>;
622
623
  compliance_report: z.ZodDefault<z.ZodBoolean>;
@@ -1597,6 +1598,7 @@ export declare const PluginConfigSchema: z.ZodObject<{
1597
1598
  enabled: z.ZodDefault<z.ZodBoolean>;
1598
1599
  init_enabled: z.ZodDefault<z.ZodBoolean>;
1599
1600
  phase_enabled: z.ZodDefault<z.ZodBoolean>;
1601
+ postmortem_enabled: z.ZodDefault<z.ZodBoolean>;
1600
1602
  max_summary_tokens: z.ZodDefault<z.ZodNumber>;
1601
1603
  min_knowledge_confidence: z.ZodDefault<z.ZodNumber>;
1602
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
  };