@defai.digital/ax-cli 2.7.0 → 3.0.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 (197) hide show
  1. package/.ax-cli/checkpoints/2025-11-20/checkpoint-2dd84869-e62d-46c8-9885-7e45f37f36e2.json +69 -0
  2. package/.ax-cli/checkpoints/2025-11-20/checkpoint-484dc350-353f-4808-9ed1-ebb3cefdab37.json +24 -0
  3. package/.ax-cli/checkpoints/2025-11-20/checkpoint-74a18b87-6172-4215-962b-44bb9f46a662.json +69 -0
  4. package/.ax-cli/checkpoints/2025-11-20/checkpoint-870a5fb9-6e82-4ff2-8ec8-af4c251cc514.json +44 -0
  5. package/.ax-cli/checkpoints/2025-11-20/checkpoint-93946601-0e83-456c-ba47-def9713124dd.json +24 -0
  6. package/.ax-cli/checkpoints/metadata.json +62 -0
  7. package/README.md +87 -11
  8. package/dist/agent/context-manager.d.ts +2 -2
  9. package/dist/agent/context-manager.js +37 -15
  10. package/dist/agent/context-manager.js.map +1 -1
  11. package/dist/agent/dependency-resolver.d.ts +83 -0
  12. package/dist/agent/dependency-resolver.js +310 -0
  13. package/dist/agent/dependency-resolver.js.map +1 -0
  14. package/dist/agent/llm-agent.d.ts +111 -0
  15. package/dist/agent/llm-agent.js +625 -3
  16. package/dist/agent/llm-agent.js.map +1 -1
  17. package/dist/agent/specialized/analysis-agent.d.ts +11 -0
  18. package/dist/agent/specialized/analysis-agent.js +33 -0
  19. package/dist/agent/specialized/analysis-agent.js.map +1 -0
  20. package/dist/agent/specialized/debug-agent.d.ts +11 -0
  21. package/dist/agent/specialized/debug-agent.js +33 -0
  22. package/dist/agent/specialized/debug-agent.js.map +1 -0
  23. package/dist/agent/specialized/documentation-agent.d.ts +11 -0
  24. package/dist/agent/specialized/documentation-agent.js +33 -0
  25. package/dist/agent/specialized/documentation-agent.js.map +1 -0
  26. package/dist/agent/specialized/index.d.ts +11 -0
  27. package/dist/agent/specialized/index.js +12 -0
  28. package/dist/agent/specialized/index.js.map +1 -0
  29. package/dist/agent/specialized/performance-agent.d.ts +11 -0
  30. package/dist/agent/specialized/performance-agent.js +33 -0
  31. package/dist/agent/specialized/performance-agent.js.map +1 -0
  32. package/dist/agent/specialized/refactoring-agent.d.ts +11 -0
  33. package/dist/agent/specialized/refactoring-agent.js +33 -0
  34. package/dist/agent/specialized/refactoring-agent.js.map +1 -0
  35. package/dist/agent/specialized/testing-agent.d.ts +11 -0
  36. package/dist/agent/specialized/testing-agent.js +33 -0
  37. package/dist/agent/specialized/testing-agent.js.map +1 -0
  38. package/dist/agent/subagent-orchestrator.d.ts +128 -0
  39. package/dist/agent/subagent-orchestrator.js +388 -0
  40. package/dist/agent/subagent-orchestrator.js.map +1 -0
  41. package/dist/agent/subagent-types.d.ts +262 -0
  42. package/dist/agent/subagent-types.js +152 -0
  43. package/dist/agent/subagent-types.js.map +1 -0
  44. package/dist/agent/subagent.d.ts +88 -0
  45. package/dist/agent/subagent.js +426 -0
  46. package/dist/agent/subagent.js.map +1 -0
  47. package/dist/checkpoint/index.d.ts +9 -0
  48. package/dist/checkpoint/index.js +11 -0
  49. package/dist/checkpoint/index.js.map +1 -0
  50. package/dist/checkpoint/manager.d.ts +99 -0
  51. package/dist/checkpoint/manager.js +281 -0
  52. package/dist/checkpoint/manager.js.map +1 -0
  53. package/dist/checkpoint/storage.d.ts +31 -0
  54. package/dist/checkpoint/storage.js +265 -0
  55. package/dist/checkpoint/storage.js.map +1 -0
  56. package/dist/checkpoint/types.d.ts +111 -0
  57. package/dist/checkpoint/types.js +17 -0
  58. package/dist/checkpoint/types.js.map +1 -0
  59. package/dist/commands/cache.js +5 -3
  60. package/dist/commands/cache.js.map +1 -1
  61. package/dist/commands/memory.js +21 -16
  62. package/dist/commands/memory.js.map +1 -1
  63. package/dist/commands/plan.d.ts +43 -0
  64. package/dist/commands/plan.js +385 -0
  65. package/dist/commands/plan.js.map +1 -0
  66. package/dist/commands/rewind.d.ts +19 -0
  67. package/dist/commands/rewind.js +221 -0
  68. package/dist/commands/rewind.js.map +1 -0
  69. package/dist/constants.d.ts +28 -0
  70. package/dist/constants.js +29 -0
  71. package/dist/constants.js.map +1 -1
  72. package/dist/hooks/use-enhanced-input.d.ts +5 -1
  73. package/dist/hooks/use-enhanced-input.js +23 -10
  74. package/dist/hooks/use-enhanced-input.js.map +1 -1
  75. package/dist/hooks/use-input-handler.d.ts +11 -1
  76. package/dist/hooks/use-input-handler.js +294 -2
  77. package/dist/hooks/use-input-handler.js.map +1 -1
  78. package/dist/llm/client.js +2 -1
  79. package/dist/llm/client.js.map +1 -1
  80. package/dist/llm/tools.d.ts +5 -0
  81. package/dist/llm/tools.js +57 -6
  82. package/dist/llm/tools.js.map +1 -1
  83. package/dist/mcp/client.d.ts +1 -0
  84. package/dist/mcp/client.js +30 -8
  85. package/dist/mcp/client.js.map +1 -1
  86. package/dist/mcp/transports.d.ts +0 -1
  87. package/dist/mcp/transports.js +10 -7
  88. package/dist/mcp/transports.js.map +1 -1
  89. package/dist/planner/dependency-resolver.d.ts +72 -0
  90. package/dist/planner/dependency-resolver.js +272 -0
  91. package/dist/planner/dependency-resolver.js.map +1 -0
  92. package/dist/planner/index.d.ts +12 -0
  93. package/dist/planner/index.js +26 -0
  94. package/dist/planner/index.js.map +1 -0
  95. package/dist/planner/plan-generator.d.ts +74 -0
  96. package/dist/planner/plan-generator.js +244 -0
  97. package/dist/planner/plan-generator.js.map +1 -0
  98. package/dist/planner/plan-storage.d.ts +98 -0
  99. package/dist/planner/plan-storage.js +325 -0
  100. package/dist/planner/plan-storage.js.map +1 -0
  101. package/dist/planner/prompts/planning-prompt.d.ts +41 -0
  102. package/dist/planner/prompts/planning-prompt.js +289 -0
  103. package/dist/planner/prompts/planning-prompt.js.map +1 -0
  104. package/dist/planner/task-planner.d.ts +135 -0
  105. package/dist/planner/task-planner.js +493 -0
  106. package/dist/planner/task-planner.js.map +1 -0
  107. package/dist/planner/token-estimator.d.ts +63 -0
  108. package/dist/planner/token-estimator.js +295 -0
  109. package/dist/planner/token-estimator.js.map +1 -0
  110. package/dist/planner/types.d.ts +669 -0
  111. package/dist/planner/types.js +213 -0
  112. package/dist/planner/types.js.map +1 -0
  113. package/dist/schemas/api-schemas.js +4 -0
  114. package/dist/schemas/api-schemas.js.map +1 -1
  115. package/dist/schemas/confirmation-schemas.d.ts +5 -0
  116. package/dist/schemas/confirmation-schemas.js +7 -0
  117. package/dist/schemas/confirmation-schemas.js.map +1 -1
  118. package/dist/schemas/index.d.ts +4 -4
  119. package/dist/tools/bash-output.d.ts +25 -0
  120. package/dist/tools/bash-output.js +145 -0
  121. package/dist/tools/bash-output.js.map +1 -0
  122. package/dist/tools/bash.d.ts +46 -2
  123. package/dist/tools/bash.js +241 -42
  124. package/dist/tools/bash.js.map +1 -1
  125. package/dist/tools/search.js +34 -9
  126. package/dist/tools/search.js.map +1 -1
  127. package/dist/tools/text-editor.d.ts +16 -0
  128. package/dist/tools/text-editor.js +37 -2
  129. package/dist/tools/text-editor.js.map +1 -1
  130. package/dist/ui/components/chat-history.d.ts +1 -0
  131. package/dist/ui/components/chat-history.js +125 -41
  132. package/dist/ui/components/chat-history.js.map +1 -1
  133. package/dist/ui/components/chat-input.js +10 -3
  134. package/dist/ui/components/chat-input.js.map +1 -1
  135. package/dist/ui/components/chat-interface.js +154 -45
  136. package/dist/ui/components/chat-interface.js.map +1 -1
  137. package/dist/ui/components/collapsible-tool-result.d.ts +26 -0
  138. package/dist/ui/components/collapsible-tool-result.js +172 -0
  139. package/dist/ui/components/collapsible-tool-result.js.map +1 -0
  140. package/dist/ui/components/command-suggestions.js +2 -1
  141. package/dist/ui/components/command-suggestions.js.map +1 -1
  142. package/dist/ui/components/confirmation-dialog.js +25 -36
  143. package/dist/ui/components/confirmation-dialog.js.map +1 -1
  144. package/dist/ui/components/index.d.ts +8 -0
  145. package/dist/ui/components/index.js +9 -0
  146. package/dist/ui/components/index.js.map +1 -1
  147. package/dist/ui/components/keyboard-hints.d.ts +35 -0
  148. package/dist/ui/components/keyboard-hints.js +134 -0
  149. package/dist/ui/components/keyboard-hints.js.map +1 -0
  150. package/dist/ui/components/loading-spinner.d.ts +2 -1
  151. package/dist/ui/components/loading-spinner.js +86 -34
  152. package/dist/ui/components/loading-spinner.js.map +1 -1
  153. package/dist/ui/components/phase-progress.d.ts +21 -0
  154. package/dist/ui/components/phase-progress.js +228 -0
  155. package/dist/ui/components/phase-progress.js.map +1 -0
  156. package/dist/ui/components/quick-actions.d.ts +12 -0
  157. package/dist/ui/components/quick-actions.js +122 -0
  158. package/dist/ui/components/quick-actions.js.map +1 -0
  159. package/dist/ui/components/reasoning-display.d.ts +0 -80
  160. package/dist/ui/components/reasoning-display.js +0 -83
  161. package/dist/ui/components/reasoning-display.js.map +1 -1
  162. package/dist/ui/components/status-bar.d.ts +25 -0
  163. package/dist/ui/components/status-bar.js +125 -0
  164. package/dist/ui/components/status-bar.js.map +1 -0
  165. package/dist/ui/components/subagent-monitor.d.ts +29 -0
  166. package/dist/ui/components/subagent-monitor.js +150 -0
  167. package/dist/ui/components/subagent-monitor.js.map +1 -0
  168. package/dist/ui/components/toast-notification.d.ts +123 -0
  169. package/dist/ui/components/toast-notification.js +143 -0
  170. package/dist/ui/components/toast-notification.js.map +1 -0
  171. package/dist/ui/components/welcome-panel.d.ts +10 -0
  172. package/dist/ui/components/welcome-panel.js +107 -0
  173. package/dist/ui/components/welcome-panel.js.map +1 -0
  174. package/dist/utils/background-task-manager.d.ts +95 -0
  175. package/dist/utils/background-task-manager.js +330 -0
  176. package/dist/utils/background-task-manager.js.map +1 -0
  177. package/dist/utils/confirmation-service.js +8 -3
  178. package/dist/utils/confirmation-service.js.map +1 -1
  179. package/dist/utils/history-manager.d.ts +1 -0
  180. package/dist/utils/history-manager.js +40 -5
  181. package/dist/utils/history-manager.js.map +1 -1
  182. package/dist/utils/json-utils.d.ts +7 -0
  183. package/dist/utils/json-utils.js +70 -2
  184. package/dist/utils/json-utils.js.map +1 -1
  185. package/dist/utils/message-optimizer.d.ts +1 -0
  186. package/dist/utils/message-optimizer.js +7 -1
  187. package/dist/utils/message-optimizer.js.map +1 -1
  188. package/dist/utils/project-analyzer.js +5 -2
  189. package/dist/utils/project-analyzer.js.map +1 -1
  190. package/dist/utils/settings-manager.js +12 -10
  191. package/dist/utils/settings-manager.js.map +1 -1
  192. package/dist/utils/text-utils.js +3 -3
  193. package/dist/utils/text-utils.js.map +1 -1
  194. package/dist/utils/token-counter.d.ts +5 -0
  195. package/dist/utils/token-counter.js +18 -3
  196. package/dist/utils/token-counter.js.map +1 -1
  197. package/package.json +3 -1
