@denizokcu/haze 1.2.0 → 1.5.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 (179) hide show
  1. package/CHANGELOG.md +86 -1
  2. package/README.md +23 -10
  3. package/SECURITY.md +1 -1
  4. package/bin/haze.js +27 -7
  5. package/dist/buildInfo.json +3 -3
  6. package/dist/cli/chat/BusyBar.d.ts +7 -0
  7. package/dist/cli/chat/BusyBar.js +8 -0
  8. package/dist/cli/chat/DynamicFrame.d.ts +37 -0
  9. package/dist/cli/chat/DynamicFrame.js +43 -0
  10. package/dist/cli/chat/busyIndicator.d.ts +3 -1
  11. package/dist/cli/chat/busyIndicator.js +11 -9
  12. package/dist/cli/chat/chatMetrics.d.ts +1 -1
  13. package/dist/cli/chat/chatMetrics.js +3 -3
  14. package/dist/cli/chat/inputSuggestions.js +4 -0
  15. package/dist/cli/chat/liveMessages.d.ts +36 -0
  16. package/dist/cli/chat/liveMessages.js +64 -0
  17. package/dist/cli/chat/liveRegion.js +1 -1
  18. package/dist/cli/chat/messages.js +27 -16
  19. package/dist/cli/chat/sessionLifecycle.d.ts +5 -2
  20. package/dist/cli/chat/sessionLifecycle.js +36 -4
  21. package/dist/cli/chat/sessionRecorder.d.ts +2 -1
  22. package/dist/cli/chat/sessionRecorder.js +8 -0
  23. package/dist/cli/chat/shutdown.d.ts +27 -0
  24. package/dist/cli/chat/shutdown.js +79 -0
  25. package/dist/cli/chat/terminalControl.d.ts +45 -0
  26. package/dist/cli/chat/terminalControl.js +107 -0
  27. package/dist/cli/chat/tips.js +1 -0
  28. package/dist/cli/chat/userInput.d.ts +43 -0
  29. package/dist/cli/chat/userInput.js +63 -0
  30. package/dist/cli/chat/wizard/sessionThemeHandlers.d.ts +1 -1
  31. package/dist/cli/chat/wizard/sessionThemeHandlers.js +24 -1
  32. package/dist/cli/chat/wizard/types.d.ts +8 -1
  33. package/dist/cli/chat/wizardDispatch.js +1 -1
  34. package/dist/cli/commands/chat.js +277 -193
  35. package/dist/cli/commands/commandHelp.js +6 -0
  36. package/dist/cli/commands/commands.d.ts +8 -0
  37. package/dist/cli/commands/commands.js +13 -0
  38. package/dist/cli/commands/formatters.d.ts +1 -1
  39. package/dist/cli/commands/formatters.js +25 -3
  40. package/dist/cli/commands/logsCommand.js +21 -2
  41. package/dist/cli/commands/ndjsonSink.d.ts +12 -0
  42. package/dist/cli/commands/ndjsonSink.js +29 -0
  43. package/dist/cli/commands/reasoningCommand.d.ts +44 -0
  44. package/dist/cli/commands/reasoningCommand.js +79 -0
  45. package/dist/cli/commands/runCommand.d.ts +14 -0
  46. package/dist/cli/commands/runCommand.js +56 -22
  47. package/dist/cli/commands/settingsSummary.js +2 -0
  48. package/dist/cli/commands/streaming/agentAttempt.d.ts +3 -0
  49. package/dist/cli/commands/streaming/agentAttempt.js +2 -2
  50. package/dist/cli/commands/streaming/assistantSegments.d.ts +0 -7
  51. package/dist/cli/commands/streaming/assistantSegments.js +1 -1
  52. package/dist/cli/commands/streaming/attemptLifecycle.js +13 -9
  53. package/dist/cli/commands/streaming/attemptOutcome.d.ts +2 -0
  54. package/dist/cli/commands/streaming/attemptOutcome.js +24 -9
  55. package/dist/cli/commands/streaming/attemptSetup.d.ts +4 -0
  56. package/dist/cli/commands/streaming/attemptSetup.js +21 -7
  57. package/dist/cli/commands/streaming/goalCheckpoint.d.ts +14 -1
  58. package/dist/cli/commands/streaming/goalCheckpoint.js +4 -2
  59. package/dist/cli/commands/streaming/goalSupervisor.d.ts +9 -0
  60. package/dist/cli/commands/streaming/goalSupervisor.js +51 -10
  61. package/dist/cli/commands/streaming/prepareStep.d.ts +0 -3
  62. package/dist/cli/commands/streaming/prepareStep.js +14 -5
  63. package/dist/cli/commands/streaming/streamLoop.d.ts +5 -0
  64. package/dist/cli/commands/streaming/streamLoop.js +3 -0
  65. package/dist/cli/commands/streaming/toolPartHandlers.js +6 -0
  66. package/dist/cli/commands/streaming.d.ts +8 -3
  67. package/dist/cli/commands/streaming.js +46 -21
  68. package/dist/cli/commands/wizardFlow.d.ts +10 -0
  69. package/dist/cli/commands/wizardFlow.js +34 -5
  70. package/dist/cli/index.js +22 -2
  71. package/dist/config/contextFiles.d.ts +9 -0
  72. package/dist/config/contextFiles.js +21 -1
  73. package/dist/config/modelCatalog.d.ts +3 -0
  74. package/dist/config/modelCatalog.js +29 -0
  75. package/dist/config/modelDiscovery.js +68 -5
  76. package/dist/config/providerPresets.d.ts +1 -1
  77. package/dist/config/providerPresets.js +42 -3
  78. package/dist/config/settings.d.ts +14 -6
  79. package/dist/config/settings.js +16 -1
  80. package/dist/core/agent/budgets.d.ts +13 -17
  81. package/dist/core/agent/budgets.js +15 -19
  82. package/dist/core/agent/completionController.d.ts +14 -2
  83. package/dist/core/agent/completionController.js +48 -3
  84. package/dist/core/agent/events.d.ts +2 -1
  85. package/dist/core/agent/goalPolicy.d.ts +17 -0
  86. package/dist/core/agent/goalPolicy.js +53 -6
  87. package/dist/core/agent/projectPreflight.d.ts +2 -0
  88. package/dist/core/agent/projectPreflight.js +56 -0
  89. package/dist/core/agent/reasoningPolicy.d.ts +76 -10
  90. package/dist/core/agent/reasoningPolicy.js +72 -9
  91. package/dist/core/agent/toolCapabilities.d.ts +3 -3
  92. package/dist/core/agent/toolCapabilities.js +31 -7
  93. package/dist/core/agent/workState.d.ts +14 -4
  94. package/dist/core/agent/workState.js +229 -34
  95. package/dist/core/deadline.js +22 -24
  96. package/dist/core/providerContracts.d.ts +29 -0
  97. package/dist/core/providerContracts.js +1 -0
  98. package/dist/core/safety/secretPaths.js +10 -7
  99. package/dist/core/safety/shellClassifier.d.ts +2 -0
  100. package/dist/core/safety/shellClassifier.js +9 -1
  101. package/dist/core/session/sessionReport.d.ts +33 -0
  102. package/dist/core/session/sessionReport.js +121 -0
  103. package/dist/core/session/sessionSlimming.d.ts +2 -0
  104. package/dist/core/session/sessionSlimming.js +59 -4
  105. package/dist/core/session/sessionStore.d.ts +16 -8
  106. package/dist/core/session/sessionStore.js +71 -34
  107. package/dist/core/shellOutput/reducers/git.js +7 -2
  108. package/dist/core/shellOutput/reducers/validation.d.ts +1 -1
  109. package/dist/core/shellOutput/reducers/validation.js +14 -1
  110. package/dist/core/shellOutput/registry.js +3 -2
  111. package/dist/core/subagent/contracts.d.ts +3 -18
  112. package/dist/core/subagent/executionProfiles.js +4 -4
  113. package/dist/core/tasks/taskStorage.js +8 -1
  114. package/dist/core/validation/outputParser.d.ts +6 -1
  115. package/dist/core/validation/outputParser.js +30 -2
  116. package/dist/llm/client.d.ts +6 -3
  117. package/dist/llm/client.js +28 -11
  118. package/dist/llm/hazeTools.d.ts +9161 -7135
  119. package/dist/llm/hazeTools.js +6 -462
  120. package/dist/llm/lsp/client.d.ts +7 -1
  121. package/dist/llm/lsp/client.js +58 -9
  122. package/dist/llm/lsp/pool.d.ts +11 -0
  123. package/dist/llm/lsp/pool.js +61 -4
  124. package/dist/llm/lsp/protocol.d.ts +6 -23
  125. package/dist/llm/lsp/requests.d.ts +54 -60
  126. package/dist/llm/lsp/requests.js +152 -28
  127. package/dist/llm/lsp/symbols.d.ts +16 -0
  128. package/dist/llm/lsp/symbols.js +70 -0
  129. package/dist/llm/lsp/workspaceEdit.d.ts +43 -0
  130. package/dist/llm/lsp/workspaceEdit.js +117 -0
  131. package/dist/llm/lspTools.d.ts +7518 -2859
  132. package/dist/llm/lspTools.js +195 -110
  133. package/dist/llm/mcp.js +3 -0
  134. package/dist/llm/requestContext.d.ts +4 -3
  135. package/dist/llm/requestContext.js +9 -5
  136. package/dist/{core/subagent → llm}/subagentRunner.d.ts +13 -9
  137. package/dist/{core/subagent → llm}/subagentRunner.js +54 -49
  138. package/dist/llm/systemPrompt.d.ts +11 -1
  139. package/dist/llm/systemPrompt.js +4 -13
  140. package/dist/llm/tools/fetchTool.d.ts +34 -30
  141. package/dist/llm/tools/fileTools.d.ts +7768 -0
  142. package/dist/llm/tools/fileTools.js +510 -0
  143. package/dist/llm/tools/processTool.d.ts +34 -30
  144. package/dist/llm/tools/replaceInFiles.d.ts +105 -0
  145. package/dist/llm/tools/replaceInFiles.js +131 -0
  146. package/dist/llm/tools/shellTool.d.ts +34 -30
  147. package/dist/llm/tools/shellTool.js +8 -4
  148. package/dist/llm/tools/storedOutputTool.d.ts +4 -0
  149. package/dist/llm/tools/taskTool.d.ts +4 -0
  150. package/dist/llm/tools/toolContext.d.ts +3 -29
  151. package/dist/llm/tools/toolContext.js +56 -53
  152. package/dist/llm/tools/toolContextState.d.ts +40 -0
  153. package/dist/llm/tools/toolContextState.js +34 -0
  154. package/dist/llm/workerContext.d.ts +7 -0
  155. package/dist/llm/workerContext.js +18 -1
  156. package/dist/skills/SkillLoader.js +30 -4
  157. package/dist/skills/SkillRegistry.js +3 -3
  158. package/dist/skills/builder/SkillBuilder.js +3 -3
  159. package/dist/skills/confinement.d.ts +7 -0
  160. package/dist/skills/confinement.js +15 -0
  161. package/dist/ui/codeHighlight.js +4 -4
  162. package/dist/ui/components/MarkdownText.js +7 -8
  163. package/dist/ui/components/NativeIndicators.d.ts +15 -0
  164. package/dist/ui/components/NativeIndicators.js +32 -0
  165. package/dist/ui/components/StreamingMarkdownText.d.ts +9 -0
  166. package/dist/ui/components/StreamingMarkdownText.js +38 -0
  167. package/dist/ui/components/TextInput.d.ts +7 -2
  168. package/dist/ui/components/TextInput.js +103 -46
  169. package/dist/ui/components/WizardChoices.d.ts +18 -0
  170. package/dist/ui/components/WizardChoices.js +32 -0
  171. package/dist/ui/components/useInputSuggestions.js +18 -6
  172. package/dist/ui/inputBuffer.js +12 -6
  173. package/dist/ui/textGeometry.d.ts +14 -0
  174. package/dist/ui/textGeometry.js +31 -0
  175. package/dist/utils/buildInfo.js +29 -8
  176. package/dist/utils/fs.js +5 -1
  177. package/package.json +23 -22
  178. /package/dist/cli/{contextReport.d.ts → contextReportCli.d.ts} +0 -0
  179. /package/dist/cli/{contextReport.js → contextReportCli.js} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,6 +1,91 @@
