@denizokcu/haze 1.0.0 → 1.1.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 (116) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +17 -8
  3. package/SECURITY.md +3 -1
  4. package/dist/buildInfo.json +3 -3
  5. package/dist/cli/chat/TaskBar.js +1 -1
  6. package/dist/cli/chat/busyIndicator.d.ts +11 -0
  7. package/dist/cli/chat/busyIndicator.js +34 -0
  8. package/dist/cli/chat/chatMetrics.d.ts +0 -1
  9. package/dist/cli/chat/chatMetrics.js +1 -7
  10. package/dist/cli/chat/followUpQueue.d.ts +11 -0
  11. package/dist/cli/chat/followUpQueue.js +38 -0
  12. package/dist/cli/chat/inputSuggestions.js +1 -0
  13. package/dist/cli/chat/messages.d.ts +0 -22
  14. package/dist/cli/chat/messages.js +42 -87
  15. package/dist/cli/chat/sessionLifecycle.d.ts +3 -1
  16. package/dist/cli/chat/sessionLifecycle.js +6 -1
  17. package/dist/cli/chat/sessionRecorder.d.ts +2 -0
  18. package/dist/cli/chat/sessionRecorder.js +6 -0
  19. package/dist/cli/chat/startupSequence.d.ts +29 -0
  20. package/dist/cli/chat/startupSequence.js +59 -0
  21. package/dist/cli/chat/transcriptPartition.d.ts +23 -0
  22. package/dist/cli/chat/transcriptPartition.js +78 -0
  23. package/dist/cli/chat/wizard/fieldTransitions.d.ts +38 -0
  24. package/dist/cli/chat/wizard/fieldTransitions.js +43 -0
  25. package/dist/cli/chat/wizard/lspHandlers.d.ts +4 -0
  26. package/dist/cli/chat/wizard/lspHandlers.js +85 -0
  27. package/dist/cli/chat/wizard/mcpHandlers.d.ts +8 -0
  28. package/dist/cli/chat/wizard/mcpHandlers.js +82 -0
  29. package/dist/cli/chat/wizard/providerHandlers.d.ts +12 -0
  30. package/dist/cli/chat/wizard/providerHandlers.js +420 -0
  31. package/dist/cli/chat/wizard/sessionThemeHandlers.d.ts +4 -0
  32. package/dist/cli/chat/wizard/sessionThemeHandlers.js +48 -0
  33. package/dist/cli/chat/wizard/skillsHandlers.d.ts +4 -0
  34. package/dist/cli/chat/wizard/skillsHandlers.js +125 -0
  35. package/dist/cli/chat/wizard/types.d.ts +63 -0
  36. package/dist/cli/chat/wizard/types.js +24 -0
  37. package/dist/cli/chat/wizard/uiState.d.ts +56 -0
  38. package/dist/cli/chat/wizard/uiState.js +15 -0
  39. package/dist/cli/chat/wizardDispatch.d.ts +11 -113
  40. package/dist/cli/chat/wizardDispatch.js +41 -805
  41. package/dist/cli/commands/chat.js +89 -110
  42. package/dist/cli/commands/commandHelp.js +2 -0
  43. package/dist/cli/commands/commands.js +2 -0
  44. package/dist/cli/commands/formatters.d.ts +0 -3
  45. package/dist/cli/commands/formatters.js +6 -29
  46. package/dist/cli/commands/runCommand.d.ts +2 -0
  47. package/dist/cli/commands/runCommand.js +67 -4
  48. package/dist/cli/commands/settingsSummary.js +2 -0
  49. package/dist/cli/commands/streaming/assistantSegments.d.ts +19 -0
  50. package/dist/cli/commands/streaming/assistantSegments.js +48 -0
  51. package/dist/cli/commands/streaming/attemptOutcome.d.ts +2 -2
  52. package/dist/cli/commands/streaming/attemptOutcome.js +17 -7
  53. package/dist/cli/commands/streaming/goalCheckpoint.d.ts +69 -8
  54. package/dist/cli/commands/streaming/goalCheckpoint.js +36 -1
  55. package/dist/cli/commands/streaming/goalSupervisor.d.ts +17 -2
  56. package/dist/cli/commands/streaming/goalSupervisor.js +62 -12
  57. package/dist/cli/commands/streaming/prepareStep.d.ts +35 -0
  58. package/dist/cli/commands/streaming/prepareStep.js +100 -0
  59. package/dist/cli/commands/streaming/recoverySlices.d.ts +15 -0
  60. package/dist/cli/commands/streaming/recoverySlices.js +29 -0
  61. package/dist/cli/commands/streaming/stallRecovery.d.ts +0 -1
  62. package/dist/cli/commands/streaming/stallRecovery.js +0 -4
  63. package/dist/cli/commands/streaming/streamLoop.js +9 -230
  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 +95 -0
  67. package/dist/cli/commands/streaming.d.ts +4 -1
  68. package/dist/cli/commands/streaming.js +6 -21
  69. package/dist/cli/commands/themesCommand.d.ts +17 -0
  70. package/dist/cli/commands/themesCommand.js +24 -0
  71. package/dist/cli/commands/wizardFlow.d.ts +7 -0
  72. package/dist/cli/commands/wizardFlow.js +20 -0
  73. package/dist/cli/index.js +3 -1
  74. package/dist/config/providerPresets.d.ts +7 -0
  75. package/dist/config/providerPresets.js +195 -391
  76. package/dist/config/settings.d.ts +2 -0
  77. package/dist/config/settings.js +1 -0
  78. package/dist/core/agent/completionController.d.ts +14 -7
  79. package/dist/core/agent/completionController.js +12 -6
  80. package/dist/core/agent/events.d.ts +12 -0
  81. package/dist/core/agent/goalPolicy.d.ts +4 -3
  82. package/dist/core/agent/goalPolicy.js +9 -4
  83. package/dist/core/agent/workState.d.ts +25 -15
  84. package/dist/core/agent/workState.js +71 -43
  85. package/dist/core/safety/secretPaths.d.ts +18 -0
  86. package/dist/core/safety/secretPaths.js +115 -0
  87. package/dist/core/session/sessionSlimming.js +8 -0
  88. package/dist/core/session/sessionStore.d.ts +61 -1
  89. package/dist/core/session/sessionStore.js +115 -6
  90. package/dist/llm/hazeTools.d.ts +64 -208
  91. package/dist/llm/hazeTools.js +6 -0
  92. package/dist/llm/systemPrompt.js +3 -1
  93. package/dist/llm/toolResultTypes.d.ts +1 -1
  94. package/dist/llm/tools/failures.d.ts +6 -0
  95. package/dist/llm/tools/failures.js +8 -2
  96. package/dist/llm/tools/readRecovery.js +2 -0
  97. package/dist/llm/tools/shellTool.js +3 -0
  98. package/dist/llm/tools/taskTool.d.ts +64 -208
  99. package/dist/llm/tools/taskTool.js +22 -10
  100. package/dist/llm/tools/workspaceFile.d.ts +4 -3
  101. package/dist/llm/tools/workspaceFile.js +30 -13
  102. package/dist/ui/components/Header.js +1 -1
  103. package/dist/ui/components/MarkdownText.js +10 -10
  104. package/dist/ui/components/TextInput.d.ts +1 -1
  105. package/dist/ui/components/TextInput.js +8 -69
  106. package/dist/ui/components/useInputSuggestions.d.ts +27 -0
  107. package/dist/ui/components/useInputSuggestions.js +98 -0
  108. package/dist/ui/terminalColors.d.ts +29 -0
  109. package/dist/ui/terminalColors.js +47 -0
  110. package/dist/ui/theme.d.ts +105 -10
  111. package/dist/ui/theme.js +125 -15
  112. package/dist/ui/themes/registry.d.ts +5 -0
  113. package/dist/ui/themes/registry.js +436 -0
  114. package/dist/utils/format.d.ts +10 -0
  115. package/dist/utils/format.js +45 -0
  116. package/package.json +1 -1
