@denizokcu/haze 0.0.1 → 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 (73) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +169 -70
  3. package/dist/cli/commands/chat.d.ts +4 -1
  4. package/dist/cli/commands/chat.js +606 -24
  5. package/dist/cli/commands/commands.d.ts +5 -0
  6. package/dist/cli/commands/commands.js +220 -11
  7. package/dist/cli/commands/formatters.d.ts +1 -0
  8. package/dist/cli/commands/formatters.js +23 -3
  9. package/dist/cli/commands/skills.d.ts +1 -1
  10. package/dist/cli/commands/skills.js +8 -5
  11. package/dist/cli/commands/streaming.d.ts +7 -1
  12. package/dist/cli/commands/streaming.js +533 -41
  13. package/dist/cli/index.js +5 -12
  14. package/dist/config/inputHistory.js +8 -0
  15. package/dist/config/paths.d.ts +0 -1
  16. package/dist/config/paths.js +0 -1
  17. package/dist/config/providers.d.ts +26 -0
  18. package/dist/config/providers.js +88 -0
  19. package/dist/config/settings.d.ts +9 -2
  20. package/dist/core/agent/compaction.d.ts +13 -0
  21. package/dist/core/agent/compaction.js +34 -0
  22. package/dist/core/agent/errors.d.ts +3 -0
  23. package/dist/core/agent/errors.js +13 -0
  24. package/dist/core/agent/events.d.ts +58 -0
  25. package/dist/core/agent/events.js +3 -0
  26. package/dist/core/goal/completionPolicy.d.ts +27 -0
  27. package/dist/core/goal/completionPolicy.js +67 -0
  28. package/dist/core/goal/requestClassifier.d.ts +6 -0
  29. package/dist/core/goal/requestClassifier.js +31 -0
  30. package/dist/core/goal/sessionGoal.d.ts +30 -0
  31. package/dist/core/goal/sessionGoal.js +88 -0
  32. package/dist/core/session/sessionStore.d.ts +37 -0
  33. package/dist/core/session/sessionStore.js +59 -0
  34. package/dist/llm/client.d.ts +1 -1
  35. package/dist/llm/client.js +6 -6
  36. package/dist/llm/hazeTools.d.ts +70 -0
  37. package/dist/llm/hazeTools.js +311 -97
  38. package/dist/llm/initPrompt.js +7 -5
  39. package/dist/llm/systemPrompt.js +25 -11
  40. package/dist/skills/SkillLoader.d.ts +12 -2
  41. package/dist/skills/SkillLoader.js +64 -18
  42. package/dist/skills/SkillRegistry.d.ts +1 -5
  43. package/dist/skills/SkillRegistry.js +10 -21
  44. package/dist/skills/builder/SkillBuilder.d.ts +31 -1
  45. package/dist/skills/builder/SkillBuilder.js +291 -20
  46. package/dist/skills/skillTools.d.ts +20 -0
  47. package/dist/skills/skillTools.js +25 -0
  48. package/dist/skills/types.d.ts +12 -51
  49. package/dist/ui/components/ErrorView.d.ts +2 -1
  50. package/dist/ui/components/Header.d.ts +4 -2
  51. package/dist/ui/components/Header.js +2 -2
  52. package/dist/ui/components/MarkdownText.d.ts +2 -1
  53. package/dist/ui/components/TextInput.d.ts +13 -2
  54. package/dist/ui/components/TextInput.js +125 -25
  55. package/dist/ui/theme.d.ts +2 -0
  56. package/dist/ui/theme.js +3 -1
  57. package/dist/utils/fs.d.ts +1 -0
  58. package/dist/utils/fs.js +10 -6
  59. package/examples/skills/files/SKILL.md +16 -0
  60. package/examples/skills/files/examples/file-editing.md +3 -0
  61. package/package.json +9 -9
  62. package/dist/skills/installer/SkillInstaller.d.ts +0 -1
  63. package/dist/skills/installer/SkillInstaller.js +0 -48
  64. package/dist/skills/manifestSchema.d.ts +0 -31
  65. package/dist/skills/manifestSchema.js +0 -23
  66. package/dist/tools/ToolExecutor.d.ts +0 -3
  67. package/dist/tools/ToolExecutor.js +0 -15
  68. package/dist/tools/types.d.ts +0 -9
  69. package/dist/tools/types.js +0 -1
  70. package/examples/skills/files/prompts/file_tasks.md +0 -1
  71. package/examples/skills/files/skill.yaml +0 -28
  72. package/examples/skills/files/tools/list_files.ts +0 -21
  73. package/examples/skills/files/tools/read_file.ts +0 -12
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
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
+
15
+ ## 0.0.2 - 2026-06-01
16
+
17
+ - Reworked skills into Markdown-first workflows stored in `~/.haze/skills/<name>/SKILL.md`.
18
+ - Added LLM-generated `/skill create <description>` for creating workflow skills from natural language.
19
+ - Exposed installed skills as model-selectable `skill_*` tools and slash-invokable commands.
20
+ - Added slash-command and skill autocomplete with `Tab` completion.
21
+ - Grouped tool calls into compact per-turn activity blocks.
22
+ - Added `listFiles` cursor pagination for large recursive listings.
23
+ - Refined startup/onboarding UI with ASCII logo, status bar, model/workspace details, and clearer setup guidance.
24
+ - Updated README for the minimal LLM harness and adaptive skill workflow.
25
+ - Removed old YAML/executable skill tooling.
26
+
3
27
  ## 0.0.1 - 2026-05-31