1
1
  # Changelog
2
2
 
3
- ## Unreleased
3
+ ## 1.5.0 - 2026-10-04
4
+
5
+ Ink 8 terminal modernization with formatted streamed Markdown, per-model session-scoped reasoning, model steering for compact models, and pinned session model selections.
6
+
7
+ ### Added
8
+
9
+ - Streaming assistant Markdown is rendered as formatted terminal rows: the active root block is rendered through the settled Markdown renderer offscreen and shown in the dynamic tail, clamped to the live-region budget. Whole-block parsing is preserved so later text can still reclassify a block; only parser-stable preceding roots enter the static transcript, and clamped rows are never lost — they enter `<Static>` verbatim once settled.
10
+ - `/reasoning` is now per-model and session-scoped: each `provider:model` keeps its own in-memory level for the session, with `unset` sending no parameter and `reset` dropping the override. `/thinking` is an alias. The built-in default level is now `medium` (was `high`).
11
+ - Model steering for compact models (`steeringProfile: "compact"` setting): nearby package-script names are listed for smaller working slices, validation reminders arrive earlier, and history compacts at 70% of the usual message budget. Completion evidence is not weakened.
12
+ - `escalationModel` setting (registered `provider:model` selector): after a goal makes no measurable progress or exhausts context recovery, haze tries this explicitly configured model exactly once, keeping the conversation and goal evidence and announcing the switch. Haze never picks a fallback model on its own.
13
+ - `haze report [id] [--json]`: a metadata-only summary of the latest workspace session (or one by id) — model, goal outcomes, tool/validation counts, context size, and evidence mismatches — without printing prompts, commands, paths, or tool output.
14
+ - The live busy indicator for the shell tool shows the running command (e.g. `Running npm test`), reduced to the program plus its first non-flag argument so multi-file commands do not echo whole file lists into the one-line label.
15
+ - Session model pinning: sessions record a `model_selection` entry restored on resume, continue, and fork, so changing the global default never rewrites an active session's model. Headless `--resume` follows the saved selection unless `--model` is explicit.
16
+
17
+ ### Changed
18
+
19
+ - Upgrade to pinned Ink 8.0.0, retaining normal-screen scrollback, incremental rendering, the 15 FPS cap, and application-owned interrupts. Startup now clears only the viewport, not preexisting scrollback.
20
+ - Budget the complete dynamic chat frame, including multiline drafts, suggestions, tasks, queued follow-ups, pause hints, debug panels, and live previews. Tiny terminals use a borderless prompt; clipped previews never truncate finalized transcript/session content.
21
+ - Use native bracketed paste so pasted newlines, slash commands, probe-shaped text, and control bytes remain data rather than shortcuts. Unsafe control characters are replaced only in the input display; submitted data keeps its normalized content.
22
+ - Edit and wrap input by graphemes and terminal cells, with Unicode-aware table/code widths and background padding. Unsupported Ctrl combinations no longer insert letters; masked values are excluded from input history.
23
+ - Route `/exit`, `/quit`, and legacy/Kitty Ctrl+C through one bounded shutdown that aborts active work, quarantines late callbacks, flushes owned persistence, and cleans resources. Terminal defaults are restored even when rendering or exit waiting fails.
24
+ - Native Ink indicators replace the `ink-spinner` dependency: `ActivitySpinner`, `StatusNotice`, and `BusyBar` ride Ink 8's shared animation timer, busy heartbeat included, instead of `setInterval` timers; screen-reader mode gets a static spinner glyph and a paused elapsed ticker.
25
+ - Terminal interaction is modernized on Ink 8 capabilities: `/editor` composes in `$EDITOR` and `/logs <id>` pages raw JSONL through `$PAGER` via a suspended-terminal handoff, IME composition positions the real hardware cursor at the editing point, and the shutdown path waits for a render flush so the final frame reaches the TTY before unmount and OSC 10/11 restore.
26
+ - The absolute 30-minute per-turn cap is removed: a turn now runs until the model finishes, the user cancels, or an idle-stall / step / tool budget boundary ends it. The headless `--timeout` deadline remains the explicit opt-in whole-goal budget, and the goal supervisor clamps each physical turn to the remaining goal budget.
27
+ - Refreshed the model catalog and provider preset limits; runtime and development dependencies upgraded.
28
+
29
+ ### Fixed
30
+
31
+ - Completion evidence stays honest across repairs and compounding: a validation-only goal whose check failed keeps its truthful `tool_failure` classification instead of escalating into a repair continuation; a failed edit/write after a failed check no longer inherits the validation-repair affordance; `npm cd`/`--prefix` commands normalize to a shared validation identity only when they are a single foreground command, so compounds and redirects stay distinct checks; and carried failed-check identities are no longer truncated at eight — only the model-facing preview is bounded, with the true count reported.
32
+ - Goal status reopens when the ledger restarts: a `goal_start`/`goal_continue` entry after a terminal `goal_end` reopens the goal for reporting and clears stale stop reason, gate decision, and old event evidence, so a new terminal boundary is compared only against its own evidence. The ledger validator no longer rejects more than eight unresolved failed check ids.
33
+ - Suspended child launching is hardened: `less` values are split into executable plus quoted arguments instead of being spawned as one literal path, and a pager quitting early (EPIPE on its input pipe) no longer rejects the suspended run. `/logs <id>` shows a bounded inline preview whenever paging is unavailable (short logs or screen-reader mode) instead of only reporting the summary.
34
+ - Wizard/settings writes carry their patch so unrelated changes keep the session model, the status bar shows the session selection, and the per-session reasoning map is read from the current session identity instead of a stale ref.
35
+ - The IME composition cursor sits at the editing point (measured frame-origin coordinates), covered by a VT-emulator test asserting the final cursor cell from real escape output.
36
+
37
+ ## 1.4.0 - 2026-09-24
38
+
39
+ Reasoning effort becomes a first-class per-run control, plus follow-up fixes from the 1.3.0 review.
40
+
41
+ ### Added
42
+
43
+ - `--reasoning <level>` CLI flag for headless/print mode: `haze -p "…" --reasoning xhigh` steers thinking effort for that run, and `--reasoning unset|off` sends no reasoning parameter so the provider default applies. The interactive status bar now shows the active reasoning level next to the model name (default `high` when unset), and `/reasoning` persists the choice across runs.
44
+
45
+ ### Fixed
46
+
47
+ - Provider model discovery no longer forwards credentials across redirect origins: the endpoint transport is validated before the first fetch and re-checked on redirects, so a draft API key can never leak to a different origin (follow-up to CI-01/CI-02).
48
+ - The NDJSON event sink queues events safely when the producer and consumer race on async stream errors, and goal checkpoints preserve their validation kind across supervisor boundaries (follow-ups to SU-06/R2-03).
49
+
50
+ ## 1.3.0 - 2026-09-22
51
+
52
+ Hardening pass from a 40-finding architecture review (2026-09-22; `reviews/2026-09-22/` — 33 round-1 findings plus a 7-finding round-2 follow-up, all resolved): consistent secret/file boundaries across every tool path, one shared mutation-effects projection, completion obligations that survive every failed exit, durable session lifecycle fixes, credential-safe discovery, and honest output reduction.
53
+
54
+ ### Added
55
+
56
+ - Symbol-aware LSP workflow: hierarchical symbol/body/signature retrieval, reference results enriched with enclosing symbols and snippets, symbol-scoped diagnostics, semantic rename, and reference-guarded safe delete. Warm language servers now receive external file-change notifications, wait for bounded indexing progress, and restart once after termination. Malformed LSP positions/ranges are rejected instead of being coerced into edits, and every file in a workspace edit is preflighted before the first write (TS-05).
57
+ - Guarded `replaceInFiles` bulk edits with dry-run previews, stable occurrence IDs, include/exclude globs, expected-count checks, stale-selection refusal, bounded diffs, and retrievable overflow output. Bulk scans guard every matched descendant through the shared read policy (secret protection included) before opening it (TS-01).
58
+
59
+ ### Fixed
60
+
61
+ - Secret and search boundaries are uniform across tools (TS-01/TS-02/TS-07): `replaceInFiles` scans refuse protected descendants before any read; grep traversal exclusions derive from the one secret-policy list (negated-only globs after any model glob, case-insensitive matching); and `includeIgnored` affects the ripgrep traversal only on explicit override, keeping `.git` and dependency roots out either way.
62
+ - Regex replacements use the engine's native sticky-regex mode, so lookarounds and capture-group semantics match the preview exactly instead of drifting on repeated matches (TS-04). Multi-file `writeFile` batches report changed and uncertain paths truthfully when a later write fails partway (TS-08).
63
+ - Shell output reducers apply only to unambiguous single foreground commands (TS-06): the git reducer requires a leading git command, stdout-owned output, and no stderr, and unknown status content no longer renders as a clean-status summary.
64
+ - Provider model discovery validates the endpoint transport before its first fetch and re-checks redirects, so a draft API key is never sent to an unvalidated URL; LSP pull diagnostics use the advertised `diagnosticProvider` capability and method names, distinguishing an explicit empty report from an absent or timed-out one (CI-01/CI-02).
65
+ - Skill bodies, references, and discovery responses share the file tools' secret-file policy and are bounded (count and aggregate bytes) (CI-03/CI-04); task storage resolves real workspace paths, refusing symlinked escapes out of the workspace (CI-05).
66
+ - Validation evidence is recorded in execution order so the latest run of a command decides the outcome, not insertion order; newline/background commands no longer count as direct artifact validation — the shared single-foreground-command check decides (AR-01/AR-03).
67
+ - One shared mutation-effects projection (`changedPathsFromTool`) feeds work state, LSP diagnostics, and worker capsules, and it tolerates success-only outputs; bulk edits, LSP workspace edits, delegated subagent mutations, and failed workers all count their confirmed effects and validation evidence (AR-02/AR-08).
68
+ - Structured completion obligations survive every failed exit (AR-04/AR-05): `TurnResult.checkpoint` preserves tasks, mutation counts, and red evidence on hard failures; an idle-stall resume keeps its checkpoint; headless relaunches never duplicate the request or drop carried evidence.
69
+ - Session lifecycle is durable and honest (SU-01..SU-06): one shared goal-frontier tracker reopens a paused goal on same-id resume instead of an earlier terminal entry winning; `/clear` persists an empty snapshot and restore replays the clear marker so a cleared session stays cleared; manual LLM compaction is timeout/output-bounded and discards commits over newer conversation state; recovery slash commands keep the paused-goal `R` affordance; the NDJSON sink captures async stream errors, bounds its queue, and exits non-zero on producer failure; mention completion is token-bound so stale results can never apply.
70
+ - The goal-ledger vacuum keeps the live frontier when snapshots interleave goal entries (round-2 R2-01, reproduced): the keep decision now uses original entry indexes in one pass, so a deferred vacuum can no longer drop the crash-resume frontier.
71
+ - `context_exhausted` checkpoints carry unresolved red→green evidence and the validation kind rides goal checkpoints end to end (R2-02/R2-03): a continuation cannot complete on a self-declared pass while a classifier-confirmed failure is carried — the same rule that already held inside a turn.
72
+ - Deadlines and attempt teardown are honest (AR-06/AR-07): a cleared deadline is permanently disposed and never fires late; abort listeners drop after settlement; every state-mutating callback — compaction recording included — is quarantined once an attempt is abandoned.
73
+ - Legacy slimmed tool results are re-wrapped into the AI SDK output envelope on session restore, so older persisted conversations load as protocol-safe `ModelMessage[]` values for the next provider request.
74
+ - Session-retrospective friction fixes (RT-01..RT-06): an empty `listFiles` cursor normalizes to absent (no more empty-repository misreport) and outside-workspace paths fail with a structured refusal; a ready voluntary stop at a budget boundary completes instead of looping; subagent provider-error capsules and validation summaries carry actionable detail; `turn_end` persists an explicit failure reason without `--debug`.
75
+
76
+ ### Changed
77
+
78
+ - Validation-command pairing normalizes `env` prefixes (bare, with flags, or with `VAR=value` assignments), so `env CI=1 npm test` after a bare `npm test` failure satisfies the same-check green rule (R2-06). The dead `validate` capability kind was removed — only a runtime-classifier-confirmed `shell` command is validation evidence (R2-04/R2-05).
79
+ - Release hygiene (MR-01..MR-06): `npm run release:verify` checks lockfile root, README, changelog, SECURITY series, docs stamps, and AGENTS stamps for the package version and runs in CI; CI packs a real tarball and fails the upload when it is absent; the launcher artifact suite runs after build; both Git HEAD readers resolve relative `gitdir`/`commondir` (spaces included); all ten unused exports were triaged (unexported or deleted).
80
+ - Refreshed all runtime and development dependencies to their latest releases, including Vitest 5; TypeScript deliberately remains on the latest 6.x release (`6.0.3`) rather than upgrading to TypeScript 7.
81
+
82
+ ## 1.2.1 - 2026-09-07
83
+
84
+ Edit-recovery UX fix: when a file mutation fails and haze requests `readFile` recovery, the model is now explicitly told which path to read and why — and the tool set is no longer narrowed, because the execution-time gate already enforces the fresh read with a recoverable structured error.
85
+
86
+ ### Fixed
87
+
88
+ - Read-only edit recovery instructs instead of restricting: when a failed mutation requests `readFile` recovery, the next step appends a control message naming the exact path and explaining that edit tools will reject retries until the read completes — while keeping the full tool set. The turn-scoped gate in the tool context (`failedMutationPaths` / `pathsReadAfterFailedMutation`) remains the structural enforcer: a premature retry gets a structured `Read <path> first` failure in the same step, not a request-time hard error. Previously haze silently narrowed the active tools to `readFile`, so small models that retried the failed mutation anyway hit `AI_NoSuchToolError` step failures and supervisor relaunch loops (22× observed).
4
89
 
