byterover-cli 3.5.1 → 3.6.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.
Files changed (84) hide show
  1. package/.env.production +4 -6
  2. package/dist/agent/core/interfaces/i-cipher-agent.d.ts +1 -0
  3. package/dist/agent/infra/agent/cipher-agent.d.ts +1 -0
  4. package/dist/agent/infra/agent/cipher-agent.js +1 -0
  5. package/dist/oclif/commands/curate/view.js +5 -25
  6. package/dist/oclif/commands/dream.d.ts +18 -0
  7. package/dist/oclif/commands/dream.js +230 -0
  8. package/dist/oclif/commands/query-log/summary.d.ts +18 -0
  9. package/dist/oclif/commands/query-log/summary.js +75 -0
  10. package/dist/oclif/commands/query-log/view.d.ts +23 -0
  11. package/dist/oclif/commands/query-log/view.js +95 -0
  12. package/dist/oclif/lib/time-filter.d.ts +10 -0
  13. package/dist/oclif/lib/time-filter.js +21 -0
  14. package/dist/server/config/environment.d.ts +10 -3
  15. package/dist/server/config/environment.js +34 -15
  16. package/dist/server/constants.d.ts +5 -0
  17. package/dist/server/constants.js +7 -0
  18. package/dist/server/core/domain/entities/query-log-entry.d.ts +61 -0
  19. package/dist/server/core/domain/entities/query-log-entry.js +40 -0
  20. package/dist/server/core/domain/transport/schemas.d.ts +108 -7
  21. package/dist/server/core/domain/transport/schemas.js +34 -2
  22. package/dist/server/core/interfaces/executor/i-query-executor.d.ts +23 -2
  23. package/dist/server/core/interfaces/i-terminal.d.ts +3 -0
  24. package/dist/server/core/interfaces/i-terminal.js +1 -0
  25. package/dist/server/core/interfaces/storage/i-query-log-store.d.ts +23 -0
  26. package/dist/server/core/interfaces/storage/i-query-log-store.js +2 -0
  27. package/dist/server/core/interfaces/usecase/i-query-log-summary-use-case.d.ts +44 -0
  28. package/dist/server/core/interfaces/usecase/i-query-log-summary-use-case.js +1 -0
  29. package/dist/server/core/interfaces/usecase/i-query-log-use-case.d.ts +13 -0
  30. package/dist/server/core/interfaces/usecase/i-query-log-use-case.js +3 -0
  31. package/dist/server/infra/daemon/agent-process.js +79 -9
  32. package/dist/server/infra/daemon/brv-server.js +74 -5
  33. package/dist/server/infra/dream/dream-lock-service.d.ts +37 -0
  34. package/dist/server/infra/dream/dream-lock-service.js +88 -0
  35. package/dist/server/infra/dream/dream-log-schema.d.ts +966 -0
  36. package/dist/server/infra/dream/dream-log-schema.js +57 -0
  37. package/dist/server/infra/dream/dream-log-store.d.ts +55 -0
  38. package/dist/server/infra/dream/dream-log-store.js +141 -0
  39. package/dist/server/infra/dream/dream-response-schemas.d.ts +219 -0
  40. package/dist/server/infra/dream/dream-response-schemas.js +38 -0
  41. package/dist/server/infra/dream/dream-state-schema.d.ts +67 -0
  42. package/dist/server/infra/dream/dream-state-schema.js +23 -0
  43. package/dist/server/infra/dream/dream-state-service.d.ts +38 -0
  44. package/dist/server/infra/dream/dream-state-service.js +91 -0
  45. package/dist/server/infra/dream/dream-trigger.d.ts +46 -0
  46. package/dist/server/infra/dream/dream-trigger.js +65 -0
  47. package/dist/server/infra/dream/dream-undo.d.ts +38 -0
  48. package/dist/server/infra/dream/dream-undo.js +293 -0
  49. package/dist/server/infra/dream/operations/consolidate.d.ts +52 -0
  50. package/dist/server/infra/dream/operations/consolidate.js +514 -0
  51. package/dist/server/infra/dream/operations/prune.d.ts +45 -0
  52. package/dist/server/infra/dream/operations/prune.js +362 -0
  53. package/dist/server/infra/dream/operations/synthesize.d.ts +37 -0
  54. package/dist/server/infra/dream/operations/synthesize.js +278 -0
  55. package/dist/server/infra/dream/parse-dream-response.d.ts +11 -0
  56. package/dist/server/infra/dream/parse-dream-response.js +35 -0
  57. package/dist/server/infra/executor/curate-executor.js +10 -0
  58. package/dist/server/infra/executor/dream-executor.d.ts +97 -0
  59. package/dist/server/infra/executor/dream-executor.js +431 -0
  60. package/dist/server/infra/executor/query-executor.d.ts +2 -2
  61. package/dist/server/infra/executor/query-executor.js +92 -22
  62. package/dist/server/infra/process/feature-handlers.js +10 -6
  63. package/dist/server/infra/process/query-log-handler.d.ts +42 -0
  64. package/dist/server/infra/process/query-log-handler.js +150 -0
  65. package/dist/server/infra/process/task-router.d.ts +40 -0
  66. package/dist/server/infra/process/task-router.js +67 -9
  67. package/dist/server/infra/process/transport-handlers.d.ts +4 -0
  68. package/dist/server/infra/process/transport-handlers.js +1 -0
  69. package/dist/server/infra/storage/file-curate-log-store.js +1 -1
  70. package/dist/server/infra/storage/file-query-log-store.d.ts +81 -0
  71. package/dist/server/infra/storage/file-query-log-store.js +249 -0
  72. package/dist/server/infra/transport/handlers/config-handler.js +1 -1
  73. package/dist/server/infra/usecase/curate-log-use-case.js +7 -3
  74. package/dist/server/infra/usecase/query-log-summary-narrative-formatter.d.ts +15 -0
  75. package/dist/server/infra/usecase/query-log-summary-narrative-formatter.js +79 -0
  76. package/dist/server/infra/usecase/query-log-summary-use-case.d.ts +13 -0
  77. package/dist/server/infra/usecase/query-log-summary-use-case.js +217 -0
  78. package/dist/server/infra/usecase/query-log-use-case.d.ts +31 -0
  79. package/dist/server/infra/usecase/query-log-use-case.js +128 -0
  80. package/dist/server/utils/log-format-utils.d.ts +5 -0
  81. package/dist/server/utils/log-format-utils.js +23 -0
  82. package/dist/shared/transport/events/config-events.d.ts +1 -1
  83. package/oclif.manifest.json +510 -255
  84. package/package.json +1 -1
