@denizokcu/haze 0.0.2 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +100 -34
  3. package/dist/cli/commands/chat.d.ts +3 -1
  4. package/dist/cli/commands/chat.js +500 -56
  5. package/dist/cli/commands/commands.d.ts +5 -0
  6. package/dist/cli/commands/commands.js +114 -29
  7. package/dist/cli/commands/formatters.js +32 -2
  8. package/dist/cli/commands/streaming.d.ts +6 -1
  9. package/dist/cli/commands/streaming.js +316 -98
  10. package/dist/cli/index.js +5 -2
  11. package/dist/config/inputHistory.js +8 -0
  12. package/dist/config/providers.d.ts +26 -0
  13. package/dist/config/providers.js +88 -0
  14. package/dist/config/settings.d.ts +9 -2
  15. package/dist/core/agent/compaction.d.ts +13 -0
  16. package/dist/core/agent/compaction.js +34 -0
  17. package/dist/core/agent/errors.d.ts +3 -0
  18. package/dist/core/agent/errors.js +13 -0
  19. package/dist/core/agent/events.d.ts +58 -0
  20. package/dist/core/agent/events.js +3 -0
  21. package/dist/core/goal/completionPolicy.d.ts +28 -0
  22. package/dist/core/goal/completionPolicy.js +84 -0
  23. package/dist/core/goal/requestClassifier.d.ts +6 -0
  24. package/dist/core/goal/requestClassifier.js +31 -0
  25. package/dist/core/goal/sessionGoal.d.ts +30 -0
  26. package/dist/core/goal/sessionGoal.js +88 -0
  27. package/dist/core/session/sessionStore.d.ts +37 -0
  28. package/dist/core/session/sessionStore.js +59 -0
  29. package/dist/core/subagent/subagentRunner.d.ts +33 -0
  30. package/dist/core/subagent/subagentRunner.js +140 -0
  31. package/dist/llm/client.d.ts +1 -1
  32. package/dist/llm/client.js +6 -6
  33. package/dist/llm/hazeTools.d.ts +86 -0
  34. package/dist/llm/hazeTools.js +313 -93
  35. package/dist/llm/initPrompt.js +6 -4
  36. package/dist/llm/systemPrompt.js +11 -7
  37. package/dist/skills/builder/SkillBuilder.d.ts +6 -0
  38. package/dist/skills/builder/SkillBuilder.js +146 -24
  39. package/dist/ui/components/ErrorView.d.ts +2 -1
  40. package/dist/ui/components/Header.d.ts +2 -1
  41. package/dist/ui/components/Header.js +1 -11
  42. package/dist/ui/components/MarkdownText.d.ts +2 -1
  43. package/dist/ui/components/TextInput.d.ts +7 -3
  44. package/dist/ui/components/TextInput.js +112 -27
  45. package/dist/ui/theme.d.ts +3 -0
  46. package/dist/ui/theme.js +4 -1
  47. package/package.json +8 -8
package/CHANGELOG.md CHANGED
@@ -2,6 +2,25 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.1.0 - 2026-06-07
6
+
7
+ - Added ripgrep-backed `grep` for fast workspace search with regex, glob, context-line, case-insensitive, and result-limit options.
8
+ - Added focused `subagent` delegation for independent parallel tasks with fresh context, step caps, concise summaries, tool-call metadata, and parent abort propagation.
9
+ - Added compact inline diff display for successful `editFile` and `replaceLines` calls, including added/removed counts, colored additions/removals, one context line around small changes, and hidden summaries for large diffs.
10
+ - Improved agent-loop completion handling for truncated model output and long-running tool loops.
11
+ - Refined subagent prompting and parent transcript summaries to reduce noise and discourage single-task delegation.
12
+ - Updated release documentation and roadmap state for the 0.1.0 foundation release.
13
+
14
+ ## 0.0.3 - 2026-06-06
15
+
16
+ - Added stable transcript rendering for long sessions, compact placeholders for large multiline pastes, and clearer goal/status display.
17
+ - Added OpenAI-compatible provider management with `/provider`, provider-qualified model selection, and legacy OpenRouter settings migration.
18
+ - Added durable workspace sessions with `haze --continue`, `--no-session`, `/session`, `/resume`, `/new`, and `/compact`.
19
+ - Added context compaction and goal-aware completion tracking to improve long-running agent turns.
20
+ - Hardened file tools with structured recoverable failures, safer concurrent mutation handling, line-number-prefix tolerant edits, and EOF-clamped line replacements.
21
+ - Simplified generated skill structure around role, focused prompt, and compact output templates.
22
+ - Updated docs site install/version copy and refreshed dependencies.
23
+
5
24
  ## 0.0.2 - 2026-06-01
