@rhizogrip/spore-cli 1.8.0 → 1.9.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rhizogrip/spore-cli",
3
- "version": "1.8.0",
3
+ "version": "1.9.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.8.0",
53
+ "@rhizogrip/spore": "1.9.0",
54
54
  "chalk": "^6.0.1",
55
55
  "minimist": "^1.2.8"
56
56
  },
package/tui/README.md CHANGED
@@ -22,6 +22,10 @@ ctrl+d leave, on an empty line
22
22
  //text a message that starts with /
23
23
  ```
24
24
 
25
+ A tool call's line starts with `✓` when it worked, with the exit code (`1`) when a command ran
26
+ to its end and exited non-zero — which may be its answer, `grep` finding nothing — and with `✗`
27
+ and how when the call failed: `✗ idle`, `✗ deadline`, `✗ SIGKILL`, `✗ refused`.
28
+
25
29
  The line you type on names the spore and its state at its right. The status line under it gives
26
30
  the running turn's limits, the spend and the model. When another spore answers or asks, the
27
31
  status line says so and the terminal gets a notification
@@ -71,7 +71,15 @@ export function applyEvent (live, event) {
71
71
  case 'tool_end': {
72
72
  const tool = live.tools.find(t => t.callId === event.callId)
73
73
  if (!tool) return false
74
- Object.assign(tool, { done: true, durationMs: event.durationMs, error: Boolean(event.error) })
74
+ Object.assign(tool, {
75
+ done: true,
76
+ durationMs: event.durationMs,
77
+ error: Boolean(event.error),
78
+ outcome: event.outcome,
79
+ exit: event.exit,
80
+ killed: event.killed,
81
+ signal: event.signal
82
+ })
75
83
  return true
76
84
  }
77
85
  case 'usage':
@@ -85,6 +93,9 @@ export function applyEvent (live, event) {
85
93
  case 'wrap':
86
94
  live.notes.push({ kind: 'note', text: `wrapping up — reached its ${event.dimension} limit` })
87
95
  return true
96
+ case 'compaction_started':
97
+ live.notes.push({ kind: 'note', text: `summarizing ${event.messages} earlier messages before the first round…` })
98
+ return true
88
99
  case 'compaction':
89
100
  live.notes.push({ kind: 'note', text: 'earlier turns summarized' })
90
101
  return true
@@ -99,3 +110,15 @@ export function applyEvent (live, event) {
99
110
  return false
100
111
  }
101
112
  }
113
+
114
+ /**
115
+ * What a call's line starts with: whether it worked, the exit code of a command that ran to its
116
+ * end and said no, or how it failed. A tool_end a runtime before outcomes recorded has only `error`.
117
+ */
118
+ export function markOf (tool) {
119
+ if (!tool.done) return { text: '…', tone: 'running' }
120
+ if (tool.outcome === undefined) return tool.error ? { text: '✗', tone: 'failed' } : { text: '✓', tone: 'ok' }
121
+ if (tool.outcome === 'ok') return { text: '✓', tone: 'ok' }
122
+ if (tool.outcome === 'exit') return { text: String(tool.exit), tone: 'exit' }
123
+ return { text: `✗ ${tool.killed ?? tool.signal ?? tool.outcome}`, tone: 'failed' }
124
+ }
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, liveOf } from './conversation.js'
12
+ import { applyEvent, createLive, history, liveOf, markOf } 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'
@@ -17,6 +17,7 @@ import { Answer } from './answer.js'
17
17
  import { matching, priceText, sporeLabel, statusParts } from './status.js'
18
18
 
19
19
  const REFRESH_MS = 1000
20
+ const MARK_TONE = { running: chalk.yellow, ok: chalk.green, exit: chalk.yellow, failed: chalk.red }
20
21
  const TWICE_MS = 1500
21
22
  const NOTICE_MS = 4000
22
23
  const LONG_TURN_MS = 60_000
@@ -80,7 +81,8 @@ function changeLines (tool, change, { expanded, width, mark, time }) {
80
81
  }
81
82
 
82
83
  function toolLine (tool, { expanded, width }) {
83
- const mark = !tool.done ? chalk.yellow('…') : tool.error ? chalk.red('✗') : chalk.green('✓')
84
+ const { text, tone } = markOf(tool)
85
+ const mark = MARK_TONE[tone](text)
84
86
  const time = tool.done ? dim(` ${durationText(tool.durationMs)}`) : ''
85
87
  const change = changeOf(tool)
86
88
  if (change) return changeLines(tool, change, { expanded, width, mark, time })