@rhizogrip/spore-cli 1.32.0 → 1.34.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 +1 -0
- package/src/hooks.js +6 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rhizogrip/spore-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.34.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.34.0",
|
|
54
54
|
"chalk": "^6.0.1",
|
|
55
55
|
"minimist": "^1.2.8"
|
|
56
56
|
},
|
package/src/dispatch.js
CHANGED
|
@@ -477,6 +477,7 @@ function renderPlugin (result) {
|
|
|
477
477
|
line(i ? '' : 'settings', `${key} (${kind})${result.configured?.[key] === undefined ? '' : ` = ${result.configured[key]}`}`)
|
|
478
478
|
}
|
|
479
479
|
for (const [i, [name, path]] of Object.entries(result.programs).entries()) line(i ? '' : 'programs', `${name} → ${path}`)
|
|
480
|
+
for (const [i, [name, path]] of Object.entries(result.routes).entries()) line(i ? '' : 'routes', `${name} → ${path}, an owner's router (hooks.json)`)
|
|
480
481
|
for (const [i, [name, value]] of Object.entries(result.env).entries()) line(i ? '' : 'env', `${name}=${value}`)
|
|
481
482
|
if (result.contain) line('contain', result.contain.keep ? `${result.contain.keep}, and nothing else of ${result.contain.hide}` : `nothing of ${result.contain.hide}`)
|
|
482
483
|
if (result.modules.length) line('modules', `${result.modules.join(', ')} → node_modules/, for the agent's programs`)
|
package/src/hooks.js
CHANGED
|
@@ -8,7 +8,7 @@ const UNAVAILABLE = new Set(['SERVICE_NO_SYSTEMD', 'SERVICE_NOT_DEFINED'])
|
|
|
8
8
|
|
|
9
9
|
const kb = (bytes) => bytes >= 1024 * 1024 ? `${(bytes / 1024 / 1024).toFixed(1)}MB` : `${Math.round(bytes / 1024)}KB`
|
|
10
10
|
|
|
11
|
-
const verifyText = ({ method, header }) => header ? `${method} on ${header}` : method
|
|
11
|
+
const verifyText = ({ method, header }) => method === 'api' ? 'a caller of the HTTP API, by its token' : header ? `${method} on ${header}` : method
|
|
12
12
|
|
|
13
13
|
const acceptText = (accept) => [
|
|
14
14
|
accept.header ? `${accept.header} in ${accept.values.join(', ')}` : null,
|
|
@@ -47,10 +47,14 @@ function renderHook (hook) {
|
|
|
47
47
|
console.log(` verify ${verifyText(hook.verify)}`)
|
|
48
48
|
if (hook.accept) console.log(` accepts ${acceptText(hook.accept)}`)
|
|
49
49
|
console.log(` bounds ${kb(hook.maxBytes)} a request · ${hook.perHour} turns an hour · ${hook.maxWait ? `waits up to ${durationText(hook.maxWait)} · ${hook.perDay} triage cells a day` : 'released at once'}`)
|
|
50
|
+
if (hook.owner) {
|
|
51
|
+
const { plugin, name, timeoutMs, attach, reads } = hook.owner
|
|
52
|
+
console.log(` router ${plugin}/${name}, the owner's: attaches up to ${attach.files} files and ${kb(attach.bytes)} within ${durationText(timeoutMs)}${reads.length ? `, reading ${reads.join(', ')}` : ''}`)
|
|
53
|
+
}
|
|
50
54
|
for (const spore of hook.spores) {
|
|
51
55
|
console.log(`\n${sporeLine(spore, spore.name.length)}`)
|
|
52
56
|
if (!spore.ws) continue
|
|
53
|
-
if (spore.router) console.log(` router ${spore.router}`)
|
|
57
|
+
if (spore.router) console.log(` router ${spore.router}${hook.owner ? ', not run: the owner\'s router is' : ''}`)
|
|
54
58
|
if (spore.triage) console.log(` triage ${spore.triage}`)
|
|
55
59
|
for (const held of spore.held) console.log(` held since ${held.at}, released ${held.releaseAt}, at the latest ${held.deadline}${held.summary ? ` — ${held.summary}` : ''}`)
|
|
56
60
|
for (const d of spore.deliveries) {
|