6
25
 
7
26
  - Reworked skills into Markdown-first workflows stored in `~/.haze/skills/<name>/SKILL.md`.
package/README.md CHANGED
@@ -2,9 +2,18 @@
2
2
 
3
3
  A minimal LLM harness for your terminal.
4
4
 
5
- Haze gives an AI model a small set of transparent local tools — read files, edit files, write files, list files, and run commands — then gets out of the way. Start with chat. Build your workflows as you work. Teach Haze with Markdown skills when a pattern repeats. Tiny spell, useful goblin.
5
+ ## What's new in 0.1.0
6
6
 
7
- MVP scope: Haze currently uses OpenRouter only. More providers are on the roadmap after the goblin learns to hold a spoon safely.
7
+ Haze 0.1.0 is the foundation release: the agent can now *find*, *delegate*, and *show its work* without turning your terminal into soup.
8
+
9
+ - `grep` gives the model fast, targeted codebase search with regex, globs, context lines, and `.gitignore` awareness — no more brute-force file spelunking.
10
+ - Subagents let Haze fan out independent investigations into fresh contexts, then fold the result back into the main turn as a concise summary.
11
+ - File edits now render compact, colorized inline diffs with one context line around the change; big diffs stay summarized so signal beats scrollback.
12
+ - Long-turn handling is calmer: truncated model output and tool-heavy loops recover more gracefully.
13
+
14
+ The result is a more capable agent loop while keeping the core small and inspectable. Haze gives an AI model transparent local tools — read, search, edit, write, list, and run commands — plus focused delegation when work can split safely. Tiny spell, sharper goblin.
15
+
16
+ Haze works with OpenAI-compatible providers, including OpenRouter and local endpoints. Use `/provider` to choose or add one, then `/model` to select a model.
8
17
 
9
18
  ```txt
10
19
  _
@@ -17,30 +26,48 @@ MVP scope: Haze currently uses OpenRouter only. More providers are on the roadma
17
26
 
18
27
  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. Watch the tool calls. Keep your hands near the wheel. Progress.
19
28
 
20
- ## Install
29
+ ## Getting started
30
+
31
+ Install Haze:
21
32
 
22
33
  ```bash
23
34
  npm install -g @denizokcu/haze
24
- haze
25
35
  ```
26
36
 
27
- First run inside Haze, do both steps:
37
+ Open Haze from your project:
38
+
39
+ ```bash
40
+ $ haze
41
+ ```
42
+
43
+ On first run, create or choose a provider, then choose your first model:
28
44
 
29
45
  ```txt
30
- /login
31
- /model x-ai/grok-build-0.1
46
+ /provider
47
+ /model
32
48
  ```
33
49
 
34
- `/login` saves your API key. `/model` saves the model Haze should use. The recommended MVP model is `x-ai/grok-build-0.1`.
50
+ `/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.
51
+
52
+ `/model` selects the model Haze should use. You can also set one directly:
35
53
 
36
- Or use environment variables:
54
+ ```txt
55
+ /model anthropic/claude-sonnet-4.6
56
+ /model local:llama3.1
57
+ ```
58
+
59
+ Or use environment variables for any OpenAI-compatible endpoint:
37
60
 
