@rhizogrip/spore-cli 1.62.0 → 1.62.2
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/bin/spore.js +2 -2
- package/package.json +2 -2
- package/src/dispatch.js +7 -5
- package/tui/conversation.js +1 -3
- package/tui/index.js +1 -2
- package/tui/links.js +1 -3
- package/tui/printable.js +0 -13
package/bin/spore.js
CHANGED
|
@@ -19,7 +19,7 @@ import { host } from '../src/vm.js'
|
|
|
19
19
|
|
|
20
20
|
await host(process.argv.slice(2))
|
|
21
21
|
|
|
22
|
-
const { differingDocs, fork, follow, followingDocs, grantOf, isWorkspace, lastEventSeq, loadEnvironment, mimeOf, readConfig, readInbox, RUNNING, send, stateOf, stop, turnOfMessage, turnSummary, watch, workspaceFor, errorText } = await import('@rhizogrip/spore')
|
|
22
|
+
const { differingDocs, fork, follow, followingDocs, grantOf, isWorkspace, lastEventSeq, loadEnvironment, mimeOf, printable, readConfig, readInbox, RUNNING, send, stateOf, stop, turnOfMessage, turnSummary, watch, workspaceFor, errorText } = await import('@rhizogrip/spore')
|
|
23
23
|
const { renderHeader } = await import('../src/dispatch.js')
|
|
24
24
|
const { SERVICES } = await import('../src/services.js')
|
|
25
25
|
|
|
@@ -462,7 +462,7 @@ if (argv.json) {
|
|
|
462
462
|
|
|
463
463
|
if (settled) {
|
|
464
464
|
const found = answeredBy(ws, sent.inbox)
|
|
465
|
-
if (found?.read && found.turn.output != null) process.stdout.write(found.turn.output + '\n')
|
|
465
|
+
if (found?.read && found.turn.output != null) process.stdout.write((process.stdout.isTTY ? printable(found.turn.output) : found.turn.output) + '\n')
|
|
466
466
|
process.stderr.write(`spore: already sent under ${requestId} — ${found?.read ? `turn ${found.turn.turnNo} answered it` : 'no turn read it'}\n`)
|
|
467
467
|
process.exit(exitOf(found?.read ? found.turn : null))
|
|
468
468
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rhizogrip/spore-cli",
|
|
3
|
-
"version": "1.62.
|
|
3
|
+
"version": "1.62.2",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Christophe Le Bars",
|
|
6
6
|
"email": "clb@toort.net"
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"minimist": "^1.2.8"
|
|
55
55
|
},
|
|
56
56
|
"optionalDependencies": {
|
|
57
|
-
"@rhizogrip/spore": "1.62.
|
|
57
|
+
"@rhizogrip/spore": "1.62.2"
|
|
58
58
|
},
|
|
59
59
|
"license": "Apache-2.0"
|
|
60
60
|
}
|
package/src/dispatch.js
CHANGED
|
@@ -13,7 +13,7 @@ import { readFileSync } from 'node:fs'
|
|
|
13
13
|
import { homedir } from 'node:os'
|
|
14
14
|
import { basename, join, resolve } from 'node:path'
|
|
15
15
|
|
|
16
|
-
import { addTo, allowPlugin, annotate, billingFor, bytesText, changeText, define, defaultModel, disallowPlugin, durationText, edit, extend, flush, getKey, interactionOutcome, jobs, list, listApprovals, listPlugins, log, pause, remake, remove, removeFrom, removeSchedule, requestApproval, runningLines, schedules, setDefaultModel, setKey, setSchedule, settings, show, showPlugin, sql, stateWord, stopJob, switchModel, tick, tickReport, unmetered, unpause, upgrade, usage, wrap, CONFIG_FILE, DEFAULT_SPORANGIUM, errorText } from '@rhizogrip/spore'
|
|
16
|
+
import { addTo, allowPlugin, annotate, billingFor, bytesText, changeText, define, defaultModel, disallowPlugin, durationText, edit, extend, flush, getKey, interactionOutcome, jobs, list, listApprovals, listPlugins, log, pause, printable, remake, remove, removeFrom, removeSchedule, requestApproval, runningLines, schedules, setDefaultModel, setKey, setSchedule, settings, show, showPlugin, sql, stateWord, stopJob, switchModel, tick, tickReport, unmetered, unpause, upgrade, usage, wrap, CONFIG_FILE, DEFAULT_SPORANGIUM, errorText } from '@rhizogrip/spore'
|
|
17
17
|
import { diagnose, hostReport, renderDoctor, renderReport } from './doctor.js'
|
|
18
18
|
import { hook } from './hooks.js'
|
|
19
19
|
import { withMoHint } from './mo.js'
|
|
@@ -22,6 +22,8 @@ import { saidBy, saidText } from '../tui/conversation.js'
|
|
|
22
22
|
|
|
23
23
|
const STATE_WIDTH = 9
|
|
24
24
|
|
|
25
|
+
const say = (line) => console.log(process.stdout.isTTY ? printable(line) : line)
|
|
26
|
+
|
|
25
27
|
const tilde = (path) => (path === homedir() || path.startsWith(homedir() + '/') ? `~${path.slice(homedir().length)}` : path)
|
|
26
28
|
|
|
27
29
|
const line = (row, under) => {
|
|
@@ -334,14 +336,14 @@ function renderLog (result) {
|
|
|
334
336
|
]
|
|
335
337
|
const order = (at) => at ?? '\uffff'
|
|
336
338
|
timeline.sort((a, b) => order(a.at) < order(b.at) ? -1 : order(a.at) > order(b.at) ? 1 : 0)
|
|
337
|
-
for (const { line } of timeline)
|
|
339
|
+
for (const { line } of timeline) say(line)
|
|
338
340
|
// The time column is when a turn ended, and a waiting message has not been answered by
|
|
339
341
|
// one. Blank says that; when it was said is in the record for anyone who needs it.
|
|
340
342
|
for (const entry of result.setAside) {
|
|
341
|
-
|
|
343
|
+
say(` ${' '.repeat(19)} ${'set aside'.padEnd(12)} ${' '.repeat(19)} ${quoted([entry])}`)
|
|
342
344
|
}
|
|
343
345
|
for (const entry of result.waiting) {
|
|
344
|
-
|
|
346
|
+
say(` ${' '.repeat(19)} ${'waiting'.padEnd(12)} ${' '.repeat(19)} ${quoted([entry])}`)
|
|
345
347
|
}
|
|
346
348
|
for (const one of result.held) {
|
|
347
349
|
console.log(` ${' '.repeat(19)} ${one.state.padEnd(12)} ${' '.repeat(19)} schedule ${one.name} — ${one.why}`)
|
|
@@ -668,7 +670,7 @@ export async function manage (verb, argv) {
|
|
|
668
670
|
return 2
|
|
669
671
|
}
|
|
670
672
|
const { lines } = sql({ ws: name, query: query || undefined, json: Boolean(argv.json) })
|
|
671
|
-
for (const line of lines)
|
|
673
|
+
for (const line of lines) say(line)
|
|
672
674
|
return 0
|
|
673
675
|
}
|
|
674
676
|
if (verb === 'tick') return emit(tick(), renderTick, (result) => tickReport(result).exit)
|
package/tui/conversation.js
CHANGED
package/tui/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { tmpdir } from 'node:os'
|
|
|
4
4
|
import { basename, dirname, join } from 'node:path'
|
|
5
5
|
|
|
6
6
|
import { CombinedAutocompleteProvider, Input, isKeyRelease, Markdown, matchesKey, ProcessTerminal, ScrollView, SelectList, truncateToWidth, TuiAltScreen, visibleWidth, VStack, wrapTextWithAnsi } from '@earendil-works/pi-tui'
|
|
7
|
-
import { applyEvent, changeText, createLive, curate, durationText, errorText, extendTurn, flush, grantOf, list, liveIn, loadMohdelEnvironment, outbox, pause, paused, readInbox, readTurns, RUNNING, send, SERVICE_STATE_DIR, show, sporePaths, stateOf, stop, switchModel, unpause, upstream, watchAll, wrapTurn } from '@rhizogrip/spore'
|
|
7
|
+
import { applyEvent, changeText, createLive, curate, durationText, errorText, extendTurn, flush, grantOf, list, liveIn, loadMohdelEnvironment, outbox, pause, paused, printable, readInbox, readTurns, RUNNING, send, SERVICE_STATE_DIR, show, sporePaths, stateOf, stop, switchModel, unpause, upstream, watchAll, wrapTurn } from '@rhizogrip/spore'
|
|
8
8
|
import chalk from 'chalk'
|
|
9
9
|
|
|
10
10
|
import { runningJob, scheduleLine } from '../src/dispatch.js'
|
|
@@ -13,7 +13,6 @@ import { COMMANDS, parseCommand } from './commands.js'
|
|
|
13
13
|
import { history, markOf } from './conversation.js'
|
|
14
14
|
import { changeOf, counts, hunks } from './diff.js'
|
|
15
15
|
import { copyNumber, deliveredLine, fenceLabel, fileOf } from './links.js'
|
|
16
|
-
import { printable } from './printable.js'
|
|
17
16
|
import { PromptEditor } from './prompt.js'
|
|
18
17
|
import { Answer } from './answer.js'
|
|
19
18
|
import { matching, priceText, sporeLabel, statusParts } from './status.js'
|
package/tui/links.js
CHANGED
|
@@ -7,11 +7,9 @@
|
|
|
7
7
|
import { fileURLToPath, pathToFileURL } from 'node:url'
|
|
8
8
|
|
|
9
9
|
import { getCapabilities, hyperlink } from '@earendil-works/pi-tui'
|
|
10
|
-
import { bytesText } from '@rhizogrip/spore'
|
|
10
|
+
import { bytesText, printable } from '@rhizogrip/spore'
|
|
11
11
|
import chalk from 'chalk'
|
|
12
12
|
|
|
13
|
-
import { printable } from './printable.js'
|
|
14
|
-
|
|
15
13
|
const LABEL = /^(.*) · \/copy (\d+)$/
|
|
16
14
|
const SCHEME = 'spore-copy:'
|
|
17
15
|
|
package/tui/printable.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Text from a model or a tool, made safe to put on a terminal: no escape or control byte that
|
|
3
|
-
* the terminal would act on (a cursor move, a screen clear, an OSC 52 clipboard write), and no
|
|
4
|
-
* bidirectional override that would show it in another order than it reads. Newlines stay,
|
|
5
|
-
* since an answer is prose; a tab becomes spaces.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
// C0 controls but newline and tab, DEL, the C1 block, and the bidi embeddings, overrides and
|
|
9
|
-
// isolates.
|
|
10
|
-
// eslint-disable-next-line no-control-regex
|
|
11
|
-
const UNPRINTABLE = /[\x00-\x08\x0b-\x1f\x7f-\x9f--]/g
|
|
12
|
-
|
|
13
|
-
export const printable = (text) => String(text).replace(/\t/g, ' ').replace(UNPRINTABLE, '')
|