heartcode 0.1.104 → 0.1.106

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,19 @@
2
2
 
3
3
  What changed in each version of HeartCode, newest first.
4
4
 
5
+ ## 0.1.106 (2026-11-28)
6
+
7
+ - **Updated while it was open? HeartCode says to restart.** A HeartCode keeps running the code it
8
+ started with, so one left open while `npm install -g heartcode` ran in another window still
9
+ behaved like the old version. Now it notices the newer version on disk within a minute and says
10
+ "restart it to use 0.1.x" (also in the status bar).
11
+
12
+ ## 0.1.105 (2026-11-28)
13
+
14
+ - **A newer HeartCode is noticed while HeartCode stays open**: npm is asked at start and then every
15
+ hour, so one left running hears of a version published after it started (said once per version,
16
+ then kept in the status bar). Before, only a restart found it.
17
+
5
18
  ## 0.1.104 (2026-11-28)
6
19
 
7
20
  - **"Runs everything" now really runs everything: it never asks.** Writing the folder's HeartCode or
package/bin/heartcode.js CHANGED
@@ -9,7 +9,7 @@ import { loadRankings, scoreOf } from '../src/rankings.js'
9
9
  import { byRecord, useRecords } from '../src/record.js'
10
10
  import { Session, transcript, contextReport } from '../src/agent.js'
11
11
  import { listJobs, getJob, stopJob, removeJob, runningJobs, tailLines, ago as ranFor } from '../src/background.js'
12
- import { checkUpdate, installKind, UPDATE_COMMANDS, packageDir, whatsNew } from '../src/update.js'
12
+ import { checkUpdate, installedVersion, newer, installKind, UPDATE_COMMANDS, packageDir, whatsNew } from '../src/update.js'
13
13
  import { treeItems, codePlan, move, leaving, leftText, leftFiles } from '../src/tree.js'
14
14
  import { UI, c, PERMISSIONS, duration, copyText, overSsh, prettyKey, rank, setTheme, themeCodes, renderDiff, diffLines, DEFAULT_KEYS, loadKeys, width, shortError, wrapWords, ownAsk } from '../src/ui.js'
15
15
  import { listFiles, runCommand, clip } from '../src/tools.js'
@@ -736,7 +736,7 @@ class App {
736
736
  autocompact: cfg.autoCompact === false ? c.faint('auto-compact off') : null,
737
737
  worktree: this.worktree ? c.info(`⎇ ${this.worktree.branch}`) : null,
738
738
  background: runningJobs(this.root).length ? c.info(`⚙ ${runningJobs(this.root).length} running`) + c.faint(' Alt+B') : null,
739
- update: this.update?.newer ? c.green(`⬆ ${this.update.latest}`) + c.faint(' /update') : null,
739
+ update: this.installed ? c.green(`⬆ ${this.installed}`) + c.faint(' restart to use it') : this.update?.newer ? c.green(`⬆ ${this.update.latest}`) + c.faint(' /update') : null,
740
740
  permissions: { all: c.green('runs everything'), commands: c.yellow('asks before commands'), ask: c.yellow('asks before changes'), plan: c.info('plan mode') }[ui.permission],
741
741
  }
742
742
  if (strat) {
@@ -1971,16 +1971,26 @@ async function repl(app, f = {}) {
1971
1971
  // models this folder picked earlier (/select_model): said, with the way back to your whole list
1972
1972
  if (app.folderModels && cfg.session?.length) ui.notice(`This folder uses ${cfg.session.map((t) => t.model).join(', ')} (picked earlier) · /select_model auto for the whole list again`, 10000) // not a message
1973
1973
  app.tabs?.onChange?.() // the conversation it opened with
1974
- // a newer HeartCode: asked of npm in the background at every start, said once and kept in the status bar
1975
- if (cfg.updateCheck !== false)
1974
+ // a newer HeartCode: asked of npm in the background at every start and every hour after (one left
1975
+ // open for days still hears of it), said once per version and kept in the status bar
1976
+ const askNpm = () =>
1976
1977
  checkUpdate()
1977
1978
  .then((u) => {
1978
- if (!u?.newer) return
1979
+ if (!u?.newer || app.update?.latest === u.latest) return
1979
1980
  app.update = u
1980
1981
  ui.notice(`HeartCode ${u.latest} is out (this is ${u.current}) · /update`, 10000) // and in the status bar
1981
1982
  ui.render?.()
1982
1983
  })
1983
1984
  .catch(() => {})
1985
+ if (cfg.updateCheck !== false) askNpm(), setInterval(askNpm, 3600_000).unref()
1986
+ // updated while this one runs (npm install -g in another window): it still runs the old code, so say so
1987
+ setInterval(() => {
1988
+ const v = installedVersion()
1989
+ if (!v || !newer(v, VERSION) || app.installed === v) return
1990
+ app.installed = v
1991
+ ui.notice(`HeartCode ${v} is installed, but this one still runs ${VERSION} · restart it to use ${v} (/exit, then heart)`, 30000)
1992
+ ui.render?.()
1993
+ }, 60_000).unref()
1984
1994
  // this folder's own setup (a cloned repo's hooks and MCP servers run commands): used once you say so
1985
1995
  if (!trusted(app.root) && ui.permission === 'all') trust(app.root), reloadPrompts() // runs everything: used without asking
1986
1996
  else if (!trusted(app.root)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "heartcode",
3
- "version": "0.1.104",
3
+ "version": "0.1.106",
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",
package/src/update.js CHANGED
@@ -31,6 +31,16 @@ export async function checkUpdate() {
31
31
  return { current: VERSION, latest, newer: Boolean(latest) && newer(latest, VERSION) }
32
32
  }
33
33
 
34
+ // The version installed on disk now: newer than VERSION when HeartCode was updated while this one
35
+ // runs (it keeps the code it started with until it's restarted)
36
+ export function installedVersion() {
37
+ try {
38
+ return JSON.parse(fs.readFileSync(path.join(PKG, 'package.json'), 'utf8')).version
39
+ } catch {
40
+ return null
41
+ }
42
+ }
43
+
34
44
  // How HeartCode was installed: 'git' (a checkout, linked), or the package manager that put it there.
35
45
  export function installKind() {
36
46
  if (fs.existsSync(path.join(PKG, '.git')) || !PKG.split(path.sep).includes('node_modules')) return 'git'