opencode-swarm 7.92.0 → 7.93.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,86 @@
1
+ /**
2
+ * Session reflection service — two-phase end-of-session architect review.
3
+ *
4
+ * Phase 1 (deterministic): Aggregate session signals — tool failures, gate
5
+ * rejections, error taxonomy, agent dispatches, retro lessons. No LLM, no
6
+ * quota, fast. Produces a structured snapshot the architect can reason over.
7
+ *
8
+ * Phase 2 (LLM): Feed the snapshot to the skill_improver agent (which acts
9
+ * as the architect's reflection delegate) to produce an actionable report:
10
+ * what skills to create/change, what problems were encountered, what tools
11
+ * didn't work, and what the swarm should learn for next time. The report is
12
+ * surfaced directly in the finalize output — not buried in an artifact.
13
+ *
14
+ * When no LLM client is available, phase 2 falls back to a deterministic
15
+ * summary so finalize never blocks on missing infrastructure.
16
+ */
17
+ import { type SkillImproverLLMDelegate } from '../hooks/skill-improver-llm-factory';
18
+ import type { ToolAggregate } from '../state';
19
+ export interface ToolProblem {
20
+ tool: string;
21
+ failureCount: number;
22
+ totalCalls: number;
23
+ failureRate: number;
24
+ avgDurationMs: number;
25
+ }
26
+ export interface AgentDispatchSummary {
27
+ agent: string;
28
+ delegationCount: number;
29
+ lastDelegationReason?: string;
30
+ }
31
+ export interface GateFailureSummary {
32
+ gate: string;
33
+ taskId: string;
34
+ count: number;
35
+ }
36
+ export interface SessionReflectionData {
37
+ timestamp: string;
38
+ totalToolCalls: number;
39
+ totalToolFailures: number;
40
+ toolProblems: ToolProblem[];
41
+ agentDispatches: AgentDispatchSummary[];
42
+ gateFailures: GateFailureSummary[];
43
+ lessonsFromRetros: string[];
44
+ errorTaxonomy: Record<string, number>;
45
+ }
46
+ export interface SessionReflectionResult {
47
+ data: SessionReflectionData;
48
+ architectReport: string;
49
+ source: 'llm' | 'deterministic';
50
+ }
51
+ declare function gatherToolProblems(toolAggregates: Map<string, ToolAggregate>): {
52
+ problems: ToolProblem[];
53
+ totalCalls: number;
54
+ totalFailures: number;
55
+ };
56
+ interface AgentSessionLike {
57
+ agentName: string;
58
+ lastDelegationReason?: string;
59
+ }
60
+ declare function gatherAgentDispatches(agentSessions: Map<string, AgentSessionLike>): AgentDispatchSummary[];
61
+ declare function gatherRetroLessonsAndTaxonomy(directory: string): Promise<{
62
+ lessons: string[];
63
+ taxonomy: Record<string, number>;
64
+ }>;
65
+ declare function gatherGateFailures(directory: string): Promise<GateFailureSummary[]>;
66
+ declare function buildReflectionDataSummary(data: SessionReflectionData): string;
67
+ declare function buildDeterministicReport(data: SessionReflectionData): string;
68
+ export interface SessionReflectionInput {
69
+ directory: string;
70
+ toolAggregates: Map<string, ToolAggregate>;
71
+ agentSessions: Map<string, AgentSessionLike>;
72
+ sessionId?: string;
73
+ signal?: AbortSignal;
74
+ delegate?: SkillImproverLLMDelegate;
75
+ }
76
+ export declare function runSessionReflection(input: SessionReflectionInput): Promise<SessionReflectionResult>;
77
+ export declare function writeSessionReflection(directory: string, result: SessionReflectionResult): Promise<string>;
78
+ export declare const _internals: {
79
+ gatherToolProblems: typeof gatherToolProblems;
80
+ gatherAgentDispatches: typeof gatherAgentDispatches;
81
+ gatherRetroLessonsAndTaxonomy: typeof gatherRetroLessonsAndTaxonomy;
82
+ gatherGateFailures: typeof gatherGateFailures;
83
+ buildReflectionDataSummary: typeof buildReflectionDataSummary;
84
+ buildDeterministicReport: typeof buildDeterministicReport;
85
+ };
86
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "7.92.0",
3
+ "version": "7.93.0",
4
4
  "description": "Architect-centric agentic swarm plugin for OpenCode - hub-and-spoke orchestration with SME consultation, code generation, and QA review",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",