38
61
  ```bash
39
- export OPENAI_API_KEY=... # your OpenRouter API key
40
- export HAZE_MODEL=x-ai/grok-build-0.1
62
+ # e.g. OpenRouter, OpenAI, LM Studio, Ollama, or an OpenAI-compatible proxy
63
+ export OPENAI_API_KEY=... # provider API key, if needed; local providers may not need one
64
+ export OPENAI_BASE_URL=https://openrouter.ai/api/v1 # or http://localhost:1234/v1, http://localhost:11434/v1, ...
65
+ export HAZE_MODEL=anthropic/claude-sonnet-4.6 # or gpt-4.1, llama3.1, qwen2.5-coder, ...
41
66
  ```
42
67
 
43
- Saved settings live in `~/.haze/settings.json`. The current MVP experience is documented around OpenRouter; more provider docs are future work.
68
+ 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.
69
+
70
+ 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 `/create-skill <description>`. 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.
44
71
 
45
72
  ## Get productive immediately
46
73
 
@@ -50,7 +77,7 @@ Open a project and ask for work:
50
77
  create a calculator in calc-app in ruby with add subtract multiply divide
51
78
  ```
52
79
 
53
- Haze will inspect, write files, run commands, and show compact tool activity inline.
80
+ Haze will inspect, search, write files, 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. Sessions are saved by default so you can resume the latest workspace conversation with `haze --continue` or `/resume`.
54
81
 
55
82
  Use `/` to discover commands and skills. `Tab` completes the top suggestion.
56
83
 
@@ -58,30 +85,30 @@ Useful starters:
58
85
 
59
86
  ```txt
60
87
  /init
61
- /skill create review my current branch against main like a senior engineer
62
- /skill create prepare clean git commits from my uncommitted changes
63
- /skill create implement small features with tests and a concise summary
88
+ /create-skill review my current branch against main like a senior engineer
89
+ /create-skill prepare clean git commits from my uncommitted changes
90
+ /create-skill implement small features with tests and a concise summary
64
91
  ```
65
92
 
66
93
  `/init` creates or updates `AGENTS.md` so future sessions understand the project.
67
94
 
68
95
  ## Skills: your workflows, grown while working
69
96
 
70
- Skills are Markdown workflows stored in `~/.haze/skills`.
97
+ Skills are Markdown workflows that Haze creates with `/create-skill` and stores in `~/.haze/skills` so you can inspect or refine them later.
71
98
 
72
- When you notice yourself asking for the same kind of work, make it a skill:
99
+ If you do something for the second time, build a skill for it:
73
100
 
74
101
  ```txt
75
- /skill create review the diff between my current branch and main, focusing on bugs, tests, DRY and KISS
102
+ /create-skill review the diff between my current branch and main, focusing on bugs, tests, DRY and KISS
76
103
  ```
77
104
 
78
- Haze uses the model to create:
105
+ Haze uses the model to create the skill file for you:
79
106
 
80
107
  ```txt
81
108
  ~/.haze/skills/<skill-name>/SKILL.md
82
109
  ```
83
110
 
84
- A skill is just Markdown with frontmatter:
111
+ A skill is just Markdown with frontmatter, a role, a focused prompt, and a small output template:
85
112
 
86
113
  ```md
87
114
  ---
@@ -89,13 +116,28 @@ name: code-review-diff-main
89
116
  description: Use when the user asks for a code review of the current branch against main.
90
117
  ---
91
118
 
92
- # Goal
119
+ # Role
120
+
121
+ You are a focused code reviewer.
122
+
123
+ # Focused prompt
93
124
 
94
125
  Review the actual change and return useful, evidence-based feedback.
95
126
 
96
127
  # Procedure
97
128
 
98
129
  Inspect branch state, changed files, staged and unstaged diffs, then review incrementally.
130
+
131
+ # Output template
132
+
133
+ ## Summary
134
+ - <scope and result>
135
+
136
+ ## Findings
137
+ - <prioritized findings, or "No issues found">
138
+
139
+ ## Evidence inspected
140
+ - <commands/files used>
99
141
  ```
100
142
 
101
143
  Installed skills appear as slash commands like:
@@ -112,22 +154,35 @@ This is the trick: do normal work, notice friction, create a skill, keep going.
112
154
 
113
155
  ```txt
