heartcode 0.1.0 → 0.1.3
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/README.md +4 -16
- package/SKILL.md +24 -10
- package/bin/heart.js +2 -1
- package/bin/heartcode.js +25 -3
- package/package.json +1 -1
- package/prompts/agent.md +54 -4
- package/prompts/guided.md +1 -0
- package/src/agent.js +115 -21
- package/src/client.js +96 -12
- package/src/config.js +4 -0
- package/src/guided.js +13 -2
- package/src/headless.js +27 -11
- package/src/log.js +37 -3
- package/src/mcp.js +49 -3
- package/src/prompts.js +2 -1
- package/src/settings.html +144 -32
- package/src/settings.js +31 -1
- package/src/tools.js +126 -15
- package/src/ui.js +4 -3
- package/src/usage.js +16 -1
package/src/ui.js
CHANGED
|
@@ -376,6 +376,7 @@ export class UI {
|
|
|
376
376
|
this.out = output
|
|
377
377
|
this.queue = []
|
|
378
378
|
this.ahead = [] // messages typed (and sent with Enter) while HeartCode was working
|
|
379
|
+
this.isCommand = (l) => l.startsWith('/') // the app's: only real commands (a path like /Users/… is a message)
|
|
379
380
|
this.keys = { ...DEFAULT_KEYS, ...loadKeys() }
|
|
380
381
|
this.waiters = []
|
|
381
382
|
this.closed = false
|
|
@@ -736,7 +737,7 @@ export class UI {
|
|
|
736
737
|
if (/^\/btw\b/.test(line) && this.onBtw) this.onBtw(line.replace(/^\/btw\b/, '').trim()) // answered now, beside the task
|
|
737
738
|
else if (line) {
|
|
738
739
|
this.ahead.push(line)
|
|
739
|
-
this.print(`${c.faint(' ↳')} ${c.muted(line.split('\n')[0])} ${c.faint(
|
|
740
|
+
this.print(`${c.faint(' ↳')} ${c.muted(line.split('\n')[0])} ${c.faint(this.isCommand(line) ? '(runs when this is done)' : '(goes to the model at its next step, or runs next)')}`)
|
|
740
741
|
}
|
|
741
742
|
return this.render()
|
|
742
743
|
}
|
|
@@ -841,8 +842,8 @@ export class UI {
|
|
|
841
842
|
|
|
842
843
|
// Messages typed while working that can go to the running task now (not commands); taken.
|
|
843
844
|
takeAhead() {
|
|
844
|
-
const out = this.ahead.filter((l) => !
|
|
845
|
-
this.ahead = this.ahead.filter((l) =>
|
|
845
|
+
const out = this.ahead.filter((l) => !this.isCommand(l))
|
|
846
|
+
this.ahead = this.ahead.filter((l) => this.isCommand(l))
|
|
846
847
|
return out
|
|
847
848
|
}
|
|
848
849
|
|
package/src/usage.js
CHANGED
|
@@ -88,6 +88,20 @@ function indexOf(t) {
|
|
|
88
88
|
return index
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
// A "…-latest" name models.dev doesn't list: the newest dated version it does list
|
|
92
|
+
// (magistral-small-latest → magistral-small-2509), its entries at every provider. [] if none.
|
|
93
|
+
function newestOf(name) {
|
|
94
|
+
const base = /^(.+?)[-_.:]?latest$/i.exec(name)?.[1]
|
|
95
|
+
if (!base) return []
|
|
96
|
+
const re = new RegExp(`^[a-z]{0,12}${norm(base)}(\\d{4,8})$`) // a date or version after the name: 2509, 20250929; a vendor before it (mistral.magistral-small-2509)
|
|
97
|
+
let best = null
|
|
98
|
+
for (const [k, list] of indexOf(table)) {
|
|
99
|
+
const d = re.exec(k)?.[1]
|
|
100
|
+
if (d && (!best || Number(d) > Number(best.d))) best = { d, list }
|
|
101
|
+
}
|
|
102
|
+
return best ? [...best.list].sort((a, b) => a.n - b.n) : []
|
|
103
|
+
}
|
|
104
|
+
|
|
91
105
|
// What models.dev says of a model: { context, output (tokens), tools, thinking, images }, or null. Found by its name
|
|
92
106
|
// however it's written (google/gemini-2.5-flash, models/gemini-2.5-flash, gpt-oss:120b ≈
|
|
93
107
|
// gpt-oss-120b): at this provider first; else, among all that list it, the size most say (a
|
|
@@ -98,7 +112,8 @@ export function limitsOf(provider, baseUrl, model) {
|
|
|
98
112
|
const want = new Set([model, model.replace(/^models\//, ''), last(model), last(model).replace(/:(free|beta|extended|nitro|floor|online|cloud)$/, '').replace(/-cloud$/, '')].map(norm))
|
|
99
113
|
const own = ownBy(provider, baseUrl)
|
|
100
114
|
const found = { own: [], all: [] }
|
|
101
|
-
|
|
115
|
+
let hits = [...new Set([...want].flatMap((w) => indexOf(table).get(w) ?? []))].sort((a, b) => a.n - b.n)
|
|
116
|
+
if (!hits.length) hits = newestOf(last(model)) // "magistral-small-latest" by its dated names only
|
|
102
117
|
for (const { entry, info } of hits) {
|
|
103
118
|
const it = { ...info.limit, ...(info.can ?? { tools: true, thinking: false, images: false }) }
|
|
104
119
|
found.all.push(it)
|