heartcode 0.1.59 → 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 CHANGED
@@ -2,6 +2,34 @@
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
+
5
33
  ## 0.1.59 (2026-11-07)
6
34
 
7
35
  - **You see which model does what**: every step names its model (`● web_fetch … · model`), each
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.
@@ -74,7 +79,8 @@ has none, so there's nothing for anyone to poison.
74
79
  let HeartCode pick them; without any, it can use any of your models, in your order. Every step
75
80
  on screen names the model doing it.
76
81
  6. **It checks before it says it's done**: it must have tested what it changed, finished its todo
77
- list and made the files it names. Then your next models say yes or no; a no sends it back.
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.
78
84
  7. **It tidies up** in the background: saves notes for next time, removes throwaway files.
79
85
 
80
86
  ## How to set it up
@@ -111,7 +117,7 @@ key. A running HeartCode picks up your changes right away.
111
117
 
112
118
  What's in the sidebar:
113
119
 
114
- - **Models**: *Your list* (the models HeartCode uses, in order) and *Providers* (where they come from).
120
+ - **Models**: *List* (the models HeartCode uses, in order) and *Providers* (where they come from).
115
121
  - **General**: what it may do without asking, colors, thinking effort, voice input, web search,
116
122
  and the *Status bar* (drag and drop what it shows). **Notifications**: Telegram.
117
123
  - **Skills**, **MCP servers** and **System prompt**: what HeartCode can do and what it's told.
@@ -128,7 +134,7 @@ On **Models → Providers**:
128
134
 
129
135
  ### 5. Put your list in order
130
136
 
131
- On **Models → Your list**:
137
+ On **Models → List**:
132
138
 
133
139
  1. **Sort.** Click *Abilities*, then *Context*: the most capable models come first, the biggest
134
140
  context window first among those. Click **Save list**.
@@ -139,9 +145,10 @@ On **Models → Your list**:
139
145
  **Use only these** keeps just the ones you see, in that order.
140
146
  5. **Helpers** (optional): the models #1 can hand parts of a task to. In the *Helper* column, switch
141
147
  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.
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).
145
152
 
146
153
  **Update model info** fetches what each model can do and costs (from models.dev) and its places in
147
154
  LMArena's public rankings for coding, web apps and vision, as columns to sort by. A model *not
package/SKILL.md CHANGED
@@ -295,7 +295,8 @@ a program that doesn't know a subtype can skip it, as for Claude Code):
295
295
  | `subtype` | Fields | When |
296
296
  |---|---|---|
297
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 |
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) |
299
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 |
300
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 |
301
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) |
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]) < 22) fail(`HeartCode needs Node.js 22 or newer (you have ${process.version}): https://nodejs.org`)
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')
package/bin/heartcode.js CHANGED
@@ -5,6 +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, rankIn } from '../src/rankings.js'
8
9
  import { Session, transcript, contextReport } from '../src/agent.js'
9
10
  import { listJobs, getJob, stopJob, removeJob, runningJobs, tailLines, ago as ranFor } from '../src/background.js'
10
11
  import { checkUpdate, installKind, UPDATE_COMMANDS, packageDir, whatsNew } from '../src/update.js'
@@ -42,24 +43,24 @@ ${c.bold('usage')}
42
43
  heart ~/code/my-app in that folder (a folder, not a file)
43
44
  heart "fix the failing test" run one task and exit
44
45
  heart providers list added providers
45
- heart models [filter] what -m takes, one per line: "auto" (your list), then your models
46
+ heart models [filter] what -m takes, one per line: "auto" (the list), then each model
46
47
  as provider/model, #1 first
47
48
  heart models --all [filter] every provider's models (provider/model)
48
49
  heart models --json as JSON (with --all too), for other programs
49
50
  heart config show the config file
50
- heart settings change providers, models and settings in your browser
51
+ heart settings change providers, models and settings in the browser
51
52
 
52
53
  ${c.bold('options')}
53
54
  -u, --base-url <url> use this server for this run (add --save to keep it)