@@ -0,0 +1,669 @@
1
+ /**
2
+ * Multi-Phase Task Planning System - Type Definitions
3
+ *
4
+ * Defines the core data structures for task decomposition,
5
+ * phase execution, and plan persistence.
6
+ */
7
+ import { z } from "zod";
8
+ /**
9
+ * Risk level for a phase - determines approval requirements
10
+ */
11
+ export declare enum RiskLevel {
12
+ LOW = "low",
13
+ MEDIUM = "medium",
14
+ HIGH = "high"
15
+ }
16
+ /**
17
+ * Fallback strategy when a phase fails
18
+ */
19
+ export declare enum FallbackStrategy {
20
+ RETRY = "retry",// Retry the phase (up to max attempts)
21
+ SKIP = "skip",// Skip and continue to next phase
22
+ ABORT = "abort"
23
+ }
24
+ /**
25
+ * Status of an individual phase
26
+ */
27
+ export declare enum PhaseStatus {
28
+ PENDING = "pending",// Not started yet
29
+ APPROVED = "approved",// User approved (if required)
30
+ QUEUED = "queued",// Ready to execute
31
+ EXECUTING = "executing",// Currently running
32
+ COMPLETED = "completed",// Successfully finished
33
+ FAILED = "failed",// Execution failed
34
+ SKIPPED = "skipped",// User skipped
35
+ CANCELLED = "cancelled"
36
+ }
37
+ /**
38
+ * Status of the overall plan
39
+ */
40
+ export declare enum PlanStatus {
41
+ CREATED = "created",// Plan generated, not approved
42
+ APPROVED = "approved",// User approved, ready to execute
43
+ EXECUTING = "executing",// Currently running phases
44
+ PAUSED = "paused",// User paused execution
45
+ COMPLETED = "completed",// All phases done
46
+ FAILED = "failed",// A phase failed, awaiting action
47
+ ABANDONED = "abandoned"
48
+ }
49
+ /**
50
+ * Represents a single phase in the execution plan
51
+ */
52
+ export interface TaskPhase {
53
+ /** Unique identifier for this phase */
54
+ id: string;
55
+ /** Order in the plan (0-indexed) */
56
+ index: number;
57
+ /** Short descriptive name */
58
+ name: string;
59
+ /** Detailed description of what this phase accomplishes */
60
+ description: string;
61
+ /** Specific objectives/goals for this phase */
62
+ objectives: string[];
63
+ /** Tools that this phase is expected to use */
64
+ toolsRequired: string[];
65
+ /** Phase IDs that must complete before this one */
66
+ dependencies: string[];
67
+ /** Whether this phase can run in parallel with others */
68
+ canRunInParallel: boolean;
69
+ /** Risk assessment for this phase */
70
+ riskLevel: RiskLevel;
71
+ /** Whether user approval is required before execution */
72
+ requiresApproval: boolean;
73
+ /** What to do if this phase fails */
74
+ fallbackStrategy: FallbackStrategy;
75
+ /** Maximum retry attempts (if fallbackStrategy is RETRY) */
76
+ maxRetries: number;
77
+ /** Current status of this phase */
78
+ status: PhaseStatus;
79
+ /** When execution started */
80
+ startedAt?: Date;
81
+ /** When execution completed */
82
+ completedAt?: Date;
83
+ /** Duration in milliseconds */
84
+ duration?: number;
85
+ /** Checkpoint ID created before this phase */
86
+ checkpointId?: string;
87
+ /** Number of retry attempts made */
88
+ retryCount: number;
89
+ /** Summary of phase output/results */
90
+ output?: string;
91
+ /** Error message if failed */
92
+ error?: string;
93
+ /** Tokens consumed by this phase */
94
+ tokensUsed?: number;
95
+ /** Files modified during this phase */
96
+ filesModified?: string[];
97
+ }
98
+ /**
99
+ * Represents a complete execution plan
100
+ */
101
+ export interface TaskPlan {
102
+ /** Unique identifier for this plan */
103
+ id: string;
104
+ /** Schema version for migrations */
105
+ version: number;
106
+ /** Original user request that triggered planning */
107
+ originalPrompt: string;
108
+ /** LLM's reasoning for this decomposition */
109
+ reasoning: string;
110
+ /** Overall complexity assessment */
111
+ complexity: "simple" | "moderate" | "complex";
112
+ /** Ordered list of phases */
113
+ phases: TaskPhase[];
114
+ /** Index of currently executing phase (-1 if not started) */
115
+ currentPhaseIndex: number;
116
+ /** Overall plan status */
117
+ status: PlanStatus;
118
+ /** When the plan was created */
119
+ createdAt: Date;
120
+ /** Last update timestamp */
121
+ updatedAt: Date;
122
+ /** Estimated total tokens for all phases */
123
+ estimatedTotalTokens: number;
124
+ /** Estimated total duration in milliseconds */
125
+ estimatedDuration: number;
126
+ /** Checkpoint ID for plan start state */
127
+ initialCheckpointId?: string;
128
+ /** Total tokens actually used */
129
+ totalTokensUsed: number;
130
+ /** Actual total duration */
131
+ actualDuration: number;
132
+ /** Number of phases completed */
133
+ phasesCompleted: number;
134
+ /** Number of phases failed */
135
+ phasesFailed: number;
136
+ /** Number of phases skipped */
137
+ phasesSkipped: number;
138
+ }
139
+ /**
140
+ * Result of executing a single phase
141
+ */
142
+ export interface PhaseResult {
143
+ /** Phase ID */
144
+ phaseId: string;
145
+ /** Whether execution succeeded */
146
+ success: boolean;
147
+ /** Output/summary from the phase */
148
+ output?: string;
149
+ /** Error message if failed */
150
+ error?: string;
151
+ /** Duration in milliseconds */
152
+ duration: number;
153
+ /** Tokens consumed */
154
+ tokensUsed: number;
155
+ /** Files that were modified */
156
+ filesModified: string[];
157
+ /** Checkpoint ID after this phase */
158
+ checkpointId?: string;
159
+ /** Whether this was a retry */
160
+ wasRetry: boolean;
161
+ /** Retry attempt number (0 for first attempt) */
162
+ retryAttempt: number;
163
+ }
164
+ /**
165
+ * Result of executing an entire plan
166
+ */
167
+ export interface PlanResult {
168
+ /** Plan ID */
169
+ planId: string;
170
+ /** Overall success (all phases completed) */
171
+ success: boolean;
172
+ /** Results for each phase */
173
+ phaseResults: PhaseResult[];
174
+ /** Total duration */
175
+ totalDuration: number;
176
+ /** Total tokens used */
177
+ totalTokensUsed: number;
178
+ /** Summary of what was accomplished */
179
+ summary: string;
180
+ /** Any warnings or notes */
181
+ warnings: string[];
182
+ }
183
+ /**
184
+ * Options for plan execution
185
+ */
186
+ export interface ExecutionOptions {
187
+ /** Auto-approve all phases (bypass approval gates) */
188
+ autoApprove: boolean;
189
+ /** Auto-approve only low-risk phases */
190
+ autoApproveLowRisk: boolean;
191
+ /** Create checkpoints before each phase */
192
+ createCheckpoints: boolean;
193
+ /** Prune context between phases */
194
+ pruneContextBetweenPhases: boolean;
195
+ /** Target context percentage after pruning */
196
+ targetContextPercentage: number;
197
+ /** Maximum parallel phases */
198
+ maxParallelPhases: number;
199
+ /** Phase timeout in milliseconds */
200
+ phaseTimeoutMs: number;
201
+ /** Callback when phase starts */
202
+ onPhaseStart?: (phase: TaskPhase) => void;
203
+ /** Callback when phase completes */
204
+ onPhaseComplete?: (phase: TaskPhase, result: PhaseResult) => void;
205
+ /** Callback when phase fails */
206
+ onPhaseFailed?: (phase: TaskPhase, error: Error) => void;
207
+ /** Callback for approval request */
208
+ onApprovalRequest?: (phase: TaskPhase) => Promise<boolean>;
209
+ /** Callback when plan is paused */
210
+ onPlanPaused?: (plan: TaskPlan) => void;
211
+ }
212
+ /**
213
+ * Options for the TaskPlanner
214
+ */
215
+ export interface PlannerOptions {
216
+ /** Maximum phases to generate */
217
+ maxPhases: number;
218
+ /** Minimum tool calls to trigger auto-planning */
219
+ autoPlanThreshold: number;
220
+ /** Whether to require plan approval before execution */
221
+ requirePlanApproval: boolean;
222
+ /** Whether to require approval for high-risk phases */
223
+ requireHighRiskApproval: boolean;
224
+ /** Default execution options */
225
+ defaultExecutionOptions: Partial<ExecutionOptions>;
226
+ }
227
+ /**
228
+ * Saved plan state for persistence
229
+ */
230
+ export interface SavedPlanState {
231
+ /** The plan definition */
232
+ plan: TaskPlan;
233
+ /** When the state was saved */
234
+ savedAt: Date;
235
+ /** Reason for saving (paused, checkpoint, etc.) */
236
+ saveReason: "paused" | "checkpoint" | "completed" | "failed";
237
+ /** Conversation context at save time */
238
+ conversationContext?: unknown[];
239
+ /** Files that were tracked */
240
+ trackedFiles?: Array<{
241
+ path: string;
242
+ hash: string;
243
+ }>;
244
+ }
245
+ export declare const RiskLevelSchema: z.ZodNativeEnum<typeof RiskLevel>;
246
+ export declare const FallbackStrategySchema: z.ZodNativeEnum<typeof FallbackStrategy>;
247
+ export declare const PhaseStatusSchema: z.ZodNativeEnum<typeof PhaseStatus>;
248
+ export declare const PlanStatusSchema: z.ZodNativeEnum<typeof PlanStatus>;
249
+ export declare const TaskPhaseSchema: z.ZodObject<{
250
+ id: z.ZodString;
251
+ index: z.ZodNumber;
252
+ name: z.ZodString;
253
+ description: z.ZodString;
254
+ objectives: z.ZodArray<z.ZodString, "many">;
255
+ toolsRequired: z.ZodArray<z.ZodString, "many">;
256
+ dependencies: z.ZodArray<z.ZodString, "many">;
257
+ canRunInParallel: z.ZodBoolean;
258
+ riskLevel: z.ZodNativeEnum<typeof RiskLevel>;
259
+ requiresApproval: z.ZodBoolean;
260
+ fallbackStrategy: z.ZodNativeEnum<typeof FallbackStrategy>;
261
+ maxRetries: z.ZodDefault<z.ZodNumber>;
262
+ status: z.ZodNativeEnum<typeof PhaseStatus>;
263
+ startedAt: z.ZodOptional<z.ZodDate>;
264
+ completedAt: z.ZodOptional<z.ZodDate>;
265
+ duration: z.ZodOptional<z.ZodNumber>;
266
+ checkpointId: z.ZodOptional<z.ZodString>;
267
+ retryCount: z.ZodDefault<z.ZodNumber>;
268
+ output: z.ZodOptional<z.ZodString>;
269
+ error: z.ZodOptional<z.ZodString>;
270
+ tokensUsed: z.ZodOptional<z.ZodNumber>;
271
+ filesModified: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
272
+ }, "strip", z.ZodTypeAny, {
273
+ name: string;
274
+ status: PhaseStatus;
275
+ description: string;
276
+ id: string;
277
+ index: number;
278
+ dependencies: string[];
279
+ objectives: string[];
280
+ toolsRequired: string[];
281
+ canRunInParallel: boolean;
282
+ riskLevel: RiskLevel;
283
+ requiresApproval: boolean;
284
+ fallbackStrategy: FallbackStrategy;
285
+ maxRetries: number;
286
+ retryCount: number;
287
+ duration?: number | undefined;
288
+ error?: string | undefined;
289
+ output?: string | undefined;
290
+ startedAt?: Date | undefined;
291
+ completedAt?: Date | undefined;
292
+ checkpointId?: string | undefined;
293
+ tokensUsed?: number | undefined;
294
+ filesModified?: string[] | undefined;
295
+ }, {
296
+ name: string;
297
+ status: PhaseStatus;
298
+ description: string;
299
+ id: string;
300
+ index: number;
301
+ dependencies: string[];
302
+ objectives: string[];
303
+ toolsRequired: string[];
304
+ canRunInParallel: boolean;
305
+ riskLevel: RiskLevel;
306
+ requiresApproval: boolean;
307
+ fallbackStrategy: FallbackStrategy;
308
+ duration?: number | undefined;
309
+ error?: string | undefined;
310
+ output?: string | undefined;
311
+ maxRetries?: number | undefined;
312
+ startedAt?: Date | undefined;
313
+ completedAt?: Date | undefined;
314
+ checkpointId?: string | undefined;
315
+ retryCount?: number | undefined;
316
+ tokensUsed?: number | undefined;
317
+ filesModified?: string[] | undefined;
318
+ }>;
319
+ export declare const TaskPlanSchema: z.ZodObject<{
320
+ id: z.ZodString;
321
+ version: z.ZodNumber;
322
+ originalPrompt: z.ZodString;
323
+ reasoning: z.ZodString;
324
+ complexity: z.ZodEnum<["simple", "moderate", "complex"]>;
325
+ phases: z.ZodArray<z.ZodObject<{
326
+ id: z.ZodString;
327
+ index: z.ZodNumber;
328
+ name: z.ZodString;
329
+ description: z.ZodString;
330
+ objectives: z.ZodArray<z.ZodString, "many">;
331
+ toolsRequired: z.ZodArray<z.ZodString, "many">;
332
+ dependencies: z.ZodArray<z.ZodString, "many">;
333
+ canRunInParallel: z.ZodBoolean;
334
+ riskLevel: z.ZodNativeEnum<typeof RiskLevel>;
335
+ requiresApproval: z.ZodBoolean;
336
+ fallbackStrategy: z.ZodNativeEnum<typeof FallbackStrategy>;
337
+ maxRetries: z.ZodDefault<z.ZodNumber>;
338
+ status: z.ZodNativeEnum<typeof PhaseStatus>;
339
+ startedAt: z.ZodOptional<z.ZodDate>;
340
+ completedAt: z.ZodOptional<z.ZodDate>;
341
+ duration: z.ZodOptional<z.ZodNumber>;
342
+ checkpointId: z.ZodOptional<z.ZodString>;
343
+ retryCount: z.ZodDefault<z.ZodNumber>;
344
+ output: z.ZodOptional<z.ZodString>;
345
+ error: z.ZodOptional<z.ZodString>;
346
+ tokensUsed: z.ZodOptional<z.ZodNumber>;
347
+ filesModified: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
348
+ }, "strip", z.ZodTypeAny, {
349
+ name: string;
350
+ status: PhaseStatus;
351
+ description: string;
352
+ id: string;
353
+ index: number;
354
+ dependencies: string[];
355
+ objectives: string[];
356
+ toolsRequired: string[];
357
+ canRunInParallel: boolean;
358
+ riskLevel: RiskLevel;
359
+ requiresApproval: boolean;
360
+ fallbackStrategy: FallbackStrategy;
361
+ maxRetries: number;
362
+ retryCount: number;
363
+ duration?: number | undefined;
364
+ error?: string | undefined;
365
+ output?: string | undefined;
366
+ startedAt?: Date | undefined;
367
+ completedAt?: Date | undefined;
368
+ checkpointId?: string | undefined;
369
+ tokensUsed?: number | undefined;
370
+ filesModified?: string[] | undefined;
371
+ }, {
372
+ name: string;
373
+ status: PhaseStatus;
374
+ description: string;
375
+ id: string;
376
+ index: number;
377
+ dependencies: string[];
378
+ objectives: string[];
379
+ toolsRequired: string[];
380
+ canRunInParallel: boolean;
381
+ riskLevel: RiskLevel;
382
+ requiresApproval: boolean;
383
+ fallbackStrategy: FallbackStrategy;
384
+ duration?: number | undefined;
385
+ error?: string | undefined;
386
+ output?: string | undefined;
387
+ maxRetries?: number | undefined;
388
+ startedAt?: Date | undefined;
389
+ completedAt?: Date | undefined;
390
+ checkpointId?: string | undefined;
391
+ retryCount?: number | undefined;
392
+ tokensUsed?: number | undefined;
393
+ filesModified?: string[] | undefined;
394
+ }>, "many">;
395
+ currentPhaseIndex: z.ZodNumber;
396
+ status: z.ZodNativeEnum<typeof PlanStatus>;
397
+ createdAt: z.ZodDate;
398
+ updatedAt: z.ZodDate;
399
+ estimatedTotalTokens: z.ZodNumber;
400
+ estimatedDuration: z.ZodNumber;
401
+ initialCheckpointId: z.ZodOptional<z.ZodString>;
402
+ totalTokensUsed: z.ZodDefault<z.ZodNumber>;
403
+ actualDuration: z.ZodDefault<z.ZodNumber>;
404
+ phasesCompleted: z.ZodDefault<z.ZodNumber>;
405
+ phasesFailed: z.ZodDefault<z.ZodNumber>;
406
+ phasesSkipped: z.ZodDefault<z.ZodNumber>;
407
+ }, "strip", z.ZodTypeAny, {
408
+ status: PlanStatus;
409
+ id: string;
410
+ reasoning: string;
411
+ version: number;
412
+ originalPrompt: string;
413
+ complexity: "simple" | "moderate" | "complex";
414
+ phases: {
415
+ name: string;
416
+ status: PhaseStatus;
417
+ description: string;
418
+ id: string;
419
+ index: number;
420
+ dependencies: string[];
421
+ objectives: string[];
422
+ toolsRequired: string[];
423
+ canRunInParallel: boolean;
424
+ riskLevel: RiskLevel;
425
+ requiresApproval: boolean;
426
+ fallbackStrategy: FallbackStrategy;
427
+ maxRetries: number;
428
+ retryCount: number;
429
+ duration?: number | undefined;
430
+ error?: string | undefined;
431
+ output?: string | undefined;
432
+ startedAt?: Date | undefined;
433
+ completedAt?: Date | undefined;
434
+ checkpointId?: string | undefined;
435
+ tokensUsed?: number | undefined;
436
+ filesModified?: string[] | undefined;
437
+ }[];
438
+ currentPhaseIndex: number;
439
+ createdAt: Date;
440
+ updatedAt: Date;
441
+ estimatedTotalTokens: number;
442
+ estimatedDuration: number;
443
+ totalTokensUsed: number;
444
+ actualDuration: number;
445
+ phasesCompleted: number;
446
+ phasesFailed: number;
447
+ phasesSkipped: number;
448
+ initialCheckpointId?: string | undefined;
449
+ }, {
450
+ status: PlanStatus;
451
+ id: string;
452
+ reasoning: string;
453
+ version: number;
454
+ originalPrompt: string;
455
+ complexity: "simple" | "moderate" | "complex";
456
+ phases: {
457
+ name: string;
458
+ status: PhaseStatus;
459
+ description: string;
460
+ id: string;
461
+ index: number;
462
+ dependencies: string[];
463
+ objectives: string[];
464
+ toolsRequired: string[];
465
+ canRunInParallel: boolean;
466
+ riskLevel: RiskLevel;
467
+ requiresApproval: boolean;
468
+ fallbackStrategy: FallbackStrategy;
469
+ duration?: number | undefined;
470
+ error?: string | undefined;
471
+ output?: string | undefined;
472
+ maxRetries?: number | undefined;
473
+ startedAt?: Date | undefined;
474
+ completedAt?: Date | undefined;
475
+ checkpointId?: string | undefined;
476
+ retryCount?: number | undefined;
477
+ tokensUsed?: number | undefined;
478
+ filesModified?: string[] | undefined;
479
+ }[];
480
+ currentPhaseIndex: number;
481
+ createdAt: Date;
482
+ updatedAt: Date;
483
+ estimatedTotalTokens: number;
484
+ estimatedDuration: number;
485
+ initialCheckpointId?: string | undefined;
486
+ totalTokensUsed?: number | undefined;
487
+ actualDuration?: number | undefined;
488
+ phasesCompleted?: number | undefined;
489
+ phasesFailed?: number | undefined;
490
+ phasesSkipped?: number | undefined;
491
+ }>;
492
+ export declare const PhaseResultSchema: z.ZodObject<{
493
+ phaseId: z.ZodString;
494
+ success: z.ZodBoolean;
495
+ output: z.ZodOptional<z.ZodString>;
496
+ error: z.ZodOptional<z.ZodString>;
497
+ duration: z.ZodNumber;
498
+ tokensUsed: z.ZodNumber;
499
+ filesModified: z.ZodArray<z.ZodString, "many">;
500
+ checkpointId: z.ZodOptional<z.ZodString>;
501
+ wasRetry: z.ZodBoolean;
502
+ retryAttempt: z.ZodNumber;
503
+ }, "strip", z.ZodTypeAny, {
504
+ duration: number;
505
+ success: boolean;
506
+ tokensUsed: number;
507
+ filesModified: string[];
508
+ phaseId: string;
509
+ wasRetry: boolean;
510
+ retryAttempt: number;
511
+ error?: string | undefined;
512
+ output?: string | undefined;
513
+ checkpointId?: string | undefined;
514
+ }, {
515
+ duration: number;
516
+ success: boolean;
517
+ tokensUsed: number;
518
+ filesModified: string[];
519
+ phaseId: string;
520
+ wasRetry: boolean;
521
+ retryAttempt: number;
522
+ error?: string | undefined;
523
+ output?: string | undefined;
524
+ checkpointId?: string | undefined;
525
+ }>;
526
+ /**
527
+ * Schema for LLM-generated phase (before adding execution state)
528
+ */
529
+ export declare const LLMPhaseResponseSchema: z.ZodObject<{
530
+ name: z.ZodString;
531
+ description: z.ZodString;
532
+ objectives: z.ZodArray<z.ZodString, "many">;
533
+ toolsRequired: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
534
+ dependencies: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
535
+ canRunInParallel: z.ZodDefault<z.ZodBoolean>;
536
+ riskLevel: z.ZodDefault<z.ZodEnum<["low", "medium", "high"]>>;
537
+ requiresApproval: z.ZodDefault<z.ZodBoolean>;
538
+ }, "strip", z.ZodTypeAny, {
539
+ name: string;
540
+ description: string;
541
+ dependencies: string[];
542
+ objectives: string[];
543
+ toolsRequired: string[];
544
+ canRunInParallel: boolean;
545
+ riskLevel: "high" | "medium" | "low";
546
+ requiresApproval: boolean;
547
+ }, {
548
+ name: string;
549
+ description: string;
550
+ objectives: string[];
551
+ dependencies?: string[] | undefined;
552
+ toolsRequired?: string[] | undefined;
553
+ canRunInParallel?: boolean | undefined;
554
+ riskLevel?: "high" | "medium" | "low" | undefined;
555
+ requiresApproval?: boolean | undefined;
556
+ }>;
557
+ /**
558
+ * Schema for LLM-generated plan response
559
+ */
560
+ export declare const LLMPlanResponseSchema: z.ZodObject<{
561
+ reasoning: z.ZodString;
562
+ complexity: z.ZodEnum<["simple", "moderate", "complex"]>;
563
+ phases: z.ZodArray<z.ZodObject<{
564
+ name: z.ZodString;
565
+ description: z.ZodString;
566
+ objectives: z.ZodArray<z.ZodString, "many">;
567
+ toolsRequired: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
568
+ dependencies: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
569
+ canRunInParallel: z.ZodDefault<z.ZodBoolean>;
570
+ riskLevel: z.ZodDefault<z.ZodEnum<["low", "medium", "high"]>>;
571
+ requiresApproval: z.ZodDefault<z.ZodBoolean>;
572
+ }, "strip", z.ZodTypeAny, {
573
+ name: string;
574
+ description: string;
575
+ dependencies: string[];
576
+ objectives: string[];
577
+ toolsRequired: string[];
578
+ canRunInParallel: boolean;
579
+ riskLevel: "high" | "medium" | "low";
580
+ requiresApproval: boolean;
581
+ }, {
582
+ name: string;
583
+ description: string;
584
+ objectives: string[];
585
+ dependencies?: string[] | undefined;
586
+ toolsRequired?: string[] | undefined;
587
+ canRunInParallel?: boolean | undefined;
588
+ riskLevel?: "high" | "medium" | "low" | undefined;
589
+ requiresApproval?: boolean | undefined;
590
+ }>, "many">;
591
+ }, "strip", z.ZodTypeAny, {
592
+ reasoning: string;
593
+ complexity: "simple" | "moderate" | "complex";
594
+ phases: {
595
+ name: string;
596
+ description: string;
597
+ dependencies: string[];
598
+ objectives: string[];
599
+ toolsRequired: string[];
600
+ canRunInParallel: boolean;
601
+ riskLevel: "high" | "medium" | "low";
602
+ requiresApproval: boolean;
603
+ }[];
604
+ }, {
605
+ reasoning: string;
606
+ complexity: "simple" | "moderate" | "complex";
607
+ phases: {
608
+ name: string;
609
+ description: string;
610
+ objectives: string[];
611
+ dependencies?: string[] | undefined;
612
+ toolsRequired?: string[] | undefined;
613
+ canRunInParallel?: boolean | undefined;
614
+ riskLevel?: "high" | "medium" | "low" | undefined;
615
+ requiresApproval?: boolean | undefined;
616
+ }[];
617
+ }>;
618
+ export type LLMPhaseResponse = z.infer<typeof LLMPhaseResponseSchema>;
619
+ export type LLMPlanResponse = z.infer<typeof LLMPlanResponseSchema>;
620
+ /**
621
+ * Phase with minimal info for display
622
+ */
623
+ export interface PhaseDisplayInfo {
624
+ id: string;
625
+ index: number;
626
+ name: string;
627
+ status: PhaseStatus;
628
+ riskLevel: RiskLevel;
629
+ duration?: number;
630
+ isCurrentPhase: boolean;
631
+ }
632
+ /**
633
+ * Plan summary for listing
634
+ */
635
+ export interface PlanSummary {
636
+ id: string;
637
+ originalPrompt: string;
638
+ status: PlanStatus;
639
+ totalPhases: number;
640
+ completedPhases: number;
641
+ createdAt: Date;
642
+ updatedAt: Date;
643
+ }
644
+ /**
645
+ * Recovery action after phase failure
646
+ */
647
+ export interface RecoveryAction {
648
+ action: "retry" | "skip" | "abort" | "rewind";
649
+ phaseId?: string;
650
+ reason?: string;
651
+ attempts?: number;
652
+ delay?: number;
653
+ }
654
+ /**
655
+ * Create a new TaskPhase with defaults
656
+ */
657
+ export declare function createPhase(partial: Partial<TaskPhase> & Pick<TaskPhase, "id" | "index" | "name" | "description">): TaskPhase;
658
+ /**
659
+ * Create a new TaskPlan with defaults
660
+ */
661
+ export declare function createPlan(partial: Partial<TaskPlan> & Pick<TaskPlan, "id" | "originalPrompt" | "phases">): TaskPlan;
662
+ /**
663
+ * Create default execution options
664
+ */
665
+ export declare function createDefaultExecutionOptions(): ExecutionOptions;
666
+ /**
667
+ * Create default planner options
668
+ */
669
+ export declare function createDefaultPlannerOptions(): PlannerOptions;