@denizokcu/haze 0.4.0 → 0.5.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 +28 -0
- package/README.md +31 -29
- package/dist/cli/commands/chat.js +106 -48
- package/dist/cli/commands/commands.js +15 -1
- package/dist/cli/commands/streaming.d.ts +4 -0
- package/dist/cli/commands/streaming.js +242 -111
- package/dist/config/contextFiles.d.ts +6 -0
- package/dist/config/contextFiles.js +47 -16
- package/dist/config/providers.d.ts +2 -5
- package/dist/config/providers.js +16 -12
- package/dist/core/agent/requestAssembly.js +12 -1
- package/dist/core/agent/toolOutputStore.d.ts +6 -1
- package/dist/core/agent/toolOutputStore.js +33 -1
- package/dist/core/bashOutput/ansi.d.ts +1 -0
- package/dist/core/bashOutput/ansi.js +7 -0
- package/dist/core/bashOutput/command.d.ts +2 -0
- package/dist/core/bashOutput/command.js +62 -0
- package/dist/core/bashOutput/lineFilter.d.ts +25 -0
- package/dist/core/bashOutput/lineFilter.js +62 -0
- package/dist/core/bashOutput/reducers/content.d.ts +3 -0
- package/dist/core/bashOutput/reducers/content.js +134 -0
- package/dist/core/bashOutput/reducers/git.d.ts +1 -0
- package/dist/core/bashOutput/reducers/git.js +147 -0
- package/dist/core/bashOutput/reducers/search.d.ts +7 -0
- package/dist/core/bashOutput/reducers/search.js +76 -0
- package/dist/core/bashOutput/reducers/validation.d.ts +2 -0
- package/dist/core/bashOutput/reducers/validation.js +41 -0
- package/dist/core/bashOutput/registry.d.ts +4 -0
- package/dist/core/bashOutput/registry.js +126 -0
- package/dist/core/bashOutput/types.d.ts +46 -0
- package/dist/core/bashOutput/types.js +1 -0
- package/dist/core/goal/completionPolicy.d.ts +1 -0
- package/dist/core/goal/completionPolicy.js +4 -0
- package/dist/core/safety/urlGuard.d.ts +37 -0
- package/dist/core/safety/urlGuard.js +206 -0
- package/dist/core/subagent/subagentRunner.d.ts +1 -1
- package/dist/core/subagent/subagentRunner.js +2 -2
- package/dist/core/toolOutput/reduction.d.ts +25 -0
- package/dist/core/toolOutput/reduction.js +23 -0
- package/dist/llm/client.d.ts +2 -2
- package/dist/llm/client.js +6 -4
- package/dist/llm/hazeTools.d.ts +133 -16
- package/dist/llm/hazeTools.js +205 -31
- package/dist/llm/initPrompt.js +2 -1
- package/dist/llm/systemPrompt.js +3 -1
- package/dist/llm/toolResultTypes.d.ts +1 -1
- package/dist/llm/webFetch.d.ts +57 -0
- package/dist/llm/webFetch.js +270 -0
- package/dist/ui/components/MarkdownText.d.ts +2 -0
- package/dist/ui/components/MarkdownText.js +116 -3
- package/package.json +17 -10
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,34 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
- Nothing yet.
|
|
6
|
+
|
|
7
|
+
## 0.5.0 - 2026-06-19
|
|
8
|
+
|
|
9
|
+
### Changed
|
|
10
|
+
|
|
11
|
+
- 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.
|
|
12
|
+
- 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.
|
|
13
|
+
- 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.
|
|
14
|
+
- `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.
|
|
15
|
+
- 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.
|
|
16
|
+
- 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.
|
|
17
|
+
- Consecutive assistant messages in one turn now share a single visible `haze` header for a less noisy transcript.
|
|
18
|
+
- 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.
|
|
19
|
+
- Context loading now includes global `~/.claude/CLAUDE.md` while keeping `~/.haze/AGENTS.md` higher priority for Haze-specific global guidance.
|
|
20
|
+
- 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.
|
|
21
|
+
- 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.
|
|
22
|
+
- `/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.
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- `fetch` tool: read public URLs as readable content (Markdown for HTML, pretty JSON for JSON, passthrough text), with SSRF protection (scheme allowlist + private/loopback/link-local/metadata blocking, re-validated per redirect and after DNS resolution), a 2 MB raw-download cap, and a 30 s timeout. Oversize output stays retrievable via `readToolOutput`. HTML→Markdown extraction uses `defuddle` (readability-grade, pure-JS DOM).
|
|
27
|
+
- Shared tool-output reduction metadata (`reducerName`, `contentKind`, `lossy`, `parseTier`, token/character savings, handles, omitted counts) for reduced tool results.
|
|
28
|
+
|
|
29
|
+
### Removed
|
|
30
|
+
|
|
31
|
+
- Removed obsolete token-efficiency planning documents and the unused alternate docs-site HTML file from `docs/`.
|
|
32
|
+
|
|
5
33
|
## 0.4.0 - 2026-06-15
|
|
6
34
|
|
|
7
35
|
### Skills
|
package/README.md
CHANGED
|
@@ -2,18 +2,22 @@
|
|
|
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.5.0
|
|
6
6
|
|
|
7
|
-
Haze 0.
|
|
7
|
+
Haze 0.5.0 adds web fetching, scoped project instructions, debug-only detailed logs, and quieter long-running transcripts.
|
|
8
8
|
|
|
9
|
-
- **
|
|
10
|
-
- **
|
|
11
|
-
- **
|
|
12
|
-
- **
|
|
13
|
-
- **
|
|
9
|
+
- **Fetch public URLs.** The new `fetch` tool reads public HTTP(S) pages as Markdown, JSON, or text, with SSRF protections, redirects re-checked, bounded downloads, and oversize output retrievable via `readToolOutput`.
|
|
10
|
+
- **No provider env vars.** `OPENAI_API_KEY`, `OPENAI_BASE_URL`, `HAZE_MODEL`, and `HAZE_CONTEXT_BUDGET_SHARE` are no longer read. Configure providers, models, keys, and base URLs through `/provider`, `/model`, `/settings`, and `~/.haze/settings.json`.
|
|
11
|
+
- **Debug-only LLM logs.** Detailed JSONL LLM logging is now off by default and only starts with `haze --debug`. `/logs` can still review historical logs.
|
|
12
|
+
- **Quieter tool output.** Bash, git, search, JSON, diff, and log output are reduced before they enter model context, with raw output available through `readToolOutput` when needed.
|
|
13
|
+
- **Cleaner terminal rendering.** Assistant Markdown now renders headings, lists, code fences with syntax highlighting, blockquotes, links, emphasis, and wrapped tables in the CLI.
|
|
14
|
+
- **Cleaner transcripts.** Consecutive assistant messages in one turn share one visible `haze` header, live tool groups use compact elapsed-time summaries, and repeated identical tool calls are steered back to the model instead of aborting immediately.
|
|
15
|
+
- **Scoped instructions.** Haze reads global `~/.claude/CLAUDE.md` plus Haze/project `AGENTS.md` files, and discovers nested `CLAUDE.md`/`AGENTS.md` files only when tools enter their subtree.
|
|
16
|
+
- **Less stale state.** Completed task lists clear automatically on the next user turn, and `/init` now guides `AGENTS.md` toward the context-file budget.
|
|
14
17
|
|
|
15
18
|
Previous releases:
|
|
16
19
|
|
|
20
|
+
- **0.4.0** — 3-step skill wizard, language-agnostic skill intent extraction, model-managed tasks, leaner command surface, docs site additions.
|
|
17
21
|
- **0.3.0** — Docs site redesign, task bar moves above the activity spinner, tasks auto-clear between sessions.
|
|
18
22
|
- **0.2.0** — Reliability release: stronger continuation after failed edits and validation, structured bash classification, parsed validation summaries, multi-line chat input with vertical cursor movement.
|
|
19
23
|
- **0.1.0** — Bundled ripgrep, subagent delegation, inline diff display.
|
|
@@ -64,16 +68,7 @@ On first run, create or choose a provider, then choose your first model:
|
|
|
64
68
|
/model local:llama3.1
|
|
65
69
|
```
|
|
66
70
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
```bash
|
|
70
|
-
# e.g. OpenRouter, OpenAI, LM Studio, Ollama, or an OpenAI-compatible proxy
|
|
71
|
-
export OPENAI_API_KEY=... # provider API key, if needed; local providers may not need one
|
|
72
|
-
export OPENAI_BASE_URL=https://openrouter.ai/api/v1 # or http://localhost:1234/v1, http://localhost:11434/v1, ...
|
|
73
|
-
export HAZE_MODEL=anthropic/claude-sonnet-4.6 # or gpt-4.1, llama3.1, qwen2.5-coder, ...
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
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.
|
|
71
|
+
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.
|
|
77
72
|
|
|
78
73
|
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` (a 3-step wizard: name, role, 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.
|
|
79
74
|
|
|
@@ -85,7 +80,7 @@ Open a project and ask for work:
|
|
|
85
80
|
create a calculator in calc-app in ruby with add subtract multiply divide
|
|
86
81
|
```
|
|
87
82
|
|
|
88
|
-
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. Bash
|
|
83
|
+
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`.
|
|
89
84
|
|
|
90
85
|
Use `/` to discover commands and skills. `Tab` completes the top suggestion.
|
|
91
86
|
|
|
@@ -170,6 +165,7 @@ This is the trick: do normal work, notice friction, create a skill, keep going.
|
|
|
170
165
|
/model <name-or-provider:name>
|
|
171
166
|
/model list
|
|
172
167
|
/settings
|
|
168
|
+
/logs [id]
|
|
173
169
|
/init
|
|
174
170
|
/session
|
|
175
171
|
/resume
|
|
@@ -178,38 +174,42 @@ This is the trick: do normal work, notice friction, create a skill, keep going.
|
|
|
178
174
|
/clear
|
|
179
175
|
/exit
|
|
180
176
|
|
|
177
|
+
/skills
|
|
181
178
|
/create-skill
|
|
182
179
|
/skill-info <name>
|
|
183
180
|
/validate-skill <name-or-dir>
|
|
184
181
|
/remove-skill <name> --yes
|
|
185
182
|
```
|
|
186
183
|
|
|
187
|
-
|
|
184
|
+
Older `/skill <subcommand>` and `/skills <subcommand>` routing forms were removed; use the direct skill commands above.
|
|
188
185
|
|
|
189
186
|
CLI flags:
|
|
190
187
|
|
|
191
188
|
```bash
|
|
192
|
-
haze --debug # show model/tool debug logs
|
|
189
|
+
haze --debug # show model/tool debug logs and write detailed JSONL logs to ~/.haze/logs
|
|
193
190
|
haze --continue # resume the latest saved session for this workspace
|
|
194
191
|
haze --no-session # run without durable session storage
|
|
195
192
|
```
|
|
196
193
|
|
|
194
|
+
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.
|
|
195
|
+
|
|
197
196
|
## Agent tools
|
|
198
197
|
|
|
199
198
|
Haze exposes a deliberately small toolset:
|
|
200
199
|
|
|
201
200
|
- `listFiles` — structured discovery, recursive with cursor pagination when needed.
|
|
202
201
|
- `readFile` — read numbered UTF-8 lines in bounded pages, with `nextOffset` when more remain.
|
|
203
|
-
- `grep` — structured ripgrep search with a true global result cap.
|
|
202
|
+
- `grep` — structured ripgrep search with a true global result cap and compacted long lines/results.
|
|
204
203
|
- `editFile` — unique text replacements, with line-number-prefix tolerance for common model mistakes.
|
|
205
204
|
- `replaceLines` — line-range edits when exact replacements are awkward; slightly-too-large EOF ranges are clamped.
|
|
206
205
|
- `writeFile` — create files and parent directories.
|
|
207
|
-
- `bash` — run tests, builds, git commands, inspections, scripts, installs, and other shell workflows with compact validation output.
|
|
208
|
-
- `readToolOutput` — page through full output omitted from an oversized tool result.
|
|
209
|
-
- `
|
|
206
|
+
- `bash` — run tests, builds, git commands, inspections, scripts, installs, and other shell workflows with command-aware output reduction and compact validation output.
|
|
207
|
+
- `readToolOutput` — page through full/raw output omitted from an oversized or reduced tool result.
|
|
208
|
+
- `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`.
|
|
209
|
+
- `writeTasks` — replace the task list at meaningful phase changes; completed lists auto-clear on the next user turn.
|
|
210
210
|
- `skill` — load one installed Markdown workflow or one of its references.
|
|
211
211
|
|
|
212
|
-
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 reason codes and recovery hints. Large bash output is kept behind an in-memory handle so later model calls carry only
|
|
212
|
+
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 reason codes and recovery hints. Large bash/search/fetch output is kept behind an in-memory handle so later model calls carry only reduced validation, git, search, diff, JSON, log, or head/tail summaries.
|
|
213
213
|
|
|
214
214
|
## Subagents
|
|
215
215
|
|
|
@@ -225,12 +225,13 @@ Long turns use bounded tool slices. Older successful tool results are compacted
|
|
|
225
225
|
|
|
226
226
|
Haze loads project instructions from:
|
|
227
227
|
|
|
228
|
+
- `~/.claude/CLAUDE.md`
|
|
228
229
|
- `~/.haze/AGENTS.md`
|
|
229
|
-
-
|
|
230
|
-
|
|
231
|
-
|
|
230
|
+
- `CLAUDE.md` / `AGENTS.md` files from filesystem root to the current workspace
|
|
231
|
+
|
|
232
|
+
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, and mutating tools stop once so the model can review newly discovered scoped instructions before editing.
|
|
232
233
|
|
|
233
|
-
Use `AGENTS.md` for project conventions, commands, architecture notes, and things future-you does not want to re-explain.
|
|
234
|
+
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.
|
|
234
235
|
|
|
235
236
|
## Safety model
|
|
236
237
|
|
|
@@ -238,6 +239,7 @@ Use `AGENTS.md` for project conventions, commands, architecture notes, and thing
|
|
|
238
239
|
- File tools follow `.gitignore` by default.
|
|
239
240
|
- Ignored files require an explicit override.
|
|
240
241
|
- Bash commands are classified and shown with working-directory metadata, but Haze does not use command confirmation gates.
|
|
242
|
+
- The `fetch` tool reads public `http(s)` URLs only; private, loopback, link-local, and cloud-metadata hosts and non-`http(s)` schemes are blocked, re-checked on every redirect and after DNS resolution.
|
|
241
243
|
- Mutating and destructive commands can run when they are relevant to the user's request; this is intentional for expert users.
|
|
242
244
|
- Haze is powerful enough to help and dumb enough to deserve supervision. Ideal software, basically.
|
|
243
245
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { execFile as execFileCallback } from 'node:child_process';
|
|
4
|
+
import os from 'node:os';
|
|
4
5
|
import { promisify } from 'node:util';
|
|
5
6
|
import { Box, render, Static, Text, useApp, useStdout } from 'ink';
|
|
6
7
|
import Spinner from 'ink-spinner';
|
|
@@ -8,7 +9,7 @@ import { readContextFiles } from '../../config/contextFiles.js';
|
|
|
8
9
|
import { addInputHistoryItem, readInputHistory } from '../../config/inputHistory.js';
|
|
9
10
|
import { loadTasks as loadTasksFromStore, clearTasks as clearTasksFromStore } from '../../core/tasks/taskStorage.js';
|
|
10
11
|
import { readSettings, updateSettings } from '../../config/settings.js';
|
|
11
|
-
import { activeModel, configuredProviders,
|
|
12
|
+
import { activeModel, configuredProviders, findProvider, modelSelector, providerHasKey, resolveModelSelector, upsertProvider } from '../../config/providers.js';
|
|
12
13
|
import { Header } from '../../ui/components/Header.js';
|
|
13
14
|
import { TextInput } from '../../ui/components/TextInput.js';
|
|
14
15
|
import { MarkdownText } from '../../ui/components/MarkdownText.js';
|
|
@@ -48,6 +49,12 @@ function toolCallCount(messages) {
|
|
|
48
49
|
function estimateTokens(text) {
|
|
49
50
|
return Math.ceil(text.length / 4);
|
|
50
51
|
}
|
|
52
|
+
function compactHomePath(filePath) {
|
|
53
|
+
const home = os.homedir();
|
|
54
|
+
if (filePath === home)
|
|
55
|
+
return '~';
|
|
56
|
+
return filePath.startsWith(`${home}/`) ? `~/${filePath.slice(home.length + 1)}` : filePath;
|
|
57
|
+
}
|
|
51
58
|
function formatTokenCount(tokens) {
|
|
52
59
|
if (tokens >= 1_000_000)
|
|
53
60
|
return `${(tokens / 1_000_000).toFixed(tokens >= 10_000_000 ? 0 : 1).replace(/\.0$/, '')}m`;
|
|
@@ -115,13 +122,16 @@ function messageElapsedLabel(message) {
|
|
|
115
122
|
return '';
|
|
116
123
|
const end = message.finishedAt ?? (message.streaming ? Date.now() : message.startedAt);
|
|
117
124
|
const elapsed = end - message.startedAt;
|
|
125
|
+
if (message.role === 'assistant' && !message.streaming && message.tokensPerSecond != null) {
|
|
126
|
+
return `✓ Done in ${formatElapsedTime(elapsed)} · ${Math.round(message.tokensPerSecond)} tok/s`;
|
|
127
|
+
}
|
|
118
128
|
return message.streaming ? formatElapsedTimeWhole(elapsed) : formatElapsedTime(elapsed);
|
|
119
129
|
}
|
|
120
|
-
function MessageView({ message, width }) {
|
|
130
|
+
function MessageView({ message, width, suppressAssistantHeader = false }) {
|
|
121
131
|
if (message.role === 'user') {
|
|
122
132
|
return _jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsx(Text, { backgroundColor: theme.quoteBg, children: fullWidthBlankLine(width) }), _jsx(Text, { color: theme.success, bold: true, backgroundColor: theme.quoteBg, children: ' You asked'.padEnd(width) }), fullWidthLines(message.text, width, 2).map((line, lineIndex) => _jsx(Text, { color: "white", backgroundColor: theme.quoteBg, children: line }, lineIndex)), _jsx(Text, { backgroundColor: theme.quoteBg, children: fullWidthBlankLine(width) })] });
|
|
123
133
|
}
|
|
124
|
-
return _jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Text, { children: [_jsx(Text, { color: message.role === 'assistant' ? theme.purple : message.role === 'tool' ? theme.blue : theme.muted, bold: true, children: message.role === 'assistant' ? 'haze' : message.role === 'tool' ? 'Tool' : 'Info' }), messageElapsedLabel(message) ? _jsxs(Text, { color: theme.muted, bold: false, children: [" \u00B7 ", messageElapsedLabel(message)] }) : null] }), message.role === 'tool'
|
|
134
|
+
return _jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [!suppressAssistantHeader && _jsxs(Text, { children: [_jsx(Text, { color: message.role === 'assistant' ? theme.purple : message.role === 'tool' ? theme.blue : theme.muted, bold: true, children: message.role === 'assistant' ? 'haze' : message.role === 'tool' ? 'Tool' : 'Info' }), messageElapsedLabel(message) ? _jsxs(Text, { color: theme.muted, bold: false, children: [" \u00B7 ", messageElapsedLabel(message)] }) : null] }), message.role === 'tool'
|
|
125
135
|
? _jsx(ToolMessageText, { text: message.text, streaming: message.streaming })
|
|
126
136
|
: message.role === 'assistant' && !message.streaming
|
|
127
137
|
? _jsx(MarkdownText, { content: message.text })
|
|
@@ -130,21 +140,47 @@ function MessageView({ message, width }) {
|
|
|
130
140
|
function messageKey(message, index) {
|
|
131
141
|
return message.id ?? `${index}-${message.role}-${message.text}`;
|
|
132
142
|
}
|
|
143
|
+
function orderedDisplayMessages(messages) {
|
|
144
|
+
return messages
|
|
145
|
+
.map((message, index) => ({ message, index }))
|
|
146
|
+
.sort((a, b) => {
|
|
147
|
+
if (a.message.displayOrder != null && b.message.displayOrder != null && a.message.displayOrder !== b.message.displayOrder) {
|
|
148
|
+
return a.message.displayOrder - b.message.displayOrder;
|
|
149
|
+
}
|
|
150
|
+
return a.index - b.index;
|
|
151
|
+
})
|
|
152
|
+
.map(item => item.message);
|
|
153
|
+
}
|
|
154
|
+
function annotateTurnHeaders(messages) {
|
|
155
|
+
return messages.map(message => ({ message, suppressAssistantHeader: false }));
|
|
156
|
+
}
|
|
133
157
|
function startupProviderInfo(settings) {
|
|
134
158
|
const selection = activeModel(settings);
|
|
135
|
-
const
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
159
|
+
const configuredCount = configuredProviders(settings).length;
|
|
160
|
+
if (!selection) {
|
|
161
|
+
return [
|
|
162
|
+
'Provider configuration',
|
|
163
|
+
'- Provider: not configured',
|
|
164
|
+
'- Model: not set',
|
|
165
|
+
'- Base URL: not configured',
|
|
166
|
+
'- API key: missing',
|
|
167
|
+
`- Configured providers: ${configuredCount}`,
|
|
168
|
+
'',
|
|
169
|
+
'Run /provider to choose or add a provider, then select a model.',
|
|
170
|
+
].join('\n');
|
|
171
|
+
}
|
|
172
|
+
const model = selection.model;
|
|
173
|
+
const modelSource = settings.model ? 'settings' : 'provider default';
|
|
174
|
+
const baseURL = selection.provider.url;
|
|
175
|
+
const apiKeySource = providerHasKey(settings, selection.provider) ? `provider ${selection.provider.name}` : 'missing';
|
|
176
|
+
const provider = selection.provider.name;
|
|
141
177
|
return [
|
|
142
178
|
'Provider configuration',
|
|
143
179
|
`- Provider: ${provider}`,
|
|
144
180
|
`- Model: ${model} (${modelSource})`,
|
|
145
|
-
`- Base URL: ${baseURL} (
|
|
181
|
+
`- Base URL: ${baseURL} (settings)`,
|
|
146
182
|
`- API key: ${apiKeySource === 'missing' ? 'not configured; local providers may not need one' : `configured via ${apiKeySource}`}`,
|
|
147
|
-
`- Configured providers: ${
|
|
183
|
+
`- Configured providers: ${configuredCount}`,
|
|
148
184
|
].join('\n');
|
|
149
185
|
}
|
|
150
186
|
const TASK_STATUS_ICON = {
|
|
@@ -188,14 +224,24 @@ function ChatScreen({ debug = false, version, continueSession = false, noSession
|
|
|
188
224
|
const { exit } = useApp();
|
|
189
225
|
const { stdout } = useStdout();
|
|
190
226
|
const width = stdout.columns ?? process.stdout.columns ?? 80;
|
|
191
|
-
const
|
|
192
|
-
|
|
227
|
+
const nextDisplayOrderRef = useRef(1);
|
|
228
|
+
const withDisplayOrder = (message) => {
|
|
229
|
+
if (message.displayOrder != null)
|
|
230
|
+
return message;
|
|
231
|
+
return { ...message, displayOrder: nextDisplayOrderRef.current++ };
|
|
232
|
+
};
|
|
233
|
+
const withDisplayOrders = (next) => next.map(withDisplayOrder);
|
|
234
|
+
const [messages, setMessagesRaw] = useState([
|
|
235
|
+
{ role: 'system', text: 'Welcome to Haze. Use /help for commands.', displayOrder: 0 }
|
|
193
236
|
]);
|
|
237
|
+
const setMessages = (updater) => {
|
|
238
|
+
setMessagesRaw(previous => withDisplayOrders(typeof updater === 'function' ? updater(previous) : updater));
|
|
239
|
+
};
|
|
194
240
|
const [liveMessages, setLiveMessages] = useState([]);
|
|
195
241
|
const liveMessagesRef = useRef([]);
|
|
196
242
|
const setLiveMessagesState = (updater) => {
|
|
197
243
|
setLiveMessages(previous => {
|
|
198
|
-
const next = updater(previous);
|
|
244
|
+
const next = withDisplayOrders(updater(previous));
|
|
199
245
|
liveMessagesRef.current = next;
|
|
200
246
|
return next;
|
|
201
247
|
});
|
|
@@ -221,7 +267,6 @@ function ChatScreen({ debug = false, version, continueSession = false, noSession
|
|
|
221
267
|
const [taskBarPadding, setTaskBarPadding] = useState(0);
|
|
222
268
|
const [, setSessionLabel] = useState();
|
|
223
269
|
const [tokenUsage, setTokenUsage] = useState({ ...EMPTY_TOKEN_USAGE });
|
|
224
|
-
const [, setTimerTick] = useState(0);
|
|
225
270
|
const [queuedFollowUps, setQueuedFollowUps] = useState([]);
|
|
226
271
|
const [skills, setSkills] = useState([]);
|
|
227
272
|
const [branchName, setBranchName] = useState();
|
|
@@ -229,10 +274,6 @@ function ChatScreen({ debug = false, version, continueSession = false, noSession
|
|
|
229
274
|
const [selectedProviderName, setSelectedProviderName] = useState();
|
|
230
275
|
const [providerDraft, setProviderDraft] = useState({});
|
|
231
276
|
const [skillCreateDraft, setSkillCreateDraft] = useState({});
|
|
232
|
-
useEffect(() => {
|
|
233
|
-
const timer = setInterval(() => setTimerTick(tick => tick + 1), 1000);
|
|
234
|
-
return () => clearInterval(timer);
|
|
235
|
-
}, []);
|
|
236
277
|
useEffect(() => {
|
|
237
278
|
Promise.all([readSettings(), currentBranchName()]).then(([next, branch]) => {
|
|
238
279
|
setSettings(next);
|
|
@@ -283,6 +324,8 @@ function ChatScreen({ debug = false, version, continueSession = false, noSession
|
|
|
283
324
|
setDebugLogs(current => [...current.slice(-7), line]);
|
|
284
325
|
}
|
|
285
326
|
async function startNewLog() {
|
|
327
|
+
if (!debug)
|
|
328
|
+
return undefined;
|
|
286
329
|
if (llmLogRef.current) {
|
|
287
330
|
await endLlmLog(llmLogRef.current).catch(() => undefined);
|
|
288
331
|
}
|
|
@@ -872,6 +915,15 @@ function ChatScreen({ debug = false, version, continueSession = false, noSession
|
|
|
872
915
|
}
|
|
873
916
|
async function doAgentTurn(value, displayValue) {
|
|
874
917
|
setDebugLogs([]);
|
|
918
|
+
// When every task is already completed, start the new turn with a clean
|
|
919
|
+
// slate: the task bar clears (nothing shown for simple questions) and the
|
|
920
|
+
// model may create fresh todos via writeTasks if the new question warrants.
|
|
921
|
+
if (visibleTasks.length > 0 && visibleTasks.every(t => t.status === 'completed')) {
|
|
922
|
+
setVisibleTasks([]);
|
|
923
|
+
setTasksExpanded(false);
|
|
924
|
+
setTaskBarPadding(0);
|
|
925
|
+
await clearTasksFromStore().catch(() => undefined);
|
|
926
|
+
}
|
|
875
927
|
await runSingleAgentTurn(value, displayValue);
|
|
876
928
|
while (followUpQueueRef.current.length > 0) {
|
|
877
929
|
const next = followUpQueueRef.current[0];
|
|
@@ -890,16 +942,18 @@ function ChatScreen({ debug = false, version, continueSession = false, noSession
|
|
|
890
942
|
const finalizeMessage = (msg) => {
|
|
891
943
|
if (msg.hidden)
|
|
892
944
|
return;
|
|
893
|
-
|
|
894
|
-
|
|
945
|
+
const ordered = withDisplayOrder(msg);
|
|
946
|
+
setMessages(m => [...m, ordered]);
|
|
947
|
+
persistUiMessage(ordered);
|
|
895
948
|
};
|
|
896
949
|
await runAgentTurn(value, displayValue, contextFiles, {
|
|
897
950
|
addMessage: msg => {
|
|
898
|
-
|
|
899
|
-
|
|
951
|
+
const ordered = withDisplayOrder(msg);
|
|
952
|
+
if (ordered.streaming) {
|
|
953
|
+
setLiveMessagesState(m => [...m, ordered]);
|
|
900
954
|
return;
|
|
901
955
|
}
|
|
902
|
-
finalizeMessage(
|
|
956
|
+
finalizeMessage(ordered);
|
|
903
957
|
},
|
|
904
958
|
updateMessage: (id, update) => {
|
|
905
959
|
const liveMessage = liveMessagesRef.current.find(msg => msg.id === id);
|
|
@@ -962,8 +1016,12 @@ function ChatScreen({ debug = false, version, continueSession = false, noSession
|
|
|
962
1016
|
}, 0, false, false, { start: sessionStartRef.current, cwd: process.cwd() });
|
|
963
1017
|
}
|
|
964
1018
|
const visible = messages.filter(message => !message.hidden);
|
|
965
|
-
const transcriptItems = visible.map((message, index) => ({ key: messageKey(message, index), message }));
|
|
966
1019
|
const activeLiveMessages = liveMessages.filter(message => !message.hidden);
|
|
1020
|
+
const orderedVisibleMessages = orderedDisplayMessages([...visible, ...activeLiveMessages]);
|
|
1021
|
+
const annotatedDisplayMessages = annotateTurnHeaders(orderedVisibleMessages);
|
|
1022
|
+
const staticDisplayItems = annotatedDisplayMessages.filter(item => !item.message.streaming);
|
|
1023
|
+
const transcriptItems = staticDisplayItems.map((item, index) => ({ key: messageKey(item.message, index), ...item }));
|
|
1024
|
+
const activeLiveItems = annotatedDisplayMessages.filter(item => item.message.streaming);
|
|
967
1025
|
const activeSelection = activeModel(settings);
|
|
968
1026
|
const placeholder = mode === 'provider'
|
|
969
1027
|
? 'Choose provider'
|
|
@@ -992,30 +1050,30 @@ function ChatScreen({ debug = false, version, continueSession = false, noSession
|
|
|
992
1050
|
: mode === 'skillCreateDescription'
|
|
993
1051
|
? 'Describe what the skill should do'
|
|
994
1052
|
: busy ? 'Queue a follow-up, or Esc to interrupt' : 'Ask Haze to help build your app';
|
|
995
|
-
const activeModelName = `${activeSelection.provider.name}:${
|
|
996
|
-
const
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
'while trying to stay scoped to this project.',
|
|
1009
|
-
].join('\n')
|
|
1010
|
-
: 'First things first: run /provider to choose or add a provider, then select a model.';
|
|
1011
|
-
const workspaceLabel = `${process.cwd()}${branchName ? ` (${branchName})` : ''}`;
|
|
1053
|
+
const activeModelName = activeSelection ? `${activeSelection.provider.name}:${activeSelection.model}` : 'unconfigured';
|
|
1054
|
+
const headerSubtitle = [
|
|
1055
|
+
'A minimal LLM harness for growing your own workflows while you work.',
|
|
1056
|
+
'',
|
|
1057
|
+
'Start with simple chat, then teach Haze your habits with skills:',
|
|
1058
|
+
'/create-skill — three-step skill wizard (name, role, description).',
|
|
1059
|
+
'',
|
|
1060
|
+
'The most adaptive workflow is the one you shape as you go.',
|
|
1061
|
+
'',
|
|
1062
|
+
'Guardrails are light: Haze lets the LLM work from the terminal almost like you,',
|
|
1063
|
+
'while trying to stay scoped to this project.',
|
|
1064
|
+
].join('\n');
|
|
1065
|
+
const workspaceLabel = `${compactHomePath(process.cwd())}${branchName ? ` (${branchName})` : ''}`;
|
|
1012
1066
|
const allDisplayMessages = [...messages, ...liveMessages];
|
|
1067
|
+
const hazeMessages = allDisplayMessages.filter(message => message.role === 'assistant' && !message.hidden).length;
|
|
1013
1068
|
const toolsUsed = toolCallCount(allDisplayMessages);
|
|
1014
1069
|
const fallbackTokens = estimateConversationTokens(allDisplayMessages);
|
|
1015
|
-
const
|
|
1070
|
+
const estimatedLogicalInput = tokenUsage.logicalInputEstimate || fallbackTokens.input || 0;
|
|
1071
|
+
const providerInput = tokenUsage.inputTokens;
|
|
1072
|
+
const effectiveInput = providerInput == null ? estimatedLogicalInput : Math.max(providerInput, estimatedLogicalInput);
|
|
1016
1073
|
const effectiveOutput = tokenUsage.outputTokens ?? (fallbackTokens.output || 0);
|
|
1017
|
-
const
|
|
1018
|
-
const
|
|
1074
|
+
const inputEstimated = providerInput == null || effectiveInput !== providerInput;
|
|
1075
|
+
const outputEstimated = tokenUsage.outputTokens == null;
|
|
1076
|
+
const statusDetailLabel = `${hazeMessages} haze message${hazeMessages === 1 ? '' : 's'} / ${toolsUsed} tool call${toolsUsed === 1 ? '' : 's'} / LLM ${inputEstimated ? '~' : ''}↑${formatTokenCount(effectiveInput)} ${outputEstimated ? '~' : ''}↓${formatTokenCount(effectiveOutput)} / ${skills.length} skill${skills.length === 1 ? '' : 's'}`;
|
|
1019
1077
|
const hasTokenBreakdown = tokenUsage.systemPrompt > 0 || tokenUsage.messages > 0 || tokenUsage.toolSchemas > 0 || effectiveInput > 0 || effectiveOutput > 0;
|
|
1020
1078
|
const goalText = activeGoalStatus?.replace(/^Goal:\s*/, '');
|
|
1021
1079
|
// Goal tracking is internal; display removed in favor of task bar
|
|
@@ -1040,12 +1098,12 @@ function ChatScreen({ debug = false, version, continueSession = false, noSession
|
|
|
1040
1098
|
...skills.map(skill => ({ value: `/${skill.name}`, description: skill.description, kind: 'skill' })),
|
|
1041
1099
|
] : [];
|
|
1042
1100
|
const staticItems = [
|
|
1043
|
-
{ kind: 'header', key: `header-${activeModelName}
|
|
1101
|
+
{ kind: 'header', key: `header-${activeModelName}`, subtitle: headerSubtitle },
|
|
1044
1102
|
...transcriptItems.map(item => ({ kind: 'message', ...item })),
|
|
1045
1103
|
];
|
|
1046
1104
|
return _jsxs(Box, { flexDirection: "column", children: [_jsx(Static, { items: staticItems, children: item => item.kind === 'header'
|
|
1047
1105
|
? _jsx(Header, { subtitle: item.subtitle, version: version }, item.key)
|
|
1048
|
-
: _jsx(MessageView, { message: item.message, width: width }, item.key) }),
|
|
1106
|
+
: _jsx(MessageView, { message: item.message, width: width, suppressAssistantHeader: item.suppressAssistantHeader }, item.key) }), activeLiveItems.length > 0 && _jsx(Box, { flexDirection: "column", flexShrink: 0, children: activeLiveItems.map((item, index) => _jsx(MessageView, { message: item.message, width: width, suppressAssistantHeader: item.suppressAssistantHeader }, messageKey(item.message, index))) }), debug && debugLogs.length > 0 && _jsxs(Box, { flexDirection: "column", flexShrink: 0, marginBottom: 1, borderStyle: "round", borderColor: theme.muted, paddingX: 1, children: [_jsx(Text, { color: theme.muted, bold: true, children: "Debug" }), debugLogs.map((line, index) => _jsxs(Text, { color: theme.muted, children: ["\u2022 ", line] }, index))] }), queuedFollowUps.length > 0 && _jsxs(Box, { flexDirection: "column", flexShrink: 0, marginBottom: 1, children: [_jsx(Text, { color: theme.muted, children: "Queued follow-ups:" }), queuedFollowUps.map((item, index) => _jsxs(Text, { color: theme.muted, dimColor: true, children: [" ", index + 1, ". ", item] }, `${index}-${item}`))] }), visibleTasks.length > 0 && _jsx(Box, { flexDirection: "column", flexShrink: 0, marginBottom: 1, children: _jsx(TaskBarContent, { tasks: visibleTasks, width: width, expanded: tasksExpanded, padding: taskBarPadding }) }), busy && _jsx(Box, { flexShrink: 0, children: _jsxs(Text, { children: [_jsxs(Text, { color: theme.orange, bold: true, children: [_jsx(Spinner, { type: "dots" }), " ", busyLabel] }), _jsx(Text, { color: theme.muted, dimColor: true, children: " \u00B7 type to queue follow-up \u00B7 esc to interrupt" })] }) }), _jsx(Box, { borderStyle: "round", borderColor: theme.deepPurple, paddingX: 1, flexShrink: 0, children: _jsx(Box, { flexGrow: 1, minWidth: 0, children: _jsx(TextInput, { placeholder: placeholder, disabled: busy && mode !== 'chat', mask: mode === 'providerAddKey' || mode === 'providerSetKey', historyItems: inputHistory, recordHistory: mode === 'chat', suggestions: inputSuggestions, suggestionMode: mode === 'provider' || mode === 'providerAction' || mode === 'providerAddPreset' || mode === 'model' ? 'always' : 'slash', submitOnEmpty: mode === 'providerAddKey' || mode === 'skillCreateRole', width: Math.max(20, width - 4), onHistoryAdd: persistInputHistory, onToggleTasks: () => {
|
|
1049
1107
|
if (!tasksExpanded) {
|
|
1050
1108
|
setTaskBarPadding(0);
|
|
1051
1109
|
setTasksExpanded(true);
|
|
@@ -1061,7 +1119,7 @@ function ChatScreen({ debug = false, version, continueSession = false, noSession
|
|
|
1061
1119
|
cancelThinking();
|
|
1062
1120
|
else
|
|
1063
1121
|
closeInputList();
|
|
1064
|
-
}, onSubmit: submit }) }) }), debug && hasTokenBreakdown && _jsxs(Box, { flexShrink: 0, flexDirection: "column", paddingX: 1, children: [_jsxs(Text, { color: theme.muted, bold: true, children: ["Token usage ",
|
|
1122
|
+
}, onSubmit: submit }) }) }), debug && hasTokenBreakdown && _jsxs(Box, { flexShrink: 0, flexDirection: "column", paddingX: 1, children: [_jsxs(Text, { color: theme.muted, bold: true, children: ["Token usage ", inputEstimated || outputEstimated ? '(estimated)' : '(precise)'] }), _jsxs(Text, { color: theme.muted, children: [" in=", formatTokenCount(effectiveInput), " out=", formatTokenCount(effectiveOutput), tokenUsage.cacheReadTokens > 0 ? ` cached=${formatTokenCount(tokenUsage.cacheReadTokens)}` : '', tokenUsage.noCacheTokens > 0 ? ` uncached=${formatTokenCount(tokenUsage.noCacheTokens)}` : '', tokenUsage.cacheWriteTokens > 0 ? ` cache_write=${formatTokenCount(tokenUsage.cacheWriteTokens)}` : '', tokenUsage.reasoningTokens > 0 ? ` reasoning=${formatTokenCount(tokenUsage.reasoningTokens)}` : ''] }), _jsxs(Text, { color: theme.muted, children: [" logical=", formatTokenCount(tokenUsage.logicalInputEstimate), tokenUsage.effectiveNonCachedInput != null ? ` effective_non_cached=${formatTokenCount(tokenUsage.effectiveNonCachedInput)}` : ''] }), _jsxs(Text, { color: theme.muted, children: [" system=", formatTokenCount(tokenUsage.systemPrompt), " messages=", formatTokenCount(tokenUsage.messages), " tools=", formatTokenCount(tokenUsage.toolSchemas), " output=", formatTokenCount(tokenUsage.outputEstimate)] })] }), _jsxs(Box, { flexShrink: 0, justifyContent: "space-between", children: [_jsxs(Box, { flexDirection: "column", flexShrink: 1, minWidth: 0, children: [_jsx(Text, { color: theme.muted, dimColor: true, wrap: "truncate-end", children: workspaceLabel }), _jsx(Text, { color: theme.muted, dimColor: true, wrap: "truncate-end", children: statusDetailLabel })] }), _jsx(Box, { flexShrink: 0, marginLeft: 2, children: _jsx(Text, { color: theme.muted, dimColor: true, wrap: "truncate-start", children: activeModelName }) })] })] });
|
|
1065
1123
|
}
|
|
1066
1124
|
export async function chatCommand(options = {}) {
|
|
1067
1125
|
if (process.stdout.isTTY) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from 'fs-extra';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { buildInitPrompt } from '../../llm/initPrompt.js';
|
|
4
|
-
import { contextFileDiagnostics, summarizeContextDiagnostics } from '../../config/contextFiles.js';
|
|
4
|
+
import { contextFileDiagnostics, summarizeContextDiagnostics, MAX_CONTEXT_FILE_CHARS } from '../../config/contextFiles.js';
|
|
5
5
|
import { activeProvider, configuredProviders, modelSelector, providerHasKey, resolveModelSelector, upsertProvider } from '../../config/providers.js';
|
|
6
6
|
import { clearTasks } from '../../core/tasks/taskStorage.js';
|
|
7
7
|
import { listLogs, readLogEntries } from '../../core/log/llmLog.js';
|
|
@@ -291,6 +291,10 @@ export async function handleSlashCommand(value, ctx) {
|
|
|
291
291
|
}
|
|
292
292
|
if (resolved.status === 'missing') {
|
|
293
293
|
const provider = activeProvider(ctx.settings);
|
|
294
|
+
if (!provider) {
|
|
295
|
+
ctx.addSystemMessage('No provider configured. Run /provider to choose or add a provider before setting a model.');
|
|
296
|
+
return 'handled';
|
|
297
|
+
}
|
|
294
298
|
const nextProvider = provider.models.includes(selector) ? provider : { ...provider, models: [...provider.models, selector] };
|
|
295
299
|
await ctx.updateSettings({ provider: provider.name, model: selector, providers: upsertProvider(ctx.settings, nextProvider) });
|
|
296
300
|
ctx.addSystemMessage(`Model set to ${selector} on ${provider.name}. Saved to ~/.haze/settings.json.`);
|
|
@@ -303,6 +307,16 @@ export async function handleSlashCommand(value, ctx) {
|
|
|
303
307
|
if (value === '/init') {
|
|
304
308
|
await ctx.runAgentTurn(buildInitPrompt(), '/init');
|
|
305
309
|
await ctx.refreshContextFiles();
|
|
310
|
+
const agentsMdPath = path.join(process.cwd(), 'AGENTS.md');
|
|
311
|
+
if (await fs.pathExists(agentsMdPath)) {
|
|
312
|
+
const content = await fs.readFile(agentsMdPath, 'utf8');
|
|
313
|
+
const chars = content.length;
|
|
314
|
+
const lines = content.split('\n').length;
|
|
315
|
+
const msg = chars > MAX_CONTEXT_FILE_CHARS
|
|
316
|
+
? `AGENTS.md validation: ${chars.toLocaleString()} chars / ${lines} lines — exceeds the ${MAX_CONTEXT_FILE_CHARS.toLocaleString()}-char context budget and will be truncated. Trim it before relying on it.`
|
|
317
|
+
: `AGENTS.md validation: ${chars.toLocaleString()} chars / ${lines} lines — within the ${MAX_CONTEXT_FILE_CHARS.toLocaleString()}-char context budget.`;
|
|
318
|
+
ctx.addSystemMessage(msg);
|
|
319
|
+
}
|
|
306
320
|
return 'handled';
|
|
307
321
|
}
|
|
308
322
|
if (value === '/skills')
|
|
@@ -12,7 +12,11 @@ export type Message = {
|
|
|
12
12
|
hidden?: boolean;
|
|
13
13
|
startedAt?: number;
|
|
14
14
|
finishedAt?: number;
|
|
15
|
+
tokensPerSecond?: number;
|
|
16
|
+
displayOrder?: number;
|
|
15
17
|
};
|
|
18
|
+
export declare function isHiddenUnstartedFinalText(text: string): boolean;
|
|
19
|
+
export declare function shouldStartAssistantStream(text: string, startedAt: number): boolean;
|
|
16
20
|
export interface TokenUsage {
|
|
17
21
|
/** Precise input tokens from the provider (undefined if provider doesn't report). */
|
|
18
22
|
inputTokens: number | undefined;
|