@@ -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,9 +3,10 @@ import { type ToolExecutionContext } from './toolContext.js';
3
3
  * Resolve a read path and confine it to the workspace — unless the user
4
4
  * explicitly mentioned it (or a parent directory) in the prompt this turn.
5
5
  * Blessed paths skip both `.gitignore` enforcement and the workspace boundary
6
- * so the model can read host files the user pointed at. Mutating tools use
7
- * `prepareWorkspaceMutation` / `prepareWorkspaceWritePath` instead, which
8
- * never consult the bless set.
6
+ * so the model can read host files the user pointed at. Secret-file
7
+ * protection is checked before the bless set and is never bypassed.
8
+ * Mutating tools use `prepareWorkspaceMutation` / `prepareWorkspaceWritePath`
9
+ * instead, which never consult the bless set.
9
10
  */
10
11
  export declare function prepareWorkspaceRead(filePath: string, allowIgnored: boolean | undefined, context?: ToolExecutionContext): Promise<string>;
11
12
  export declare function prepareWorkspaceMutation(toolName: string, filePath: string, allowIgnored: boolean | undefined, context: ToolExecutionContext): Promise<{
@@ -1,29 +1,44 @@
1
1
  import fs from 'node:fs/promises';
2
+ import os from 'node:os';
2
3
  import path from 'node:path';
3
4
  import { assertRealPathInsideWorkspace, assertWritablePathInsideWorkspace, resolveWorkspacePath, workspaceRoot } from '../../utils/path.js';
4
5
  import { isPathBlessed } from '../../core/attachments/readBlessings.js';
6
+ import { isProtectedSecretPath } from '../../core/safety/secretPaths.js';
5
7
  import { assertNotIgnored } from './fileToolShared.js';
8
+ import { HazeToolError } from './failures.js';
6
9
  import { discoverScopedContext, hazeContext, scopedContextMutationStop } from './toolContext.js';
10
+ /**
11
+ * Secret files are hands-off for every tool: this check wins over the read
12
+ * bless set, `allowIgnored`, and gitignore logic. Both the lexical path and
13
+ * the real path are checked so symlinks cannot rename a secret into reach
14
+ * (`link -> .env`) or a secret name onto other content (`.env -> target`).
15
+ */
16
+ async function assertNotSecretPath(absolutePath, realPath, inputPath, operation) {
17
+ const homeDir = os.homedir();
18
+ if (!isProtectedSecretPath(absolutePath, homeDir) && !isProtectedSecretPath(realPath, homeDir))
19
+ return;
20
+ throw new HazeToolError(`Refusing to ${operation} protected secret file: ${inputPath}. Secret files (SSH keys, shell histories, .env files, credentials) are never accessible to agent tools.`, 'secret_file_protected', { recoverable: false, suggestedNextStep: 'Protected secret file: do not retry with other tools, paths, or shell. Ask the user to provide the needed value in the conversation instead.' });
21
+ }
7
22
  /**
8
23
  * Resolve a read path and confine it to the workspace — unless the user
9
24
  * explicitly mentioned it (or a parent directory) in the prompt this turn.
10
25
  * Blessed paths skip both `.gitignore` enforcement and the workspace boundary
11
- * so the model can read host files the user pointed at. Mutating tools use
12
- * `prepareWorkspaceMutation` / `prepareWorkspaceWritePath` instead, which
13
- * never consult the bless set.
26
+ * so the model can read host files the user pointed at. Secret-file
27
+ * protection is checked before the bless set and is never bypassed.
28
+ * Mutating tools use `prepareWorkspaceMutation` / `prepareWorkspaceWritePath`
29
+ * instead, which never consult the bless set.
14
30
  */
15
31
  export async function prepareWorkspaceRead(filePath, allowIgnored, context) {
32
+ const absolutePath = path.resolve(workspaceRoot(), filePath);
33
+ const realRequested = await requestedRealPath(absolutePath);
34
+ await assertNotSecretPath(absolutePath, realRequested, filePath, 'read');
16
35
  const blessed = context ? hazeContext(context)?.blessedPaths : undefined;
17
- if (blessed && blessed.length > 0) {
18
- const absolutePath = path.resolve(workspaceRoot(), filePath);
19
- const realRequested = await requestedRealPath(absolutePath);
20
- if (isPathBlessed(realRequested, blessed))
21
- return absolutePath;
22
- }
23
- const absolutePath = resolveWorkspacePath(filePath);
24
- await assertNotIgnored(absolutePath, filePath, allowIgnored, { operation: 'read' });
25
- await assertRealPathInsideWorkspace(absolutePath, filePath);
26
- return absolutePath;
36
+ if (blessed && blessed.length > 0 && isPathBlessed(realRequested, blessed))
37
+ return absolutePath;
38
+ const confinedPath = resolveWorkspacePath(filePath);
39
+ await assertNotIgnored(confinedPath, filePath, allowIgnored, { operation: 'read' });
40
+ await assertRealPathInsideWorkspace(confinedPath, filePath);
41
+ return confinedPath;
27
42
  }
28
43
  /** Best-effort realpath for bless comparison; falls back to the verbatim path if the file is gone. */
29
44
  async function requestedRealPath(absolutePath) {
@@ -36,6 +51,7 @@ async function requestedRealPath(absolutePath) {
36
51
  }
37
52
  export async function prepareWorkspaceMutation(toolName, filePath, allowIgnored, context) {
38
53
  const absolutePath = resolveWorkspacePath(filePath);
54
+ await assertNotSecretPath(absolutePath, await requestedRealPath(absolutePath), filePath, 'mutation');
39
55
  await assertNotIgnored(absolutePath, filePath, allowIgnored);
40
56
  await assertRealPathInsideWorkspace(absolutePath, filePath);
41
57
  const scopedContext = await discoverScopedContext(filePath, context);
@@ -44,6 +60,7 @@ export async function prepareWorkspaceMutation(toolName, filePath, allowIgnored,
44
60
  }
45
61
  export async function prepareWorkspaceWritePath(toolName, filePath, allowIgnored, context) {
46
62
  const absolutePath = resolveWorkspacePath(filePath);
63
+ await assertNotSecretPath(absolutePath, await requestedRealPath(absolutePath), filePath, 'mutation');
47
64
  await assertNotIgnored(absolutePath, filePath, allowIgnored);
48
65
  const scopedContext = await discoverScopedContext(filePath, context);
49
66
  const scopedStop = scopedContextMutationStop(toolName, filePath, scopedContext);
@@ -2,5 +2,5 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { Box, Text } from 'ink';
3
3
  import { theme } from '../theme.js';
4
4
  export function Header({ subtitle, version }) {
5
- return _jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Box, { children: [_jsx(Text, { color: theme.purple, bold: true, children: "haze" }), version ? _jsxs(Text, { color: theme.muted, children: [" v", version] }) : null] }), _jsx(Text, { children: " " }), _jsx(Text, { color: theme.muted, children: subtitle ?? 'A tiny terminal fog machine for building software.' })] });
5
+ return _jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Box, { children: [_jsx(Text, { color: theme.accent, bold: true, children: "haze" }), version ? _jsxs(Text, { color: theme.muted, children: [" v", version] }) : null] }), _jsx(Text, { children: " " }), _jsx(Text, { color: theme.muted, children: subtitle ?? 'A tiny terminal fog machine for building software.' })] });
6
6
  }