@rhizogrip/spore-cli 1.4.2 → 1.5.1
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/tui/conversation.js +8 -0
- package/tui/index.js +4 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rhizogrip/spore-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.1",
|
|
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.5.1",
|
|
54
54
|
"chalk": "^6.0.1",
|
|
55
55
|
"minimist": "^1.2.8"
|
|
56
56
|
},
|
package/tui/conversation.js
CHANGED
|
@@ -45,6 +45,14 @@ export function history ({ turns, inbox }) {
|
|
|
45
45
|
|
|
46
46
|
export const createLive = () => ({ text: '', notes: [], tools: [], rounds: 0, input: null, cost: 0, complete: null })
|
|
47
47
|
|
|
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
|
+
export function liveOf (events) {
|
|
50
|
+
if (!events.length) return null
|
|
51
|
+
const live = createLive()
|
|
52
|
+
for (const event of events) applyEvent(live, event)
|
|
53
|
+
return live
|
|
54
|
+
}
|
|
55
|
+
|
|
48
56
|
/** False when the event changes nothing shown. Text written before a tool call is a note: the answer is what comes last. */
|
|
49
57
|
export function applyEvent (live, event) {
|
|
50
58
|
switch (event.event) {
|
package/tui/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import chalk from 'chalk'
|
|
|
9
9
|
|
|
10
10
|
import { runningJob, scheduleLine } from '../src/dispatch.js'
|
|
11
11
|
import { COMMANDS, parseCommand } from './commands.js'
|
|
12
|
-
import { applyEvent, createLive, history } from './conversation.js'
|
|
12
|
+
import { applyEvent, createLive, history, liveOf } from './conversation.js'
|
|
13
13
|
import { changeOf, counts, hunks } from './diff.js'
|
|
14
14
|
import { printable } from './printable.js'
|
|
15
15
|
import { PromptEditor } from './prompt.js'
|
|
@@ -320,12 +320,9 @@ export async function runTui ({ ws, commands = [], renderTool = null, greeting =
|
|
|
320
320
|
state.limits = null
|
|
321
321
|
if (stateOf(state.ws).state === RUNNING) {
|
|
322
322
|
const ends = readEvents(state.ws, { event: 'turn_end' })
|
|
323
|
-
const
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
state.lastSeq = event.seq
|
|
327
|
-
}
|
|
328
|
-
conversation.live = live
|
|
323
|
+
const events = readEvents(state.ws, { after: ends.at(-1)?.seq ?? 0 })
|
|
324
|
+
if (events.length) state.lastSeq = events.at(-1).seq
|
|
325
|
+
conversation.live = liveOf(events)
|
|
329
326
|
}
|
|
330
327
|
conversation.invalidate()
|
|
331
328
|
refresh()
|