opencode-swarm-plugin 0.32.0 → 0.34.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 (55) hide show
  1. package/.hive/issues.jsonl +12 -0
  2. package/.hive/memories.jsonl +255 -1
  3. package/.turbo/turbo-build.log +9 -10
  4. package/.turbo/turbo-test.log +343 -337
  5. package/CHANGELOG.md +358 -0
  6. package/README.md +152 -179
  7. package/bin/swarm.test.ts +303 -1
  8. package/bin/swarm.ts +473 -16
  9. package/dist/compaction-hook.d.ts +1 -1
  10. package/dist/compaction-hook.d.ts.map +1 -1
  11. package/dist/index.d.ts +112 -0
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +12380 -131
  14. package/dist/logger.d.ts +34 -0
  15. package/dist/logger.d.ts.map +1 -0
  16. package/dist/observability-tools.d.ts +116 -0
  17. package/dist/observability-tools.d.ts.map +1 -0
  18. package/dist/plugin.js +12254 -119
  19. package/dist/skills.d.ts.map +1 -1
  20. package/dist/swarm-orchestrate.d.ts +105 -0
  21. package/dist/swarm-orchestrate.d.ts.map +1 -1
  22. package/dist/swarm-prompts.d.ts +113 -2
  23. package/dist/swarm-prompts.d.ts.map +1 -1
  24. package/dist/swarm-research.d.ts +127 -0
  25. package/dist/swarm-research.d.ts.map +1 -0
  26. package/dist/swarm-review.d.ts.map +1 -1
  27. package/dist/swarm.d.ts +73 -1
  28. package/dist/swarm.d.ts.map +1 -1
  29. package/evals/compaction-resumption.eval.ts +289 -0
  30. package/evals/coordinator-behavior.eval.ts +307 -0
  31. package/evals/fixtures/compaction-cases.ts +350 -0
  32. package/evals/scorers/compaction-scorers.ts +305 -0
  33. package/evals/scorers/index.ts +12 -0
  34. package/examples/plugin-wrapper-template.ts +297 -8
  35. package/package.json +6 -2
  36. package/src/compaction-hook.test.ts +617 -1
  37. package/src/compaction-hook.ts +291 -18
  38. package/src/index.ts +54 -1
  39. package/src/logger.test.ts +189 -0
  40. package/src/logger.ts +135 -0
  41. package/src/observability-tools.test.ts +346 -0
  42. package/src/observability-tools.ts +594 -0
  43. package/src/skills.integration.test.ts +137 -1
  44. package/src/skills.test.ts +42 -1
  45. package/src/skills.ts +8 -4
  46. package/src/swarm-orchestrate.test.ts +123 -0
  47. package/src/swarm-orchestrate.ts +183 -0
  48. package/src/swarm-prompts.test.ts +553 -1
  49. package/src/swarm-prompts.ts +406 -4
  50. package/src/swarm-research.integration.test.ts +544 -0
  51. package/src/swarm-research.test.ts +698 -0
  52. package/src/swarm-research.ts +472 -0
  53. package/src/swarm-review.test.ts +177 -0
  54. package/src/swarm-review.ts +12 -47
  55. package/src/swarm.ts +6 -3
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Logger infrastructure using Pino with daily rotation
3
+ *
4
+ * Features:
5
+ * - Daily log rotation via pino-roll (numeric format: swarm.1log, swarm.2log, etc.)
6
+ * - 14-day retention (14 files max in addition to current file)
7
+ * - Module-specific child loggers with separate log files
8
+ * - Pretty mode for development (SWARM_LOG_PRETTY=1 env var)
9
+ * - Logs to ~/.config/swarm-tools/logs/ by default
10
+ *
11
+ * Note: pino-roll uses numeric rotation (e.g., swarm.1log, swarm.2log) not date-based names.
12
+ * Files rotate daily based on frequency='daily', with a maximum of 14 retained files.
13
+ */
14
+ import type { Logger } from "pino";
15
+ /**
16
+ * Gets or creates the main logger instance
17
+ *
18
+ * @param logDir - Optional log directory (defaults to ~/.config/swarm-tools/logs)
19
+ * @returns Pino logger instance
20
+ */
21
+ export declare function getLogger(logDir?: string): Logger;
22
+ /**
23
+ * Creates a child logger for a specific module with its own log file
24
+ *
25
+ * @param module - Module name (e.g., "compaction", "cli")
26
+ * @param logDir - Optional log directory (defaults to ~/.config/swarm-tools/logs)
27
+ * @returns Child logger instance
28
+ */
29
+ export declare function createChildLogger(module: string, logDir?: string): Logger;
30
+ /**
31
+ * Default logger instance for immediate use
32
+ */
33
+ export declare const logger: Logger;
34
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAuDnC;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,MAAM,GAAE,MAAwB,GAAG,MAAM,CAmBlE;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,MAAwB,GAC/B,MAAM,CAoBR;AAED;;GAEG;AACH,eAAO,MAAM,MAAM,QAAc,CAAC"}
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Observability Tools - Agent-facing Analytics
3
+ *
4
+ * Exposes observability tools to agents via plugin tools.
5
+ * Agents get programmatic access to analytics, not just CLI.
6
+ *
7
+ * Tools:
8
+ * - swarm_analytics: Query pre-built analytics
9
+ * - swarm_query: Raw SQL for power users
10
+ * - swarm_diagnose: Auto-diagnosis for epic/task
11
+ * - swarm_insights: Generate learning insights
12
+ */
13
+ export interface SwarmAnalyticsArgs {
14
+ query: "failed-decompositions" | "strategy-success-rates" | "lock-contention" | "agent-activity" | "message-latency" | "scope-violations" | "task-duration" | "checkpoint-frequency" | "recovery-success" | "human-feedback";
15
+ since?: string;
16
+ format?: "json" | "summary";
17
+ }
18
+ export interface SwarmQueryArgs {
19
+ sql: string;
20
+ format?: "json" | "table";
21
+ }
22
+ export interface SwarmDiagnoseArgs {
23
+ epic_id?: string;
24
+ bead_id?: string;
25
+ include?: Array<"blockers" | "conflicts" | "slow_tasks" | "errors" | "timeline">;
26
+ }
27
+ export interface SwarmInsightsArgs {
28
+ scope: "epic" | "project" | "recent";
29
+ epic_id?: string;
30
+ metrics: Array<"success_rate" | "avg_duration" | "conflict_rate" | "retry_rate">;
31
+ }
32
+ export declare const observabilityTools: {
33
+ swarm_analytics: {
34
+ description: string;
35
+ args: {
36
+ query: import("zod").ZodEnum<{
37
+ "failed-decompositions": "failed-decompositions";
38
+ "strategy-success-rates": "strategy-success-rates";
39
+ "lock-contention": "lock-contention";
40
+ "agent-activity": "agent-activity";
41
+ "message-latency": "message-latency";
42
+ "scope-violations": "scope-violations";
43
+ "task-duration": "task-duration";
44
+ "checkpoint-frequency": "checkpoint-frequency";
45
+ "recovery-success": "recovery-success";
46
+ "human-feedback": "human-feedback";
47
+ }>;
48
+ since: import("zod").ZodOptional<import("zod").ZodString>;
49
+ format: import("zod").ZodOptional<import("zod").ZodEnum<{
50
+ summary: "summary";
51
+ json: "json";
52
+ }>>;
53
+ };
54
+ execute(args: {
55
+ query: "failed-decompositions" | "strategy-success-rates" | "lock-contention" | "agent-activity" | "message-latency" | "scope-violations" | "task-duration" | "checkpoint-frequency" | "recovery-success" | "human-feedback";
56
+ since?: string | undefined;
57
+ format?: "summary" | "json" | undefined;
58
+ }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
59
+ };
60
+ swarm_query: {
61
+ description: string;
62
+ args: {
63
+ sql: import("zod").ZodString;
64
+ format: import("zod").ZodOptional<import("zod").ZodEnum<{
65
+ json: "json";
66
+ table: "table";
67
+ }>>;
68
+ };
69
+ execute(args: {
70
+ sql: string;
71
+ format?: "json" | "table" | undefined;
72
+ }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
73
+ };
74
+ swarm_diagnose: {
75
+ description: string;
76
+ args: {
77
+ epic_id: import("zod").ZodOptional<import("zod").ZodString>;
78
+ bead_id: import("zod").ZodOptional<import("zod").ZodString>;
79
+ include: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodEnum<{
80
+ errors: "errors";
81
+ blockers: "blockers";
82
+ conflicts: "conflicts";
83
+ slow_tasks: "slow_tasks";
84
+ timeline: "timeline";
85
+ }>>>;
86
+ };
87
+ execute(args: {
88
+ epic_id?: string | undefined;
89
+ bead_id?: string | undefined;
90
+ include?: ("errors" | "blockers" | "conflicts" | "slow_tasks" | "timeline")[] | undefined;
91
+ }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
92
+ };
93
+ swarm_insights: {
94
+ description: string;
95
+ args: {
96
+ scope: import("zod").ZodEnum<{
97
+ project: "project";
98
+ epic: "epic";
99
+ recent: "recent";
100
+ }>;
101
+ epic_id: import("zod").ZodOptional<import("zod").ZodString>;
102
+ metrics: import("zod").ZodArray<import("zod").ZodEnum<{
103
+ success_rate: "success_rate";
104
+ avg_duration: "avg_duration";
105
+ conflict_rate: "conflict_rate";
106
+ retry_rate: "retry_rate";
107
+ }>>;
108
+ };
109
+ execute(args: {
110
+ scope: "project" | "epic" | "recent";
111
+ metrics: ("success_rate" | "avg_duration" | "conflict_rate" | "retry_rate")[];
112
+ epic_id?: string | undefined;
113
+ }, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
114
+ };
115
+ };
116
+ //# sourceMappingURL=observability-tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"observability-tools.d.ts","sourceRoot":"","sources":["../src/observability-tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AA2BH,MAAM,WAAW,kBAAkB;IAClC,KAAK,EACF,uBAAuB,GACvB,wBAAwB,GACxB,iBAAiB,GACjB,gBAAgB,GAChB,iBAAiB,GACjB,kBAAkB,GAClB,eAAe,GACf,sBAAsB,GACtB,kBAAkB,GAClB,gBAAgB,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B;AAED,MAAM,WAAW,cAAc;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAC1B;AAED,MAAM,WAAW,iBAAiB;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,KAAK,CACd,UAAU,GAAG,WAAW,GAAG,YAAY,GAAG,QAAQ,GAAG,UAAU,CAC/D,CAAC;CACF;AAED,MAAM,WAAW,iBAAiB;IACjC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,KAAK,CAAC,cAAc,GAAG,cAAc,GAAG,eAAe,GAAG,YAAY,CAAC,CAAC;CACjF;AAqgBD,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAK9B,CAAC"}