@denizokcu/haze 0.0.2 → 0.0.3

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 (45) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/README.md +87 -33
  3. package/dist/cli/commands/chat.d.ts +3 -1
  4. package/dist/cli/commands/chat.js +442 -52
  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 +5 -2
  8. package/dist/cli/commands/streaming.d.ts +5 -1
  9. package/dist/cli/commands/streaming.js +193 -86
  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 +27 -0
  22. package/dist/core/goal/completionPolicy.js +67 -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/llm/client.d.ts +1 -1
  30. package/dist/llm/client.js +6 -6
  31. package/dist/llm/hazeTools.d.ts +38 -0
  32. package/dist/llm/hazeTools.js +196 -92
  33. package/dist/llm/initPrompt.js +6 -4
  34. package/dist/llm/systemPrompt.js +3 -3
  35. package/dist/skills/builder/SkillBuilder.d.ts +6 -0
  36. package/dist/skills/builder/SkillBuilder.js +146 -24
  37. package/dist/ui/components/ErrorView.d.ts +2 -1
  38. package/dist/ui/components/Header.d.ts +2 -1
  39. package/dist/ui/components/Header.js +1 -11
  40. package/dist/ui/components/MarkdownText.d.ts +2 -1
  41. package/dist/ui/components/TextInput.d.ts +7 -3
  42. package/dist/ui/components/TextInput.js +112 -27
  43. package/dist/ui/theme.d.ts +1 -0
  44. package/dist/ui/theme.js +2 -1
  45. package/package.json +8 -8
package/CHANGELOG.md CHANGED
@@ -2,6 +2,16 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.0.3 - 2026-06-06
6
+
7
+ - Added stable transcript rendering for long sessions, compact placeholders for large multiline pastes, and clearer goal/status display.
8
+ - Added OpenAI-compatible provider management with `/provider`, provider-qualified model selection, and legacy OpenRouter settings migration.
9
+ - Added durable workspace sessions with `haze --continue`, `--no-session`, `/session`, `/resume`, `/new`, and `/compact`.
10
+ - Added context compaction and goal-aware completion tracking to improve long-running agent turns.
11
+ - Hardened file tools with structured recoverable failures, safer concurrent mutation handling, line-number-prefix tolerant edits, and EOF-clamped line replacements.
12
+ - Simplified generated skill structure around role, focused prompt, and compact output templates.
13
+ - Updated docs site install/version copy and refreshed dependencies.
14
+
5
15
  ## 0.0.2 - 2026-06-01
6
16
 
7
17
  - Reworked skills into Markdown-first workflows stored in `~/.haze/skills/<name>/SKILL.md`.
package/README.md CHANGED
@@ -2,9 +2,13 @@
2
2
 
3
3
  A minimal LLM harness for your terminal.
4
4
 
5
+ ## What's new in 0.0.3
6
+
7
+ Haze 0.0.3 keeps long sessions calmer with stable transcript rendering, compact placeholders for large multiline pastes, and clearer goal/status display. Pasted text is still sent to the model with line breaks preserved.
8
+
5
9
  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.
6
10
 
7
- MVP scope: Haze currently uses OpenRouter only. More providers are on the roadmap after the goblin learns to hold a spoon safely.
11
+ 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
12
 
9
13
  ```txt
10
14
  _
@@ -17,30 +21,48 @@ MVP scope: Haze currently uses OpenRouter only. More providers are on the roadma
17
21
 
18
22
  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
23
 
20
- ## Install
24
+ ## Getting started
25
+
26
+ Install Haze:
21
27
 
22
28
  ```bash
23
29
  npm install -g @denizokcu/haze
24
- haze
25
30
  ```
26
31
 
27
- First run inside Haze, do both steps:
32
+ Open Haze from your project:
33
+
34
+ ```bash
35
+ $ haze
36
+ ```
37
+
38
+ On first run, create or choose a provider, then choose your first model:
28
39
 
29
40
  ```txt
30
- /login
31
- /model x-ai/grok-build-0.1
41
+ /provider
42
+ /model
32
43
  ```
33
44
 
34
- `/login` saves your API key. `/model` saves the model Haze should use. The recommended MVP model is `x-ai/grok-build-0.1`.
45
+ `/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.
46
+
47
+ `/model` selects the model Haze should use. You can also set one directly:
48
+
49
+ ```txt
50
+ /model x-ai/grok-build-0.1
51
+ /model local:llama3.1
52
+ ```
35
53
 
36
- Or use environment variables:
54
+ Or use environment variables for any OpenAI-compatible endpoint:
37
55
 
38
56
  ```bash
39
- export OPENAI_API_KEY=... # your OpenRouter API key
40
- export HAZE_MODEL=x-ai/grok-build-0.1
57
+ # e.g. OpenRouter, OpenAI, LM Studio, Ollama, or an OpenAI-compatible proxy
58
+ export OPENAI_API_KEY=... # provider API key, if needed; local providers may not need one
59
+ export OPENAI_BASE_URL=https://openrouter.ai/api/v1 # or http://localhost:1234/v1, http://localhost:11434/v1, ...
60
+ export HAZE_MODEL=x-ai/grok-build-0.1 # or gpt-4.1, llama3.1, qwen2.5-coder, ...
41
61
  ```
42
62
 
43
- Saved settings live in `~/.haze/settings.json`. The current MVP experience is documented around OpenRouter; more provider docs are future work.
63
+ 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.
64
+
65
+ 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
66
 
45
67
  ## Get productive immediately
46
68
 
@@ -50,7 +72,7 @@ Open a project and ask for work:
50
72
  create a calculator in calc-app in ruby with add subtract multiply divide