5
90
  ## 1.2.0 - 2026-08-31
6
91
 
package/README.md CHANGED
@@ -2,18 +2,22 @@
2
2
 
3
3
  A minimal LLM harness for your terminal.
4
4
 
5
- ## What's new in 1.2.0
5
+ ## What's new in 1.5.0
6
6
 
7
- haze 1.2.0 makes long-running work more truthful under context pressure and provider instability.
7
+ haze 1.5.0 modernizes the terminal experience on Ink 8 — formatted streamed Markdown, native spinners and busy indicators, `$EDITOR`/`$PAGER` handoffs, and IME-aware cursor placement — and adds model steering for compact models, per-model session-scoped `/reasoning` (with the `/thinking` alias), pinned session model selections, and a metadata-only `haze report`.
8
8
 
9
- - Provider-aware context accounting: completed steps re-anchor estimates on provider usage, a curated model catalog supplies known context/output limits, and live or user-configured model metadata still takes precedence.
10
- - Recoverable overflow handling: thrown, silent, and length-stop context overflows compact and retry with progressively smaller budgets. Exhausted recovery checkpoints the goal as `context_exhausted` instead of hard-failing or looping on the same request.
11
- - Better continuity: large mid-turn compactions use model-written, split-turn-aware summaries; every compaction emits stream events and a durable session entry for auditability.
12
- - Truthful validation: validation pipelines run with `pipefail`; masking command lists and quoted lookalikes cannot claim validation authority; and a generic custom pass cannot erase a real classified failure.
13
- - Resilient retries: `retryBaseDelayMs` configures exponential backoff, the retry pool resets after measurable step progress, and provider/model settings are re-read for each attempt.
9
+ - Formatted streaming: assistant Markdown renders as formatted terminal rows while it streams, clamped to the viewport budget; clamped rows settle into the transcript verbatim, never lost.
10
+ - Model steering: `steeringProfile: "compact"` lists nearby package-script names, asks for smaller working slices, reminds about validation earlier, and compacts history at 70% of the usual budget — completion evidence stays just as strict. `escalationModel` hands a stuck goal to one explicitly configured model, once, with the conversation and evidence intact.
11
+ - Reasoning control: `/reasoning` (alias `/thinking`) keeps a per-model level for the session — `unset` sends no parameter, `reset` drops the override — and the status bar shows the effective level. Headless runs keep `--reasoning <level|unset>` as a run-scoped override.
12
+ - Session model pinning: each session remembers its model selection on resume, continue, and fork; changing the global default never rewrites an active session. Headless `--resume` follows the saved selection unless `--model` is explicit.
13
+ - `haze report [id] [--json]`: goal outcomes, tool/validation counts, context size, and evidence mismatches from session metadata — never prompts, commands, paths, or tool output.
14
+ - Terminal modernization: Ink 8 with native bracketed paste, grapheme/cell-aware editing, one bounded shutdown path, suspended-terminal `$EDITOR`/`$PAGER` handoffs, and screen-reader-aware indicators. The implicit 30-minute per-turn cap is gone; `--timeout` remains the explicit opt-in goal budget.
14
15
 
