opencode-swarm 7.91.1 → 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.
Files changed (30) hide show
  1. package/.opencode/skills/codebase-review-swarm/SKILL.md +3 -1
  2. package/.opencode/skills/council/SKILL.md +17 -12
  3. package/.opencode/skills/deep-dive/SKILL.md +12 -2
  4. package/.opencode/skills/swarm-pr-review/SKILL.md +5 -3
  5. package/dist/agents/explorer.d.ts +1 -1
  6. package/dist/background/candidate-parser.d.ts +1 -0
  7. package/dist/cli/{config-doctor-g04wdz19.js → config-doctor-fkwyrtpq.js} +2 -2
  8. package/dist/cli/{explorer-h2fnj343.js → explorer-4ttwy7jd.js} +1 -1
  9. package/dist/cli/{guardrail-explain-h2007ev1.js → guardrail-explain-656752j3.js} +6 -6
  10. package/dist/cli/{guardrail-log-m3285thy.js → guardrail-log-x3w800x5.js} +3 -3
  11. package/dist/cli/{index-bm4f0nme.js → index-1x2608ga.js} +30 -0
  12. package/dist/cli/{index-bywt2171.js → index-2jpbaedv.js} +1 -1
  13. package/dist/cli/{index-h1cjgz2r.js → index-mf31xkvd.js} +921 -581
  14. package/dist/cli/{index-6tnmt41c.js → index-ne4g3mk1.js} +1 -1
  15. package/dist/cli/{index-sxm9y9a5.js → index-rbx55am1.js} +2 -2
  16. package/dist/cli/{index-07qr9he0.js → index-rh24fcmy.js} +7 -7
  17. package/dist/cli/{index-123s7kjc.js → index-xsbtbffr.js} +4 -4
  18. package/dist/cli/{index-gg589mfw.js → index-yykcmn6m.js} +1 -1
  19. package/dist/cli/index.js +5 -5
  20. package/dist/cli/{schema-t9th7frq.js → schema-1kndsf0c.js} +1 -1
  21. package/dist/commands/close.d.ts +3 -0
  22. package/dist/config/constants.d.ts +1 -1
  23. package/dist/index.js +2288 -1832
  24. package/dist/services/session-reflection.d.ts +86 -0
  25. package/dist/tools/apply-patch.d.ts +7 -1
  26. package/dist/tools/dispatch-lanes.d.ts +2 -0
  27. package/dist/tools/index.d.ts +3 -3
  28. package/dist/tools/manifest.d.ts +1 -1
  29. package/dist/tools/tool-metadata.d.ts +1 -1
  30. package/package.json +1 -1
@@ -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 {};
@@ -45,4 +45,10 @@ export interface ApplyPatchArgs {
45
45
  allowCreates?: boolean;
46
46
  allowDeletes?: boolean;
47
47
  }
48
- export declare const applyPatch: ToolDefinition;
48
+ /**
49
+ * Swarm unified-diff patch tool (formerly registered as apply_patch).
50
+ * Renamed to swarm_apply_patch so it no longer shadows the native opencode
51
+ * apply_patch tool. The native tool handles *** Begin Patch / *** Update File
52
+ * style payloads; this tool handles standard unified diffs only.
53
+ */
54
+ export declare const swarmApplyPatch: ToolDefinition;
@@ -201,6 +201,7 @@ export declare const _internals: {
201
201
  };
202
202
  export declare const _test_exports: {
203
203
  applyCommonPrompt: typeof applyCommonPrompt;
204
+ applyExplorerFormatSuffix: typeof applyExplorerFormatSuffix;
204
205
  extractAssistantTranscript: typeof extractAssistantTranscript;
205
206
  formatError: typeof formatError;
206
207
  nextCollectPollInterval: typeof nextCollectPollInterval;
@@ -274,6 +275,7 @@ type ApplyCommonPromptResult = {
274
275
  * prompts when it is. Callers may treat the returned array as their own.
275
276
  */
276
277
  declare function applyCommonPrompt(lanes: DispatchLaneSpec[], commonPrompt: string | undefined): ApplyCommonPromptResult;
278
+ declare function applyExplorerFormatSuffix(lanes: DispatchLaneSpec[]): DispatchLaneSpec[];
277
279
  declare function formatError(error: unknown): string;
278
280
  declare function promptHash(lane: DispatchLaneSpec, directory: string, batchId: string): string;
279
281
  export declare const dispatch_lanes: ReturnType<typeof createSwarmTool>;
@@ -1,6 +1,6 @@
1
- import { applyPatch } from './apply-patch';
2
- export { applyPatch };
3
- export declare const apply_patch: typeof applyPatch;
1
+ import { swarmApplyPatch } from './apply-patch';
2
+ export { swarmApplyPatch };
3
+ export declare const swarm_apply_patch: typeof swarmApplyPatch;
4
4
  export { batch_symbols } from './batch-symbols';
5
5
  export { build_check } from './build-check';
6
6
  export { check_gate_status } from './check-gate-status';
@@ -112,7 +112,7 @@ export declare const TOOL_MANIFEST: {
112
112
  lean_turbo_review: () => ToolDefinition;
113
113
  lean_turbo_run_phase: () => ToolDefinition;
114
114
  lean_turbo_status: () => ToolDefinition;
115
- apply_patch: () => ToolDefinition;
115
+ swarm_apply_patch: () => ToolDefinition;
116
116
  external_skill_discover: () => ToolDefinition;
117
117
  external_skill_list: () => ToolDefinition;
118
118
  external_skill_inspect: () => ToolDefinition;
@@ -379,7 +379,7 @@ export declare const TOOL_METADATA: {
379
379
  description: string;
380
380
  agents: never[];
381
381
  };
382
- apply_patch: {
382
+ swarm_apply_patch: {
383
383
  description: string;
384
384
  agents: ("test_engineer" | "coder")[];
385
385
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm",
3
- "version": "7.91.1",
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",