@@ -0,0 +1,966 @@
1
+ import { z } from 'zod';
2
+ export declare const DreamOperationSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
3
+ action: z.ZodEnum<["MERGE", "TEMPORAL_UPDATE", "CROSS_REFERENCE"]>;
4
+ inputFiles: z.ZodArray<z.ZodString, "many">;
5
+ needsReview: z.ZodBoolean;
6
+ outputFile: z.ZodOptional<z.ZodString>;
7
+ previousTexts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
8
+ reason: z.ZodString;
9
+ type: z.ZodLiteral<"CONSOLIDATE">;
10
+ }, "strip", z.ZodTypeAny, {
11
+ type: "CONSOLIDATE";
12
+ reason: string;
13
+ needsReview: boolean;
14
+ action: "MERGE" | "TEMPORAL_UPDATE" | "CROSS_REFERENCE";
15
+ inputFiles: string[];
16
+ outputFile?: string | undefined;
17
+ previousTexts?: Record<string, string> | undefined;
18
+ }, {
19
+ type: "CONSOLIDATE";
20
+ reason: string;
21
+ needsReview: boolean;
22
+ action: "MERGE" | "TEMPORAL_UPDATE" | "CROSS_REFERENCE";
23
+ inputFiles: string[];
24
+ outputFile?: string | undefined;
25
+ previousTexts?: Record<string, string> | undefined;
26
+ }>, z.ZodObject<{
27
+ action: z.ZodEnum<["CREATE", "UPDATE"]>;
28
+ confidence: z.ZodNumber;
29
+ needsReview: z.ZodBoolean;
30
+ outputFile: z.ZodString;
31
+ sources: z.ZodArray<z.ZodString, "many">;
32
+ type: z.ZodLiteral<"SYNTHESIZE">;
33
+ }, "strip", z.ZodTypeAny, {
34
+ type: "SYNTHESIZE";
35
+ sources: string[];
36
+ confidence: number;
37
+ needsReview: boolean;
38
+ action: "UPDATE" | "CREATE";
39
+ outputFile: string;
40
+ }, {
41
+ type: "SYNTHESIZE";
42
+ sources: string[];
43
+ confidence: number;
44
+ needsReview: boolean;
45
+ action: "UPDATE" | "CREATE";
46
+ outputFile: string;
47
+ }>, z.ZodObject<{
48
+ action: z.ZodEnum<["ARCHIVE", "KEEP", "SUGGEST_MERGE"]>;
49
+ file: z.ZodString;
50
+ mergeTarget: z.ZodOptional<z.ZodString>;
51
+ needsReview: z.ZodBoolean;
52
+ reason: z.ZodString;
53
+ stubPath: z.ZodOptional<z.ZodString>;
54
+ type: z.ZodLiteral<"PRUNE">;
55
+ }, "strip", z.ZodTypeAny, {
56
+ type: "PRUNE";
57
+ reason: string;
58
+ file: string;
59
+ needsReview: boolean;
60
+ action: "ARCHIVE" | "KEEP" | "SUGGEST_MERGE";
61
+ mergeTarget?: string | undefined;
62
+ stubPath?: string | undefined;
63
+ }, {
64
+ type: "PRUNE";
65
+ reason: string;
66
+ file: string;
67
+ needsReview: boolean;
68
+ action: "ARCHIVE" | "KEEP" | "SUGGEST_MERGE";
69
+ mergeTarget?: string | undefined;
70
+ stubPath?: string | undefined;
71
+ }>]>;
72
+ export type DreamOperation = z.infer<typeof DreamOperationSchema>;
73
+ export declare const DreamLogSummarySchema: z.ZodObject<{
74
+ consolidated: z.ZodNumber;
75
+ errors: z.ZodNumber;
76
+ flaggedForReview: z.ZodNumber;
77
+ pruned: z.ZodNumber;
78
+ synthesized: z.ZodNumber;
79
+ }, "strip", z.ZodTypeAny, {
80
+ errors: number;
81
+ consolidated: number;
82
+ flaggedForReview: number;
83
+ pruned: number;
84
+ synthesized: number;
85
+ }, {
86
+ errors: number;
87
+ consolidated: number;
88
+ flaggedForReview: number;
89
+ pruned: number;
90
+ synthesized: number;
91
+ }>;
92
+ export type DreamLogSummary = z.infer<typeof DreamLogSummarySchema>;
93
+ export declare const DreamLogEntrySchema: z.ZodDiscriminatedUnion<"status", [z.ZodObject<{
94
+ id: z.ZodString;
95
+ operations: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
96
+ action: z.ZodEnum<["MERGE", "TEMPORAL_UPDATE", "CROSS_REFERENCE"]>;
97
+ inputFiles: z.ZodArray<z.ZodString, "many">;
98
+ needsReview: z.ZodBoolean;
99
+ outputFile: z.ZodOptional<z.ZodString>;
100
+ previousTexts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
101
+ reason: z.ZodString;
102
+ type: z.ZodLiteral<"CONSOLIDATE">;
103
+ }, "strip", z.ZodTypeAny, {
104
+ type: "CONSOLIDATE";
105
+ reason: string;
106
+ needsReview: boolean;
107
+ action: "MERGE" | "TEMPORAL_UPDATE" | "CROSS_REFERENCE";
108
+ inputFiles: string[];
109
+ outputFile?: string | undefined;
110
+ previousTexts?: Record<string, string> | undefined;
111
+ }, {
112
+ type: "CONSOLIDATE";
113
+ reason: string;
114
+ needsReview: boolean;
115
+ action: "MERGE" | "TEMPORAL_UPDATE" | "CROSS_REFERENCE";
116
+ inputFiles: string[];
117
+ outputFile?: string | undefined;
118
+ previousTexts?: Record<string, string> | undefined;
119
+ }>, z.ZodObject<{
120
+ action: z.ZodEnum<["CREATE", "UPDATE"]>;
121
+ confidence: z.ZodNumber;
122
+ needsReview: z.ZodBoolean;
123
+ outputFile: z.ZodString;
124
+ sources: z.ZodArray<z.ZodString, "many">;
125
+ type: z.ZodLiteral<"SYNTHESIZE">;
126
+ }, "strip", z.ZodTypeAny, {
127
+ type: "SYNTHESIZE";
128
+ sources: string[];
129
+ confidence: number;
130
+ needsReview: boolean;
131
+ action: "UPDATE" | "CREATE";
132
+ outputFile: string;
133
+ }, {
134
+ type: "SYNTHESIZE";
135
+ sources: string[];
136
+ confidence: number;
137
+ needsReview: boolean;
138
+ action: "UPDATE" | "CREATE";
139
+ outputFile: string;
140
+ }>, z.ZodObject<{
141
+ action: z.ZodEnum<["ARCHIVE", "KEEP", "SUGGEST_MERGE"]>;
142
+ file: z.ZodString;
143
+ mergeTarget: z.ZodOptional<z.ZodString>;
144
+ needsReview: z.ZodBoolean;
145
+ reason: z.ZodString;
146
+ stubPath: z.ZodOptional<z.ZodString>;
147
+ type: z.ZodLiteral<"PRUNE">;
148
+ }, "strip", z.ZodTypeAny, {
149
+ type: "PRUNE";
150
+ reason: string;
151
+ file: string;
152
+ needsReview: boolean;
153
+ action: "ARCHIVE" | "KEEP" | "SUGGEST_MERGE";
154
+ mergeTarget?: string | undefined;
155
+ stubPath?: string | undefined;
156
+ }, {
157
+ type: "PRUNE";
158
+ reason: string;
159
+ file: string;
160
+ needsReview: boolean;
161
+ action: "ARCHIVE" | "KEEP" | "SUGGEST_MERGE";
162
+ mergeTarget?: string | undefined;
163
+ stubPath?: string | undefined;
164
+ }>]>, "many">;
165
+ startedAt: z.ZodNumber;
166
+ summary: z.ZodObject<{
167
+ consolidated: z.ZodNumber;
168
+ errors: z.ZodNumber;
169
+ flaggedForReview: z.ZodNumber;
170
+ pruned: z.ZodNumber;
171
+ synthesized: z.ZodNumber;
172
+ }, "strip", z.ZodTypeAny, {
173
+ errors: number;
174
+ consolidated: number;
175
+ flaggedForReview: number;
176
+ pruned: number;
177
+ synthesized: number;
178
+ }, {
179
+ errors: number;
180
+ consolidated: number;
181
+ flaggedForReview: number;
182
+ pruned: number;
183
+ synthesized: number;
184
+ }>;
185
+ taskId: z.ZodOptional<z.ZodString>;
186
+ trigger: z.ZodEnum<["agent-idle", "manual", "cli"]>;
187
+ } & {
188
+ completedAt: z.ZodNumber;
189
+ status: z.ZodLiteral<"completed">;
190
+ }, "strip", z.ZodTypeAny, {
191
+ status: "completed";
192
+ summary: {
193
+ errors: number;
194
+ consolidated: number;
195
+ flaggedForReview: number;
196
+ pruned: number;
197
+ synthesized: number;
198
+ };
199
+ id: string;
200
+ startedAt: number;
201
+ completedAt: number;
202
+ operations: ({
203
+ type: "CONSOLIDATE";
204
+ reason: string;
205
+ needsReview: boolean;
206
+ action: "MERGE" | "TEMPORAL_UPDATE" | "CROSS_REFERENCE";
207
+ inputFiles: string[];
208
+ outputFile?: string | undefined;
209
+ previousTexts?: Record<string, string> | undefined;
210
+ } | {
211
+ type: "SYNTHESIZE";
212
+ sources: string[];
213
+ confidence: number;
214
+ needsReview: boolean;
215
+ action: "UPDATE" | "CREATE";
216
+ outputFile: string;
217
+ } | {
218
+ type: "PRUNE";
219
+ reason: string;
220
+ file: string;
221
+ needsReview: boolean;
222
+ action: "ARCHIVE" | "KEEP" | "SUGGEST_MERGE";
223
+ mergeTarget?: string | undefined;
224
+ stubPath?: string | undefined;
225
+ })[];
226
+ trigger: "manual" | "agent-idle" | "cli";
227
+ taskId?: string | undefined;
228
+ }, {
229
+ status: "completed";
230
+ summary: {
231
+ errors: number;
232
+ consolidated: number;
233
+ flaggedForReview: number;
234
+ pruned: number;
235
+ synthesized: number;
236
+ };
237
+ id: string;
238
+ startedAt: number;
239
+ completedAt: number;
240
+ operations: ({
241
+ type: "CONSOLIDATE";
242
+ reason: string;
243
+ needsReview: boolean;
244
+ action: "MERGE" | "TEMPORAL_UPDATE" | "CROSS_REFERENCE";
245
+ inputFiles: string[];
246
+ outputFile?: string | undefined;
247
+ previousTexts?: Record<string, string> | undefined;
248
+ } | {
249
+ type: "SYNTHESIZE";
250
+ sources: string[];
251
+ confidence: number;
252
+ needsReview: boolean;
253
+ action: "UPDATE" | "CREATE";
254
+ outputFile: string;
255
+ } | {
256
+ type: "PRUNE";
257
+ reason: string;
258
+ file: string;
259
+ needsReview: boolean;
260
+ action: "ARCHIVE" | "KEEP" | "SUGGEST_MERGE";
261
+ mergeTarget?: string | undefined;
262
+ stubPath?: string | undefined;
263
+ })[];
264
+ trigger: "manual" | "agent-idle" | "cli";
265
+ taskId?: string | undefined;
266
+ }>, z.ZodObject<{
267
+ id: z.ZodString;
268
+ operations: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
269
+ action: z.ZodEnum<["MERGE", "TEMPORAL_UPDATE", "CROSS_REFERENCE"]>;
270
+ inputFiles: z.ZodArray<z.ZodString, "many">;
271
+ needsReview: z.ZodBoolean;
272
+ outputFile: z.ZodOptional<z.ZodString>;
273
+ previousTexts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
274
+ reason: z.ZodString;
275
+ type: z.ZodLiteral<"CONSOLIDATE">;
276
+ }, "strip", z.ZodTypeAny, {
277
+ type: "CONSOLIDATE";
278
+ reason: string;
279
+ needsReview: boolean;
280
+ action: "MERGE" | "TEMPORAL_UPDATE" | "CROSS_REFERENCE";
281
+ inputFiles: string[];
282
+ outputFile?: string | undefined;
283
+ previousTexts?: Record<string, string> | undefined;
284
+ }, {
285
+ type: "CONSOLIDATE";
286
+ reason: string;
287
+ needsReview: boolean;
288
+ action: "MERGE" | "TEMPORAL_UPDATE" | "CROSS_REFERENCE";
289
+ inputFiles: string[];
290
+ outputFile?: string | undefined;
291
+ previousTexts?: Record<string, string> | undefined;
292
+ }>, z.ZodObject<{
293
+ action: z.ZodEnum<["CREATE", "UPDATE"]>;
294
+ confidence: z.ZodNumber;
295
+ needsReview: z.ZodBoolean;
296
+ outputFile: z.ZodString;
297
+ sources: z.ZodArray<z.ZodString, "many">;
298
+ type: z.ZodLiteral<"SYNTHESIZE">;
299
+ }, "strip", z.ZodTypeAny, {
300
+ type: "SYNTHESIZE";
301
+ sources: string[];
302
+ confidence: number;
303
+ needsReview: boolean;
304
+ action: "UPDATE" | "CREATE";
305
+ outputFile: string;
306
+ }, {
307
+ type: "SYNTHESIZE";
308
+ sources: string[];
309
+ confidence: number;
310
+ needsReview: boolean;
311
+ action: "UPDATE" | "CREATE";
312
+ outputFile: string;
313
+ }>, z.ZodObject<{
314
+ action: z.ZodEnum<["ARCHIVE", "KEEP", "SUGGEST_MERGE"]>;
315
+ file: z.ZodString;
316
+ mergeTarget: z.ZodOptional<z.ZodString>;
317
+ needsReview: z.ZodBoolean;
318
+ reason: z.ZodString;
319
+ stubPath: z.ZodOptional<z.ZodString>;
320
+ type: z.ZodLiteral<"PRUNE">;
321
+ }, "strip", z.ZodTypeAny, {
322
+ type: "PRUNE";
323
+ reason: string;
324
+ file: string;
325
+ needsReview: boolean;
326
+ action: "ARCHIVE" | "KEEP" | "SUGGEST_MERGE";
327
+ mergeTarget?: string | undefined;
328
+ stubPath?: string | undefined;
329
+ }, {
330
+ type: "PRUNE";
331
+ reason: string;
332
+ file: string;
333
+ needsReview: boolean;
334
+ action: "ARCHIVE" | "KEEP" | "SUGGEST_MERGE";
335
+ mergeTarget?: string | undefined;
336
+ stubPath?: string | undefined;
337
+ }>]>, "many">;
338
+ startedAt: z.ZodNumber;
339
+ summary: z.ZodObject<{
340
+ consolidated: z.ZodNumber;
341
+ errors: z.ZodNumber;
342
+ flaggedForReview: z.ZodNumber;
343
+ pruned: z.ZodNumber;
344
+ synthesized: z.ZodNumber;
345
+ }, "strip", z.ZodTypeAny, {
346
+ errors: number;
347
+ consolidated: number;
348
+ flaggedForReview: number;
349
+ pruned: number;
350
+ synthesized: number;
351
+ }, {
352
+ errors: number;
353
+ consolidated: number;
354
+ flaggedForReview: number;
355
+ pruned: number;
356
+ synthesized: number;
357
+ }>;
358
+ taskId: z.ZodOptional<z.ZodString>;
359
+ trigger: z.ZodEnum<["agent-idle", "manual", "cli"]>;
360
+ } & {
361
+ abortReason: z.ZodString;
362
+ completedAt: z.ZodNumber;
363
+ status: z.ZodLiteral<"partial">;
364
+ }, "strip", z.ZodTypeAny, {
365
+ status: "partial";
366
+ summary: {
367
+ errors: number;
368
+ consolidated: number;
369
+ flaggedForReview: number;
370
+ pruned: number;
371
+ synthesized: number;
372
+ };
373
+ id: string;
374
+ startedAt: number;
375
+ completedAt: number;
376
+ operations: ({
377
+ type: "CONSOLIDATE";
378
+ reason: string;
379
+ needsReview: boolean;
380
+ action: "MERGE" | "TEMPORAL_UPDATE" | "CROSS_REFERENCE";
381
+ inputFiles: string[];
382
+ outputFile?: string | undefined;
383
+ previousTexts?: Record<string, string> | undefined;
384
+ } | {
385
+ type: "SYNTHESIZE";
386
+ sources: string[];
387
+ confidence: number;
388
+ needsReview: boolean;
389
+ action: "UPDATE" | "CREATE";
390
+ outputFile: string;
391
+ } | {
392
+ type: "PRUNE";
393
+ reason: string;
394
+ file: string;
395
+ needsReview: boolean;
396
+ action: "ARCHIVE" | "KEEP" | "SUGGEST_MERGE";
397
+ mergeTarget?: string | undefined;
398
+ stubPath?: string | undefined;
399
+ })[];
400
+ trigger: "manual" | "agent-idle" | "cli";
401
+ abortReason: string;
402
+ taskId?: string | undefined;
403
+ }, {
404
+ status: "partial";
405
+ summary: {
406
+ errors: number;
407
+ consolidated: number;
408
+ flaggedForReview: number;
409
+ pruned: number;
410
+ synthesized: number;
411
+ };
412
+ id: string;
413
+ startedAt: number;
414
+ completedAt: number;
415
+ operations: ({
416
+ type: "CONSOLIDATE";
417
+ reason: string;
418
+ needsReview: boolean;
419
+ action: "MERGE" | "TEMPORAL_UPDATE" | "CROSS_REFERENCE";
420
+ inputFiles: string[];
421
+ outputFile?: string | undefined;
422
+ previousTexts?: Record<string, string> | undefined;
423
+ } | {
424
+ type: "SYNTHESIZE";
425
+ sources: string[];
426
+ confidence: number;
427
+ needsReview: boolean;
428
+ action: "UPDATE" | "CREATE";
429
+ outputFile: string;
430
+ } | {
431
+ type: "PRUNE";
432
+ reason: string;
433
+ file: string;
434
+ needsReview: boolean;
435
+ action: "ARCHIVE" | "KEEP" | "SUGGEST_MERGE";
436
+ mergeTarget?: string | undefined;
437
+ stubPath?: string | undefined;
438
+ })[];
439
+ trigger: "manual" | "agent-idle" | "cli";
440
+ abortReason: string;
441
+ taskId?: string | undefined;
442
+ }>, z.ZodObject<{
443
+ id: z.ZodString;
444
+ operations: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
445
+ action: z.ZodEnum<["MERGE", "TEMPORAL_UPDATE", "CROSS_REFERENCE"]>;
446
+ inputFiles: z.ZodArray<z.ZodString, "many">;
447
+ needsReview: z.ZodBoolean;
448
+ outputFile: z.ZodOptional<z.ZodString>;
449
+ previousTexts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
450
+ reason: z.ZodString;
451
+ type: z.ZodLiteral<"CONSOLIDATE">;
452
+ }, "strip", z.ZodTypeAny, {
453
+ type: "CONSOLIDATE";
454
+ reason: string;
455
+ needsReview: boolean;
456
+ action: "MERGE" | "TEMPORAL_UPDATE" | "CROSS_REFERENCE";
457
+ inputFiles: string[];
458
+ outputFile?: string | undefined;
459
+ previousTexts?: Record<string, string> | undefined;
460
+ }, {
461
+ type: "CONSOLIDATE";
462
+ reason: string;
463
+ needsReview: boolean;
464
+ action: "MERGE" | "TEMPORAL_UPDATE" | "CROSS_REFERENCE";
465
+ inputFiles: string[];
466
+ outputFile?: string | undefined;
467
+ previousTexts?: Record<string, string> | undefined;
468
+ }>, z.ZodObject<{
469
+ action: z.ZodEnum<["CREATE", "UPDATE"]>;
470
+ confidence: z.ZodNumber;
471
+ needsReview: z.ZodBoolean;
472
+ outputFile: z.ZodString;
473
+ sources: z.ZodArray<z.ZodString, "many">;
474
+ type: z.ZodLiteral<"SYNTHESIZE">;
475
+ }, "strip", z.ZodTypeAny, {
476
+ type: "SYNTHESIZE";
477
+ sources: string[];
478
+ confidence: number;
479
+ needsReview: boolean;
480
+ action: "UPDATE" | "CREATE";
481
+ outputFile: string;
482
+ }, {
483
+ type: "SYNTHESIZE";
484
+ sources: string[];
485
+ confidence: number;
486
+ needsReview: boolean;
487
+ action: "UPDATE" | "CREATE";
488
+ outputFile: string;
489
+ }>, z.ZodObject<{
490
+ action: z.ZodEnum<["ARCHIVE", "KEEP", "SUGGEST_MERGE"]>;
491
+ file: z.ZodString;
492
+ mergeTarget: z.ZodOptional<z.ZodString>;
493
+ needsReview: z.ZodBoolean;
494
+ reason: z.ZodString;
495
+ stubPath: z.ZodOptional<z.ZodString>;
496
+ type: z.ZodLiteral<"PRUNE">;
497
+ }, "strip", z.ZodTypeAny, {
498
+ type: "PRUNE";
499
+ reason: string;
500
+ file: string;
501
+ needsReview: boolean;
502
+ action: "ARCHIVE" | "KEEP" | "SUGGEST_MERGE";
503
+ mergeTarget?: string | undefined;
504
+ stubPath?: string | undefined;
505
+ }, {
506
+ type: "PRUNE";
507
+ reason: string;
508
+ file: string;
509
+ needsReview: boolean;
510
+ action: "ARCHIVE" | "KEEP" | "SUGGEST_MERGE";
511
+ mergeTarget?: string | undefined;
512
+ stubPath?: string | undefined;
513
+ }>]>, "many">;
514
+ startedAt: z.ZodNumber;
515
+ summary: z.ZodObject<{
516
+ consolidated: z.ZodNumber;
517
+ errors: z.ZodNumber;
518
+ flaggedForReview: z.ZodNumber;
519
+ pruned: z.ZodNumber;
520
+ synthesized: z.ZodNumber;
521
+ }, "strip", z.ZodTypeAny, {
522
+ errors: number;
523
+ consolidated: number;
524
+ flaggedForReview: number;
525
+ pruned: number;
526
+ synthesized: number;
527
+ }, {
528
+ errors: number;
529
+ consolidated: number;
530
+ flaggedForReview: number;
531
+ pruned: number;
532
+ synthesized: number;
533
+ }>;
534
+ taskId: z.ZodOptional<z.ZodString>;
535
+ trigger: z.ZodEnum<["agent-idle", "manual", "cli"]>;
536
+ } & {
537
+ completedAt: z.ZodNumber;
538
+ error: z.ZodString;
539
+ status: z.ZodLiteral<"error">;
540
+ }, "strip", z.ZodTypeAny, {
541
+ status: "error";
542
+ error: string;
543
+ summary: {
544
+ errors: number;
545
+ consolidated: number;
546
+ flaggedForReview: number;
547
+ pruned: number;
548
+ synthesized: number;
549
+ };
550
+ id: string;
551
+ startedAt: number;
552
+ completedAt: number;
553
+ operations: ({
554
+ type: "CONSOLIDATE";
555
+ reason: string;
556
+ needsReview: boolean;
557
+ action: "MERGE" | "TEMPORAL_UPDATE" | "CROSS_REFERENCE";
558
+ inputFiles: string[];
559
+ outputFile?: string | undefined;
560
+ previousTexts?: Record<string, string> | undefined;
561
+ } | {
562
+ type: "SYNTHESIZE";
563
+ sources: string[];
564
+ confidence: number;
565
+ needsReview: boolean;
566
+ action: "UPDATE" | "CREATE";
567
+ outputFile: string;
568
+ } | {
569
+ type: "PRUNE";
570
+ reason: string;
571
+ file: string;
572
+ needsReview: boolean;
573
+ action: "ARCHIVE" | "KEEP" | "SUGGEST_MERGE";
574
+ mergeTarget?: string | undefined;
575
+ stubPath?: string | undefined;
576
+ })[];
577
+ trigger: "manual" | "agent-idle" | "cli";
578
+ taskId?: string | undefined;
579
+ }, {
580
+ status: "error";
581
+ error: string;
582
+ summary: {
583
+ errors: number;
584
+ consolidated: number;
585
+ flaggedForReview: number;
586
+ pruned: number;
587
+ synthesized: number;
588
+ };
589
+ id: string;
590
+ startedAt: number;
591
+ completedAt: number;
592
+ operations: ({
593
+ type: "CONSOLIDATE";
594
+ reason: string;
595
+ needsReview: boolean;
596
+ action: "MERGE" | "TEMPORAL_UPDATE" | "CROSS_REFERENCE";
597
+ inputFiles: string[];
598
+ outputFile?: string | undefined;
599
+ previousTexts?: Record<string, string> | undefined;
600
+ } | {
601
+ type: "SYNTHESIZE";
602
+ sources: string[];
603
+ confidence: number;
604
+ needsReview: boolean;
605
+ action: "UPDATE" | "CREATE";
606
+ outputFile: string;
607
+ } | {
608
+ type: "PRUNE";
609
+ reason: string;
610
+ file: string;
611
+ needsReview: boolean;
612
+ action: "ARCHIVE" | "KEEP" | "SUGGEST_MERGE";
613
+ mergeTarget?: string | undefined;
614
+ stubPath?: string | undefined;
615
+ })[];
616
+ trigger: "manual" | "agent-idle" | "cli";
617
+ taskId?: string | undefined;
618
+ }>, z.ZodObject<{
619
+ id: z.ZodString;
620
+ operations: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
621
+ action: z.ZodEnum<["MERGE", "TEMPORAL_UPDATE", "CROSS_REFERENCE"]>;
622
+ inputFiles: z.ZodArray<z.ZodString, "many">;
623
+ needsReview: z.ZodBoolean;
624
+ outputFile: z.ZodOptional<z.ZodString>;
625
+ previousTexts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
626
+ reason: z.ZodString;
627
+ type: z.ZodLiteral<"CONSOLIDATE">;
628
+ }, "strip", z.ZodTypeAny, {
629
+ type: "CONSOLIDATE";
630
+ reason: string;
631
+ needsReview: boolean;
632
+ action: "MERGE" | "TEMPORAL_UPDATE" | "CROSS_REFERENCE";
633
+ inputFiles: string[];
634
+ outputFile?: string | undefined;
635
+ previousTexts?: Record<string, string> | undefined;
636
+ }, {
637
+ type: "CONSOLIDATE";
638
+ reason: string;
639
+ needsReview: boolean;
640
+ action: "MERGE" | "TEMPORAL_UPDATE" | "CROSS_REFERENCE";
641
+ inputFiles: string[];
642
+ outputFile?: string | undefined;
643
+ previousTexts?: Record<string, string> | undefined;
644
+ }>, z.ZodObject<{
645
+ action: z.ZodEnum<["CREATE", "UPDATE"]>;
646
+ confidence: z.ZodNumber;
647
+ needsReview: z.ZodBoolean;
648
+ outputFile: z.ZodString;
649
+ sources: z.ZodArray<z.ZodString, "many">;
650
+ type: z.ZodLiteral<"SYNTHESIZE">;
651
+ }, "strip", z.ZodTypeAny, {
652
+ type: "SYNTHESIZE";
653
+ sources: string[];
654
+ confidence: number;
655
+ needsReview: boolean;
656
+ action: "UPDATE" | "CREATE";
657
+ outputFile: string;
658
+ }, {
659
+ type: "SYNTHESIZE";
660
+ sources: string[];
661
+ confidence: number;
662
+ needsReview: boolean;
663
+ action: "UPDATE" | "CREATE";
664
+ outputFile: string;
665
+ }>, z.ZodObject<{
666
+ action: z.ZodEnum<["ARCHIVE", "KEEP", "SUGGEST_MERGE"]>;
667
+ file: z.ZodString;
668
+ mergeTarget: z.ZodOptional<z.ZodString>;
669
+ needsReview: z.ZodBoolean;
670
+ reason: z.ZodString;
671
+ stubPath: z.ZodOptional<z.ZodString>;
672
+ type: z.ZodLiteral<"PRUNE">;
673
+ }, "strip", z.ZodTypeAny, {
674
+ type: "PRUNE";
675
+ reason: string;
676
+ file: string;
677
+ needsReview: boolean;
678
+ action: "ARCHIVE" | "KEEP" | "SUGGEST_MERGE";
679
+ mergeTarget?: string | undefined;
680
+ stubPath?: string | undefined;
681
+ }, {
682
+ type: "PRUNE";
683
+ reason: string;
684
+ file: string;
685
+ needsReview: boolean;
686
+ action: "ARCHIVE" | "KEEP" | "SUGGEST_MERGE";
687
+ mergeTarget?: string | undefined;
688
+ stubPath?: string | undefined;
689
+ }>]>, "many">;
690
+ startedAt: z.ZodNumber;
691
+ summary: z.ZodObject<{
692
+ consolidated: z.ZodNumber;
693
+ errors: z.ZodNumber;
694
+ flaggedForReview: z.ZodNumber;
695
+ pruned: z.ZodNumber;
696
+ synthesized: z.ZodNumber;
697
+ }, "strip", z.ZodTypeAny, {
698
+ errors: number;
699
+ consolidated: number;
700
+ flaggedForReview: number;
701
+ pruned: number;
702
+ synthesized: number;
703
+ }, {
704
+ errors: number;
705
+ consolidated: number;
706
+ flaggedForReview: number;
707
+ pruned: number;
708
+ synthesized: number;
709
+ }>;
710
+ taskId: z.ZodOptional<z.ZodString>;
711
+ trigger: z.ZodEnum<["agent-idle", "manual", "cli"]>;
712
+ } & {
713
+ status: z.ZodLiteral<"processing">;
714
+ }, "strip", z.ZodTypeAny, {
715
+ status: "processing";
716
+ summary: {
717
+ errors: number;
718
+ consolidated: number;
719
+ flaggedForReview: number;
720
+ pruned: number;
721
+ synthesized: number;
722
+ };
723
+ id: string;
724
+ startedAt: number;
725
+ operations: ({
726
+ type: "CONSOLIDATE";
727
+ reason: string;
728
+ needsReview: boolean;
729
+ action: "MERGE" | "TEMPORAL_UPDATE" | "CROSS_REFERENCE";
730
+ inputFiles: string[];
731
+ outputFile?: string | undefined;
732
+ previousTexts?: Record<string, string> | undefined;
733
+ } | {
734
+ type: "SYNTHESIZE";
735
+ sources: string[];
736
+ confidence: number;
737
+ needsReview: boolean;
738
+ action: "UPDATE" | "CREATE";
739
+ outputFile: string;
740
+ } | {
741
+ type: "PRUNE";
742
+ reason: string;
743
+ file: string;
744
+ needsReview: boolean;
745
+ action: "ARCHIVE" | "KEEP" | "SUGGEST_MERGE";
746
+ mergeTarget?: string | undefined;
747
+ stubPath?: string | undefined;
748
+ })[];
749
+ trigger: "manual" | "agent-idle" | "cli";
750
+ taskId?: string | undefined;
751
+ }, {
752
+ status: "processing";
753
+ summary: {
754
+ errors: number;
755
+ consolidated: number;
756
+ flaggedForReview: number;
757
+ pruned: number;
758
+ synthesized: number;
759
+ };
760
+ id: string;
761
+ startedAt: number;
762
+ operations: ({
763
+ type: "CONSOLIDATE";
764
+ reason: string;
765
+ needsReview: boolean;
766
+ action: "MERGE" | "TEMPORAL_UPDATE" | "CROSS_REFERENCE";
767
+ inputFiles: string[];
768
+ outputFile?: string | undefined;
769
+ previousTexts?: Record<string, string> | undefined;
770
+ } | {
771
+ type: "SYNTHESIZE";
772
+ sources: string[];
773
+ confidence: number;
774
+ needsReview: boolean;
775
+ action: "UPDATE" | "CREATE";
776
+ outputFile: string;
777
+ } | {
778
+ type: "PRUNE";
779
+ reason: string;
780
+ file: string;
781
+ needsReview: boolean;
782
+ action: "ARCHIVE" | "KEEP" | "SUGGEST_MERGE";
783
+ mergeTarget?: string | undefined;
784
+ stubPath?: string | undefined;
785
+ })[];
786
+ trigger: "manual" | "agent-idle" | "cli";
787
+ taskId?: string | undefined;
788
+ }>, z.ZodObject<{
789
+ id: z.ZodString;
790
+ operations: z.ZodArray<z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
791
+ action: z.ZodEnum<["MERGE", "TEMPORAL_UPDATE", "CROSS_REFERENCE"]>;
792
+ inputFiles: z.ZodArray<z.ZodString, "many">;
793
+ needsReview: z.ZodBoolean;
794
+ outputFile: z.ZodOptional<z.ZodString>;
795
+ previousTexts: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
796
+ reason: z.ZodString;
797
+ type: z.ZodLiteral<"CONSOLIDATE">;
798
+ }, "strip", z.ZodTypeAny, {
799
+ type: "CONSOLIDATE";
800
+ reason: string;
801
+ needsReview: boolean;
802
+ action: "MERGE" | "TEMPORAL_UPDATE" | "CROSS_REFERENCE";
803
+ inputFiles: string[];
804
+ outputFile?: string | undefined;
805
+ previousTexts?: Record<string, string> | undefined;
806
+ }, {
807
+ type: "CONSOLIDATE";
808
+ reason: string;
809
+ needsReview: boolean;
810
+ action: "MERGE" | "TEMPORAL_UPDATE" | "CROSS_REFERENCE";
811
+ inputFiles: string[];
812
+ outputFile?: string | undefined;
813
+ previousTexts?: Record<string, string> | undefined;
814
+ }>, z.ZodObject<{
815
+ action: z.ZodEnum<["CREATE", "UPDATE"]>;
816
+ confidence: z.ZodNumber;
817
+ needsReview: z.ZodBoolean;
818
+ outputFile: z.ZodString;
819
+ sources: z.ZodArray<z.ZodString, "many">;
820
+ type: z.ZodLiteral<"SYNTHESIZE">;
821
+ }, "strip", z.ZodTypeAny, {
822
+ type: "SYNTHESIZE";
823
+ sources: string[];
824
+ confidence: number;
825
+ needsReview: boolean;
826
+ action: "UPDATE" | "CREATE";
827
+ outputFile: string;
828
+ }, {
829
+ type: "SYNTHESIZE";
830
+ sources: string[];
831
+ confidence: number;
832
+ needsReview: boolean;
833
+ action: "UPDATE" | "CREATE";
834
+ outputFile: string;
835
+ }>, z.ZodObject<{
836
+ action: z.ZodEnum<["ARCHIVE", "KEEP", "SUGGEST_MERGE"]>;
837
+ file: z.ZodString;
838
+ mergeTarget: z.ZodOptional<z.ZodString>;
839
+ needsReview: z.ZodBoolean;
840
+ reason: z.ZodString;
841
+ stubPath: z.ZodOptional<z.ZodString>;
842
+ type: z.ZodLiteral<"PRUNE">;
843
+ }, "strip", z.ZodTypeAny, {
844
+ type: "PRUNE";
845
+ reason: string;
846
+ file: string;
847
+ needsReview: boolean;
848
+ action: "ARCHIVE" | "KEEP" | "SUGGEST_MERGE";
849
+ mergeTarget?: string | undefined;
850
+ stubPath?: string | undefined;
851
+ }, {
852
+ type: "PRUNE";
853
+ reason: string;
854
+ file: string;
855
+ needsReview: boolean;
856
+ action: "ARCHIVE" | "KEEP" | "SUGGEST_MERGE";
857
+ mergeTarget?: string | undefined;
858
+ stubPath?: string | undefined;
859
+ }>]>, "many">;
860
+ startedAt: z.ZodNumber;
861
+ summary: z.ZodObject<{
862
+ consolidated: z.ZodNumber;
863
+ errors: z.ZodNumber;
864
+ flaggedForReview: z.ZodNumber;
865
+ pruned: z.ZodNumber;
866
+ synthesized: z.ZodNumber;
867
+ }, "strip", z.ZodTypeAny, {
868
+ errors: number;
869
+ consolidated: number;
870
+ flaggedForReview: number;
871
+ pruned: number;
872
+ synthesized: number;
873
+ }, {
874
+ errors: number;
875
+ consolidated: number;
876
+ flaggedForReview: number;
877
+ pruned: number;
878
+ synthesized: number;
879
+ }>;
880
+ taskId: z.ZodOptional<z.ZodString>;
881
+ trigger: z.ZodEnum<["agent-idle", "manual", "cli"]>;
882
+ } & {
883
+ completedAt: z.ZodNumber;
884
+ status: z.ZodLiteral<"undone">;
885
+ undoneAt: z.ZodNumber;
886
+ }, "strip", z.ZodTypeAny, {
887
+ status: "undone";
888
+ summary: {
889
+ errors: number;
890
+ consolidated: number;
891
+ flaggedForReview: number;
892
+ pruned: number;
893
+ synthesized: number;
894
+ };
895
+ id: string;
896
+ startedAt: number;
897
+ completedAt: number;
898
+ operations: ({
899
+ type: "CONSOLIDATE";
900
+ reason: string;
901
+ needsReview: boolean;
902
+ action: "MERGE" | "TEMPORAL_UPDATE" | "CROSS_REFERENCE";
903
+ inputFiles: string[];
904
+ outputFile?: string | undefined;
905
+ previousTexts?: Record<string, string> | undefined;
906
+ } | {
907
+ type: "SYNTHESIZE";
908
+ sources: string[];
909
+ confidence: number;
910
+ needsReview: boolean;
911
+ action: "UPDATE" | "CREATE";
912
+ outputFile: string;
913
+ } | {
914
+ type: "PRUNE";
915
+ reason: string;
916
+ file: string;
917
+ needsReview: boolean;
918
+ action: "ARCHIVE" | "KEEP" | "SUGGEST_MERGE";
919
+ mergeTarget?: string | undefined;
920
+ stubPath?: string | undefined;
921
+ })[];
922
+ trigger: "manual" | "agent-idle" | "cli";
923
+ undoneAt: number;
924
+ taskId?: string | undefined;
925
+ }, {
926
+ status: "undone";
927
+ summary: {
928
+ errors: number;
929
+ consolidated: number;
930
+ flaggedForReview: number;
931
+ pruned: number;
932
+ synthesized: number;
933
+ };
934
+ id: string;
935
+ startedAt: number;
936
+ completedAt: number;
937
+ operations: ({
938
+ type: "CONSOLIDATE";
939
+ reason: string;
940
+ needsReview: boolean;
941
+ action: "MERGE" | "TEMPORAL_UPDATE" | "CROSS_REFERENCE";
942
+ inputFiles: string[];
943
+ outputFile?: string | undefined;
944
+ previousTexts?: Record<string, string> | undefined;
945
+ } | {
946
+ type: "SYNTHESIZE";
947
+ sources: string[];
948
+ confidence: number;
949
+ needsReview: boolean;
950
+ action: "UPDATE" | "CREATE";
951
+ outputFile: string;
952
+ } | {
953
+ type: "PRUNE";
954
+ reason: string;
955
+ file: string;
956
+ needsReview: boolean;
957
+ action: "ARCHIVE" | "KEEP" | "SUGGEST_MERGE";
958
+ mergeTarget?: string | undefined;
959
+ stubPath?: string | undefined;
960
+ })[];
961
+ trigger: "manual" | "agent-idle" | "cli";
962
+ undoneAt: number;
963
+ taskId?: string | undefined;
964
+ }>]>;
965
+ export type DreamLogEntry = z.infer<typeof DreamLogEntrySchema>;
966
+ export type DreamLogStatus = DreamLogEntry['status'];