pinokiod 8.2.26 → 8.2.27
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/kernel/anywhere/index.js +12 -0
- package/package.json +1 -1
- package/test/anywhere-api.test.js +5 -1
- package/test/anywhere.test.js +31 -0
package/kernel/anywhere/index.js
CHANGED
|
@@ -671,9 +671,21 @@ class Anywhere {
|
|
|
671
671
|
await this.loadConfig()
|
|
672
672
|
const installed = await this.installed()
|
|
673
673
|
const enabled = !!this.config.enabled
|
|
674
|
+
const info = this.kernel.sysinfo || {}
|
|
674
675
|
const base = {
|
|
675
676
|
installed,
|
|
676
677
|
enabled,
|
|
678
|
+
// Display metadata only; the existing Tailscale identity/address stays intact.
|
|
679
|
+
machineName: os.hostname(),
|
|
680
|
+
system: {
|
|
681
|
+
platform: this.platform,
|
|
682
|
+
arch: this.kernel.arch || os.arch(),
|
|
683
|
+
os: info.osInfo?.distro,
|
|
684
|
+
cpu: info.cpu?.brand,
|
|
685
|
+
gpu: info.gpu_model,
|
|
686
|
+
ram: info.ram,
|
|
687
|
+
vram: info.vram,
|
|
688
|
+
},
|
|
677
689
|
error: this.error,
|
|
678
690
|
serveError: this.lastServeError,
|
|
679
691
|
}
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@ const readyAnywhere = () => {
|
|
|
13
13
|
anywhere.config = { enabled: true }
|
|
14
14
|
anywhere.lastStatus = { Self: { DNSName: 'pinokio.tail1.ts.net.' } }
|
|
15
15
|
anywhere.lastServe = buildServeConfig({ dnsName: 'pinokio.tail1.ts.net', targets: [{ listen: 43000, target: 7860 }] })
|
|
16
|
-
anywhere.snapshot = async () => ({ phase: 'ready', dnsName: 'pinokio.tail1.ts.net', serve: describeServeConfig(anywhere.lastServe) })
|
|
16
|
+
anywhere.snapshot = async () => ({ phase: 'ready', machineName: 'OS-HOST', system: { platform: 'linux', arch: 'x64', cpu: 'Test CPU', gpu: 'Test GPU', ram: 64, vram: 24 }, dnsName: 'pinokio.tail1.ts.net', serve: describeServeConfig(anywhere.lastServe) })
|
|
17
17
|
return anywhere
|
|
18
18
|
}
|
|
19
19
|
|
|
@@ -36,10 +36,14 @@ test('status carries app ids and complete remote addresses, and no installed cou
|
|
|
36
36
|
]) {
|
|
37
37
|
readyUrl = url
|
|
38
38
|
const status = await Server.prototype.composeAnywhereStatus.call(fake, {})
|
|
39
|
+
assert.equal(status.machineName, 'OS-HOST')
|
|
40
|
+
assert.equal(status.system.gpu, 'Test GPU')
|
|
39
41
|
assert.equal(status.installed, undefined)
|
|
40
42
|
assert.deepEqual(status.apps.map((a) => [a.id, a.state, a.remote]), [['comfy', 'ready', expected], ['forge', 'starting', null], ['unrouted', 'publishing', null]])
|
|
41
43
|
}
|
|
42
44
|
const light = await Server.prototype.composeAnywhereStatus.call(fake, { light: true })
|
|
45
|
+
assert.equal(light.machineName, 'OS-HOST')
|
|
46
|
+
assert.equal(light.system.ram, 64)
|
|
43
47
|
assert.equal(light.apps, undefined, 'the light status is unchanged')
|
|
44
48
|
})
|
|
45
49
|
|
package/test/anywhere.test.js
CHANGED
|
@@ -14,6 +14,37 @@ const { spawn } = require('node:child_process')
|
|
|
14
14
|
const { once, EventEmitter } = require('node:events')
|
|
15
15
|
const Setup = require('../kernel/bin/setup')
|
|
16
16
|
|
|
17
|
+
test('status reports os.hostname and cached system specs on every platform without spawning commands', async () => {
|
|
18
|
+
const source = fs.readFileSync(require.resolve('../kernel/anywhere'), 'utf8')
|
|
19
|
+
const baseRequire = require('node:module').createRequire(require.resolve('../kernel/anywhere'))
|
|
20
|
+
for (const platform of ['darwin', 'win32', 'linux']) {
|
|
21
|
+
const context = { module: { exports: {} }, process, console, require(name) {
|
|
22
|
+
if (name === 'os') return { hostname: () => 'OS-HOST', arch: () => 'x64' }
|
|
23
|
+
if (name === 'child_process') return { execFile() { assert.fail('metadata must not spawn commands') } }
|
|
24
|
+
return baseRequire(name)
|
|
25
|
+
} }
|
|
26
|
+
vm.runInNewContext(source, context)
|
|
27
|
+
const kernel = { platform, sysinfo: {
|
|
28
|
+
osInfo: { distro: 'Test OS' }, cpu: { brand: 'Test CPU' },
|
|
29
|
+
gpu_model: 'Test GPU', ram: 64, vram: 24,
|
|
30
|
+
} }
|
|
31
|
+
const anywhere = new context.module.exports(kernel)
|
|
32
|
+
anywhere.loadConfig = async () => { anywhere.config = { enabled: false, hostname: 'pinokio' } }
|
|
33
|
+
for (const installed of [false, true]) {
|
|
34
|
+
anywhere.installed = async () => installed
|
|
35
|
+
const status = await anywhere.snapshot()
|
|
36
|
+
assert.equal(status.machineName, 'OS-HOST')
|
|
37
|
+
assert.deepEqual(JSON.parse(JSON.stringify(status.system)), {
|
|
38
|
+
platform, arch: 'x64', os: 'Test OS', cpu: 'Test CPU', gpu: 'Test GPU', ram: 64, vram: 24,
|
|
39
|
+
})
|
|
40
|
+
assert.equal(status.phase, installed ? 'off' : 'setup')
|
|
41
|
+
assert.equal(anywhere.config.hostname, 'pinokio')
|
|
42
|
+
}
|
|
43
|
+
delete kernel.sysinfo
|
|
44
|
+
assert.deepEqual(JSON.parse(JSON.stringify((await anywhere.snapshot()).system)), { platform, arch: 'x64' }, 'startup before system info is ready')
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
|
|
17
48
|
test('serve config maps pinokiod to 443 and each app to its stable remote port', () => {
|
|
18
49
|
const config = buildServeConfig({
|
|
19
50
|
dnsName: 'pinokio.tail1234.ts.net.',
|