51
73
  ```
52
74
 
53
- Haze will inspect, write files, run commands, and show compact tool activity inline.
75
+ Haze will inspect, write files, run commands, and show compact tool activity inline. Sessions are saved by default so you can resume the latest workspace conversation with `haze --continue` or `/resume`.
54
76
 
55
77
  Use `/` to discover commands and skills. `Tab` completes the top suggestion.
56
78
 
@@ -58,30 +80,30 @@ Useful starters:
58
80
 
59
81
  ```txt
60
82
  /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
83
+ /create-skill review my current branch against main like a senior engineer
84
+ /create-skill prepare clean git commits from my uncommitted changes
85
+ /create-skill implement small features with tests and a concise summary
64
86
  ```
65
87
 
66
88
  `/init` creates or updates `AGENTS.md` so future sessions understand the project.
67
89
 
68
90
  ## Skills: your workflows, grown while working
69
91
 
70
- Skills are Markdown workflows stored in `~/.haze/skills`.
92
+ Skills are Markdown workflows that Haze creates with `/create-skill` and stores in `~/.haze/skills` so you can inspect or refine them later.
71
93
 
72
- When you notice yourself asking for the same kind of work, make it a skill:
94
+ If you do something for the second time, build a skill for it:
73
95
 
74
96
  ```txt
75
- /skill create review the diff between my current branch and main, focusing on bugs, tests, DRY and KISS
97
+ /create-skill review the diff between my current branch and main, focusing on bugs, tests, DRY and KISS
76
98
  ```
77
99
 
78
- Haze uses the model to create:
100
+ Haze uses the model to create the skill file for you:
79
101
 
80
102
  ```txt
81
103
  ~/.haze/skills/<skill-name>/SKILL.md
82
104
  ```
83
105
 
84
- A skill is just Markdown with frontmatter:
106
+ A skill is just Markdown with frontmatter, a role, a focused prompt, and a small output template:
85
107
 
86
108
  ```md
87
109
  ---
@@ -89,13 +111,28 @@ name: code-review-diff-main
89
111
  description: Use when the user asks for a code review of the current branch against main.
90
112
  ---
91
113
 
92
- # Goal
114
+ # Role
115
+
116
+ You are a focused code reviewer.
117
+
118
+ # Focused prompt
93
119
 
94
120
  Review the actual change and return useful, evidence-based feedback.
95
121
 
96
122
  # Procedure
97
123
 
98
124
  Inspect branch state, changed files, staged and unstaged diffs, then review incrementally.
125
+
126
+ # Output template
127
+
128
+ ## Summary
129
+ - <scope and result>
130
+
131
+ ## Findings
132
+ - <prioritized findings, or "No issues found">
133
+
134
+ ## Evidence inspected
135
+ - <commands/files used>
99
136
  ```
100
137
 
101
138
  Installed skills appear as slash commands like:
@@ -112,22 +149,35 @@ This is the trick: do normal work, notice friction, create a skill, keep going.
112
149
 
113
150
  ```txt
114
151
  /help
115
- /login
116
- /model <name>
152
+ /provider
117
153
  /model
154
+ /model <name-or-provider:name>
155
+ /model list
118
156
  /settings
119
157
  /init
158
+ /session
159
+ /resume
160
+ /new
161
+ /compact [instructions]
120
162
  /clear
121
163
  /exit
122
164
 
123
- /skill create <description>
124
- /skill list
125
- /skill info <name>
126
- /skill validate <name-or-dir>
127
- /skill remove <name> --yes
165
+ /create-skill <description>
166
+ /list-skills
167
+ /skill-info <name>
168
+ /validate-skill <name-or-dir>
169
+ /remove-skill <name> --yes
128
170
  ```
129
171
 
130
- `/skills ...` also works as an alias for `/skill ...`.
172
+ Legacy `/skill ...` and `/skills ...` commands still work as aliases.
173
+
174
+ CLI flags:
175
+
176
+ ```bash
177
+ haze --debug # show model/tool debug logs
178
+ haze --continue # resume the latest saved session for this workspace
179
+ haze --no-session # run without durable session storage
180
+ ```
131
181
 
132
182
  ## Agent tools
133
183
 
@@ -135,16 +185,18 @@ Haze exposes a deliberately small toolset:
135
185
 
136
186
  - `listFiles` — structured discovery, recursive with cursor pagination when needed.
137
187
  - `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.
188
+ - `editFile` — unique text replacements, with line-number-prefix tolerance for common model mistakes.
189
+ - `replaceLines` — line-range edits when exact replacements are awkward; slightly-too-large EOF ranges are clamped.
140
190
  - `writeFile` — create files and parent directories.
141
191
  - `bash` — run tests, builds, git commands, and inspections.
142
192
  - `skill_*` — load Markdown skill instructions on demand.
143
193
 
144
- Tool calls are grouped in the transcript so you can see what happened without reading a novella.
194
+ Tool calls are grouped in the transcript so you can see what happened without reading a novella. File-tool failures return structured recovery hints instead of mystery stack traces.
145
195
 
146
196
  ## Context files
147
197
 
198
+ 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.
199
+
148
200
  Haze loads project instructions from:
149
201
 
150
202
  - `~/.haze/AGENTS.md`
@@ -180,12 +232,14 @@ Package check:
180
232
  npm pack --dry-run
181
233
  ```
182
234
 
183
- The npm package ships `bin`, `dist`, docs, license, changelog, and examples.
235
+ The npm package ships `bin`, `dist`, README, license, changelog, and examples.
184
236
 
185
237
  ## Release
186
238
 
187
239
  ```bash
188
240
  npm run typecheck
241
+ npm test
242
+ npm run lint
189
243
  npm run build
190
244
  npm pack --dry-run
191
245
  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 {};