@denizokcu/haze 1.1.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/CHANGELOG.md +49 -1
  2. package/README.md +17 -10
  3. package/SECURITY.md +1 -1
  4. package/dist/buildInfo.json +3 -3
  5. package/dist/cli/chat/busyIndicator.d.ts +11 -0
  6. package/dist/cli/chat/busyIndicator.js +34 -0
  7. package/dist/cli/chat/chatMetrics.d.ts +0 -1
  8. package/dist/cli/chat/chatMetrics.js +1 -7
  9. package/dist/cli/chat/followUpQueue.d.ts +11 -0
  10. package/dist/cli/chat/followUpQueue.js +38 -0
  11. package/dist/cli/chat/messages.d.ts +0 -22
  12. package/dist/cli/chat/messages.js +40 -85
  13. package/dist/cli/chat/sessionLifecycle.d.ts +3 -1
  14. package/dist/cli/chat/sessionLifecycle.js +8 -1
  15. package/dist/cli/chat/sessionRecorder.d.ts +9 -0
  16. package/dist/cli/chat/sessionRecorder.js +12 -0
  17. package/dist/cli/chat/startupSequence.d.ts +29 -0
  18. package/dist/cli/chat/startupSequence.js +59 -0
  19. package/dist/cli/chat/transcriptPartition.d.ts +23 -0
  20. package/dist/cli/chat/transcriptPartition.js +78 -0
  21. package/dist/cli/chat/wizard/fieldTransitions.d.ts +38 -0
  22. package/dist/cli/chat/wizard/fieldTransitions.js +43 -0
  23. package/dist/cli/chat/wizard/lspHandlers.d.ts +4 -0
  24. package/dist/cli/chat/wizard/lspHandlers.js +85 -0
  25. package/dist/cli/chat/wizard/mcpHandlers.d.ts +8 -0
  26. package/dist/cli/chat/wizard/mcpHandlers.js +82 -0
  27. package/dist/cli/chat/wizard/providerHandlers.d.ts +12 -0
  28. package/dist/cli/chat/wizard/providerHandlers.js +420 -0
  29. package/dist/cli/chat/wizard/sessionThemeHandlers.d.ts +4 -0
  30. package/dist/cli/chat/wizard/sessionThemeHandlers.js +48 -0
  31. package/dist/cli/chat/wizard/skillsHandlers.d.ts +4 -0
  32. package/dist/cli/chat/wizard/skillsHandlers.js +125 -0
  33. package/dist/cli/chat/wizard/types.d.ts +63 -0
  34. package/dist/cli/chat/wizard/types.js +24 -0
  35. package/dist/cli/chat/wizard/uiState.d.ts +56 -0
  36. package/dist/cli/chat/wizard/uiState.js +15 -0
  37. package/dist/cli/chat/wizardDispatch.d.ts +11 -113
  38. package/dist/cli/chat/wizardDispatch.js +41 -815
  39. package/dist/cli/commands/chat.js +69 -110
  40. package/dist/cli/commands/formatters.d.ts +0 -3
  41. package/dist/cli/commands/formatters.js +0 -29
  42. package/dist/cli/commands/runCommand.d.ts +2 -0
  43. package/dist/cli/commands/runCommand.js +73 -4
  44. package/dist/cli/commands/streaming/agentAttempt.d.ts +11 -1
  45. package/dist/cli/commands/streaming/agentAttempt.js +9 -5
  46. package/dist/cli/commands/streaming/assistantSegments.d.ts +19 -0
  47. package/dist/cli/commands/streaming/assistantSegments.js +48 -0
  48. package/dist/cli/commands/streaming/attemptOutcome.d.ts +25 -5
  49. package/dist/cli/commands/streaming/attemptOutcome.js +69 -16
  50. package/dist/cli/commands/streaming/attemptSetup.d.ts +10 -3
  51. package/dist/cli/commands/streaming/attemptSetup.js +30 -13
  52. package/dist/cli/commands/streaming/goalCheckpoint.d.ts +69 -8
  53. package/dist/cli/commands/streaming/goalCheckpoint.js +36 -1
  54. package/dist/cli/commands/streaming/goalSupervisor.d.ts +18 -3
  55. package/dist/cli/commands/streaming/goalSupervisor.js +71 -12
  56. package/dist/cli/commands/streaming/prepareStep.d.ts +40 -0
  57. package/dist/cli/commands/streaming/prepareStep.js +116 -0
  58. package/dist/cli/commands/streaming/recoverySlices.d.ts +15 -0
  59. package/dist/cli/commands/streaming/recoverySlices.js +29 -0
  60. package/dist/cli/commands/streaming/stallRecovery.d.ts +0 -1
  61. package/dist/cli/commands/streaming/stallRecovery.js +2 -6
  62. package/dist/cli/commands/streaming/streamLoop.d.ts +31 -4
  63. package/dist/cli/commands/streaming/streamLoop.js +283 -268
  64. package/dist/cli/commands/streaming/toolGroupRenderer.js +2 -1
  65. package/dist/cli/commands/streaming/toolPartHandlers.d.ts +19 -0
  66. package/dist/cli/commands/streaming/toolPartHandlers.js +108 -0
  67. package/dist/cli/commands/streaming/turnRuntime.d.ts +1 -1
  68. package/dist/cli/commands/streaming/turnRuntime.js +3 -2
  69. package/dist/cli/commands/streaming.d.ts +12 -1
  70. package/dist/cli/commands/streaming.js +20 -25
  71. package/dist/cli/index.js +6 -3
  72. package/dist/config/modelCatalog.d.ts +32 -0
  73. package/dist/config/modelCatalog.js +84 -0
  74. package/dist/config/providerPresets.d.ts +7 -0
  75. package/dist/config/providerPresets.js +195 -391
  76. package/dist/config/settings.d.ts +10 -2
  77. package/dist/config/settings.js +3 -0
  78. package/dist/core/agent/budgets.d.ts +10 -0
  79. package/dist/core/agent/budgets.js +10 -0
  80. package/dist/core/agent/compaction.d.ts +42 -3
  81. package/dist/core/agent/compaction.js +53 -5
  82. package/dist/core/agent/completionController.d.ts +16 -7
  83. package/dist/core/agent/completionController.js +13 -6
  84. package/dist/core/agent/contextBudget.d.ts +56 -0
  85. package/dist/core/agent/contextBudget.js +53 -0
  86. package/dist/core/agent/errors.js +2 -2
  87. package/dist/core/agent/events.d.ts +36 -1
  88. package/dist/core/agent/goalPolicy.d.ts +4 -3
  89. package/dist/core/agent/goalPolicy.js +9 -4
  90. package/dist/core/agent/overflow.d.ts +45 -0
  91. package/dist/core/agent/overflow.js +91 -0
  92. package/dist/core/agent/requestAssembly.d.ts +7 -0
  93. package/dist/core/agent/requestAssembly.js +15 -7
  94. package/dist/core/agent/workState.d.ts +25 -15
  95. package/dist/core/agent/workState.js +84 -44
  96. package/dist/core/safety/shellClassifier.d.ts +16 -0
  97. package/dist/core/safety/shellClassifier.js +31 -0
  98. package/dist/core/session/sessionSlimming.js +8 -0
  99. package/dist/core/session/sessionStore.d.ts +71 -1
  100. package/dist/core/session/sessionStore.js +121 -6
  101. package/dist/core/validation/outputParser.d.ts +1 -1
  102. package/dist/core/validation/outputParser.js +6 -1
  103. package/dist/llm/client.d.ts +2 -2
  104. package/dist/llm/client.js +14 -6
  105. package/dist/llm/hazeTools.d.ts +64 -208
  106. package/dist/llm/tools/shellTool.js +27 -8
  107. package/dist/llm/tools/taskTool.d.ts +64 -208
  108. package/dist/llm/tools/taskTool.js +22 -10
  109. package/dist/ui/components/TextInput.d.ts +18 -1
  110. package/dist/ui/components/TextInput.js +50 -73
  111. package/dist/ui/components/useInputSuggestions.d.ts +27 -0
  112. package/dist/ui/components/useInputSuggestions.js +98 -0
  113. package/dist/ui/theme.d.ts +8 -8
  114. package/dist/ui/theme.js +11 -12
  115. package/dist/ui/themes/registry.d.ts +5 -0
  116. package/dist/ui/themes/registry.js +436 -0
  117. package/dist/utils/format.d.ts +10 -0
  118. package/dist/utils/format.js +45 -0
  119. package/package.json +16 -15
  120. package/dist/ui/themes/af-magic.d.ts +0 -7
  121. package/dist/ui/themes/af-magic.js +0 -25
  122. package/dist/ui/themes/agnoster.d.ts +0 -10
  123. package/dist/ui/themes/agnoster.js +0 -40
  124. package/dist/ui/themes/bira.d.ts +0 -10
  125. package/dist/ui/themes/bira.js +0 -28
  126. package/dist/ui/themes/bureau.d.ts +0 -10
  127. package/dist/ui/themes/bureau.js +0 -28
  128. package/dist/ui/themes/clean.d.ts +0 -9
  129. package/dist/ui/themes/clean.js +0 -27
  130. package/dist/ui/themes/cloud.d.ts +0 -6
  131. package/dist/ui/themes/cloud.js +0 -24
  132. package/dist/ui/themes/dst.d.ts +0 -10
  133. package/dist/ui/themes/dst.js +0 -28
  134. package/dist/ui/themes/fishy.d.ts +0 -7
  135. package/dist/ui/themes/fishy.js +0 -25
  136. package/dist/ui/themes/index.d.ts +0 -8
  137. package/dist/ui/themes/index.js +0 -36
  138. package/dist/ui/themes/light.d.ts +0 -3
  139. package/dist/ui/themes/light.js +0 -21
  140. package/dist/ui/themes/purple.d.ts +0 -7
  141. package/dist/ui/themes/purple.js +0 -26
  142. package/dist/ui/themes/robbyrussell.d.ts +0 -8
  143. package/dist/ui/themes/robbyrussell.js +0 -26
  144. package/dist/ui/themes/solarized-dark.d.ts +0 -16
  145. package/dist/ui/themes/solarized-dark.js +0 -44
  146. package/dist/ui/themes/solarized-light.d.ts +0 -12
  147. package/dist/ui/themes/solarized-light.js +0 -40
  148. package/dist/ui/themes/steeef.d.ts +0 -11
  149. package/dist/ui/themes/steeef.js +0 -29
