@denizokcu/haze 0.6.0 → 0.8.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.
- package/CHANGELOG.md +42 -7
- package/README.md +81 -34
- package/dist/cli/chat/TaskBar.d.ts +9 -0
- package/dist/cli/chat/TaskBar.js +40 -0
- package/dist/cli/chat/chatMetrics.d.ts +11 -0
- package/dist/cli/chat/chatMetrics.js +50 -0
- package/dist/cli/chat/inputSuggestions.d.ts +16 -0
- package/dist/cli/chat/inputSuggestions.js +55 -0
- package/dist/cli/chat/messages.d.ts +9 -0
- package/dist/cli/chat/messages.js +76 -0
- package/dist/cli/chat/sessionRecorder.d.ts +12 -0
- package/dist/cli/chat/sessionRecorder.js +21 -0
- package/dist/cli/chat/startupInfo.d.ts +4 -0
- package/dist/cli/chat/startupInfo.js +53 -0
- package/dist/cli/chat/turnState.d.ts +5 -0
- package/dist/cli/chat/turnState.js +20 -0
- package/dist/cli/commands/chat.d.ts +0 -1
- package/dist/cli/commands/chat.js +331 -906
- package/dist/cli/commands/chatModes.d.ts +8 -0
- package/dist/cli/commands/chatModes.js +44 -0
- package/dist/cli/commands/commandHelp.d.ts +6 -0
- package/dist/cli/commands/commandHelp.js +25 -0
- package/dist/cli/commands/commands.d.ts +1 -1
- package/dist/cli/commands/commands.js +41 -267
- package/dist/cli/commands/formatters.d.ts +6 -0
- package/dist/cli/commands/formatters.js +50 -4
- package/dist/cli/commands/initCommand.d.ts +2 -0
- package/dist/cli/commands/initCommand.js +19 -0
- package/dist/cli/commands/logsCommand.d.ts +2 -0
- package/dist/cli/commands/logsCommand.js +63 -0
- package/dist/cli/commands/lspWizard.d.ts +14 -0
- package/dist/cli/commands/lspWizard.js +44 -0
- package/dist/cli/commands/mcpWizard.d.ts +15 -0
- package/dist/cli/commands/mcpWizard.js +69 -0
- package/dist/cli/commands/modelCommand.d.ts +2 -0
- package/dist/cli/commands/modelCommand.js +36 -0
- package/dist/cli/commands/providerWizard.d.ts +30 -0
- package/dist/cli/commands/providerWizard.js +114 -0
- package/dist/cli/commands/runCommand.d.ts +16 -0
- package/dist/cli/commands/runCommand.js +170 -0
- package/dist/cli/commands/settingsSummary.d.ts +3 -0
- package/dist/cli/commands/settingsSummary.js +40 -0
- package/dist/cli/commands/skillConfirmRemove.d.ts +11 -0
- package/dist/cli/commands/skillConfirmRemove.js +19 -0
- package/dist/cli/commands/skillCreation.d.ts +12 -0
- package/dist/cli/commands/skillCreation.js +14 -0
- package/dist/cli/commands/skillWizard.d.ts +15 -0
- package/dist/cli/commands/skillWizard.js +38 -0
- package/dist/cli/commands/streaming/assistantText.d.ts +17 -0
- package/dist/cli/commands/streaming/assistantText.js +115 -0
- package/dist/cli/commands/streaming/toolGroupRenderer.d.ts +55 -0
- package/dist/cli/commands/streaming/toolGroupRenderer.js +102 -0
- package/dist/cli/commands/streaming/toolResultState.d.ts +13 -0
- package/dist/cli/commands/streaming/toolResultState.js +25 -0
- package/dist/cli/commands/streaming/turnRuntime.d.ts +78 -0
- package/dist/cli/commands/streaming/turnRuntime.js +86 -0
- package/dist/cli/commands/streaming.d.ts +9 -25
- package/dist/cli/commands/streaming.js +109 -363
- package/dist/cli/commands/wizardActions.d.ts +40 -0
- package/dist/cli/commands/wizardActions.js +40 -0
- package/dist/cli/commands/wizardInput.d.ts +4 -0
- package/dist/cli/commands/wizardInput.js +19 -0
- package/dist/cli/commands/wizardPrompts.d.ts +22 -0
- package/dist/cli/commands/wizardPrompts.js +52 -0
- package/dist/cli/commands/wizardSuggestions.d.ts +23 -0
- package/dist/cli/commands/wizardSuggestions.js +139 -0
- package/dist/cli/index.js +62 -4
- package/dist/config/contextFiles.d.ts +8 -1
- package/dist/config/contextFiles.js +25 -12
- package/dist/config/lspSettings.js +3 -6
- package/dist/config/mcpSettings.js +5 -5
- package/dist/config/providers.js +8 -12
- package/dist/config/settings.d.ts +1 -0
- package/dist/config/settings.js +54 -2
- package/dist/config/skillSettings.js +4 -3
- package/dist/core/agent/budgets.d.ts +6 -0
- package/dist/core/agent/budgets.js +6 -0
- package/dist/core/agent/compaction.js +3 -3
- package/dist/core/agent/errors.js +1 -1
- package/dist/core/agent/requestAssembly.d.ts +1 -7
- package/dist/core/agent/requestAssembly.js +40 -5
- package/dist/core/agent/toolOutputStore.js +5 -4
- package/dist/core/agent/toolResults.d.ts +31 -0
- package/dist/core/agent/toolResults.js +42 -0
- package/dist/core/agent/turnPolicy.d.ts +8 -0
- package/dist/core/agent/turnPolicy.js +23 -0
- package/dist/core/agent/workState.d.ts +18 -5
- package/dist/core/agent/workState.js +39 -20
- package/dist/core/bashOutput/reducers/content.d.ts +1 -0
- package/dist/core/bashOutput/reducers/content.js +1 -1
- package/dist/core/bashOutput/reducers/gh.d.ts +1 -0
- package/dist/core/bashOutput/reducers/gh.js +77 -0
- package/dist/core/bashOutput/registry.js +18 -8
- package/dist/core/goal/completionPolicy.js +1 -1
- package/dist/core/goal/sessionGoal.d.ts +6 -30
- package/dist/core/goal/sessionGoal.js +3 -68
- package/dist/core/safety/bashClassifier.js +30 -0
- package/dist/core/safety/urlGuard.d.ts +1 -0
- package/dist/core/safety/urlGuard.js +6 -1
- package/dist/core/session/sessionSlimming.d.ts +5 -0
- package/dist/core/session/sessionSlimming.js +78 -0
- package/dist/core/session/sessionStore.d.ts +23 -3
- package/dist/core/session/sessionStore.js +30 -10
- package/dist/core/subagent/subagentRunner.d.ts +258 -5
- package/dist/core/subagent/subagentRunner.js +14 -18
- package/dist/core/toolOutput/reduction.d.ts +2 -0
- package/dist/core/toolOutput/reduction.js +12 -0
- package/dist/core/validation/outputParser.js +5 -3
- package/dist/llm/capabilities.d.ts +12 -0
- package/dist/llm/capabilities.js +10 -0
- package/dist/llm/client.d.ts +3 -2
- package/dist/llm/client.js +26 -4
- package/dist/llm/hazeTools.d.ts +7710 -366
- package/dist/llm/hazeTools.js +46 -567
- package/dist/llm/initPrompt.js +1 -1
- package/dist/llm/lsp.d.ts +46 -1
- package/dist/llm/lsp.js +19 -10
- package/dist/llm/lspTools.d.ts +2310 -119
- package/dist/llm/mcp.js +9 -0
- package/dist/llm/requestContext.js +7 -22
- package/dist/llm/systemPrompt.d.ts +1 -0
- package/dist/llm/systemPrompt.js +3 -3
- package/dist/llm/tools/bashTool.d.ts +251 -0
- package/dist/llm/tools/bashTool.js +82 -0
- package/dist/llm/tools/editMatch.d.ts +55 -0
- package/dist/llm/tools/editMatch.js +99 -0
- package/dist/llm/tools/failures.d.ts +36 -0
- package/dist/llm/tools/failures.js +38 -0
- package/dist/llm/tools/fetchTool.d.ts +1201 -0
- package/dist/llm/tools/fetchTool.js +46 -0
- package/dist/llm/tools/fileToolShared.d.ts +10 -0
- package/dist/llm/tools/fileToolShared.js +43 -0
- package/dist/llm/tools/grepParse.d.ts +13 -0
- package/dist/llm/tools/grepParse.js +67 -0
- package/dist/llm/tools/outputCap.d.ts +53 -0
- package/dist/llm/tools/outputCap.js +67 -0
- package/dist/llm/tools/storedOutputTool.d.ts +351 -0
- package/dist/llm/tools/storedOutputTool.js +17 -0
- package/dist/llm/tools/taskTool.d.ts +629 -0
- package/dist/llm/tools/taskTool.js +41 -0
- package/dist/llm/tools/toolContext.d.ts +74 -0
- package/dist/llm/tools/toolContext.js +196 -0
- package/dist/llm/tools/workspaceFile.d.ts +33 -0
- package/dist/llm/tools/workspaceFile.js +27 -0
- package/dist/llm/webFetch.d.ts +13 -1
- package/dist/llm/webFetch.js +122 -28
- package/dist/skills/builder/SkillBuilder.d.ts +3 -0
- package/dist/skills/builder/SkillBuilder.js +8 -8
- package/dist/ui/components/TextInput.d.ts +7 -0
- package/dist/ui/components/TextInput.js +10 -98
- package/dist/ui/inputBuffer.d.ts +28 -0
- package/dist/ui/inputBuffer.js +99 -0
- package/dist/utils/collections.d.ts +6 -0
- package/dist/utils/collections.js +9 -0
- package/dist/utils/modelName.d.ts +2 -0
- package/dist/utils/modelName.js +15 -0
- package/dist/utils/path.d.ts +2 -0
- package/dist/utils/path.js +40 -0
- package/examples/skills/files/SKILL.md +1 -1
- package/package.json +14 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,45 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## Unreleased
|
|
4
|
+
|
|
5
|
+
## 0.8.0 - 2026-07-09
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- **Migrated the agent runtime to AI SDK v7.** The main `ToolLoopAgent` turn and subagent runner now use AI SDK v7 APIs while preserving haze's compact terminal rendering, turn-scoped tool state, loop guardrails, and scoped-context injection behavior.
|
|
10
|
+
- **Improved live busy feedback.** The interactive busy line now shows the active model name, a one-second elapsed-time heartbeat, and current tool activity labels such as reading, editing, searching, running commands, loading skills, querying LSP, or running MCP tools. Long model/tool gaps now visibly progress instead of looking frozen.
|
|
11
|
+
- **Bounded bash output processing.** Bash reducer paths now bound large output processing more aggressively before output enters the transcript/model context, keeping validation/search/log-heavy commands safer for long-running agent work.
|
|
12
|
+
- **Hardened core agent maintenance paths.** Tool context wiring, maintenance prompts, and related agent guidance were tightened for AI SDK v7 and current haze runtime behavior.
|
|
13
|
+
- **Standardized lowercase `haze` naming.** README, docs, prompts, skills, command help, tests, and agent guidance now consistently use lowercase `haze` for the product name.
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
|
|
17
|
+
- Fixed multiline input shortcut handling in the chat input.
|
|
18
|
+
- Kept model thinking labels concise without hiding useful slash-model suffixes such as reasoning variants.
|
|
19
|
+
- Compacted long file paths in live tool labels so the busy line stays readable.
|
|
20
|
+
|
|
21
|
+
## 0.7.0 - 2026-06-29
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- **`--output stream-json` for print mode.** `haze -p "…" --output stream-json` streams the run as newline-delimited JSON: public progress events (`turn_start`, `message_start`/`message_update`/`message_end`, `tool_start`/`tool_end`, `retry`, `context_overflow`, `turn_end`, each with an ISO-8601 `at` timestamp) are written to stdout as they happen, and the final line is the same `{type,status,result,usage}` envelope as `--output json`. Tool events omit raw inputs/outputs so captured stdout stays suitable for harness and CI logs. Previously print mode stayed silent until the end and emitted only that single envelope, so harnesses driving haze headlessly had no live progress and could not run stdout-based stagnation/loop detection on a silent-but-alive run. Every line is standalone valid JSON (pipeable through `jq -c .`). `text` and `json` outputs are unchanged.
|
|
26
|
+
- **Startup context visibility.** The interactive startup message now lists the context files sent with the system prompt, making it easier to verify whether global `CLAUDE.md`/`AGENTS.md` and workspace instructions were loaded.
|
|
27
|
+
|
|
28
|
+
### Changed
|
|
29
|
+
|
|
30
|
+
- **CLI print mode.** `haze -p "prompt"` runs a single non-interactive turn and prints the result, with optional `--model provider:name` override (per-run, no settings write) and `--output json` structured output. Reads the prompt from stdin when piped. The exit code and JSON `status` are driven by the agent's authoritative terminal state (`complete`/`aborted`/`failed`) rather than by parsing the reply, so CI gating on the exit code is reliable. A bad or ambiguous `--model` selector reports a precise error and exits non-zero, `--debug` writes a JSONL log under `~/.haze/logs/`, and the `--output json` `usage` object is pinned to a documented set of fields.
|
|
31
|
+
- **Scoped context refresh during turns.** Nested `CLAUDE.md`/`AGENTS.md` files discovered by file tools are injected into the next model step, tracked by signature, and reread when they change. Concurrent scoped-context discovery is serialized so unchanged instruction files are read once while still surfacing newly changed guidance.
|
|
32
|
+
- **Smaller durable session files.** Session persistence now drops streaming `message_update` events and slims large tool outputs/errors in persisted `tool_end` events and `conversation_snapshot` tool results to previews plus byte counts. Sessions remain resumable while avoiding runaway JSONL growth from repeated streamed text or large file reads.
|
|
33
|
+
|
|
34
|
+
### Security
|
|
35
|
+
|
|
36
|
+
- **Closed a DNS-rebinding TOCTOU in the `fetch` tool.** `urlGuard.validateUrl` resolved a hostname and confirmed every address was public, but the subsequent global `fetch` re-resolved the hostname at connect time, so an attacker-controlled DNS server could answer validation with a public IP and connect with an internal/cloud-metadata IP — fully bypassing the SSRF guard that exists precisely to stop that. `fetchUrlContent` now pins each connection (and each redirect hop) to the already-validated IP via a small stdlib transport that preserves the original `Host` header and TLS `servername`/cert verification, with no second DNS lookup between validation and connect. The post-fetch re-validation was removed as it re-resolved DNS against an already-pinned connection and only reopened the race. Literal-IP URLs keep using the global `fetch` (no rebinding surface).
|
|
37
|
+
|
|
3
38
|
## 0.6.0 - 2026-06-21
|
|
4
39
|
|
|
5
40
|
### Added
|
|
6
41
|
|
|
7
|
-
- **MCP server support.**
|
|
42
|
+
- **MCP server support.** haze can now connect to [Model Context Protocol](https://modelcontextprotocol.io) servers and expose their tools to the agent alongside the built-in toolset. `/mcp` opens an interactive picker (like `/provider`) to add a server from a preset (Context7 ships built-in for up-to-date library docs) or custom `http`/`sse`/`stdio` details, then enable/disable/remove it or set a masked API key. Servers persist in `~/.haze/settings.json` under `mcpServers`. MCP clients open per agent turn and close when it ends; a failing server is isolated and MCP tools never shadow built-ins.
|
|
8
43
|
- Added optional configurable stdio LSP support through `/lsp`, with TypeScript, Rust, Python, Go, and PHP presets.
|
|
9
44
|
- Added read-only semantic navigation tools (`lspWorkspaceSymbols`, `lspSymbols`, `lspDefinition`, `lspReferences`) that are exposed to the model only when an enabled LSP command is installed on `PATH`.
|
|
10
45
|
- Added `/context`, a token breakdown of the current request (system prompt, project context, tools including MCP, and chat messages).
|
|
@@ -15,7 +50,7 @@
|
|
|
15
50
|
|
|
16
51
|
- Switched the main agent turn to the AI SDK v6 `ToolLoopAgent` abstraction while preserving compact terminal tool/text rendering and key loop guardrails.
|
|
17
52
|
- Improved transcript segmentation so assistant text and tool blocks alternate cleanly during multi-step turns.
|
|
18
|
-
- Added LSP-aware prompt guidance only when LSP tools are actually available; otherwise
|
|
53
|
+
- Added LSP-aware prompt guidance only when LSP tools are actually available; otherwise haze naturally falls back to `grep`, `listFiles`, and `readFile`.
|
|
19
54
|
- Made `/lsp` and `/mcp` interactive pickers matching the `/provider` flow (autocomplete lists, preset pickers, masked API-key entry), replacing the previous `/lsp`/`/mcp` subcommand syntax.
|
|
20
55
|
- Unified skill management into a single `/skills` interactive picker that mirrors `/provider`, `/lsp`, and `/mcp`; removed the legacy `/create-skill`, `/skill-info`, `/validate-skill`, and `/remove-skill` commands.
|
|
21
56
|
- Updated README, docs site, and project agent guidance for LSP setup and the 0.6.0 release.
|
|
@@ -25,16 +60,16 @@
|
|
|
25
60
|
### Changed
|
|
26
61
|
|
|
27
62
|
- Removed all user-facing environment variables. `OPENAI_API_KEY`, `OPENAI_BASE_URL`, `HAZE_MODEL`, and `HAZE_CONTEXT_BUDGET_SHARE` are no longer read; configure providers, models, API keys, and base URLs through `~/.haze/settings.json` and the `/provider`, `/model`, `/settings` slash commands instead. This also removes the `OPENAI_*` env overrides from the startup provider info and the header.
|
|
28
|
-
- File LLM logging is now **off by default**. Previously
|
|
63
|
+
- File LLM logging is now **off by default**. Previously haze wrote a detailed JSONL log (full prompts, model messages, tool inputs/outputs, token usage) to `~/.haze/logs/<timestamp>.jsonl` on every session. Logging is now enabled solely with the `--debug` flag (`haze --debug`), which also turns on the on-screen debug panel. The `/logs` command still reviews historical log files.
|
|
29
64
|
- Bash results now pass through command-aware reducers before they enter the transcript/model context. Validation failures render focused diagnostics, successful validation stays short, git/diff/search/JSON/log-like output is compacted, noisy command families get line filters, and reduced raw output remains retrievable by `readToolOutput` when stored.
|
|
30
65
|
- `grep` now returns compact structured search output for long match sets/lines, with reduction metadata, omitted-result counts, and a raw-output handle when the rendered result was truncated.
|
|
31
66
|
- Tool activity rendering is quieter: live tool groups show elapsed timers, subagent child calls, capped group detail, and compact success/failure summaries instead of dumping large result objects.
|
|
32
67
|
- Assistant Markdown rendering in the CLI now supports styled headings, inline code/strong/emphasis/links, blockquotes, syntax-highlighted code fences, horizontal rules, and width-aware tables.
|
|
33
68
|
- Consecutive assistant messages in one turn now share a single visible `haze` header for a less noisy transcript.
|
|
34
69
|
- Completed task lists now clear automatically at the start of a new user turn so old successful todos do not linger in the task bar.
|
|
35
|
-
- Context loading now includes global `~/.claude/CLAUDE.md` while keeping `~/.haze/AGENTS.md` higher priority for
|
|
70
|
+
- Context loading now includes global `~/.claude/CLAUDE.md` while keeping `~/.haze/AGENTS.md` higher priority for haze-specific global guidance.
|
|
36
71
|
- Nested `CLAUDE.md`/`AGENTS.md` files below the workspace are now scoped and loaded lazily when file tools operate inside their directory tree; mutating file tools stop before the first edit when newly scoped instructions are discovered.
|
|
37
|
-
- Repeated identical tool calls are now steered back to the model with an explicit correction instead of aborting the turn immediately, so
|
|
72
|
+
- Repeated identical tool calls are now steered back to the model with an explicit correction instead of aborting the turn immediately, so haze can reuse existing results or finish cleanly.
|
|
38
73
|
- `/init` now explicitly keeps `AGENTS.md` compact, reminds the model that context files are injected into every request, and references the current context-file truncation budget.
|
|
39
74
|
|
|
40
75
|
### Added
|
|
@@ -76,7 +111,7 @@
|
|
|
76
111
|
- Added request-level context accounting, cache/no-cache usage metrics, a debug token breakdown, and an offline `context:report` command.
|
|
77
112
|
- Bounded `readFile`, structured and globally capped `grep`, and compacted large bash output behind paginated `readToolOutput` handles.
|
|
78
113
|
- Added structured `WorkState` snapshots, token-aware compaction, conservative old-tool-result pruning, bounded continuation slices, and no-progress termination for long agent workflows.
|
|
79
|
-
- Made
|
|
114
|
+
- Made haze control nudges ephemeral, omitted tool schemas from text-only follow-ups, and replaced duplicated subagent prompting with a concise dedicated prompt.
|
|
80
115
|
- Consolidated installed workflows into one progressive `skill` catalog tool and added provider capability-gated cache keys, sticky session hints, and low-verbosity options.
|
|
81
116
|
- Shortened the model operating contract and final-response guidance while preserving edit recovery, validation evidence, and blocked/partial reporting.
|
|
82
117
|
|
|
@@ -95,7 +130,7 @@
|
|
|
95
130
|
- Added shared structured tool result types and more specific file-edit failure reason codes so edit recovery can reread the affected file and retry with better guidance.
|
|
96
131
|
- Reworked the system prompt, subagent prompt, compaction prompt, and generated-skill guidance around autonomous expert developer workflows with concise final status reporting.
|
|
97
132
|
- Removed hard-coded `temperature: 0` from model calls so providers/models that reject temperature options can run without warning workarounds.
|
|
98
|
-
- Removed bash confirmation gates, including for destructive classifications;
|
|
133
|
+
- Removed bash confirmation gates, including for destructive classifications; haze now assumes expert users know what they asked for and relies on transparent tool output rather than permission prompts.
|
|
99
134
|
- Improved chat input editing with wrapped multi-line display, vertical cursor movement across wrapped lines, and better cursor mapping for compacted paste blocks.
|
|
100
135
|
- Added and updated tests for bash classification, bash execution behavior, validation parsing, edit recovery, system-prompt guidance, and skill generation.
|
|
101
136
|
|
package/README.md
CHANGED
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
#
|
|
1
|
+
# haze
|
|
2
2
|
|
|
3
3
|
A minimal LLM harness for your terminal.
|
|
4
4
|
|
|
5
|
-
## What's new in 0.
|
|
5
|
+
## What's new in 0.8.0
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
haze 0.8.0 focuses on runtime reliability and clearer terminal feedback while staying compact and low-friction.
|
|
8
8
|
|
|
9
|
-
- **
|
|
10
|
-
- **
|
|
11
|
-
- **
|
|
12
|
-
- **
|
|
13
|
-
- **Cleaner transcripts.** Assistant text and tool blocks alternate cleanly during multi-step turns.
|
|
14
|
-
- **Context breakdown.** `/context` shows estimated system-prompt, project-context, tool (including MCP), and message tokens for the current request.
|
|
15
|
-
- **Startup update check.** Haze quietly surfaces a newer published version when one exists.
|
|
9
|
+
- **AI SDK v7 runtime.** The main agent and subagent runners now use AI SDK v7 APIs with explicit per-tool context wiring, keeping built-in tool state turn-scoped and compatible with the newer runtime.
|
|
10
|
+
- **Live busy status.** The active-turn indicator now shows the current model, elapsed time, and the tool activity underway — reading, editing, searching, running commands, loading skills, or calling MCP/LSP tools — so long turns look alive instead of stuck.
|
|
11
|
+
- **Bounded bash output processing.** Bash output reduction paths are tightened so large command output remains controlled before it reaches transcript/model context.
|
|
12
|
+
- **Input and maintenance polish.** Multiline input shortcuts are fixed, core agent maintenance paths are hardened, model/status labels are shorter and safer, and user-facing naming is consistently lowercase `haze`.
|
|
16
13
|
|
|
17
14
|
Previous releases:
|
|
18
15
|
|
|
16
|
+
- **0.7.0** — Headless `-p`/`--output json`/`--output stream-json`, pinned-connection `fetch` safety, scoped instruction refresh during turns, smaller durable sessions, and startup context visibility.
|
|
17
|
+
- **0.6.0** — AI SDK-native ToolLoopAgent core, optional LSP semantic navigation, MCP server support, unified config pickers, cleaner transcripts, `/context`, and startup update checks.
|
|
19
18
|
- **0.5.0** — `fetch` tool for public URLs (Markdown/JSON/text, SSRF-protected), removed all provider env vars (config via `/provider`/`/model`/`/settings`), debug-only LLM logs, command-aware output reduction, Markdown rendering in the CLI, scoped nested context files, and auto-clearing completed tasks.
|
|
20
19
|
- **0.4.0** — 3-step skill wizard, language-agnostic skill intent extraction, model-managed tasks, leaner command surface, docs site additions.
|
|
21
20
|
- **0.3.0** — Docs site redesign, task bar moves above the activity spinner, tasks auto-clear between sessions.
|
|
@@ -25,7 +24,7 @@ Previous releases:
|
|
|
25
24
|
- **0.0.2** — Markdown skills, autocomplete, listFiles pagination.
|
|
26
25
|
- **0.0.1** — Initial release.
|
|
27
26
|
|
|
28
|
-
|
|
27
|
+
haze works with OpenAI-compatible providers, including OpenRouter and local endpoints. Use `/provider` to choose or add one, then `/model` to select a model.
|
|
29
28
|
|
|
30
29
|
```txt
|
|
31
30
|
_
|
|
@@ -36,17 +35,17 @@ Haze works with OpenAI-compatible providers, including OpenRouter and local endp
|
|
|
36
35
|
|_| |_|\__,_/___\___|
|
|
37
36
|
```
|
|
38
37
|
|
|
39
|
-
|
|
38
|
+
haze keeps guardrails light. The LLM can work from the terminal with freedoms close to yours, while trying to stay scoped to the current project. It is aimed at developers who want an expert-oriented tool, not a permission dialog factory. Watch the tool calls. Keep your hands near the wheel. Progress.
|
|
40
39
|
|
|
41
40
|
## Getting started
|
|
42
41
|
|
|
43
|
-
Install
|
|
42
|
+
Install haze:
|
|
44
43
|
|
|
45
44
|
```bash
|
|
46
45
|
npm install -g @denizokcu/haze
|
|
47
46
|
```
|
|
48
47
|
|
|
49
|
-
Open
|
|
48
|
+
Open haze from your project:
|
|
50
49
|
|
|
51
50
|
```bash
|
|
52
51
|
$ haze
|
|
@@ -59,9 +58,9 @@ On first run, create or choose a provider, then choose your first model:
|
|
|
59
58
|
/model
|
|
60
59
|
```
|
|
61
60
|
|
|
62
|
-
`/provider` opens provider setup for any OpenAI-compatible endpoint — e.g. OpenRouter, OpenAI, LM Studio, Ollama, or a proxy.
|
|
61
|
+
`/provider` opens provider setup for any OpenAI-compatible endpoint — e.g. OpenRouter, OpenAI, LM Studio, Ollama, or a proxy. haze will ask for a provider name, base URL, optional API key, and model names.
|
|
63
62
|
|
|
64
|
-
`/model` selects the model
|
|
63
|
+
`/model` selects the model haze should use. You can also set one directly:
|
|
65
64
|
|
|
66
65
|
```txt
|
|
67
66
|
/model anthropic/claude-sonnet-4.6
|
|
@@ -81,9 +80,9 @@ Use `/mcp` to connect [Model Context Protocol](https://modelcontextprotocol.io)
|
|
|
81
80
|
|
|
82
81
|
API keys are entered in a masked prompt and sent as `Authorization: Bearer <value>`. Servers persist in `~/.haze/settings.json` under `mcpServers` and support `http`, `sse`, and `stdio` transports. Their tools load at the start of each agent turn and the connections close when the turn ends. An unreachable server is isolated and never blocks the agent, and MCP tools never shadow built-in tools.
|
|
83
82
|
|
|
84
|
-
Saved settings live in `~/.haze/settings.json`. Providers can include API keys, base URLs, and model lists; local OpenAI-compatible providers can be configured without a key. Use `/provider`, `/model`, and `/settings` to configure everything from inside
|
|
83
|
+
Saved settings live in `~/.haze/settings.json`. Providers can include API keys, base URLs, and model lists; local OpenAI-compatible providers can be configured without a key. Use `/provider`, `/model`, and `/settings` to configure everything from inside haze — there are no environment variables to set.
|
|
85
84
|
|
|
86
|
-
|
|
85
|
+
haze is intentionally minimal: chat, local tools, context files, sessions, and Markdown skills. Any workflow beyond the core is meant to be grown with the LLM through `/skills` (an interactive picker: generate a custom skill from a description, then enable/disable, validate, or remove it). If you want reviews, release prep, deploy checks, debugging rituals, or your team's strange checklist, ask haze to create a skill and then refine the Markdown.
|
|
87
86
|
|
|
88
87
|
## Get productive immediately
|
|
89
88
|
|
|
@@ -93,7 +92,7 @@ Open a project and ask for work:
|
|
|
93
92
|
create a calculator in calc-app in ruby with add subtract multiply divide
|
|
94
93
|
```
|
|
95
94
|
|
|
96
|
-
|
|
95
|
+
haze will inspect, search, write files, fetch public URLs, run commands, and show compact tool activity inline. Small file edits include a colorized line diff with one context line before and after the change; large diffs stay summarized so the transcript does not become a wall of noise. Bash output is reduced by command-aware filters for validation, git, search, JSON, diffs, and noisy logs; failures point at the relevant files, tests, or diagnostics, and raw output remains available by handle when it was omitted. Sessions are saved by default so you can resume the latest workspace conversation with `haze --continue` or `/resume`.
|
|
97
96
|
|
|
98
97
|
Use `/` to discover commands and skills. `Tab` completes the top suggestion.
|
|
99
98
|
|
|
@@ -111,7 +110,7 @@ Useful starters:
|
|
|
111
110
|
|
|
112
111
|
## Skills: your workflows, grown while working
|
|
113
112
|
|
|
114
|
-
Skills are Markdown workflows that
|
|
113
|
+
Skills are Markdown workflows that haze creates with `/skills` and stores in `~/.haze/skills` so you can inspect or refine them later.
|
|
115
114
|
|
|
116
115
|
If you do something for the second time, build a skill for it:
|
|
117
116
|
|
|
@@ -122,7 +121,7 @@ If you do something for the second time, build a skill for it:
|
|
|
122
121
|
# Description: review the diff between my current branch and main, focusing on bugs, tests, DRY and KISS
|
|
123
122
|
```
|
|
124
123
|
|
|
125
|
-
|
|
124
|
+
haze uses the model to create the skill file for you:
|
|
126
125
|
|
|
127
126
|
```txt
|
|
128
127
|
~/.haze/skills/<skill-name>/SKILL.md
|
|
@@ -166,7 +165,7 @@ Installed skills appear as slash commands like:
|
|
|
166
165
|
/code-review-diff-main
|
|
167
166
|
```
|
|
168
167
|
|
|
169
|
-
They are also available through one `skill` catalog tool.
|
|
168
|
+
They are also available through one `skill` catalog tool. haze loads one workflow body first and fetches large references only when needed. Skills provide instructions; they do not execute code.
|
|
170
169
|
|
|
171
170
|
This is the trick: do normal work, notice friction, create a skill, keep going. Your workflow adapts instead of asking you to adapt to the tool. Rude, but in a good way.
|
|
172
171
|
|
|
@@ -205,11 +204,57 @@ haze --continue # resume the latest saved session for this workspace
|
|
|
205
204
|
haze --no-session # run without durable session storage
|
|
206
205
|
```
|
|
207
206
|
|
|
208
|
-
|
|
207
|
+
Non-interactive / print mode:
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
haze -p "refactor utils.ts to remove the unused export"
|
|
211
|
+
haze -p "summarize this repo" --model openai:gpt-4o-mini
|
|
212
|
+
haze -p "list the top 3 bugs in src/api.ts" --output json
|
|
213
|
+
haze -p "audit src/auth.ts" --output stream-json # live NDJSON events, then the result envelope
|
|
214
|
+
echo "what does this project do?" | haze
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
`-p` / `--prompt` runs a single agentic turn (with the full tool set and guardrails) and prints the final assistant text. `--model` overrides the active model for that one run without changing `~/.haze/settings.json` — accepts a bare model name or `provider:name`. The selected model must already be registered under a provider's `models` (add it once via `/provider`); an unknown or ambiguous selector exits non-zero with a precise error on stderr. When `-p` is omitted and stdin is piped, the prompt is read from stdin. A one-shot run never starts or resumes a durable session; `--continue` is ignored in this mode. Headless runs do **not** auto-compact on context overflow, so very large CI prompts may fail rather than recover — keep prompts within the model's window. Add `--debug` to also write a detailed JSONL log under `~/.haze/logs/`. `--output` selects how the run is reported: `text` (default), `json` (a single final envelope), or `stream-json` (a live NDJSON event stream ending in that envelope) — see below.
|
|
218
|
+
|
|
219
|
+
`--output json` prints a single-line envelope instead of plain text:
|
|
220
|
+
|
|
221
|
+
```json
|
|
222
|
+
{
|
|
223
|
+
"type": "result",
|
|
224
|
+
"status": "complete", // "complete" (exit 0) | "aborted" | "failed" (both exit non-zero)
|
|
225
|
+
"result": "the final assistant text",
|
|
226
|
+
"usage": {
|
|
227
|
+
"inputTokens": 0,
|
|
228
|
+
"outputTokens": 0,
|
|
229
|
+
"cacheReadTokens": 0,
|
|
230
|
+
"cacheWriteTokens": 0,
|
|
231
|
+
"reasoningTokens": 0
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
The `status` field is authoritative (driven by the agent's terminal state, not by parsing `result`), and the exit code mirrors it: `0` only for `complete`. A `complete` run with an empty `result` means the model produced no visible text — distinct from a `failed` run.
|
|
237
|
+
|
|
238
|
+
`--output stream-json` streams the run as it happens instead of staying silent until the end. Each public progress event is written to stdout as one newline-delimited JSON object (NDJSON), and the **last** line is the exact same `{ type: "result", status, result, usage }` envelope as `--output json` — so a consumer can render live progress and still parse the final line identically:
|
|
239
|
+
|
|
240
|
+
```jsonc
|
|
241
|
+
{"type":"turn_start","request":"audit src/auth.ts","at":"2026-06-27T22:00:00.000Z"}
|
|
242
|
+
{"type":"message_start","id":"a1","role":"assistant","at":"..."}
|
|
243
|
+
{"type":"message_update","id":"a1","text":"Reading the auth module…","at":"..."}
|
|
244
|
+
{"type":"tool_start","id":"t1","name":"readFile","at":"..."}
|
|
245
|
+
{"type":"tool_end","id":"t1","name":"readFile","success":true,"durationMs":12,"at":"..."}
|
|
246
|
+
{"type":"message_end","id":"a1","text":"Here are the findings…","at":"..."}
|
|
247
|
+
{"type":"turn_end","request":"audit src/auth.ts","status":"complete","at":"..."}
|
|
248
|
+
{"type":"result","status":"complete","result":"Here are the findings…","usage":{"inputTokens":0,"outputTokens":0,"cacheReadTokens":0,"cacheWriteTokens":0,"reasoningTokens":0}}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Every line is standalone valid JSON, so the stream pipes cleanly through `jq -c .`. The event types are `turn_start`, `message_start` / `message_update` / `message_end`, `tool_start` / `tool_end`, `retry`, `context_overflow`, and `turn_end`; each carries an ISO-8601 `at` timestamp. Tool events intentionally omit raw tool inputs and outputs because stdout is often captured by CI/harness logs; use `--debug` when detailed local JSONL logs are needed. This mode is intended for harnesses driving haze autonomously: the incremental, ever-changing output lets a supervisor show live progress and run stdout-based stagnation/loop detection, while the trailing `result` envelope remains the single source of truth for status, text, and usage. `text` and `json` outputs are unchanged.
|
|
252
|
+
|
|
253
|
+
By default, haze does **not** write the detailed LLM log files under `~/.haze/logs/` (they capture full prompts, messages, and tool I/O). File logging is only enabled with `haze --debug`, which also turns on the on-screen debug panel. Use the `/logs` command to review past log files once logging has been enabled.
|
|
209
254
|
|
|
210
255
|
## Agent tools
|
|
211
256
|
|
|
212
|
-
|
|
257
|
+
haze exposes a deliberately small toolset:
|
|
213
258
|
|
|
214
259
|
- `listFiles` — structured discovery, recursive with cursor pagination when needed.
|
|
215
260
|
- `readFile` — read numbered UTF-8 lines in bounded pages, with `nextOffset` when more remain.
|
|
@@ -217,7 +262,7 @@ Haze exposes a deliberately small toolset:
|
|
|
217
262
|
- `editFile` — unique text replacements, with line-number-prefix tolerance for common model mistakes.
|
|
218
263
|
- `replaceLines` — line-range edits when exact replacements are awkward; slightly-too-large EOF ranges are clamped.
|
|
219
264
|
- `writeFile` — create files and parent directories.
|
|
220
|
-
- `bash` — run tests, builds, git commands, inspections, scripts, installs, and other shell workflows with command-aware output reduction and compact validation output.
|
|
265
|
+
- `bash` — run tests, builds, git/gh commands, inspections, scripts, installs, and other shell workflows with command-aware output reduction (git, gh, search, JSON, diffs, logs) and compact validation output.
|
|
221
266
|
- `readToolOutput` — page through full/raw output omitted from an oversized or reduced tool result.
|
|
222
267
|
- `fetch` — read a public `http(s)` URL and return readable content (Markdown for docs, pretty JSON, or text). Private/loopback/metadata hosts and non-`http(s)` schemes are blocked; output is bounded and retrievable via `readToolOutput`.
|
|
223
268
|
- `writeTasks` — replace the task list at meaningful phase changes; completed lists auto-clear on the next user turn.
|
|
@@ -228,7 +273,7 @@ Tool calls are grouped in the transcript so you can see what happened without re
|
|
|
228
273
|
|
|
229
274
|
### Optional LSP navigation
|
|
230
275
|
|
|
231
|
-
|
|
276
|
+
haze can use user-configured stdio Language Server Protocol servers for semantic code navigation. Configure them with `/lsp` (an interactive picker, like `/provider` and `/mcp`): add a preset or a custom command, then enable/disable/remove servers. Presets currently include TypeScript, Rust, Python, Go, and PHP. haze does not install language servers for you, and it hides LSP tools from the model unless an enabled server command exists on `PATH`, so projects without LSP still use `grep`, `listFiles`, and `readFile` normally.
|
|
232
277
|
|
|
233
278
|
Example TypeScript setup:
|
|
234
279
|
|
|
@@ -243,23 +288,25 @@ npm install -g typescript typescript-language-server
|
|
|
243
288
|
|
|
244
289
|
## Subagents
|
|
245
290
|
|
|
246
|
-
Subagents are a delegation feature, not another file operation. When a request clearly splits into independent parallel work,
|
|
291
|
+
Subagents are a delegation feature, not another file operation. When a request clearly splits into independent parallel work, haze can spin up focused agents with fresh context, let them inspect or act with their own capped tool loop, then fold their concise summaries back into the main conversation.
|
|
247
292
|
|
|
248
293
|
Use them for parallel investigation across separate areas of a codebase. Do not use them for single sequential tasks where the main agent already has the best context.
|
|
249
294
|
|
|
250
295
|
## Context files
|
|
251
296
|
|
|
252
|
-
|
|
297
|
+
haze saves durable workspace sessions in `~/.haze/sessions`. Use `/session` to see the current file, `/new` to start fresh, `/resume` to restore the latest session, and `/compact` to summarize older model context. Sessions also persist compact structured work state: the active goal, touched files, validation evidence, blockers, and next action.
|
|
298
|
+
|
|
299
|
+
Session files are optimized for resume and audit, not token-by-token playback: completed user/assistant messages, tool lifecycle events, conversation snapshots, and work-state snapshots are persisted, but streaming `message_update` events are skipped. Large persisted tool outputs are replaced with previews and byte counts so a resumed model can reread current files instead of carrying stale megabytes forward.
|
|
253
300
|
|
|
254
|
-
Long turns use bounded tool slices. Older successful tool results are compacted while failures and recent evidence remain verbatim, synthetic
|
|
301
|
+
Long turns use bounded tool slices. Older successful tool results are compacted while failures and recent evidence remain verbatim, synthetic haze control nudges are not persisted as user requests, and token-pressure compaction preserves the structured work state.
|
|
255
302
|
|
|
256
|
-
|
|
303
|
+
haze loads project instructions from:
|
|
257
304
|
|
|
258
305
|
- `~/.claude/CLAUDE.md`
|
|
259
306
|
- `~/.haze/AGENTS.md`
|
|
260
307
|
- `CLAUDE.md` / `AGENTS.md` files from filesystem root to the current workspace
|
|
261
308
|
|
|
262
|
-
At the same scope, `AGENTS.md` overrides `CLAUDE.md`; global
|
|
309
|
+
At the same scope, `AGENTS.md` overrides `CLAUDE.md`; global haze guidance in `~/.haze/AGENTS.md` overrides global Claude guidance in `~/.claude/CLAUDE.md`. Nested `CLAUDE.md` / `AGENTS.md` files below the workspace are scoped: haze surfaces them only when file tools operate inside that directory or its subdirectories, injects newly discovered scoped guidance into the next model step, and mutating tools stop once so the model can review it before editing. Scoped context files are tracked by signature, so changed nested guidance can be read again later in the same session.
|
|
263
310
|
|
|
264
311
|
Use `AGENTS.md` for project conventions, commands, architecture notes, and things future-you does not want to re-explain. `/init` is intentionally budget-aware: it does one small discovery pass, preserves useful existing guidance, and asks for a compact file because context files are injected into every request.
|
|
265
312
|
|
|
@@ -268,10 +315,10 @@ Use `AGENTS.md` for project conventions, commands, architecture notes, and thing
|
|
|
268
315
|
- File tools are restricted to the current workspace.
|
|
269
316
|
- File tools follow `.gitignore` by default.
|
|
270
317
|
- Ignored files require an explicit override.
|
|
271
|
-
- Bash commands are classified and shown with working-directory metadata, but
|
|
272
|
-
- The `fetch` tool reads public `http(s)` URLs only; private, loopback, link-local, and cloud-metadata hosts and non-`http(s)` schemes are blocked,
|
|
318
|
+
- Bash commands are classified and shown with working-directory metadata, but haze does not use command confirmation gates.
|
|
319
|
+
- The `fetch` tool reads public `http(s)` URLs only; private, loopback, link-local, and cloud-metadata hosts and non-`http(s)` schemes are blocked, and each redirect hop is connected to the already validated public IP to avoid DNS-rebinding races.
|
|
273
320
|
- Mutating and destructive commands can run when they are relevant to the user's request; this is intentional for expert users.
|
|
274
|
-
-
|
|
321
|
+
- haze is powerful enough to help and dumb enough to deserve supervision. Ideal software, basically.
|
|
275
322
|
|
|
276
323
|
## Local development
|
|
277
324
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Task } from '../../core/tasks/taskStorage.js';
|
|
3
|
+
export declare const MAX_VISIBLE_TASKS = 5;
|
|
4
|
+
export declare function TaskBar({ tasks, width, expanded, padding }: {
|
|
5
|
+
tasks: Task[];
|
|
6
|
+
width: number;
|
|
7
|
+
expanded: boolean;
|
|
8
|
+
padding: number;
|
|
9
|
+
}): React.JSX.Element;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from 'ink';
|
|
3
|
+
import { theme } from '../../ui/theme.js';
|
|
4
|
+
const TASK_STATUS_ICON = {
|
|
5
|
+
pending: '\u25CB',
|
|
6
|
+
in_progress: '\u25D0',
|
|
7
|
+
completed: '\u2713',
|
|
8
|
+
};
|
|
9
|
+
function taskStatusColor(status) {
|
|
10
|
+
switch (status) {
|
|
11
|
+
case 'completed': return theme.success;
|
|
12
|
+
case 'in_progress': return theme.warning;
|
|
13
|
+
default: return theme.muted;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export const MAX_VISIBLE_TASKS = 5;
|
|
17
|
+
export function TaskBar({ tasks, width, expanded, padding }) {
|
|
18
|
+
const maxTitleWidth = Math.max(10, width - 6);
|
|
19
|
+
const inProgress = tasks.filter(t => t.status === 'in_progress');
|
|
20
|
+
const pending = tasks.filter(t => t.status === 'pending');
|
|
21
|
+
const completed = tasks.filter(t => t.status === 'completed');
|
|
22
|
+
const limit = expanded ? tasks.length : MAX_VISIBLE_TASKS;
|
|
23
|
+
const ordered = [];
|
|
24
|
+
for (const t of inProgress) {
|
|
25
|
+
if (ordered.length < limit)
|
|
26
|
+
ordered.push(t);
|
|
27
|
+
}
|
|
28
|
+
for (const t of pending) {
|
|
29
|
+
if (ordered.length < limit)
|
|
30
|
+
ordered.push(t);
|
|
31
|
+
}
|
|
32
|
+
for (let i = completed.length - 1; i >= 0 && ordered.length < limit; i--) {
|
|
33
|
+
ordered.push(completed[i]);
|
|
34
|
+
}
|
|
35
|
+
const counts = `${inProgress.length > 0 ? `${inProgress.length} active` : ''}${pending.length > 0 ? `${inProgress.length > 0 ? ', ' : ''}${pending.length} pending` : ''}${completed.length > 0 ? `${inProgress.length + pending.length > 0 ? ', ' : ''}${completed.length} done` : ''}`;
|
|
36
|
+
return (_jsxs(Box, { flexDirection: "column", flexShrink: 0, children: [padding > 0 && Array.from({ length: padding }, (_, i) => _jsx(Text, { children: ' ' }, `pad-${i}`)), _jsxs(Text, { children: [_jsx(Text, { color: theme.purple, bold: true, children: "Tasks" }), counts ? _jsxs(Text, { color: theme.muted, children: [" (", counts, ")"] }) : null, tasks.length > MAX_VISIBLE_TASKS ? _jsxs(Text, { color: theme.muted, dimColor: true, children: [" \u00B7 ctrl+o ", expanded ? 'collapse' : 'expand'] }) : null] }), ordered.map(task => {
|
|
37
|
+
const title = task.title.length > maxTitleWidth ? task.title.slice(0, maxTitleWidth - 1) + '\u2026' : task.title;
|
|
38
|
+
return (_jsxs(Text, { wrap: "truncate-end", children: [_jsxs(Text, { color: taskStatusColor(task.status), children: [TASK_STATUS_ICON[task.status], " "] }), _jsx(Text, { color: task.status === 'completed' ? theme.muted : 'white', children: title })] }, task.id));
|
|
39
|
+
})] }));
|
|
40
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ModelMessage } from 'ai';
|
|
2
|
+
import type { Message } from '../commands/streaming.js';
|
|
3
|
+
export declare function toolCallCount(messages: Message[]): number;
|
|
4
|
+
export declare function estimateTokens(text: string): number;
|
|
5
|
+
export declare function compactHomePath(filePath: string, home?: string): string;
|
|
6
|
+
export declare function formatTokenCount(tokens: number): string;
|
|
7
|
+
export declare function displayMessagesFromConversation(conversation: ModelMessage[]): Message[];
|
|
8
|
+
export declare function estimateConversationTokens(messages: Message[]): {
|
|
9
|
+
input: number;
|
|
10
|
+
output: number;
|
|
11
|
+
};
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import os from 'node:os';
|
|
2
|
+
import { modelMessageText } from '../../core/agent/compaction.js';
|
|
3
|
+
export function toolCallCount(messages) {
|
|
4
|
+
return messages.reduce((total, message) => {
|
|
5
|
+
if (message.role !== 'tool')
|
|
6
|
+
return total;
|
|
7
|
+
const headerCount = /Tools: (\d+) calls?/.exec(message.text)?.[1];
|
|
8
|
+
if (headerCount)
|
|
9
|
+
return total + Number(headerCount);
|
|
10
|
+
const rows = message.text.split('\n').filter(line => /^\s+[✓✗…]\s/.test(line));
|
|
11
|
+
return total + rows.reduce((rowTotal, row) => rowTotal + Number(/×(\d+)/.exec(row)?.[1] ?? 1), 0);
|
|
12
|
+
}, 0);
|
|
13
|
+
}
|
|
14
|
+
export function estimateTokens(text) {
|
|
15
|
+
return Math.ceil(text.length / 4);
|
|
16
|
+
}
|
|
17
|
+
export function compactHomePath(filePath, home = os.homedir()) {
|
|
18
|
+
if (filePath === home)
|
|
19
|
+
return '~';
|
|
20
|
+
return filePath.startsWith(`${home}/`) ? `~/${filePath.slice(home.length + 1)}` : filePath;
|
|
21
|
+
}
|
|
22
|
+
export function formatTokenCount(tokens) {
|
|
23
|
+
if (tokens >= 1_000_000)
|
|
24
|
+
return `${(tokens / 1_000_000).toFixed(tokens >= 10_000_000 ? 0 : 1).replace(/\.0$/, '')}m`;
|
|
25
|
+
if (tokens >= 1_000)
|
|
26
|
+
return `${(tokens / 1_000).toFixed(tokens >= 10_000 ? 0 : 1).replace(/\.0$/, '')}k`;
|
|
27
|
+
return String(tokens);
|
|
28
|
+
}
|
|
29
|
+
export function displayMessagesFromConversation(conversation) {
|
|
30
|
+
return conversation.flatMap(message => {
|
|
31
|
+
if (message.role !== 'user' && message.role !== 'assistant')
|
|
32
|
+
return [];
|
|
33
|
+
const text = modelMessageText(message).trim();
|
|
34
|
+
return text ? [{ role: message.role, text }] : [];
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
export function estimateConversationTokens(messages) {
|
|
38
|
+
const inputText = messages
|
|
39
|
+
.filter(message => message.role === 'user' || message.role === 'tool')
|
|
40
|
+
.map(message => message.text)
|
|
41
|
+
.join('\n');
|
|
42
|
+
const outputText = messages
|
|
43
|
+
.filter(message => message.role === 'assistant')
|
|
44
|
+
.map(message => message.text)
|
|
45
|
+
.join('\n');
|
|
46
|
+
return {
|
|
47
|
+
input: estimateTokens(inputText),
|
|
48
|
+
output: estimateTokens(outputText),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { HazeSettings } from '../../config/settings.js';
|
|
2
|
+
import type { LoadedSkill } from '../../skills/types.js';
|
|
3
|
+
import type { TextInputSuggestion } from '../../ui/components/TextInput.js';
|
|
4
|
+
import type { Mode } from '../commands/chatModes.js';
|
|
5
|
+
interface InputSuggestionState {
|
|
6
|
+
mode: Mode;
|
|
7
|
+
settings: HazeSettings;
|
|
8
|
+
skills: LoadedSkill[];
|
|
9
|
+
selectedProviderName?: string;
|
|
10
|
+
modelProviderFilter?: string;
|
|
11
|
+
selectedSkillName?: string;
|
|
12
|
+
selectedLspName?: string;
|
|
13
|
+
selectedMcpName?: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function inputSuggestionsForState(state: InputSuggestionState): TextInputSuggestion[];
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { isSkillEnabled } from '../../config/skillSettings.js';
|
|
2
|
+
import { providerSuggestions, providerActionSuggestions, presetSuggestions, modelSuggestions, lspSuggestions, lspActionSuggestions, lspPresetSuggestions, mcpSuggestions, mcpActionSuggestions, mcpPresetSuggestions, mcpTransportSuggestions, skillsSuggestions, skillsActionSuggestions } from '../commands/wizardSuggestions.js';
|
|
3
|
+
const CHAT_COMMAND_SUGGESTIONS = [
|
|
4
|
+
{ value: '/help', description: 'Show commands', kind: 'command' },
|
|
5
|
+
{ value: '/provider', description: 'Choose a provider', kind: 'command' },
|
|
6
|
+
{ value: '/model', description: 'Choose a model', kind: 'command' },
|
|
7
|
+
{ value: '/lsp', description: 'Manage LSP servers (semantic navigation)', kind: 'command' },
|
|
8
|
+
{ value: '/mcp', description: 'Manage MCP servers (Context7, etc.)', kind: 'command' },
|
|
9
|
+
{ value: '/settings', description: 'Show provider, model, API key, and context status', kind: 'command' },
|
|
10
|
+
{ value: '/context', description: 'Show token breakdown of system, tools, MCP, and messages', kind: 'command' },
|
|
11
|
+
{ value: '/skills', description: 'Manage Markdown skills (add, enable/disable, validate, remove)', kind: 'command' },
|
|
12
|
+
{ value: '/init', description: 'Create or update AGENTS.md project instructions', kind: 'command' },
|
|
13
|
+
{ value: '/session', description: 'Show current session path', kind: 'command' },
|
|
14
|
+
{ value: '/resume', description: 'Resume latest session for this workspace', kind: 'command' },
|
|
15
|
+
{ value: '/new', description: 'Start a new session', kind: 'command' },
|
|
16
|
+
{ value: '/compact ', description: 'Summarize older context and keep recent messages', kind: 'command' },
|
|
17
|
+
{ value: '/clear', description: 'Clear conversation history', kind: 'command' },
|
|
18
|
+
{ value: '/exit', description: 'Exit haze', kind: 'command' },
|
|
19
|
+
{ value: '/quit', description: 'Exit haze', kind: 'command' },
|
|
20
|
+
];
|
|
21
|
+
export function inputSuggestionsForState(state) {
|
|
22
|
+
const { mode, settings, skills } = state;
|
|
23
|
+
if (mode === 'provider')
|
|
24
|
+
return providerSuggestions(settings);
|
|
25
|
+
if (mode === 'providerAction')
|
|
26
|
+
return providerActionSuggestions(settings, state.selectedProviderName);
|
|
27
|
+
if (mode === 'providerAddPreset')
|
|
28
|
+
return presetSuggestions();
|
|
29
|
+
if (mode === 'model')
|
|
30
|
+
return modelSuggestions(settings, state.modelProviderFilter);
|
|
31
|
+
if (mode === 'skills')
|
|
32
|
+
return skillsSuggestions(settings, skills);
|
|
33
|
+
if (mode === 'skillsAction')
|
|
34
|
+
return skillsActionSuggestions(settings, skills, state.selectedSkillName);
|
|
35
|
+
if (mode === 'lsp')
|
|
36
|
+
return lspSuggestions(settings);
|
|
37
|
+
if (mode === 'lspAction')
|
|
38
|
+
return lspActionSuggestions(settings, state.selectedLspName);
|
|
39
|
+
if (mode === 'lspAddPreset')
|
|
40
|
+
return lspPresetSuggestions();
|
|
41
|
+
if (mode === 'mcp')
|
|
42
|
+
return mcpSuggestions(settings);
|
|
43
|
+
if (mode === 'mcpAction')
|
|
44
|
+
return mcpActionSuggestions(settings, state.selectedMcpName);
|
|
45
|
+
if (mode === 'mcpAddPreset')
|
|
46
|
+
return mcpPresetSuggestions();
|
|
47
|
+
if (mode === 'mcpAddTransport')
|
|
48
|
+
return mcpTransportSuggestions();
|
|
49
|
+
if (mode !== 'chat')
|
|
50
|
+
return [];
|
|
51
|
+
return [
|
|
52
|
+
...CHAT_COMMAND_SUGGESTIONS,
|
|
53
|
+
...skills.filter(skill => isSkillEnabled(settings, skill.name)).map(skill => ({ value: `/${skill.name}`, description: skill.description, kind: 'skill' })),
|
|
54
|
+
];
|
|
55
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { Message } from '../commands/streaming.js';
|
|
3
|
+
export declare function messageElapsedLabel(message: Message): string;
|
|
4
|
+
export declare function MessageView({ message, width }: {
|
|
5
|
+
message: Message;
|
|
6
|
+
width: number;
|
|
7
|
+
}): React.JSX.Element;
|
|
8
|
+
export declare function messageKey(message: Message, index: number): string;
|
|
9
|
+
export declare function orderedDisplayMessages(messages: Message[]): Message[];
|