54
55
  -m, --model <name> this model alone for this run (provider/model, or a model of #1's provider);
55
- "auto" (the default): your list, #1 then the next when one fails
56
+ "auto" (the default): the list, #1 then the next when one fails
56
57
  --fallback-model <name> after -m's model when it fails (repeatable)
57
58
  --api-key <key> API key for --base-url
58
59
  -y, --yes do everything without asking (the default; through --acp, an editor: ask)
59
60
  --ask ask before every edit and command, this run
60
61
  --hide-thinking the model's thinking: only its last two lines while it thinks (the default; Alt+O shows all of it)
61
62
  -C, --cwd <dir> project folder (default: current folder)
62
- --temp keep nothing: a throwaway settings folder (your providers, model info,
63
+ --temp keep nothing: a throwaway settings folder (providers, model info,
63
64
  prices and notes copied in), shared by the --temp runs going on at once
64
65
  and deleted after the last, with its logs; ~/.heart and the project's
65
66
  .heartcode/ aren't touched (their notes and research are read from a copy)
@@ -101,16 +102,16 @@ ${c.bold('in a session')} attach an image with @path/to/shot.png · /help for c
101
102
  // [name, description, takes an argument], by section. /help and the "/" menu are built from it.
102
103
  const SECTIONS = [
103
104
  ['providers and models', [
104
- ['/select_model', 'pick the model(s) for this session: one pins it, several rotate among them, auto = your whole list', true],
105
+ ['/select_model', 'pick the model(s) for this session: one pins it, several rotate among them, auto = the whole list', true],
105
106
  ]],
106
107
  ['settings', [
107
108
  ['/toggle_thinking', "the model's thinking: its last two lines, or all of it (Alt+O)"],
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'],
109
+ ['/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'],
109
110
  ]],
110
111
  ['session', [
111
112
  ['/resume', 'continue an earlier session in this folder'],
112
113
  ['/rewind', 'go back to an earlier message: conversation, code or both (Esc Esc); what came after stays in /tree'],
113
- ['/tree', "every message on every branch of this session: go to any, the files follow, a summary of what you leave comes along"],
114
+ ['/tree', "every message on every branch of this session: go to any, the files follow, a summary of the branch left behind comes along"],
114
115
  ['/rename', 'name this session (shown in /resume)', true],
115
116
  ['/fork', 'go on in a copy of this session (the original stays in /resume)'],
116
117
  ['/export', 'save the conversation as Markdown, HTML or JSON', true],
@@ -127,12 +128,12 @@ const SECTIONS = [
127
128
  ['/install_skill', 'install a skill from a GitHub repo or a SKILL.md URL (add --project for this folder only)', true],
128
129
  ['/doctor', 'check the outside tools HeartCode features need (voice, browser, git) and what to install'],
129
130
  ['/update', 'install the newest HeartCode (shows what changed first)'],
130
- ['/mcp', 'your MCP servers and whether each needs signing in'],
131
+ ['/mcp', 'the MCP servers and whether each needs signing in'],
131
132
  ['/login_mcp', 'sign in (again) to a remote MCP server', true],
132
133
  ['/compact', 'summarize the conversation to free up context (add what to keep)', true],
133
134
  ['/clear_chat', 'forget the conversation'],
134
135
  ['/reset', "HeartCode's settings (or also providers, or everything) back to the start; asks for a code first"],
135
- ['/settings', 'change providers, models, settings, MCP servers, hooks, keys and skills in your browser'],
136
+ ['/settings', 'change providers, models, settings, MCP servers, hooks, keys and skills in the browser'],
136
137
  ['/help', 'this list'],
137
138
  ['/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],
138
139
  ['/close_tab', 'close this tab (Alt+W); asks first'],
@@ -154,7 +155,7 @@ function keysHelp(keys = {}, mouse = false, voice = false) {
154
155
  const forAct = (a) => Object.entries(keys).filter(([, v]) => v === a).map(([k]) => prettyKey(k)).join(' / ')
155
156
  const tabs = Object.values(keys).some((v) => /^tab_[1-9]$/.test(v))
156
157
  const rows = [
157
- [voice ? 'Space' : '', 'voice: listens at once, Enter sends what you said (in an empty box)'],
158
+ [voice ? 'Space' : '', 'voice: listens at once, Enter sends what was said (in an empty box)'],
158
159
  ['Enter', 'send · while it works, queue the message (commands like /help, /cost, /select_model run at once)'],
159
160
  ['Option+Enter or Shift+Enter', 'new line in the box (also while it works)'],
160
161
  ['Esc', 'while it works: queued messages back into the box, then clears the box, then stops the task (twice)'],
@@ -182,13 +183,13 @@ function keysHelp(keys = {}, mouse = false, voice = false) {
182
183
  return rows
183
184
  }
184
185
 
185
- const HOWTO = `${c.yellow('No model set up yet.')} Add a provider and choose its models in your browser:
186
+ const HOWTO = `${c.yellow('No model set up yet.')} Add a provider and choose its models in the browser:
186
187
 
187
188
  ${c.cyan('/settings')} (or ${c.cyan('heart settings')} in another terminal)
188
189
 
189
190
  ${c.dim('Ollama, LM Studio or llama.cpp running on this machine is found on its own.')}`
190
191
  const NO_MODELS = `${c.yellow('No model chosen yet.')} Choose one on ${c.cyan('/settings')}: a provider's models, click one.`
191
- const ALL_OFF = `${c.yellow('The providers of all your models are switched off.')} Switch one on on ${c.cyan('/settings')}, or add a model of one that's on.`
192
+ const ALL_OFF = `${c.yellow('The providers of all the models are switched off.')} Switch one on on ${c.cyan('/settings')}, or add a model of one that's on.`
192
193
 
193
194
  // Choices for commands that take one (also offered in the "/" menu).
194
195
  const ARGS = {
@@ -248,10 +249,10 @@ class App {
248
249
  // a remote server asks to sign in: its page opens in the browser (and the link is shown)
249
250
  if (!this.ui.noUser)
250
251
  mcp.onSignIn = (name, url) => {
251
- this.ui.print(`${c.info('↗')} ${c.bold(name)} ${c.muted('needs you to sign in; opening your browser…')}\n ${c.faint(url)}`)
252
+ this.ui.print(`${c.info('↗')} ${c.bold(name)} ${c.muted('needs a sign-in; opening the browser…')}\n ${c.faint(url)}`)
252
253
  const [cmd, ...args] = process.platform === 'darwin' ? ['open', url] : process.platform === 'win32' ? ['rundll32', 'url.dll,FileProtocolHandler', url] : ['xdg-open', url]
253
254
  spawnSync(cmd, args, { stdio: 'ignore' })
254
- this.ui.spinner(`waiting for you to sign in to ${name} in the browser · Esc twice to stop`)
255
+ this.ui.spinner(`waiting for the sign-in to ${name} in the browser · Esc twice to stop`)
255
256
  }
256
257
  return mcp
257
258
  }
@@ -370,7 +371,7 @@ class App {
370
371
  const from = failed?.t
371
372
  const why = f ? `${failed.t.model} ${f.status === 429 ? 'rate-limited (429)' : `failed (${clip(shortError(f), 50)})`} → ` : ''
372
373
  failed = null
373
- switched = c.dim(`↻ ${why}${t.provider} · ${t.model} answered${i ? ` (#${i + 1} in your model list)` : ' (#1 again)'}`)
374
+ switched = c.dim(`↻ ${why}${t.provider} · ${t.model} answered${i ? ` (#${i + 1} in the model list)` : ' (#1 again)'}`)
374
375
  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 })
375
376
  setImmediate(client.announceSwitch)
376
377
  }
@@ -555,7 +556,7 @@ class App {
555
556
  // leave is kept, the files can follow, and a summary of what you leave can come along.
556
557
  async tree() {
557
558
  const { ui, chat } = this
558
- if (!chat.turns.length && !chat.branches?.length) return ui.print('Nothing here yet: the tree grows as you send messages and go back (/rewind, /tree).')
559
+ if (!chat.turns.length && !chat.branches?.length) return ui.print('Nothing here yet: the tree grows as messages are sent and rewound (/rewind, /tree).')
559
560
  chat.log = ui.log
560
561
  const n = (chat.branches?.length ?? 0) + 1
561
562
  const it = await ui.pick(`This session${n > 1 ? `, ${n} branches` : ''} · pick a message`, treeItems(chat, ago))
@@ -580,7 +581,7 @@ class App {
580
581
  }
581
582
  let summarize = false
582
583
  if (leaving(chat, it.branch, go.keep) && (this.s || this.cfg.providers[this.cfg.provider])) {
583
- const a = await ui.pick('Bring a summary of the messages you leave?', [
584
+ const a = await ui.pick('Bring a summary of the messages left behind?', [
584
585
  { label: 'Yes', desc: 'one request to the model, so this branch knows what was tried there', yes: true },
585
586
  { label: 'No', desc: 'they stay in the tree, the model just won\'t know about them' },
586
587
  ])
@@ -594,13 +595,13 @@ class App {
594
595
  if (summarize) {
595
596
  const s = await this.session()
596
597
  if (s) {
597
- ui.spinner('summarizing the branch you left')
598
+ ui.spinner('summarizing the branch left behind')
598
599
  try {
599
600
  const changedThere = leftFiles(left)
600
601
  const summary = await s.summarizeBranch(leftText(left, transcript), changedThere, this.signal)
601
602
  chat.branchNote = prompt('compact/branch-note', { summary, files: changedThere.join(', '), kept: changedThere.length && !code, restored: changedThere.length && code })
602
603
  ui.stopSpin()
603
- ui.print(`${c.faint('✻')} ${c.muted(`summary of the branch you left (goes with your next message): ${clip(summary.split('\n').find((l) => l.trim()) ?? '', 120)}`)}`)
604
+ ui.print(`${c.faint('✻')} ${c.muted(`summary of the branch left behind (goes with the next message): ${clip(summary.split('\n').find((l) => l.trim()) ?? '', 120)}`)}`)
604
605
  } catch (e) {
605
606
  ui.stopSpin()
606
607
  if (e.name === 'AbortError') throw e
@@ -608,7 +609,7 @@ class App {
608
609
  }
609
610
  }
610
611
  }
611
- ui.print(c.dim(`${go.edit ? 'edit the message and send it: a new branch' : 'here now'} · the branch you left stays in /tree`))
612
+ ui.print(c.dim(`${go.edit ? 'edit the message and send it: a new branch' : 'here now'} · the branch left behind stays in /tree`))
612
613
  if (go.edit) this.nextInput = it.task
613
614
  if (this.s) this.s.client.lastTokens = 0
614
615
  this.save()
@@ -634,7 +635,7 @@ class App {
634
635
  help() {
635
636
  const mine = this.commands().slice(COMMANDS.length)
636
637
  const sections = [...SECTIONS]
637
- if (mine.length) sections.push(['your skills (type /skill:name)', mine])
638
+ if (mine.length) sections.push(['skills (type /skill:name)', mine])
638
639
  sections.push(['keyboard', keysHelp(this.ui.keys, this.cfg?.mouse !== false, Boolean(this.ui.voiceReady?.()))])
639
640
  return helpText(sections)
640
641
  }
@@ -699,7 +700,7 @@ class App {
699
700
  if (!cfg.providers[cfg.provider] || !cfg.model) return c.dim('no model · /settings to choose one')
700
701
  const rot = this.s?.client.rotation
701
702
  const now = this.inUse() // the model list's one in use; never one of a provider that's off
702
- if (!now) return c.dim('the providers of all your models are off · /settings to switch one on')
703
+ if (!now) return c.dim('the providers of all the models are off · /settings to switch one on')
703
704
  const count = this.sessionModels().length
704
705
  // the model answering now; a yellow "↻" before it when it's a fallback (rotated to after one failed)
705
706
  const rotated = rot && rot.at > 0
@@ -714,7 +715,7 @@ class App {
714
715
  const parts = {
715
716
  provider: `${c.brand('●')} ${c.muted(now.provider)}`,
716
717
  model,
717
- mode: strat ? (strat.actions === 'tools' ? null : c.muted('no tool calls (guided)')) : c.faint('checked at your first message'), // what it can do: known once it's been asked
718
+ mode: strat ? (strat.actions === 'tools' ? null : c.muted('no tool calls (guided)')) : c.faint('checked at the first message'), // what it can do: known once it's been asked
718
719
  thinking: strat?.thinking ? c.think(`thinking · ${effortOf(cfg)}`) + (ui.showThinking ? c.faint(' (all)') : '') : null,
719
720
  images: strat?.vision ? c.muted('images') : null,
720
721
  ctx: null,
@@ -851,13 +852,26 @@ class App {
851
852
  return this.sessionModels()
852
853
  .filter((t) => !(t.provider === now?.provider && t.model === now?.model))
853
854
  .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
+ .sort(this.byProvider()) // helpers picked in your list's order, your provider ranking's, or by score (Your models)
855
856
  }
856
857
 
857
858
  // Your models' "Helper order": by your provider ranking, a sort that puts the higher-ranked
858
859
  // provider's models first (each provider's in your list's order; providers not ranked after, A to
859
860
  // Z); in your list's order, one that keeps it.
861
+ // By score: the best placed in LMArena's rankings first (its best share of a list: #5 of 200 is 2.5%),
862
+ // across the lists the helpers are picked by (coding, web apps, long real tasks, hard prompts);
863
+ // models not in them after, in your list's order.
860
864
  byProvider() {
865
+ if (this.cfg.helperOrder === 'score') {
866
+ const data = loadRankings()
867
+ const share = new Map()
868
+ const of = (t) => {
869
+ const k = `${t.provider}/${t.model}`
870
+ if (!share.has(k)) share.set(k, Math.min(...['text:coding', 'webdev:webdev', 'agent:overall', 'text:hard_prompts'].map((l) => rankIn(t.model, l, data)).filter(Boolean).map((r) => r.rank / r.of), Infinity))
871
+ return share.get(k)
872
+ }
873
+ return (a, b) => (of(a) === of(b) ? 0 : of(a) < of(b) ? -1 : 1) // Infinity (not ranked) last; ties keep your order
874
+ }
861
875
  const rank = this.cfg.helperOrder === 'provider' && Array.isArray(this.cfg.providerRank) ? this.cfg.providerRank : null
862
876
  if (!rank) return () => 0
863
877
  const at = (p) => (rank.includes(p) ? rank.indexOf(p) : rank.length)
@@ -1019,7 +1033,7 @@ class App {
1019
1033
  this.s = null
1020
1034
  }
1021
1035
  const msg = list.length === 1 ? `${c.green('using')} ${c.cyan(list[0].model)} ${c.dim('· pinned for this folder')}` : `${c.green(`using ${list.length} models for this folder`)}: ${c.cyan(list.map((t) => t.model).join(', '))}`
1022
- if (later) return this.later.push(apply), this.ui.print(`${msg} ${c.dim('· from your next message')}`)
1036
+ if (later) return this.later.push(apply), this.ui.print(`${msg} ${c.dim('· from the next message')}`)
1023
1037
  apply()
1024
1038
  this.ui.print(msg)
1025
1039
  await this.session()
@@ -1036,7 +1050,7 @@ class App {
1036
1050
  }
1037
1051
  const n = this.myModels().length
1038
1052
  const msg = `${c.green('using')} ${c.dim('auto')} ${c.cyan(`(${n} model${n === 1 ? '' : 's'})`)}`
1039
- if (later) return this.later.push(apply), this.ui.print(`${msg} ${c.dim('· from your next message')}`)
1053
+ if (later) return this.later.push(apply), this.ui.print(`${msg} ${c.dim('· from the next message')}`)
1040
1054
  apply()
1041
1055
  this.ui.print(msg)
1042
1056
  await this.session()
@@ -1055,7 +1069,7 @@ class App {
1055
1069
  const chosen = new Set((cfg.session ?? mine).map(key)) // pre-ticked: this session's set, or all (auto)
1056
1070
  const items = mine.map((t) => ({ label: t.model, t, checked: chosen.has(key(t)), desc: this.modelDesc(t, mine.indexOf(t)) }))
1057
1071
  // first, standing alone: back to auto (Enter on it, whatever is ticked)
1058
- const auto = { label: 'auto', only: true, auto: true, desc: `your whole list, in its order (${mine.length} model${mine.length === 1 ? '' : 's'})${cfg.session ? ' · forgets what this folder picked' : ' · in use'}` }
1072
+ const auto = { label: 'auto', only: true, auto: true, desc: `the whole list, in its order (${mine.length} model${mine.length === 1 ? '' : 's'})${cfg.session ? ' · forgets what this folder picked' : ' · in use'}` }
1059
1073
  const guessed = mine.some((t) => this.abilities(t).guessed) ? "\n~128k and the like: the window's size is a guess (models.dev doesn't list the model)" : ''
1060
1074
  const picked = await ui.pick('Models for this session', [auto, ...items], { filter, multi: true, body: `Tick several to rotate among them, one to pin it, or choose auto.${guessed}` })
1061
1075
  if (!picked) return
@@ -1085,7 +1099,7 @@ class App {
1085
1099
  const missing = []
1086
1100
  for (const spec of specs) (resolve(spec) ? found : missing).push(resolve(spec) ?? spec)
1087
1101
  if (missing.length || !found.length) {
1088
- if (missing.length) this.ui.print(c.dim(`not in your models: ${missing.join(', ')} · add on /settings`))
1102
+ if (missing.length) this.ui.print(c.dim(`not in the model list: ${missing.join(', ')} · add on /settings`))
1089
1103
  return this.chooseModel(specs.length === 1 ? specs[0] : '', later)
1090
1104
  }
1091
1105
  return this.setSession(found, later)
@@ -1176,7 +1190,7 @@ async function continueTabs(app, saved) {
1176
1190
  if (!open.length) return
1177
1191
  const many = open.length > 1
1178
1192
  const newest = open.map((t) => t.chat.updated).sort().at(-1)
1179
- const go = await ui.pick(many ? `Continue where you left off? ${open.length} tabs` : 'Continue your last session here?', [
1193
+ const go = await ui.pick(many ? `Continue where it left off? ${open.length} tabs` : 'Continue the last session here?', [
1180
1194
  { label: many ? `Yes, with its ${open.length} tabs` : 'Yes', desc: `${open.map((t) => `"${t.chat.title}"`).join(', ')} · ${ago(newest)}`, yes: true },
1181
1195
  { label: 'No, start a new session', desc: '/resume finds it later' },
1182
1196
  ], { quiet: true, fixed: true })
@@ -1202,8 +1216,8 @@ async function continueTabs(app, saved) {
1202
1216
  // A continued tab's own model, as it was (unless its provider is gone: then the current one).
1203
1217
  function useModel(app, { provider, model }) {
1204
1218
  if (!provider || !model || (provider === app.cfg.provider && model === app.cfg.model)) return
1205
- if (!app.cfg.providers[provider]) return app.ui.warn(`this tab used ${provider} · ${model}, but there's no provider "${provider}" now: using your list`)
1206
- if (app.cfg.providers[provider].off) return app.ui.warn(`this tab used ${provider} · ${model}, but ${provider} is switched off: using your list`)
1219
+ if (!app.cfg.providers[provider]) return app.ui.warn(`this tab used ${provider} · ${model}, but there's no provider "${provider}" now: using the list`)
1220
+ if (app.cfg.providers[provider].off) return app.ui.warn(`this tab used ${provider} · ${model}, but ${provider} is switched off: using the list`)
1207
1221
  Object.assign(app.cfg, { provider, model })
1208
1222
  app.s = null
1209
1223
  }
@@ -1243,7 +1257,7 @@ function applySettings(apps, cfg, what) {
1243
1257
  if (what === 'model' && !app.cfg.session) {
1244
1258
  app.lists = {}
1245
1259
  if (app.s && !(cfg.providers[cfg.provider] && cfg.model)) now(() => ((app.s = null), ui.print(c.dim('settings: no model chosen'))))
1246
- else if (app.s && !app.myModels().length) now(() => ((app.s = null), ui.print(c.dim('settings: the providers of all your models are switched off'))))
1260
+ else if (app.s && !app.myModels().length) now(() => ((app.s = null), ui.print(c.dim('settings: the providers of all the models are switched off'))))
1247
1261
  }
1248
1262
  // your model list: into the running session now, its next request goes to the new #1
1249
1263
  if (['model', 'setting:rotation'].includes(what) && !app.cfg.session && app.s && cfg.providers[cfg.provider] && cfg.model) {
@@ -1422,7 +1436,7 @@ async function slash(app, line, working = false) {
1422
1436
  const n = app.tabs?.list.length ?? 1
1423
1437
  if (n > 1 || working) {
1424
1438
  const go = await ui.pick(`Quit HeartCode?${working ? ' It is still working: that stops.' : ''}${n > 1 ? ` ${n} tabs are open` : ''}`, [
1425
- { label: 'Yes, quit', desc: 'they come back next time you start HeartCode here', yes: true },
1439
+ { label: 'Yes, quit', desc: 'they come back the next time HeartCode starts here', yes: true },
1426
1440
  { label: 'No', desc: 'Alt+W closes just this tab' },
1427
1441
  ])
1428
1442
  if (!go?.yes) return
@@ -1439,7 +1453,7 @@ async function slash(app, line, working = false) {
1439
1453
  const home = process.env.HOME
1440
1454
  const tilde = (f) => (home && f.startsWith(home) ? '~' + f.slice(home.length) : f)
1441
1455
  const files = resetPaths(it.level)
1442
- const what = [...(it.level === 'settings' ? [`the settings in ${tilde(CONFIG_FILE)} (not your providers, keys or model)`] : []), ...files.map(tilde)]
1456
+ const what = [...(it.level === 'settings' ? [`the settings in ${tilde(CONFIG_FILE)} (not the providers, keys or model)`] : []), ...files.map(tilde)]
1443
1457
  ui.print(`${c.warn('!')} ${c.bold(`Reset: ${it.label.toLowerCase()}.`)} ${c.muted("This can't be undone. It removes:")}\n${what.length ? what.map((f) => ` ${c.faint('·')} ${f}`).join('\n') : c.faint(' (nothing there yet)')}`)
1444
1458
  const code = resetCode()
1445
1459
  const typed = await ui.ask(` Type ${c.bold(code)} to reset ${c.dim('(anything else: no)')}: `)
@@ -1453,7 +1467,7 @@ async function slash(app, line, working = false) {
1453
1467
  settingsPage ??= startSettings({ cfg, root: app.root, onLoginMcp: (name) => signInMcp(app, name, null), apply: (what) => applySettings(app.tabs ? app.tabs.list.map((t) => t.app) : [app], cfg, what) })
1454
1468
  const { url, local, close } = await settingsPage
1455
1469
  openBrowser(local)
1456
- if (!ui.full) ui.print(`${c.info('↗')} ${c.bold('settings')} ${c.muted(overSsh ? 'open this link in your browser:' : 'opened in your browser:')}\n ${c.faint(url)}`)
1470
+ if (!ui.full) ui.print(`${c.info('↗')} ${c.bold('settings')} ${c.muted(overSsh ? 'open this link in a browser:' : 'opened in the browser:')}\n ${c.faint(url)}`)
1457
1471
  // a dialog until it's turned off: nothing else meanwhile, in any tab (Esc turns it off too).
1458
1472
  // Not busy meanwhile: what's changed on the page applies at once, here too (opened while a task
1459
1473
  // works: once it's done).
@@ -1461,7 +1475,7 @@ async function slash(app, line, working = false) {
1461
1475
  if (app.tabs) app.tabs.locked = true
1462
1476
  ui.setMouse(false) // the terminal's own selection for the link: OSC 52 copying fails in some terminals
1463
1477
  try {
1464
- await ui.pick('The settings page is on', [{ label: 'Turn off', desc: 'stops the page and gives HeartCode back' }], { fixed: true, quiet: true, ctrlC: true, body: `${overSsh ? 'Open this link in your browser:' : "It's open in your browser:"}\n${url}\n\nTo copy it, select it with the mouse.\nWhat you change there applies right away.` })
1478
+ await ui.pick('The settings page is on', [{ label: 'Turn off', desc: 'stops the page and gives HeartCode back' }], { fixed: true, quiet: true, ctrlC: true, body: `${overSsh ? 'Open this link in a browser:' : "It's open in the browser:"}\n${url}\n\nTo copy it, select it with the mouse.\nChanges there apply right away.` })
1465
1479
  } finally {
1466
1480
  ui.setMouse(cfg.mouse !== false)
1467
1481
  if (app.tabs) app.tabs.locked = false
@@ -1493,9 +1507,9 @@ async function slash(app, line, working = false) {
1493
1507
  if (!u.newer) return ui.print(c.dim(`HeartCode ${u.current} is the newest`))
1494
1508
  const kind = installKind()
1495
1509
  const notes = await whatsNew(u.current, u.latest)
1496
- if (kind === 'git') return ui.showText(`HeartCode ${u.latest} is out (you have ${u.current})`, `${notes || '(no changelog found)'}\n\nThis HeartCode runs from a git checkout (${packageDir}): update it there with git pull.`)
1510
+ if (kind === 'git') return ui.showText(`HeartCode ${u.latest} is out (this is ${u.current})`, `${notes || '(no changelog found)'}\n\nThis HeartCode runs from a git checkout (${packageDir}): update it there with git pull.`)
1497
1511
  const cmd = UPDATE_COMMANDS[kind]
1498
- ui.showText(`HeartCode ${u.latest} is out (you have ${u.current})`, notes || '(no changelog found)')
1512
+ ui.showText(`HeartCode ${u.latest} is out (this is ${u.current})`, notes || '(no changelog found)')
1499
1513
  if ((await ui.confirm(`Update now with ${c.bold(cmd)}?`, 'command')) !== true) return ui.print(c.dim('not updated'))
1500
1514
  ui.spinner(`running ${cmd}`)
1501
1515
  const r = await runCommand(process.cwd(), cmd, { timeout: 300_000 })
@@ -1520,7 +1534,7 @@ async function slash(app, line, working = false) {
1520
1534
  const was = app.chat.id
1521
1535
  app.setChat(forkChat(app.chat))
1522
1536
  app.save()
1523
- return ui.print(c.dim(`forked: you're in "${app.chat.name}" now; the original (${was}) stays in /resume`))
1537
+ return ui.print(c.dim(`forked: now in "${app.chat.name}"; the original (${was}) stays in /resume`))
1524
1538
  }
1525
1539
  case 'export': {
1526
1540
  if (!app.chat.turns.length) return ui.print('Nothing to export yet.')
@@ -1565,7 +1579,7 @@ async function slash(app, line, working = false) {
1565
1579
  const answer = app.chat.history.at(-1)?.answer?.trim()
1566
1580
  if (!answer) return ui.print('No answer to copy yet.')
1567
1581
  const how = copyText(answer)
1568
- return ui.print(c.dim(`copied the last answer (${answer.split('\n').length} lines)${how === 'osc' ? ' if your terminal allows it' : ''}`))
1582
+ return ui.print(c.dim(`copied the last answer (${answer.split('\n').length} lines)${how === 'osc' ? ' if the terminal allows it' : ''}`))
1569
1583
  }
1570
1584
  case 'background': {
1571
1585
  const jobs = listJobs(app.root)
@@ -1585,7 +1599,7 @@ async function slash(app, line, working = false) {
1585
1599
  }
1586
1600
  case 'context': {
1587
1601
  const s = app.s
1588
- if (!s?.messages?.length) return ui.print('Nothing in the context yet: it fills with your first message.')
1602
+ if (!s?.messages?.length) return ui.print('Nothing in the context yet: it fills with the first message.')
1589
1603
  const r = contextReport(s)
1590
1604
  const share = (n) => (r.window ? `${Math.round((n / r.window) * 100)}%` : '')
1591
1605
  const bar = (n) => c.brand('█'.repeat(r.window ? Math.round((n / r.window) * 40) : 0) || (n ? '▏' : ''))
@@ -1733,7 +1747,7 @@ async function slash(app, line, working = false) {
1733
1747
  const name = cmd.slice(6)
1734
1748
  const k = app.skills.get(name)
1735
1749
  if (k && (k.use === 'me' || k.use === 'both')) return runTask(app, await app.expandSkill(k, args.join(' ')), { signal: app.signal })
1736
- return ui.print(`unknown skill /skill:${name} ${c.dim('· /help lists your skills')}`)
1750
+ return ui.print(`unknown skill /skill:${name} ${c.dim('· /help lists the skills')}`)
1737
1751
  }
1738
1752
  if (app.skills.has(cmd)) return ui.print(`${c.dim(`/${cmd} is a skill — run it as`)} ${c.cyan(`/skill:${cmd}`)}`) // bare skill name: point to the namespaced form
1739
1753
  return ui.print(`unknown command /${cmd} ${c.dim('· /help lists them')}`)
@@ -1801,7 +1815,7 @@ async function repl(app, f = {}) {
1801
1815
  .catch((e) => (log('error', e.stack), ui.print(c.red(`error: ${e.message}`))))
1802
1816
  return true
1803
1817
  }
1804
- ui.onWaiting = (question) => notify(cfg, 'waiting', `⏳ Waiting for you · ${path.basename(app.root)}\n${clip(question.replace(/\x1b\[[0-9;]*m/g, '').replace(/\s*›\s*$/, '').replace(/^\?\s*/, '').trim(), 1000)}`) // a question or a permission while it works (Telegram)
1818
+ ui.onWaiting = (question) => notify(cfg, 'waiting', `⏳ Waiting for an answer · ${path.basename(app.root)}\n${clip(question.replace(/\x1b\[[0-9;]*m/g, '').replace(/\s*›\s*$/, '').replace(/^\?\s*/, '').trim(), 1000)}`) // a question or a permission while it works (Telegram)
1805
1819
  ui.isCommand = (l) => app.isCommand(l)
1806
1820
  loadPrices().then(() => ui.render?.()) // models.dev: what each model can do, for the model lists
1807
1821
  ui.voiceConfig = () => ({ voice: cfg.voice, providers: cfg.providers })
@@ -1892,7 +1906,7 @@ async function repl(app, f = {}) {
1892
1906
  else if (f.resume) await app.resume()
1893
1907
  if (f.model) useModel(app, f.model) // a continued tab's own model
1894
1908
  // models this folder picked earlier (/select_model): said, with the way back to your whole list
1895
- if (app.folderModels && cfg.session?.length) ui.print(`${c.muted('this folder uses')} ${c.cyan(cfg.session.map((t) => t.model).join(', '))} ${c.faint(`(picked earlier) · ${c.cyan('/select_model auto')} for your whole list again`)}`)
1909
+ if (app.folderModels && cfg.session?.length) ui.print(`${c.muted('this folder uses')} ${c.cyan(cfg.session.map((t) => t.model).join(', '))} ${c.faint(`(picked earlier) · ${c.cyan('/select_model auto')} for the whole list again`)}`)
1896
1910
  app.tabs?.onChange?.() // the conversation it opened with
1897
1911
  // a newer HeartCode: asked of npm in the background at every start, said once and kept in the status bar
1898
1912
  if (cfg.updateCheck !== false)
@@ -1900,7 +1914,7 @@ async function repl(app, f = {}) {
1900
1914
  .then((u) => {
1901
1915
  if (!u?.newer) return
1902
1916
  app.update = u
1903
- ui.print(`${c.green('⬆')} ${c.muted('HeartCode')} ${c.green(u.latest)} ${c.muted(`is out (you have ${u.current})`)} ${c.faint('·')} ${c.cyan('/update')}`)
1917
+ ui.print(`${c.green('⬆')} ${c.muted('HeartCode')} ${c.green(u.latest)} ${c.muted(`is out (this is ${u.current})`)} ${c.faint('·')} ${c.cyan('/update')}`)
1904
1918
  ui.render?.()
1905
1919
  })
1906
1920
  .catch(() => {})
@@ -2036,14 +2050,14 @@ async function main() {
2036
2050
  if (!cfg.providers[f.provider]) throw new Error(`no provider "${f.provider}" (heartcode providers lists them)`)
2037
2051
  if (!f.model) {
2038
2052
  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>`)
2053
+ if (!t) throw new Error(`--provider ${f.provider}: no model in the list is from it; add -m <model>`)
2040
2054
  Object.assign(cfg, { ...t, session: [t], pinned: true })
2041
2055
  }
2042
2056
  }
2043
2057
  // --fallback-model: after the model given (as in Claude Code's -p), when it fails
2044
2058
  cfg.fallbacks = (f['fallback-model'] ?? []).map((v) => {
2045
2059
  const t = parseModel(v, cfg.providers, cfg.provider)
2046
- if (isAuto(v) || !cfg.providers[t.provider]) throw new Error(`--fallback-model ${v}: give provider/model, or a model of ${cfg.provider} (heart models lists yours)`)
2060
+ if (isAuto(v) || !cfg.providers[t.provider]) throw new Error(`--fallback-model ${v}: give provider/model, or a model of ${cfg.provider} (heart models lists them)`)
2047
2061
  return t
2048
2062
  })
2049
2063
  if (f.effort) cfg.effort = f.effort === 'default' ? undefined : f.effort
@@ -2060,7 +2074,7 @@ async function main() {
2060
2074
 
2061
2075
  if (sub === 'settings') {
2062
2076
  const { url, local } = await startSettings({ cfg })
2063
- console.log(`${c.brand('♥')} HeartCode settings: ${url}\n${c.dim(`${overSsh ? 'open it in your browser' : 'opened in your browser'} · from another device on this network, open the link above · Ctrl+C to stop`)}`)
2077
+ console.log(`${c.brand('♥')} HeartCode settings: ${url}\n${c.dim(`${overSsh ? 'open it in a browser' : 'opened in the browser'} · from another device on this network, open the link above · Ctrl+C to stop`)}`)
2064
2078
  openBrowser(local)
2065
2079
  return new Promise(() => {}) // until Ctrl+C
2066
2080
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "heartcode",
3
- "version": "0.1.59",
3
+ "version": "0.1.60",
4
4
  "description": "A coding CLI for any local or OpenAI-compatible model, including small models without tool calling.",
5
5
  "keywords": [
6
6
  "ai",