opencode-swarm-plugin 0.26.1 → 0.27.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 (77) hide show
  1. package/.turbo/turbo-build.log +4 -4
  2. package/CHANGELOG.md +23 -0
  3. package/README.md +43 -46
  4. package/bin/swarm.ts +8 -8
  5. package/dist/compaction-hook.d.ts +57 -0
  6. package/dist/compaction-hook.d.ts.map +1 -0
  7. package/dist/hive.d.ts +741 -0
  8. package/dist/hive.d.ts.map +1 -0
  9. package/dist/index.d.ts +139 -23
  10. package/dist/index.d.ts.map +1 -1
  11. package/dist/index.js +1353 -350
  12. package/dist/learning.d.ts +9 -9
  13. package/dist/plugin.js +1176 -350
  14. package/dist/schemas/cell-events.d.ts +1352 -0
  15. package/dist/schemas/{bead-events.d.ts.map → cell-events.d.ts.map} +1 -1
  16. package/dist/schemas/{bead.d.ts → cell.d.ts} +173 -29
  17. package/dist/schemas/cell.d.ts.map +1 -0
  18. package/dist/schemas/index.d.ts +11 -7
  19. package/dist/schemas/index.d.ts.map +1 -1
  20. package/dist/structured.d.ts +17 -7
  21. package/dist/structured.d.ts.map +1 -1
  22. package/dist/swarm-decompose.d.ts +5 -5
  23. package/dist/swarm-orchestrate.d.ts +16 -2
  24. package/dist/swarm-orchestrate.d.ts.map +1 -1
  25. package/dist/swarm-prompts.d.ts +9 -9
  26. package/dist/swarm-prompts.d.ts.map +1 -1
  27. package/dist/swarm-review.d.ts +210 -0
  28. package/dist/swarm-review.d.ts.map +1 -0
  29. package/dist/swarm-worktree.d.ts +185 -0
  30. package/dist/swarm-worktree.d.ts.map +1 -0
  31. package/dist/swarm.d.ts +7 -0
  32. package/dist/swarm.d.ts.map +1 -1
  33. package/dist/tool-availability.d.ts +3 -2
  34. package/dist/tool-availability.d.ts.map +1 -1
  35. package/docs/analysis-socratic-planner-pattern.md +1 -1
  36. package/docs/planning/ADR-007-swarm-enhancements-worktree-review.md +168 -0
  37. package/docs/testing/context-recovery-test.md +2 -2
  38. package/evals/README.md +2 -2
  39. package/evals/scorers/index.ts +7 -7
  40. package/examples/commands/swarm.md +21 -23
  41. package/examples/plugin-wrapper-template.ts +310 -44
  42. package/examples/skills/{beads-workflow → hive-workflow}/SKILL.md +40 -40
  43. package/examples/skills/swarm-coordination/SKILL.md +1 -1
  44. package/global-skills/swarm-coordination/SKILL.md +14 -14
  45. package/global-skills/swarm-coordination/references/coordinator-patterns.md +3 -3
  46. package/package.json +2 -2
  47. package/src/compaction-hook.ts +161 -0
  48. package/src/{beads.integration.test.ts → hive.integration.test.ts} +92 -80
  49. package/src/{beads.ts → hive.ts} +378 -219
  50. package/src/index.ts +57 -20
  51. package/src/learning.ts +9 -9
  52. package/src/output-guardrails.test.ts +4 -4
  53. package/src/output-guardrails.ts +9 -9
  54. package/src/planning-guardrails.test.ts +1 -1
  55. package/src/planning-guardrails.ts +1 -1
  56. package/src/schemas/{bead-events.test.ts → cell-events.test.ts} +83 -77
  57. package/src/schemas/cell-events.ts +807 -0
  58. package/src/schemas/{bead.ts → cell.ts} +95 -41
  59. package/src/schemas/evaluation.ts +1 -1
  60. package/src/schemas/index.ts +90 -18
  61. package/src/schemas/swarm-context.ts +2 -2
  62. package/src/structured.test.ts +15 -15
  63. package/src/structured.ts +18 -11
  64. package/src/swarm-decompose.ts +23 -23
  65. package/src/swarm-orchestrate.ts +135 -21
  66. package/src/swarm-prompts.ts +43 -43
  67. package/src/swarm-review.test.ts +702 -0
  68. package/src/swarm-review.ts +696 -0
  69. package/src/swarm-worktree.test.ts +501 -0
  70. package/src/swarm-worktree.ts +575 -0
  71. package/src/swarm.integration.test.ts +12 -12
  72. package/src/tool-availability.ts +36 -3
  73. package/dist/beads.d.ts +0 -386
  74. package/dist/beads.d.ts.map +0 -1
  75. package/dist/schemas/bead-events.d.ts +0 -698
  76. package/dist/schemas/bead.d.ts.map +0 -1
  77. package/src/schemas/bead-events.ts +0 -583