114
156
  /help
115
- /login
116
- /model <name>
157
+ /provider
117
158
  /model
159
+ /model <name-or-provider:name>
160
+ /model list
118
161
  /settings
119
162
  /init
163
+ /session
164
+ /resume
165
+ /new
166
+ /compact [instructions]
120
167
  /clear
121
168
  /exit
122
169
 
123
- /skill create <description>
124
- /skill list
125
- /skill info <name>
126
- /skill validate <name-or-dir>
127
- /skill remove <name> --yes
170
+ /create-skill <description>
171
+ /list-skills
172
+ /skill-info <name>
173
+ /validate-skill <name-or-dir>
174
+ /remove-skill <name> --yes
128
175
  ```
129
176
 
130
- `/skills ...` also works as an alias for `/skill ...`.
177
+ Legacy `/skill ...` and `/skills ...` commands still work as aliases.
178
+
179
+ CLI flags:
180
+
181
+ ```bash
182
+ haze --debug # show model/tool debug logs
183
+ haze --continue # resume the latest saved session for this workspace
184
+ haze --no-session # run without durable session storage
185
+ ```
131
186
 
132
187
  ## Agent tools
133
188
 
@@ -135,16 +190,25 @@ Haze exposes a deliberately small toolset:
135
190
 
136
191
  - `listFiles` — structured discovery, recursive with cursor pagination when needed.
137
192
  - `readFile` — read UTF-8 files with optional line ranges.
138
- - `editFile` — exact unique text replacements.
139
- - `replaceLines` — line-range edits when exact replacements are awkward.
193
+ - `grep` — ripgrep-backed regex search with path, glob, context-line, case, and result-limit controls.
194
+ - `editFile` — unique text replacements, with line-number-prefix tolerance for common model mistakes.
195
+ - `replaceLines` — line-range edits when exact replacements are awkward; slightly-too-large EOF ranges are clamped.
140
196
  - `writeFile` — create files and parent directories.
141
197
  - `bash` — run tests, builds, git commands, and inspections.
142
198
  - `skill_*` — load Markdown skill instructions on demand.
143
199
 
144
- Tool calls are grouped in the transcript so you can see what happened without reading a novella.
200
+ Tool calls are grouped in the transcript so you can see what happened without reading a novella. Successful targeted file edits show a compact diff with colored additions/removals and one context line around the change when the diff is small; larger diffs are summarized with a pointer to `git diff`. File-tool failures return structured recovery hints instead of mystery stack traces.
201
+
202
+ ## Subagents
203
+
204
+ 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.
205
+
206
+ 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.
145
207
 
146
208
  ## Context files
147
209
 
210
+ 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 while keeping recent messages.
211
+
148
212
  Haze loads project instructions from:
149
213
 
150
214
  - `~/.haze/AGENTS.md`
@@ -180,12 +244,14 @@ Package check:
180
244
  npm pack --dry-run
181
245
  ```
182
246
 
183
- The npm package ships `bin`, `dist`, docs, license, changelog, and examples.
247
+ The npm package ships `bin`, `dist`, README, license, changelog, and examples.
184
248
 
185
249
  ## Release
186
250
 
187
251
  ```bash
188
252
  npm run typecheck
253
+ npm test
254
+ npm run lint
189
255
  npm run build
190
256
  npm pack --dry-run
191
257
  git tag vX.Y.Z
@@ -1,7 +1,9 @@
1
- export type Mode = 'chat' | 'apiKey' | 'model';
1
+ export type Mode = 'chat' | 'provider' | 'providerAction' | 'model' | 'providerAddName' | 'providerAddUrl' | 'providerAddKey' | 'providerAddModels' | 'providerAppendModels';
2
2
  interface ChatOptions {
3
3
  debug?: boolean;
4
4
  version?: string;
5
+ continueSession?: boolean;
6
+ noSession?: boolean;
5
7
  }
6
8
  export declare function chatCommand(options?: ChatOptions): Promise<void>;
7
9
  export {};