@rhizogrip/spore-cli 1.7.1 → 1.8.0
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/package.json +2 -2
- package/src/dispatch.js +9 -1
- package/tui/conversation.js +6 -2
- package/tui/status.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rhizogrip/spore-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Christophe Le Bars",
|
|
6
6
|
"email": "clb@toort.net"
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"tui": "node bin/spore.js tui"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@rhizogrip/spore": "1.
|
|
53
|
+
"@rhizogrip/spore": "1.8.0",
|
|
54
54
|
"chalk": "^6.0.1",
|
|
55
55
|
"minimist": "^1.2.8"
|
|
56
56
|
},
|
package/src/dispatch.js
CHANGED
|
@@ -42,7 +42,8 @@ const line = (row, under) => {
|
|
|
42
42
|
const where = under && row.ws.startsWith(under) ? row.ws.slice(under.length + 1) || '.' : row.ws
|
|
43
43
|
const spend = row.treeUsd ? `$${row.treeUsd.toFixed(4)}` : ''
|
|
44
44
|
const works = row.definitionError ? ' (its spore.cmk does not parse)' : row.writes.map(path => ` → ${tilde(path)}`).join('')
|
|
45
|
-
|
|
45
|
+
const over = row.historyOver ? ' (history over its bound)' : ''
|
|
46
|
+
return ` ${stateWord(row).padEnd(STATE_WIDTH)} ${String(row.lastTurnNo).padStart(4)} turns ${spend.padStart(9)} ${size(row.bytes).padStart(8)} ${where}${works}${over}`
|
|
46
47
|
}
|
|
47
48
|
|
|
48
49
|
const block = (title, rows, under) => {
|
|
@@ -171,6 +172,7 @@ function renderShow (result) {
|
|
|
171
172
|
for (const [i, job] of result.jobs.running.entries()) line(i ? '' : 'jobs', runningJob(job))
|
|
172
173
|
}
|
|
173
174
|
line('turns', `${result.lastTurnNo}${result.last?.stopReason ? ` last ${result.last.stopReason}` : ''}${result.endedAt ? ` ${result.endedAt}` : ''}`)
|
|
175
|
+
if (result.history) line('history', historyLine(result.history))
|
|
174
176
|
line('spend', unmetered(result.billing) ? `not metered · ${result.billing.label}` : `$${result.treeUsd.toFixed(6)}`)
|
|
175
177
|
line('work', `${result.workUnits} units (${result.workUnitsOwn} own rounds, ${result.workUnitsChildren} in cells)`)
|
|
176
178
|
if (result.produced.length) {
|
|
@@ -519,6 +521,12 @@ const EIGHTHS = ' ▏▎▍▌▋▊▉'
|
|
|
519
521
|
|
|
520
522
|
const dollars = (micros) => `$${(micros / 1e6).toFixed(4)}`
|
|
521
523
|
const count = (n) => (n >= 1e6 ? `${(n / 1e6).toFixed(1)}M` : n >= 1e3 ? `${Math.round(n / 1e3)}k` : String(n))
|
|
524
|
+
|
|
525
|
+
function historyLine (history) {
|
|
526
|
+
const cache = history.cacheShare === null ? '' : ` · cache ${Math.round(history.cacheShare * 100)}% over ${plural(history.rounds ?? 0, 'round')}`
|
|
527
|
+
const over = history.over ? ' — OVER ITS BOUND, it was not summarized' : ''
|
|
528
|
+
return `${count(history.sent)} / ${count(history.bound)} at turn ${history.turnNo}${cache}${over}`
|
|
529
|
+
}
|
|
522
530
|
const plural = (n, one) => `${n} ${one}${n === 1 ? '' : 's'}`
|
|
523
531
|
|
|
524
532
|
const bar = (micros, most) => {
|
package/tui/conversation.js
CHANGED
|
@@ -43,7 +43,7 @@ export function history ({ turns, inbox }) {
|
|
|
43
43
|
return items
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
export const createLive = () => ({ text: '', notes: [], tools: [], rounds: 0, input: null, cost: 0, complete: null })
|
|
46
|
+
export const createLive = () => ({ text: '', notes: [], tools: [], rounds: 0, input: null, cached: 0, cost: 0, complete: null })
|
|
47
47
|
|
|
48
48
|
/** The running turn from its events so far, or null when there are none: a turn's end is recorded before its lock is let go. */
|
|
49
49
|
export function liveOf (events) {
|
|
@@ -75,7 +75,8 @@ export function applyEvent (live, event) {
|
|
|
75
75
|
return true
|
|
76
76
|
}
|
|
77
77
|
case 'usage':
|
|
78
|
-
live.input = event.input
|
|
78
|
+
live.input = event.input + event.cacheRead + event.cacheWrite
|
|
79
|
+
live.cached = event.cacheRead
|
|
79
80
|
live.cost += event.cost
|
|
80
81
|
return true
|
|
81
82
|
case 'interject':
|
|
@@ -87,6 +88,9 @@ export function applyEvent (live, event) {
|
|
|
87
88
|
case 'compaction':
|
|
88
89
|
live.notes.push({ kind: 'note', text: 'earlier turns summarized' })
|
|
89
90
|
return true
|
|
91
|
+
case 'compaction_failed':
|
|
92
|
+
live.notes.push({ kind: 'note', text: `earlier turns are over their bound and were not summarized — ${event.why}` })
|
|
93
|
+
return true
|
|
90
94
|
case 'complete':
|
|
91
95
|
live.complete = { stopReason: event.stopReason ?? 'answer', output: event.output == null ? null : printable(event.output) }
|
|
92
96
|
if (live.complete.output) live.text = live.complete.output
|
package/tui/status.js
CHANGED
|
@@ -42,7 +42,7 @@ export function statusParts ({ shown, live, attention, now }) {
|
|
|
42
42
|
if (attention.length) parts.push(`${attentionText(attention)} — Ctrl+P`)
|
|
43
43
|
const limited = Boolean(shown.turnLimits) && !shown.draining
|
|
44
44
|
if (limited) parts.push(limitsText(shown.turnLimits, { rounds: live.rounds, cost: unmetered(shown) ? null : live.cost, now }))
|
|
45
|
-
if (live.input !== null) parts.push(`${thousands(live.input)} in`)
|
|
45
|
+
if (live.input !== null) parts.push(`${thousands(live.input)} in${live.cached ? ` (${thousands(live.cached)} cached)` : ''}`)
|
|
46
46
|
if (!limited || unmetered(shown)) parts.push(spendText(shown))
|
|
47
47
|
parts.push(shown.model)
|
|
48
48
|
return parts
|