heartcode 0.1.58 → 0.1.60
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 +57 -0
- package/README.md +27 -10
- package/SKILL.md +59 -17
- package/bin/heart.js +1 -1
- package/bin/heartcode.js +92 -66
- package/package.json +1 -1
- package/prompts/agent.md +64 -15
- package/src/acp.js +3 -3
- package/src/agent.js +175 -44
- package/src/capabilities.js +1 -1
- package/src/client.js +41 -10
- package/src/config.js +3 -3
- package/src/context.js +1 -1
- package/src/guided.js +26 -17
- package/src/headless.js +63 -15
- package/src/importer.js +7 -7
- package/src/log.js +3 -3
- package/src/mcp.js +1 -1
- package/src/memory.js +1 -1
- package/src/oauth.js +1 -1
- package/src/probe.js +14 -4
- package/src/reset.js +2 -2
- package/src/sessions.js +2 -2
- package/src/settings.html +203 -159
- package/src/settings.js +49 -20
- package/src/tabs.js +4 -1
- package/src/telegram.js +1 -1
- package/src/tools.js +102 -33
- package/src/tree.js +1 -1
- package/src/ui.js +110 -26
- package/src/usage.js +9 -0
- package/src/voice.js +1 -1
- package/src/web.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,63 @@
|
|
|
2
2
|
|
|
3
3
|
What changed in each version of HeartCode, newest first.
|
|
4
4
|
|
|
5
|
+
## 0.1.60 (2026-11-08)
|
|
6
|
+
|
|
7
|
+
- **Models say when they're stuck, and get help**: a todo step can be marked `stuck` with why; the
|
|
8
|
+
1st time it's told to change approach, the 2nd another model gives a second opinion (a Big & hard
|
|
9
|
+
helper first), the 3rd the next model takes over (not another version of the same one, nor one
|
|
10
|
+
given up on already). An answer that says it didn't manage counts the same; with no model left,
|
|
11
|
+
it says plainly what blocks it. Headless: `stuck` events, `why` on todos.
|
|
12
|
+
- **No giving up without trying**: "I can't browse / run…" before any tool is used gets a reminder
|
|
13
|
+
of its tools, then the next model. An answer repeated after "not done" or a review's no hands the
|
|
14
|
+
task over. The review now also checks tasks that changed no files but ran commands or a browser.
|
|
15
|
+
- **Helpers see what they're asked about**: an image named in a helper's job is attached, so a model
|
|
16
|
+
that can see takes it; a helper that can't see gets its screenshots described by one that can.
|
|
17
|
+
The same tool failing three times in a row: told to stop and find out why.
|
|
18
|
+
- **Learns from struggles**: what blocked a task (from how it ended and the review, not from the
|
|
19
|
+
model's excuses) or what got it unstuck is saved as a lesson; a failed task's lesson is what to
|
|
20
|
+
check first next time.
|
|
21
|
+
- **Settings, Models page**: helper jobs and narrow columns are icons (names on hover), rankings show
|
|
22
|
+
the place only, and the table fits the screen on a desktop and a 1280px laptop; the controls in
|
|
23
|
+
three rows with icons (the list's actions by the title; fail-over and helper settings; filters).
|
|
24
|
+
Helpers: **Automatic / Manual**, used in list order, by provider or **by score** (best ranked
|
|
25
|
+
first). A phone gets a dismissible "works best on a desktop".
|
|
26
|
+
- **No more you/your**: the settings page and the CLI use plain labels ("Models", "List").
|
|
27
|
+
- **Settings load fast**: model profiles, models.dev lookups and the saved model lists are kept in
|
|
28
|
+
memory (read again when their files change) and warmed in the background: the Providers page with
|
|
29
|
+
2,895 models is ready in about a third of a second (was several seconds).
|
|
30
|
+
- **Model lists**: a provider that answers with a bare list (Typhoon) is read; loading a list waits
|
|
31
|
+
up to a minute.
|
|
32
|
+
|
|
33
|
+
## 0.1.59 (2026-11-07)
|
|
34
|
+
|
|
35
|
+
- **You see which model does what**: every step names its model (`● web_fetch … · model`), each
|
|
36
|
+
helper at work has a line with its model, and a plan step handed to a helper says who has it.
|
|
37
|
+
- **Headless says everything the screen shows**: `stream-json` adds `system` lines for the plan
|
|
38
|
+
(`todos`, with `by`), helpers (`helper`), reviews, model switches, retries, warnings and what it's
|
|
39
|
+
doing now (`status`, a running command's output too); tool results carry their `model`; every
|
|
40
|
+
reply and the result have a `stop_reason`. SKILL.md lists them.
|
|
41
|
+
- **Cut-off replies aren't taken as finished**: a reply stopped by its provider's output limit, or a
|
|
42
|
+
stream that ends without `[DONE]` (its last line is no longer lost), is continued where it
|
|
43
|
+
stopped; the answer is always sent whole as a reply of its own.
|
|
44
|
+
- **A spinner where the work is**: the running step's ● spins, and while it waits on the model a
|
|
45
|
+
line at the end of the conversation says so (the status at the bottom stays).
|
|
46
|
+
- **Queued messages can be changed or dropped**: Esc (or ↑) takes them back into the box without
|
|
47
|
+
stopping the work; Esc twice stops it. Shift+Enter adds a new line while it works too.
|
|
48
|
+
- **Alt+O sends nothing**: it no longer queues `/toggle_thinking`; after an answer it opens that
|
|
49
|
+
reply's thinking in a box.
|
|
50
|
+
- **No more flicker or broken screens**: a question no longer flickers (only what changed is drawn,
|
|
51
|
+
shown at once where the terminal can); resizing the terminal keeps the input box and status bar;
|
|
52
|
+
a plan that grows prints only what changed.
|
|
53
|
+
- **Installed from a clone, /update works**: `npm start` installs a copy in npm's global folder, as
|
|
54
|
+
`npm install -g heartcode` does, so `/update` replaces it there.
|
|
55
|
+
- **Says what it does**: an audit of every hint, prompt, settings text and doc against the code.
|
|
56
|
+
Fixed on the way: `--save -m` saves the model, `--provider` picks a model alone, `-m` runs a
|
|
57
|
+
model of a switched-off provider, `--allowedTools WebFetch/WebSearch` work, guided mode's
|
|
58
|
+
`--max-turns` is an error, `HEART_LOG=off` stops request logs too, `heart page` with a missing
|
|
59
|
+
file says so, `list_files` takes `path` and `filter` together, project prompts reach the tool
|
|
60
|
+
descriptions at once, reviews see browser and helper checks, settings changes reach every tab.
|
|
61
|
+
|
|
5
62
|
## 0.1.58 (2026-11-07)
|
|
6
63
|
|
|
7
64
|
- **Helpers you pick**: on Your models, a Helper column: a switch (can #1 start this model for a part
|
package/README.md
CHANGED
|
@@ -28,6 +28,10 @@ has none, so there's nothing for anyone to poison.
|
|
|
28
28
|
- When a conversation gets too long for a model, it moves to one of your models with more room
|
|
29
29
|
instead of summarizing things away.
|
|
30
30
|
- When a model goes round in circles, the next one takes over. Only you stop it (Esc).
|
|
31
|
+
- Models are told to say when they're stuck, and believed: first a different approach, then a
|
|
32
|
+
second opinion from another of your models, then the next model takes over (not another version
|
|
33
|
+
of the same one). The same happens when a model says "I can't" without trying its tools, or
|
|
34
|
+
answers again without doing anything after being told it isn't done.
|
|
31
35
|
|
|
32
36
|
**It works carefully**
|
|
33
37
|
- It asks what you want before it builds, reads the current docs before it uses something, and
|
|
@@ -40,7 +44,8 @@ has none, so there's nothing for anyone to poison.
|
|
|
40
44
|
- Every web page it reads is saved in `.heartcode/research/`.
|
|
41
45
|
- After a task, it saves what's worth knowing as notes (`.heartcode/memory/`) and deletes the junk
|
|
42
46
|
and throwaway files, in the background.
|
|
43
|
-
- A mistake it fixes becomes a lesson it won't repeat.
|
|
47
|
+
- A mistake it fixes becomes a lesson it won't repeat. So does what blocked a task, or what got it
|
|
48
|
+
unstuck, so the next task like it starts knowing.
|
|
44
49
|
|
|
45
50
|
**It gets good work out of small and local models**
|
|
46
51
|
- Models that can't call tools are guided one simple question at a time.
|
|
@@ -67,12 +72,15 @@ has none, so there's nothing for anyone to poison.
|
|
|
67
72
|
1. **It asks first.** If your request leaves something open (how it should look, how far to go,
|
|
68
73
|
whether to test it), it asks you, with its own suggestion first. Small fixes it just does.
|
|
69
74
|
2. **It reads up** on whatever it's about to use, instead of trusting its memory.
|
|
70
|
-
3. **It makes a plan**: a todo list you can see.
|
|
75
|
+
3. **It makes a plan**: a todo list you can see. Its first change of each message waits for one.
|
|
71
76
|
4. **It does the work**: reading files, running commands, editing.
|
|
72
77
|
5. **It may split the work.** Your #1 model can hand a job to a helper, or run separate parts at
|
|
73
|
-
the same time, each on its own files.
|
|
78
|
+
the same time, each on its own files. The model decides. Pick your helpers yourself (below), or
|
|
79
|
+
let HeartCode pick them; without any, it can use any of your models, in your order. Every step
|
|
80
|
+
on screen names the model doing it.
|
|
74
81
|
6. **It checks before it says it's done**: it must have tested what it changed, finished its todo
|
|
75
|
-
list and made the files it names. Then your next models say yes or no
|
|
82
|
+
list and made the files it names. Then your next models say yes or no (also when it changed no
|
|
83
|
+
files but ran commands or a browser); a no sends it back.
|
|
76
84
|
7. **It tidies up** in the background: saves notes for next time, removes throwaway files.
|
|
77
85
|
|
|
78
86
|
## How to set it up
|
|
@@ -83,7 +91,7 @@ has none, so there's nothing for anyone to poison.
|
|
|
83
91
|
npm install -g heartcode
|
|
84
92
|
```
|
|
85
93
|
|
|
86
|
-
Or from source (
|
|
94
|
+
Or from source (installed the same way: `/update` updates it):
|
|
87
95
|
|
|
88
96
|
```sh
|
|
89
97
|
git clone https://github.com/p32929/HeartCode.git
|
|
@@ -109,7 +117,7 @@ key. A running HeartCode picks up your changes right away.
|
|
|
109
117
|
|
|
110
118
|
What's in the sidebar:
|
|
111
119
|
|
|
112
|
-
- **Models**: *
|
|
120
|
+
- **Models**: *List* (the models HeartCode uses, in order) and *Providers* (where they come from).
|
|
113
121
|
- **General**: what it may do without asking, colors, thinking effort, voice input, web search,
|
|
114
122
|
and the *Status bar* (drag and drop what it shows). **Notifications**: Telegram.
|
|
115
123
|
- **Skills**, **MCP servers** and **System prompt**: what HeartCode can do and what it's told.
|
|
@@ -126,15 +134,21 @@ On **Models → Providers**:
|
|
|
126
134
|
|
|
127
135
|
### 5. Put your list in order
|
|
128
136
|
|
|
129
|
-
On **Models →
|
|
137
|
+
On **Models → List**:
|
|
130
138
|
|
|
131
139
|
1. **Sort.** Click *Abilities*, then *Context*: the most capable models come first, the biggest
|
|
132
140
|
context window first among those. Click **Save list**.
|
|
133
141
|
2. **Drag rows** to fine-tune. #1 is the one HeartCode uses; the rest are its fallbacks, in order.
|
|
134
142
|
3. **Test** (optional): **Test all** sends each model a short message and shows which answer and
|
|
135
143
|
how fast (*Works?*). Sort by it to put the fastest first.
|
|
136
|
-
4. **Filter** (optional): by name, provider, test result, context, abilities or
|
|
137
|
-
these** keeps just the ones you see, in that order.
|
|
144
|
+
4. **Filter** (optional): by name, provider, test result, context, abilities, free or helpers.
|
|
145
|
+
**Use only these** keeps just the ones you see, in that order.
|
|
146
|
+
5. **Helpers** (optional): the models #1 can hand parts of a task to. In the *Helper* column, switch
|
|
147
|
+
a model on and pick what it's good at: **UI & visuals**, **Code & logic**, **Big & hard**,
|
|
148
|
+
**Quick & cheap** (hover an icon to see what it covers). **Suggest helpers** proposes them from
|
|
149
|
+
the models that passed **Test all** and the rankings; or set *Helpers* (at the top) to
|
|
150
|
+
**Automatic**. *Used*: which helper #1 takes first: in your order, by your provider ranking, or
|
|
151
|
+
**by score** (best placed in LMArena's rankings first).
|
|
138
152
|
|
|
139
153
|
**Update model info** fetches what each model can do and costs (from models.dev) and its places in
|
|
140
154
|
LMArena's public rankings for coding, web apps and vision, as columns to sort by. A model *not
|
|
@@ -205,7 +219,10 @@ Ask it to read, change, run and fix things in your project, like any coding agen
|
|
|
205
219
|
|
|
206
220
|
- `/` shows every command; `heart --help` lists the rest.
|
|
207
221
|
- `Shift+Tab` changes what it may do without asking.
|
|
208
|
-
- `Esc` stops it
|
|
222
|
+
- `Esc` twice stops it; `Esc` also closes a dialog.
|
|
223
|
+
- While it works, `Enter` queues a message. `Esc` (or `↑`) takes queued messages back into the box
|
|
224
|
+
to change or drop, without stopping the work.
|
|
225
|
+
- `Shift+Enter` (or `Option+Enter`) adds a new line. `Alt+O` shows all of the model's thinking.
|
|
209
226
|
- While it works, commands that don't change the conversation (`/help`, `/cost`, `/diff`,
|
|
210
227
|
`/settings`…) run at once; the ones that do (`/compact`, `/rewind`…) wait until it's done.
|
|
211
228
|
|
package/SKILL.md
CHANGED
|
@@ -16,7 +16,7 @@ heart --version # installed? (else: node /path/to/heart_cli/bin/heart.j
|
|
|
16
16
|
heart providers # the providers set up, and their URLs (keys are masked)
|
|
17
17
|
heart models # what -m takes, one per line: "auto" first, then the user's models (provider/model), #1 first
|
|
18
18
|
heart models --json # the same, as JSON
|
|
19
|
-
heart models --all # every provider's models
|
|
19
|
+
heart models --all # every provider's models (slower: asks each provider); with --json, beside the list
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
`heart models` prints one id per line, nothing else (like `opencode models`):
|
|
@@ -42,8 +42,9 @@ With `--json`:
|
|
|
42
42
|
`id` is exactly what to pass to `-m`:
|
|
43
43
|
|
|
44
44
|
- **`auto`** (always first): the user's list. `fallbacks: true` when it has more than one model:
|
|
45
|
-
#1 is used, and the next one in order when it fails. No `-m` means `auto` too
|
|
46
|
-
|
|
45
|
+
#1 is used, and the next one in order when it fails. No `-m` means `auto` too, unless the user
|
|
46
|
+
chose a set of models for that folder in HeartCode (`/select_model`): then that set. (`default`
|
|
47
|
+
is its old name and still works.)
|
|
47
48
|
- **the user's models** (`place` 1, 2, …), as `provider/model`: #1 is the one `auto` starts with.
|
|
48
49
|
|
|
49
50
|
No model set up yet: `models` is empty (and `heart -p` fails with "no model set up").
|
|
@@ -110,12 +111,14 @@ heart -p --output-format json -C /path/to/project "fix the failing test in math.
|
|
|
110
111
|
|
|
111
112
|
```json
|
|
112
113
|
{ "type": "result", "subtype": "success", "is_error": false, "result": "Fixed it: …",
|
|
113
|
-
"num_turns": 6, "duration_ms": 41200, "total_cost_usd": 0.0031,
|
|
114
|
+
"stop_reason": "end_turn", "num_turns": 6, "duration_ms": 41200, "total_cost_usd": 0.0031,
|
|
114
115
|
"usage": { "input_tokens": 18000, "output_tokens": 900 }, "session_id": "20261027-…" }
|
|
115
116
|
```
|
|
116
117
|
|
|
117
118
|
Read `is_error` and `result`. `subtype` is `success`, `error_during_execution` or
|
|
118
|
-
`error_max_turns`.
|
|
119
|
+
`error_max_turns`. `stop_reason` is why the answer ended, in Claude's words: `end_turn`, or
|
|
120
|
+
`max_tokens` when it was still cut off (see "Cut-off replies" below), `refusal` when the
|
|
121
|
+
provider's filter stopped it. Without `--output-format`, stdout is just the answer text, and an error
|
|
119
122
|
goes to stderr. Logs never go to stdout.
|
|
120
123
|
|
|
121
124
|
## Continue the same conversation
|
|
@@ -145,7 +148,7 @@ can't switch the model you chose.
|
|
|
145
148
|
| Everything (edits and commands) | `--permission-mode all` (the default unless the user set another) |
|
|
146
149
|
| Changes kept apart from the user's files | `--worktree=<name>` (in a git repo): it works in `.heartcode/worktrees/<name>` on the branch `heartcode/<name>`; kept if anything changed (merge it from there), removed if nothing did |
|
|
147
150
|
| A cap on how long it works | `--max-turns 30` (model steps), `--max-retries 3` (a failing provider) |
|
|
148
|
-
| Nothing kept: no session, logs, settings or notes in `~/.heart`, nothing in the project's `.heartcode/` | `--temp` (a throwaway copy, shared by the `--temp` runs going on at once, deleted after the last; the project's notes and research are read, and what the run adds goes with the copy) |
|
|
151
|
+
| Nothing kept: no session, logs, settings or notes in `~/.heart`, nothing in the project's `.heartcode/` | `--temp` (a throwaway copy, shared by the `--temp` runs going on at once, deleted after the last; the project's notes and research are read, and what the run adds goes with the copy) With `--worktree` too, the worktree itself is made in the project's `.heartcode/worktrees/` (git needs it in the repository) |
|
|
149
152
|
|
|
150
153
|
Tool names: HeartCode's own (`read_file`, `edit_file`, `write_file`, `run_command`, `search`,
|
|
151
154
|
`list_files`, `changes`, `web_fetch`, `web_search`…) or Claude Code's (`Read`, `Edit`, `Write`, `Bash`,
|
|
@@ -169,10 +172,16 @@ nothing is sent to the model to find out. A model models.dev doesn't know works
|
|
|
169
172
|
assumptions, and the user can set it up on the settings page. Models that can't call tools still
|
|
170
173
|
work, in a slower guided mode.
|
|
171
174
|
|
|
172
|
-
The model in use knows the user's other models
|
|
175
|
+
The model in use knows the user's other models and works with them through its `agent` tool.
|
|
176
|
+
When the user picked helpers (on *Your models*: a switch per model and what it's good at: UI &
|
|
177
|
+
visuals, Code & logic, Big & hard, Quick & cheap), it knows only those, and a job goes to the
|
|
178
|
+
helper good at it (no model named: the first helper, in the user's order or by their provider
|
|
179
|
+
ranking, as they chose); else it knows all of them, in the user's order, with what each can do. It
|
|
180
|
+
asks a model that can for what it
|
|
173
181
|
can't do itself (a model that can't see asks one that can about a screenshot: "which tiles show a
|
|
174
182
|
chair?"), several at once when there are many images or parts, and a helper that fails is handed to
|
|
175
|
-
the next capable model in the user's order
|
|
183
|
+
the next capable model in the user's order (with helpers picked: the next helper, then the model in
|
|
184
|
+
use) until one does the job. A helper works until its job is done (no step
|
|
176
185
|
limit; `--max-turns` applies to it too). Their tokens are in `usage`, and each model's in
|
|
177
186
|
`modelUsage`.
|
|
178
187
|
|
|
@@ -193,7 +202,7 @@ HEART_API_KEY=… heart -u https://api.groq.com/openai/v1 -m openai/gpt-oss-120b
|
|
|
193
202
|
```
|
|
194
203
|
|
|
195
204
|
A model server on this machine (Ollama on :11434, LM Studio on :1234, llama.cpp on :8080) is
|
|
196
|
-
found on its own. The user can also set everything up in a browser: `heart settings` (its link has
|
|
205
|
+
found on its own while no provider is set up yet. The user can also set everything up in a browser: `heart settings` (its link has
|
|
197
206
|
the machine's network address, so it opens from another device too, for HeartCode on a server), where
|
|
198
207
|
**Test all** under *Your models* sends each model a short message to show it really answers, and how fast. A run that fails with a wrong key or an unknown model: ask the user to test it there.
|
|
199
208
|
|
|
@@ -201,7 +210,7 @@ the machine's network address, so it opens from another device too, for HeartCod
|
|
|
201
210
|
|
|
202
211
|
| Flag | |
|
|
203
212
|
|---|---|
|
|
204
|
-
| `--append-system-prompt "<text>"` | your instructions for this run, at the end of the system prompt. HeartCode's own part then says less (no role of its own, no "stay in the project folder", no way of finishing of its own) and tells the model to follow yours where they differ; its `manage` tool is left out
|
|
213
|
+
| `--append-system-prompt "<text>"` | your instructions for this run, at the end of the system prompt. HeartCode's own part then says less (no role of its own, no "stay in the project folder", no way of finishing of its own) and tells the model to follow yours where they differ; its `manage` tool is left out (its memory still works: `--no-memory` turns that off) |
|
|
205
214
|
| `--mcp-config <file or JSON>` | more MCP servers (repeatable); `--strict-mcp-config`: only those. The model sees every server's tools by name, one line each, and gets a tool's arguments when it uses it (a call that doesn't fit them comes back with what's wrong, not run). What a server says about using its tools comes once, with the first result of one of them |
|
|
206
215
|
| `--skills-dir <folder>` | more skills (repeatable) |
|
|
207
216
|
| `--no-memory` | nothing read or kept: no memory notes, no web pages saved in the project, no wrap-up at the end (see "What a run leaves") |
|
|
@@ -227,7 +236,8 @@ stopped when HeartCode exits.
|
|
|
227
236
|
|
|
228
237
|
Before a task that changed files ends, another of the user's models (the same one when only one is
|
|
229
238
|
used) reviews the work against the request in a request of its own; a NO sends it back to fix.
|
|
230
|
-
The first file change of
|
|
239
|
+
The first file change of each message waits for the model's plan (its todo list): without one it
|
|
240
|
+
isn't made, once (the model is told to write the plan first). Changing files and
|
|
231
241
|
then saying it's done without running anything since sends it back to check. Nothing stops a
|
|
232
242
|
task but `--max-turns`, `--max-retries` or an interrupt: a model going round in circles hands the
|
|
233
243
|
work to the next model in the list. These requests are in `usage` and `modelUsage` too.
|
|
@@ -240,7 +250,8 @@ heart -p --input-format stream-json --output-format stream-json
|
|
|
240
250
|
|
|
241
251
|
Stdin: one message per line, `{"type":"user","message":{"role":"user","content":"…"}}`.
|
|
242
252
|
Stop the running one with `{"type":"control_request","request_id":"1","request":{"subtype":"interrupt"}}`;
|
|
243
|
-
|
|
253
|
+
`initialize` and `set_permission_mode` (`"mode"`: as `--permission-mode` takes it) are answered with
|
|
254
|
+
`subtype: "success"`; any other control request gets a `control_response` with `subtype: "error"` (not supported).
|
|
244
255
|
Stdout: one JSON event per line, `system`/`init` (its `tools` include the MCP servers' tools, each
|
|
245
256
|
`mcp__<server>__<tool>`, and `mcp_servers` says which are `connected`), then `assistant` (text, thinking, `tool_use`),
|
|
246
257
|
`user` (`tool_result`), and a `result` after each message. It runs until stdin closes. An MCP
|
|
@@ -257,13 +268,44 @@ several can run at once) come as `assistant` and `user` lines too, as Claude Cod
|
|
|
257
268
|
subagent's: `parent_tool_use_id` is the id of the `agent` call they belong to (`null` for the main
|
|
258
269
|
conversation's). The helper's last reply is that `agent` call's `tool_result`.
|
|
259
270
|
|
|
260
|
-
|
|
261
|
-
|
|
271
|
+
**Which model does what.** Every line says which model it's from, as `provider/model`:
|
|
272
|
+
|
|
273
|
+
- `assistant`: `message.model` is the model that wrote it (after a fallback, the one that took
|
|
274
|
+
over, not the `init` line's `model`; a helper's lines: the helper's model).
|
|
275
|
+
- `user` (a `tool_result`): a top-level `model`, the model that made the call.
|
|
276
|
+
- `system` lines (below): `model` on `status`, `helper` and `review`; `by` on each plan step a
|
|
277
|
+
helper took; `from` and `to` on `model_switch`.
|
|
278
|
+
|
|
262
279
|
`modelUsage` in the `result` has each model that answered.
|
|
263
280
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
281
|
+
**Why a reply ended.** Each `assistant` line's `message.stop_reason` is `end_turn`, `tool_use`,
|
|
282
|
+
`max_tokens` (cut off: its provider's output limit, or a connection that ended early) or `refusal`
|
|
283
|
+
(the provider's filter); the `result` has the final answer's.
|
|
284
|
+
|
|
285
|
+
**Cut-off replies.** HeartCode sends no `max_tokens`, so each provider's own output limit applies.
|
|
286
|
+
An answer cut off by it (or by a stream that ended without `[DONE]`) isn't taken as finished: the
|
|
287
|
+
model is asked to go on where it stopped (up to 3 times in a row), and the answer is the pieces
|
|
288
|
+
together. Each piece comes as its own `assistant` line (`stop_reason: max_tokens`), then the whole
|
|
289
|
+
answer as one more `assistant` line, so the last `assistant` line before the `result` is always
|
|
290
|
+
the answer as a whole (and so is `result`).
|
|
291
|
+
|
|
292
|
+
**What the full screen shows, as `system` lines** (`{"type":"system","subtype":…,"session_id":…}`;
|
|
293
|
+
a program that doesn't know a subtype can skip it, as for Claude Code):
|
|
294
|
+
|
|
295
|
+
| `subtype` | Fields | When |
|
|
296
|
+
|---|---|---|
|
|
297
|
+
| `status` | `status`, `model` | what it's doing now, as the screen's spinner says it ("thinking", "waiting for …", "preparing read_file README.md", a running command's latest output line, read once a second); sent when it changes. A helper's: its model |
|
|
298
|
+
| `todos` | `todos`: `[{ content, status, why?, by? }]` | the whole plan, each time it changes; `status` is `pending`, `in_progress`, `completed` or `stuck` (`why`: the model's reason); `by`: the model a step was handed to |
|
|
299
|
+
| `stuck` | `step`, `why`, `count`, `model` | the model says it's stuck on a step (`count` this message): the 1st time it's told to change approach, the 2nd another model gives a second opinion, the 3rd the next model takes over (a `warning` says so) |
|
|
300
|
+
| `helper` | `tool_use_id`, `label`, `model`, `status` | a helper at work: `starting`, then what it's doing, then `done`. `tool_use_id` is its `agent` call (several parts of a plan run at once can share one); `label` its job |
|
|
301
|
+
| `review` | `model`, `verdict` (`yes`/`no`), `issues` | another model's look at the changes before the answer; a `no` sends the work back to be fixed |
|
|
302
|
+
| `model_switch` | `from`, `to`, `reason`, `place` | the user's list moved on: `from` failed (`reason`, e.g. `rate-limited (429)`), `to` answers now (`place`: its place in the list) |
|
|
303
|
+
| `retry` | `attempt`, `delay_ms`, `error` | a request failed and is tried again after `delay_ms` |
|
|
304
|
+
| `warning` | `message` | what the screen shows as a warning (e.g. a model models.dev doesn't know) |
|
|
305
|
+
|
|
306
|
+
Not in the stream: HeartCode's own prompts (the system prompt, its nudges) and the wrap-up's
|
|
307
|
+
requests (their `retry` lines can come after the `result`). Their tokens are in `usage` and
|
|
308
|
+
`modelUsage`.
|
|
267
309
|
|
|
268
310
|
## Don't
|
|
269
311
|
|
package/bin/heart.js
CHANGED
|
@@ -22,7 +22,7 @@ const fail = (msg) => {
|
|
|
22
22
|
console.error(msg)
|
|
23
23
|
process.exit(1)
|
|
24
24
|
}
|
|
25
|
-
if (Number(process.versions.node.split('.')[0]) <
|
|
25
|
+
if (Number(process.versions.node.split('.')[0]) < 22) fail(`HeartCode needs Node.js 22 or newer (this is ${process.version}): https://nodejs.org`)
|
|
26
26
|
|
|
27
27
|
const args = process.argv.slice(2)
|
|
28
28
|
const realHome = process.env.HEART_HOME || path.join(os.homedir(), '.heart')
|