opencode-swarm-plugin 0.42.9 → 0.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.
@@ -126,13 +126,13 @@ export declare const observabilityTools: {
126
126
  args: {
127
127
  sql: import("zod").ZodString;
128
128
  format: import("zod").ZodOptional<import("zod").ZodEnum<{
129
- json: "json";
130
129
  table: "table";
130
+ json: "json";
131
131
  }>>;
132
132
  };
133
133
  execute(args: {
134
134
  sql: string;
135
- format?: "json" | "table" | undefined;
135
+ format?: "table" | "json" | undefined;
136
136
  }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
137
137
  };
138
138
  swarm_diagnose: {
@@ -0,0 +1,59 @@
1
+ /**
2
+ * GREEN PHASE: SQL Query Tools Implementation
3
+ *
4
+ * Provides:
5
+ * - 10 preset queries for observability insights
6
+ * - Custom SQL execution with timing
7
+ * - 3 output formats: Table (box-drawing), CSV, JSON
8
+ */
9
+ import type { DatabaseAdapter } from "swarm-mail";
10
+ export type PresetQueryName = "failed_decompositions" | "duration_by_strategy" | "file_conflicts" | "worker_success_rate" | "review_rejections" | "blocked_tasks" | "agent_activity" | "event_frequency" | "error_patterns" | "compaction_stats";
11
+ export interface QueryResult {
12
+ columns: string[];
13
+ rows: Record<string, unknown>[];
14
+ rowCount: number;
15
+ executionTimeMs: number;
16
+ }
17
+ export declare const presetQueries: Record<PresetQueryName, string>;
18
+ /**
19
+ * Execute custom SQL against the events table.
20
+ *
21
+ * @param db - DatabaseAdapter instance
22
+ * @param sql - SQL query string
23
+ * @param params - Optional parameterized query values
24
+ * @returns QueryResult with rows, columns, timing
25
+ */
26
+ export declare function executeQuery(db: DatabaseAdapter, sql: string, params?: unknown[]): Promise<QueryResult>;
27
+ /**
28
+ * Format query result as aligned table with box-drawing characters.
29
+ *
30
+ * Example output:
31
+ * ┌──────────┬───────┐
32
+ * │ name │ count │
33
+ * ├──────────┼───────┤
34
+ * │ AgentA │ 5 │
35
+ * │ AgentB │ 3 │
36
+ * └──────────┴───────┘
37
+ * 2 rows in 5.2ms
38
+ */
39
+ export declare function formatAsTable(result: QueryResult): string;
40
+ /**
41
+ * Format query result as CSV with proper escaping.
42
+ *
43
+ * Escapes:
44
+ * - Commas → wrap in quotes
45
+ * - Quotes → double them
46
+ * - Newlines → wrap in quotes
47
+ */
48
+ export declare function formatAsCSV(result: QueryResult): string;
49
+ /**
50
+ * Format query result as pretty-printed JSON array.
51
+ *
52
+ * Example:
53
+ * [
54
+ * { "name": "AgentA", "count": 5 },
55
+ * { "name": "AgentB", "count": 3 }
56
+ * ]
57
+ */
58
+ export declare function formatAsJSON(result: QueryResult): string;
59
+ //# sourceMappingURL=query-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"query-tools.d.ts","sourceRoot":"","sources":["../src/query-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAMlD,MAAM,MAAM,eAAe,GACxB,uBAAuB,GACvB,sBAAsB,GACtB,gBAAgB,GAChB,qBAAqB,GACrB,mBAAmB,GACnB,eAAe,GACf,gBAAgB,GAChB,iBAAiB,GACjB,gBAAgB,GAChB,kBAAkB,CAAC;AAEtB,MAAM,WAAW,WAAW;IAC3B,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;CACxB;AAMD,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAoHzD,CAAC;AAMF;;;;;;;GAOG;AACH,wBAAsB,YAAY,CACjC,EAAE,EAAE,eAAe,EACnB,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,OAAO,EAAE,GAChB,OAAO,CAAC,WAAW,CAAC,CAiBtB;AAMD;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAkEzD;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CA2BvD;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAExD"}
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Replay Tools - Event replay with timing simulation
3
+ *
4
+ * TDD GREEN: Minimal implementation to pass tests
5
+ */
6
+ export type ReplaySpeed = "1x" | "2x" | "instant";
7
+ export interface ReplayEvent {
8
+ session_id: string;
9
+ epic_id: string;
10
+ timestamp: string;
11
+ event_type: "DECISION" | "VIOLATION" | "OUTCOME" | "COMPACTION";
12
+ decision_type?: string;
13
+ violation_type?: string;
14
+ outcome_type?: string;
15
+ payload: Record<string, unknown>;
16
+ delta_ms: number;
17
+ }
18
+ export interface ReplayFilter {
19
+ type?: Array<"DECISION" | "VIOLATION" | "OUTCOME" | "COMPACTION">;
20
+ agent?: string;
21
+ since?: Date;
22
+ until?: Date;
23
+ }
24
+ export declare function fetchEpicEvents(epicId: string, sessionFile: string): Promise<ReplayEvent[]>;
25
+ export declare function filterEvents(events: ReplayEvent[], filter: ReplayFilter): ReplayEvent[];
26
+ export declare function replayWithTiming(events: ReplayEvent[], speed: ReplaySpeed): AsyncGenerator<ReplayEvent>;
27
+ export declare function formatReplayEvent(event: ReplayEvent): string;
28
+ //# sourceMappingURL=replay-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replay-tools.d.ts","sourceRoot":"","sources":["../src/replay-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC;AAElD,MAAM,WAAW,WAAW;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,UAAU,GAAG,WAAW,GAAG,SAAS,GAAG,YAAY,CAAC;IAChE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY;IAC5B,IAAI,CAAC,EAAE,KAAK,CAAC,UAAU,GAAG,WAAW,GAAG,SAAS,GAAG,YAAY,CAAC,CAAC;IAClE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,KAAK,CAAC,EAAE,IAAI,CAAC;CACb;AAMD,wBAAsB,eAAe,CACpC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GACjB,OAAO,CAAC,WAAW,EAAE,CAAC,CA4CxB;AAMD,wBAAgB,YAAY,CAC3B,MAAM,EAAE,WAAW,EAAE,EACrB,MAAM,EAAE,YAAY,GAClB,WAAW,EAAE,CAiCf;AAMD,wBAAuB,gBAAgB,CACtC,MAAM,EAAE,WAAW,EAAE,EACrB,KAAK,EAAE,WAAW,GAChB,cAAc,CAAC,WAAW,CAAC,CAuC7B;AAMD,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM,CA0D5D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm-plugin",
3
- "version": "0.42.9",
3
+ "version": "0.43.0",
4
4
  "description": "Multi-agent swarm coordination for OpenCode with learning capabilities, beads integration, and Agent Mail",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",