heartcode 0.1.60 → 0.1.62
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 +42 -0
- package/README.md +24 -11
- package/bin/heartcode.js +27 -13
- package/package.json +1 -1
- package/prompts/agent.md +47 -9
- package/src/agent.js +80 -14
- package/src/background.js +2 -8
- package/src/capabilities.js +1 -1
- package/src/check.js +69 -4
- package/src/client.js +8 -5
- package/src/config.js +29 -0
- package/src/format.js +5 -3
- package/src/http.js +96 -0
- package/src/importer.js +1 -0
- package/src/lsp.js +3 -6
- package/src/mcp.js +4 -6
- package/src/oauth.js +1 -0
- package/src/rankings.js +7 -0
- package/src/settings.html +53 -39
- package/src/settings.js +12 -9
- package/src/spawn.js +48 -0
- package/src/telegram.js +1 -0
- package/src/tools.js +209 -18
- package/src/ui.js +58 -19
- package/src/update.js +1 -0
- package/src/usage.js +1 -0
- package/src/voice.js +20 -6
- package/src/web.js +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,48 @@
|
|
|
2
2
|
|
|
3
3
|
What changed in each version of HeartCode, newest first.
|
|
4
4
|
|
|
5
|
+
## 0.1.62 (2026-11-10)
|
|
6
|
+
|
|
7
|
+
- **"Done" is checked, not taken on trust**: a web page or game that was changed is opened in a real
|
|
8
|
+
browser by HeartCode itself before "done" is accepted; errors, a blank page or a canvas that draws
|
|
9
|
+
nothing send the model back with screenshots (a canvas showing one flat color now counts as
|
|
10
|
+
broken). Saying "done" again without changing anything doesn't pass.
|
|
11
|
+
- **Better models take over**: a model that times out or errors, goes round in circles, says it's
|
|
12
|
+
stuck or keeps failing the browser check hands the task to the best-ranked of your models
|
|
13
|
+
(LMArena) not tried yet, not just the next in your list (often a much smaller one). Your #1 still
|
|
14
|
+
starts every message. Helpers are picked best-ranked first by default (Used: by score).
|
|
15
|
+
- **Fixes don't lose earlier work**: the changes tool lists a file's earlier versions from every
|
|
16
|
+
conversation in the project (versions, version: N). A changed file much smaller than an earlier
|
|
17
|
+
version stops "done" until what was lost is checked, and the review checks that what earlier
|
|
18
|
+
messages asked for still works. Rules: a fix keeps everything working; never rewrite a whole
|
|
19
|
+
working file to fix part of it; judge by what's on screen, not values inside the program.
|
|
20
|
+
- **One agent or several**: a plan of several steps asks whether to work on it with several agents
|
|
21
|
+
at once. With several, parts that stand alone run side by side, and a part no model is sure of
|
|
22
|
+
(compare) is done by the two best-ranked models, each in a copy of the project; HeartCode checks
|
|
23
|
+
both and another model picks the better one.
|
|
24
|
+
- **The screen stays tidy**: "waiting for" shows once; a plan shows 3 steps (Alt+L or /todos for all
|
|
25
|
+
of it); thinking shows 2 lines (Alt+O for all); the same call made again shows once with ×N.
|
|
26
|
+
- **Works on Windows**: npm start installs from source (paths from file URLs were /C:/…); MCP
|
|
27
|
+
servers, language servers and npm/npx (.cmd files) start through cmd.exe with proper quoting; a
|
|
28
|
+
stopped command, server or background job takes its whole process tree with it; formatters and
|
|
29
|
+
ffmpeg are found with their .exe/.cmd; voice records from the microphone (DirectShow); the model
|
|
30
|
+
is told the shell its commands really run in.
|
|
31
|
+
- **Settings page**: Save list is always there and saves the list exactly as shown, keeping the
|
|
32
|
+
sort and filters; Clear sort in one click; Suggest helpers only marks the suggestions (no
|
|
33
|
+
filtering; the Helpers filter is gone); plain-language tooltips on the Models settings; Give up,
|
|
34
|
+
Stalled and Tests wait can't contradict each other (Tests wait and Stalled ≥ Give up: the one you
|
|
35
|
+
set stays, the other moves, and the page says why).
|
|
36
|
+
|
|
37
|
+
## 0.1.61 (2026-11-09)
|
|
38
|
+
|
|
39
|
+
- **No more hours of "not answering" after a connection dies**: requests go over HeartCode's own
|
|
40
|
+
HTTP/1.1 client (node:http/https, no packages) instead of Node's built-in fetch. That one used
|
|
41
|
+
HTTP/2, one connection for every request to a host; when it died without a word, every later
|
|
42
|
+
request waited on it and none was sent (every model behind one proxy "didn't start answering"
|
|
43
|
+
while the host answered at once). Now each request has its own socket, a stopped one takes it
|
|
44
|
+
with it, and the next request goes through on a fresh connection.
|
|
45
|
+
- **Alt+B shows the running background commands**; `A` shows the stopped and finished ones too.
|
|
46
|
+
|
|
5
47
|
## 0.1.60 (2026-11-08)
|
|
6
48
|
|
|
7
49
|
- **Models say when they're stuck, and get help**: a todo step can be marked `stuck` with why; the
|
package/README.md
CHANGED
|
@@ -27,7 +27,11 @@ has none, so there's nothing for anyone to poison.
|
|
|
27
27
|
down or fails, the next one answers and the work goes on. A ↻ in the status bar shows it.
|
|
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
|
-
- When a model goes round in circles,
|
|
30
|
+
- When a model goes round in circles, another takes over. Only you stop it (Esc).
|
|
31
|
+
- A model that shows it can't do the task (stuck, going round, or saying "done" while the work is
|
|
32
|
+
still broken) hands it to the best-ranked of your models it hasn't tried (LMArena's rankings),
|
|
33
|
+
not just the next in your list. Your list still decides who starts, and who answers when one is
|
|
34
|
+
down.
|
|
31
35
|
- Models are told to say when they're stuck, and believed: first a different approach, then a
|
|
32
36
|
second opinion from another of your models, then the next model takes over (not another version
|
|
33
37
|
of the same one). The same happens when a model says "I can't" without trying its tools, or
|
|
@@ -38,6 +42,9 @@ has none, so there's nothing for anyone to poison.
|
|
|
38
42
|
makes a plan before it changes anything.
|
|
39
43
|
- It runs and tests what it changed before it says "done", and another of your models checks the
|
|
40
44
|
result against what you asked.
|
|
45
|
+
- A web page or game it changed, HeartCode opens in a real browser itself before it accepts "done":
|
|
46
|
+
errors, a blank page or a canvas that draws nothing send it back to work, whatever the model's own
|
|
47
|
+
checks said.
|
|
41
48
|
- It writes the least code that works and changes only what the task needs.
|
|
42
49
|
|
|
43
50
|
**It learns, per project**
|
|
@@ -58,7 +65,7 @@ has none, so there's nothing for anyone to poison.
|
|
|
58
65
|
- **Skills, MCP servers and hooks** in Claude Code's formats; `/import` brings yours over.
|
|
59
66
|
- **Tabs** (`Alt+T`) and git worktrees, for work kept apart.
|
|
60
67
|
- **Servers in the background**: the model starts a dev server and keeps working. `Alt+B` shows
|
|
61
|
-
|
|
68
|
+
the running ones' logs live (`A`: the stopped ones too).
|
|
62
69
|
- **Telegram messages** when a task finishes, fails or waits for you.
|
|
63
70
|
- **Logs** of exactly what you choose (seven kinds, all off by default), readable on the settings page.
|
|
64
71
|
- **`heart -p`** runs one task without the screen, for other tools and AI agents, like `claude -p`
|
|
@@ -74,12 +81,16 @@ has none, so there's nothing for anyone to poison.
|
|
|
74
81
|
2. **It reads up** on whatever it's about to use, instead of trusting its memory.
|
|
75
82
|
3. **It makes a plan**: a todo list you can see. Its first change of each message waits for one.
|
|
76
83
|
4. **It does the work**: reading files, running commands, editing.
|
|
77
|
-
5. **It
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
84
|
+
5. **It splits the work, if you want.** When the plan has several steps, HeartCode asks: several
|
|
85
|
+
agents at once, or one? With several, steps that stand alone run at the same time, each on its
|
|
86
|
+
own files and on the model best at it. A step no model is sure to do well is done by two of your
|
|
87
|
+
best-ranked models, each in a copy of the project, and the better result is kept (HeartCode checks
|
|
88
|
+
both, another model picks). Nobody to answer (`heart -p`): several. Pick your helpers yourself
|
|
89
|
+
(below), or let HeartCode pick them; without any, it can use any of your models. Every step on
|
|
90
|
+
screen names the model doing it.
|
|
81
91
|
6. **It checks before it says it's done**: it must have tested what it changed, finished its todo
|
|
82
|
-
list and made the files it names.
|
|
92
|
+
list and made the files it names. A web page it changed, HeartCode opens in a browser itself.
|
|
93
|
+
Then your next models say yes or no (also when it changed no
|
|
83
94
|
files but ran commands or a browser); a no sends it back.
|
|
84
95
|
7. **It tidies up** in the background: saves notes for next time, removes throwaway files.
|
|
85
96
|
|
|
@@ -141,14 +152,14 @@ On **Models → List**:
|
|
|
141
152
|
2. **Drag rows** to fine-tune. #1 is the one HeartCode uses; the rest are its fallbacks, in order.
|
|
142
153
|
3. **Test** (optional): **Test all** sends each model a short message and shows which answer and
|
|
143
154
|
how fast (*Works?*). Sort by it to put the fastest first.
|
|
144
|
-
4. **Filter** (optional): by name, provider, test result, context, abilities
|
|
155
|
+
4. **Filter** (optional): by name, provider, test result, context, abilities or free.
|
|
145
156
|
**Use only these** keeps just the ones you see, in that order.
|
|
146
157
|
5. **Helpers** (optional): the models #1 can hand parts of a task to. In the *Helper* column, switch
|
|
147
158
|
a model on and pick what it's good at: **UI & visuals**, **Code & logic**, **Big & hard**,
|
|
148
159
|
**Quick & cheap** (hover an icon to see what it covers). **Suggest helpers** proposes them from
|
|
149
160
|
the models that passed **Test all** and the rankings; or set *Helpers* (at the top) to
|
|
150
|
-
**Automatic**. *Used*: which helper #1 takes first:
|
|
151
|
-
|
|
161
|
+
**Automatic**. *Used*: which helper #1 takes first: **by score** (the default: best placed in
|
|
162
|
+
LMArena's rankings first), in your order, or by your provider ranking.
|
|
152
163
|
|
|
153
164
|
**Update model info** fetches what each model can do and costs (from models.dev) and its places in
|
|
154
165
|
LMArena's public rankings for coding, web apps and vision, as columns to sort by. A model *not
|
|
@@ -222,7 +233,9 @@ Ask it to read, change, run and fix things in your project, like any coding agen
|
|
|
222
233
|
- `Esc` twice stops it; `Esc` also closes a dialog.
|
|
223
234
|
- While it works, `Enter` queues a message. `Esc` (or `↑`) takes queued messages back into the box
|
|
224
235
|
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
|
|
236
|
+
- `Shift+Enter` (or `Option+Enter`) adds a new line. `Alt+O` shows all of the model's thinking (two lines
|
|
237
|
+
of it show otherwise), `Alt+L` the whole plan (three of its steps show while it works). The same
|
|
238
|
+
call made again and again shows once, with a count (×4).
|
|
226
239
|
- While it works, commands that don't change the conversation (`/help`, `/cost`, `/diff`,
|
|
227
240
|
`/settings`…) run at once; the ones that do (`/compact`, `/rewind`…) wait until it's done.
|
|
228
241
|
|
package/bin/heartcode.js
CHANGED
|
@@ -5,7 +5,7 @@ import { Client, limitSaid, estMessages } from '../src/client.js'
|
|
|
5
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
|
-
import { loadRankings,
|
|
8
|
+
import { loadRankings, scoreOf } from '../src/rankings.js'
|
|
9
9
|
import { Session, transcript, contextReport } from '../src/agent.js'
|
|
10
10
|
import { listJobs, getJob, stopJob, removeJob, runningJobs, tailLines, ago as ranFor } from '../src/background.js'
|
|
11
11
|
import { checkUpdate, installKind, UPDATE_COMMANDS, packageDir, whatsNew } from '../src/update.js'
|
|
@@ -45,7 +45,7 @@ ${c.bold('usage')}
|
|
|
45
45
|
heart providers list added providers
|
|
46
46
|
heart models [filter] what -m takes, one per line: "auto" (the list), then each model
|
|
47
47
|
as provider/model, #1 first
|
|
48
|
-
heart models --all [filter] every provider's models (provider/model)
|
|
48
|
+
heart models --all [filter] every switched-on provider's models (provider/model)
|
|
49
49
|
heart models --json as JSON (with --all too), for other programs
|
|
50
50
|
heart config show the config file
|
|
51
51
|
heart settings change providers, models and settings in the browser
|
|
@@ -106,6 +106,7 @@ const SECTIONS = [
|
|
|
106
106
|
]],
|
|
107
107
|
['settings', [
|
|
108
108
|
['/toggle_thinking', "the model's thinking: its last two lines, or all of it (Alt+O)"],
|
|
109
|
+
['/todos', 'the whole plan of the task at work, every step and its state (Alt+L)'],
|
|
109
110
|
['/voice', 'dictate a message (or Space in an empty box, once voice is set up): it shows in the box while speaking, Enter sends it, Esc cancels'],
|
|
110
111
|
]],
|
|
111
112
|
['session', [
|
|
@@ -145,7 +146,7 @@ for (const [, list] of SECTIONS) list.sort(byName) // alphabetical, in /help and
|
|
|
145
146
|
const COMMANDS = SECTIONS.flatMap(([, list]) => list).sort(byName)
|
|
146
147
|
// Typed while a task works, these run at once, beside it: they leave the conversation alone. The
|
|
147
148
|
// others (/compact, /rewind, /resume, /init…) wait in the queue until it's done.
|
|
148
|
-
const RIGHT_AWAY = new Set(['help', 'cost', 'context', 'background', 'model_info', 'diff', 'copy', 'mcp', 'doctor', 'toggle_thinking', 'btw', 'rename', 'export', 'tab', 'close_tab', 'exit', 'quit', 'settings', 'login_mcp', 'install_skill', 'import', 'voice', 'select_model'])
|
|
149
|
+
const RIGHT_AWAY = new Set(['help', 'todos', 'cost', 'context', 'background', 'model_info', 'diff', 'copy', 'mcp', 'doctor', 'toggle_thinking', 'btw', 'rename', 'export', 'tab', 'close_tab', 'exit', 'quit', 'settings', 'login_mcp', 'install_skill', 'import', 'voice', 'select_model'])
|
|
149
150
|
const helpText = (sections) => sections.map(([title, list]) => ` ${c.bold(title)}\n` + list.map(([n, d]) => ` ${c.cyan(n.padEnd(17))} ${d}`).join('\n')).join('\n\n')
|
|
150
151
|
const SLASH = helpText(SECTIONS)
|
|
151
152
|
|
|
@@ -162,6 +163,7 @@ function keysHelp(keys = {}, mouse = false, voice = false) {
|
|
|
162
163
|
['Esc Esc', 'rewind to an earlier message (at the prompt)'],
|
|
163
164
|
['Shift+Tab', 'change what runs without asking (permissions)'],
|
|
164
165
|
[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"],
|
|
166
|
+
[forAct('show_plan'), 'the whole plan in a box (only three of its steps show while it works)'],
|
|
165
167
|
[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"],
|
|
166
168
|
[forAct('new_tab'), 'new tab'],
|
|
167
169
|
[forAct('close_tab'), 'close this tab'],
|
|
@@ -862,12 +864,12 @@ class App {
|
|
|
862
864
|
// across the lists the helpers are picked by (coding, web apps, long real tasks, hard prompts);
|
|
863
865
|
// models not in them after, in your list's order.
|
|
864
866
|
byProvider() {
|
|
865
|
-
if (this.cfg.helperOrder === 'score') {
|
|
867
|
+
if ((this.cfg.helperOrder ?? 'score') === 'score') { // the default: a small model early in your list isn't who looks at a screenshot
|
|
866
868
|
const data = loadRankings()
|
|
867
869
|
const share = new Map()
|
|
868
870
|
const of = (t) => {
|
|
869
871
|
const k = `${t.provider}/${t.model}`
|
|
870
|
-
if (!share.has(k)) share.set(k,
|
|
872
|
+
if (!share.has(k)) share.set(k, scoreOf(t.model, data))
|
|
871
873
|
return share.get(k)
|
|
872
874
|
}
|
|
873
875
|
return (a, b) => (of(a) === of(b) ? 0 : of(a) < of(b) ? -1 : 1) // Infinity (not ranked) last; ties keep your order
|
|
@@ -933,13 +935,20 @@ class App {
|
|
|
933
935
|
|
|
934
936
|
// Alt+B, /background: the background commands' logs in a dialog, one at a time with a tab each.
|
|
935
937
|
// ←/→ (or a click on a tab): another one; ↑/↓, PgUp/PgDn, the wheel: back in its log (End: the
|
|
936
|
-
// newest again); K twice: stop it and close its tab; Esc or Alt+B: closed.
|
|
938
|
+
// newest again); K twice: stop it and close its tab; A: the stopped ones too; Esc or Alt+B: closed.
|
|
937
939
|
toggleJobs(on = !this.jobsShown) {
|
|
938
940
|
const { ui } = this
|
|
939
941
|
if (!on) return ui.setDialog(null)
|
|
940
942
|
this.jobsShown = true
|
|
941
943
|
const ERROR = /\b(error|errors|failed|fail|exception|traceback|panic|fatal)\b/i
|
|
942
|
-
|
|
944
|
+
// running ones only (and any that stop while it's open); A: the stopped and finished ones too
|
|
945
|
+
let showAll = false
|
|
946
|
+
const live = new Set()
|
|
947
|
+
const jobs = () => {
|
|
948
|
+
for (const j of runningJobs(this.root)) live.add(j.id) // a command's leftover that's gone counts as stopped
|
|
949
|
+
const list = listJobs(this.root)
|
|
950
|
+
return showAll ? list : list.filter((j) => live.has(j.id))
|
|
951
|
+
}
|
|
943
952
|
const current = () => jobs().find((j) => j.id === this.jobTab) ?? jobs().findLast((j) => !j.exited) ?? jobs().at(-1)
|
|
944
953
|
let spots = [] // where each tab is on its row: { from, to, id }
|
|
945
954
|
let back = 0 // lines scrolled back from the newest (0: following it)
|
|
@@ -978,6 +987,7 @@ class App {
|
|
|
978
987
|
if (key.name === 'end') return (back = 0)
|
|
979
988
|
if (key.name === 'home') return (back = 1e6)
|
|
980
989
|
if (key.name === 'k' && !key.ctrl && !key.meta) return kill()
|
|
990
|
+
if (key.name === 'a' && !key.ctrl && !key.meta) return (showAll = !showAll), (back = 0)
|
|
981
991
|
},
|
|
982
992
|
click: (col, row) => {
|
|
983
993
|
const hit = row === 0 && spots.find((t) => col >= t.from && col < t.to)
|
|
@@ -985,7 +995,8 @@ class App {
|
|
|
985
995
|
},
|
|
986
996
|
draw: (w, h) => {
|
|
987
997
|
const all = jobs()
|
|
988
|
-
|
|
998
|
+
const ended = listJobs(this.root).length - all.length // stopped or finished, not shown
|
|
999
|
+
if (!all.length) return ['', ...wrapWords('Nothing runs in the background. The model starts servers and watchers there.', w - 2).map((l) => ` ${c.faint(l.trim())}`), '', ` ${c.faint(`${ended ? `A show ${ended} stopped · ` : ''}Esc close`)}`]
|
|
989
1000
|
const job = current()
|
|
990
1001
|
this.jobTab = job.id
|
|
991
1002
|
// the tabs, scrolled so the one shown is on screen
|
|
@@ -1016,7 +1027,7 @@ class App {
|
|
|
1016
1027
|
` ${c.bold(clip(job.command, Math.max(10, w - 2 - width(` · ${state} · ${ranFor(job)}${where}`.replace(/\x1b\[[0-9;]*m/g, '')))))} ${c.faint('·')} ${state} ${c.faint(`· ${ranFor(job)}`)}${where}`, // the command, as much as the rest leaves room for
|
|
1017
1028
|
...Array.from({ length: n }, (_, i) => (shown.length ? (shown[i] === undefined ? '' : ` ${ERROR.test(shown[i]) ? c.red(shown[i]) : c.muted(shown[i])}`) : i ? '' : ` ${c.faint('(no output yet)')}`)),
|
|
1018
1029
|
c.ghost('─'.repeat(w)),
|
|
1019
|
-
` ${said ? c.yellow(said) : c.faint(`${all.length > 1 ? '←/→ another one · ' : ''}↑/↓ PgUp/PgDn scroll · K ${job.exited ? 'close' : 'stop'} it · Esc close`)}`,
|
|
1030
|
+
` ${said ? c.yellow(said) : c.faint(`${all.length > 1 ? '←/→ another one · ' : ''}↑/↓ PgUp/PgDn scroll · K ${job.exited ? 'close' : 'stop'} it · ${showAll ? 'A running only' : ended ? `A show ${ended} stopped` : ''}${showAll || ended ? ' · ' : ''}Esc close`)}`,
|
|
1020
1031
|
]
|
|
1021
1032
|
},
|
|
1022
1033
|
})
|
|
@@ -1118,16 +1129,17 @@ class App {
|
|
|
1118
1129
|
|
|
1119
1130
|
// `heart models`: what -m takes, one per line (as \`opencode models\`): "auto" (your list: #1, then
|
|
1120
1131
|
// the next when one fails; also no -m), then your models as provider/model, #1 first. all: every
|
|
1121
|
-
// provider's models (fetched from each; a provider whose list is off: the ones added by
|
|
1132
|
+
// switched-on provider's models (fetched from each; a provider whose list is off: the ones added by
|
|
1133
|
+
// name). A provider switched off isn't listed at all: its models aren't offered anywhere.
|
|
1122
1134
|
// json: one JSON object on stdout, for other programs:
|
|
1123
1135
|
// { "models": [{ "id": "auto", "fallbacks": true }, { "id": "groq/openai/gpt-oss-120b", "provider", "model", "place": 1 }, …],
|
|
1124
|
-
// "providers": [{ "name", "baseUrl", "list": true, "
|
|
1136
|
+
// "providers": [{ "name", "baseUrl", "list": true, "models": ["provider/model", …], "error"? }] } (--all)
|
|
1125
1137
|
async listModels(filter = '', { all = false, json = false } = {}) {
|
|
1126
1138
|
const { ui, cfg } = this
|
|
1127
1139
|
const match = (id) => id.toLowerCase().includes(filter.toLowerCase())
|
|
1128
1140
|
const mine = this.myModels().map((t, i) => ({ id: `${t.provider}/${t.model}`, provider: t.provider, model: t.model, place: i + 1 }))
|
|
1129
|
-
const providers = !all ? [] : await Promise.all(Object.entries(cfg.providers).map(async ([name, p]) => {
|
|
1130
|
-
const out = { name, baseUrl: p.baseUrl, list: p.list !== false,
|
|
1141
|
+
const providers = !all ? [] : await Promise.all(Object.entries(cfg.providers).filter(([, p]) => !p.off).map(async ([name, p]) => {
|
|
1142
|
+
const out = { name, baseUrl: p.baseUrl, list: p.list !== false, models: [] }
|
|
1131
1143
|
if (out.list) {
|
|
1132
1144
|
try {
|
|
1133
1145
|
out.models = await new Client({ baseUrl: p.baseUrl, apiKey: p.apiKey }).listModels()
|
|
@@ -1734,6 +1746,8 @@ async function slash(app, line, working = false) {
|
|
|
1734
1746
|
if (text) ui.ahead.push(text) // sent: the next prompt takes it, as if typed
|
|
1735
1747
|
return
|
|
1736
1748
|
}
|
|
1749
|
+
case 'todos':
|
|
1750
|
+
return ui.showPlan()
|
|
1737
1751
|
case 'toggle_thinking':
|
|
1738
1752
|
ui.showThinking = !ui.showThinking
|
|
1739
1753
|
ui.print(c.dim(ui.showThinking ? 'thinking shown: all of it (Alt+O: last two lines)' : 'thinking shown: its last two lines (Alt+O: all of it)'))
|
package/package.json
CHANGED
package/prompts/agent.md
CHANGED
|
@@ -9,7 +9,7 @@ its section into ~/.heart/prompts/agent.md (every project) or .heartcode/prompts
|
|
|
9
9
|
|
|
10
10
|
<!-- The system prompt in tool mode (models with native tool calls).
|
|
11
11
|
{{root}}: the project folder's absolute path.
|
|
12
|
-
{{env}}: the OS and shell ("macOS (darwin 25.6.0, arm64), shell
|
|
12
|
+
{{env}}: the OS and the shell commands run in ("macOS (darwin 25.6.0, arm64), shell sh"; cmd.exe on Windows). {{today}}: the date (2026-10-30).
|
|
13
13
|
{{rootList}}: every entry in the project root, names only ("src/ · .git/ · node_modules/ (ignored) · package.json").
|
|
14
14
|
{{servers}}: language servers used in this project before ("typescript-language-server --stdio (typescript) for .ts"), or empty.
|
|
15
15
|
{{see}}: set when the model can see images.
|
|
@@ -46,8 +46,10 @@ Stop looking once you have what the task needs.
|
|
|
46
46
|
|
|
47
47
|
## 4. Write code
|
|
48
48
|
1. Bugs: find the root cause with evidence first. Read the whole error and reproduce it. Two fixes failed: investigate again. Three failures of one approach: change the approach.
|
|
49
|
+
It worked before and doesn't now: first find what changed since it worked (changes tool: versions) and fix or undo that change. Don't rebuild it.
|
|
50
|
+
A fix keeps everything working that the user asked for in this conversation. "Fix it" means all of it works again, not just the last thing they named.
|
|
49
51
|
2. Write the least that works. In this order: not needed → already in this code (reuse it) → the standard library → a built-in platform feature → an installed dependency → one line → new code, as little as possible. No abstractions or options nobody asked for.
|
|
50
|
-
3. Read a file before you change it. Change only what the task needs, in the style that's there. Don't touch nearby code. Remove only what your change made unused.
|
|
52
|
+
3. Read a file before you change it. Change only what the task needs, in the style that's there. Don't touch nearby code. Remove only what your change made unused. Never rewrite or cut down a whole working file to fix part of it.
|
|
51
53
|
4. Clear names. A comment only for what isn't obvious.
|
|
52
54
|
5. Tests: if the user wants them or the project has them, write the failing test first, see it fail, then make it pass.
|
|
53
55
|
6. "All" or "every": do one, check it, then do the rest the same way.
|
|
@@ -55,7 +57,8 @@ Stop looking once you have what the task needs.
|
|
|
55
57
|
|
|
56
58
|
## 5. Prove it works, then stop
|
|
57
59
|
1. Never say done, fixed or working without running what proves it and reading the output. "It should work" is not proof.
|
|
58
|
-
2. Check it the way the user will use it: run it, use it with real input and an edge case, look at it
|
|
60
|
+
2. Check it the way the user will use it, and judge it by what they get: run it, use it with real input and an edge case, read its errors. Something on a screen: take a screenshot and look at it. Values read from inside the program (variables, state) don't prove it works. Run the tests if there are any. Stop what you started.
|
|
61
|
+
Every problem the user named is part of the task: check each one is gone, one by one, before you say done.
|
|
59
62
|
3. Before you say done, read your whole change (changes tool). Update everything that uses what you changed or renamed.
|
|
60
63
|
4. A real bug: fix the cause and check again until it works. Once the proof passes, stop: no polish or extra tests.
|
|
61
64
|
5. A review point (from HeartCode, a reviewer or a helper): check it against the code. If it's wrong, say why and skip it.
|
|
@@ -145,6 +148,7 @@ Find text or a regex in the project's files, or only in `path` (a file, a folder
|
|
|
145
148
|
## tool-changes
|
|
146
149
|
|
|
147
150
|
Your file changes in this message, as a diff (`all`: the whole conversation; `path`: one file). Read it before you say done.
|
|
151
|
+
A file's earlier versions in this project (path, versions: true): as it was before each earlier message, in any conversation here. version: N gives one, and what changed from it to now. Something worked before and doesn't now: find the version that worked and what changed since.
|
|
148
152
|
|
|
149
153
|
## tool-list_files
|
|
150
154
|
|
|
@@ -222,7 +226,7 @@ Files of this skill (read one with the skill tool: name "{{name}}", file "<path>
|
|
|
222
226
|
<!-- The todo tool: the model's checklist, shown to the user. -->
|
|
223
227
|
Your todo list for a task with several steps. Send the whole list each time: content and status (pending, in_progress, completed or stuck). 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
228
|
Stuck: you've tried a step twice and it still doesn't work, or you don't know how to go on. Mark it stuck at once, with why (what you tried, what happened). It gets you help: a new approach, a second opinion, then another model. Saying so is expected and useful; claiming it works when it doesn't wastes the user's time.
|
|
225
|
-
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.
|
|
229
|
+
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). A part you're not sure one model does well (hard, or visual): also compare: true, with its files: two of the best models each do it in a copy of the project, and the better result is kept. 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.
|
|
226
230
|
|
|
227
231
|
## tool-web_search
|
|
228
232
|
|
|
@@ -319,23 +323,30 @@ Write the plan with the todo tool: the result in one line, then each step with h
|
|
|
319
323
|
|
|
320
324
|
## not-done
|
|
321
325
|
|
|
322
|
-
<!-- Sent when the model stops but isn't done. One placeholder is set, and only its part is sent. {{asked}}: it wrote questions for the user as text (only ask_user lets them answer); {{todos}}: open todo items, a "- item" per line; {{unchecked}}: files changed and not run or tested since; {{missing}}: files its answer names that don't exist; {{early}}: it named a next step but didn't take it. -->
|
|
326
|
+
<!-- Sent when the model stops but isn't done. One placeholder is set, and only its part is sent. {{asked}}: it wrote questions for the user as text (only ask_user lets them answer); {{todos}}: open todo items, a "- item" per line; {{unchecked}}: files changed and not run or tested since; {{missing}}: files its answer names that don't exist; {{early}}: it named a next step but didn't take it; {{shrunk}}: files it changed that are much smaller than an earlier version (one per line); {{broken}}: HeartCode opened {{page}} in a browser and it doesn't work (the report), {{shots}} its screenshots, {{command}} the same check as a command. -->
|
|
323
327
|
{{#if asked}}(The user can't answer questions written as text. Ask each one with the ask_user tool: question, header, options (your recommended one first), emphasis: true. Put all the calls in one reply.){{/if}}
|
|
324
328
|
{{#if todos}}(Not done: your todo list has open items:
|
|
325
329
|
{{todos}}
|
|
326
330
|
Do them. If one is no longer needed, update the list and say why.){{/if}}
|
|
327
331
|
{{#if unchecked}}(Not done: you changed {{unchecked}} and ran nothing since, so it isn't proven to work. Run, test or open it the way the user will. Fix what's wrong, then reply.){{/if}}
|
|
328
332
|
{{#if missing}}(Your answer names {{missing}}, but they aren't in the project. Make them, or correct your answer.){{/if}}
|
|
333
|
+
{{#if shrunk}}(Before you say done: these files are much smaller than they were earlier in this project:
|
|
334
|
+
{{shrunk}}
|
|
335
|
+
What earlier messages asked for may be gone. Look at that version (changes tool, with path and version) and what changed since. Everything the user asked for in this conversation, and everything that worked, must still work: bring back what was lost, then check it. Removed on purpose (the user asked, or it was broken and replaced): say so in your answer.){{/if}}
|
|
336
|
+
{{#if broken}}(Not done: HeartCode opened {{page}} in a real browser itself, and it doesn't work:
|
|
337
|
+
{{broken}}
|
|
338
|
+
This is what the user gets, whatever your own checks said. Look at the screenshots ({{shots}}) with read_file. Find the cause in the code, fix it, then run the same check yourself: {{command}} (it exits 0 when it passes). Checking values in the page (state, variables) doesn't prove it works; what's on the screen does.){{/if}}
|
|
329
339
|
{{#if early}}(You named a next step but didn't take it. If the task isn't done, do the rest now with your tools. If it is done and checked, reply with the final result only.){{/if}}
|
|
330
340
|
|
|
331
341
|
## review
|
|
332
342
|
|
|
333
|
-
<!-- A check before a task is called done, in a request of its own (your next models when there are any). {{request}}: the user's messages; {{plan}}: the todo list; {{answer}}: the agent's final reply; {{changes}}: the diffs; {{ran}}: commands run (newest last) and how they ended; {{emphasis}}: what the user said about how they want it (may be empty). -->
|
|
343
|
+
<!-- A check before a task is called done, in a request of its own (your next models when there are any). {{request}}: the user's messages; {{plan}}: the todo list; {{answer}}: the agent's final reply; {{changes}}: the diffs; {{ran}}: commands run (newest last) and how they ended; {{emphasis}}: what the user said about how they want it (may be empty); {{shrunk}}: changed files much smaller than an earlier version (may be empty). -->
|
|
334
344
|
You check a coding agent's work before the user gets it. Judge it strictly against what the user asked:
|
|
335
345
|
1. Complete: every part, every item of "all" or "every". Done, not described: steps for the user to do themselves, or "I can't", isn't doing it.
|
|
336
346
|
2. Correct: it would work. No bug, wrong API, placeholder or TODO.
|
|
337
347
|
3. Checked: what it ran shows it working.
|
|
338
348
|
4. Clean: no scratch files it made by hand left in the project (experiments, copies, test pages). Tool caches and build output (node_modules, .pytest_cache) are fine.
|
|
349
|
+
5. Nothing lost: what the user asked for in earlier messages, and what worked before, still works. A fix that removes earlier features isn't done.
|
|
339
350
|
Don't judge style or taste.{{#if emphasis}} The user said how they want it: {{emphasis}}. Hold it to that; what they didn't choose (polish, extras, tests, edge cases) is not missing.{{/if}}
|
|
340
351
|
|
|
341
352
|
The user asked:
|
|
@@ -352,7 +363,10 @@ What it changed (long changes are shortened here to save room; a shortened part
|
|
|
352
363
|
|
|
353
364
|
What it ran:
|
|
354
365
|
{{ran}}
|
|
355
|
-
|
|
366
|
+
{{#if shrunk}}
|
|
367
|
+
Files much smaller than an earlier version of them (something may have been lost):
|
|
368
|
+
{{shrunk}}
|
|
369
|
+
{{/if}}
|
|
356
370
|
The FIRST word of your reply must be YES (done right) or NO. If NO, follow with a numbered list of what's wrong or missing: where, what, and what's needed. Nothing else.
|
|
357
371
|
|
|
358
372
|
## review-failed
|
|
@@ -487,6 +501,30 @@ Your part: {{part}}
|
|
|
487
501
|
{{#if files}}Change only these files: {{files}}. Read others if you need to; never change them.
|
|
488
502
|
{{/if}}Do your part completely, check it works as far as it can alone, and stop. Reply with what you did, the names (functions, ids, events) other parts will use, and what another part must still do.
|
|
489
503
|
|
|
504
|
+
## compare
|
|
505
|
+
|
|
506
|
+
<!-- Two models did the same part of a plan, each in its own copy of the project; another model picks the better. {{task}}: the user's request; {{part}}: the part; {{model0}}/{{model1}}: who did A and B; {{said0}}/{{said1}}: what each replied; {{changes0}}/{{changes1}}: what each changed; {{check0}}/{{check1}}: HeartCode's browser check of a web page each changed. -->
|
|
507
|
+
Two models did the same part of a task, each on its own copy of the project. Pick the one that does the part better: it works (see the checks), it's complete, and it's correct. Don't judge style.
|
|
508
|
+
|
|
509
|
+
The user asked:
|
|
510
|
+
{{task}}
|
|
511
|
+
|
|
512
|
+
The part: {{part}}
|
|
513
|
+
|
|
514
|
+
A ({{model0}}) said:
|
|
515
|
+
{{said0}}
|
|
516
|
+
A changed:
|
|
517
|
+
{{changes0}}
|
|
518
|
+
HeartCode's check of A: {{check0}}
|
|
519
|
+
|
|
520
|
+
B ({{model1}}) said:
|
|
521
|
+
{{said1}}
|
|
522
|
+
B changed:
|
|
523
|
+
{{changes1}}
|
|
524
|
+
HeartCode's check of B: {{check1}}
|
|
525
|
+
|
|
526
|
+
The FIRST word of your reply must be A or B, then one line why. Nothing else.
|
|
527
|
+
|
|
490
528
|
## part-files
|
|
491
529
|
|
|
492
530
|
<!-- A helper doing one part tried to change a file its part doesn't own. {{file}}: that file; {{files}}: the ones it owns. -->
|
|
@@ -504,9 +542,9 @@ Now combine them: read what they changed, add what's still needed between them,
|
|
|
504
542
|
|
|
505
543
|
## plan-check
|
|
506
544
|
|
|
507
|
-
<!-- Added to the todo tool's result, once a message each. {{research}}: set when the plan has two or more steps and nothing was looked up yet. {{split}}: set when
|
|
545
|
+
<!-- Added to the todo tool's result, once a message each. {{research}}: set when the plan has two or more steps and nothing was looked up yet. {{split}}: set when the user chose several agents at once and no part is marked to run side by side or on another model. -->
|
|
508
546
|
{{#if research}}(Before you start: does this plan use a library, framework, API, tool or command? Your memory of it is out of date. Read its current official docs first (web_search, then web_fetch), or the pages already saved for this project. Only this project's own code: go on.){{/if}}
|
|
509
|
-
{{#if split}}(
|
|
547
|
+
{{#if split}}(The user wants several agents working at once. Mark each part that stands alone parallel: true, with the files only it changes and the model best at it (model). A part you're not sure one model does well: also compare: true. Then save the list again. If every part needs the one before it, say so in one line and go on.){{/if}}
|
|
510
548
|
|
|
511
549
|
## tool-memory
|
|
512
550
|
|