@denizokcu/haze 1.4.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +48 -1
- package/README.md +28 -12
- package/SECURITY.md +1 -1
- package/dist/buildInfo.json +3 -3
- package/dist/cli/chat/BusyBar.d.ts +7 -0
- package/dist/cli/chat/BusyBar.js +8 -0
- package/dist/cli/chat/DynamicFrame.d.ts +37 -0
- package/dist/cli/chat/DynamicFrame.js +48 -0
- package/dist/cli/chat/busyIndicator.d.ts +3 -1
- package/dist/cli/chat/busyIndicator.js +11 -9
- package/dist/cli/chat/chatMetrics.d.ts +1 -1
- package/dist/cli/chat/chatMetrics.js +3 -3
- package/dist/cli/chat/inputSuggestions.js +2 -1
- package/dist/cli/chat/liveRegion.js +1 -1
- package/dist/cli/chat/messages.js +27 -16
- package/dist/cli/chat/resizeGuard.d.ts +20 -0
- package/dist/cli/chat/resizeGuard.js +25 -0
- package/dist/cli/chat/sessionLifecycle.d.ts +3 -1
- package/dist/cli/chat/sessionLifecycle.js +13 -2
- package/dist/cli/chat/sessionRecorder.d.ts +2 -1
- package/dist/cli/chat/sessionRecorder.js +8 -0
- package/dist/cli/chat/shutdown.d.ts +27 -0
- package/dist/cli/chat/shutdown.js +79 -0
- package/dist/cli/chat/terminalControl.d.ts +45 -0
- package/dist/cli/chat/terminalControl.js +107 -0
- package/dist/cli/chat/tips.js +1 -0
- package/dist/cli/chat/userInput.d.ts +43 -0
- package/dist/cli/chat/userInput.js +63 -0
- package/dist/cli/chat/wizard/sessionThemeHandlers.js +14 -6
- package/dist/cli/chat/wizard/types.d.ts +8 -1
- package/dist/cli/chat/wizardDispatch.js +1 -1
- package/dist/cli/commands/chat.js +258 -172
- package/dist/cli/commands/commandHelp.js +6 -2
- package/dist/cli/commands/commands.d.ts +8 -0
- package/dist/cli/commands/commands.js +11 -0
- package/dist/cli/commands/formatters.d.ts +1 -1
- package/dist/cli/commands/formatters.js +20 -2
- package/dist/cli/commands/logsCommand.js +21 -2
- package/dist/cli/commands/reasoningCommand.d.ts +23 -14
- package/dist/cli/commands/reasoningCommand.js +53 -20
- package/dist/cli/commands/runCommand.js +19 -11
- package/dist/cli/commands/streaming/attemptOutcome.d.ts +2 -0
- package/dist/cli/commands/streaming/attemptOutcome.js +11 -6
- package/dist/cli/commands/streaming/attemptSetup.d.ts +1 -0
- package/dist/cli/commands/streaming/attemptSetup.js +11 -5
- package/dist/cli/commands/streaming/goalCheckpoint.d.ts +8 -1
- package/dist/cli/commands/streaming/goalCheckpoint.js +3 -2
- package/dist/cli/commands/streaming/goalSupervisor.d.ts +4 -0
- package/dist/cli/commands/streaming/goalSupervisor.js +43 -7
- package/dist/cli/commands/streaming/prepareStep.js +7 -3
- package/dist/cli/commands/streaming/streamLoop.d.ts +5 -0
- package/dist/cli/commands/streaming/streamLoop.js +3 -0
- package/dist/cli/commands/streaming/toolPartHandlers.js +6 -0
- package/dist/cli/commands/streaming.d.ts +1 -1
- package/dist/cli/commands/streaming.js +23 -17
- package/dist/cli/commands/wizardFlow.d.ts +5 -2
- package/dist/cli/commands/wizardFlow.js +17 -10
- package/dist/cli/index.js +17 -1
- package/dist/config/contextFiles.d.ts +9 -0
- package/dist/config/contextFiles.js +21 -1
- package/dist/config/modelCatalog.d.ts +3 -0
- package/dist/config/modelCatalog.js +29 -0
- package/dist/config/providerPresets.d.ts +1 -1
- package/dist/config/providerPresets.js +42 -3
- package/dist/config/settings.d.ts +11 -4
- package/dist/config/settings.js +9 -0
- package/dist/core/agent/budgets.d.ts +13 -15
- package/dist/core/agent/budgets.js +15 -17
- package/dist/core/agent/completionController.d.ts +6 -2
- package/dist/core/agent/completionController.js +16 -3
- package/dist/core/agent/goalPolicy.d.ts +10 -0
- package/dist/core/agent/goalPolicy.js +44 -6
- package/dist/core/agent/projectPreflight.d.ts +2 -0
- package/dist/core/agent/projectPreflight.js +56 -0
- package/dist/core/agent/reasoningPolicy.d.ts +34 -4
- package/dist/core/agent/reasoningPolicy.js +27 -4
- package/dist/core/agent/workState.d.ts +8 -0
- package/dist/core/agent/workState.js +191 -8
- package/dist/core/providerContracts.d.ts +32 -0
- package/dist/core/providerContracts.js +1 -0
- package/dist/core/session/sessionReport.d.ts +33 -0
- package/dist/core/session/sessionReport.js +121 -0
- package/dist/core/session/sessionSlimming.js +9 -3
- package/dist/core/session/sessionStore.d.ts +12 -0
- package/dist/core/session/sessionStore.js +20 -4
- package/dist/core/subagent/contracts.d.ts +3 -25
- package/dist/core/subagent/executionProfiles.js +4 -4
- package/dist/core/validation/outputParser.d.ts +6 -1
- package/dist/core/validation/outputParser.js +6 -2
- package/dist/llm/client.d.ts +4 -2
- package/dist/llm/client.js +44 -16
- package/dist/llm/hazeTools.d.ts +8553 -8550
- package/dist/llm/hazeTools.js +6 -503
- package/dist/llm/lspTools.d.ts +120 -120
- package/dist/llm/mcp.js +3 -0
- package/dist/llm/requestContext.d.ts +1 -1
- package/dist/llm/requestContext.js +1 -1
- package/dist/{core/subagent → llm}/subagentRunner.d.ts +9 -9
- package/dist/{core/subagent → llm}/subagentRunner.js +22 -25
- package/dist/llm/systemPrompt.d.ts +11 -1
- package/dist/llm/systemPrompt.js +2 -11
- package/dist/llm/tools/fetchTool.d.ts +30 -30
- package/dist/llm/tools/fileTools.d.ts +7768 -0
- package/dist/llm/tools/fileTools.js +510 -0
- package/dist/llm/tools/processTool.d.ts +30 -30
- package/dist/llm/tools/shellTool.d.ts +30 -30
- package/dist/llm/tools/shellTool.js +8 -4
- package/dist/llm/tools/toolContext.d.ts +3 -32
- package/dist/llm/tools/toolContext.js +33 -52
- package/dist/llm/tools/toolContextState.d.ts +40 -0
- package/dist/llm/tools/toolContextState.js +34 -0
- package/dist/llm/workerContext.d.ts +7 -0
- package/dist/llm/workerContext.js +18 -1
- package/dist/skills/SkillLoader.js +3 -3
- package/dist/skills/SkillRegistry.js +3 -3
- package/dist/skills/builder/SkillBuilder.js +3 -3
- package/dist/skills/confinement.d.ts +7 -0
- package/dist/skills/confinement.js +15 -0
- package/dist/ui/codeHighlight.js +4 -4
- package/dist/ui/components/MarkdownText.js +7 -8
- package/dist/ui/components/NativeIndicators.d.ts +15 -0
- package/dist/ui/components/NativeIndicators.js +32 -0
- package/dist/ui/components/StreamingMarkdownText.d.ts +9 -0
- package/dist/ui/components/StreamingMarkdownText.js +38 -0
- package/dist/ui/components/TextInput.d.ts +7 -2
- package/dist/ui/components/TextInput.js +103 -46
- package/dist/ui/components/WizardChoices.d.ts +18 -0
- package/dist/ui/components/WizardChoices.js +32 -0
- package/dist/ui/inputBuffer.js +12 -6
- package/dist/ui/textGeometry.d.ts +14 -0
- package/dist/ui/textGeometry.js +31 -0
- package/package.json +14 -13
- /package/dist/cli/{contextReport.d.ts → contextReportCli.d.ts} +0 -0
- /package/dist/cli/{contextReport.js → contextReportCli.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,53 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
##
|
|
3
|
+
## 1.5.1 - 2026-10-07
|
|
4
|
+
|
|
5
|
+
Terminal transcript replay on resize and capability-aware reasoning effort.
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- On terminal width changes, clear the viewport and replay the full settled transcript, including formatted Markdown, at the new width. Only `<Static>` remounts: input drafts and active turns retain their state. Scrollback is not erased, so earlier transcript copies can remain there after replay.
|
|
10
|
+
- Size the dynamic frame against the live Yoga root during Ink's synchronous resize pass, avoiding stale numeric widths before React commits the new terminal dimensions.
|
|
11
|
+
- Gate reasoning effort by endpoint capability. Explicit provider `capabilities.reasoningEffort` overrides win; otherwise local inference endpoints omit the parameter and hosted OpenAI-compatible endpoints retain SDK pass-through. Omission avoids local servers coercing unsupported levels into an enabled reasoning switch; their own default still applies.
|
|
12
|
+
- Match the pinned OpenAI SDK's GPT-6+ restrictions: omit `minimal`, and omit `none` except for exactly `gpt-6-sol` and `gpt-6-luna`. Unsupported choices use the provider default rather than being promoted to another effort; reasoning-policy events explain the omission.
|
|
13
|
+
|
|
14
|
+
### Documentation
|
|
15
|
+
|
|
16
|
+
- Refresh release metadata, README, public documentation, and scoped AGENTS guidance for 1.5.1; correct session-only reasoning semantics, the `medium` default, and formatted streaming/resize behavior.
|
|
17
|
+
|
|
18
|
+
## 1.5.0 - 2026-10-04
|
|
19
|
+
|
|
20
|
+
Ink 8 terminal modernization with formatted streamed Markdown, per-model session-scoped reasoning, model steering for compact models, and pinned session model selections.
|
|
21
|
+
|
|
22
|
+
### Added
|
|
23
|
+
|
|
24
|
+
- 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.
|
|
25
|
+
- `/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`).
|
|
26
|
+
- 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.
|
|
27
|
+
- `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.
|
|
28
|
+
- `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.
|
|
29
|
+
- 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.
|
|
30
|
+
- 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.
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
|
|
34
|
+
- 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.
|
|
35
|
+
- 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.
|
|
36
|
+
- 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.
|
|
37
|
+
- 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.
|
|
38
|
+
- 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.
|
|
39
|
+
- 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.
|
|
40
|
+
- 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.
|
|
41
|
+
- 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.
|
|
42
|
+
- Refreshed the model catalog and provider preset limits; runtime and development dependencies upgraded.
|
|
43
|
+
|
|
44
|
+
### Fixed
|
|
45
|
+
|
|
46
|
+
- 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.
|
|
47
|
+
- 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.
|
|
48
|
+
- 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.
|
|
49
|
+
- 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.
|
|
50
|
+
- 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.
|
|
4
51
|
|
|
5
52
|
## 1.4.0 - 2026-09-24
|
|
6
53
|
|
package/README.md
CHANGED
|
@@ -2,19 +2,28 @@
|
|
|
2
2
|
|
|
3
3
|
A minimal LLM harness for your terminal.
|
|
4
4
|
|
|
5
|
-
## What's new in 1.
|
|
5
|
+
## What's new in 1.5.1
|
|
6
6
|
|
|
7
|
-
haze 1.
|
|
7
|
+
haze 1.5.1 improves terminal resizing and reasoning-effort compatibility:
|
|
8
8
|
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
- On terminal width changes, haze replays the full settled transcript, including formatted Markdown, at the new width. The input draft and active turn stay mounted. Terminal scrollback is preserved, so older transcript copies can remain there after a replay.
|
|
10
|
+
- Local inference endpoints omit reasoning effort by default; providers can explicitly enable or disable it with `capabilities.reasoningEffort`. Hosted OpenAI-compatible endpoints retain pass-through behavior.
|
|
11
|
+
- Unsupported `none`/`minimal` choices for GPT-6+ model names are omitted rather than promoted to a different effort; the provider default applies.
|
|
12
|
+
|
|
13
|
+
### Highlights from 1.5.0
|
|
14
|
+
|
|
15
|
+
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`.
|
|
16
|
+
|
|
17
|
+
- 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.
|
|
18
|
+
- 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.
|
|
19
|
+
- 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.
|
|
20
|
+
- 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.
|
|
21
|
+
- `haze report [id] [--json]`: goal outcomes, tool/validation counts, context size, and evidence mismatches from session metadata — never prompts, commands, paths, or tool output.
|
|
22
|
+
- 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.
|
|
15
23
|
|
|
16
24
|
Previous releases:
|
|
17
25
|
|
|
26
|
+
- `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.
|
|
18
27
|
- `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.
|
|
19
28
|
- `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.
|
|
20
29
|
- `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.
|
|
@@ -86,6 +95,8 @@ On first run, create or choose a provider, then choose your first model:
|
|
|
86
95
|
/model local:llama3.1
|
|
87
96
|
```
|
|
88
97
|
|
|
98
|
+
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.
|
|
99
|
+
|
|
89
100
|
### MCP servers
|
|
90
101
|
|
|
91
102
|
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.
|
|
@@ -103,7 +114,9 @@ Saved settings live in `~/.haze/settings.json`. ChatGPT OAuth credentials live s
|
|
|
103
114
|
|
|
104
115
|
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.
|
|
105
116
|
|
|
106
|
-
Control reasoning effort with `/reasoning
|
|
117
|
+
Control reasoning effort with `/reasoning` (alias `/thinking`). The picker or `/reasoning <level>` sets `none`, `minimal`, `low`, `medium`, `high`, or `xhigh` for the active model in this session; it never writes settings. `/reasoning unset` omits the parameter, `/reasoning reset` drops the session override, and `/reasoning status` explains the current choice. Resolution follows run-scoped `--reasoning` → per-model session override → saved global `reasoning` setting → built-in default `medium`. The level travels as the AI SDK's portable `reasoning` parameter from the next turn and appears beside the model in the status bar.
|
|
118
|
+
|
|
119
|
+
Reasoning effort is capability-gated: `capabilities.reasoningEffort: true|false` on a provider explicitly enables or disables sending it. Without an override, local inference endpoints recognized by haze (`localhost`, `127.0.0.1`, `::1`, `0.0.0.0`, and `.local` hosts) omit it; hosted endpoints retain pass-through behavior. This avoids local servers interpreting unsupported levels as reasoning being enabled. Omission leaves the server's own default in control; it does not guarantee reasoning is off. For bare GPT-6+ model names, `minimal` is omitted, and `none` is omitted except for exactly `gpt-6-sol` and `gpt-6-luna`; unsupported choices are never silently promoted. The `reasoning_policy` stream event reports the effective policy.
|
|
107
120
|
|
|
108
121
|
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.
|
|
109
122
|
|
|
@@ -115,7 +128,7 @@ Open a project and ask for work:
|
|
|
115
128
|
create a calculator in calc-app in ruby with add subtract multiply divide
|
|
116
129
|
```
|
|
117
130
|
|
|
118
|
-
haze can inspect and edit files, fetch public URLs, and run commands. Tool activity stays compact in the transcript.
|
|
131
|
+
haze can inspect and edit files, fetch public URLs, and run commands. Tool activity stays compact in the transcript. Settled transcript entries normally render once as static terminal output, keeping typing, live model output, and spinner updates from repainting the full history. Streaming Markdown remains formatted: parser-stable root blocks move into static history while the final, still-changing block stays in the bounded dynamic tail. On a terminal width change, haze clears the viewport and replays the full static transcript with fresh Markdown layout; the draft and running turn keep their state. This does not erase scrollback, which may retain earlier transcript copies. Small edits show a colorized diff with one line of context on either side; large diffs get a short summary instead. Shell output is capped while the command runs, then filtered according to the command type. Validation failures keep the useful diagnostics. Raw output handles have per-entry and total memory limits, and tell you how many bytes were dropped. Sessions are saved after their first resumable message, so you can pick up the latest workspace conversation with `haze --continue` or `/resume` without accumulating empty session files.
|
|
119
132
|
|
|
120
133
|
The agent can start up to five dev servers or watchers as registered background processes. Their rolling output is capped at 256 KB and remains available through `readToolOutput`; the `process` tool lists, reads, and kills them. The status bar shows the live count. Starting a new session or exiting haze terminates every registered process tree, while aborting an individual turn leaves background work running. Background processes are unavailable inside fleet workers and never survive haze itself.
|
|
121
134
|
|
|
@@ -217,7 +230,7 @@ When you catch yourself repeating the same instructions, put them in a skill. Th
|
|
|
217
230
|
/settings open
|
|
218
231
|
/themes
|
|
219
232
|
/themes <name>
|
|
220
|
-
/reasoning [level|unset|status]
|
|
233
|
+
/reasoning [level|unset|reset|status]
|
|
221
234
|
/logs [id]
|
|
222
235
|
/lsp
|
|
223
236
|
/mcp
|
|
@@ -395,12 +408,15 @@ Use `AGENTS.md` for project conventions, commands, architecture notes, and anyth
|
|
|
395
408
|
|
|
396
409
|
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.
|
|
397
410
|
|
|
411
|
+
- `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.
|
|
412
|
+
- `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.
|
|
398
413
|
- `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`.
|
|
399
414
|
- `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.
|
|
400
415
|
- `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.
|
|
401
416
|
- `manualCompaction` (`"llm-summary"` default, or `"heuristic"`): whether manual `/compact` asks the active model for a continuity summary or keeps the model-free bounded excerpt.
|
|
402
417
|
- `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.
|
|
403
|
-
- `reasoning` (`"none"` | `"minimal"` | `"low"` | `"medium"` | `"high"` | `"xhigh"` | `"provider-default"`, default `
|
|
418
|
+
- `reasoning` (`"none"` | `"minimal"` | `"low"` | `"medium"` | `"high"` | `"xhigh"` | `"provider-default"`, default `medium`): saved global fallback for the portable reasoning parameter. Run-scoped and per-model session choices take precedence. The `provider-default` sentinel omits the parameter; `/reasoning` changes only the in-memory session choice.
|
|
419
|
+
- `providers[].capabilities.reasoningEffort` (optional boolean): explicitly allow or omit reasoning effort for that provider. Without it, local inference endpoints omit the parameter and hosted OpenAI-compatible endpoints pass it through, subject to model-specific restrictions.
|
|
404
420
|
|
|
405
421
|
## Safety model
|
|
406
422
|
|
package/SECURITY.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
| Version | Supported |
|
|
6
6
|
|---------|-----------|
|
|
7
|
-
| Latest minor (`1.
|
|
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/dist/buildInfo.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@denizokcu/haze",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"commit": "
|
|
5
|
-
"builtAt": "2026-
|
|
3
|
+
"version": "1.5.1",
|
|
4
|
+
"commit": "d77c53f3eea3bec1757d583bc5a8e80cfd9fc3a2",
|
|
5
|
+
"builtAt": "2026-10-07T21:45:47.260Z",
|
|
6
6
|
"sourceRoot": "/Users/deniz.okcu/development/haze"
|
|
7
7
|
}
|
|
@@ -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,48 @@
|
|
|
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
|
+
// Percentage width resolves against the Yoga root at layout time, so the
|
|
43
|
+
// frame follows the live terminal width even in Ink v8's synchronous
|
|
44
|
+
// resize render of the stale React tree, where an explicit numeric width
|
|
45
|
+
// stays stale-wide and soft-wraps (see tests/cli/chat/resizeBoundary.test.tsx).
|
|
46
|
+
// maxWidth keeps the columns prop authoritative for standalone embeds.
|
|
47
|
+
return _jsxs(Box, { flexDirection: "column", width: "100%", maxWidth: 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 })] });
|
|
48
|
+
}
|
|
@@ -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 {
|
|
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
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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();
|
|
@@ -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
|
|
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 = `${
|
|
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 {
|
|
60
|
+
return { assistantMessages, toolsUsed, effectiveInput, effectiveOutput, inputEstimated, outputEstimated, statusDetailLabel, hasTokenBreakdown };
|
|
61
61
|
}
|
|
@@ -8,7 +8,8 @@ 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
|
|
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' },
|
|
12
13
|
{ value: '/context', description: 'Show token breakdown of system, tools, MCP, and messages', kind: 'command' },
|
|
13
14
|
{ value: '/skills', description: 'Manage Markdown skills (add, enable/disable, validate, remove)', kind: 'command' },
|
|
14
15
|
{ value: '/tips', description: 'Toggle the rotating tips shown while the model is thinking', kind: 'command' },
|
|
@@ -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(
|
|
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) {
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { Box, Text } from 'ink';
|
|
4
|
-
import
|
|
4
|
+
import { ActivitySpinner } from '../../ui/components/NativeIndicators.js';
|
|
5
5
|
import { formatElapsedTime, formatElapsedTimeWhole } from '../../utils/format.js';
|
|
6
6
|
import { MarkdownText } from '../../ui/components/MarkdownText.js';
|
|
7
|
+
import { StreamingMarkdownText } from '../../ui/components/StreamingMarkdownText.js';
|
|
7
8
|
import { clampTextTail, wrapLine } from './liveRegion.js';
|
|
8
9
|
import { isSubstantiveAssistantText } from '../commands/streaming/assistantText.js';
|
|
9
10
|
import { theme } from '../../ui/theme.js';
|
|
11
|
+
import { cellWidth } from '../../ui/textGeometry.js';
|
|
10
12
|
import { highlightedCodeLine, languageForPath } from '../../ui/codeHighlight.js';
|
|
11
13
|
function fullWidthLines(text, width, leftPadding = 0) {
|
|
12
14
|
const safeWidth = Math.max(1, width);
|
|
13
15
|
const prefix = ' '.repeat(leftPadding);
|
|
14
|
-
return text.replace(/\r\n|\r/g, '\n').split('\n').map(line => `${prefix}${line}
|
|
16
|
+
return text.replace(/\r\n|\r/g, '\n').split('\n').map(line => `${prefix}${line}${' '.repeat(Math.max(0, safeWidth - cellWidth(line) - leftPadding))}`);
|
|
15
17
|
}
|
|
16
18
|
function fullWidthBlankLine(width) {
|
|
17
19
|
return ''.padEnd(Math.max(1, width));
|
|
@@ -95,10 +97,12 @@ const TOOL_ROW_PATTERN = /^(\s*)([✓✗…])\s+(\S+)(.*)$/;
|
|
|
95
97
|
* settings, see liveRegion.ts) and continuation rows are padded to align
|
|
96
98
|
* under the tool name instead of dropping back to the left edge.
|
|
97
99
|
*/
|
|
98
|
-
function toolGroupLineRows(line, width) {
|
|
100
|
+
function toolGroupLineRows(line, width, spinner = false) {
|
|
99
101
|
const match = TOOL_ROW_PATTERN.exec(line);
|
|
100
102
|
if (!match)
|
|
101
|
-
return
|
|
103
|
+
return spinner && width > 2
|
|
104
|
+
? wrapLine(line, width - 2).map(row => ` ${row}`)
|
|
105
|
+
: wrapLine(line, width);
|
|
102
106
|
const [, indent, icon, toolName, rest] = match;
|
|
103
107
|
const hang = indent.length + 2; // icon + separating space
|
|
104
108
|
const rows = wrapLine(`${toolName}${rest}`, Math.max(1, width - hang));
|
|
@@ -110,14 +114,14 @@ function toolGroupLineRows(line, width) {
|
|
|
110
114
|
* top and whole diff previews from the bottom, with one indicator row each.
|
|
111
115
|
* The finalized group still enters the static transcript verbatim.
|
|
112
116
|
*/
|
|
113
|
-
function clampToolDisplay({ text, width, toolDiffs, maxVisibleLines }) {
|
|
117
|
+
function clampToolDisplay({ text, width, toolDiffs, maxVisibleLines, streaming }) {
|
|
114
118
|
const allLines = text.split('\n');
|
|
115
119
|
const allDiffs = toolDiffs ?? [];
|
|
116
120
|
if (maxVisibleLines == null)
|
|
117
121
|
return { lines: allLines, hiddenTextRowCount: 0, visibleDiffs: allDiffs, hiddenDiffCount: 0 };
|
|
118
122
|
// Row counts must mirror toolGroupLineRows so the budget matches what is
|
|
119
123
|
// actually rendered (icon rows consume one extra hang indent column).
|
|
120
|
-
const rows = allLines.map(line => toolGroupLineRows(line, width).length);
|
|
124
|
+
const rows = allLines.map((line, index) => toolGroupLineRows(line, width, streaming && index === 0).length);
|
|
121
125
|
const total = rows.reduce((sum, count) => sum + count, 0);
|
|
122
126
|
let lines = allLines;
|
|
123
127
|
let hiddenTextRowCount = 0;
|
|
@@ -151,13 +155,16 @@ function clampToolDisplay({ text, width, toolDiffs, maxVisibleLines }) {
|
|
|
151
155
|
return { lines, hiddenTextRowCount, visibleDiffs, hiddenDiffCount: allDiffs.length - visibleDiffs.length };
|
|
152
156
|
}
|
|
153
157
|
function ToolMessageText({ text, streaming, width, toolDiffs, maxVisibleLines }) {
|
|
154
|
-
const clamped = clampToolDisplay({ text, width, toolDiffs, maxVisibleLines });
|
|
158
|
+
const clamped = clampToolDisplay({ text, width, toolDiffs, maxVisibleLines, streaming });
|
|
155
159
|
return _jsxs(Box, { flexDirection: "column", children: [clamped.hiddenTextRowCount > 0 ? _jsx(Text, { color: theme.muted, children: `⋯ +${clamped.hiddenTextRowCount} line${clamped.hiddenTextRowCount === 1 ? '' : 's'} above` }) : null, clamped.lines.flatMap((line, index) => {
|
|
156
160
|
const match = TOOL_ROW_PATTERN.exec(line);
|
|
157
161
|
if (!match) {
|
|
158
162
|
// Summary header / caption rows: plain muted rows (spinner on the
|
|
159
163
|
// first row while streaming).
|
|
160
|
-
|
|
164
|
+
const spinner = !!streaming && index === 0 && clamped.hiddenTextRowCount === 0 && width > 2;
|
|
165
|
+
return toolGroupLineRows(line, width, spinner).map((row, rowIndex) => spinner && rowIndex === 0
|
|
166
|
+
? _jsxs(Box, { width: width, overflow: "hidden", children: [_jsx(ActivitySpinner, { color: theme.muted }), _jsx(Box, { flexShrink: 0, width: 1 }), _jsx(Text, { color: theme.muted, wrap: "truncate-end", children: row.slice(2) })] }, `${index}-${rowIndex}`)
|
|
167
|
+
: _jsx(Text, { color: theme.muted, children: row }, `${index}-${rowIndex}`));
|
|
161
168
|
}
|
|
162
169
|
const [, indent, icon, toolName] = match;
|
|
163
170
|
const iconColor = icon === '✓' ? theme.success : icon === '✗' ? theme.danger : theme.muted;
|
|
@@ -193,19 +200,23 @@ export const AssistantMarkdownChunkView = React.memo(function AssistantMarkdownC
|
|
|
193
200
|
/** Streaming assistant tail clamped to the live-region budget; the full text enters the static transcript once the root settles. */
|
|
194
201
|
function StreamingClampedText({ text, width, maxVisibleLines }) {
|
|
195
202
|
const clamped = clampTextTail(text, width, maxVisibleLines);
|
|
196
|
-
return _jsxs(Box, { flexDirection: "column", children: [clamped.hiddenLineCount > 0 ? _jsx(Text, { color: theme.muted, children: `⋯ +${clamped.hiddenLineCount} line${clamped.hiddenLineCount === 1 ? '' : 's'} above` }) : null, _jsx(Text, { children: clamped.text })] });
|
|
203
|
+
return _jsxs(Box, { flexDirection: "column", children: [clamped.hiddenLineCount > 0 ? _jsx(Text, { color: theme.muted, wrap: "truncate-end", children: `⋯ +${clamped.hiddenLineCount} line${clamped.hiddenLineCount === 1 ? '' : 's'} above` }) : null, clamped.text || clamped.hiddenLineCount === 0 ? _jsx(Text, { children: clamped.text }) : null] });
|
|
197
204
|
}
|
|
198
205
|
export const MessageView = React.memo(function MessageView({ message, width, showHeader = true, maxVisibleLines }) {
|
|
206
|
+
if (maxVisibleLines != null && message.role !== 'tool') {
|
|
207
|
+
return _jsxs(Box, { flexDirection: "column", flexShrink: 0, maxHeight: maxVisibleLines + (showHeader ? 1 : 0), overflow: "hidden", children: [showHeader && _jsx(Text, { color: theme.muted, wrap: "truncate-end", children: message.role === 'assistant' ? 'haze' : message.role === 'user' ? 'You asked' : 'Info' }), message.role === 'assistant'
|
|
208
|
+
? _jsx(StreamingMarkdownText, { content: message.text, width: width, maxVisibleLines: maxVisibleLines })
|
|
209
|
+
: _jsx(StreamingClampedText, { text: message.text, width: width, maxVisibleLines: maxVisibleLines })] });
|
|
210
|
+
}
|
|
199
211
|
if (message.role === 'user') {
|
|
200
212
|
return _jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsx(Text, { backgroundColor: theme.surfaceBg, children: fullWidthBlankLine(width) }), _jsx(Text, { color: theme.success, bold: true, backgroundColor: theme.surfaceBg, children: ' You asked'.padEnd(width) }), fullWidthLines(message.text, width, 2).map((line, lineIndex) => _jsx(Text, { color: theme.foreground, backgroundColor: theme.surfaceBg, children: line }, lineIndex)), _jsx(Text, { backgroundColor: theme.surfaceBg, children: fullWidthBlankLine(width) })] });
|
|
201
213
|
}
|
|
202
214
|
return _jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [showHeader ? _jsxs(Text, { children: [_jsx(Text, { color: message.role === 'assistant' ? theme.accent : message.role === 'tool' ? theme.info : message.role === 'system' ? theme.success : theme.muted, bold: true, children: message.role === 'assistant' ? 'haze' : message.role === 'tool' ? 'Tool' : 'Info' }), messageElapsedLabel(message) ? _jsxs(Text, { color: theme.muted, bold: false, children: [" \u00B7 ", messageElapsedLabel(message)] }) : null] }) : null, message.role === 'tool'
|
|
203
|
-
? _jsx(ToolMessageText, { text: message.text, streaming: message.streaming, width: width, toolDiffs: message.toolDiffs, maxVisibleLines:
|
|
204
|
-
: message.role === 'assistant'
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
? _jsx(MarkdownText, { content: message.text, width: width })
|
|
215
|
+
? _jsx(ToolMessageText, { text: message.text, streaming: message.streaming, width: width, toolDiffs: message.toolDiffs, maxVisibleLines: maxVisibleLines })
|
|
216
|
+
: message.role === 'assistant'
|
|
217
|
+
? message.streaming
|
|
218
|
+
? _jsx(StreamingMarkdownText, { content: message.text, width: width })
|
|
219
|
+
: _jsx(MarkdownText, { content: message.text, width: width })
|
|
209
220
|
: message.role === 'system'
|
|
210
221
|
? _jsx(SystemMessageText, { text: message.text })
|
|
211
222
|
: message.streaming && maxVisibleLines != null
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Minimal TTY stdout shape for the resize guard (tests pass a fake stream). */
|
|
2
|
+
export interface ResizeGuardStream {
|
|
3
|
+
isTTY?: boolean;
|
|
4
|
+
columns?: number;
|
|
5
|
+
rows?: number;
|
|
6
|
+
on(event: 'resize', listener: () => void): unknown;
|
|
7
|
+
off(event: 'resize', listener: () => void): unknown;
|
|
8
|
+
write(chunk: string): unknown;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Clear the viewport on width changes before Ink's resize repaint. Pair this
|
|
12
|
+
* with a width-keyed <Static> in ChatScreen: clearing alone loses the visible
|
|
13
|
+
* transcript, whereas remounting Static re-renders the history and Markdown
|
|
14
|
+
* at the new width. The dynamic input stays mounted to preserve its draft.
|
|
15
|
+
*
|
|
16
|
+
* Register before render() so this listener precedes Ink's resize handler.
|
|
17
|
+
* This does not erase terminal scrollback; replay can leave earlier copies
|
|
18
|
+
* of the transcript there.
|
|
19
|
+
*/
|
|
20
|
+
export declare function installViewportResizeGuard(stream?: ResizeGuardStream): () => void;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const HOME_AND_ERASE_DOWN = '\u001B[H\u001B[J';
|
|
2
|
+
/**
|
|
3
|
+
* Clear the viewport on width changes before Ink's resize repaint. Pair this
|
|
4
|
+
* with a width-keyed <Static> in ChatScreen: clearing alone loses the visible
|
|
5
|
+
* transcript, whereas remounting Static re-renders the history and Markdown
|
|
6
|
+
* at the new width. The dynamic input stays mounted to preserve its draft.
|
|
7
|
+
*
|
|
8
|
+
* Register before render() so this listener precedes Ink's resize handler.
|
|
9
|
+
* This does not erase terminal scrollback; replay can leave earlier copies
|
|
10
|
+
* of the transcript there.
|
|
11
|
+
*/
|
|
12
|
+
export function installViewportResizeGuard(stream = process.stdout) {
|
|
13
|
+
if (!stream.isTTY)
|
|
14
|
+
return () => undefined;
|
|
15
|
+
let previousColumns = stream.columns;
|
|
16
|
+
const onResize = () => {
|
|
17
|
+
const { columns } = stream;
|
|
18
|
+
if (typeof columns === 'number' && columns !== previousColumns) {
|
|
19
|
+
stream.write(HOME_AND_ERASE_DOWN);
|
|
20
|
+
}
|
|
21
|
+
previousColumns = columns;
|
|
22
|
+
};
|
|
23
|
+
stream.on('resize', onResize);
|
|
24
|
+
return () => { stream.off('resize', onResize); };
|
|
25
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ModelMessage } from 'ai';
|
|
2
2
|
import type { ContextFile } from '../../config/contextFiles.js';
|
|
3
3
|
import type { WorkState } from '../../core/agent/workState.js';
|
|
4
|
-
import { type GoalLedgerFrontier, type HazeSession } from '../../core/session/sessionStore.js';
|
|
4
|
+
import { type GoalLedgerFrontier, type HazeSession, type SessionModelSelection } from '../../core/session/sessionStore.js';
|
|
5
5
|
import { type LlmLog } from '../../core/log/llmLog.js';
|
|
6
6
|
import type { Message } from '../commands/streaming.js';
|
|
7
7
|
import type { TokenUsage } from '../commands/streaming/turnRuntime.js';
|
|
@@ -24,6 +24,8 @@ export interface SessionLifecycleDeps {
|
|
|
24
24
|
noSession: boolean;
|
|
25
25
|
debug: boolean;
|
|
26
26
|
contextFiles: () => ContextFile[];
|
|
27
|
+
modelSelection?: () => SessionModelSelection | undefined;
|
|
28
|
+
onModelSelection?: (selection: SessionModelSelection | undefined) => void;
|
|
27
29
|
sessionRef: {
|
|
28
30
|
current: HazeSession | undefined;
|
|
29
31
|
};
|