heartcode 0.1.57 → 0.1.59
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 +46 -0
- package/README.md +17 -7
- package/SKILL.md +58 -17
- package/bin/heart.js +1 -1
- package/bin/heartcode.js +47 -24
- package/package.json +1 -1
- package/prompts/agent.md +24 -13
- package/src/agent.js +71 -29
- package/src/client.js +12 -3
- package/src/config.js +14 -2
- package/src/guided.js +26 -17
- package/src/headless.js +61 -14
- package/src/log.js +1 -1
- package/src/rankings.js +4 -3
- package/src/settings.html +218 -14
- package/src/settings.js +78 -3
- package/src/tabs.js +4 -1
- package/src/tools.js +41 -26
- package/src/ui.js +104 -20
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,52 @@
|
|
|
2
2
|
|
|
3
3
|
What changed in each version of HeartCode, newest first.
|
|
4
4
|
|
|
5
|
+
## 0.1.59 (2026-11-07)
|
|
6
|
+
|
|
7
|
+
- **You see which model does what**: every step names its model (`● web_fetch … · model`), each
|
|
8
|
+
helper at work has a line with its model, and a plan step handed to a helper says who has it.
|
|
9
|
+
- **Headless says everything the screen shows**: `stream-json` adds `system` lines for the plan
|
|
10
|
+
(`todos`, with `by`), helpers (`helper`), reviews, model switches, retries, warnings and what it's
|
|
11
|
+
doing now (`status`, a running command's output too); tool results carry their `model`; every
|
|
12
|
+
reply and the result have a `stop_reason`. SKILL.md lists them.
|
|
13
|
+
- **Cut-off replies aren't taken as finished**: a reply stopped by its provider's output limit, or a
|
|
14
|
+
stream that ends without `[DONE]` (its last line is no longer lost), is continued where it
|
|
15
|
+
stopped; the answer is always sent whole as a reply of its own.
|
|
16
|
+
- **A spinner where the work is**: the running step's ● spins, and while it waits on the model a
|
|
17
|
+
line at the end of the conversation says so (the status at the bottom stays).
|
|
18
|
+
- **Queued messages can be changed or dropped**: Esc (or ↑) takes them back into the box without
|
|
19
|
+
stopping the work; Esc twice stops it. Shift+Enter adds a new line while it works too.
|
|
20
|
+
- **Alt+O sends nothing**: it no longer queues `/toggle_thinking`; after an answer it opens that
|
|
21
|
+
reply's thinking in a box.
|
|
22
|
+
- **No more flicker or broken screens**: a question no longer flickers (only what changed is drawn,
|
|
23
|
+
shown at once where the terminal can); resizing the terminal keeps the input box and status bar;
|
|
24
|
+
a plan that grows prints only what changed.
|
|
25
|
+
- **Installed from a clone, /update works**: `npm start` installs a copy in npm's global folder, as
|
|
26
|
+
`npm install -g heartcode` does, so `/update` replaces it there.
|
|
27
|
+
- **Says what it does**: an audit of every hint, prompt, settings text and doc against the code.
|
|
28
|
+
Fixed on the way: `--save -m` saves the model, `--provider` picks a model alone, `-m` runs a
|
|
29
|
+
model of a switched-off provider, `--allowedTools WebFetch/WebSearch` work, guided mode's
|
|
30
|
+
`--max-turns` is an error, `HEART_LOG=off` stops request logs too, `heart page` with a missing
|
|
31
|
+
file says so, `list_files` takes `path` and `filter` together, project prompts reach the tool
|
|
32
|
+
descriptions at once, reviews see browser and helper checks, settings changes reach every tab.
|
|
33
|
+
|
|
34
|
+
## 0.1.58 (2026-11-07)
|
|
35
|
+
|
|
36
|
+
- **Helpers you pick**: on Your models, a Helper column: a switch (can #1 start this model for a part
|
|
37
|
+
of a task?) and four pills for what it's good at: UI & visuals, Code & logic, Big & hard, Quick &
|
|
38
|
+
cheap (hover one: what it covers, and what a click does). A click saves at once; #1 is told only
|
|
39
|
+
your helpers and what each is good at, and a job with no model named goes to the first helper.
|
|
40
|
+
Reviews go to the Code & logic ones first. None picked: everything works as before.
|
|
41
|
+
- **Suggest helpers**: every model that answered its test (#1 too, also ones without tool calls),
|
|
42
|
+
each with what it's good at: the top half of LMArena's web-app or coding ranking, thinking with a
|
|
43
|
+
big context or a place in its new agent and hardest-prompts rankings, a fast test. Shown dashed,
|
|
44
|
+
taken all at once or one by one. Not tested yet: a dialog offers Test all first, saying how many
|
|
45
|
+
of your models may charge for it.
|
|
46
|
+
- **Picked for you**: Helpers in the list's settings: HeartCode picks them, again after Update model
|
|
47
|
+
info, a test run or a new order; a click on a pill makes them yours again.
|
|
48
|
+
- **Helpers picked in your order or by provider**: beside Order providers; your list stays as it is.
|
|
49
|
+
- A Helpers filter; Save order is now Save list.
|
|
50
|
+
|
|
5
51
|
## 0.1.57 (2026-11-06)
|
|
6
52
|
|
|
7
53
|
- **The `/settings` link can be copied over SSH**: while the page is on, the mouse is the terminal's,
|
package/README.md
CHANGED
|
@@ -67,10 +67,12 @@ has none, so there's nothing for anyone to poison.
|
|
|
67
67
|
1. **It asks first.** If your request leaves something open (how it should look, how far to go,
|
|
68
68
|
whether to test it), it asks you, with its own suggestion first. Small fixes it just does.
|
|
69
69
|
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.
|
|
70
|
+
3. **It makes a plan**: a todo list you can see. Its first change of each message waits for one.
|
|
71
71
|
4. **It does the work**: reading files, running commands, editing.
|
|
72
72
|
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.
|
|
73
|
+
the same time, each on its own files. The model decides. Pick your helpers yourself (below), or
|
|
74
|
+
let HeartCode pick them; without any, it can use any of your models, in your order. Every step
|
|
75
|
+
on screen names the model doing it.
|
|
74
76
|
6. **It checks before it says it's done**: it must have tested what it changed, finished its todo
|
|
75
77
|
list and made the files it names. Then your next models say yes or no; a no sends it back.
|
|
76
78
|
7. **It tidies up** in the background: saves notes for next time, removes throwaway files.
|
|
@@ -83,7 +85,7 @@ has none, so there's nothing for anyone to poison.
|
|
|
83
85
|
npm install -g heartcode
|
|
84
86
|
```
|
|
85
87
|
|
|
86
|
-
Or from source (
|
|
88
|
+
Or from source (installed the same way: `/update` updates it):
|
|
87
89
|
|
|
88
90
|
```sh
|
|
89
91
|
git clone https://github.com/p32929/HeartCode.git
|
|
@@ -129,12 +131,17 @@ On **Models → Providers**:
|
|
|
129
131
|
On **Models → Your list**:
|
|
130
132
|
|
|
131
133
|
1. **Sort.** Click *Abilities*, then *Context*: the most capable models come first, the biggest
|
|
132
|
-
context window first among those. Click **Save
|
|
134
|
+
context window first among those. Click **Save list**.
|
|
133
135
|
2. **Drag rows** to fine-tune. #1 is the one HeartCode uses; the rest are its fallbacks, in order.
|
|
134
136
|
3. **Test** (optional): **Test all** sends each model a short message and shows which answer and
|
|
135
137
|
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.
|
|
138
|
+
4. **Filter** (optional): by name, provider, test result, context, abilities, free or helpers.
|
|
139
|
+
**Use only these** keeps just the ones you see, in that order.
|
|
140
|
+
5. **Helpers** (optional): the models #1 can hand parts of a task to. In the *Helper* column, switch
|
|
141
|
+
a model on and pick what it's good at: **UI & visuals**, **Code & logic**, **Big & hard**,
|
|
142
|
+
**Quick & cheap** (hover a pill to see what it covers). **Suggest helpers** proposes them from
|
|
143
|
+
the models that passed **Test all** and the rankings; or set *Helpers* to **picked for you**.
|
|
144
|
+
*Helpers picked* (beside **Order providers**): in your order, or by your provider ranking.
|
|
138
145
|
|
|
139
146
|
**Update model info** fetches what each model can do and costs (from models.dev) and its places in
|
|
140
147
|
LMArena's public rankings for coding, web apps and vision, as columns to sort by. A model *not
|
|
@@ -205,7 +212,10 @@ Ask it to read, change, run and fix things in your project, like any coding agen
|
|
|
205
212
|
|
|
206
213
|
- `/` shows every command; `heart --help` lists the rest.
|
|
207
214
|
- `Shift+Tab` changes what it may do without asking.
|
|
208
|
-
- `Esc` stops it
|
|
215
|
+
- `Esc` twice stops it; `Esc` also closes a dialog.
|
|
216
|
+
- While it works, `Enter` queues a message. `Esc` (or `↑`) takes queued messages back into the box
|
|
217
|
+
to change or drop, without stopping the work.
|
|
218
|
+
- `Shift+Enter` (or `Option+Enter`) adds a new line. `Alt+O` shows all of the model's thinking.
|
|
209
219
|
- While it works, commands that don't change the conversation (`/help`, `/cost`, `/diff`,
|
|
210
220
|
`/settings`…) run at once; the ones that do (`/compact`, `/rewind`…) wait until it's done.
|
|
211
221
|
|
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,43 @@ 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, by? }]` | the whole plan, each time it changes; `status` is `pending`, `in_progress` or `completed`; `by`: the model a step was handed to |
|
|
299
|
+
| `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 |
|
|
300
|
+
| `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 |
|
|
301
|
+
| `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) |
|
|
302
|
+
| `retry` | `attempt`, `delay_ms`, `error` | a request failed and is tried again after `delay_ms` |
|
|
303
|
+
| `warning` | `message` | what the screen shows as a warning (e.g. a model models.dev doesn't know) |
|
|
304
|
+
|
|
305
|
+
Not in the stream: HeartCode's own prompts (the system prompt, its nudges) and the wrap-up's
|
|
306
|
+
requests (their `retry` lines can come after the `result`). Their tokens are in `usage` and
|
|
307
|
+
`modelUsage`.
|
|
267
308
|
|
|
268
309
|
## Don't
|
|
269
310
|
|
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 (you have ${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')
|
package/bin/heartcode.js
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
import path from 'node:path'
|
|
3
3
|
import { parseArgs } from 'node:util'
|
|
4
4
|
import { Client, limitSaid, estMessages } from '../src/client.js'
|
|
5
|
-
import { loadConfig, saveConfig, readJson, writeJson, providerName, CONFIG_FILE, HOME, TEMP, AUTO_MODEL, isAuto, parseModel, takeIn, whatOf, VERSION, speedOf } from '../src/config.js'
|
|
5
|
+
import { loadConfig, saveConfig, readJson, writeJson, providerName, CONFIG_FILE, HOME, TEMP, AUTO_MODEL, isAuto, parseModel, takeIn, whatOf, VERSION, speedOf, jobsOf } from '../src/config.js'
|
|
6
6
|
import { loadProfile, strategy, describe, profilePath, profileFrom } from '../src/probe.js'
|
|
7
7
|
import { learnFromUsage, LIMIT_MS, RATE_CAP_MS } from '../src/context.js'
|
|
8
8
|
import { Session, transcript, contextReport } from '../src/agent.js'
|
|
9
9
|
import { listJobs, getJob, stopJob, removeJob, runningJobs, tailLines, ago as ranFor } from '../src/background.js'
|
|
10
10
|
import { checkUpdate, installKind, UPDATE_COMMANDS, packageDir, whatsNew } from '../src/update.js'
|
|
11
11
|
import { treeItems, codePlan, move, leaving, leftText, leftFiles } from '../src/tree.js'
|
|
12
|
-
import { UI, c, PERMISSIONS, duration, copyText, overSsh, rank, setTheme, themeCodes, renderDiff, diffLines, DEFAULT_KEYS, loadKeys, width, shortError, wrapWords } from '../src/ui.js'
|
|
12
|
+
import { UI, c, PERMISSIONS, duration, copyText, overSsh, prettyKey, rank, setTheme, themeCodes, renderDiff, diffLines, DEFAULT_KEYS, loadKeys, width, shortError, wrapWords } from '../src/ui.js'
|
|
13
13
|
import { listFiles, runCommand, clip } from '../src/tools.js'
|
|
14
14
|
import { notify } from '../src/telegram.js'
|
|
15
15
|
import { log, LOG_FILE, LOG_DIR, requestLog, useRequestLog, useLogs, pruneLogs, logDays } from '../src/log.js'
|
|
@@ -55,7 +55,7 @@ ${c.bold('options')}
|
|
|
55
55
|
"auto" (the default): your list, #1 then the next when one fails
|
|
56
56
|
--fallback-model <name> after -m's model when it fails (repeatable)
|
|
57
57
|
--api-key <key> API key for --base-url
|
|
58
|
-
-y, --yes do everything without asking (the default)
|
|
58
|
+
-y, --yes do everything without asking (the default; through --acp, an editor: ask)
|
|
59
59
|
--ask ask before every edit and command, this run
|
|
60
60
|
--hide-thinking the model's thinking: only its last two lines while it thinks (the default; Alt+O shows all of it)
|
|
61
61
|
-C, --cwd <dir> project folder (default: current folder)
|
|
@@ -93,7 +93,8 @@ ${c.bold('headless')} (for other programs; flags and output as in Claude Code's
|
|
|
93
93
|
${c.bold('editors')} heartcode --acp the Agent Client Protocol on stdin/stdout (Zed, JetBrains, Neovim)
|
|
94
94
|
|
|
95
95
|
${c.bold('env')} HEART_BASE_URL, HEART_MODEL, HEART_API_KEY (or OPENAI_BASE_URL / OPENAI_API_KEY)
|
|
96
|
-
HEART_LOG=<file> every
|
|
96
|
+
HEART_LOG=<file> every text log of this run in that one file, whatever is switched on (requests stay
|
|
97
|
+
in their own folder); HEART_LOG=off: no logs at all
|
|
97
98
|
|
|
98
99
|
${c.bold('in a session')} attach an image with @path/to/shot.png · /help for commands`
|
|
99
100
|
|
|
@@ -104,7 +105,7 @@ const SECTIONS = [
|
|
|
104
105
|
]],
|
|
105
106
|
['settings', [
|
|
106
107
|
['/toggle_thinking', "the model's thinking: its last two lines, or all of it (Alt+O)"],
|
|
107
|
-
['/voice', 'say your message (or Space in an empty box): it shows in the box as you speak, Enter sends it, Esc cancels'],
|
|
108
|
+
['/voice', 'say your message (or Space in an empty box, once voice is set up): it shows in the box as you speak, Enter sends it, Esc cancels'],
|
|
108
109
|
]],
|
|
109
110
|
['session', [
|
|
110
111
|
['/resume', 'continue an earlier session in this folder'],
|
|
@@ -133,7 +134,7 @@ const SECTIONS = [
|
|
|
133
134
|
['/reset', "HeartCode's settings (or also providers, or everything) back to the start; asks for a code first"],
|
|
134
135
|
['/settings', 'change providers, models, settings, MCP servers, hooks, keys and skills in your browser'],
|
|
135
136
|
['/help', 'this list'],
|
|
136
|
-
['/tab', 'a new tab (Alt+T): another conversation beside this one · /tab worktree [name]: in its own git worktree · /tab 2: go to tab 2 (Alt+N/P) · Alt+W closes one', true],
|
|
137
|
+
['/tab', 'a new tab (Alt+T): another conversation beside this one · /tab worktree [name]: in its own git worktree · /tab 2: go to tab 2 (Alt+2; Alt+N/P: the next or previous) · Alt+W closes one', true],
|
|
137
138
|
['/close_tab', 'close this tab (Alt+W); asks first'],
|
|
138
139
|
['/exit', 'quit HeartCode (Alt+W closes just this tab)'],
|
|
139
140
|
]],
|
|
@@ -149,19 +150,18 @@ const SLASH = helpText(SECTIONS)
|
|
|
149
150
|
|
|
150
151
|
// The keyboard shortcuts, as [keys, what] rows, read from the effective keybindings (keybindings.json
|
|
151
152
|
// can change any of them) plus the fixed ones (Space, Enter, Esc, Shift+Tab, Ctrl+C).
|
|
152
|
-
function keysHelp(keys = {}, mouse = false) {
|
|
153
|
-
const
|
|
154
|
-
const
|
|
155
|
-
const forAct = (a) => Object.entries(keys).filter(([, v]) => v === a).map(([k]) => pretty(k)).join(' / ')
|
|
156
|
-
const tabs = /(^|,)alt\+[1-9]/.test(Object.keys(keys).join(','))
|
|
153
|
+
function keysHelp(keys = {}, mouse = false, voice = false) {
|
|
154
|
+
const forAct = (a) => Object.entries(keys).filter(([, v]) => v === a).map(([k]) => prettyKey(k)).join(' / ')
|
|
155
|
+
const tabs = Object.values(keys).some((v) => /^tab_[1-9]$/.test(v))
|
|
157
156
|
const rows = [
|
|
158
|
-
['Space', 'voice: listens at once, Enter sends what you said (in an empty box)'],
|
|
157
|
+
[voice ? 'Space' : '', 'voice: listens at once, Enter sends what you said (in an empty box)'],
|
|
159
158
|
['Enter', 'send · while it works, queue the message (commands like /help, /cost, /select_model run at once)'],
|
|
160
|
-
['Option+Enter or Shift+Enter', 'new line in the box'],
|
|
161
|
-
['Esc', '
|
|
159
|
+
['Option+Enter or Shift+Enter', 'new line in the box (also while it works)'],
|
|
160
|
+
['Esc', 'while it works: queued messages back into the box, then clears the box, then stops the task (twice)'],
|
|
162
161
|
['Esc Esc', 'rewind to an earlier message (at the prompt)'],
|
|
163
162
|
['Shift+Tab', 'change what runs without asking (permissions)'],
|
|
164
|
-
[forAct('
|
|
163
|
+
[forAct('toggle_thinking'), "the model's thinking: after an answer, all of it in a box; while it works, all of it as it comes or its last two lines"],
|
|
164
|
+
[forAct('background_log'), "the background commands' logs in a dialog, a tab each (←/→ switch, ↑/↓ scroll, K twice stops one, Esc closes); with text in the box it moves back a word instead"],
|
|
165
165
|
[forAct('new_tab'), 'new tab'],
|
|
166
166
|
[forAct('close_tab'), 'close this tab'],
|
|
167
167
|
[forAct('next_tab'), 'next tab'],
|
|
@@ -251,7 +251,7 @@ class App {
|
|
|
251
251
|
this.ui.print(`${c.info('↗')} ${c.bold(name)} ${c.muted('needs you to sign in; opening your browser…')}\n ${c.faint(url)}`)
|
|
252
252
|
const [cmd, ...args] = process.platform === 'darwin' ? ['open', url] : process.platform === 'win32' ? ['rundll32', 'url.dll,FileProtocolHandler', url] : ['xdg-open', url]
|
|
253
253
|
spawnSync(cmd, args, { stdio: 'ignore' })
|
|
254
|
-
this.ui.spinner(`waiting for you to sign in to ${name} in the browser · Esc to stop`)
|
|
254
|
+
this.ui.spinner(`waiting for you to sign in to ${name} in the browser · Esc twice to stop`)
|
|
255
255
|
}
|
|
256
256
|
return mcp
|
|
257
257
|
}
|
|
@@ -367,9 +367,11 @@ class App {
|
|
|
367
367
|
client.onSwitch = (t) => {
|
|
368
368
|
const i = client.rotation.list.indexOf(t)
|
|
369
369
|
const f = failed?.e
|
|
370
|
+
const from = failed?.t
|
|
370
371
|
const why = f ? `${failed.t.model} ${f.status === 429 ? 'rate-limited (429)' : `failed (${clip(shortError(f), 50)})`} → ` : ''
|
|
371
372
|
failed = null
|
|
372
373
|
switched = c.dim(`↻ ${why}${t.provider} · ${t.model} answered${i ? ` (#${i + 1} in your model list)` : ' (#1 again)'}`)
|
|
374
|
+
ui.event?.({ subtype: 'model_switch', from: from ? `${from.provider}/${from.model}` : null, to: `${t.provider}/${t.model}`, reason: f ? (f.status === 429 ? 'rate-limited (429)' : shortError(f)) : null, place: i + 1 })
|
|
373
375
|
setImmediate(client.announceSwitch)
|
|
374
376
|
}
|
|
375
377
|
if (cfg.maxRetries !== undefined) client.retryIf = (e, attempt) => attempt < cfg.maxRetries // headless: then give up
|
|
@@ -633,7 +635,7 @@ class App {
|
|
|
633
635
|
const mine = this.commands().slice(COMMANDS.length)
|
|
634
636
|
const sections = [...SECTIONS]
|
|
635
637
|
if (mine.length) sections.push(['your skills (type /skill:name)', mine])
|
|
636
|
-
sections.push(['keyboard', keysHelp(this.ui.keys, this.cfg?.mouse !== false)])
|
|
638
|
+
sections.push(['keyboard', keysHelp(this.ui.keys, this.cfg?.mouse !== false, Boolean(this.ui.voiceReady?.()))])
|
|
637
639
|
return helpText(sections)
|
|
638
640
|
}
|
|
639
641
|
|
|
@@ -848,7 +850,18 @@ class App {
|
|
|
848
850
|
const now = this.s?.client.rotation?.list[this.s.client.rotation.at] ?? this.sessionModels()[0]
|
|
849
851
|
return this.sessionModels()
|
|
850
852
|
.filter((t) => !(t.provider === now?.provider && t.model === now?.model))
|
|
851
|
-
.map((t) => ({ ...t, ...this.abilities(t) }))
|
|
853
|
+
.map((t) => ({ ...t, ...this.abilities(t), jobs: jobsOf(this.cfg.helpers?.[`${t.provider}/${t.model}`]) })) // jobs: ticked as a helper on Your models (what for)
|
|
854
|
+
.sort(this.byProvider()) // helpers picked in your list's order, or your provider ranking's (Your models)
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
// Your models' "Helper order": by your provider ranking, a sort that puts the higher-ranked
|
|
858
|
+
// provider's models first (each provider's in your list's order; providers not ranked after, A to
|
|
859
|
+
// Z); in your list's order, one that keeps it.
|
|
860
|
+
byProvider() {
|
|
861
|
+
const rank = this.cfg.helperOrder === 'provider' && Array.isArray(this.cfg.providerRank) ? this.cfg.providerRank : null
|
|
862
|
+
if (!rank) return () => 0
|
|
863
|
+
const at = (p) => (rank.includes(p) ? rank.indexOf(p) : rank.length)
|
|
864
|
+
return (a, b) => at(a.provider) - at(b.provider) || (at(a.provider) === rank.length ? a.provider.localeCompare(b.provider) : 0)
|
|
852
865
|
}
|
|
853
866
|
|
|
854
867
|
// What a model can do, from its saved profile or models.dev (guessed: neither knows it).
|
|
@@ -901,7 +914,7 @@ class App {
|
|
|
901
914
|
const { cfg } = this
|
|
902
915
|
if (!cfg.session) return this.myModels(all)
|
|
903
916
|
const seen = new Set()
|
|
904
|
-
return cfg.session.filter((t) => cfg.providers[t.provider] && (all || !cfg.providers[t.provider].off) && t.model && !seen.has(`${t.provider}/${t.model}`) && seen.add(`${t.provider}/${t.model}`))
|
|
917
|
+
return cfg.session.filter((t) => cfg.providers[t.provider] && (all || cfg.pinned || !cfg.providers[t.provider].off) && t.model && !seen.has(`${t.provider}/${t.model}`) && seen.add(`${t.provider}/${t.model}`))
|
|
905
918
|
}
|
|
906
919
|
|
|
907
920
|
// Alt+B, /background: the background commands' logs in a dialog, one at a time with a tab each.
|
|
@@ -1224,7 +1237,7 @@ function applySettings(apps, cfg, what) {
|
|
|
1224
1237
|
const { ui } = app
|
|
1225
1238
|
const busy = Boolean(ui.busySince || app.working)
|
|
1226
1239
|
const now = (fn) => (busy ? app.later.push(fn) : fn())
|
|
1227
|
-
if (app.cfg !== cfg) for (const k of ['providers', 'provider', 'model', 'effort', 'theme', 'context', 'autoCompact', 'director', 'format', 'lsp', 'voice', 'rotation', 'statusBar']) app.cfg[k] = cfg[k]
|
|
1240
|
+
if (app.cfg !== cfg) for (const k of ['providers', 'provider', 'model', 'effort', 'theme', 'context', 'autoCompact', 'director', 'format', 'lsp', 'voice', 'rotation', 'statusBar', 'helpers', 'helpersAuto', 'helperOrder', 'providerRank', 'replyStart', 'replyIdle', 'telegram', 'queue', 'mouse']) app.cfg[k] = cfg[k]
|
|
1228
1241
|
// a model pinned in this CLI (/select_model) is a session choice: a model/order change on the
|
|
1229
1242
|
// settings page leaves it alone (only /select_model auto here returns it to the list)
|
|
1230
1243
|
if (what === 'model' && !app.cfg.session) {
|
|
@@ -1415,7 +1428,7 @@ async function slash(app, line, working = false) {
|
|
|
1415
1428
|
if (!go?.yes) return
|
|
1416
1429
|
}
|
|
1417
1430
|
if (!working && app.s?.wrapping) {
|
|
1418
|
-
ui.spinner('keeping what the last task learned · Ctrl+C to quit now')
|
|
1431
|
+
ui.spinner('keeping what the last task learned · Ctrl+C twice to quit now')
|
|
1419
1432
|
await app.s.wrapping
|
|
1420
1433
|
}
|
|
1421
1434
|
return 'exit'
|
|
@@ -1851,7 +1864,7 @@ async function repl(app, f = {}) {
|
|
|
1851
1864
|
ui.folder = app.root // what a double click on the header's folder copies
|
|
1852
1865
|
ui.header = (cols = 100) => {
|
|
1853
1866
|
const room = cols - 2 - width(`♥ HeartCode ${VERSION} `) // the folder's own name (its end) stays in sight
|
|
1854
|
-
const keys = [['/', 'run a command'], ['@', 'attach a file'], ...(ui.voiceReady?.() ? [['Space', 'talk (voice)']] : []), [NEWLINE_KEY, 'add a new line'], ['Esc', 'stop'], ['Shift+Tab', 'change permissions']]
|
|
1867
|
+
const keys = [['/', 'run a command'], ['@', 'attach a file'], ...(ui.voiceReady?.() ? [['Space', 'talk (voice)']] : []), [NEWLINE_KEY, 'add a new line'], ui.busySince ? ['Esc twice', 'stop'] : ['Esc Esc', 'go back to a message'], ['Shift+Tab', 'change permissions']]
|
|
1855
1868
|
// the keys: on a second line when they don't fit one, broken between keys (never inside one)
|
|
1856
1869
|
const rows = []
|
|
1857
1870
|
for (const kd of keys) {
|
|
@@ -1948,6 +1961,7 @@ async function main() {
|
|
|
1948
1961
|
// that starts with "page" ("page fix the footer") is a prompt
|
|
1949
1962
|
const target = process.argv[3]
|
|
1950
1963
|
if (process.argv[2] === 'page' && process.argv.length === 4 && (/^https?:\/\//.test(target) || fs.existsSync(target))) return (process.exitCode = await (await import('../src/check.js')).pageCommand(target))
|
|
1964
|
+
if (process.argv[2] === 'page' && process.argv.length === 4 && /[./\\]/.test(target)) return console.error(`heart page: no such file: ${target}`), (process.exitCode = 1) // a file meant, not there: not taken as a task
|
|
1951
1965
|
// "--resume <id>" (as in Claude Code) vs a bare "--resume" (pick one): an id follows it
|
|
1952
1966
|
const argv = process.argv.slice(2)
|
|
1953
1967
|
const print = argv.includes('-p') || argv.includes('--print') // headless: an id after --resume is always an id
|
|
@@ -2010,14 +2024,21 @@ async function main() {
|
|
|
2010
2024
|
for (const k of ['output-format', 'input-format']) if (f[k] && !['text', 'json', 'stream-json'].includes(f[k])) throw new Error(`--${k} must be text, json or stream-json`)
|
|
2011
2025
|
if (f['permission-mode'] && !PERMISSION_MODES[f['permission-mode']]) throw new Error(`--permission-mode must be one of ${Object.keys(PERMISSION_MODES).join(', ')}`)
|
|
2012
2026
|
|
|
2013
|
-
|
|
2027
|
+
if (f.effort && !['default', 'low', 'medium', 'high'].includes(f.effort)) throw new Error('--effort must be low, medium, high or default')
|
|
2028
|
+
const cfg = loadConfig({ baseUrl: f['base-url'], model: f.provider && f.model ? `${f.provider} ${f.model}` : f.model, apiKey: f['api-key'], context: f.context })
|
|
2014
2029
|
setTheme(cfg.theme)
|
|
2015
2030
|
useLogs(cfg)
|
|
2016
2031
|
const safe = { ...cfg, providers: Object.fromEntries(Object.entries(cfg.providers).map(([n, p]) => [n, { ...p, apiKey: p.apiKey && mask(p.apiKey) }])) }
|
|
2017
2032
|
log('start', `heartcode ${VERSION} · node ${process.version} · ${process.platform} · cwd ${process.cwd()}`, { args: process.argv.slice(2).map((a) => (a === f['api-key'] ? mask(a) : a)), config: safe })
|
|
2033
|
+
// --provider: one model alone, as -m does: with -m, that one (above); alone, that provider's first
|
|
2034
|
+
// model in your list
|
|
2018
2035
|
if (f.provider) {
|
|
2019
2036
|
if (!cfg.providers[f.provider]) throw new Error(`no provider "${f.provider}" (heartcode providers lists them)`)
|
|
2020
|
-
|
|
2037
|
+
if (!f.model) {
|
|
2038
|
+
const t = [{ provider: cfg.provider, model: cfg.model }, ...(cfg.rotation?.then ?? [])].find((x) => x.provider === f.provider && x.model)
|
|
2039
|
+
if (!t) throw new Error(`--provider ${f.provider}: none of your models is from it; add -m <model>`)
|
|
2040
|
+
Object.assign(cfg, { ...t, session: [t], pinned: true })
|
|
2041
|
+
}
|
|
2021
2042
|
}
|
|
2022
2043
|
// --fallback-model: after the model given (as in Claude Code's -p), when it fails
|
|
2023
2044
|
cfg.fallbacks = (f['fallback-model'] ?? []).map((v) => {
|
|
@@ -2030,6 +2051,8 @@ async function main() {
|
|
|
2030
2051
|
extraSkillDirs.push(...(f['skills-dir'] ?? []).map((d) => path.resolve(d)))
|
|
2031
2052
|
if (f.save) {
|
|
2032
2053
|
cfg.adhoc = null
|
|
2054
|
+
// the model given (-m, -u): saved as #1, not just for this run
|
|
2055
|
+
if (cfg.session?.length) [cfg.provider, cfg.model, cfg.session, cfg.pinned] = [cfg.session[0].provider, cfg.session[0].model, undefined, undefined]
|
|
2033
2056
|
saveConfig(cfg)
|
|
2034
2057
|
console.log(c.dim(`saved to ${CONFIG_FILE}`))
|
|
2035
2058
|
}
|
package/package.json
CHANGED
package/prompts/agent.md
CHANGED
|
@@ -34,8 +34,8 @@ Then build exactly what they chose. Nothing extra: no polish, features, tests or
|
|
|
34
34
|
## 2. Research and plan
|
|
35
35
|
1. Your memory is out of date. Before you use a library, framework, API, tool or command, read its current official docs (web_search, then web_fetch) and use its latest version. This project's own code needs no lookup: read the code.
|
|
36
36
|
2. Notes and pages saved for this project come with the message. Read them first.
|
|
37
|
-
3. Save a project note (memory tool) for what later tasks here need: how to build, run or test it; a decision and why.
|
|
38
|
-
4. Before the first change, write a plan with the todo tool: the result in one line, what "done" looks like, then each step with how you'll check it. A small change: one item.
|
|
37
|
+
3. {{#if memory}}Save a project note (memory tool) for what later tasks here need: how to build, run or test it; a decision and why.{{else}}Say in your reply what later tasks here need: how to build, run or test it; a decision and why.{{/if}}
|
|
38
|
+
4. Before the first change, write a plan with the todo tool: the result in one line, what "done" looks like, then each step with how you'll check it. A small change: one item. The first change of each message waits for that plan: without one it isn't made.
|
|
39
39
|
|
|
40
40
|
## 3. Find your way
|
|
41
41
|
Stop looking once you have what the task needs.
|
|
@@ -99,6 +99,11 @@ How to use {{server}}, in its own words (said once):
|
|
|
99
99
|
<!-- A tool result that was shortened. {{shown}}, {{total}}: characters shown and in all. {{file}}: where all of it is (may be empty). {{call}}: set for an older result shortened to save room ("run_command npm test"); its first lines follow. -->
|
|
100
100
|
[{{#if call}}Older output of {{call}}, shortened to save room{{else}}Shortened to fit{{/if}}. Not an error: it ran normally. {{shown}} of {{total}} characters shown.{{#if file}} All of it is in {{file}}: read_file it (start_line, end_line) or search it.{{/if}}]
|
|
101
101
|
|
|
102
|
+
## cut-off
|
|
103
|
+
|
|
104
|
+
<!-- Sent when the model's reply was cut off (its provider's output limit, or the connection ended early), to have it go on. -->
|
|
105
|
+
(Your reply was cut off. Go on exactly where it stopped, without repeating what you already wrote.)
|
|
106
|
+
|
|
102
107
|
## empty-reply
|
|
103
108
|
|
|
104
109
|
<!-- Sent when the model replied with nothing (no text, no tool call) in the middle of a task. -->
|
|
@@ -143,7 +148,7 @@ Your file changes in this message, as a diff (`all`: the whole conversation; `pa
|
|
|
143
148
|
|
|
144
149
|
## tool-list_files
|
|
145
150
|
|
|
146
|
-
With `path`: that folder's entries (folders end in /; "(ignored)": left out by .gitignore). Without: the project's files
|
|
151
|
+
With `path`: that folder's entries (folders end in /; "(ignored)": left out by .gitignore). Without: the project's files. `filter`: only paths containing it (with `path`: the files under that folder that contain it).
|
|
147
152
|
|
|
148
153
|
## tool-find_command
|
|
149
154
|
|
|
@@ -166,7 +171,7 @@ Create a file, or overwrite one with its full content. append: true adds to its
|
|
|
166
171
|
|
|
167
172
|
## tool-run_command
|
|
168
173
|
|
|
169
|
-
Run a shell command in the project folder. `wait`: seconds to wait for it (5 for a quick one, 60+ for an install or build; default 30). Finished: its exit code and output. Still running: it goes on in the background and you get its id and output so far; check it with the background tool. A command that keeps running (a dev server, a watcher): background: true.
|
|
174
|
+
Run a shell command in the project folder. `wait`: seconds to wait for it (5 for a quick one, 60+ for an install or build; default 30, or 3 with background: true). Finished: its exit code and output (of a long one, its last 4,000 characters). Still running: it goes on in the background and you get its id and output so far; check it with the background tool. A command that keeps running (a dev server, a watcher): background: true.
|
|
170
175
|
|
|
171
176
|
## tool-background
|
|
172
177
|
|
|
@@ -215,16 +220,16 @@ Files of this skill (read one with the skill tool: name "{{name}}", file "<path>
|
|
|
215
220
|
## tool-todo
|
|
216
221
|
|
|
217
222
|
<!-- The todo tool: the model's checklist, shown to the user. -->
|
|
218
|
-
Your todo list for a task with several steps. Send the whole list each time: content and status (pending, in_progress or completed). One item in_progress at a time; mark it completed as soon as it's done.
|
|
219
|
-
A part that stands alone (needs no other part's result, touches no file another part touches) can run at the same time on another of your models: parallel: true, model ("provider model" from "Your other models"; left out: yours), files (the files only it changes). HeartCode starts
|
|
223
|
+
Your todo list for a task with several steps. Send the whole list each time: content and status (pending, in_progress or completed). One item in_progress at a time; mark it completed as soon as it's done. A small task: one item (changing files needs a plan first).
|
|
224
|
+
A part that stands alone (needs no other part's result, touches no file another part touches) can run at the same time on another of your models: parallel: true, model ("provider model" from "Your helpers" or "Your other models"; left out: your first helper, or yours when you have none), files (the files only it changes). HeartCode starts the pending ones as helpers when you save the list (not in plan mode, not from a helper) and gives you what each did; you combine and check. Parts that build on each other, one file, a small fix: do them yourself.
|
|
220
225
|
|
|
221
226
|
## tool-web_search
|
|
222
227
|
|
|
223
|
-
Search the web. Returns titles, URLs and snippets; read a page with web_fetch.
|
|
228
|
+
Search the web. Returns titles, URLs and snippets; read a page with web_fetch. When pages this project already saved match, you get those instead of a search (with the date read): use them, or search with fresh: true for something that changes (a latest version).
|
|
224
229
|
|
|
225
230
|
## tool-web_fetch
|
|
226
231
|
|
|
227
|
-
Fetch a web page (any http/https URL) as Markdown. The whole page is saved in the project's research folder (the result says where). Give look_for (what you need, in a few words): a long page comes as its outline plus the matching parts; read the rest from the saved file with read_file. A short page comes whole.
|
|
232
|
+
Fetch a web page (any http/https URL) as Markdown. The whole page is saved in the project's research folder (the result says where). Give look_for (what you need, in a few words): a long page comes as its outline plus the matching parts; read the rest from the saved file with read_file. A short page comes whole. When nothing is saved (the result says so), a long page comes in parts: start (a character offset) reads on from where it stopped.
|
|
228
233
|
|
|
229
234
|
## tool-ask_user
|
|
230
235
|
|
|
@@ -238,19 +243,25 @@ No answer. Decide yourself, carry on, and say in your reply what you assumed.
|
|
|
238
243
|
## tool-agent
|
|
239
244
|
|
|
240
245
|
<!-- Starts a helper agent (only in the main conversation, not in helpers). -->
|
|
241
|
-
Give a side job to a helper agent with a fresh context, to keep the details out of this conversation: searching or reading a lot of code, web research, reviewing changes. It has your tools (no helpers of its own) and sees only your prompt: say exactly what to do and what to report. Its final reply is the result. description: 3-5 words for the user.
|
|
246
|
+
Give a side job to a helper agent with a fresh context, to keep the details out of this conversation: searching or reading a lot of code, web research, reviewing changes. It has your tools (but no helpers of its own, no memory, and it can't ask the user) and sees only your prompt: say exactly what to do and what to report. Its final reply is the result. description: 3-5 words for the user.
|
|
242
247
|
Several agent calls in one reply run at the same time: one helper per independent part, or the same question to several helpers to compare their answers.
|
|
243
248
|
|
|
244
249
|
## team
|
|
245
250
|
|
|
246
|
-
<!-- In the system prompt when the user set up other models. {{models}}: one per line, in the user's order, with what each can do. {{you}}: what this model can do. -->
|
|
247
|
-
# Your
|
|
251
|
+
<!-- In the system prompt when the user set up other models. {{models}}: one per line, in the user's order, with what each can do (and with {{helpers}}: what the user picked it for). {{you}}: what this model can do. {{helpers}}: the user ticked helpers on Your models: only those are listed and can be started. -->
|
|
252
|
+
{{#if helpers}}# Your helpers
|
|
253
|
+
|
|
254
|
+
Besides you (tool calls, {{you}}), the user picked these helpers, in their order, each with what they're good at:
|
|
255
|
+
{{models}}
|
|
256
|
+
|
|
257
|
+
Use them with the agent tool ("model" picks one, "images" gives it images):
|
|
258
|
+
- Give a part to the helper good at it; none fits: the first one ("model" left out).{{else}}# Your other models
|
|
248
259
|
|
|
249
260
|
Besides you (tool calls, {{you}}), the user set up these models, in their order:
|
|
250
261
|
{{models}}
|
|
251
262
|
|
|
252
263
|
Use them with the agent tool ("model" picks one, "images" gives it images):
|
|
253
|
-
- Give a part to the first model in this order that can do it. Independent parts run at the same time; you plan, combine and check. Small jobs: do them yourself.
|
|
264
|
+
- Give a part to the first model in this order that can do it.{{/if}} Independent parts run at the same time; you plan, combine and check. Small jobs: do them yourself.
|
|
254
265
|
- Can't do something (see an image, read more than fits)? Don't refuse or guess: ask a model that can.
|
|
255
266
|
- Ask for exactly what you need to act ("which of tiles 1-9 show a chair? numbers only"), not a description. A loop that needs the ability at every step (look, act, look again) goes whole to that model.
|
|
256
267
|
- Helpers take turns with the browser and MCP servers. Never give two helpers the same files. A failed helper's job goes to your next model. An unclear answer: ask again, sharper. Trust a clear answer; don't redo it.
|
|
@@ -443,7 +454,7 @@ Not changed: {{file}} belongs to another part. Your part changes only {{files}}.
|
|
|
443
454
|
These parts were done at the same time, each by a helper:
|
|
444
455
|
{{reports}}
|
|
445
456
|
{{#if unknown}}
|
|
446
|
-
({{unknown}}: not one of your models, so
|
|
457
|
+
({{unknown}}: not one of your models, so HeartCode chose the model for those parts. Yours: {{models}}.)
|
|
447
458
|
{{/if}}
|
|
448
459
|
Now combine them: read what they changed, add what's still needed between them, then check the whole thing once. A part not done: do it yourself or give it again.
|
|
449
460
|
|