15
16
  Previous releases:
16
17
 
18
+ - `1.4.0`: per-run reasoning control (`--reasoning` for headless runs and a live status-bar indicator) on top of the 1.3.0 hardening pass — uniform secret/file boundaries, evidence that survives failed exits, durable session lifecycle fixes, credential-safe provider discovery, and honest output reduction.
19
+ - `1.2.1`: edit-recovery instructs instead of restricting — the model is told which path to read and why, while the execution-time gate enforces the fresh read.
20
+ - `1.2.0`: provider-usage context accounting, recoverable compact-and-retry overflow handling, model-written split-turn-aware compaction, `pipefail` validation truthfulness, and a configurable retry pool.
17
21
  - `1.1.1`: durable goal ledgers and crash-resume frontiers; headless `--until-done` relaunches with bounded notices and a no-progress guard; proportional task/validation completion gates; and smaller orchestration internals.
18
22
  - `1.1.0`: terminal theming with 14 built-in palettes and live `/themes` switching; hard secret-file protection across every file tool, including symlink, read-blessing, ignore-override, and grep-traversal defenses.
19
23
  - `1.0.0`: first stable release — the CLI flags, settings schema, `stream-json` event contract, session format, skill layout, and structured tool-result shape under the 1.x compatibility promise; a configurable model-retry pool; and four benchmark-driven reliability fixes (validated with the Harbor differential benchmark: 17/17 verifier tests, fewest input tokens of the reporting harnesses, zero stalls).
@@ -83,6 +87,8 @@ On first run, create or choose a provider, then choose your first model:
83
87
  /model local:llama3.1