@@ -38,24 +38,15 @@ export declare const writeTasksTool: ({
38
38
  output: NoInfer<{
39
39
  ok: boolean;
40
40
  error: string;
41
- taskCount?: undefined;
42
- summary?: undefined;
43
- counts?: undefined;
44
41
  } | {
45
- ok: boolean;
46
- taskCount: number;
47
42
  summary: string;
48
- error?: undefined;
49
- counts?: undefined;
50
- } | {
51
- ok: boolean;
52
- taskCount: number;
53
- counts: {
43
+ counts?: {
54
44
  pending: number;
55
45
  in_progress: number;
56
46
  completed: number;
57
- };
58
- summary: string;
47
+ } | undefined;
48
+ ok: boolean;
49
+ taskCount: number;
59
50
  error?: undefined;
60
51
  }>;
61
52
  }) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
@@ -63,24 +54,15 @@ export declare const writeTasksTool: ({
63
54
  outputSchema?: import("ai").FlexibleSchema<{
64
55
  ok: boolean;
65
56
  error: string;
66
- taskCount?: undefined;
67
- summary?: undefined;
68
- counts?: undefined;
69
57
  } | {
70
- ok: boolean;
71
- taskCount: number;
72
58
  summary: string;
73
- error?: undefined;
74
- counts?: undefined;
75
- } | {
76
- ok: boolean;
77
- taskCount: number;
78
- counts: {
59
+ counts?: {
79
60
  pending: number;
80
61
  in_progress: number;
81
62
  completed: number;
82
- };
83
- summary: string;
63
+ } | undefined;
64
+ ok: boolean;
65
+ taskCount: number;
84
66
  error?: undefined;
85
67
  }> | undefined;
86
68
  execute: import("ai").ToolExecuteFunction<{
@@ -91,24 +73,15 @@ export declare const writeTasksTool: ({
91
73
  }, {
92
74
  ok: boolean;
93
75
  error: string;
94
- taskCount?: undefined;
95
- summary?: undefined;
96
- counts?: undefined;
97
76
  } | {
98
- ok: boolean;
99
- taskCount: number;
100
77
  summary: string;
101
- error?: undefined;
102
- counts?: undefined;
103
- } | {
104
- ok: boolean;
105
- taskCount: number;
106
- counts: {
78
+ counts?: {
107
79
  pending: number;
108
80
  in_progress: number;
109
81
  completed: number;
110
- };
111
- summary: string;
82
+ } | undefined;
83
+ ok: boolean;
84
+ taskCount: number;
112
85
  error?: undefined;
113
86
  }, NoInfer<import("@ai-sdk/provider-utils").Context>>;
114
87
  } & {
@@ -140,24 +113,15 @@ export declare const writeTasksTool: ({
140
113
  }, {
141
114
  ok: boolean;
142
115
  error: string;
143
- taskCount?: undefined;
144
- summary?: undefined;
145
- counts?: undefined;
146
116
  } | {
147
- ok: boolean;
148
- taskCount: number;
149
117
  summary: string;
150
- error?: undefined;
151
- counts?: undefined;
152
- } | {
153
- ok: boolean;
154
- taskCount: number;
155
- counts: {
118
+ counts?: {
156
119
  pending: number;
157
120
  in_progress: number;
158
121
  completed: number;
159
- };
160
- summary: string;
122
+ } | undefined;
123
+ ok: boolean;
124
+ taskCount: number;
161
125
  error?: undefined;
162
126
  }, NoInfer<import("@ai-sdk/provider-utils").Context>>;
163
127
  }) | ({
@@ -200,24 +164,15 @@ export declare const writeTasksTool: ({
200
164
  output: NoInfer<{
201
165
  ok: boolean;
202
166
  error: string;
203
- taskCount?: undefined;
204
- summary?: undefined;
205
- counts?: undefined;
206
167
  } | {
207
- ok: boolean;
208
- taskCount: number;
209
168
  summary: string;
210
- error?: undefined;
211
- counts?: undefined;
212
- } | {
213
- ok: boolean;
214
- taskCount: number;
215
- counts: {
169
+ counts?: {
216
170
  pending: number;
217
171
  in_progress: number;
218
172
  completed: number;
219
- };
220
- summary: string;
173
+ } | undefined;
174
+ ok: boolean;
175
+ taskCount: number;
221
176
  error?: undefined;
222
177
  }>;
223
178
  }) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
@@ -225,24 +180,15 @@ export declare const writeTasksTool: ({
225
180
  outputSchema?: import("ai").FlexibleSchema<{
226
181
  ok: boolean;
227
182
  error: string;
228
- taskCount?: undefined;
229
- summary?: undefined;
230
- counts?: undefined;
231
183
  } | {
232
- ok: boolean;
233
- taskCount: number;
234
184
  summary: string;
235
- error?: undefined;
236
- counts?: undefined;
237
- } | {
238
- ok: boolean;
239
- taskCount: number;
240
- counts: {
185
+ counts?: {
241
186
  pending: number;
242
187
  in_progress: number;
243
188
  completed: number;
244
- };
245
- summary: string;
189
+ } | undefined;
190
+ ok: boolean;
191
+ taskCount: number;
246
192
  error?: undefined;
247
193
  }> | undefined;
248
194
  execute: import("ai").ToolExecuteFunction<{
@@ -253,24 +199,15 @@ export declare const writeTasksTool: ({
253
199
  }, {
254
200
  ok: boolean;
255
201
  error: string;
256
- taskCount?: undefined;
257
- summary?: undefined;
258
- counts?: undefined;
259
202
  } | {
260
- ok: boolean;
261
- taskCount: number;
262
203
  summary: string;
263
- error?: undefined;
264
- counts?: undefined;
265
- } | {
266
- ok: boolean;
267
- taskCount: number;
268
- counts: {
204
+ counts?: {
269
205
  pending: number;
270
206
  in_progress: number;
271
207
  completed: number;
272
- };
273
- summary: string;
208
+ } | undefined;
209
+ ok: boolean;
210
+ taskCount: number;
274
211
  error?: undefined;
275
212
  }, NoInfer<import("@ai-sdk/provider-utils").Context>>;
276
213
  } & {
@@ -302,24 +239,15 @@ export declare const writeTasksTool: ({
302
239
  }, {
303
240
  ok: boolean;
304
241
  error: string;
305
- taskCount?: undefined;
306
- summary?: undefined;
307
- counts?: undefined;
308
242
  } | {
309
- ok: boolean;
310
- taskCount: number;
311
243
  summary: string;
312
- error?: undefined;
313
- counts?: undefined;
314
- } | {
315
- ok: boolean;
316
- taskCount: number;
317
- counts: {
244
+ counts?: {
318
245
  pending: number;
319
246
  in_progress: number;
320
247
  completed: number;
321
- };
322
- summary: string;
248
+ } | undefined;
249
+ ok: boolean;
250
+ taskCount: number;
323
251
  error?: undefined;
324
252
  }, NoInfer<import("@ai-sdk/provider-utils").Context>>;
325
253
  }) | ({
@@ -362,24 +290,15 @@ export declare const writeTasksTool: ({
362
290
  output: NoInfer<{
363
291
  ok: boolean;
364
292
  error: string;
365
- taskCount?: undefined;
366
- summary?: undefined;
367
- counts?: undefined;
368
293
  } | {
369
- ok: boolean;
370
- taskCount: number;
371
294
  summary: string;
372
- error?: undefined;
373
- counts?: undefined;
374
- } | {
375
- ok: boolean;
376
- taskCount: number;
377
- counts: {
295
+ counts?: {
378
296
  pending: number;
379
297
  in_progress: number;
380
298
  completed: number;
381
- };
382
- summary: string;
299
+ } | undefined;
300
+ ok: boolean;
301
+ taskCount: number;
383
302
  error?: undefined;
384
303
  }>;
385
304
  }) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
@@ -387,24 +306,15 @@ export declare const writeTasksTool: ({
387
306
  outputSchema?: import("ai").FlexibleSchema<{
388
307
  ok: boolean;
389
308
  error: string;
390
- taskCount?: undefined;
391
- summary?: undefined;
392
- counts?: undefined;
393
309
  } | {
394
- ok: boolean;
395
- taskCount: number;
396
310
  summary: string;
397
- error?: undefined;
398
- counts?: undefined;
399
- } | {
400
- ok: boolean;
401
- taskCount: number;
402
- counts: {
311
+ counts?: {
403
312
  pending: number;
404
313
  in_progress: number;
405
314
  completed: number;
406
- };
407
- summary: string;
315
+ } | undefined;
316
+ ok: boolean;
317
+ taskCount: number;
408
318
  error?: undefined;
409
319
  }> | undefined;
410
320
  execute: import("ai").ToolExecuteFunction<{
@@ -415,24 +325,15 @@ export declare const writeTasksTool: ({
415
325
  }, {
416
326
  ok: boolean;
417
327
  error: string;
418
- taskCount?: undefined;
419
- summary?: undefined;
420
- counts?: undefined;
421
328
  } | {
422
- ok: boolean;
423
- taskCount: number;
424
329
  summary: string;
425
- error?: undefined;
426
- counts?: undefined;
427
- } | {
428
- ok: boolean;
429
- taskCount: number;
430
- counts: {
330
+ counts?: {
431
331
  pending: number;
432
332
  in_progress: number;
433
333
  completed: number;
434
- };
435
- summary: string;
334
+ } | undefined;
335
+ ok: boolean;
336
+ taskCount: number;
436
337
  error?: undefined;
437
338
  }, NoInfer<import("@ai-sdk/provider-utils").Context>>;
438
339
  } & {
@@ -454,24 +355,15 @@ export declare const writeTasksTool: ({
454
355
  }, {
455
356
  ok: boolean;
456
357
  error: string;
457
- taskCount?: undefined;
458
- summary?: undefined;
459
- counts?: undefined;
460
358
  } | {
461
- ok: boolean;
462
- taskCount: number;
463
359
  summary: string;
464
- error?: undefined;
465
- counts?: undefined;
466
- } | {
467
- ok: boolean;
468
- taskCount: number;
469
- counts: {
360
+ counts?: {
470
361
  pending: number;
471
362
  in_progress: number;
472
363
  completed: number;
473
- };
474
- summary: string;
364
+ } | undefined;
365
+ ok: boolean;
366
+ taskCount: number;
475
367
  error?: undefined;
476
368
  }, NoInfer<import("@ai-sdk/provider-utils").Context>>;
477
369
  }) | ({
@@ -514,24 +406,15 @@ export declare const writeTasksTool: ({
514
406
  output: NoInfer<{
515
407
  ok: boolean;
516
408
  error: string;
517
- taskCount?: undefined;
518
- summary?: undefined;
519
- counts?: undefined;
520
409
  } | {
521
- ok: boolean;
522
- taskCount: number;
523
410
  summary: string;
524
- error?: undefined;
525
- counts?: undefined;
526
- } | {
527
- ok: boolean;
528
- taskCount: number;
529
- counts: {
411
+ counts?: {
530
412
  pending: number;
531
413
  in_progress: number;
532
414
  completed: number;
533
- };
534
- summary: string;
415
+ } | undefined;
416
+ ok: boolean;
417
+ taskCount: number;
535
418
  error?: undefined;
536
419
  }>;
537
420
  }) => import("@ai-sdk/provider-utils").ToolResultOutput | PromiseLike<import("@ai-sdk/provider-utils").ToolResultOutput>) | undefined;
@@ -539,24 +422,15 @@ export declare const writeTasksTool: ({
539
422
  outputSchema?: import("ai").FlexibleSchema<{
540
423
  ok: boolean;
541
424
  error: string;
542
- taskCount?: undefined;
543
- summary?: undefined;
544
- counts?: undefined;
545
425
  } | {
546
- ok: boolean;
547
- taskCount: number;
548
426
  summary: string;
549
- error?: undefined;
550
- counts?: undefined;
551
- } | {
552
- ok: boolean;
553
- taskCount: number;
554
- counts: {
427
+ counts?: {
555
428
  pending: number;
556
429
  in_progress: number;
557
430
  completed: number;
558
- };
559
- summary: string;
431
+ } | undefined;
432
+ ok: boolean;
433
+ taskCount: number;
560
434
  error?: undefined;
561
435
  }> | undefined;
562
436
  execute: import("ai").ToolExecuteFunction<{
@@ -567,24 +441,15 @@ export declare const writeTasksTool: ({
567
441
  }, {
568
442
  ok: boolean;
569
443
  error: string;
570
- taskCount?: undefined;
571
- summary?: undefined;
572
- counts?: undefined;
573
444
  } | {
574
- ok: boolean;
575
- taskCount: number;
576
445
  summary: string;
577
- error?: undefined;
578
- counts?: undefined;
579
- } | {
580
- ok: boolean;
581
- taskCount: number;
582
- counts: {
446
+ counts?: {
583
447
  pending: number;
584
448
  in_progress: number;
585
449
  completed: number;
586
- };
587
- summary: string;
450
+ } | undefined;
451
+ ok: boolean;
452
+ taskCount: number;
588
453
  error?: undefined;
589
454
  }, NoInfer<import("@ai-sdk/provider-utils").Context>>;
590
455
  } & {
@@ -606,24 +471,15 @@ export declare const writeTasksTool: ({
606
471
  }, {
607
472
  ok: boolean;
608
473
  error: string;
609
- taskCount?: undefined;
610
- summary?: undefined;
611
- counts?: undefined;
612
474
  } | {
613
- ok: boolean;
614
- taskCount: number;
615
475
  summary: string;
616
- error?: undefined;
617
- counts?: undefined;
618
- } | {
619
- ok: boolean;
620
- taskCount: number;
621
- counts: {
476
+ counts?: {
622
477
  pending: number;
623
478
  in_progress: number;
624
479
  completed: number;
625
- };
626
- summary: string;
480
+ } | undefined;
481
+ ok: boolean;
482
+ taskCount: number;
627
483
  error?: undefined;
628
484
  }, NoInfer<import("@ai-sdk/provider-utils").Context>>;
629
485
  });
@@ -1,11 +1,21 @@
1
1
  import { tool } from 'ai';
2
2
  import { z } from 'zod';
3
3
  import { generateTaskId, saveTasks } from '../../core/tasks/taskStorage.js';
4
+ /**
5
+ * Size policy: task titles are never Zod-capped. A schema `.max()` turns an
6
+ * over-long string into a hard `AI_TypeValidationError` that rejects the whole
7
+ * call, so `execute` truncates titles instead.
8
+ */
9
+ const TITLE_CHARS = 200;
10
+ function truncate(value, max) {
11
+ const trimmed = value.trim();
12
+ return trimmed.length <= max ? trimmed : trimmed.slice(0, max);
13
+ }
4
14
  export const writeTasksTool = tool({
5
- description: 'Replace the task list for substantial work. Update at meaningful phase changes, blockers, and completion; pass the complete list.',
15
+ description: 'Replace the task list for substantial work. Update tasks at meaningful phase changes, blockers, and completion; pass the complete list.',
6
16
  inputSchema: z.object({
7
17
  tasks: z.array(z.object({
8
- title: z.string().max(200).describe('Short task description'),
18
+ title: z.string().min(1).describe('Short task description'),
9
19
  status: z.enum(['pending', 'in_progress', 'completed']).optional().describe('Task status (defaults to pending)'),
10
20
  })).describe('Complete task list. Replaces any existing tasks. Pass an empty array to clear.'),
11
21
  }),
@@ -14,28 +24,30 @@ export const writeTasksTool = tool({
14
24
  return { ok: false, error: 'Tasks must be an array. Pass an empty array to clear the list.' };
15
25
  }
16
26
  for (let i = 0; i < inputTasks.length; i++) {
17
- const title = inputTasks[i]?.title?.trim();
18
- if (!title)
27
+ if (!inputTasks[i]?.title?.trim())
19
28
  return { ok: false, error: `Task ${i + 1}: title cannot be empty.` };
20
- if (title.length > 200)
21
- return { ok: false, error: `Task ${i + 1}: title is too long (max 200 characters).` };
22
29
  }
23
30
  const now = new Date().toISOString();
24
31
  const tasks = inputTasks.map((input) => ({
25
32
  id: generateTaskId(),
26
- title: input.title.trim(),
33
+ title: truncate(input.title, TITLE_CHARS),
27
34
  status: input.status ?? 'pending',
28
35
  createdAt: now,
29
36
  updatedAt: now,
30
37
  }));
31
38
  await saveTasks(tasks);
32
- if (tasks.length === 0)
33
- return { ok: true, taskCount: 0, summary: 'Task list cleared.' };
34
39
  const counts = {
35
40
  pending: tasks.filter(t => t.status === 'pending').length,
36
41
  in_progress: tasks.filter(t => t.status === 'in_progress').length,
37
42
  completed: tasks.filter(t => t.status === 'completed').length,
38
43
  };
39
- return { ok: true, taskCount: tasks.length, counts, summary: `Tasks: ${counts.pending} pending, ${counts.in_progress} in progress, ${counts.completed} completed.` };
44
+ return {
45
+ ok: true,
46
+ taskCount: tasks.length,
47
+ ...(tasks.length > 0 ? { counts } : {}),
48
+ summary: tasks.length === 0
49
+ ? 'Task list cleared.'
50
+ : `Tasks: ${counts.pending} pending, ${counts.in_progress} in progress, ${counts.completed} completed.`,
51
+ };
40
52
  },
41
53
  });
@@ -3,8 +3,18 @@ type TextInputKey = {
3
3
  return?: boolean;
4
4
  shift?: boolean;
5
5
  ctrl?: boolean;
6
+ meta?: boolean;
6
7
  };
7
8
  export declare function shouldInsertNewline(input: string, key: TextInputKey): boolean;
9
+ export declare function isKittyQueryResponseInput(input: string): boolean;
10
+ /**
11
+ * Ctrl+C terminate check. Legacy terminals deliver the raw \x03 byte (Ink
12
+ * parses it to `c` + ctrl); with the kitty keyboard protocol enabled the
13
+ * terminal reports `CSI 99;5u`, which parses to the same `c` + ctrl shape.
14
+ * Ink 7.1.1's built-in exit-on-CtrlC only recognizes the raw \x03 event, so
15
+ * haze owns the interrupt explicitly (render runs with exitOnCtrlC: false).
16
+ */
17
+ export declare function isInterruptInput(input: string, key: TextInputKey): boolean;
8
18
  export type TextInputSuggestion = {
9
19
  value: string;
10
20
  description?: string;
@@ -12,7 +22,7 @@ export type TextInputSuggestion = {
12
22
  };
13
23
  /** Cursor-aware path completer for `@token` mentions; receives the token verbatim. */
14
24
  export type MentionSuggestionsProvider = (token: string) => Promise<TextInputSuggestion[]> | TextInputSuggestion[];
15
- export declare function TextInput({ placeholder, disabled, mask, historyItems, recordHistory, suggestions, suggestionMode, submitOnEmpty, width, getMentionSuggestions, onHistoryAdd, onCancel, onEscape, onToggleTasks, onResumeKey, onSubmit }: {
25
+ export declare function TextInput({ placeholder, disabled, mask, historyItems, recordHistory, suggestions, suggestionMode, submitOnEmpty, width, getMentionSuggestions, onHistoryAdd, onCancel, onEscape, onToggleTasks, onResumeKey, onInterrupt, onSubmit }: {
16
26
  placeholder?: string;
17
27
  disabled?: boolean;
18
28
  mask?: boolean;
@@ -34,6 +44,13 @@ export declare function TextInput({ placeholder, disabled, mask, historyItems, r
34
44
  * matching hint line, so ordinary typing is unaffected.
35
45
  */
36
46
  onResumeKey?: () => void;
47
+ /**
48
+ * Ctrl+C terminate: called for the parsed `c`+ctrl shape shared by the
49
+ * legacy \x03 byte and the kitty-protocol `CSI 99;5u` report. Runs even
50
+ * while the input is disabled (streaming), matching the terminal-wide
51
+ * terminate convention Ink's global handler used to provide.
52
+ */
53
+ onInterrupt?: () => void;
37
54
  onSubmit: (value: string) => void;
38
55
  }): React.JSX.Element;
39
56
  export {};