4
28
 
5
29
  Initial public release.
package/README.md CHANGED
@@ -1,149 +1,248 @@
1
1
  # Haze
2
2
 
3
- Haze is a pragmatic agentic CLI for building apps from the terminal. It uses the Vercel AI SDK, OpenAI-compatible providers such as OpenRouter, and transparent local tools for reading, editing, writing, and testing files.
3
+ A minimal LLM harness for your terminal.
4
4
 
5
- ## Install
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
+
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.
10
+
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.
12
+
13
+ ```txt
14
+ _
15
+ | |
16
+ | |__ __ _ _______
17
+ | '_ \ / _` |_ / _ \
18
+ | | | | (_| |/ / __/
19
+ |_| |_|\__,_/___\___|
20
+ ```
21
+
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.
23
+
24
+ ## Getting started
25
+
26
+ Install Haze:
6
27
 
7
28
  ```bash
8
29
  npm install -g @denizokcu/haze
9
30
  ```
10
31
 
11
- Then start Haze:
32
+ Open Haze from your project:
12
33
 
13
34
  ```bash
14
- haze
35
+ $ haze
36
+ ```
37
+
38
+ On first run, create or choose a provider, then choose your first model:
39
+
40
+ ```txt
41
+ /provider
42
+ /model
43
+ ```
44
+
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
15
52
  ```
16
53
 
17
- For local development from this repository:
54
+ Or use environment variables for any OpenAI-compatible endpoint:
18
55
 
19
56
  ```bash
20
- npm install
21
- npm run dev
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, ...
22
61
  ```
23
62
 
24
- ## First-time setup
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.
25
66
 
26
- Inside Haze, configure OpenRouter:
67
+ ## Get productive immediately
68
+
69
+ Open a project and ask for work:
27
70
 
28
71
  ```txt
29
- /login
30
- /model openai/gpt-4o-mini
72
+ create a calculator in calc-app in ruby with add subtract multiply divide
31
73
  ```
32
74
 
33
- `/login` stores settings in `~/.haze/settings.json`:
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`.
76
+
77
+ Use `/` to discover commands and skills. `Tab` completes the top suggestion.
34
78
 
35
- ```json
36
- {
37
- "provider": "openrouter",
38
- "apiKey": "...",
39
- "baseURL": "https://openrouter.ai/api/v1",
40
- "model": "openai/gpt-4o-mini"
41
- }
79
+ Useful starters:
80
+
81
+ ```txt
82
+ /init
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
42
86
  ```
43
87
 
44
- Environment variables override saved settings:
88
+ `/init` creates or updates `AGENTS.md` so future sessions understand the project.
45
89
 
46
- ```bash
47
- export OPENAI_API_KEY=...
48
- export OPENAI_BASE_URL=https://openrouter.ai/api/v1
49
- export HAZE_MODEL=openai/gpt-4o-mini
90
+ ## Skills: your workflows, grown while working
91
+
92
+ Skills are Markdown workflows that Haze creates with `/create-skill` and stores in `~/.haze/skills` so you can inspect or refine them later.
93
+
94
+ If you do something for the second time, build a skill for it:
95
+
96
+ ```txt
97
+ /create-skill review the diff between my current branch and main, focusing on bugs, tests, DRY and KISS
50
98
  ```
51
99
 
52
- ## Usage
100
+ Haze uses the model to create the skill file for you:
53
101
 
54
- ```bash
55
- haze
56
- haze --debug
57
- haze skills list
58
- haze skills info <name>
59
- haze skills validate <dir>
60
- haze install-skill <githubRepo>
61
- haze build-skill <description>
102
+ ```txt
103
+ ~/.haze/skills/<skill-name>/SKILL.md
62
104
  ```
63
105
 
64
- Chat commands:
106
+ A skill is just Markdown with frontmatter, a role, a focused prompt, and a small output template:
107
+
108
+ ```md
109
+ ---
110
+ name: code-review-diff-main
111
+ description: Use when the user asks for a code review of the current branch against main.
112
+ ---
113
+
114
+ # Role
115
+
116
+ You are a focused code reviewer.
117
+
118
+ # Focused prompt
119
+
120
+ Review the actual change and return useful, evidence-based feedback.
121
+
122
+ # Procedure
123
+
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>
136
+ ```
137
+
138
+ Installed skills appear as slash commands like:
139
+
140
+ ```txt
141
+ /code-review-diff-main
142
+ ```
143
+
144
+ They are also exposed to the model as `skill_*` tools. The skill does not execute code; it gives Haze a workflow to follow.
145
+
146
+ 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.
147
+
148
+ ## Commands
65
149
 
66
150
  ```txt
67
151
  /help
68
- /login
69
- /model <name>
152
+ /provider
70
153
  /model
154
+ /model <name-or-provider:name>
155
+ /model list
71
156
  /settings
72
157
  /init
158
+ /session
159
+ /resume
160
+ /new
161
+ /compact [instructions]
73
162
  /clear
74
163
  /exit
75
- ```
76
164
 
77
- `/init` explores the current workspace using `.gitignore`-aware tools and creates or updates an `AGENTS.md` file with project instructions for future Haze sessions.
165
+ /create-skill <description>
166
+ /list-skills
167
+ /skill-info <name>
168
+ /validate-skill <name-or-dir>
169
+ /remove-skill <name> --yes
170
+ ```
78
171
 
79
- Input conveniences:
172
+ Legacy `/skill ...` and `/skills ...` commands still work as aliases.
80
173
 
81
- - `↑` / `↓` browse persisted input history.
82
- - `←` / `→` move the cursor.
83
- - `Esc` clears the input field.
84
- - `Ctrl+A` / `Ctrl+E` jump to start/end.
174
+ CLI flags:
85
175
 
86
- Input history is stored in `~/.haze/history/input-history.json`.
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
+ ```
87
181
 
88
182
  ## Agent tools
89
183
 
90
- Haze exposes a small toolset to the model:
184
+ Haze exposes a deliberately small toolset:
91
185
 
92
- - `listFiles` — structured project discovery.
186
+ - `listFiles` — structured discovery, recursive with cursor pagination when needed.
93
187
  - `readFile` — read UTF-8 files with optional line ranges.
94
- - `editFile` — exact unique text replacements.
95
- - `replaceLines` — replace a 1-based line range when exact edits are ambiguous.
96
- - `writeFile` — create or overwrite files.
97
- - `bash` — run shell commands for tests, builds, and inspection.
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.
190
+ - `writeFile` — create files and parent directories.
191
+ - `bash` — run tests, builds, git commands, and inspections.
192
+ - `skill_*` — load Markdown skill instructions on demand.
98
193
 
99
- Tool calls are shown inline in the chat transcript so you can see what Haze is doing.
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.
100
195
 
101
196
  ## Context files
102
197
 
103
- Haze loads project instructions from context files and includes them in the system prompt:
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
+
200
+ Haze loads project instructions from:
104
201
 
105
202
  - `~/.haze/AGENTS.md`
106
203
  - `~/.haze/CLAUDE.md`
107
- - `AGENTS.md` files found while walking from the filesystem root to the current workspace
108
- - `CLAUDE.md` files found while walking from the filesystem root to the current workspace
204
+ - `AGENTS.md` files from filesystem root to the current workspace
205
+ - `CLAUDE.md` files from filesystem root to the current workspace
109
206
 
110
- Use `AGENTS.md` for shared project instructions. `CLAUDE.md` is supported for compatibility with existing projects.
207
+ Use `AGENTS.md` for project conventions, commands, architecture notes, and things future-you does not want to re-explain.
111
208
 
112
209
  ## Safety model
113
210
 
114
211
  - File tools are restricted to the current workspace.
115
212
  - File tools follow `.gitignore` by default.
116
- - Ignored files can still be accessed when explicitly needed by using the tool's ignored-file override.
117
- - Haze is prompted to ask before destructive actions.
118
- - Bash is powerful; review commands shown in the transcript, especially in early releases.
119
-
120
- ## Skills
213
+ - Ignored files require an explicit override.
214
+ - Bash mutations are discouraged by the tool contract.
215
+ - Destructive actions should require explicit user confirmation.
216
+ - Haze is powerful enough to help and dumb enough to deserve supervision. Ideal software, basically.
121
217
 
122
- Default skill locations:
123
-
124
- - `~/.haze/skills/`
125
- - `./.haze/skills/` local overrides global
126
-
127
- A skill is a directory containing `skill.yaml`, optional prompts, and TypeScript tool files. Skill tools run in a subprocess via `tsx`.
128
-
129
- ## Development
218
+ ## Local development
130
219
 
131
220
  ```bash
132
221
  npm install
222
+ npm run dev
133
223
  npm run typecheck
224
+ npm test
225
+ npm run lint
134
226
  npm run build
227
+ ```
228
+
229
+ Package check:
230
+
231
+ ```bash
135
232
  npm pack --dry-run
136
233
  ```
137
234
 
138
- The npm package intentionally ships only `bin`, `dist`, `README.md`, `LICENSE`, `CHANGELOG.md`, and `examples`.
235
+ The npm package ships `bin`, `dist`, README, license, changelog, and examples.
139
236
 
140
237
  ## Release
141
238
 
142
239
  ```bash
143
240
  npm run typecheck
241
+ npm test
242
+ npm run lint
144
243
  npm run build
145
244
  npm pack --dry-run
146
- git tag v0.0.1
245
+ git tag vX.Y.Z
147
246
  git push origin main --tags
148
247
  npm publish --access public
149
248
  ```
@@ -1,6 +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
+ version?: string;
5
+ continueSession?: boolean;
6
+ noSession?: boolean;
4
7
  }
5
8
  export declare function chatCommand(options?: ChatOptions): Promise<void>;
6
9
  export {};