84
88
  ```
85
89
 
90
+ Sessions remember their provider and model across resume, continue, and fork, even if the global default changes. `/model` explicitly changes the current session's selection and the default for new sessions. Headless resume uses the saved selection unless `--model` overrides it for that run. If the saved model is no longer configured, choose or re-add it rather than silently switching models. Older sessions without model metadata adopt the current default when resumed.
91
+
86
92
  ### MCP servers
87
93
 
88
94
  Use `/mcp` to connect [Model Context Protocol](https://modelcontextprotocol.io) servers and give the agent more tools. The interactive picker works like `/provider`: enable, disable, or remove a server; set its API key; or add one from a preset or custom configuration. The built-in Context7 preset provides current library documentation.
@@ -100,6 +106,8 @@ Saved settings live in `~/.haze/settings.json`. ChatGPT OAuth credentials live s
100
106
 
101
107
  Switch the interface palette with `/themes`. The picker lists every built-in theme — light palettes and oh-my-zsh ports like `robbyrussell`, `af-magic`, and `solarized-dark` — and applies the choice immediately; `/themes <name>` sets one directly. The selection persists as `theme` in `~/.haze/settings.json`, and text already on screen keeps its old colors.
102
108
 
109
+ Control reasoning effort with `/reasoning`. The picker (or `/reasoning <level>`) sets one of `none`, `minimal`, `low`, `medium`, `high`, or `xhigh`; the default is `high` when nothing is saved. `/reasoning unset` returns to the provider default (no reasoning parameter is sent) and `/reasoning status` shows the current level. The level is sent as the AI SDK's portable reasoning parameter (the standard `reasoning_effort` field on OpenAI-compatible endpoints) and applies from the next turn. Endpoints without native support ignore it. The selection persists as `reasoning` in `~/.haze/settings.json`; the current level is shown in the bottom status bar next to the model name.
110
+
103
111
  haze focuses on chat, local tools, context files, sessions, and Markdown skills. Use `/skills` for workflows outside that core. Its interactive picker can generate a skill from a description, then enable, disable, validate, or remove it. For reviews, release prep, deploy checks, debugging routines, or a team-specific checklist, ask haze to create a skill and edit the resulting Markdown as needed.
104
112
 
105
113
  ## Start using haze
@@ -212,6 +220,7 @@ When you catch yourself repeating the same instructions, put them in a skill. Th
212
220
  /settings open
213
221
  /themes
214
222
  /themes <name>
223
+ /reasoning [level|unset|status]
215
224
  /logs [id]
216
225
  /lsp
217
226
  /mcp
@@ -304,6 +313,7 @@ haze has a small built-in toolset:
304
313
  - `readFile` returns numbered UTF-8 lines in bounded pages, with `nextOffset` when more remain. It keeps a small, signature-checked index of line offsets so later pages do not start from the top of the file. File contents are not cached.
305
314
  - `grep` runs structured ripgrep searches with a global result cap and compacts long lines and result sets. It rejects directly named ignored roots unless `includeIgnored` is set.
306
315
  - `editFile` makes unique text replacements, tolerates accidental line-number prefixes, and returns a structured diff.
316
+ - `replaceInFiles` previews or applies guarded literal/regex changes across files using stable occurrence IDs, globs, and expected-count checks.
307
317
  - `replaceLines` edits line ranges when exact replacements are awkward, clamps ranges that extend slightly past EOF, and returns a structured diff.
308
318
  - `writeFile` creates, overwrites, or appends files and parent directories, returning a diff for each successful content change.
309
319
  - `shell` runs tests, builds, git and gh commands, scripts, installs, and other command-line work in your configured login shell. Set `HAZE_SHELL` to an explicit executable for deterministic CI or service accounts. Its schema identifies the active shell dialect. Output is trimmed according to the command type while preserving useful failure details. A timeout or abort kills the process tree, escalates if necessary, and returns even when an escaped child keeps stdout or stderr open.
@@ -311,13 +321,13 @@ haze has a small built-in toolset:
311
321
  - `fetch` reads public `http(s)` URLs as Markdown, formatted JSON, or text. It rejects non-HTTP schemes, private and loopback addresses, metadata hosts, and malformed IPv6-like hosts. Bounded output remains available through `readToolOutput`.
312
322
  - `writeTasks` replaces the task list at meaningful phase changes. Completed lists clear on the next user turn.
313
323
  - `skill` loads an installed Markdown workflow or one of its references.
314
- - `lspWorkspaceSymbols`, `lspSymbols`, `lspDefinition`, and `lspReferences` provide optional read-only navigation through configured language servers. They appear only when an enabled server command is installed.
324
+ - Optional LSP tools provide hierarchical symbol/body retrieval, definitions, enriched references, implementations, symbol-scoped diagnostics, semantic rename, and checked safe delete. They appear only when an enabled server command is installed.
315
325
 
316
- Tool calls are grouped in the transcript so you can see what happened without reading a novella. Every successful `editFile`, `replaceLines`, and `writeFile` content change shows colored additions and removals with line numbers and context. Large diffs keep an eight-row preview—the first four and last four rows, separated by an omission marker—and expose the complete retained diff through `readToolOutput`; no-op mutations are labeled explicitly. File-tool failures include a reason code and a recovery hint; protected secret files (SSH keys, shell histories, `.env` files, credentials) are refused outright with `secret_file_protected` and show as `blocked: protected secret file` in the transcript. Large shell, search, and fetch results stay behind an in-memory handle. Later model calls see a compact summary tailored to validation, git, search, diffs, JSON, logs, or the head and tail of the output.
326
+ Tool calls are grouped in the transcript so you can see what happened without reading a novella. Every successful `editFile`, `replaceInFiles`, `replaceLines`, `writeFile`, and mutating LSP content change shows colored additions and removals with line numbers and context. Large diffs keep an eight-row preview—the first four and last four rows, separated by an omission marker—and expose the complete retained diff through `readToolOutput`; no-op mutations are labeled explicitly. File-tool failures include a reason code and a recovery hint; protected secret files (SSH keys, shell histories, `.env` files, credentials) are refused outright with `secret_file_protected` and show as `blocked: protected secret file` in the transcript. Large shell, search, and fetch results stay behind an in-memory handle. Later model calls see a compact summary tailored to validation, git, search, diffs, JSON, logs, or the head and tail of the output.
317
327
 
318
328
  ### Optional LSP navigation
319
329
 
320
- haze can use stdio Language Server Protocol servers for semantic code navigation. Open `/lsp` to add a preset or custom command, then enable, disable, or remove it. The presets cover TypeScript, Rust, Python, Go, and PHP. You install the server yourself. haze only exposes LSP tools when an enabled server command is on `PATH`; otherwise it uses `grep`, `listFiles`, and `readFile`. When haze closes a server or rejects malformed protocol output, it terminates the server's process tree and forces it to exit if necessary.
330
+ haze can use stdio Language Server Protocol servers for semantic code navigation and refactoring. Open `/lsp` to add a preset or custom command, then enable, disable, or remove it. The presets cover TypeScript, Rust, Python, Go, and PHP. You install the server yourself. haze only exposes LSP tools when an enabled server command is on `PATH`; otherwise it uses `grep`, `listFiles`, and `readFile`. Warm servers are refreshed after external file changes, bounded indexing progress is respected, and a terminated server is restarted for one retry. Returned locations and workspace edits remain confined to the workspace. When haze closes a server or rejects malformed protocol output, it terminates the server's process tree and forces it to exit if necessary.
321
331
 
322
332
  Example TypeScript setup:
323
333
 
@@ -388,11 +398,14 @@ Use `AGENTS.md` for project conventions, commands, architecture notes, and anyth
388
398
 
389
399
  Most haze behaviour needs no configuration; a few optional keys in `~/.haze/settings.json` tune reliability and context handling. All are validated loudly — malformed values fail with a clear settings error instead of being silently ignored.
390
400
 
401
+ - `steeringProfile` (`"standard"` default, or `"compact"`): compact lists nearby package script names, asks for smaller working slices, gives earlier validation reminders, and compacts history at 70% of the usual message budget. Choose it for models that struggle with long contexts or large tool batches; completion checks stay the same.
402
+ - `escalationModel` (registered model selector, optional): after a goal makes no measurable progress or exhausts its context recovery, haze tries this explicitly configured model once. It keeps the same conversation and goal evidence, and announces the switch. Haze never chooses a fallback model on its own.
391
403
  - `modelRetries` (integer 0–10, default 2): size of the shared bounded retry pool for transient model errors and idle-stream stalls. Raise it for providers that terminate long streams aggressively; `0` disables automatic retries (a stalled stream pauses with the goal preserved for a one-key resume). The effective value is reported in `timeout` and `retry` stream events as `maxRetries`.
392
404
  - `retryBaseDelayMs` (integer 250–60000, default 1000): base delay for the shared retry pool's exponential backoff (`base × 2^attempt`, capped at 4× the base). The pool resets whenever a failed attempt completed steps since the previous retry, so intermittent blips on a long turn never exhaust it.
393
405
  - `contextWindowFallbackTokens` / `localContextWindowFallbackTokens` (default 128K hosted / 32K local): context-window guess for models without limits metadata or a curated catalog entry. Every turn emits a `context_budget` event naming the window and its source, and the interactive warning fires once per model per session when the built-in default was used.
394
406
  - `manualCompaction` (`"llm-summary"` default, or `"heuristic"`): whether manual `/compact` asks the active model for a continuity summary or keeps the model-free bounded excerpt.
395
407
  - `theme` (string, default `purple`): name of a built-in palette (`/themes` lists and sets them, with `light` and oh-my-zsh ports like `robbyrussell` included). Unknown names fail loudly at startup with the valid names listed.
408
+ - `reasoning` (`"none"` | `"minimal"` | `"low"` | `"medium"` | `"high"` | `"xhigh"` | `"provider-default"`, default `high`): reasoning-effort level sent as the portable reasoning parameter. An absent key means `high`; the `provider-default` sentinel means no parameter is sent. `/reasoning` lists, sets, and clears it.
396
409
 
397
410
  ## Safety model
398
411
 
package/SECURITY.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  | Version | Supported |
6
6
  |---------|-----------|
7
- | Latest minor (`1.2.x`) | Yes — security fixes |
7
+ | Latest minor (`1.5.x`) | Yes — security fixes |
8
8
  | Older minors and pre-1.0 (`0.x`) | No — upgrade required |
9
9
 
10
10
  Security fixes are provided for the latest published minor release. Upgrade to the newest release before reporting an issue that may already have been fixed.
package/bin/haze.js CHANGED
@@ -29,19 +29,39 @@ function readJson(file) {
29
29
 
30
30
  function readGitHead() {
31
31
  const sha = (value) => (/^[0-9a-f]{7,40}$/i.test((value ?? '').trim()) ? value.trim() : undefined);
32
+ const readOptional = (file) => {
33
+ try {
34
+ return readFileSync(file, 'utf8');
35
+ } catch {
36
+ return undefined;
37
+ }
38
+ };
32
39
  try {
33
40
  const dotGit = path.join(root, '.git');
34
41
  const stat = statSync(dotGit);
35
- const gitDir = stat.isDirectory() ? dotGit : /gitdir:\s*(\S+)/.exec(readFileSync(dotGit, 'utf8'))?.[1];
42
+ // `gitdir: <path>` may be relative (resolve against root) and contain
43
+ // spaces; linked worktrees keep refs in the common dir via `commondir`
44
+ // (MR-05). Mirrors src/utils/buildInfo.ts gitHeadCommit by design.
45
+ const gitDir = stat.isDirectory()
46
+ ? dotGit
47
+ : path.resolve(root, (/gitdir:\s*(.+?)\s*$/m.exec(readOptional(dotGit) ?? '') ?? [])[1]);
36
48
  if (!gitDir) return undefined;
37
- const head = readFileSync(path.join(gitDir, 'HEAD'), 'utf8').trim();
49
+ const commonDirRaw = /\s*(.+?)\s*$/.exec(readOptional(path.join(gitDir, 'commondir')) ?? '')?.[1];
50
+ const refDirs = commonDirRaw ? [path.resolve(gitDir, commonDirRaw)] : [];
51
+ const head = (readOptional(path.join(gitDir, 'HEAD')) ?? '').trim();
38
52
  if (!head.startsWith('ref:')) return sha(head);
39
53
  const ref = head.slice(4).trim();
40
- const refPath = path.join(gitDir, ref);
41
- if (existsSync(refPath)) return sha(readFileSync(refPath, 'utf8'));
42
- const packed = readFileSync(path.join(gitDir, 'packed-refs'), 'utf8');
43
- const escaped = ref.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
44
- return sha(new RegExp(`^([0-9a-f]{40}) ${escaped}$`, 'm').exec(packed)?.[1]);
54
+ for (const dir of [gitDir, ...refDirs]) {
55
+ const loose = sha(readOptional(path.join(dir, ref)));
56
+ if (loose) return loose;
57
+ const packed = readOptional(path.join(dir, 'packed-refs'));
58
+ if (packed) {
59
+ const escaped = ref.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
60
+ const packedSha = sha(new RegExp(`^([0-9a-f]{40}) ${escaped}$`, 'm').exec(packed)?.[1]);
61
+ if (packedSha) return packedSha;
62
+ }
63
+ }
64
+ return undefined;
45
65
  } catch {
46
66
  return undefined;
47
67
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@denizokcu/haze",
3
- "version": "1.2.0",
4
- "commit": "667c1c325d41e1f9811d9de0d19361e95a969d0e",
5
- "builtAt": "2026-08-31T22:00:27.789Z",
3
+ "version": "1.5.0",
4
+ "commit": "cd0daa845cacfe4aee5adb0cd8f521c9885acf79",
5
+ "builtAt": "2026-10-04T20:57:37.360Z",
6
6
  "sourceRoot": "/Users/deniz.okcu/development/haze"
7
7
  }
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ /** Spinner ticks stay within this subtree, not the transcript orchestrator. */
3
+ export declare function BusyBar({ label, elapsed, tip }: {
4
+ label: string;
5
+ elapsed: string;
6
+ tip?: string;
7
+ }): React.JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Box, Text } from 'ink';
3
+ import { ActivitySpinner } from '../../ui/components/NativeIndicators.js';
4
+ import { theme } from '../../ui/theme.js';
5
+ /** Spinner ticks stay within this subtree, not the transcript orchestrator. */
6
+ export function BusyBar({ label, elapsed, tip }) {
7
+ return _jsxs(Box, { flexDirection: "column", flexShrink: 0, children: [_jsxs(Box, { overflow: "hidden", children: [_jsx(ActivitySpinner, {}), _jsx(Box, { flexShrink: 0, width: 1 }), _jsxs(Text, { wrap: "truncate-end", children: [_jsxs(Text, { color: theme.command, bold: true, children: [label, elapsed ? _jsxs(Text, { color: theme.muted, children: [" \u00B7 ", elapsed] }) : null] }), _jsx(Text, { color: theme.muted, children: " \u00B7 type to queue follow-up \u00B7 esc to interrupt" })] })] }), tip && _jsxs(Text, { color: theme.muted, wrap: "truncate-end", children: [_jsx(Text, { bold: true, children: "Tip:" }), " ", tip] })] });
8
+ }
@@ -0,0 +1,37 @@
1
+ import React from 'react';
2
+ export interface FrameSections {
3
+ live?: React.ReactNode | ((rows: number) => React.ReactNode);
4
+ tasks?: React.ReactNode;
5
+ queue?: React.ReactNode;
6
+ debug?: React.ReactNode;
7
+ status?: React.ReactNode;
8
+ activity?: React.ReactNode;
9
+ }
10
+ export interface InputDemand {
11
+ input: number;
12
+ suggestions: number;
13
+ }
14
+ /** Allocate the entire normal-screen dynamic frame, never Static history. */
15
+ export declare function allocateFrame(rows: number, columns: number, sections: FrameSections, demand?: InputDemand): {
16
+ compact: boolean;
17
+ input: number;
18
+ border: number;
19
+ activity: number;
20
+ status: number;
21
+ suggestions: number;
22
+ tasks: number;
23
+ queue: number;
24
+ debug: number;
25
+ live: number;
26
+ };
27
+ export declare function DynamicFrame({ rows, columns, sections, input }: {
28
+ rows: number;
29
+ columns: number;
30
+ sections: FrameSections;
31
+ input: (limits: {
32
+ width: number;
33
+ inputRows: number;
34
+ suggestionRows: number;
35
+ onRowsChange: (demand: InputDemand) => void;
36
+ }) => React.ReactNode;
37
+ }): React.JSX.Element;
@@ -0,0 +1,43 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useRef, useState } from 'react';
3
+ import { Box, useBoxMetrics } from 'ink';
4
+ import { theme } from '../../ui/theme.js';
5
+ /** Allocate the entire normal-screen dynamic frame, never Static history. */
6
+ export function allocateFrame(rows, columns, sections, demand = { input: 1, suggestions: 0 }) {
7
+ // Keep normal-screen output below Ink's fullscreen threshold, including long
8
+ // live previews. One-cell terminals still get an editable input row.
9
+ let remaining = Math.max(1, Math.floor(rows) - 1);
10
+ const take = (wanted) => {
11
+ const granted = Math.min(remaining, wanted);
12
+ remaining -= granted;
13
+ return granted;
14
+ };
15
+ const compact = columns < 12 || rows < 6;
16
+ const input = take(compact ? 1 : Math.min(4, Math.max(1, demand.input), Math.max(1, rows - 5)));
17
+ const border = compact ? 0 : take(2);
18
+ const activity = sections.activity ? take(1) : 0;
19
+ const status = sections.status ? take(compact ? 1 : 2) : 0;
20
+ const suggestions = take(Math.min(5, demand.suggestions, Math.floor(remaining / 3)));
21
+ const tasks = sections.tasks ? take(Math.min(6, Math.floor(remaining / 3))) : 0;
22
+ const queue = sections.queue ? take(Math.min(3, Math.floor(remaining / 4))) : 0;
23
+ const debug = sections.debug ? take(Math.min(4, Math.floor(remaining / 4))) : 0;
24
+ const live = sections.live ? take(remaining) : 0;
25
+ return { compact, input, border, activity, status, suggestions, tasks, queue, debug, live };
26
+ }
27
+ /** Cap panel geometry without stretching short output into a fullscreen frame. */
28
+ function Panel({ rows, children }) {
29
+ if (rows === 0)
30
+ return null;
31
+ return _jsx(Box, { flexDirection: "column", maxHeight: rows, flexShrink: 0, overflow: "hidden", children: _jsx(Box, { flexDirection: "column", flexShrink: 0, width: "100%", children: children }) });
32
+ }
33
+ export function DynamicFrame({ rows, columns, sections, input }) {
34
+ const [demand, setDemand] = useState({ input: 1, suggestions: 0 });
35
+ const inputRef = useRef(null);
36
+ const metrics = useBoxMetrics(inputRef);
37
+ const budget = allocateFrame(rows, columns, sections, demand);
38
+ const safeWidth = Math.max(1, columns - (budget.border ? 4 : 0));
39
+ // Previous measurements may be wider on shrink: first-render arithmetic stays authoritative.
40
+ const inputWidth = metrics.hasMeasured && metrics.clientWidth > 0 ? Math.min(safeWidth, metrics.clientWidth) : safeWidth;
41
+ const onRowsChange = (next) => setDemand(previous => previous.input === next.input && previous.suggestions === next.suggestions ? previous : next);
42
+ return _jsxs(Box, { flexDirection: "column", width: Math.max(1, columns), flexShrink: 0, children: [_jsx(Panel, { rows: budget.live, children: typeof sections.live === 'function' ? sections.live(budget.live) : sections.live }), _jsx(Panel, { rows: budget.debug, children: sections.debug }), _jsx(Panel, { rows: budget.queue, children: sections.queue }), _jsx(Panel, { rows: budget.tasks, children: sections.tasks }), _jsx(Panel, { rows: budget.activity, children: sections.activity }), _jsx(Box, { flexDirection: "column", height: budget.input + budget.suggestions + budget.border, flexShrink: 0, overflow: "hidden", borderStyle: budget.border ? 'round' : undefined, borderColor: theme.border, paddingX: budget.border ? 1 : 0, children: _jsx(Box, { ref: inputRef, width: "100%", flexDirection: "column", minWidth: 0, children: input({ width: inputWidth, inputRows: budget.input, suggestionRows: budget.suggestions, onRowsChange }) }) }), _jsx(Panel, { rows: budget.status, children: sections.status })] });
43
+ }
@@ -2,7 +2,9 @@
2
2
  * Busy state with a one-second heartbeat. The tick re-renders the elapsed-time
3
3
  * label so the developer always sees rolling activity even when the model is
4
4
  * thinking with no streamed output and no tool is running (the "looks stuck"
5
- * problem). Extracted from ChatScreen alongside BusyBar.
5
+ * problem). Extracted from ChatScreen alongside BusyBar. The heartbeat rides
6
+ * Ink 8's shared animation timer so every animated component (spinners,
7
+ * elapsed labels) consolidates into one render cycle under maxFps.
6
8
  */
7
9
  export declare function useBusyIndicator(): {
8
10
  busy: boolean;
@@ -1,4 +1,5 @@
1
- import { useEffect, useRef, useState } from 'react';
1
+ import { useRef, useState } from 'react';
2
+ import { useAnimation, useIsScreenReaderEnabled } from 'ink';
2
3
  import { formatElapsedTimeWhole } from '../../utils/format.js';
3
4
  /** Elapsed-time label for the busy indicator heartbeat, or '' when no turn is active. */
4
5
  function busyElapsedLabel(startedAt) {
@@ -11,18 +12,19 @@ function busyElapsedLabel(startedAt) {
11
12
  * Busy state with a one-second heartbeat. The tick re-renders the elapsed-time
12
13
  * label so the developer always sees rolling activity even when the model is
13
14
  * thinking with no streamed output and no tool is running (the "looks stuck"
14
- * problem). Extracted from ChatScreen alongside BusyBar.
15
+ * problem). Extracted from ChatScreen alongside BusyBar. The heartbeat rides
16
+ * Ink 8's shared animation timer so every animated component (spinners,
17
+ * elapsed labels) consolidates into one render cycle under maxFps.
15
18
  */
16
19
  export function useBusyIndicator() {
17
20
  const [busy, setBusyState] = useState(false);
18
21
  const turnStartedAtRef = useRef(undefined);
19
- const [, setBusyTick] = useState(0);
20
- useEffect(() => {
21
- if (!busy)
22
- return;
23
- const heartbeat = setInterval(() => setBusyTick(tick => tick + 1), 1000);
24
- return () => clearInterval(heartbeat);
25
- }, [busy]);
22
+ const screenReader = useIsScreenReaderEnabled();
23
+ // Whole-second elapsed labels: one shared-timer frame per second is enough.
24
+ // Screen-reader mode keeps the elapsed text static between turns instead
25
+ // of announcing a re-render every second. The animation state update itself
26
+ // re-renders this component, refreshing the elapsed label below.
27
+ useAnimation({ interval: 1000, isActive: busy && !screenReader });
26
28
  function setBusy(nextBusy) {
27
29
  if (nextBusy && !busy)
28
30
  turnStartedAtRef.current = Date.now();
@@ -15,7 +15,7 @@ export declare function statusBarMetrics(input: {
15
15
  enabledSkillCount: number;
16
16
  backgroundProcessCount?: number;
17
17
  }): {
18
- hazeMessages: number;
18
+ assistantMessages: number;
19
19
  toolsUsed: number;
20
20
  effectiveInput: number;
21
21
  effectiveOutput: number;
@@ -45,7 +45,7 @@ export function estimateConversationTokens(messages) {
45
45
  /** Status-bar numbers for the transcript, extracted so render stays declarative (CR-006). */
46
46
  export function statusBarMetrics(input) {
47
47
  const { messages, tokenUsage, enabledSkillCount } = input;
48
- const hazeMessages = messages.filter(message => message.role === 'assistant' && !message.hidden).length;
48
+ const assistantMessages = messages.filter(message => message.role === 'assistant' && !message.hidden).length;
49
49
  const toolsUsed = toolCallCount(messages);
50
50
  const fallbackTokens = estimateConversationTokens(messages);
51
51
  const estimatedLogicalInput = tokenUsage.logicalInputEstimate || fallbackTokens.input || 0;
@@ -55,7 +55,7 @@ export function statusBarMetrics(input) {
55
55
  const inputEstimated = providerInput == null || effectiveInput !== providerInput;
56
56
  const outputEstimated = tokenUsage.outputTokens == null;
57
57
  const backgroundLabel = input.backgroundProcessCount ? ` / ⏵ ${input.backgroundProcessCount} bg` : '';
58
- const statusDetailLabel = `${hazeMessages} haze message${hazeMessages === 1 ? '' : 's'} / ${toolsUsed} tool call${toolsUsed === 1 ? '' : 's'} / LLM ${inputEstimated ? '~' : ''}↑${formatTokenCount(effectiveInput)} ${outputEstimated ? '~' : ''}↓${formatTokenCount(effectiveOutput)} / ${enabledSkillCount} skill${enabledSkillCount === 1 ? '' : 's'}${backgroundLabel}`;
58
+ const statusDetailLabel = `${assistantMessages} message${assistantMessages === 1 ? '' : 's'} / ${toolsUsed} tool calls / LLM ${inputEstimated ? '~' : ''}↑${formatTokenCount(effectiveInput)} ${outputEstimated ? '~' : ''}↓${formatTokenCount(effectiveOutput)} / ${enabledSkillCount} skill${enabledSkillCount === 1 ? '' : 's'}${backgroundLabel}`;
59
59
  const hasTokenBreakdown = tokenUsage.systemPrompt > 0 || tokenUsage.messages > 0 || tokenUsage.toolSchemas > 0 || effectiveInput > 0 || effectiveOutput > 0;
60
- return { hazeMessages, toolsUsed, effectiveInput, effectiveOutput, inputEstimated, outputEstimated, statusDetailLabel, hasTokenBreakdown };
60
+ return { assistantMessages, toolsUsed, effectiveInput, effectiveOutput, inputEstimated, outputEstimated, statusDetailLabel, hasTokenBreakdown };
61
61
  }
@@ -8,13 +8,17 @@ const CHAT_COMMAND_SUGGESTIONS = [
8
8
  { value: '/mcp', description: 'Manage MCP servers (Context7, etc.)', kind: 'command' },
9
9
  { value: '/settings', description: 'Show provider, model, API key, and context status', kind: 'command' },
10
10
  { value: '/themes', description: 'Choose a terminal theme (light palettes and oh-my-zsh ports included)', kind: 'command' },
11
+ { value: '/reasoning', description: 'Set reasoning effort for the active model, this session (none…xhigh), unset, or reset', kind: 'command' },
12
+ { value: '/thinking', description: 'Alias for /reasoning. Set reasoning effort for the active model, this session', kind: 'command' },
11
13
  { value: '/context', description: 'Show token breakdown of system, tools, MCP, and messages', kind: 'command' },
12
14
  { value: '/skills', description: 'Manage Markdown skills (add, enable/disable, validate, remove)', kind: 'command' },
15
+ { value: '/tips', description: 'Toggle the rotating tips shown while the model is thinking', kind: 'command' },
13
16
  { value: '/fleet ', description: 'Parallelize independent work in disposable contexts (flags: --review/--profile/--workers/--concurrency)', kind: 'command' },
14
17
  { value: '/init', description: 'Create or update AGENTS.md project instructions', kind: 'command' },
15
18
  { value: '/session', description: 'Show current session path', kind: 'command' },
16
19
  { value: '/resume', description: 'Browse saved sessions for this workspace', kind: 'command' },
17
20
  { value: '/new', description: 'Start a new session', kind: 'command' },
21
+ { value: '/logs', description: 'List recent LLM logs, or summarize one by id (--debug runs only)', kind: 'command' },
18
22
  { value: '/compact ', description: 'Summarize older context and keep recent messages', kind: 'command' },
19
23
  { value: '/clear', description: 'Clear conversation history', kind: 'command' },
20
24
  { value: '/exit', description: 'Exit haze', kind: 'command' },
@@ -0,0 +1,36 @@
1
+ import type { Message } from '../commands/streaming.js';
2
+ /**
3
+ * The dynamic live tail: streaming messages shown below the append-only
4
+ * `<Static>` transcript (streamed assistant text and the active tool group).
5
+ *
6
+ * The tail is a synchronous ref-first store, not plain React state: agent
7
+ * callbacks (addMessage → message_update deltas → the finalizing update that
8
+ * flips `streaming: false`) routinely arrive back-to-back inside one React
9
+ * batch window — a fast or buffered model stream never yields to the scheduler
10
+ * between them. If `liveMessagesRef` were written only inside the state
11
+ * updater, routing decisions made during the burst would read a stale tail:
12
+ * deltas would be dropped and the finalize would misroute, stranding a
13
+ * truncated streaming fragment in the tail forever. Mutations therefore
14
+ * advance the ref immediately (synchronously visible to the next callback)
15
+ * and mirror into state purely for rendering.
16
+ */
17
+ export declare function useLiveMessages(finalizeMessage: (message: Message) => void): {
18
+ liveMessages: Message[];
19
+ liveMessagesRef: import("react").RefObject<Message[]>;
20
+ addStreaming: (message: Message) => void;
21
+ patch: (id: string, update: Partial<Message>) => {
22
+ id?: string;
23
+ role: "system" | "user" | "assistant" | "tool";
24
+ text: string;
25
+ streaming?: boolean;
26
+ hidden?: boolean;
27
+ startedAt?: number;
28
+ finishedAt?: number;
29
+ tokensPerSecond?: number;
30
+ displayOrder?: number;
31
+ toolCount?: number;
32
+ toolDiffs?: import("../commands/streaming/toolGroupRenderer.js").ToolDisplayDiff[];
33
+ } | undefined;
34
+ drain: (finalize?: (message: Message) => void) => void;
35
+ clear: () => void;
36
+ };
@@ -0,0 +1,64 @@
1
+ import { useRef, useState } from 'react';
2
+ /**
3
+ * The dynamic live tail: streaming messages shown below the append-only
4
+ * `<Static>` transcript (streamed assistant text and the active tool group).
5
+ *
6
+ * The tail is a synchronous ref-first store, not plain React state: agent
7
+ * callbacks (addMessage → message_update deltas → the finalizing update that
8
+ * flips `streaming: false`) routinely arrive back-to-back inside one React
9
+ * batch window — a fast or buffered model stream never yields to the scheduler
10
+ * between them. If `liveMessagesRef` were written only inside the state
11
+ * updater, routing decisions made during the burst would read a stale tail:
12
+ * deltas would be dropped and the finalize would misroute, stranding a
13
+ * truncated streaming fragment in the tail forever. Mutations therefore
14
+ * advance the ref immediately (synchronously visible to the next callback)
15
+ * and mirror into state purely for rendering.
16
+ */
17
+ export function useLiveMessages(finalizeMessage) {
18
+ const [liveMessages, setLiveMessages] = useState([]);
19
+ const liveMessagesRef = useRef([]);
20
+ function commit(next) {
21
+ liveMessagesRef.current = next;
22
+ setLiveMessages(next);
23
+ }
24
+ /** Add a streaming message to the tail. */
25
+ function addStreaming(message) {
26
+ commit([...liveMessagesRef.current, message]);
27
+ }
28
+ /** Patch one live message by id (deltas keep it streaming). */
29
+ function patch(id, update) {
30
+ const liveMessage = liveMessagesRef.current.find(message => message.id === id);
31
+ if (!liveMessage)
32
+ return undefined;
33
+ const updated = { ...liveMessage, ...update };
34
+ if (updated.streaming === false) {
35
+ commit(liveMessagesRef.current.filter(message => message.id !== id));
36
+ finalizeMessage(updated);
37
+ return updated;
38
+ }
39
+ commit(liveMessagesRef.current.map(message => message.id === id ? updated : message));
40
+ return updated;
41
+ }
42
+ /**
43
+ * Settle every still-streaming message at a turn boundary. Aborted or
44
+ * forcibly settled attempts are quarantined before they can emit the
45
+ * finalizing update, so any message left streaming here would otherwise
46
+ * strand in the dynamic tail forever. Finalized text is preserved verbatim;
47
+ * nothing is lost, it just stops being dynamic.
48
+ */
49
+ function drain(finalize = finalizeMessage) {
50
+ const stranded = liveMessagesRef.current.filter(message => message.streaming);
51
+ if (stranded.length === 0)
52
+ return;
53
+ commit(liveMessagesRef.current.filter(message => !message.streaming));
54
+ for (const message of stranded)
55
+ finalize({ ...message, streaming: false });
56
+ }
57
+ /** Drop the tail (clear/new-session). */
58
+ function clear() {
59
+ if (liveMessagesRef.current.length === 0)
60
+ return;
61
+ commit([]);
62
+ }
63
+ return { liveMessages, liveMessagesRef, addStreaming, patch, drain, clear };
64
+ }
@@ -33,7 +33,7 @@ export function clampTextTail(text, width, maxLines) {
33
33
  const total = rows.reduce((sum, count) => sum + count, 0);
34
34
  if (total <= maxLines)
35
35
  return { text, hiddenLineCount: 0 };
36
- const visibleBudget = Math.max(1, maxLines - 1); // reserve the indicator row
36
+ const visibleBudget = Math.max(0, maxLines - 1); // reserve the indicator row
37
37
  let used = 0;
38
38
  let start = logical.length;
39
39
  while (start > 0) {