@@ -1,39 +1,42 @@
1
1
  /**
2
- * Bead schemas for type-safe beads operations
2
+ * Cell schemas for type-safe cell operations
3
3
  *
4
4
  * These schemas validate all data from the `bd` CLI to ensure
5
5
  * type safety and catch malformed responses early.
6
+ *
7
+ * Cells are work items in the Hive (honeycomb metaphor).
8
+ * Backward compatibility: Bead* aliases provided for gradual migration.
6
9
  */
7
10
  import { z } from "zod";
8
11
 
9
- /** Valid bead statuses */
10
- export const BeadStatusSchema = z.enum([
12
+ /** Valid cell statuses */
13
+ export const CellStatusSchema = z.enum([
11
14
  "open",
12
15
  "in_progress",
13
16
  "blocked",
14
17
  "closed",
15
18
  ]);
16
- export type BeadStatus = z.infer<typeof BeadStatusSchema>;
19
+ export type CellStatus = z.infer<typeof CellStatusSchema>;
17
20
 
18
- /** Valid bead types */
19
- export const BeadTypeSchema = z.enum([
21
+ /** Valid cell types */
22
+ export const CellTypeSchema = z.enum([
20
23
  "bug",
21
24
  "feature",
22
25
  "task",
23
26
  "epic",
24
27
  "chore",
25
28
  ]);
26
- export type BeadType = z.infer<typeof BeadTypeSchema>;
29
+ export type CellType = z.infer<typeof CellTypeSchema>;
27
30
 
28
- /** Dependency relationship between beads */
29
- export const BeadDependencySchema = z.object({
31
+ /** Dependency relationship between cells */
32
+ export const CellDependencySchema = z.object({
30
33
  id: z.string(),
31
34
  type: z.enum(["blocks", "blocked-by", "related", "discovered-from"]),
32
35
  });
33
- export type BeadDependency = z.infer<typeof BeadDependencySchema>;
36
+ export type CellDependency = z.infer<typeof CellDependencySchema>;
34
37
 
35
38
  /**
36
- * Core bead schema - validates bd CLI JSON output
39
+ * Core cell schema - validates bd CLI JSON output
37
40
  *
38
41
  * ID format:
39
42
  * - Standard: `{project}-{hash}` (e.g., `opencode-swarm-plugin-1i8`)
@@ -41,13 +44,13 @@ export type BeadDependency = z.infer<typeof BeadDependencySchema>;
41
44
  * - Custom: `{project}-{custom-id}` (e.g., `migrate-egghead-phase-0`)
42
45
  * - Custom subtask: `{project}-{custom-id}.{suffix}` (e.g., `migrate-egghead-phase-0.e2e-test`)
43
46
  */
44
- export const BeadSchema = z.object({
47
+ export const CellSchema = z.object({
45
48
  /**
46
- * Bead ID format: project-slug-hash with optional subtask index.
49
+ * Cell ID format: project-slug-hash with optional subtask index.
47
50
  *
48
51
  * Pattern: `project-name-xxxxx` or `project-name-xxxxx.N`
49
52
  * Examples:
50
- * - `my-project-abc12` (main bead)
53
+ * - `my-project-abc12` (main cell)
51
54
  * - `my-project-abc12.1` (first subtask)
52
55
  * - `my-project-abc12.2` (second subtask)
53
56
  */
@@ -55,13 +58,13 @@ export const BeadSchema = z.object({
55
58
  .string()
56
59
  .regex(
57
60
  /^[a-z0-9]+(-[a-z0-9]+)+(\.[\w-]+)?$/,
58
- "Invalid bead ID format (expected: project-slug-hash or project-slug-hash.N)",
61
+ "Invalid cell ID format (expected: project-slug-hash or project-slug-hash.N)",
59
62
  ),
60
63
  title: z.string().min(1, "Title required"),
61
64
  description: z.string().optional().default(""),
62
- status: BeadStatusSchema.default("open"),
65
+ status: CellStatusSchema.default("open"),
63
66
  priority: z.number().int().min(0).max(3).default(2),
64
- issue_type: BeadTypeSchema.default("task"),
67
+ issue_type: CellTypeSchema.default("task"),
65
68
  created_at: z.string().datetime({
66
69
  offset: true,
67
70
  message:
@@ -77,51 +80,51 @@ export const BeadSchema = z.object({
77
80
  .optional(),
78
81
  closed_at: z.string().datetime({ offset: true }).optional(),
79
82
  parent_id: z.string().optional(),
80
- dependencies: z.array(BeadDependencySchema).default([]),
83
+ dependencies: z.array(CellDependencySchema).default([]),
81
84
  metadata: z.record(z.string(), z.unknown()).optional(),
82
85
  });
83
- export type Bead = z.infer<typeof BeadSchema>;
86
+ export type Cell = z.infer<typeof CellSchema>;
84
87
 
85
- /** Arguments for creating a bead */
86
- export const BeadCreateArgsSchema = z.object({
88
+ /** Arguments for creating a cell */
89
+ export const CellCreateArgsSchema = z.object({
87
90
  title: z.string().min(1, "Title required"),
88
- type: BeadTypeSchema.default("task"),
91
+ type: CellTypeSchema.default("task"),
89
92
  priority: z.number().int().min(0).max(3).default(2),
90
93
  description: z.string().optional(),
91
94
  parent_id: z.string().optional(),
92
95
  /**
93
- * Custom ID for human-readable bead names.
96
+ * Custom ID for human-readable cell names.
94
97
  * MUST include project prefix (e.g., 'migrate-egghead-phase-0', not just 'phase-0').
95
98
  * For subtasks, use dot notation: 'migrate-egghead-phase-0.e2e-test'
96
99
  */
97
100
  id: z.string().optional(),
98
101
  });
99
- export type BeadCreateArgs = z.infer<typeof BeadCreateArgsSchema>;
102
+ export type CellCreateArgs = z.infer<typeof CellCreateArgsSchema>;
100
103
 
101
- /** Arguments for updating a bead */
102
- export const BeadUpdateArgsSchema = z.object({
104
+ /** Arguments for updating a cell */
105
+ export const CellUpdateArgsSchema = z.object({
103
106
  id: z.string(),
104
- status: BeadStatusSchema.optional(),
107
+ status: CellStatusSchema.optional(),
105
108
  description: z.string().optional(),
106
109
  priority: z.number().int().min(0).max(3).optional(),
107
110
  });
108
- export type BeadUpdateArgs = z.infer<typeof BeadUpdateArgsSchema>;
111
+ export type CellUpdateArgs = z.infer<typeof CellUpdateArgsSchema>;
109
112
 
110
- /** Arguments for closing a bead */
111
- export const BeadCloseArgsSchema = z.object({
113
+ /** Arguments for closing a cell */
114
+ export const CellCloseArgsSchema = z.object({
112
115
  id: z.string(),
113
116
  reason: z.string().min(1, "Reason required"),
114
117
  });
115
- export type BeadCloseArgs = z.infer<typeof BeadCloseArgsSchema>;
118
+ export type CellCloseArgs = z.infer<typeof CellCloseArgsSchema>;
116
119
 
117
- /** Arguments for querying beads */
118
- export const BeadQueryArgsSchema = z.object({
119
- status: BeadStatusSchema.optional(),
120
- type: BeadTypeSchema.optional(),
120
+ /** Arguments for querying cells */
121
+ export const CellQueryArgsSchema = z.object({
122
+ status: CellStatusSchema.optional(),
123
+ type: CellTypeSchema.optional(),
121
124
  ready: z.boolean().optional(),
122
125
  limit: z.number().int().positive().default(20),
123
126
  });
124
- export type BeadQueryArgs = z.infer<typeof BeadQueryArgsSchema>;
127
+ export type CellQueryArgs = z.infer<typeof CellQueryArgsSchema>;
125
128
 
126
129
  /**
127
130
  * Subtask specification for epic decomposition
@@ -147,18 +150,18 @@ export const SubtaskSpecSchema = z.object({
147
150
  export type SubtaskSpec = z.infer<typeof SubtaskSpecSchema>;
148
151
 
149
152
  /**
150
- * Bead tree for swarm decomposition
153
+ * Cell tree for swarm decomposition
151
154
  *
152
155
  * Represents an epic with its subtasks, ready for spawning agents.
153
156
  */
154
- export const BeadTreeSchema = z.object({
157
+ export const CellTreeSchema = z.object({
155
158
  epic: z.object({
156
159
  title: z.string().min(1),
157
160
  description: z.string().optional().default(""),
158
161
  }),
159
162
  subtasks: z.array(SubtaskSpecSchema).min(1),
160
163
  });
161
- export type BeadTree = z.infer<typeof BeadTreeSchema>;
164
+ export type CellTree = z.infer<typeof CellTreeSchema>;
162
165
 
163
166
  /** Arguments for creating an epic with subtasks */
164
167
  export const EpicCreateArgsSchema = z.object({
@@ -195,8 +198,59 @@ export type EpicCreateArgs = z.infer<typeof EpicCreateArgsSchema>;
195
198
  */
196
199
  export const EpicCreateResultSchema = z.object({
197
200
  success: z.boolean(),
198
- epic: BeadSchema,
199
- subtasks: z.array(BeadSchema),
201
+ epic: CellSchema,
202
+ subtasks: z.array(CellSchema),
200
203
  rollback_hint: z.string().optional(),
201
204
  });
202
205
  export type EpicCreateResult = z.infer<typeof EpicCreateResultSchema>;
206
+
207
+ // ============================================================================
208
+ // BACKWARD COMPATIBILITY ALIASES
209
+ // These aliases maintain compatibility with existing code using Bead* names.
210
+ // Gradually migrate to Cell* names in new code.
211
+ // ============================================================================
212
+
213
+ /** @deprecated Use CellStatusSchema instead */
214
+ export const BeadStatusSchema = CellStatusSchema;
215
+ /** @deprecated Use CellStatus instead */
216
+ export type BeadStatus = CellStatus;
217
+
218
+ /** @deprecated Use CellTypeSchema instead */
219
+ export const BeadTypeSchema = CellTypeSchema;
220
+ /** @deprecated Use CellType instead */
221
+ export type BeadType = CellType;
222
+
223
+ /** @deprecated Use CellDependencySchema instead */
224
+ export const BeadDependencySchema = CellDependencySchema;
225
+ /** @deprecated Use CellDependency instead */
226
+ export type BeadDependency = CellDependency;
227
+
228
+ /** @deprecated Use CellSchema instead */
229
+ export const BeadSchema = CellSchema;
230
+ /** @deprecated Use Cell instead */
231
+ export type Bead = Cell;
232
+
233
+ /** @deprecated Use CellCreateArgsSchema instead */
234
+ export const BeadCreateArgsSchema = CellCreateArgsSchema;
235
+ /** @deprecated Use CellCreateArgs instead */
236
+ export type BeadCreateArgs = CellCreateArgs;
237
+
238
+ /** @deprecated Use CellUpdateArgsSchema instead */
239
+ export const BeadUpdateArgsSchema = CellUpdateArgsSchema;
240
+ /** @deprecated Use CellUpdateArgs instead */
241
+ export type BeadUpdateArgs = CellUpdateArgs;
242
+
243
+ /** @deprecated Use CellCloseArgsSchema instead */
244
+ export const BeadCloseArgsSchema = CellCloseArgsSchema;
245
+ /** @deprecated Use CellCloseArgs instead */
246
+ export type BeadCloseArgs = CellCloseArgs;
247
+
248
+ /** @deprecated Use CellQueryArgsSchema instead */
249
+ export const BeadQueryArgsSchema = CellQueryArgsSchema;
250
+ /** @deprecated Use CellQueryArgs instead */
251
+ export type BeadQueryArgs = CellQueryArgs;
252
+
253
+ /** @deprecated Use CellTreeSchema instead */
254
+ export const BeadTreeSchema = CellTreeSchema;
255
+ /** @deprecated Use CellTree instead */
256
+ export type BeadTree = CellTree;
@@ -128,7 +128,7 @@ export const SwarmEvaluationResultSchema = z.object({
128
128
  }),
129
129
  ),
130
130
  overall_passed: z.boolean(),
131
- retry_needed: z.array(z.string()), // Bead IDs that need retry
131
+ retry_needed: z.array(z.string()), // Cell IDs that need retry
132
132
  });
133
133
  export type SwarmEvaluationResult = z.infer<typeof SwarmEvaluationResultSchema>;
134
134
 
@@ -4,16 +4,18 @@
4
4
  * This module re-exports all schema definitions used throughout the plugin.
5
5
  * Schemas are organized by domain:
6
6
  *
7
- * ## Bead Schemas (Issue Tracking)
8
- * - `BeadSchema` - Core bead/issue definition
9
- * - `BeadStatusSchema` - Status enum (open, in_progress, blocked, closed)
10
- * - `BeadTypeSchema` - Type enum (bug, feature, task, epic, chore)
7
+ * ## Cell Schemas (Issue Tracking) - PRIMARY
8
+ * - `CellSchema` - Core cell/issue definition (formerly BeadSchema)
9
+ * - `CellStatusSchema` - Status enum (open, in_progress, blocked, closed)
10
+ * - `CellTypeSchema` - Type enum (bug, feature, task, epic, chore)
11
11
  * - `SubtaskSpecSchema` - Subtask specification for epic creation
12
+ * - `CellTreeSchema` - Epic + subtasks structure (formerly CellTreeSchema)
13
+ *
14
+ * **Backward compatibility:** All Bead* names are exported as deprecated aliases.
12
15
  *
13
16
  * ## Task Schemas (Swarm Decomposition)
14
17
  * - `TaskDecompositionSchema` - Full task breakdown
15
18
  * - `DecomposedSubtaskSchema` - Individual subtask definition
16
- * - `BeadTreeSchema` - Epic + subtasks structure
17
19
  *
18
20
  * ## Evaluation Schemas (Agent Self-Assessment)
19
21
  * - `EvaluationSchema` - Complete evaluation with criteria
@@ -27,7 +29,35 @@
27
29
  * @module schemas
28
30
  */
29
31
 
30
- // Bead schemas
32
+ // Cell schemas (primary names)
33
+ export {
34
+ CellStatusSchema,
35
+ CellTypeSchema,
36
+ CellDependencySchema,
37
+ CellSchema,
38
+ CellCreateArgsSchema,
39
+ CellUpdateArgsSchema,
40
+ CellCloseArgsSchema,
41
+ CellQueryArgsSchema,
42
+ SubtaskSpecSchema,
43
+ CellTreeSchema,
44
+ EpicCreateArgsSchema,
45
+ EpicCreateResultSchema,
46
+ type CellStatus,
47
+ type CellType,
48
+ type CellDependency,
49
+ type Cell,
50
+ type CellCreateArgs,
51
+ type CellUpdateArgs,
52
+ type CellCloseArgs,
53
+ type CellQueryArgs,
54
+ type SubtaskSpec,
55
+ type CellTree,
56
+ type EpicCreateArgs,
57
+ type EpicCreateResult,
58
+ } from "./cell";
59
+
60
+ // Bead schemas (backward compatibility aliases)
31
61
  export {
32
62
  BeadStatusSchema,
33
63
  BeadTypeSchema,
@@ -37,10 +67,7 @@ export {
37
67
  BeadUpdateArgsSchema,
38
68
  BeadCloseArgsSchema,
39
69
  BeadQueryArgsSchema,
40
- SubtaskSpecSchema,
41
70
  BeadTreeSchema,
42
- EpicCreateArgsSchema,
43
- EpicCreateResultSchema,
44
71
  type BeadStatus,
45
72
  type BeadType,
46
73
  type BeadDependency,
@@ -49,11 +76,8 @@ export {
49
76
  type BeadUpdateArgs,
50
77
  type BeadCloseArgs,
51
78
  type BeadQueryArgs,
52
- type SubtaskSpec,
53
79
  type BeadTree,
54
- type EpicCreateArgs,
55
- type EpicCreateResult,
56
- } from "./bead";
80
+ } from "./cell";
57
81
 
58
82
  // Evaluation schemas
59
83
  export {
@@ -144,7 +168,58 @@ export {
144
168
  type QuerySwarmContextsArgs,
145
169
  } from "./swarm-context";
146
170
 
147
- // Bead event schemas
171
+ // Cell event schemas (PRIMARY)
172
+ export {
173
+ BaseCellEventSchema,
174
+ CellCreatedEventSchema,
175
+ CellUpdatedEventSchema,
176
+ CellStatusChangedEventSchema,
177
+ CellClosedEventSchema,
178
+ CellReopenedEventSchema,
179
+ CellDeletedEventSchema,
180
+ CellDependencyAddedEventSchema,
181
+ CellDependencyRemovedEventSchema,
182
+ CellLabelAddedEventSchema,
183
+ CellLabelRemovedEventSchema,
184
+ CellCommentAddedEventSchema,
185
+ CellCommentUpdatedEventSchema,
186
+ CellCommentDeletedEventSchema,
187
+ CellEpicChildAddedEventSchema,
188
+ CellEpicChildRemovedEventSchema,
189
+ CellEpicClosureEligibleEventSchema,
190
+ CellAssignedEventSchema,
191
+ CellWorkStartedEventSchema,
192
+ CellCompactedEventSchema,
193
+ CellEventSchema,
194
+ createCellEvent,
195
+ isCellEventType,
196
+ getCellIdFromEvent,
197
+ isStateTransitionEvent,
198
+ isEpicEvent,
199
+ isAgentEvent,
200
+ type CellEvent,
201
+ type CellCreatedEvent,
202
+ type CellUpdatedEvent,
203
+ type CellStatusChangedEvent,
204
+ type CellClosedEvent,
205
+ type CellReopenedEvent,
206
+ type CellDeletedEvent,
207
+ type CellDependencyAddedEvent,
208
+ type CellDependencyRemovedEvent,
209
+ type CellLabelAddedEvent,
210
+ type CellLabelRemovedEvent,
211
+ type CellCommentAddedEvent,
212
+ type CellCommentUpdatedEvent,
213
+ type CellCommentDeletedEvent,
214
+ type CellEpicChildAddedEvent,
215
+ type CellEpicChildRemovedEvent,
216
+ type CellEpicClosureEligibleEvent,
217
+ type CellAssignedEvent,
218
+ type CellWorkStartedEvent,
219
+ type CellCompactedEvent,
220
+ } from "./cell-events";
221
+
222
+ // Bead event schemas (DEPRECATED - backward compatibility)
148
223
  export {
149
224
  BaseBeadEventSchema,
150
225
  BeadCreatedEventSchema,
@@ -170,9 +245,6 @@ export {
170
245
  createBeadEvent,
171
246
  isBeadEventType,
172
247
  getBeadIdFromEvent,
173
- isStateTransitionEvent,
174
- isEpicEvent,
175
- isAgentEvent,
176
248
  type BeadEvent,
177
249
  type BeadCreatedEvent,
178
250
  type BeadUpdatedEvent,
@@ -193,4 +265,4 @@ export {
193
265
  type BeadAssignedEvent,
194
266
  type BeadWorkStartedEvent,
195
267
  type BeadCompactedEvent,
196
- } from "./bead-events";
268
+ } from "./cell-events";
@@ -56,13 +56,13 @@ export const SwarmBeadContextSchema = z.object({
56
56
  id: z.string(),
57
57
  /** Epic this bead belongs to */
58
58
  epic_id: z.string(),
59
- /** Bead ID being executed */
59
+ /** Cell ID being executed */
60
60
  bead_id: z.string(),
61
61
  /** Decomposition strategy used */
62
62
  strategy: SwarmStrategySchema,
63
63
  /** Files this bead is responsible for */
64
64
  files: z.array(z.string()),
65
- /** Bead IDs this task depends on */
65
+ /** Cell IDs this task depends on */
66
66
  dependencies: z.array(z.string()).default([]),
67
67
  /** Shared directives and context */
68
68
  directives: SwarmDirectivesSchema,
@@ -7,7 +7,7 @@ import type { ToolContext } from "@opencode-ai/plugin";
7
7
  import { describe, expect, it } from "bun:test";
8
8
  import { z } from "zod";
9
9
  import {
10
- BeadTreeSchema,
10
+ CellTreeSchema,
11
11
  EvaluationSchema,
12
12
  TaskDecompositionSchema,
13
13
  } from "./schemas";
@@ -18,7 +18,7 @@ import {
18
18
  formatZodErrors,
19
19
  getSchemaByName,
20
20
  structured_extract_json,
21
- structured_parse_bead_tree,
21
+ structured_parse_cell_tree,
22
22
  structured_parse_decomposition,
23
23
  structured_parse_evaluation,
24
24
  structured_validate,
@@ -337,9 +337,9 @@ describe("getSchemaByName", () => {
337
337
  expect(schema).toBe(TaskDecompositionSchema);
338
338
  });
339
339
 
340
- it("returns BeadTreeSchema for 'bead_tree'", () => {
341
- const schema = getSchemaByName("bead_tree");
342
- expect(schema).toBe(BeadTreeSchema);
340
+ it("returns CellTreeSchema for 'cell_tree'", () => {
341
+ const schema = getSchemaByName("cell_tree");
342
+ expect(schema).toBe(CellTreeSchema);
343
343
  });
344
344
 
345
345
  it("throws error for unknown schema name", () => {
@@ -353,7 +353,7 @@ describe("getSchemaByName", () => {
353
353
  if (error instanceof Error) {
354
354
  expect(error.message).toContain("evaluation");
355
355
  expect(error.message).toContain("task_decomposition");
356
- expect(error.message).toContain("bead_tree");
356
+ expect(error.message).toContain("cell_tree");
357
357
  }
358
358
  }
359
359
  });
@@ -552,7 +552,7 @@ describe("structured_validate", () => {
552
552
  });
553
553
  });
554
554
 
555
- describe("bead_tree schema", () => {
555
+ describe("cell_tree schema", () => {
556
556
  it("validates correct bead tree", async () => {
557
557
  const validTree = {
558
558
  epic: { title: "Epic", description: "Desc" },
@@ -568,7 +568,7 @@ describe("structured_validate", () => {
568
568
  const result = await structured_validate.execute(
569
569
  {
570
570
  response: JSON.stringify(validTree),
571
- schema_name: "bead_tree",
571
+ schema_name: "cell_tree",
572
572
  },
573
573
  mockCtx,
574
574
  );
@@ -852,10 +852,10 @@ describe("structured_parse_decomposition", () => {
852
852
  });
853
853
 
854
854
  // ============================================================================
855
- // 9. structured_parse_bead_tree tool
855
+ // 9. structured_parse_cell_tree tool
856
856
  // ============================================================================
857
857
 
858
- describe("structured_parse_bead_tree", () => {
858
+ describe("structured_parse_cell_tree", () => {
859
859
  const mockCtx = {} as ToolContext;
860
860
 
861
861
  it("parses valid bead tree", async () => {
@@ -881,7 +881,7 @@ describe("structured_parse_bead_tree", () => {
881
881
  },
882
882
  ],
883
883
  };
884
- const result = await structured_parse_bead_tree.execute(
884
+ const result = await structured_parse_cell_tree.execute(
885
885
  { response: JSON.stringify(validTree) },
886
886
  mockCtx,
887
887
  );
@@ -917,7 +917,7 @@ describe("structured_parse_bead_tree", () => {
917
917
  },
918
918
  ],
919
919
  };
920
- const result = await structured_parse_bead_tree.execute(
920
+ const result = await structured_parse_cell_tree.execute(
921
921
  { response: JSON.stringify(tree) },
922
922
  mockCtx,
923
923
  );
@@ -944,7 +944,7 @@ describe("structured_parse_bead_tree", () => {
944
944
  },
945
945
  ],
946
946
  };
947
- const result = await structured_parse_bead_tree.execute(
947
+ const result = await structured_parse_cell_tree.execute(
948
948
  { response: JSON.stringify(tree) },
949
949
  mockCtx,
950
950
  );
@@ -955,7 +955,7 @@ describe("structured_parse_bead_tree", () => {
955
955
  });
956
956
 
957
957
  it("returns error for invalid bead tree", async () => {
958
- const result = await structured_parse_bead_tree.execute(
958
+ const result = await structured_parse_cell_tree.execute(
959
959
  { response: '{"epic": {}}' }, // Missing required fields
960
960
  mockCtx,
961
961
  );
@@ -966,7 +966,7 @@ describe("structured_parse_bead_tree", () => {
966
966
  });
967
967
 
968
968
  it("includes expected shape in error", async () => {
969
- const result = await structured_parse_bead_tree.execute(
969
+ const result = await structured_parse_cell_tree.execute(
970
970
  { response: '{"wrong": true}' },
971
971
  mockCtx,
972
972
  );
package/src/structured.ts CHANGED
@@ -9,7 +9,7 @@
9
9
  * 2. `structured_validate` - Extract + validate against named schema
10
10
  * 3. `structured_parse_evaluation` - Typed parsing for agent self-evaluations
11
11
  * 4. `structured_parse_decomposition` - Typed parsing for task breakdowns
12
- * 5. `structured_parse_bead_tree` - Typed parsing for epic + subtasks
12
+ * 5. `structured_parse_cell_tree` - Typed parsing for epic + subtasks
13
13
  *
14
14
  * @module structured
15
15
  */
@@ -18,12 +18,12 @@ import { z, type ZodSchema } from "zod";
18
18
  import {
19
19
  EvaluationSchema,
20
20
  TaskDecompositionSchema,
21
- BeadTreeSchema,
21
+ CellTreeSchema,
22
22
  ValidationResultSchema,
23
23
  CriterionEvaluationSchema,
24
24
  type Evaluation,
25
25
  type TaskDecomposition,
26
- type BeadTree,
26
+ type CellTree,
27
27
  type ValidationResult,
28
28
  } from "./schemas";
29
29
 
@@ -96,7 +96,7 @@ function formatZodErrors(error: z.ZodError): string[] {
96
96
  const SCHEMA_REGISTRY: Record<string, ZodSchema> = {
97
97
  evaluation: EvaluationSchema,
98
98
  task_decomposition: TaskDecompositionSchema,
99
- bead_tree: BeadTreeSchema,
99
+ cell_tree: CellTreeSchema,
100
100
  };
101
101
 
102
102
  /**
@@ -377,12 +377,12 @@ export const structured_validate = tool({
377
377
  args: {
378
378
  response: tool.schema.string().describe("Agent response to validate"),
379
379
  schema_name: tool.schema
380
- .enum(["evaluation", "task_decomposition", "bead_tree"])
380
+ .enum(["evaluation", "task_decomposition", "cell_tree"])
381
381
  .describe(
382
382
  "Schema to validate against: " +
383
383
  "evaluation = agent self-eval with criteria, " +
384
384
  "task_decomposition = swarm task breakdown, " +
385
- "bead_tree = epic with subtasks",
385
+ "cell_tree = epic with subtasks",
386
386
  ),
387
387
  max_retries: tool.schema
388
388
  .number()
@@ -650,11 +650,11 @@ export const structured_parse_decomposition = tool({
650
650
  /**
651
651
  * Parse and validate a bead tree (epic with subtasks)
652
652
  *
653
- * Validates the structure before creating beads.
653
+ * Validates the structure before creating cells.
654
654
  */
655
- export const structured_parse_bead_tree = tool({
655
+ export const structured_parse_cell_tree = tool({
656
656
  description:
657
- "Parse and validate bead tree response. Uses BeadTreeSchema. Validates before creating epic with subtasks.",
657
+ "Parse and validate bead tree response. Uses CellTreeSchema. Validates before creating epic with subtasks.",
658
658
  args: {
659
659
  response: tool.schema
660
660
  .string()
@@ -663,7 +663,7 @@ export const structured_parse_bead_tree = tool({
663
663
  async execute(args, ctx) {
664
664
  try {
665
665
  const [extracted, method] = extractJsonFromText(args.response);
666
- const validated = BeadTreeSchema.parse(extracted) as BeadTree;
666
+ const validated = CellTreeSchema.parse(extracted) as CellTree;
667
667
 
668
668
  // Collect all files for reservation planning
669
669
  const allFiles = validated.subtasks.flatMap((s) => s.files);
@@ -751,5 +751,12 @@ export const structuredTools = {
751
751
  structured_validate: structured_validate,
752
752
  structured_parse_evaluation: structured_parse_evaluation,
753
753
  structured_parse_decomposition: structured_parse_decomposition,
754
- structured_parse_bead_tree: structured_parse_bead_tree,
754
+ structured_parse_cell_tree: structured_parse_cell_tree,
755
755
  };
756
+
757
+ // ============================================================================
758
+ // Backward Compatibility Aliases
759
+ // ============================================================================
760
+
761
+ /** @deprecated Use structured_parse_cell_tree instead */
762
+ export const structured_parse_bead_tree = structured_parse_cell_tree;