ferix-code 0.0.1
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.
- package/README.md +216 -0
- package/dist/index.d.ts +2012 -0
- package/dist/index.js +5509 -0
- package/package.json +47 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,2012 @@
|
|
|
1
|
+
import { Schema, Brand, Stream, Effect, Context, Layer } from 'effect';
|
|
2
|
+
import * as effect_Cause from 'effect/Cause';
|
|
3
|
+
import * as effect_Types from 'effect/Types';
|
|
4
|
+
import * as effect_Effect from 'effect/Effect';
|
|
5
|
+
import * as effect_ParseResult from 'effect/ParseResult';
|
|
6
|
+
import * as effect_SchemaAST from 'effect/SchemaAST';
|
|
7
|
+
|
|
8
|
+
declare const LLMError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
9
|
+
readonly _tag: "LLMError";
|
|
10
|
+
} & Readonly<A>;
|
|
11
|
+
/**
|
|
12
|
+
* Error that occurs during LLM execution.
|
|
13
|
+
*/
|
|
14
|
+
declare class LLMError extends LLMError_base<{
|
|
15
|
+
readonly message: string;
|
|
16
|
+
readonly cause?: unknown;
|
|
17
|
+
}> {
|
|
18
|
+
}
|
|
19
|
+
declare const ParseError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
20
|
+
readonly _tag: "ParseError";
|
|
21
|
+
} & Readonly<A>;
|
|
22
|
+
/**
|
|
23
|
+
* Error that occurs when parsing signals from LLM output.
|
|
24
|
+
*/
|
|
25
|
+
declare class ParseError extends ParseError_base<{
|
|
26
|
+
readonly message: string;
|
|
27
|
+
readonly input?: string;
|
|
28
|
+
}> {
|
|
29
|
+
}
|
|
30
|
+
declare const PlanStoreError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
31
|
+
readonly _tag: "PlanStoreError";
|
|
32
|
+
} & Readonly<A>;
|
|
33
|
+
/**
|
|
34
|
+
* Error that occurs during plan storage operations.
|
|
35
|
+
*/
|
|
36
|
+
declare class PlanStoreError extends PlanStoreError_base<{
|
|
37
|
+
readonly message: string;
|
|
38
|
+
readonly operation: "create" | "load" | "update" | "list";
|
|
39
|
+
readonly cause?: unknown;
|
|
40
|
+
}> {
|
|
41
|
+
}
|
|
42
|
+
declare const SessionStoreError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
43
|
+
readonly _tag: "SessionStoreError";
|
|
44
|
+
} & Readonly<A>;
|
|
45
|
+
/**
|
|
46
|
+
* Error that occurs during session storage operations.
|
|
47
|
+
*/
|
|
48
|
+
declare class SessionStoreError extends SessionStoreError_base<{
|
|
49
|
+
readonly message: string;
|
|
50
|
+
readonly operation: "create" | "get" | "update";
|
|
51
|
+
readonly cause?: unknown;
|
|
52
|
+
}> {
|
|
53
|
+
}
|
|
54
|
+
declare const OrchestratorError_base: new <A extends Record<string, any> = {}>(args: effect_Types.Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => effect_Cause.YieldableError & {
|
|
55
|
+
readonly _tag: "OrchestratorError";
|
|
56
|
+
} & Readonly<A>;
|
|
57
|
+
/**
|
|
58
|
+
* Error that occurs during orchestrator execution.
|
|
59
|
+
*/
|
|
60
|
+
declare class OrchestratorError extends OrchestratorError_base<{
|
|
61
|
+
readonly message: string;
|
|
62
|
+
readonly phase: "setup" | "discovery" | "iteration" | "cleanup";
|
|
63
|
+
readonly cause?: unknown;
|
|
64
|
+
}> {
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Union of all possible errors in the system.
|
|
68
|
+
*/
|
|
69
|
+
type FerixError = LLMError | ParseError | PlanStoreError | SessionStoreError | OrchestratorError;
|
|
70
|
+
|
|
71
|
+
declare const PhasePromptOverridesSchema: Schema.Struct<{
|
|
72
|
+
breakdown: Schema.optional<typeof Schema.String>;
|
|
73
|
+
planning: Schema.optional<typeof Schema.String>;
|
|
74
|
+
execution: Schema.optional<typeof Schema.String>;
|
|
75
|
+
check: Schema.optional<typeof Schema.String>;
|
|
76
|
+
verify: Schema.optional<typeof Schema.String>;
|
|
77
|
+
review: Schema.optional<typeof Schema.String>;
|
|
78
|
+
completion: Schema.optional<typeof Schema.String>;
|
|
79
|
+
}>;
|
|
80
|
+
type PhasePromptOverrides = typeof PhasePromptOverridesSchema.Type;
|
|
81
|
+
declare const PromptConfigSchema: Schema.Struct<{
|
|
82
|
+
systemPrompt: Schema.optional<typeof Schema.String>;
|
|
83
|
+
phases: Schema.optional<Schema.Struct<{
|
|
84
|
+
breakdown: Schema.optional<typeof Schema.String>;
|
|
85
|
+
planning: Schema.optional<typeof Schema.String>;
|
|
86
|
+
execution: Schema.optional<typeof Schema.String>;
|
|
87
|
+
check: Schema.optional<typeof Schema.String>;
|
|
88
|
+
verify: Schema.optional<typeof Schema.String>;
|
|
89
|
+
review: Schema.optional<typeof Schema.String>;
|
|
90
|
+
completion: Schema.optional<typeof Schema.String>;
|
|
91
|
+
}>>;
|
|
92
|
+
additionalContext: Schema.optional<typeof Schema.String>;
|
|
93
|
+
}>;
|
|
94
|
+
type PromptConfig = typeof PromptConfigSchema.Type;
|
|
95
|
+
declare const LoopConfigSchema: Schema.Struct<{
|
|
96
|
+
task: typeof Schema.String;
|
|
97
|
+
maxIterations: typeof Schema.Number;
|
|
98
|
+
verifyCommands: Schema.Array$<typeof Schema.String>;
|
|
99
|
+
sessionId: Schema.optional<typeof Schema.String>;
|
|
100
|
+
branch: Schema.optional<typeof Schema.String>;
|
|
101
|
+
push: Schema.optional<typeof Schema.Boolean>;
|
|
102
|
+
pr: Schema.optional<typeof Schema.Boolean>;
|
|
103
|
+
verbose: Schema.optional<typeof Schema.Boolean>;
|
|
104
|
+
prompts: Schema.optional<Schema.Struct<{
|
|
105
|
+
systemPrompt: Schema.optional<typeof Schema.String>;
|
|
106
|
+
phases: Schema.optional<Schema.Struct<{
|
|
107
|
+
breakdown: Schema.optional<typeof Schema.String>;
|
|
108
|
+
planning: Schema.optional<typeof Schema.String>;
|
|
109
|
+
execution: Schema.optional<typeof Schema.String>;
|
|
110
|
+
check: Schema.optional<typeof Schema.String>;
|
|
111
|
+
verify: Schema.optional<typeof Schema.String>;
|
|
112
|
+
review: Schema.optional<typeof Schema.String>;
|
|
113
|
+
completion: Schema.optional<typeof Schema.String>;
|
|
114
|
+
}>>;
|
|
115
|
+
additionalContext: Schema.optional<typeof Schema.String>;
|
|
116
|
+
}>>;
|
|
117
|
+
}>;
|
|
118
|
+
type LoopConfig = typeof LoopConfigSchema.Type;
|
|
119
|
+
declare const LoopSummarySchema: Schema.Struct<{
|
|
120
|
+
iterations: typeof Schema.Number;
|
|
121
|
+
success: typeof Schema.Boolean;
|
|
122
|
+
sessionId: typeof Schema.String;
|
|
123
|
+
completedTasks: Schema.Array$<typeof Schema.String>;
|
|
124
|
+
durationMs: typeof Schema.Number;
|
|
125
|
+
}>;
|
|
126
|
+
type LoopSummary = typeof LoopSummarySchema.Type;
|
|
127
|
+
declare const LoopErrorSchema: Schema.Struct<{
|
|
128
|
+
message: typeof Schema.String;
|
|
129
|
+
phase: typeof Schema.String;
|
|
130
|
+
iteration: Schema.optional<typeof Schema.Number>;
|
|
131
|
+
}>;
|
|
132
|
+
type LoopError = typeof LoopErrorSchema.Type;
|
|
133
|
+
declare const decodeLoopConfig: (u: unknown, overrideOptions?: effect_SchemaAST.ParseOptions) => effect_Effect.Effect<{
|
|
134
|
+
readonly task: string;
|
|
135
|
+
readonly maxIterations: number;
|
|
136
|
+
readonly verifyCommands: readonly string[];
|
|
137
|
+
readonly push?: boolean | undefined;
|
|
138
|
+
readonly sessionId?: string | undefined;
|
|
139
|
+
readonly branch?: string | undefined;
|
|
140
|
+
readonly pr?: boolean | undefined;
|
|
141
|
+
readonly verbose?: boolean | undefined;
|
|
142
|
+
readonly prompts?: {
|
|
143
|
+
readonly systemPrompt?: string | undefined;
|
|
144
|
+
readonly phases?: {
|
|
145
|
+
readonly breakdown?: string | undefined;
|
|
146
|
+
readonly planning?: string | undefined;
|
|
147
|
+
readonly execution?: string | undefined;
|
|
148
|
+
readonly check?: string | undefined;
|
|
149
|
+
readonly verify?: string | undefined;
|
|
150
|
+
readonly review?: string | undefined;
|
|
151
|
+
readonly completion?: string | undefined;
|
|
152
|
+
} | undefined;
|
|
153
|
+
readonly additionalContext?: string | undefined;
|
|
154
|
+
} | undefined;
|
|
155
|
+
}, effect_ParseResult.ParseError, never>;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Loop lifecycle events.
|
|
159
|
+
*/
|
|
160
|
+
declare const LoopStartedEventSchema: Schema.TaggedStruct<"LoopStarted", {
|
|
161
|
+
config: Schema.Struct<{
|
|
162
|
+
task: typeof Schema.String;
|
|
163
|
+
maxIterations: typeof Schema.Number;
|
|
164
|
+
verifyCommands: Schema.Array$<typeof Schema.String>;
|
|
165
|
+
sessionId: Schema.optional<typeof Schema.String>;
|
|
166
|
+
branch: Schema.optional<typeof Schema.String>;
|
|
167
|
+
push: Schema.optional<typeof Schema.Boolean>;
|
|
168
|
+
pr: Schema.optional<typeof Schema.Boolean>;
|
|
169
|
+
verbose: Schema.optional<typeof Schema.Boolean>;
|
|
170
|
+
prompts: Schema.optional<Schema.Struct<{
|
|
171
|
+
systemPrompt: Schema.optional<typeof Schema.String>;
|
|
172
|
+
phases: Schema.optional<Schema.Struct<{
|
|
173
|
+
breakdown: Schema.optional<typeof Schema.String>;
|
|
174
|
+
planning: Schema.optional<typeof Schema.String>;
|
|
175
|
+
execution: Schema.optional<typeof Schema.String>;
|
|
176
|
+
check: Schema.optional<typeof Schema.String>;
|
|
177
|
+
verify: Schema.optional<typeof Schema.String>;
|
|
178
|
+
review: Schema.optional<typeof Schema.String>;
|
|
179
|
+
completion: Schema.optional<typeof Schema.String>;
|
|
180
|
+
}>>;
|
|
181
|
+
additionalContext: Schema.optional<typeof Schema.String>;
|
|
182
|
+
}>>;
|
|
183
|
+
}>;
|
|
184
|
+
timestamp: typeof Schema.Number;
|
|
185
|
+
}>;
|
|
186
|
+
type LoopStartedEvent = typeof LoopStartedEventSchema.Type;
|
|
187
|
+
declare const LoopCompletedEventSchema: Schema.TaggedStruct<"LoopCompleted", {
|
|
188
|
+
summary: Schema.Struct<{
|
|
189
|
+
iterations: typeof Schema.Number;
|
|
190
|
+
success: typeof Schema.Boolean;
|
|
191
|
+
sessionId: typeof Schema.String;
|
|
192
|
+
completedTasks: Schema.Array$<typeof Schema.String>;
|
|
193
|
+
durationMs: typeof Schema.Number;
|
|
194
|
+
}>;
|
|
195
|
+
}>;
|
|
196
|
+
type LoopCompletedEvent = typeof LoopCompletedEventSchema.Type;
|
|
197
|
+
declare const LoopFailedEventSchema: Schema.TaggedStruct<"LoopFailed", {
|
|
198
|
+
error: Schema.Struct<{
|
|
199
|
+
message: typeof Schema.String;
|
|
200
|
+
phase: typeof Schema.String;
|
|
201
|
+
iteration: Schema.optional<typeof Schema.Number>;
|
|
202
|
+
}>;
|
|
203
|
+
}>;
|
|
204
|
+
type LoopFailedEvent = typeof LoopFailedEventSchema.Type;
|
|
205
|
+
/**
|
|
206
|
+
* Discovery phase events.
|
|
207
|
+
*/
|
|
208
|
+
declare const DiscoveryStartedEventSchema: Schema.TaggedStruct<"DiscoveryStarted", {
|
|
209
|
+
timestamp: typeof Schema.Number;
|
|
210
|
+
}>;
|
|
211
|
+
type DiscoveryStartedEvent = typeof DiscoveryStartedEventSchema.Type;
|
|
212
|
+
declare const DiscoveryCompletedEventSchema: Schema.TaggedStruct<"DiscoveryCompleted", {
|
|
213
|
+
taskCount: typeof Schema.Number;
|
|
214
|
+
timestamp: typeof Schema.Number;
|
|
215
|
+
}>;
|
|
216
|
+
type DiscoveryCompletedEvent = typeof DiscoveryCompletedEventSchema.Type;
|
|
217
|
+
/**
|
|
218
|
+
* Iteration events.
|
|
219
|
+
*/
|
|
220
|
+
declare const IterationStartedEventSchema: Schema.TaggedStruct<"IterationStarted", {
|
|
221
|
+
iteration: typeof Schema.Number;
|
|
222
|
+
}>;
|
|
223
|
+
type IterationStartedEvent = typeof IterationStartedEventSchema.Type;
|
|
224
|
+
declare const IterationCompletedEventSchema: Schema.TaggedStruct<"IterationCompleted", {
|
|
225
|
+
iteration: typeof Schema.Number;
|
|
226
|
+
}>;
|
|
227
|
+
type IterationCompletedEvent = typeof IterationCompletedEventSchema.Type;
|
|
228
|
+
/**
|
|
229
|
+
* LLM events.
|
|
230
|
+
*/
|
|
231
|
+
declare const LLMTextEventSchema: Schema.TaggedStruct<"LLMText", {
|
|
232
|
+
text: typeof Schema.String;
|
|
233
|
+
}>;
|
|
234
|
+
type LLMTextEvent = typeof LLMTextEventSchema.Type;
|
|
235
|
+
declare const LLMToolStartEventSchema: Schema.TaggedStruct<"LLMToolStart", {
|
|
236
|
+
tool: typeof Schema.String;
|
|
237
|
+
}>;
|
|
238
|
+
type LLMToolStartEvent = typeof LLMToolStartEventSchema.Type;
|
|
239
|
+
declare const LLMToolUseEventSchema: Schema.TaggedStruct<"LLMToolUse", {
|
|
240
|
+
tool: typeof Schema.String;
|
|
241
|
+
input: typeof Schema.Unknown;
|
|
242
|
+
}>;
|
|
243
|
+
type LLMToolUseEvent = typeof LLMToolUseEventSchema.Type;
|
|
244
|
+
declare const LLMToolEndEventSchema: Schema.TaggedStruct<"LLMToolEnd", {
|
|
245
|
+
tool: typeof Schema.String;
|
|
246
|
+
}>;
|
|
247
|
+
type LLMToolEndEvent = typeof LLMToolEndEventSchema.Type;
|
|
248
|
+
/**
|
|
249
|
+
* Task/Phase/Criteria definition events.
|
|
250
|
+
*/
|
|
251
|
+
declare const TasksDefinedEventSchema: Schema.TaggedStruct<"TasksDefined", Readonly<{
|
|
252
|
+
tasks: Schema.Array$<Schema.Struct<{
|
|
253
|
+
id: typeof Schema.String;
|
|
254
|
+
title: typeof Schema.String;
|
|
255
|
+
description: typeof Schema.String;
|
|
256
|
+
}>>;
|
|
257
|
+
}> & Schema.Struct.Fields>;
|
|
258
|
+
type TasksDefinedEvent = typeof TasksDefinedEventSchema.Type;
|
|
259
|
+
declare const PhasesDefinedEventSchema: Schema.TaggedStruct<"PhasesDefined", Readonly<{
|
|
260
|
+
taskId: typeof Schema.String;
|
|
261
|
+
phases: Schema.Array$<Schema.Struct<{
|
|
262
|
+
id: typeof Schema.String;
|
|
263
|
+
description: typeof Schema.String;
|
|
264
|
+
}>>;
|
|
265
|
+
}> & Schema.Struct.Fields>;
|
|
266
|
+
type PhasesDefinedEvent = typeof PhasesDefinedEventSchema.Type;
|
|
267
|
+
declare const CriteriaDefinedEventSchema: Schema.TaggedStruct<"CriteriaDefined", Readonly<{
|
|
268
|
+
taskId: typeof Schema.String;
|
|
269
|
+
criteria: Schema.Array$<Schema.Struct<{
|
|
270
|
+
id: typeof Schema.String;
|
|
271
|
+
description: typeof Schema.String;
|
|
272
|
+
}>>;
|
|
273
|
+
}> & Schema.Struct.Fields>;
|
|
274
|
+
type CriteriaDefinedEvent = typeof CriteriaDefinedEventSchema.Type;
|
|
275
|
+
/**
|
|
276
|
+
* Phase lifecycle events.
|
|
277
|
+
*/
|
|
278
|
+
declare const PhaseStartedEventSchema: Schema.TaggedStruct<"PhaseStarted", Readonly<{
|
|
279
|
+
phaseId: typeof Schema.String;
|
|
280
|
+
}> & Schema.Struct.Fields>;
|
|
281
|
+
type PhaseStartedEvent = typeof PhaseStartedEventSchema.Type;
|
|
282
|
+
declare const PhaseCompletedEventSchema: Schema.TaggedStruct<"PhaseCompleted", Readonly<{
|
|
283
|
+
phaseId: typeof Schema.String;
|
|
284
|
+
}> & Schema.Struct.Fields>;
|
|
285
|
+
type PhaseCompletedEvent = typeof PhaseCompletedEventSchema.Type;
|
|
286
|
+
declare const PhaseFailedEventSchema: Schema.TaggedStruct<"PhaseFailed", Readonly<{
|
|
287
|
+
phaseId: typeof Schema.String;
|
|
288
|
+
reason: typeof Schema.String;
|
|
289
|
+
}> & Schema.Struct.Fields>;
|
|
290
|
+
type PhaseFailedEvent = typeof PhaseFailedEventSchema.Type;
|
|
291
|
+
/**
|
|
292
|
+
* Criterion events.
|
|
293
|
+
*/
|
|
294
|
+
declare const CriterionPassedEventSchema: Schema.TaggedStruct<"CriterionPassed", Readonly<{
|
|
295
|
+
criterionId: typeof Schema.String;
|
|
296
|
+
}> & Schema.Struct.Fields>;
|
|
297
|
+
type CriterionPassedEvent = typeof CriterionPassedEventSchema.Type;
|
|
298
|
+
declare const CriterionFailedEventSchema: Schema.TaggedStruct<"CriterionFailed", Readonly<{
|
|
299
|
+
criterionId: typeof Schema.String;
|
|
300
|
+
reason: typeof Schema.String;
|
|
301
|
+
}> & Schema.Struct.Fields>;
|
|
302
|
+
type CriterionFailedEvent = typeof CriterionFailedEventSchema.Type;
|
|
303
|
+
/**
|
|
304
|
+
* Check events.
|
|
305
|
+
*/
|
|
306
|
+
declare const CheckPassedEventSchema: Schema.TaggedStruct<"CheckPassed", {}>;
|
|
307
|
+
type CheckPassedEvent = typeof CheckPassedEventSchema.Type;
|
|
308
|
+
declare const CheckFailedEventSchema: Schema.TaggedStruct<"CheckFailed", {
|
|
309
|
+
failedCriteria: Schema.Array$<typeof Schema.String>;
|
|
310
|
+
}>;
|
|
311
|
+
type CheckFailedEvent = typeof CheckFailedEventSchema.Type;
|
|
312
|
+
/**
|
|
313
|
+
* Review event.
|
|
314
|
+
*/
|
|
315
|
+
declare const ReviewCompleteEventSchema: Schema.TaggedStruct<"ReviewComplete", Readonly<{
|
|
316
|
+
changesMade: typeof Schema.Boolean;
|
|
317
|
+
}> & Schema.Struct.Fields>;
|
|
318
|
+
type ReviewCompleteEvent = typeof ReviewCompleteEventSchema.Type;
|
|
319
|
+
/**
|
|
320
|
+
* Task completion event.
|
|
321
|
+
*/
|
|
322
|
+
declare const TaskCompletedEventSchema: Schema.TaggedStruct<"TaskCompleted", Readonly<{
|
|
323
|
+
taskId: typeof Schema.String;
|
|
324
|
+
summary: typeof Schema.String;
|
|
325
|
+
}> & Schema.Struct.Fields>;
|
|
326
|
+
type TaskCompletedEvent = typeof TaskCompletedEventSchema.Type;
|
|
327
|
+
/**
|
|
328
|
+
* Plan events.
|
|
329
|
+
*/
|
|
330
|
+
declare const PlanCreatedEventSchema: Schema.TaggedStruct<"PlanCreated", {
|
|
331
|
+
plan: Schema.Struct<{
|
|
332
|
+
id: typeof Schema.String;
|
|
333
|
+
sessionId: typeof Schema.String;
|
|
334
|
+
createdAt: typeof Schema.String;
|
|
335
|
+
originalTask: typeof Schema.String;
|
|
336
|
+
context: Schema.optional<typeof Schema.String>;
|
|
337
|
+
tasks: Schema.Array$<Schema.Struct<{
|
|
338
|
+
id: typeof Schema.String;
|
|
339
|
+
title: typeof Schema.String;
|
|
340
|
+
description: typeof Schema.String;
|
|
341
|
+
status: Schema.Literal<["pending", "planning", "in_progress", "done", "failed", "skipped"]>;
|
|
342
|
+
phases: Schema.Array$<Schema.Struct<{
|
|
343
|
+
id: typeof Schema.String;
|
|
344
|
+
description: typeof Schema.String;
|
|
345
|
+
status: Schema.Literal<["pending", "in_progress", "done", "failed"]>;
|
|
346
|
+
}>>;
|
|
347
|
+
criteria: Schema.Array$<Schema.Struct<{
|
|
348
|
+
id: typeof Schema.String;
|
|
349
|
+
description: typeof Schema.String;
|
|
350
|
+
status: Schema.Literal<["pending", "passed", "failed"]>;
|
|
351
|
+
failureReason: Schema.optional<typeof Schema.String>;
|
|
352
|
+
}>>;
|
|
353
|
+
filesToModify: Schema.Array$<typeof Schema.String>;
|
|
354
|
+
attempts: typeof Schema.Number;
|
|
355
|
+
completionNotes: Schema.optional<typeof Schema.String>;
|
|
356
|
+
}>>;
|
|
357
|
+
}>;
|
|
358
|
+
}>;
|
|
359
|
+
type PlanCreatedEvent = typeof PlanCreatedEventSchema.Type;
|
|
360
|
+
declare const PlanUpdatedEventSchema: Schema.TaggedStruct<"PlanUpdated", {
|
|
361
|
+
plan: Schema.Struct<{
|
|
362
|
+
id: typeof Schema.String;
|
|
363
|
+
sessionId: typeof Schema.String;
|
|
364
|
+
createdAt: typeof Schema.String;
|
|
365
|
+
originalTask: typeof Schema.String;
|
|
366
|
+
context: Schema.optional<typeof Schema.String>;
|
|
367
|
+
tasks: Schema.Array$<Schema.Struct<{
|
|
368
|
+
id: typeof Schema.String;
|
|
369
|
+
title: typeof Schema.String;
|
|
370
|
+
description: typeof Schema.String;
|
|
371
|
+
status: Schema.Literal<["pending", "planning", "in_progress", "done", "failed", "skipped"]>;
|
|
372
|
+
phases: Schema.Array$<Schema.Struct<{
|
|
373
|
+
id: typeof Schema.String;
|
|
374
|
+
description: typeof Schema.String;
|
|
375
|
+
status: Schema.Literal<["pending", "in_progress", "done", "failed"]>;
|
|
376
|
+
}>>;
|
|
377
|
+
criteria: Schema.Array$<Schema.Struct<{
|
|
378
|
+
id: typeof Schema.String;
|
|
379
|
+
description: typeof Schema.String;
|
|
380
|
+
status: Schema.Literal<["pending", "passed", "failed"]>;
|
|
381
|
+
failureReason: Schema.optional<typeof Schema.String>;
|
|
382
|
+
}>>;
|
|
383
|
+
filesToModify: Schema.Array$<typeof Schema.String>;
|
|
384
|
+
attempts: typeof Schema.Number;
|
|
385
|
+
completionNotes: Schema.optional<typeof Schema.String>;
|
|
386
|
+
}>>;
|
|
387
|
+
}>;
|
|
388
|
+
}>;
|
|
389
|
+
type PlanUpdatedEvent = typeof PlanUpdatedEventSchema.Type;
|
|
390
|
+
declare const PlanUpdateFailedEventSchema: Schema.TaggedStruct<"PlanUpdateFailed", {
|
|
391
|
+
operation: Schema.Literal<["create", "update"]>;
|
|
392
|
+
error: typeof Schema.String;
|
|
393
|
+
planId: Schema.optional<typeof Schema.String>;
|
|
394
|
+
}>;
|
|
395
|
+
type PlanUpdateFailedEvent = typeof PlanUpdateFailedEventSchema.Type;
|
|
396
|
+
/**
|
|
397
|
+
* Union of all domain events.
|
|
398
|
+
*/
|
|
399
|
+
declare const DomainEventSchema: Schema.Union<[Schema.TaggedStruct<"LoopStarted", {
|
|
400
|
+
config: Schema.Struct<{
|
|
401
|
+
task: typeof Schema.String;
|
|
402
|
+
maxIterations: typeof Schema.Number;
|
|
403
|
+
verifyCommands: Schema.Array$<typeof Schema.String>;
|
|
404
|
+
sessionId: Schema.optional<typeof Schema.String>;
|
|
405
|
+
branch: Schema.optional<typeof Schema.String>;
|
|
406
|
+
push: Schema.optional<typeof Schema.Boolean>;
|
|
407
|
+
pr: Schema.optional<typeof Schema.Boolean>;
|
|
408
|
+
verbose: Schema.optional<typeof Schema.Boolean>;
|
|
409
|
+
prompts: Schema.optional<Schema.Struct<{
|
|
410
|
+
systemPrompt: Schema.optional<typeof Schema.String>;
|
|
411
|
+
phases: Schema.optional<Schema.Struct<{
|
|
412
|
+
breakdown: Schema.optional<typeof Schema.String>;
|
|
413
|
+
planning: Schema.optional<typeof Schema.String>;
|
|
414
|
+
execution: Schema.optional<typeof Schema.String>;
|
|
415
|
+
check: Schema.optional<typeof Schema.String>;
|
|
416
|
+
verify: Schema.optional<typeof Schema.String>;
|
|
417
|
+
review: Schema.optional<typeof Schema.String>;
|
|
418
|
+
completion: Schema.optional<typeof Schema.String>;
|
|
419
|
+
}>>;
|
|
420
|
+
additionalContext: Schema.optional<typeof Schema.String>;
|
|
421
|
+
}>>;
|
|
422
|
+
}>;
|
|
423
|
+
timestamp: typeof Schema.Number;
|
|
424
|
+
}>, Schema.TaggedStruct<"LoopCompleted", {
|
|
425
|
+
summary: Schema.Struct<{
|
|
426
|
+
iterations: typeof Schema.Number;
|
|
427
|
+
success: typeof Schema.Boolean;
|
|
428
|
+
sessionId: typeof Schema.String;
|
|
429
|
+
completedTasks: Schema.Array$<typeof Schema.String>;
|
|
430
|
+
durationMs: typeof Schema.Number;
|
|
431
|
+
}>;
|
|
432
|
+
}>, Schema.TaggedStruct<"LoopFailed", {
|
|
433
|
+
error: Schema.Struct<{
|
|
434
|
+
message: typeof Schema.String;
|
|
435
|
+
phase: typeof Schema.String;
|
|
436
|
+
iteration: Schema.optional<typeof Schema.Number>;
|
|
437
|
+
}>;
|
|
438
|
+
}>, Schema.TaggedStruct<"DiscoveryStarted", {
|
|
439
|
+
timestamp: typeof Schema.Number;
|
|
440
|
+
}>, Schema.TaggedStruct<"DiscoveryCompleted", {
|
|
441
|
+
taskCount: typeof Schema.Number;
|
|
442
|
+
timestamp: typeof Schema.Number;
|
|
443
|
+
}>, Schema.TaggedStruct<"IterationStarted", {
|
|
444
|
+
iteration: typeof Schema.Number;
|
|
445
|
+
}>, Schema.TaggedStruct<"IterationCompleted", {
|
|
446
|
+
iteration: typeof Schema.Number;
|
|
447
|
+
}>, Schema.TaggedStruct<"LLMText", {
|
|
448
|
+
text: typeof Schema.String;
|
|
449
|
+
}>, Schema.TaggedStruct<"LLMToolStart", {
|
|
450
|
+
tool: typeof Schema.String;
|
|
451
|
+
}>, Schema.TaggedStruct<"LLMToolUse", {
|
|
452
|
+
tool: typeof Schema.String;
|
|
453
|
+
input: typeof Schema.Unknown;
|
|
454
|
+
}>, Schema.TaggedStruct<"LLMToolEnd", {
|
|
455
|
+
tool: typeof Schema.String;
|
|
456
|
+
}>, Schema.TaggedStruct<"TasksDefined", Readonly<{
|
|
457
|
+
tasks: Schema.Array$<Schema.Struct<{
|
|
458
|
+
id: typeof Schema.String;
|
|
459
|
+
title: typeof Schema.String;
|
|
460
|
+
description: typeof Schema.String;
|
|
461
|
+
}>>;
|
|
462
|
+
}> & Schema.Struct.Fields>, Schema.TaggedStruct<"PhasesDefined", Readonly<{
|
|
463
|
+
taskId: typeof Schema.String;
|
|
464
|
+
phases: Schema.Array$<Schema.Struct<{
|
|
465
|
+
id: typeof Schema.String;
|
|
466
|
+
description: typeof Schema.String;
|
|
467
|
+
}>>;
|
|
468
|
+
}> & Schema.Struct.Fields>, Schema.TaggedStruct<"CriteriaDefined", Readonly<{
|
|
469
|
+
taskId: typeof Schema.String;
|
|
470
|
+
criteria: Schema.Array$<Schema.Struct<{
|
|
471
|
+
id: typeof Schema.String;
|
|
472
|
+
description: typeof Schema.String;
|
|
473
|
+
}>>;
|
|
474
|
+
}> & Schema.Struct.Fields>, Schema.TaggedStruct<"PhaseStarted", Readonly<{
|
|
475
|
+
phaseId: typeof Schema.String;
|
|
476
|
+
}> & Schema.Struct.Fields>, Schema.TaggedStruct<"PhaseCompleted", Readonly<{
|
|
477
|
+
phaseId: typeof Schema.String;
|
|
478
|
+
}> & Schema.Struct.Fields>, Schema.TaggedStruct<"PhaseFailed", Readonly<{
|
|
479
|
+
phaseId: typeof Schema.String;
|
|
480
|
+
reason: typeof Schema.String;
|
|
481
|
+
}> & Schema.Struct.Fields>, Schema.TaggedStruct<"CriterionPassed", Readonly<{
|
|
482
|
+
criterionId: typeof Schema.String;
|
|
483
|
+
}> & Schema.Struct.Fields>, Schema.TaggedStruct<"CriterionFailed", Readonly<{
|
|
484
|
+
criterionId: typeof Schema.String;
|
|
485
|
+
reason: typeof Schema.String;
|
|
486
|
+
}> & Schema.Struct.Fields>, Schema.TaggedStruct<"CheckPassed", {}>, Schema.TaggedStruct<"CheckFailed", {
|
|
487
|
+
failedCriteria: Schema.Array$<typeof Schema.String>;
|
|
488
|
+
}>, Schema.TaggedStruct<"ReviewComplete", Readonly<{
|
|
489
|
+
changesMade: typeof Schema.Boolean;
|
|
490
|
+
}> & Schema.Struct.Fields>, Schema.TaggedStruct<"TaskCompleted", Readonly<{
|
|
491
|
+
taskId: typeof Schema.String;
|
|
492
|
+
summary: typeof Schema.String;
|
|
493
|
+
}> & Schema.Struct.Fields>, Schema.TaggedStruct<"PlanCreated", {
|
|
494
|
+
plan: Schema.Struct<{
|
|
495
|
+
id: typeof Schema.String;
|
|
496
|
+
sessionId: typeof Schema.String;
|
|
497
|
+
createdAt: typeof Schema.String;
|
|
498
|
+
originalTask: typeof Schema.String;
|
|
499
|
+
context: Schema.optional<typeof Schema.String>;
|
|
500
|
+
tasks: Schema.Array$<Schema.Struct<{
|
|
501
|
+
id: typeof Schema.String;
|
|
502
|
+
title: typeof Schema.String;
|
|
503
|
+
description: typeof Schema.String;
|
|
504
|
+
status: Schema.Literal<["pending", "planning", "in_progress", "done", "failed", "skipped"]>;
|
|
505
|
+
phases: Schema.Array$<Schema.Struct<{
|
|
506
|
+
id: typeof Schema.String;
|
|
507
|
+
description: typeof Schema.String;
|
|
508
|
+
status: Schema.Literal<["pending", "in_progress", "done", "failed"]>;
|
|
509
|
+
}>>;
|
|
510
|
+
criteria: Schema.Array$<Schema.Struct<{
|
|
511
|
+
id: typeof Schema.String;
|
|
512
|
+
description: typeof Schema.String;
|
|
513
|
+
status: Schema.Literal<["pending", "passed", "failed"]>;
|
|
514
|
+
failureReason: Schema.optional<typeof Schema.String>;
|
|
515
|
+
}>>;
|
|
516
|
+
filesToModify: Schema.Array$<typeof Schema.String>;
|
|
517
|
+
attempts: typeof Schema.Number;
|
|
518
|
+
completionNotes: Schema.optional<typeof Schema.String>;
|
|
519
|
+
}>>;
|
|
520
|
+
}>;
|
|
521
|
+
}>, Schema.TaggedStruct<"PlanUpdated", {
|
|
522
|
+
plan: Schema.Struct<{
|
|
523
|
+
id: typeof Schema.String;
|
|
524
|
+
sessionId: typeof Schema.String;
|
|
525
|
+
createdAt: typeof Schema.String;
|
|
526
|
+
originalTask: typeof Schema.String;
|
|
527
|
+
context: Schema.optional<typeof Schema.String>;
|
|
528
|
+
tasks: Schema.Array$<Schema.Struct<{
|
|
529
|
+
id: typeof Schema.String;
|
|
530
|
+
title: typeof Schema.String;
|
|
531
|
+
description: typeof Schema.String;
|
|
532
|
+
status: Schema.Literal<["pending", "planning", "in_progress", "done", "failed", "skipped"]>;
|
|
533
|
+
phases: Schema.Array$<Schema.Struct<{
|
|
534
|
+
id: typeof Schema.String;
|
|
535
|
+
description: typeof Schema.String;
|
|
536
|
+
status: Schema.Literal<["pending", "in_progress", "done", "failed"]>;
|
|
537
|
+
}>>;
|
|
538
|
+
criteria: Schema.Array$<Schema.Struct<{
|
|
539
|
+
id: typeof Schema.String;
|
|
540
|
+
description: typeof Schema.String;
|
|
541
|
+
status: Schema.Literal<["pending", "passed", "failed"]>;
|
|
542
|
+
failureReason: Schema.optional<typeof Schema.String>;
|
|
543
|
+
}>>;
|
|
544
|
+
filesToModify: Schema.Array$<typeof Schema.String>;
|
|
545
|
+
attempts: typeof Schema.Number;
|
|
546
|
+
completionNotes: Schema.optional<typeof Schema.String>;
|
|
547
|
+
}>>;
|
|
548
|
+
}>;
|
|
549
|
+
}>, Schema.TaggedStruct<"PlanUpdateFailed", {
|
|
550
|
+
operation: Schema.Literal<["create", "update"]>;
|
|
551
|
+
error: typeof Schema.String;
|
|
552
|
+
planId: Schema.optional<typeof Schema.String>;
|
|
553
|
+
}>]>;
|
|
554
|
+
/**
|
|
555
|
+
* Explicit discriminated union type for proper TypeScript narrowing.
|
|
556
|
+
*/
|
|
557
|
+
type DomainEvent = LoopStartedEvent | LoopCompletedEvent | LoopFailedEvent | DiscoveryStartedEvent | DiscoveryCompletedEvent | IterationStartedEvent | IterationCompletedEvent | LLMTextEvent | LLMToolStartEvent | LLMToolUseEvent | LLMToolEndEvent | TasksDefinedEvent | PhasesDefinedEvent | CriteriaDefinedEvent | PhaseStartedEvent | PhaseCompletedEvent | PhaseFailedEvent | CriterionPassedEvent | CriterionFailedEvent | CheckPassedEvent | CheckFailedEvent | ReviewCompleteEvent | TaskCompletedEvent | PlanCreatedEvent | PlanUpdatedEvent | PlanUpdateFailedEvent;
|
|
558
|
+
/**
|
|
559
|
+
* Type guard utilities for domain events.
|
|
560
|
+
*/
|
|
561
|
+
declare const DomainEventUtils: {
|
|
562
|
+
readonly isLLMEvent: (e: DomainEvent) => e is LLMTextEvent | LLMToolStartEvent | LLMToolUseEvent | LLMToolEndEvent;
|
|
563
|
+
readonly isPhaseEvent: (e: DomainEvent) => e is PhaseStartedEvent | PhaseCompletedEvent | PhaseFailedEvent;
|
|
564
|
+
readonly isCriterionEvent: (e: DomainEvent) => e is CriterionPassedEvent | CriterionFailedEvent;
|
|
565
|
+
readonly isLoopEvent: (e: DomainEvent) => e is LoopStartedEvent | LoopCompletedEvent | LoopFailedEvent;
|
|
566
|
+
readonly isDiscoveryEvent: (e: DomainEvent) => e is DiscoveryStartedEvent | DiscoveryCompletedEvent;
|
|
567
|
+
};
|
|
568
|
+
|
|
569
|
+
declare const TextEventSchema: Schema.TaggedStruct<"Text", {
|
|
570
|
+
text: typeof Schema.String;
|
|
571
|
+
}>;
|
|
572
|
+
declare const ToolStartEventSchema: Schema.TaggedStruct<"ToolStart", {
|
|
573
|
+
tool: typeof Schema.String;
|
|
574
|
+
}>;
|
|
575
|
+
declare const ToolUseEventSchema: Schema.TaggedStruct<"ToolUse", {
|
|
576
|
+
tool: typeof Schema.String;
|
|
577
|
+
input: typeof Schema.Unknown;
|
|
578
|
+
}>;
|
|
579
|
+
declare const ToolEndEventSchema: Schema.TaggedStruct<"ToolEnd", {
|
|
580
|
+
tool: typeof Schema.String;
|
|
581
|
+
}>;
|
|
582
|
+
declare const DoneEventSchema: Schema.TaggedStruct<"Done", {
|
|
583
|
+
output: typeof Schema.String;
|
|
584
|
+
}>;
|
|
585
|
+
declare const LLMEventSchema: Schema.Union<[Schema.TaggedStruct<"Text", {
|
|
586
|
+
text: typeof Schema.String;
|
|
587
|
+
}>, Schema.TaggedStruct<"ToolStart", {
|
|
588
|
+
tool: typeof Schema.String;
|
|
589
|
+
}>, Schema.TaggedStruct<"ToolUse", {
|
|
590
|
+
tool: typeof Schema.String;
|
|
591
|
+
input: typeof Schema.Unknown;
|
|
592
|
+
}>, Schema.TaggedStruct<"ToolEnd", {
|
|
593
|
+
tool: typeof Schema.String;
|
|
594
|
+
}>, Schema.TaggedStruct<"Done", {
|
|
595
|
+
output: typeof Schema.String;
|
|
596
|
+
}>]>;
|
|
597
|
+
type TextEvent = typeof TextEventSchema.Type;
|
|
598
|
+
type ToolStartEvent = typeof ToolStartEventSchema.Type;
|
|
599
|
+
type ToolUseEvent = typeof ToolUseEventSchema.Type;
|
|
600
|
+
type ToolEndEvent = typeof ToolEndEventSchema.Type;
|
|
601
|
+
type DoneEvent = typeof DoneEventSchema.Type;
|
|
602
|
+
type LLMEvent = TextEvent | ToolStartEvent | ToolUseEvent | ToolEndEvent | DoneEvent;
|
|
603
|
+
declare const decodeLLMEvent: (u: unknown, overrideOptions?: effect_SchemaAST.ParseOptions) => effect_Effect.Effect<{
|
|
604
|
+
readonly _tag: "Text";
|
|
605
|
+
readonly text: string;
|
|
606
|
+
} | {
|
|
607
|
+
readonly _tag: "ToolStart";
|
|
608
|
+
readonly tool: string;
|
|
609
|
+
} | {
|
|
610
|
+
readonly input: unknown;
|
|
611
|
+
readonly _tag: "ToolUse";
|
|
612
|
+
readonly tool: string;
|
|
613
|
+
} | {
|
|
614
|
+
readonly _tag: "ToolEnd";
|
|
615
|
+
readonly tool: string;
|
|
616
|
+
} | {
|
|
617
|
+
readonly _tag: "Done";
|
|
618
|
+
readonly output: string;
|
|
619
|
+
}, effect_ParseResult.ParseError, never>;
|
|
620
|
+
|
|
621
|
+
declare const LogLevelSchema: Schema.Literal<["debug", "info", "warn", "error"]>;
|
|
622
|
+
type LogLevel = typeof LogLevelSchema.Type;
|
|
623
|
+
declare const LogEntrySchema: Schema.Struct<{
|
|
624
|
+
level: Schema.Literal<["debug", "info", "warn", "error"]>;
|
|
625
|
+
message: typeof Schema.String;
|
|
626
|
+
timestamp: typeof Schema.String;
|
|
627
|
+
context: Schema.optional<Schema.Record$<typeof Schema.String, typeof Schema.Unknown>>;
|
|
628
|
+
}>;
|
|
629
|
+
type LogEntry = typeof LogEntrySchema.Type;
|
|
630
|
+
declare const ConsoleLoggerConfigSchema: Schema.Struct<{
|
|
631
|
+
level: Schema.optional<Schema.Literal<["debug", "info", "warn", "error"]>>;
|
|
632
|
+
colors: Schema.optional<typeof Schema.Boolean>;
|
|
633
|
+
}>;
|
|
634
|
+
type ConsoleLoggerConfig = typeof ConsoleLoggerConfigSchema.Type;
|
|
635
|
+
declare const FileLoggerConfigSchema: Schema.Struct<{
|
|
636
|
+
path: Schema.optional<typeof Schema.String>;
|
|
637
|
+
level: Schema.optional<Schema.Literal<["debug", "info", "warn", "error"]>>;
|
|
638
|
+
}>;
|
|
639
|
+
type FileLoggerConfig = typeof FileLoggerConfigSchema.Type;
|
|
640
|
+
|
|
641
|
+
/**
|
|
642
|
+
* Branded PlanId type.
|
|
643
|
+
*/
|
|
644
|
+
type PlanId = string & Brand.Brand<"PlanId">;
|
|
645
|
+
declare const PlanId: Brand.Brand.Constructor<PlanId>;
|
|
646
|
+
/**
|
|
647
|
+
* Status schemas.
|
|
648
|
+
*/
|
|
649
|
+
declare const TaskStatusSchema: Schema.Literal<["pending", "planning", "in_progress", "done", "failed", "skipped"]>;
|
|
650
|
+
type TaskStatus = typeof TaskStatusSchema.Type;
|
|
651
|
+
declare const PhaseStatusSchema: Schema.Literal<["pending", "in_progress", "done", "failed"]>;
|
|
652
|
+
type PhaseStatus = typeof PhaseStatusSchema.Type;
|
|
653
|
+
declare const CriterionStatusSchema: Schema.Literal<["pending", "passed", "failed"]>;
|
|
654
|
+
type CriterionStatus = typeof CriterionStatusSchema.Type;
|
|
655
|
+
/**
|
|
656
|
+
* Phase schema.
|
|
657
|
+
*/
|
|
658
|
+
declare const PhaseSchema: Schema.Struct<{
|
|
659
|
+
id: typeof Schema.String;
|
|
660
|
+
description: typeof Schema.String;
|
|
661
|
+
status: Schema.Literal<["pending", "in_progress", "done", "failed"]>;
|
|
662
|
+
}>;
|
|
663
|
+
type Phase = typeof PhaseSchema.Type;
|
|
664
|
+
/**
|
|
665
|
+
* Criterion schema.
|
|
666
|
+
*/
|
|
667
|
+
declare const CriterionSchema: Schema.Struct<{
|
|
668
|
+
id: typeof Schema.String;
|
|
669
|
+
description: typeof Schema.String;
|
|
670
|
+
status: Schema.Literal<["pending", "passed", "failed"]>;
|
|
671
|
+
failureReason: Schema.optional<typeof Schema.String>;
|
|
672
|
+
}>;
|
|
673
|
+
type Criterion = typeof CriterionSchema.Type;
|
|
674
|
+
/**
|
|
675
|
+
* Task schema.
|
|
676
|
+
*/
|
|
677
|
+
declare const TaskSchema: Schema.Struct<{
|
|
678
|
+
id: typeof Schema.String;
|
|
679
|
+
title: typeof Schema.String;
|
|
680
|
+
description: typeof Schema.String;
|
|
681
|
+
status: Schema.Literal<["pending", "planning", "in_progress", "done", "failed", "skipped"]>;
|
|
682
|
+
phases: Schema.Array$<Schema.Struct<{
|
|
683
|
+
id: typeof Schema.String;
|
|
684
|
+
description: typeof Schema.String;
|
|
685
|
+
status: Schema.Literal<["pending", "in_progress", "done", "failed"]>;
|
|
686
|
+
}>>;
|
|
687
|
+
criteria: Schema.Array$<Schema.Struct<{
|
|
688
|
+
id: typeof Schema.String;
|
|
689
|
+
description: typeof Schema.String;
|
|
690
|
+
status: Schema.Literal<["pending", "passed", "failed"]>;
|
|
691
|
+
failureReason: Schema.optional<typeof Schema.String>;
|
|
692
|
+
}>>;
|
|
693
|
+
filesToModify: Schema.Array$<typeof Schema.String>;
|
|
694
|
+
attempts: typeof Schema.Number;
|
|
695
|
+
completionNotes: Schema.optional<typeof Schema.String>;
|
|
696
|
+
}>;
|
|
697
|
+
type Task = typeof TaskSchema.Type;
|
|
698
|
+
/**
|
|
699
|
+
* Plan data schema (without id, for deserialization).
|
|
700
|
+
*/
|
|
701
|
+
declare const PlanDataSchema: Schema.Struct<{
|
|
702
|
+
sessionId: typeof Schema.String;
|
|
703
|
+
createdAt: typeof Schema.String;
|
|
704
|
+
originalTask: typeof Schema.String;
|
|
705
|
+
context: Schema.optional<typeof Schema.String>;
|
|
706
|
+
tasks: Schema.Array$<Schema.Struct<{
|
|
707
|
+
id: typeof Schema.String;
|
|
708
|
+
title: typeof Schema.String;
|
|
709
|
+
description: typeof Schema.String;
|
|
710
|
+
status: Schema.Literal<["pending", "planning", "in_progress", "done", "failed", "skipped"]>;
|
|
711
|
+
phases: Schema.Array$<Schema.Struct<{
|
|
712
|
+
id: typeof Schema.String;
|
|
713
|
+
description: typeof Schema.String;
|
|
714
|
+
status: Schema.Literal<["pending", "in_progress", "done", "failed"]>;
|
|
715
|
+
}>>;
|
|
716
|
+
criteria: Schema.Array$<Schema.Struct<{
|
|
717
|
+
id: typeof Schema.String;
|
|
718
|
+
description: typeof Schema.String;
|
|
719
|
+
status: Schema.Literal<["pending", "passed", "failed"]>;
|
|
720
|
+
failureReason: Schema.optional<typeof Schema.String>;
|
|
721
|
+
}>>;
|
|
722
|
+
filesToModify: Schema.Array$<typeof Schema.String>;
|
|
723
|
+
attempts: typeof Schema.Number;
|
|
724
|
+
completionNotes: Schema.optional<typeof Schema.String>;
|
|
725
|
+
}>>;
|
|
726
|
+
}>;
|
|
727
|
+
type PlanData = typeof PlanDataSchema.Type;
|
|
728
|
+
/**
|
|
729
|
+
* Plan schema with id.
|
|
730
|
+
*/
|
|
731
|
+
declare const PlanSchema: Schema.Struct<{
|
|
732
|
+
id: typeof Schema.String;
|
|
733
|
+
sessionId: typeof Schema.String;
|
|
734
|
+
createdAt: typeof Schema.String;
|
|
735
|
+
originalTask: typeof Schema.String;
|
|
736
|
+
context: Schema.optional<typeof Schema.String>;
|
|
737
|
+
tasks: Schema.Array$<Schema.Struct<{
|
|
738
|
+
id: typeof Schema.String;
|
|
739
|
+
title: typeof Schema.String;
|
|
740
|
+
description: typeof Schema.String;
|
|
741
|
+
status: Schema.Literal<["pending", "planning", "in_progress", "done", "failed", "skipped"]>;
|
|
742
|
+
phases: Schema.Array$<Schema.Struct<{
|
|
743
|
+
id: typeof Schema.String;
|
|
744
|
+
description: typeof Schema.String;
|
|
745
|
+
status: Schema.Literal<["pending", "in_progress", "done", "failed"]>;
|
|
746
|
+
}>>;
|
|
747
|
+
criteria: Schema.Array$<Schema.Struct<{
|
|
748
|
+
id: typeof Schema.String;
|
|
749
|
+
description: typeof Schema.String;
|
|
750
|
+
status: Schema.Literal<["pending", "passed", "failed"]>;
|
|
751
|
+
failureReason: Schema.optional<typeof Schema.String>;
|
|
752
|
+
}>>;
|
|
753
|
+
filesToModify: Schema.Array$<typeof Schema.String>;
|
|
754
|
+
attempts: typeof Schema.Number;
|
|
755
|
+
completionNotes: Schema.optional<typeof Schema.String>;
|
|
756
|
+
}>>;
|
|
757
|
+
}>;
|
|
758
|
+
type Plan = typeof PlanSchema.Type & {
|
|
759
|
+
readonly id: PlanId;
|
|
760
|
+
};
|
|
761
|
+
/**
|
|
762
|
+
* Decode helpers.
|
|
763
|
+
*/
|
|
764
|
+
declare const decodePlan: (u: unknown, overrideOptions?: effect_SchemaAST.ParseOptions) => effect_Effect.Effect<{
|
|
765
|
+
readonly sessionId: string;
|
|
766
|
+
readonly id: string;
|
|
767
|
+
readonly createdAt: string;
|
|
768
|
+
readonly originalTask: string;
|
|
769
|
+
readonly context?: string | undefined;
|
|
770
|
+
readonly tasks: readonly {
|
|
771
|
+
readonly phases: readonly {
|
|
772
|
+
readonly id: string;
|
|
773
|
+
readonly description: string;
|
|
774
|
+
readonly status: "pending" | "in_progress" | "done" | "failed";
|
|
775
|
+
}[];
|
|
776
|
+
readonly id: string;
|
|
777
|
+
readonly description: string;
|
|
778
|
+
readonly status: "planning" | "pending" | "in_progress" | "done" | "failed" | "skipped";
|
|
779
|
+
readonly title: string;
|
|
780
|
+
readonly criteria: readonly {
|
|
781
|
+
readonly id: string;
|
|
782
|
+
readonly description: string;
|
|
783
|
+
readonly status: "pending" | "failed" | "passed";
|
|
784
|
+
readonly failureReason?: string | undefined;
|
|
785
|
+
}[];
|
|
786
|
+
readonly filesToModify: readonly string[];
|
|
787
|
+
readonly attempts: number;
|
|
788
|
+
readonly completionNotes?: string | undefined;
|
|
789
|
+
}[];
|
|
790
|
+
}, effect_ParseResult.ParseError, never>;
|
|
791
|
+
declare const decodePlanData: (u: unknown, overrideOptions?: effect_SchemaAST.ParseOptions) => effect_Effect.Effect<{
|
|
792
|
+
readonly sessionId: string;
|
|
793
|
+
readonly createdAt: string;
|
|
794
|
+
readonly originalTask: string;
|
|
795
|
+
readonly context?: string | undefined;
|
|
796
|
+
readonly tasks: readonly {
|
|
797
|
+
readonly phases: readonly {
|
|
798
|
+
readonly id: string;
|
|
799
|
+
readonly description: string;
|
|
800
|
+
readonly status: "pending" | "in_progress" | "done" | "failed";
|
|
801
|
+
}[];
|
|
802
|
+
readonly id: string;
|
|
803
|
+
readonly description: string;
|
|
804
|
+
readonly status: "planning" | "pending" | "in_progress" | "done" | "failed" | "skipped";
|
|
805
|
+
readonly title: string;
|
|
806
|
+
readonly criteria: readonly {
|
|
807
|
+
readonly id: string;
|
|
808
|
+
readonly description: string;
|
|
809
|
+
readonly status: "pending" | "failed" | "passed";
|
|
810
|
+
readonly failureReason?: string | undefined;
|
|
811
|
+
}[];
|
|
812
|
+
readonly filesToModify: readonly string[];
|
|
813
|
+
readonly attempts: number;
|
|
814
|
+
readonly completionNotes?: string | undefined;
|
|
815
|
+
}[];
|
|
816
|
+
}, effect_ParseResult.ParseError, never>;
|
|
817
|
+
|
|
818
|
+
declare const ConsumerTypeSchema: Schema.Literal<["tui", "headless", "none"]>;
|
|
819
|
+
type ConsumerType = typeof ConsumerTypeSchema.Type;
|
|
820
|
+
declare const RunOptionsDataSchema: Schema.Struct<{
|
|
821
|
+
config: Schema.Struct<{
|
|
822
|
+
task: typeof Schema.String;
|
|
823
|
+
maxIterations: typeof Schema.Number;
|
|
824
|
+
verifyCommands: Schema.Array$<typeof Schema.String>;
|
|
825
|
+
sessionId: Schema.optional<typeof Schema.String>;
|
|
826
|
+
branch: Schema.optional<typeof Schema.String>;
|
|
827
|
+
push: Schema.optional<typeof Schema.Boolean>;
|
|
828
|
+
pr: Schema.optional<typeof Schema.Boolean>;
|
|
829
|
+
verbose: Schema.optional<typeof Schema.Boolean>;
|
|
830
|
+
prompts: Schema.optional<Schema.Struct<{
|
|
831
|
+
systemPrompt: Schema.optional<typeof Schema.String>;
|
|
832
|
+
phases: Schema.optional<Schema.Struct<{
|
|
833
|
+
breakdown: Schema.optional<typeof Schema.String>;
|
|
834
|
+
planning: Schema.optional<typeof Schema.String>;
|
|
835
|
+
execution: Schema.optional<typeof Schema.String>;
|
|
836
|
+
check: Schema.optional<typeof Schema.String>;
|
|
837
|
+
verify: Schema.optional<typeof Schema.String>;
|
|
838
|
+
review: Schema.optional<typeof Schema.String>;
|
|
839
|
+
completion: Schema.optional<typeof Schema.String>;
|
|
840
|
+
}>>;
|
|
841
|
+
additionalContext: Schema.optional<typeof Schema.String>;
|
|
842
|
+
}>>;
|
|
843
|
+
}>;
|
|
844
|
+
consumer: Schema.optional<Schema.Literal<["tui", "headless", "none"]>>;
|
|
845
|
+
}>;
|
|
846
|
+
type RunOptionsData = typeof RunOptionsDataSchema.Type;
|
|
847
|
+
|
|
848
|
+
/**
|
|
849
|
+
* Session status schema.
|
|
850
|
+
*/
|
|
851
|
+
declare const SessionStatusSchema: Schema.Literal<["active", "completed", "failed", "paused"]>;
|
|
852
|
+
type SessionStatus = typeof SessionStatusSchema.Type;
|
|
853
|
+
/**
|
|
854
|
+
* Session schema.
|
|
855
|
+
*/
|
|
856
|
+
declare const SessionSchema: Schema.Struct<{
|
|
857
|
+
id: typeof Schema.String;
|
|
858
|
+
createdAt: typeof Schema.String;
|
|
859
|
+
status: Schema.Literal<["active", "completed", "failed", "paused"]>;
|
|
860
|
+
originalTask: typeof Schema.String;
|
|
861
|
+
completedTasks: Schema.Array$<typeof Schema.String>;
|
|
862
|
+
currentTaskId: Schema.optional<typeof Schema.String>;
|
|
863
|
+
}>;
|
|
864
|
+
type Session = typeof SessionSchema.Type;
|
|
865
|
+
/**
|
|
866
|
+
* Decode helper.
|
|
867
|
+
*/
|
|
868
|
+
declare const decodeSession: (u: unknown, overrideOptions?: effect_SchemaAST.ParseOptions) => effect_Effect.Effect<{
|
|
869
|
+
readonly completedTasks: readonly string[];
|
|
870
|
+
readonly id: string;
|
|
871
|
+
readonly status: "failed" | "active" | "completed" | "paused";
|
|
872
|
+
readonly createdAt: string;
|
|
873
|
+
readonly originalTask: string;
|
|
874
|
+
readonly currentTaskId?: string | undefined;
|
|
875
|
+
}, effect_ParseResult.ParseError, never>;
|
|
876
|
+
|
|
877
|
+
/**
|
|
878
|
+
* Basic info schemas for tasks, phases, and criteria.
|
|
879
|
+
*/
|
|
880
|
+
declare const TaskBasicInfoSchema: Schema.Struct<{
|
|
881
|
+
id: typeof Schema.String;
|
|
882
|
+
title: typeof Schema.String;
|
|
883
|
+
description: typeof Schema.String;
|
|
884
|
+
}>;
|
|
885
|
+
type TaskBasicInfo = typeof TaskBasicInfoSchema.Type;
|
|
886
|
+
declare const PhaseBasicInfoSchema: Schema.Struct<{
|
|
887
|
+
id: typeof Schema.String;
|
|
888
|
+
description: typeof Schema.String;
|
|
889
|
+
}>;
|
|
890
|
+
type PhaseBasicInfo = typeof PhaseBasicInfoSchema.Type;
|
|
891
|
+
declare const CriterionBasicInfoSchema: Schema.Struct<{
|
|
892
|
+
id: typeof Schema.String;
|
|
893
|
+
description: typeof Schema.String;
|
|
894
|
+
}>;
|
|
895
|
+
type CriterionBasicInfo = typeof CriterionBasicInfoSchema.Type;
|
|
896
|
+
/**
|
|
897
|
+
* Data schemas (base for signals, without _tag).
|
|
898
|
+
*/
|
|
899
|
+
declare const TasksDefinedDataSchema: Schema.Struct<{
|
|
900
|
+
tasks: Schema.Array$<Schema.Struct<{
|
|
901
|
+
id: typeof Schema.String;
|
|
902
|
+
title: typeof Schema.String;
|
|
903
|
+
description: typeof Schema.String;
|
|
904
|
+
}>>;
|
|
905
|
+
}>;
|
|
906
|
+
type TasksDefinedData = typeof TasksDefinedDataSchema.Type;
|
|
907
|
+
declare const PhasesDefinedDataSchema: Schema.Struct<{
|
|
908
|
+
taskId: typeof Schema.String;
|
|
909
|
+
phases: Schema.Array$<Schema.Struct<{
|
|
910
|
+
id: typeof Schema.String;
|
|
911
|
+
description: typeof Schema.String;
|
|
912
|
+
}>>;
|
|
913
|
+
}>;
|
|
914
|
+
type PhasesDefinedData = typeof PhasesDefinedDataSchema.Type;
|
|
915
|
+
declare const CriteriaDefinedDataSchema: Schema.Struct<{
|
|
916
|
+
taskId: typeof Schema.String;
|
|
917
|
+
criteria: Schema.Array$<Schema.Struct<{
|
|
918
|
+
id: typeof Schema.String;
|
|
919
|
+
description: typeof Schema.String;
|
|
920
|
+
}>>;
|
|
921
|
+
}>;
|
|
922
|
+
type CriteriaDefinedData = typeof CriteriaDefinedDataSchema.Type;
|
|
923
|
+
declare const PhaseIdDataSchema: Schema.Struct<{
|
|
924
|
+
phaseId: typeof Schema.String;
|
|
925
|
+
}>;
|
|
926
|
+
type PhaseIdData = typeof PhaseIdDataSchema.Type;
|
|
927
|
+
declare const PhaseFailedDataSchema: Schema.Struct<{
|
|
928
|
+
phaseId: typeof Schema.String;
|
|
929
|
+
reason: typeof Schema.String;
|
|
930
|
+
}>;
|
|
931
|
+
type PhaseFailedData = typeof PhaseFailedDataSchema.Type;
|
|
932
|
+
declare const CriterionIdDataSchema: Schema.Struct<{
|
|
933
|
+
criterionId: typeof Schema.String;
|
|
934
|
+
}>;
|
|
935
|
+
type CriterionIdData = typeof CriterionIdDataSchema.Type;
|
|
936
|
+
declare const CriterionFailedDataSchema: Schema.Struct<{
|
|
937
|
+
criterionId: typeof Schema.String;
|
|
938
|
+
reason: typeof Schema.String;
|
|
939
|
+
}>;
|
|
940
|
+
type CriterionFailedData = typeof CriterionFailedDataSchema.Type;
|
|
941
|
+
declare const ReviewCompleteDataSchema: Schema.Struct<{
|
|
942
|
+
changesMade: typeof Schema.Boolean;
|
|
943
|
+
}>;
|
|
944
|
+
type ReviewCompleteData = typeof ReviewCompleteDataSchema.Type;
|
|
945
|
+
declare const TaskCompleteSignalDataSchema: Schema.Struct<{
|
|
946
|
+
taskId: typeof Schema.String;
|
|
947
|
+
summary: typeof Schema.String;
|
|
948
|
+
filesModified: Schema.Array$<typeof Schema.String>;
|
|
949
|
+
filesCreated: Schema.Array$<typeof Schema.String>;
|
|
950
|
+
}>;
|
|
951
|
+
type TaskCompleteSignalData = typeof TaskCompleteSignalDataSchema.Type;
|
|
952
|
+
/**
|
|
953
|
+
* TaskCompleteData without file arrays (used by events).
|
|
954
|
+
*/
|
|
955
|
+
declare const TaskCompleteDataSchema: Schema.Struct<{
|
|
956
|
+
taskId: typeof Schema.String;
|
|
957
|
+
summary: typeof Schema.String;
|
|
958
|
+
}>;
|
|
959
|
+
type TaskCompleteData = typeof TaskCompleteDataSchema.Type;
|
|
960
|
+
|
|
961
|
+
/**
|
|
962
|
+
* Signal schemas.
|
|
963
|
+
*/
|
|
964
|
+
declare const TasksDefinedSignalSchema: Schema.TaggedStruct<"TasksDefined", Readonly<{
|
|
965
|
+
tasks: Schema.Array$<Schema.Struct<{
|
|
966
|
+
id: typeof Schema.String;
|
|
967
|
+
title: typeof Schema.String;
|
|
968
|
+
description: typeof Schema.String;
|
|
969
|
+
}>>;
|
|
970
|
+
}>>;
|
|
971
|
+
type TasksDefinedSignal = typeof TasksDefinedSignalSchema.Type;
|
|
972
|
+
declare const PhasesDefinedSignalSchema: Schema.TaggedStruct<"PhasesDefined", Readonly<{
|
|
973
|
+
taskId: typeof Schema.String;
|
|
974
|
+
phases: Schema.Array$<Schema.Struct<{
|
|
975
|
+
id: typeof Schema.String;
|
|
976
|
+
description: typeof Schema.String;
|
|
977
|
+
}>>;
|
|
978
|
+
}>>;
|
|
979
|
+
type PhasesDefinedSignal = typeof PhasesDefinedSignalSchema.Type;
|
|
980
|
+
declare const CriteriaDefinedSignalSchema: Schema.TaggedStruct<"CriteriaDefined", Readonly<{
|
|
981
|
+
taskId: typeof Schema.String;
|
|
982
|
+
criteria: Schema.Array$<Schema.Struct<{
|
|
983
|
+
id: typeof Schema.String;
|
|
984
|
+
description: typeof Schema.String;
|
|
985
|
+
}>>;
|
|
986
|
+
}>>;
|
|
987
|
+
type CriteriaDefinedSignal = typeof CriteriaDefinedSignalSchema.Type;
|
|
988
|
+
declare const PhaseStartedSignalSchema: Schema.TaggedStruct<"PhaseStarted", Readonly<{
|
|
989
|
+
phaseId: typeof Schema.String;
|
|
990
|
+
}>>;
|
|
991
|
+
type PhaseStartedSignal = typeof PhaseStartedSignalSchema.Type;
|
|
992
|
+
declare const PhaseCompletedSignalSchema: Schema.TaggedStruct<"PhaseCompleted", Readonly<{
|
|
993
|
+
phaseId: typeof Schema.String;
|
|
994
|
+
}>>;
|
|
995
|
+
type PhaseCompletedSignal = typeof PhaseCompletedSignalSchema.Type;
|
|
996
|
+
declare const PhaseFailedSignalSchema: Schema.TaggedStruct<"PhaseFailed", Readonly<{
|
|
997
|
+
phaseId: typeof Schema.String;
|
|
998
|
+
reason: typeof Schema.String;
|
|
999
|
+
}>>;
|
|
1000
|
+
type PhaseFailedSignal = typeof PhaseFailedSignalSchema.Type;
|
|
1001
|
+
declare const CriterionPassedSignalSchema: Schema.TaggedStruct<"CriterionPassed", Readonly<{
|
|
1002
|
+
criterionId: typeof Schema.String;
|
|
1003
|
+
}>>;
|
|
1004
|
+
type CriterionPassedSignal = typeof CriterionPassedSignalSchema.Type;
|
|
1005
|
+
declare const CriterionFailedSignalSchema: Schema.TaggedStruct<"CriterionFailed", Readonly<{
|
|
1006
|
+
criterionId: typeof Schema.String;
|
|
1007
|
+
reason: typeof Schema.String;
|
|
1008
|
+
}>>;
|
|
1009
|
+
type CriterionFailedSignal = typeof CriterionFailedSignalSchema.Type;
|
|
1010
|
+
declare const CheckPassedSignalSchema: Schema.TaggedStruct<"CheckPassed", {}>;
|
|
1011
|
+
type CheckPassedSignal = typeof CheckPassedSignalSchema.Type;
|
|
1012
|
+
declare const CheckFailedSignalSchema: Schema.TaggedStruct<"CheckFailed", {}>;
|
|
1013
|
+
type CheckFailedSignal = typeof CheckFailedSignalSchema.Type;
|
|
1014
|
+
declare const ReviewCompleteSignalSchema: Schema.TaggedStruct<"ReviewComplete", Readonly<{
|
|
1015
|
+
changesMade: typeof Schema.Boolean;
|
|
1016
|
+
}>>;
|
|
1017
|
+
type ReviewCompleteSignal = typeof ReviewCompleteSignalSchema.Type;
|
|
1018
|
+
declare const TaskCompleteSignalSchema: Schema.TaggedStruct<"TaskComplete", Readonly<{
|
|
1019
|
+
taskId: typeof Schema.String;
|
|
1020
|
+
summary: typeof Schema.String;
|
|
1021
|
+
filesModified: Schema.Array$<typeof Schema.String>;
|
|
1022
|
+
filesCreated: Schema.Array$<typeof Schema.String>;
|
|
1023
|
+
}>>;
|
|
1024
|
+
type TaskCompleteSignal = typeof TaskCompleteSignalSchema.Type;
|
|
1025
|
+
declare const LoopCompleteSignalSchema: Schema.TaggedStruct<"LoopComplete", {}>;
|
|
1026
|
+
type LoopCompleteSignal = typeof LoopCompleteSignalSchema.Type;
|
|
1027
|
+
/**
|
|
1028
|
+
* Union of all signals.
|
|
1029
|
+
*/
|
|
1030
|
+
declare const SignalSchema: Schema.Union<[Schema.TaggedStruct<"TasksDefined", Readonly<{
|
|
1031
|
+
tasks: Schema.Array$<Schema.Struct<{
|
|
1032
|
+
id: typeof Schema.String;
|
|
1033
|
+
title: typeof Schema.String;
|
|
1034
|
+
description: typeof Schema.String;
|
|
1035
|
+
}>>;
|
|
1036
|
+
}>>, Schema.TaggedStruct<"PhasesDefined", Readonly<{
|
|
1037
|
+
taskId: typeof Schema.String;
|
|
1038
|
+
phases: Schema.Array$<Schema.Struct<{
|
|
1039
|
+
id: typeof Schema.String;
|
|
1040
|
+
description: typeof Schema.String;
|
|
1041
|
+
}>>;
|
|
1042
|
+
}>>, Schema.TaggedStruct<"CriteriaDefined", Readonly<{
|
|
1043
|
+
taskId: typeof Schema.String;
|
|
1044
|
+
criteria: Schema.Array$<Schema.Struct<{
|
|
1045
|
+
id: typeof Schema.String;
|
|
1046
|
+
description: typeof Schema.String;
|
|
1047
|
+
}>>;
|
|
1048
|
+
}>>, Schema.TaggedStruct<"PhaseStarted", Readonly<{
|
|
1049
|
+
phaseId: typeof Schema.String;
|
|
1050
|
+
}>>, Schema.TaggedStruct<"PhaseCompleted", Readonly<{
|
|
1051
|
+
phaseId: typeof Schema.String;
|
|
1052
|
+
}>>, Schema.TaggedStruct<"PhaseFailed", Readonly<{
|
|
1053
|
+
phaseId: typeof Schema.String;
|
|
1054
|
+
reason: typeof Schema.String;
|
|
1055
|
+
}>>, Schema.TaggedStruct<"CriterionPassed", Readonly<{
|
|
1056
|
+
criterionId: typeof Schema.String;
|
|
1057
|
+
}>>, Schema.TaggedStruct<"CriterionFailed", Readonly<{
|
|
1058
|
+
criterionId: typeof Schema.String;
|
|
1059
|
+
reason: typeof Schema.String;
|
|
1060
|
+
}>>, Schema.TaggedStruct<"CheckPassed", {}>, Schema.TaggedStruct<"CheckFailed", {}>, Schema.TaggedStruct<"ReviewComplete", Readonly<{
|
|
1061
|
+
changesMade: typeof Schema.Boolean;
|
|
1062
|
+
}>>, Schema.TaggedStruct<"TaskComplete", Readonly<{
|
|
1063
|
+
taskId: typeof Schema.String;
|
|
1064
|
+
summary: typeof Schema.String;
|
|
1065
|
+
filesModified: Schema.Array$<typeof Schema.String>;
|
|
1066
|
+
filesCreated: Schema.Array$<typeof Schema.String>;
|
|
1067
|
+
}>>, Schema.TaggedStruct<"LoopComplete", {}>]>;
|
|
1068
|
+
type Signal = typeof SignalSchema.Type;
|
|
1069
|
+
/**
|
|
1070
|
+
* Decode helpers.
|
|
1071
|
+
*/
|
|
1072
|
+
declare const decodeSignal: (u: unknown, overrideOptions?: effect_SchemaAST.ParseOptions) => effect_Effect.Effect<{
|
|
1073
|
+
readonly _tag: "CheckPassed";
|
|
1074
|
+
} | {
|
|
1075
|
+
readonly _tag: "TasksDefined";
|
|
1076
|
+
readonly tasks: readonly {
|
|
1077
|
+
readonly id: string;
|
|
1078
|
+
readonly description: string;
|
|
1079
|
+
readonly title: string;
|
|
1080
|
+
}[];
|
|
1081
|
+
} | {
|
|
1082
|
+
readonly phases: readonly {
|
|
1083
|
+
readonly id: string;
|
|
1084
|
+
readonly description: string;
|
|
1085
|
+
}[];
|
|
1086
|
+
readonly _tag: "PhasesDefined";
|
|
1087
|
+
readonly taskId: string;
|
|
1088
|
+
} | {
|
|
1089
|
+
readonly _tag: "CriteriaDefined";
|
|
1090
|
+
readonly criteria: readonly {
|
|
1091
|
+
readonly id: string;
|
|
1092
|
+
readonly description: string;
|
|
1093
|
+
}[];
|
|
1094
|
+
readonly taskId: string;
|
|
1095
|
+
} | {
|
|
1096
|
+
readonly _tag: "PhaseStarted";
|
|
1097
|
+
readonly phaseId: string;
|
|
1098
|
+
} | {
|
|
1099
|
+
readonly _tag: "PhaseCompleted";
|
|
1100
|
+
readonly phaseId: string;
|
|
1101
|
+
} | {
|
|
1102
|
+
readonly _tag: "PhaseFailed";
|
|
1103
|
+
readonly phaseId: string;
|
|
1104
|
+
readonly reason: string;
|
|
1105
|
+
} | {
|
|
1106
|
+
readonly _tag: "CriterionPassed";
|
|
1107
|
+
readonly criterionId: string;
|
|
1108
|
+
} | {
|
|
1109
|
+
readonly _tag: "CriterionFailed";
|
|
1110
|
+
readonly reason: string;
|
|
1111
|
+
readonly criterionId: string;
|
|
1112
|
+
} | {
|
|
1113
|
+
readonly _tag: "CheckFailed";
|
|
1114
|
+
} | {
|
|
1115
|
+
readonly _tag: "ReviewComplete";
|
|
1116
|
+
readonly changesMade: boolean;
|
|
1117
|
+
} | {
|
|
1118
|
+
readonly _tag: "TaskComplete";
|
|
1119
|
+
readonly taskId: string;
|
|
1120
|
+
readonly summary: string;
|
|
1121
|
+
readonly filesModified: readonly string[];
|
|
1122
|
+
readonly filesCreated: readonly string[];
|
|
1123
|
+
} | {
|
|
1124
|
+
readonly _tag: "LoopComplete";
|
|
1125
|
+
}, effect_ParseResult.ParseError, never>;
|
|
1126
|
+
declare const decodeSignalSync: (u: unknown, overrideOptions?: effect_SchemaAST.ParseOptions) => {
|
|
1127
|
+
readonly _tag: "CheckPassed";
|
|
1128
|
+
} | {
|
|
1129
|
+
readonly _tag: "TasksDefined";
|
|
1130
|
+
readonly tasks: readonly {
|
|
1131
|
+
readonly id: string;
|
|
1132
|
+
readonly description: string;
|
|
1133
|
+
readonly title: string;
|
|
1134
|
+
}[];
|
|
1135
|
+
} | {
|
|
1136
|
+
readonly phases: readonly {
|
|
1137
|
+
readonly id: string;
|
|
1138
|
+
readonly description: string;
|
|
1139
|
+
}[];
|
|
1140
|
+
readonly _tag: "PhasesDefined";
|
|
1141
|
+
readonly taskId: string;
|
|
1142
|
+
} | {
|
|
1143
|
+
readonly _tag: "CriteriaDefined";
|
|
1144
|
+
readonly criteria: readonly {
|
|
1145
|
+
readonly id: string;
|
|
1146
|
+
readonly description: string;
|
|
1147
|
+
}[];
|
|
1148
|
+
readonly taskId: string;
|
|
1149
|
+
} | {
|
|
1150
|
+
readonly _tag: "PhaseStarted";
|
|
1151
|
+
readonly phaseId: string;
|
|
1152
|
+
} | {
|
|
1153
|
+
readonly _tag: "PhaseCompleted";
|
|
1154
|
+
readonly phaseId: string;
|
|
1155
|
+
} | {
|
|
1156
|
+
readonly _tag: "PhaseFailed";
|
|
1157
|
+
readonly phaseId: string;
|
|
1158
|
+
readonly reason: string;
|
|
1159
|
+
} | {
|
|
1160
|
+
readonly _tag: "CriterionPassed";
|
|
1161
|
+
readonly criterionId: string;
|
|
1162
|
+
} | {
|
|
1163
|
+
readonly _tag: "CriterionFailed";
|
|
1164
|
+
readonly reason: string;
|
|
1165
|
+
readonly criterionId: string;
|
|
1166
|
+
} | {
|
|
1167
|
+
readonly _tag: "CheckFailed";
|
|
1168
|
+
} | {
|
|
1169
|
+
readonly _tag: "ReviewComplete";
|
|
1170
|
+
readonly changesMade: boolean;
|
|
1171
|
+
} | {
|
|
1172
|
+
readonly _tag: "TaskComplete";
|
|
1173
|
+
readonly taskId: string;
|
|
1174
|
+
readonly summary: string;
|
|
1175
|
+
readonly filesModified: readonly string[];
|
|
1176
|
+
readonly filesCreated: readonly string[];
|
|
1177
|
+
} | {
|
|
1178
|
+
readonly _tag: "LoopComplete";
|
|
1179
|
+
};
|
|
1180
|
+
|
|
1181
|
+
/**
|
|
1182
|
+
* Status for generated tasks in tasks.md
|
|
1183
|
+
*/
|
|
1184
|
+
declare const GeneratedTaskStatusSchema: Schema.Literal<["pending", "in_progress", "done", "failed"]>;
|
|
1185
|
+
type GeneratedTaskStatus = typeof GeneratedTaskStatusSchema.Type;
|
|
1186
|
+
/**
|
|
1187
|
+
* Single generated task entry schema
|
|
1188
|
+
*/
|
|
1189
|
+
declare const GeneratedTaskSchema: Schema.Struct<{
|
|
1190
|
+
id: typeof Schema.String;
|
|
1191
|
+
title: typeof Schema.String;
|
|
1192
|
+
status: Schema.Literal<["pending", "in_progress", "done", "failed"]>;
|
|
1193
|
+
}>;
|
|
1194
|
+
type GeneratedTask = typeof GeneratedTaskSchema.Type;
|
|
1195
|
+
/**
|
|
1196
|
+
* Array of generated tasks schema
|
|
1197
|
+
*/
|
|
1198
|
+
declare const GeneratedTaskListSchema: Schema.Array$<Schema.Struct<{
|
|
1199
|
+
id: typeof Schema.String;
|
|
1200
|
+
title: typeof Schema.String;
|
|
1201
|
+
status: Schema.Literal<["pending", "in_progress", "done", "failed"]>;
|
|
1202
|
+
}>>;
|
|
1203
|
+
type GeneratedTaskList = typeof GeneratedTaskListSchema.Type;
|
|
1204
|
+
/**
|
|
1205
|
+
* Format tasks to a human-readable markdown string
|
|
1206
|
+
*/
|
|
1207
|
+
declare function formatTasksMd(tasks: GeneratedTaskList): string;
|
|
1208
|
+
/**
|
|
1209
|
+
* Parse markdown back to validated tasks
|
|
1210
|
+
*/
|
|
1211
|
+
declare function parseTasksMd(content: string): GeneratedTaskList;
|
|
1212
|
+
|
|
1213
|
+
declare const ViewModeSchema: Schema.Literal<["logs", "tasks", "detail"]>;
|
|
1214
|
+
type ViewMode = typeof ViewModeSchema.Type;
|
|
1215
|
+
declare const LoopStatusSchema: Schema.Literal<["idle", "running", "complete", "error"]>;
|
|
1216
|
+
type LoopStatus = typeof LoopStatusSchema.Type;
|
|
1217
|
+
declare const ExecutionModeSchema: Schema.Literal<["idle", "discovery", "breakdown", "planning", "working", "checking", "verifying", "reviewing"]>;
|
|
1218
|
+
type ExecutionMode = typeof ExecutionModeSchema.Type;
|
|
1219
|
+
declare const TUIPhaseStatusSchema: Schema.Literal<["pending", "in_progress", "done", "failed"]>;
|
|
1220
|
+
type TUIPhaseStatus = typeof TUIPhaseStatusSchema.Type;
|
|
1221
|
+
declare const TUICriterionStatusSchema: Schema.Literal<["pending", "passed", "failed"]>;
|
|
1222
|
+
type TUICriterionStatus = typeof TUICriterionStatusSchema.Type;
|
|
1223
|
+
declare const TUITaskStatusSchema: Schema.Literal<["pending", "in_progress", "done", "failed"]>;
|
|
1224
|
+
type TUITaskStatus = typeof TUITaskStatusSchema.Type;
|
|
1225
|
+
declare const TUIPhaseSchema: Schema.Struct<{
|
|
1226
|
+
id: typeof Schema.String;
|
|
1227
|
+
description: typeof Schema.String;
|
|
1228
|
+
status: Schema.Literal<["pending", "in_progress", "done", "failed"]>;
|
|
1229
|
+
startedAt: Schema.optional<typeof Schema.Number>;
|
|
1230
|
+
completedAt: Schema.optional<typeof Schema.Number>;
|
|
1231
|
+
}>;
|
|
1232
|
+
type TUIPhase = typeof TUIPhaseSchema.Type;
|
|
1233
|
+
declare const TUICriterionSchema: Schema.Struct<{
|
|
1234
|
+
id: typeof Schema.String;
|
|
1235
|
+
description: typeof Schema.String;
|
|
1236
|
+
status: Schema.Literal<["pending", "passed", "failed"]>;
|
|
1237
|
+
failureReason: Schema.optional<typeof Schema.String>;
|
|
1238
|
+
}>;
|
|
1239
|
+
type TUICriterion = typeof TUICriterionSchema.Type;
|
|
1240
|
+
declare const TUITaskSchema: Schema.Struct<{
|
|
1241
|
+
id: typeof Schema.String;
|
|
1242
|
+
title: typeof Schema.String;
|
|
1243
|
+
status: Schema.Literal<["pending", "in_progress", "done", "failed"]>;
|
|
1244
|
+
phases: Schema.Array$<Schema.Struct<{
|
|
1245
|
+
id: typeof Schema.String;
|
|
1246
|
+
description: typeof Schema.String;
|
|
1247
|
+
status: Schema.Literal<["pending", "in_progress", "done", "failed"]>;
|
|
1248
|
+
startedAt: Schema.optional<typeof Schema.Number>;
|
|
1249
|
+
completedAt: Schema.optional<typeof Schema.Number>;
|
|
1250
|
+
}>>;
|
|
1251
|
+
criteria: Schema.Array$<Schema.Struct<{
|
|
1252
|
+
id: typeof Schema.String;
|
|
1253
|
+
description: typeof Schema.String;
|
|
1254
|
+
status: Schema.Literal<["pending", "passed", "failed"]>;
|
|
1255
|
+
failureReason: Schema.optional<typeof Schema.String>;
|
|
1256
|
+
}>>;
|
|
1257
|
+
startedAt: Schema.optional<typeof Schema.Number>;
|
|
1258
|
+
completedAt: Schema.optional<typeof Schema.Number>;
|
|
1259
|
+
}>;
|
|
1260
|
+
type TUITask = typeof TUITaskSchema.Type;
|
|
1261
|
+
declare const TUIStateSchema: Schema.Struct<{
|
|
1262
|
+
task: typeof Schema.String;
|
|
1263
|
+
iteration: typeof Schema.Number;
|
|
1264
|
+
maxIterations: typeof Schema.Number;
|
|
1265
|
+
status: Schema.Literal<["idle", "running", "complete", "error"]>;
|
|
1266
|
+
startTime: typeof Schema.Number;
|
|
1267
|
+
discoveryInProgress: typeof Schema.Boolean;
|
|
1268
|
+
discoveryCompleted: typeof Schema.Boolean;
|
|
1269
|
+
executionMode: Schema.Literal<["idle", "discovery", "breakdown", "planning", "working", "checking", "verifying", "reviewing"]>;
|
|
1270
|
+
currentTool: Schema.optional<typeof Schema.String>;
|
|
1271
|
+
currentTaskId: Schema.optional<typeof Schema.String>;
|
|
1272
|
+
outputLines: Schema.Array$<typeof Schema.String>;
|
|
1273
|
+
partialLine: typeof Schema.String;
|
|
1274
|
+
tasks: Schema.Array$<Schema.Struct<{
|
|
1275
|
+
id: typeof Schema.String;
|
|
1276
|
+
title: typeof Schema.String;
|
|
1277
|
+
status: Schema.Literal<["pending", "in_progress", "done", "failed"]>;
|
|
1278
|
+
phases: Schema.Array$<Schema.Struct<{
|
|
1279
|
+
id: typeof Schema.String;
|
|
1280
|
+
description: typeof Schema.String;
|
|
1281
|
+
status: Schema.Literal<["pending", "in_progress", "done", "failed"]>;
|
|
1282
|
+
startedAt: Schema.optional<typeof Schema.Number>;
|
|
1283
|
+
completedAt: Schema.optional<typeof Schema.Number>;
|
|
1284
|
+
}>>;
|
|
1285
|
+
criteria: Schema.Array$<Schema.Struct<{
|
|
1286
|
+
id: typeof Schema.String;
|
|
1287
|
+
description: typeof Schema.String;
|
|
1288
|
+
status: Schema.Literal<["pending", "passed", "failed"]>;
|
|
1289
|
+
failureReason: Schema.optional<typeof Schema.String>;
|
|
1290
|
+
}>>;
|
|
1291
|
+
startedAt: Schema.optional<typeof Schema.Number>;
|
|
1292
|
+
completedAt: Schema.optional<typeof Schema.Number>;
|
|
1293
|
+
}>>;
|
|
1294
|
+
viewMode: Schema.Literal<["logs", "tasks", "detail"]>;
|
|
1295
|
+
selectedTaskIndex: typeof Schema.Number;
|
|
1296
|
+
scrollOffset: typeof Schema.Number;
|
|
1297
|
+
userScrolled: typeof Schema.Boolean;
|
|
1298
|
+
gitBranch: Schema.optional<typeof Schema.String>;
|
|
1299
|
+
gitPushed: typeof Schema.Boolean;
|
|
1300
|
+
prUrl: Schema.optional<typeof Schema.String>;
|
|
1301
|
+
}>;
|
|
1302
|
+
type TUIState = typeof TUIStateSchema.Type;
|
|
1303
|
+
|
|
1304
|
+
/**
|
|
1305
|
+
* A consumer processes a stream of domain events.
|
|
1306
|
+
*
|
|
1307
|
+
* This is the ONLY interface between orchestrator and presentation.
|
|
1308
|
+
* Consumers are completely decoupled from the orchestrator.
|
|
1309
|
+
*
|
|
1310
|
+
* @example Creating a custom consumer
|
|
1311
|
+
* ```typescript
|
|
1312
|
+
* const myConsumer: Consumer = {
|
|
1313
|
+
* consume: (events) =>
|
|
1314
|
+
* events.pipe(
|
|
1315
|
+
* Stream.runForEach((event) =>
|
|
1316
|
+
* Effect.sync(() => console.log(event._tag))
|
|
1317
|
+
* )
|
|
1318
|
+
* ),
|
|
1319
|
+
* };
|
|
1320
|
+
* ```
|
|
1321
|
+
*
|
|
1322
|
+
* @example WebSocket consumer
|
|
1323
|
+
* ```typescript
|
|
1324
|
+
* const wsConsumer: Consumer = {
|
|
1325
|
+
* consume: (events) =>
|
|
1326
|
+
* events.pipe(
|
|
1327
|
+
* Stream.runForEach((event) =>
|
|
1328
|
+
* Effect.sync(() => ws.send(JSON.stringify(event)))
|
|
1329
|
+
* )
|
|
1330
|
+
* ),
|
|
1331
|
+
* };
|
|
1332
|
+
* ```
|
|
1333
|
+
*/
|
|
1334
|
+
interface Consumer {
|
|
1335
|
+
/**
|
|
1336
|
+
* Consume a stream of events.
|
|
1337
|
+
*
|
|
1338
|
+
* The consumer handles its own lifecycle (setup, teardown).
|
|
1339
|
+
* The returned Effect completes when the stream is exhausted
|
|
1340
|
+
* or an error occurs.
|
|
1341
|
+
*
|
|
1342
|
+
* @param events - Stream of domain events to process
|
|
1343
|
+
* @returns Effect that completes when consumption is done
|
|
1344
|
+
*/
|
|
1345
|
+
readonly consume: (events: Stream.Stream<DomainEvent, unknown, never>) => Effect.Effect<void, unknown>;
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
/**
|
|
1349
|
+
* Creates a headless consumer that logs events to the console.
|
|
1350
|
+
*
|
|
1351
|
+
* This consumer is suitable for CI environments or piped output.
|
|
1352
|
+
* It formats events as colored log lines.
|
|
1353
|
+
*
|
|
1354
|
+
* @returns A Consumer that logs to stdout
|
|
1355
|
+
*
|
|
1356
|
+
* @example
|
|
1357
|
+
* ```typescript
|
|
1358
|
+
* const consumer = createHeadlessConsumer();
|
|
1359
|
+
* const events = runLoop(config).pipe(Stream.provideLayer(layers));
|
|
1360
|
+
* await consumer.consume(events).pipe(Effect.runPromise);
|
|
1361
|
+
* ```
|
|
1362
|
+
*/
|
|
1363
|
+
declare function createHeadlessConsumer(): Consumer;
|
|
1364
|
+
|
|
1365
|
+
/**
|
|
1366
|
+
* Creates a TUI consumer that renders events to a full-screen terminal interface.
|
|
1367
|
+
*
|
|
1368
|
+
* The TUI provides:
|
|
1369
|
+
* - Header with task and iteration info
|
|
1370
|
+
* - Status bar with current phase, tool, and progress
|
|
1371
|
+
* - Three view modes: logs, tasks list, task detail
|
|
1372
|
+
* - Scrollable output area with ferix tag styling
|
|
1373
|
+
* - Keyboard navigation (vim-style j/k, g/G)
|
|
1374
|
+
* - Mouse wheel support
|
|
1375
|
+
* - Context-sensitive footer with keyboard hints
|
|
1376
|
+
*
|
|
1377
|
+
* Uses ANSI escape codes for terminal control (alternate buffer, cursor hiding, etc).
|
|
1378
|
+
*
|
|
1379
|
+
* @returns A Consumer that renders to the terminal
|
|
1380
|
+
*
|
|
1381
|
+
* @example
|
|
1382
|
+
* ```typescript
|
|
1383
|
+
* const consumer = createTUIConsumer();
|
|
1384
|
+
* const events = runLoop(config).pipe(Stream.provideLayer(layers));
|
|
1385
|
+
* await consumer.consume(events).pipe(Effect.runPromise);
|
|
1386
|
+
* ```
|
|
1387
|
+
*/
|
|
1388
|
+
declare function createTUIConsumer(): Consumer;
|
|
1389
|
+
|
|
1390
|
+
/**
|
|
1391
|
+
* Service interface for LLM execution.
|
|
1392
|
+
*
|
|
1393
|
+
* Implementations include:
|
|
1394
|
+
* - ClaudeCLI: Spawns `claude` CLI with stream-json output
|
|
1395
|
+
* - Mock: Returns predefined events for testing
|
|
1396
|
+
*
|
|
1397
|
+
* @example
|
|
1398
|
+
* ```typescript
|
|
1399
|
+
* const llm = yield* LLM;
|
|
1400
|
+
* const events = llm.execute("Fix the bug in main.ts");
|
|
1401
|
+
*
|
|
1402
|
+
* await events.pipe(
|
|
1403
|
+
* Stream.runForEach((event) => console.log(event)),
|
|
1404
|
+
* Effect.runPromise
|
|
1405
|
+
* );
|
|
1406
|
+
* ```
|
|
1407
|
+
*/
|
|
1408
|
+
interface LLMService {
|
|
1409
|
+
/**
|
|
1410
|
+
* Execute a prompt and return a stream of events.
|
|
1411
|
+
*
|
|
1412
|
+
* The stream emits events in real-time as the LLM produces output.
|
|
1413
|
+
* The final event will be a "Done" event containing the full output.
|
|
1414
|
+
*
|
|
1415
|
+
* @param prompt - The prompt to send to the LLM
|
|
1416
|
+
* @returns Stream of LLM events that can be consumed by any subscriber
|
|
1417
|
+
*/
|
|
1418
|
+
readonly execute: (prompt: string) => Stream.Stream<LLMEvent, LLMError>;
|
|
1419
|
+
}
|
|
1420
|
+
declare const LLM_base: Context.TagClass<LLM, "@ferix/LLM", LLMService>;
|
|
1421
|
+
/**
|
|
1422
|
+
* Effect Tag for the LLM service.
|
|
1423
|
+
*
|
|
1424
|
+
* Use this tag to depend on an LLM implementation without coupling to a specific provider.
|
|
1425
|
+
*
|
|
1426
|
+
* @example
|
|
1427
|
+
* ```typescript
|
|
1428
|
+
* const program = Effect.gen(function* () {
|
|
1429
|
+
* const llm = yield* LLM;
|
|
1430
|
+
* return yield* llm.execute(prompt).pipe(Stream.runCollect);
|
|
1431
|
+
* });
|
|
1432
|
+
*
|
|
1433
|
+
* // Provide different implementations
|
|
1434
|
+
* program.pipe(Effect.provide(ClaudeCLI.Live)); // Production
|
|
1435
|
+
* program.pipe(Effect.provide(Mock.Live)); // Testing
|
|
1436
|
+
* ```
|
|
1437
|
+
*/
|
|
1438
|
+
declare class LLM extends LLM_base {
|
|
1439
|
+
}
|
|
1440
|
+
|
|
1441
|
+
/**
|
|
1442
|
+
* Schema for MockLLMConfig for runtime validation.
|
|
1443
|
+
*/
|
|
1444
|
+
declare const MockLLMConfigSchema: Schema.Struct<{
|
|
1445
|
+
events: Schema.Array$<Schema.Union<[Schema.TaggedStruct<"Text", {
|
|
1446
|
+
text: typeof Schema.String;
|
|
1447
|
+
}>, Schema.TaggedStruct<"ToolStart", {
|
|
1448
|
+
tool: typeof Schema.String;
|
|
1449
|
+
}>, Schema.TaggedStruct<"ToolUse", {
|
|
1450
|
+
tool: typeof Schema.String;
|
|
1451
|
+
input: typeof Schema.Unknown;
|
|
1452
|
+
}>, Schema.TaggedStruct<"ToolEnd", {
|
|
1453
|
+
tool: typeof Schema.String;
|
|
1454
|
+
}>, Schema.TaggedStruct<"Done", {
|
|
1455
|
+
output: typeof Schema.String;
|
|
1456
|
+
}>]>>;
|
|
1457
|
+
delayMs: Schema.optional<typeof Schema.Number>;
|
|
1458
|
+
}>;
|
|
1459
|
+
type MockLLMConfig = typeof MockLLMConfigSchema.Type;
|
|
1460
|
+
/**
|
|
1461
|
+
* Creates a mock LLM service that emits predefined events.
|
|
1462
|
+
*
|
|
1463
|
+
* Useful for testing without making real LLM calls.
|
|
1464
|
+
*
|
|
1465
|
+
* @param config - Configuration specifying events to emit
|
|
1466
|
+
* @returns An LLMService that emits the configured events
|
|
1467
|
+
*
|
|
1468
|
+
* @example
|
|
1469
|
+
* ```typescript
|
|
1470
|
+
* const mockLLM = createMockLLM({
|
|
1471
|
+
* events: [
|
|
1472
|
+
* { _tag: "Text", text: "Hello " },
|
|
1473
|
+
* { _tag: "Text", text: "World!" },
|
|
1474
|
+
* { _tag: "Done", output: "Hello World!" },
|
|
1475
|
+
* ],
|
|
1476
|
+
* });
|
|
1477
|
+
* ```
|
|
1478
|
+
*/
|
|
1479
|
+
declare function createMockLLM(config: MockLLMConfig): LLMService;
|
|
1480
|
+
/**
|
|
1481
|
+
* Creates a Layer with custom mock events.
|
|
1482
|
+
*
|
|
1483
|
+
* @param config - Configuration specifying events to emit
|
|
1484
|
+
* @returns A Layer providing the configured mock LLM
|
|
1485
|
+
*
|
|
1486
|
+
* @example
|
|
1487
|
+
* ```typescript
|
|
1488
|
+
* const customMockLayer = Mock.layer({
|
|
1489
|
+
* events: [
|
|
1490
|
+
* { _tag: "Text", text: "<ferix:tasks><task id=\"1\">Test</task></ferix:tasks>" },
|
|
1491
|
+
* { _tag: "Done", output: "..." },
|
|
1492
|
+
* ],
|
|
1493
|
+
* });
|
|
1494
|
+
* ```
|
|
1495
|
+
*/
|
|
1496
|
+
declare function layer$2(config: MockLLMConfig): Layer.Layer<LLM>;
|
|
1497
|
+
/**
|
|
1498
|
+
* Mock namespace containing the Live layer and factory functions.
|
|
1499
|
+
*/
|
|
1500
|
+
declare const Mock: {
|
|
1501
|
+
readonly Live: Layer.Layer<LLM, never, never>;
|
|
1502
|
+
readonly layer: typeof layer$2;
|
|
1503
|
+
readonly createMockLLM: typeof createMockLLM;
|
|
1504
|
+
};
|
|
1505
|
+
|
|
1506
|
+
/**
|
|
1507
|
+
* ClaudeCLI namespace containing the Live layer.
|
|
1508
|
+
*/
|
|
1509
|
+
declare const ClaudeCLI: {
|
|
1510
|
+
readonly Live: Layer.Layer<LLM, never, never>;
|
|
1511
|
+
};
|
|
1512
|
+
|
|
1513
|
+
/**
|
|
1514
|
+
* Service interface for plan persistence.
|
|
1515
|
+
*
|
|
1516
|
+
* Plans are stored per session at `.ferix/plans/:sessionId/task-N.md`.
|
|
1517
|
+
* Each task gets its own file that is updated across iterations.
|
|
1518
|
+
*
|
|
1519
|
+
* Implementations include:
|
|
1520
|
+
* - FileSystem: Persists to `.ferix/plans/` directory
|
|
1521
|
+
* - Memory: In-memory storage for testing
|
|
1522
|
+
*
|
|
1523
|
+
* @example
|
|
1524
|
+
* ```typescript
|
|
1525
|
+
* const planStore = yield* PlanStore;
|
|
1526
|
+
*
|
|
1527
|
+
* // Create a new plan
|
|
1528
|
+
* const planId = yield* planStore.create(sessionId, plan);
|
|
1529
|
+
*
|
|
1530
|
+
* // Update after iteration
|
|
1531
|
+
* yield* planStore.update(planId, updatedPlan);
|
|
1532
|
+
*
|
|
1533
|
+
* // Load existing plan
|
|
1534
|
+
* const plan = yield* planStore.load(planId);
|
|
1535
|
+
* ```
|
|
1536
|
+
*/
|
|
1537
|
+
interface PlanStoreService {
|
|
1538
|
+
/**
|
|
1539
|
+
* Create a new plan for a session.
|
|
1540
|
+
*
|
|
1541
|
+
* @param sessionId - Session this plan belongs to
|
|
1542
|
+
* @param plan - Plan to persist
|
|
1543
|
+
* @returns The generated plan ID
|
|
1544
|
+
*/
|
|
1545
|
+
readonly create: (sessionId: string, plan: Omit<Plan, "id">) => Effect.Effect<PlanId, PlanStoreError>;
|
|
1546
|
+
/**
|
|
1547
|
+
* Load a plan by ID.
|
|
1548
|
+
*
|
|
1549
|
+
* @param planId - ID of the plan to load
|
|
1550
|
+
* @param sessionId - Optional session ID for O(1) lookup. If not provided, searches all sessions.
|
|
1551
|
+
* @returns The loaded plan
|
|
1552
|
+
*/
|
|
1553
|
+
readonly load: (planId: PlanId, sessionId?: string) => Effect.Effect<Plan, PlanStoreError>;
|
|
1554
|
+
/**
|
|
1555
|
+
* Update an existing plan.
|
|
1556
|
+
*
|
|
1557
|
+
* @param planId - ID of the plan to update
|
|
1558
|
+
* @param plan - Updated plan data
|
|
1559
|
+
*/
|
|
1560
|
+
readonly update: (planId: PlanId, plan: Plan) => Effect.Effect<void, PlanStoreError>;
|
|
1561
|
+
/**
|
|
1562
|
+
* List all plans for a session.
|
|
1563
|
+
*
|
|
1564
|
+
* @param sessionId - Session to list plans for
|
|
1565
|
+
* @returns Array of plan IDs
|
|
1566
|
+
*/
|
|
1567
|
+
readonly list: (sessionId: string) => Effect.Effect<readonly PlanId[], PlanStoreError>;
|
|
1568
|
+
}
|
|
1569
|
+
declare const PlanStore_base: Context.TagClass<PlanStore, "@ferix/PlanStore", PlanStoreService>;
|
|
1570
|
+
/**
|
|
1571
|
+
* Effect Tag for the PlanStore service.
|
|
1572
|
+
*
|
|
1573
|
+
* Use this tag to depend on plan storage without coupling to a specific backend.
|
|
1574
|
+
*/
|
|
1575
|
+
declare class PlanStore extends PlanStore_base {
|
|
1576
|
+
}
|
|
1577
|
+
|
|
1578
|
+
/**
|
|
1579
|
+
* FileSystemPlan namespace containing the Live layer.
|
|
1580
|
+
*/
|
|
1581
|
+
declare const FileSystemPlan: {
|
|
1582
|
+
readonly Live: Layer.Layer<PlanStore, never, never>;
|
|
1583
|
+
};
|
|
1584
|
+
|
|
1585
|
+
/**
|
|
1586
|
+
* Creates a Layer for an in-memory plan store.
|
|
1587
|
+
*
|
|
1588
|
+
* Each call creates a new isolated store.
|
|
1589
|
+
*
|
|
1590
|
+
* @example
|
|
1591
|
+
* ```typescript
|
|
1592
|
+
* const testLayer = MemoryPlan.layer();
|
|
1593
|
+
*
|
|
1594
|
+
* const program = Effect.gen(function* () {
|
|
1595
|
+
* const planStore = yield* PlanStore;
|
|
1596
|
+
* const planId = yield* planStore.create(sessionId, plan);
|
|
1597
|
+
* return planId;
|
|
1598
|
+
* });
|
|
1599
|
+
*
|
|
1600
|
+
* Effect.runPromise(program.pipe(Effect.provide(testLayer)));
|
|
1601
|
+
* ```
|
|
1602
|
+
*/
|
|
1603
|
+
declare function layer$1(): Layer.Layer<PlanStore>;
|
|
1604
|
+
/**
|
|
1605
|
+
* MemoryPlan namespace containing the Live layer and factory.
|
|
1606
|
+
*/
|
|
1607
|
+
declare const MemoryPlan: {
|
|
1608
|
+
readonly Live: Layer.Layer<PlanStore, never, never>;
|
|
1609
|
+
readonly layer: typeof layer$1;
|
|
1610
|
+
};
|
|
1611
|
+
|
|
1612
|
+
/**
|
|
1613
|
+
* Service interface for session persistence.
|
|
1614
|
+
*
|
|
1615
|
+
* Sessions track execution state across runs, enabling:
|
|
1616
|
+
* - Resumption of interrupted loops
|
|
1617
|
+
* - Progress tracking across tasks
|
|
1618
|
+
* - Context building from completed work
|
|
1619
|
+
*
|
|
1620
|
+
* @example
|
|
1621
|
+
* ```typescript
|
|
1622
|
+
* const sessionStore = yield* SessionStore;
|
|
1623
|
+
*
|
|
1624
|
+
* // Start a new session
|
|
1625
|
+
* const session = yield* sessionStore.create("Implement auth feature");
|
|
1626
|
+
*
|
|
1627
|
+
* // Update progress
|
|
1628
|
+
* yield* sessionStore.update(session.id, {
|
|
1629
|
+
* ...session,
|
|
1630
|
+
* currentTaskId: "1",
|
|
1631
|
+
* });
|
|
1632
|
+
*
|
|
1633
|
+
* // Mark task complete
|
|
1634
|
+
* yield* sessionStore.update(session.id, {
|
|
1635
|
+
* ...session,
|
|
1636
|
+
* completedTasks: [...session.completedTasks, "1"],
|
|
1637
|
+
* });
|
|
1638
|
+
* ```
|
|
1639
|
+
*/
|
|
1640
|
+
interface SessionStoreService {
|
|
1641
|
+
/**
|
|
1642
|
+
* Create a new session.
|
|
1643
|
+
*
|
|
1644
|
+
* @param originalTask - The task that initiated this session
|
|
1645
|
+
* @returns The created session with a generated ID
|
|
1646
|
+
*/
|
|
1647
|
+
readonly create: (originalTask: string) => Effect.Effect<Session, SessionStoreError>;
|
|
1648
|
+
/**
|
|
1649
|
+
* Get an existing session by ID.
|
|
1650
|
+
*
|
|
1651
|
+
* @param sessionId - ID of the session to retrieve
|
|
1652
|
+
* @returns The session, or error if not found
|
|
1653
|
+
*/
|
|
1654
|
+
readonly get: (sessionId: string) => Effect.Effect<Session, SessionStoreError>;
|
|
1655
|
+
/**
|
|
1656
|
+
* Update an existing session.
|
|
1657
|
+
*
|
|
1658
|
+
* @param sessionId - ID of the session to update
|
|
1659
|
+
* @param session - Updated session data
|
|
1660
|
+
*/
|
|
1661
|
+
readonly update: (sessionId: string, session: Session) => Effect.Effect<void, SessionStoreError>;
|
|
1662
|
+
}
|
|
1663
|
+
declare const SessionStore_base: Context.TagClass<SessionStore, "@ferix/SessionStore", SessionStoreService>;
|
|
1664
|
+
/**
|
|
1665
|
+
* Effect Tag for the SessionStore service.
|
|
1666
|
+
*
|
|
1667
|
+
* Use this tag to depend on session storage without coupling to a specific backend.
|
|
1668
|
+
*/
|
|
1669
|
+
declare class SessionStore extends SessionStore_base {
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
/**
|
|
1673
|
+
* FileSystemSession namespace containing the Live layer.
|
|
1674
|
+
*/
|
|
1675
|
+
declare const FileSystemSession: {
|
|
1676
|
+
readonly Live: Layer.Layer<SessionStore, never, never>;
|
|
1677
|
+
};
|
|
1678
|
+
|
|
1679
|
+
/**
|
|
1680
|
+
* Creates a Layer for an in-memory session store.
|
|
1681
|
+
*
|
|
1682
|
+
* Each call creates a new isolated store.
|
|
1683
|
+
*
|
|
1684
|
+
* @example
|
|
1685
|
+
* ```typescript
|
|
1686
|
+
* const testLayer = MemorySession.layer();
|
|
1687
|
+
*
|
|
1688
|
+
* const program = Effect.gen(function* () {
|
|
1689
|
+
* const sessionStore = yield* SessionStore;
|
|
1690
|
+
* const session = yield* sessionStore.create("Test task");
|
|
1691
|
+
* return session;
|
|
1692
|
+
* });
|
|
1693
|
+
*
|
|
1694
|
+
* Effect.runPromise(program.pipe(Effect.provide(testLayer)));
|
|
1695
|
+
* ```
|
|
1696
|
+
*/
|
|
1697
|
+
declare function layer(): Layer.Layer<SessionStore>;
|
|
1698
|
+
/**
|
|
1699
|
+
* MemorySession namespace containing the Live layer and factory.
|
|
1700
|
+
*/
|
|
1701
|
+
declare const MemorySession: {
|
|
1702
|
+
readonly Live: Layer.Layer<SessionStore, never, never>;
|
|
1703
|
+
readonly layer: typeof layer;
|
|
1704
|
+
};
|
|
1705
|
+
|
|
1706
|
+
/**
|
|
1707
|
+
* Accumulator for parsing signals across multiple text chunks.
|
|
1708
|
+
*
|
|
1709
|
+
* LLM output arrives in chunks, and signals may span multiple chunks.
|
|
1710
|
+
* The accumulator buffers text and extracts complete signals.
|
|
1711
|
+
*/
|
|
1712
|
+
interface SignalAccumulator {
|
|
1713
|
+
/**
|
|
1714
|
+
* Feed a text chunk to the accumulator.
|
|
1715
|
+
*
|
|
1716
|
+
* @param text - Text chunk from LLM output
|
|
1717
|
+
* @returns Array of complete signals found in the accumulated text
|
|
1718
|
+
*/
|
|
1719
|
+
readonly feed: (text: string) => Effect.Effect<readonly Signal[], ParseError>;
|
|
1720
|
+
/**
|
|
1721
|
+
* Flush any remaining buffered text and extract final signals.
|
|
1722
|
+
*
|
|
1723
|
+
* Call this when the LLM stream ends to ensure no signals are lost.
|
|
1724
|
+
*
|
|
1725
|
+
* @returns Array of signals found in remaining buffer
|
|
1726
|
+
*/
|
|
1727
|
+
readonly flush: () => Effect.Effect<readonly Signal[], ParseError>;
|
|
1728
|
+
}
|
|
1729
|
+
/**
|
|
1730
|
+
* Service interface for parsing signals from LLM output.
|
|
1731
|
+
*
|
|
1732
|
+
* Signals are structured XML-like tags embedded in LLM output:
|
|
1733
|
+
* - `<ferix:tasks>...</ferix:tasks>` - Task definitions
|
|
1734
|
+
* - `<ferix:phase-start id="1.1"/>` - Phase lifecycle
|
|
1735
|
+
* - `<ferix:criterion-passed id="1.c1"/>` - Criterion verification
|
|
1736
|
+
*
|
|
1737
|
+
* @example
|
|
1738
|
+
* ```typescript
|
|
1739
|
+
* const parser = yield* SignalParser;
|
|
1740
|
+
* const accumulator = yield* parser.createAccumulator();
|
|
1741
|
+
*
|
|
1742
|
+
* for (const chunk of textChunks) {
|
|
1743
|
+
* const signals = yield* accumulator.feed(chunk);
|
|
1744
|
+
* for (const signal of signals) {
|
|
1745
|
+
* // Handle signal
|
|
1746
|
+
* }
|
|
1747
|
+
* }
|
|
1748
|
+
*
|
|
1749
|
+
* const finalSignals = yield* accumulator.flush();
|
|
1750
|
+
* ```
|
|
1751
|
+
*/
|
|
1752
|
+
interface SignalParserService {
|
|
1753
|
+
/**
|
|
1754
|
+
* Parse a complete text and extract all signals.
|
|
1755
|
+
*
|
|
1756
|
+
* Use this for parsing complete output. For streaming, use createAccumulator.
|
|
1757
|
+
*
|
|
1758
|
+
* @param text - Complete text to parse
|
|
1759
|
+
* @returns Array of signals found in the text
|
|
1760
|
+
*/
|
|
1761
|
+
readonly parse: (text: string) => Effect.Effect<readonly Signal[], ParseError>;
|
|
1762
|
+
/**
|
|
1763
|
+
* Create a stateful accumulator for streaming signal parsing.
|
|
1764
|
+
*
|
|
1765
|
+
* The accumulator handles partial signals that span multiple chunks.
|
|
1766
|
+
*
|
|
1767
|
+
* @returns An accumulator instance for incremental parsing
|
|
1768
|
+
*/
|
|
1769
|
+
readonly createAccumulator: () => Effect.Effect<SignalAccumulator>;
|
|
1770
|
+
}
|
|
1771
|
+
declare const SignalParser_base: Context.TagClass<SignalParser, "@ferix/SignalParser", SignalParserService>;
|
|
1772
|
+
/**
|
|
1773
|
+
* Effect Tag for the SignalParser service.
|
|
1774
|
+
*
|
|
1775
|
+
* Use this tag to depend on signal parsing without coupling to a specific implementation.
|
|
1776
|
+
*/
|
|
1777
|
+
declare class SignalParser extends SignalParser_base {
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
/**
|
|
1781
|
+
* FerixParser namespace containing the Live layer.
|
|
1782
|
+
*/
|
|
1783
|
+
declare const FerixParser: {
|
|
1784
|
+
readonly Live: Layer.Layer<SignalParser, never, never>;
|
|
1785
|
+
};
|
|
1786
|
+
|
|
1787
|
+
/**
|
|
1788
|
+
* Production layer bundle.
|
|
1789
|
+
*
|
|
1790
|
+
* Uses real implementations:
|
|
1791
|
+
* - Claude CLI for LLM
|
|
1792
|
+
* - Ferix parser for signals
|
|
1793
|
+
* - File system for plan and session storage
|
|
1794
|
+
*
|
|
1795
|
+
* @example
|
|
1796
|
+
* ```typescript
|
|
1797
|
+
* const program = runLoop(config);
|
|
1798
|
+
*
|
|
1799
|
+
* Effect.runPromise(
|
|
1800
|
+
* program.pipe(
|
|
1801
|
+
* Stream.runForEach(console.log),
|
|
1802
|
+
* Effect.provide(ProductionLayers)
|
|
1803
|
+
* )
|
|
1804
|
+
* );
|
|
1805
|
+
* ```
|
|
1806
|
+
*/
|
|
1807
|
+
declare const ProductionLayers: Layer.Layer<LLM | PlanStore | SessionStore | SignalParser, never, never>;
|
|
1808
|
+
/**
|
|
1809
|
+
* Test layer bundle.
|
|
1810
|
+
*
|
|
1811
|
+
* Uses mock/in-memory implementations:
|
|
1812
|
+
* - Mock LLM (configurable events)
|
|
1813
|
+
* - Ferix parser (real implementation - pure)
|
|
1814
|
+
* - In-memory plan and session storage
|
|
1815
|
+
*
|
|
1816
|
+
* @example
|
|
1817
|
+
* ```typescript
|
|
1818
|
+
* const testProgram = runLoop(config);
|
|
1819
|
+
*
|
|
1820
|
+
* const result = await Effect.runPromise(
|
|
1821
|
+
* testProgram.pipe(
|
|
1822
|
+
* Stream.runCollect,
|
|
1823
|
+
* Effect.provide(TestLayers)
|
|
1824
|
+
* )
|
|
1825
|
+
* );
|
|
1826
|
+
*
|
|
1827
|
+
* expect(result).toContainEqual({ _tag: "LoopCompleted", ... });
|
|
1828
|
+
* ```
|
|
1829
|
+
*/
|
|
1830
|
+
declare const TestLayers: Layer.Layer<LLM | PlanStore | SessionStore | SignalParser, never, never>;
|
|
1831
|
+
/**
|
|
1832
|
+
* Creates a test layer bundle with custom mock LLM events.
|
|
1833
|
+
*
|
|
1834
|
+
* @param events - Events to emit from the mock LLM
|
|
1835
|
+
* @returns A layer bundle for testing with the specified events
|
|
1836
|
+
*
|
|
1837
|
+
* @example
|
|
1838
|
+
* ```typescript
|
|
1839
|
+
* const customTestLayers = createTestLayers([
|
|
1840
|
+
* { _tag: "Text", text: "<ferix:tasks>...</ferix:tasks>" },
|
|
1841
|
+
* { _tag: "Done", output: "..." },
|
|
1842
|
+
* ]);
|
|
1843
|
+
*
|
|
1844
|
+
* Effect.runPromise(program.pipe(Effect.provide(customTestLayers)));
|
|
1845
|
+
* ```
|
|
1846
|
+
*/
|
|
1847
|
+
declare function createTestLayers(events: Parameters<typeof Mock.layer>[0]["events"]): Layer.Layer<LLM | PlanStore | SessionStore | SignalParser, never, never>;
|
|
1848
|
+
|
|
1849
|
+
/**
|
|
1850
|
+
* Required services for the orchestrator.
|
|
1851
|
+
*/
|
|
1852
|
+
type OrchestratorServices = LLM | SignalParser | PlanStore | SessionStore;
|
|
1853
|
+
/**
|
|
1854
|
+
* Run the ralph loop.
|
|
1855
|
+
*
|
|
1856
|
+
* Returns a Stream of DomainEvents that ANY consumer can subscribe to.
|
|
1857
|
+
* The orchestrator has NO knowledge of how events are consumed.
|
|
1858
|
+
*
|
|
1859
|
+
* @param config - Loop configuration
|
|
1860
|
+
* @returns Stream of domain events
|
|
1861
|
+
*
|
|
1862
|
+
* @example TUI consumption
|
|
1863
|
+
* ```typescript
|
|
1864
|
+
* const events = runLoop(config);
|
|
1865
|
+
* await events.pipe(
|
|
1866
|
+
* Stream.runForEach((event) => tui.render(event)),
|
|
1867
|
+
* Effect.provide(ProductionLayers),
|
|
1868
|
+
* Effect.runPromise
|
|
1869
|
+
* );
|
|
1870
|
+
* ```
|
|
1871
|
+
*
|
|
1872
|
+
* @example Web consumption
|
|
1873
|
+
* ```typescript
|
|
1874
|
+
* const events = runLoop(config);
|
|
1875
|
+
* await events.pipe(
|
|
1876
|
+
* Stream.runForEach((event) => websocket.send(JSON.stringify(event))),
|
|
1877
|
+
* Effect.provide(ProductionLayers),
|
|
1878
|
+
* Effect.runPromise
|
|
1879
|
+
* );
|
|
1880
|
+
* ```
|
|
1881
|
+
*
|
|
1882
|
+
* @example Collecting events for testing
|
|
1883
|
+
* ```typescript
|
|
1884
|
+
* const events = runLoop(config);
|
|
1885
|
+
* const collected = await events.pipe(
|
|
1886
|
+
* Stream.runCollect,
|
|
1887
|
+
* Effect.provide(TestLayers),
|
|
1888
|
+
* Effect.runPromise
|
|
1889
|
+
* );
|
|
1890
|
+
* expect(collected).toContainEqual({ _tag: "LoopStarted", ... });
|
|
1891
|
+
* ```
|
|
1892
|
+
*/
|
|
1893
|
+
declare function runLoop(config: LoopConfig): Stream.Stream<DomainEvent, never, OrchestratorServices>;
|
|
1894
|
+
|
|
1895
|
+
/**
|
|
1896
|
+
* Builds the iteration prompt with context and instructions.
|
|
1897
|
+
*
|
|
1898
|
+
* @param config - Loop configuration
|
|
1899
|
+
* @param iteration - Current iteration number
|
|
1900
|
+
* @param plan - Current plan state (if available)
|
|
1901
|
+
* @returns The complete prompt for this iteration
|
|
1902
|
+
*/
|
|
1903
|
+
declare function buildPrompt(config: LoopConfig, iteration: number, plan?: Plan): string;
|
|
1904
|
+
|
|
1905
|
+
/**
|
|
1906
|
+
* Options for running the ralph loop program.
|
|
1907
|
+
*/
|
|
1908
|
+
interface RunOptions {
|
|
1909
|
+
/**
|
|
1910
|
+
* Loop configuration.
|
|
1911
|
+
*/
|
|
1912
|
+
readonly config: LoopConfig;
|
|
1913
|
+
/**
|
|
1914
|
+
* Consumer type for output.
|
|
1915
|
+
* - "tui": Full-screen terminal UI
|
|
1916
|
+
* - "headless": Simple console logging
|
|
1917
|
+
* - "none": No output (for programmatic use)
|
|
1918
|
+
*
|
|
1919
|
+
* @default "headless"
|
|
1920
|
+
*/
|
|
1921
|
+
readonly consumer?: ConsumerType;
|
|
1922
|
+
/**
|
|
1923
|
+
* Optional callback for each domain event.
|
|
1924
|
+
* Called in addition to the selected consumer.
|
|
1925
|
+
*/
|
|
1926
|
+
readonly onEvent?: (event: DomainEvent) => void;
|
|
1927
|
+
}
|
|
1928
|
+
/**
|
|
1929
|
+
* Run the ralph loop with production layers.
|
|
1930
|
+
*
|
|
1931
|
+
* This is the main entry point for running a ralph loop.
|
|
1932
|
+
* It composes all services and consumers into a single Effect program.
|
|
1933
|
+
*
|
|
1934
|
+
* @param options - Run options including config and consumer type
|
|
1935
|
+
* @returns Effect that completes when the loop finishes
|
|
1936
|
+
*
|
|
1937
|
+
* @example Basic usage
|
|
1938
|
+
* ```typescript
|
|
1939
|
+
* await run({
|
|
1940
|
+
* config: {
|
|
1941
|
+
* task: "Implement the feature",
|
|
1942
|
+
* maxIterations: 3,
|
|
1943
|
+
* verifyCommands: ["bun test"],
|
|
1944
|
+
* },
|
|
1945
|
+
* consumer: "tui",
|
|
1946
|
+
* }).pipe(Effect.runPromise);
|
|
1947
|
+
* ```
|
|
1948
|
+
*
|
|
1949
|
+
* @example With event callback
|
|
1950
|
+
* ```typescript
|
|
1951
|
+
* await run({
|
|
1952
|
+
* config: { task: "Fix the bug", maxIterations: 1, verifyCommands: [] },
|
|
1953
|
+
* consumer: "headless",
|
|
1954
|
+
* onEvent: (event) => {
|
|
1955
|
+
* if (event._tag === "TaskCompleted") {
|
|
1956
|
+
* console.log("Task done:", event.taskId);
|
|
1957
|
+
* }
|
|
1958
|
+
* },
|
|
1959
|
+
* }).pipe(Effect.runPromise);
|
|
1960
|
+
* ```
|
|
1961
|
+
*/
|
|
1962
|
+
declare function run(options: RunOptions): Effect.Effect<void, unknown, never>;
|
|
1963
|
+
/**
|
|
1964
|
+
* Run the ralph loop with test layers.
|
|
1965
|
+
*
|
|
1966
|
+
* Uses mock LLM and in-memory storage for testing.
|
|
1967
|
+
*
|
|
1968
|
+
* @param options - Run options including config
|
|
1969
|
+
* @param mockEvents - Optional custom mock events
|
|
1970
|
+
* @returns Effect that completes when the loop finishes
|
|
1971
|
+
*
|
|
1972
|
+
* @example
|
|
1973
|
+
* ```typescript
|
|
1974
|
+
* const mockEvents: LLMEvent[] = [
|
|
1975
|
+
* { _tag: "Text", text: "<ferix:tasks><task id=\"1\">Test</task></ferix:tasks>" },
|
|
1976
|
+
* { _tag: "Done", output: "..." },
|
|
1977
|
+
* ];
|
|
1978
|
+
*
|
|
1979
|
+
* await runTest(
|
|
1980
|
+
* { config: { task: "test", maxIterations: 1, verifyCommands: [] } },
|
|
1981
|
+
* mockEvents
|
|
1982
|
+
* ).pipe(Effect.runPromise);
|
|
1983
|
+
* ```
|
|
1984
|
+
*/
|
|
1985
|
+
declare function runTest(options: Omit<RunOptions, "consumer">, mockEvents?: readonly LLMEvent[]): Effect.Effect<void, unknown, never>;
|
|
1986
|
+
/**
|
|
1987
|
+
* Collect all events from a ralph loop run.
|
|
1988
|
+
*
|
|
1989
|
+
* Useful for testing to get all emitted events.
|
|
1990
|
+
*
|
|
1991
|
+
* @param config - Loop configuration
|
|
1992
|
+
* @param mockEvents - Optional custom mock events
|
|
1993
|
+
* @returns Array of all domain events emitted
|
|
1994
|
+
*
|
|
1995
|
+
* @example
|
|
1996
|
+
* ```typescript
|
|
1997
|
+
* const events = await collectEvents(config, mockEvents).pipe(Effect.runPromise);
|
|
1998
|
+
* expect(events).toContainEqual({ _tag: "LoopStarted", ... });
|
|
1999
|
+
* ```
|
|
2000
|
+
*/
|
|
2001
|
+
declare function collectEvents(config: LoopConfig, mockEvents?: readonly LLMEvent[]): Effect.Effect<readonly DomainEvent[], unknown, never>;
|
|
2002
|
+
/**
|
|
2003
|
+
* Main CLI entry point.
|
|
2004
|
+
*
|
|
2005
|
+
* Automatically selects TUI for TTY, headless otherwise.
|
|
2006
|
+
*
|
|
2007
|
+
* @param config - Loop configuration
|
|
2008
|
+
* @returns Promise that resolves when the loop completes
|
|
2009
|
+
*/
|
|
2010
|
+
declare function main(config: LoopConfig): Promise<void>;
|
|
2011
|
+
|
|
2012
|
+
export { type CheckFailedEvent, CheckFailedEventSchema, type CheckFailedSignal, CheckFailedSignalSchema, type CheckPassedEvent, CheckPassedEventSchema, type CheckPassedSignal, CheckPassedSignalSchema, ClaudeCLI, type ConsoleLoggerConfig, ConsoleLoggerConfigSchema, type Consumer, type ConsumerType, ConsumerTypeSchema, type CriteriaDefinedData, CriteriaDefinedDataSchema, type CriteriaDefinedEvent, CriteriaDefinedEventSchema, type CriteriaDefinedSignal, CriteriaDefinedSignalSchema, type Criterion, type CriterionBasicInfo, CriterionBasicInfoSchema, type CriterionFailedData, CriterionFailedDataSchema, type CriterionFailedEvent, CriterionFailedEventSchema, type CriterionFailedSignal, CriterionFailedSignalSchema, type CriterionIdData, CriterionIdDataSchema, type CriterionPassedEvent, CriterionPassedEventSchema, type CriterionPassedSignal, CriterionPassedSignalSchema, CriterionSchema, type CriterionStatus, CriterionStatusSchema, type DiscoveryCompletedEvent, DiscoveryCompletedEventSchema, type DiscoveryStartedEvent, DiscoveryStartedEventSchema, type DomainEvent, DomainEventSchema, DomainEventUtils, type DoneEvent, DoneEventSchema, type ExecutionMode, ExecutionModeSchema, type FerixError, FerixParser, type FileLoggerConfig, FileLoggerConfigSchema, FileSystemPlan, FileSystemSession, type GeneratedTask, type GeneratedTaskList, GeneratedTaskListSchema, GeneratedTaskSchema, type GeneratedTaskStatus, GeneratedTaskStatusSchema, type IterationCompletedEvent, IterationCompletedEventSchema, type IterationStartedEvent, IterationStartedEventSchema, LLM, LLMError, type LLMEvent, LLMEventSchema, type LLMService, type LLMTextEvent, LLMTextEventSchema, type LLMToolEndEvent, LLMToolEndEventSchema, type LLMToolStartEvent, LLMToolStartEventSchema, type LLMToolUseEvent, LLMToolUseEventSchema, type LogEntry, LogEntrySchema, type LogLevel, LogLevelSchema, type LoopCompleteSignal, LoopCompleteSignalSchema, type LoopCompletedEvent, LoopCompletedEventSchema, type LoopConfig, LoopConfigSchema, type LoopError, LoopErrorSchema, type LoopFailedEvent, LoopFailedEventSchema, type LoopStartedEvent, LoopStartedEventSchema, type LoopStatus, LoopStatusSchema, type LoopSummary, LoopSummarySchema, MemoryPlan, MemorySession, Mock, Mock as MockLLM, OrchestratorError, type OrchestratorServices, ParseError, type Phase, type PhaseBasicInfo, PhaseBasicInfoSchema, type PhaseCompletedEvent, PhaseCompletedEventSchema, type PhaseCompletedSignal, PhaseCompletedSignalSchema, type PhaseFailedData, PhaseFailedDataSchema, type PhaseFailedEvent, PhaseFailedEventSchema, type PhaseFailedSignal, PhaseFailedSignalSchema, type PhaseIdData, PhaseIdDataSchema, type PhasePromptOverrides, PhasePromptOverridesSchema, PhaseSchema, type PhaseStartedEvent, PhaseStartedEventSchema, type PhaseStartedSignal, PhaseStartedSignalSchema, type PhaseStatus, PhaseStatusSchema, type PhasesDefinedData, PhasesDefinedDataSchema, type PhasesDefinedEvent, PhasesDefinedEventSchema, type PhasesDefinedSignal, PhasesDefinedSignalSchema, type Plan, type PlanCreatedEvent, PlanCreatedEventSchema, type PlanData, PlanDataSchema, PlanId, PlanSchema, PlanStore, PlanStoreError, type PlanStoreService, type PlanUpdateFailedEvent, PlanUpdateFailedEventSchema, type PlanUpdatedEvent, PlanUpdatedEventSchema, ProductionLayers, type PromptConfig, PromptConfigSchema, type ReviewCompleteData, ReviewCompleteDataSchema, type ReviewCompleteEvent, ReviewCompleteEventSchema, type ReviewCompleteSignal, ReviewCompleteSignalSchema, type RunOptions, type RunOptionsData, RunOptionsDataSchema, type Session, SessionSchema, type SessionStatus, SessionStatusSchema, SessionStore, SessionStoreError, type SessionStoreService, type Signal, type SignalAccumulator, SignalParser, type SignalParserService, SignalSchema, type TUICriterion, TUICriterionSchema, type TUICriterionStatus, TUICriterionStatusSchema, type TUIPhase, TUIPhaseSchema, type TUIPhaseStatus, TUIPhaseStatusSchema, type TUIState, TUIStateSchema, type TUITask, TUITaskSchema, type TUITaskStatus, TUITaskStatusSchema, type Task, type TaskBasicInfo, TaskBasicInfoSchema, type TaskCompleteData, TaskCompleteDataSchema, type TaskCompleteSignal, type TaskCompleteSignalData, TaskCompleteSignalDataSchema, TaskCompleteSignalSchema, type TaskCompletedEvent, TaskCompletedEventSchema, TaskSchema, type TaskStatus, TaskStatusSchema, type TasksDefinedData, TasksDefinedDataSchema, type TasksDefinedEvent, TasksDefinedEventSchema, type TasksDefinedSignal, TasksDefinedSignalSchema, TestLayers, type TextEvent, TextEventSchema, type ToolEndEvent, ToolEndEventSchema, type ToolStartEvent, ToolStartEventSchema, type ToolUseEvent, ToolUseEventSchema, type ViewMode, ViewModeSchema, buildPrompt, collectEvents, createHeadlessConsumer, createTUIConsumer, createTestLayers, decodeLLMEvent, decodeLoopConfig, decodePlan, decodePlanData, decodeSession, decodeSignal, decodeSignalSync, formatTasksMd, main, parseTasksMd, run, runLoop, runTest };
|