Run daemon on packaged Bare runtime
Rolling release / release (push) Canceled after 14m9s
CI / verify (push) Canceled after 14m18s

This commit is contained in:
2026-09-11 15:52:53 -04:00
parent 562f1a6316
commit a3314db1e9
30 changed files with 2953 additions and 65 deletions
+7
View File
@@ -0,0 +1,7 @@
// Bare entrypoint. Keep compatibility globals in this process, then load the
// daemon only after the mapping has been installed. This keeps Node out of the
// installed runtime while allowing the copied CommonJS harness to keep its
// upstream package shape.
await import('bare-node-runtime/global');
const { startDaemon } = await import('./index.js');
await startDaemon();
+5 -1
View File
@@ -3,7 +3,11 @@ const OBJECT = '/io/qvac/Jarvis';
const BUS_NAME = 'io.qvac.Jarvis';
export async function serveOnSessionBus(daemon) {
const dbus = await import('dbus-next');
// dbus-next is CommonJS. Load it through Bare's Node compatibility map so
// its builtin imports use bare-* implementations where supported.
const { createRequire } = await import('node:module');
const require = createRequire(import.meta.url);
const dbus = require('dbus-next', { with: { imports: 'bare-node-runtime/imports' } });
const { Interface } = dbus.interface;
class Session extends Interface {
constructor() { super(IFACE); }
+2 -1
View File
@@ -75,7 +75,7 @@ export class JarvisDaemon extends EventEmitter {
async close() { clearInterval(this._idleTimer); clearInterval(this._telemetryTimer); this.computerRevoke(); this.recovery.save({ state: 'ARMED', mode: this.mode }); await this.voiceLoop?.stop?.(); await this.harness.close(); }
}
if (import.meta.url === `file://${process.argv[1]}`) {
export async function startDaemon() {
const daemon = new JarvisDaemon();
daemon.startVoice().catch((error) => console.error(`jarvisd: voice unavailable: ${error.message}`));
import('./dbus-service.js').then(({ serveOnSessionBus }) => serveOnSessionBus(daemon)).catch((error) => {
@@ -84,4 +84,5 @@ if (import.meta.url === `file://${process.argv[1]}`) {
});
process.on('SIGINT', () => daemon.close().finally(() => process.exit(0)));
console.log('jarvisd ready; QVAC inference remains GPU-gated');
return daemon;
}
+467 -1
View File
@@ -2,5 +2,471 @@
"name": "@jarvis-qvac/daemon",
"private": true,
"type": "module",
"main": "index.js"
"main": "index.js",
"imports": {
"assert": {
"bare": "bare-assert",
"default": "assert"
},
"node:assert": {
"bare": "bare-assert",
"default": "assert"
},
"assert/strict": {
"bare": "bare-assert/strict",
"default": "assert/strict"
},
"node:assert/strict": {
"bare": "bare-assert/strict",
"default": "assert/strict"
},
"async_hooks": {
"bare": "bare-async-hooks",
"default": "async_hooks"
},
"node:async_hooks": {
"bare": "bare-async-hooks",
"default": "async_hooks"
},
"buffer": {
"bare": "bare-buffer",
"default": "buffer"
},
"node:buffer": {
"bare": "bare-buffer",
"default": "buffer"
},
"child_process": {
"bare": "bare-subprocess",
"default": "child_process"
},
"node:child_process": {
"bare": "bare-subprocess",
"default": "child_process"
},
"cluster": {
"bare": "bare-node-runtime/unsupported",
"default": "cluster"
},
"node:cluster": {
"bare": "bare-node-runtime/unsupported",
"default": "cluster"
},
"console": {
"bare": "bare-console",
"default": "console"
},
"node:console": {
"bare": "bare-console",
"default": "console"
},
"constants": {
"bare": "bare-node-runtime/unsupported",
"default": "constants"
},
"node:constants": {
"bare": "bare-node-runtime/unsupported",
"default": "constants"
},
"crypto": {
"bare": "bare-crypto",
"default": "crypto"
},
"node:crypto": {
"bare": "bare-crypto",
"default": "crypto"
},
"dgram": {
"bare": "bare-dgram",
"default": "dgram"
},
"node:dgram": {
"bare": "bare-dgram",
"default": "dgram"
},
"diagnostics_channel": {
"bare": "bare-diagnostics-channel",
"default": "diagnostics_channel"
},
"node:diagnostics_channel": {
"bare": "bare-diagnostics-channel",
"default": "diagnostics_channel"
},
"dns": {
"bare": "bare-dns",
"default": "dns"
},
"node:dns": {
"bare": "bare-dns",
"default": "dns"
},
"dns/promises": {
"bare": "bare-dns/promises",
"default": "dns/promises"
},
"node:dns/promises": {
"bare": "bare-dns/promises",
"default": "dns/promises"
},
"domain": {
"bare": "bare-node-runtime/unsupported",
"default": "domain"
},
"node:domain": {
"bare": "bare-node-runtime/unsupported",
"default": "domain"
},
"events": {
"bare": "bare-events",
"default": "events"
},
"node:events": {
"bare": "bare-events",
"default": "events"
},
"fs": {
"bare": "bare-fs",
"default": "fs"
},
"node:fs": {
"bare": "bare-fs",
"default": "fs"
},
"fs/promises": {
"bare": "bare-fs/promises",
"default": "fs/promises"
},
"node:fs/promises": {
"bare": "bare-fs/promises",
"default": "fs/promises"
},
"http": {
"bare": "bare-http1",
"default": "http"
},
"node:http": {
"bare": "bare-http1",
"default": "http"
},
"http2": {
"bare": "bare-node-runtime/unsupported",
"default": "http2"
},
"node:http2": {
"bare": "bare-node-runtime/unsupported",
"default": "http2"
},
"https": {
"bare": "bare-https",
"default": "https"
},
"node:https": {
"bare": "bare-https",
"default": "https"
},
"inspector": {
"bare": "bare-inspector",
"default": "inspector"
},
"node:inspector": {
"bare": "bare-inspector",
"default": "inspector"
},
"inspector/promises": {
"bare": "bare-inspector/promises",
"default": "inspector/promises"
},
"node:inspector/promises": {
"bare": "bare-inspector/promises",
"default": "inspector/promises"
},
"module": {
"bare": "bare-module",
"default": "module"
},
"node:module": {
"bare": "bare-module",
"default": "module"
},
"net": {
"bare": "bare-net",
"default": "net"
},
"node:net": {
"bare": "bare-net",
"default": "net"
},
"os": {
"bare": "bare-os",
"default": "os"
},
"node:os": {
"bare": "bare-os",
"default": "os"
},
"path": {
"bare": "bare-path",
"default": "path"
},
"node:path": {
"bare": "bare-path",
"default": "path"
},
"path/posix": {
"bare": "bare-path/posix",
"default": "path/posix"
},
"node:path/posix": {
"bare": "bare-path/posix",
"default": "path/posix"
},
"path/win32": {
"bare": "bare-path/win32",
"default": "path/win32"
},
"node:path/win32": {
"bare": "bare-path/win32",
"default": "path/win32"
},
"perf_hooks": {
"bare": "bare-performance",
"default": "perf_hooks"
},
"node:perf_hooks": {
"bare": "bare-performance",
"default": "perf_hooks"
},
"process": {
"bare": "bare-process",
"default": "process"
},
"node:process": {
"bare": "bare-process",
"default": "process"
},
"punycode": {
"bare": "bare-punycode",
"default": "punycode"
},
"node:punycode": {
"bare": "bare-punycode",
"default": "punycode"
},
"querystring": {
"bare": "bare-querystring",
"default": "querystring"
},
"node:querystring": {
"bare": "bare-querystring",
"default": "querystring"
},
"readline": {
"bare": "bare-readline",
"default": "readline"
},
"node:readline": {
"bare": "bare-readline",
"default": "readline"
},
"readline/promises": {
"bare": "bare-readline/promises",
"default": "readline/promises"
},
"node:readline/promises": {
"bare": "bare-readline/promises",
"default": "readline/promises"
},
"repl": {
"bare": "bare-repl",
"default": "repl"
},
"node:repl": {
"bare": "bare-repl",
"default": "repl"
},
"sea": {
"bare": "bare-node-runtime/unsupported",
"default": "sea"
},
"node:sea": {
"bare": "bare-node-runtime/unsupported",
"default": "sea"
},
"sqlite": {
"bare": "bare-sqlite",
"default": "sqlite"
},
"node:sqlite": {
"bare": "bare-sqlite",
"default": "sqlite"
},
"stream": {
"bare": "bare-stream",
"default": "stream"
},
"node:stream": {
"bare": "bare-stream",
"default": "stream"
},
"stream/consumers": {
"bare": "bare-stream/consumers",
"default": "stream/consumers"
},
"node:stream/consumers": {
"bare": "bare-stream/consumers",
"default": "stream/consumers"
},
"stream/promises": {
"bare": "bare-stream/promises",
"default": "stream/promises"
},
"node:stream/promises": {
"bare": "bare-stream/promises",
"default": "stream/promises"
},
"stream/web": {
"bare": "bare-stream/web",
"default": "stream/web"
},
"node:stream/web": {
"bare": "bare-stream/web",
"default": "stream/web"
},
"string_decoder": {
"bare": "bare-string-decoder",
"default": "string_decoder"
},
"node:string_decoder": {
"bare": "bare-string-decoder",
"default": "string_decoder"
},
"sys": {
"bare": "bare-node-runtime/unsupported",
"default": "sys"
},
"node:sys": {
"bare": "bare-node-runtime/unsupported",
"default": "sys"
},
"test": {
"bare": "bare-node-runtime/unsupported",
"default": "test"
},
"node:test": {
"bare": "bare-node-runtime/unsupported",
"default": "test"
},
"test/reporters": {
"bare": "bare-node-runtime/unsupported",
"default": "test/reporters"
},
"node:test/reporters": {
"bare": "bare-node-runtime/unsupported",
"default": "test/reporters"
},
"timers": {
"bare": "bare-timers",
"default": "timers"
},
"node:timers": {
"bare": "bare-timers",
"default": "timers"
},
"timers/promises": {
"bare": "bare-timers/promises",
"default": "timers/promises"
},
"node:timers/promises": {
"bare": "bare-timers/promises",
"default": "timers/promises"
},
"tls": {
"bare": "bare-tls",
"default": "tls"
},
"node:tls": {
"bare": "bare-tls",
"default": "tls"
},
"trace_events": {
"bare": "bare-node-runtime/unsupported",
"default": "trace_events"
},
"node:trace_events": {
"bare": "bare-node-runtime/unsupported",
"default": "trace_events"
},
"tty": {
"bare": "bare-tty",
"default": "tty"
},
"node:tty": {
"bare": "bare-tty",
"default": "tty"
},
"url": {
"bare": "bare-url",
"default": "url"
},
"node:url": {
"bare": "bare-url",
"default": "url"
},
"util": {
"bare": "bare-utils",
"default": "util"
},
"node:util": {
"bare": "bare-utils",
"default": "util"
},
"util/types": {
"bare": "bare-utils/types",
"default": "util/types"
},
"node:util/types": {
"bare": "bare-utils/types",
"default": "util/types"
},
"v8": {
"bare": "bare-v8",
"default": "v8"
},
"node:v8": {
"bare": "bare-v8",
"default": "v8"
},
"vm": {
"bare": "bare-vm",
"default": "vm"
},
"node:vm": {
"bare": "bare-vm",
"default": "vm"
},
"wasi": {
"bare": "bare-node-runtime/unsupported",
"default": "wasi"
},
"node:wasi": {
"bare": "bare-node-runtime/unsupported",
"default": "wasi"
},
"worker_threads": {
"bare": "bare-worker",
"default": "worker_threads"
},
"node:worker_threads": {
"bare": "bare-worker",
"default": "worker_threads"
},
"zlib": {
"bare": "bare-zlib",
"default": "zlib"
},
"node:zlib": {
"bare": "bare-zlib",
"default": "zlib"
}
}
}
+5 -2
View File
@@ -3,9 +3,12 @@ import fs from 'node:fs';
import path from 'node:path';
const harnessPath = process.env.JARVIS_HARNESS_PATH || path.resolve(new URL('../vendor/agent-harness', import.meta.url).pathname);
// Bare's module loader accepts the maintained Holepunch compatibility map. The
// second argument is essential for the copied CommonJS harness: it maps its
// Node builtin requests to bare-* modules without creating a second runtime.
const require = createRequire(import.meta.url);
process.env.QVAC_CONFIG_PATH ||= path.resolve(new URL('../qvac.config.json', import.meta.url).pathname);
const Agent = require(path.join(harnessPath, 'index.js'));
const Agent = require(path.join(harnessPath, 'index.js'), { with: { imports: 'bare-node-runtime/imports' } });
let loadPromise = null;
let ownerCount = 0;
@@ -33,7 +36,7 @@ export function sdkPackagePath() {
}
export function assertSdkVersion() {
const sdkPackage = require(sdkPackagePath());
const sdkPackage = require(sdkPackagePath(), { with: { imports: 'bare-node-runtime/imports' } });
if (!/^0\.19\./.test(sdkPackage.version)) {
throw new Error(`Jarvis requires vendored @qvac/sdk in the 0.19.x series; found ${sdkPackage.version}`);
}
+3
View File
@@ -0,0 +1,3 @@
await import('bare-node-runtime/global');
const { qvacStatus } = await import('./qvac-master.js');
console.log(JSON.stringify(qvacStatus(), null, 2));
+10 -4
View File
@@ -1,13 +1,19 @@
import { spawnSync } from 'node:child_process';
import { access } from 'node:fs/promises';
const commandAvailable = (command) => spawnSync('which', [command], { stdio: 'ignore' }).status === 0;
const commandAvailable = async (command) => {
for (const dir of ['/usr/bin', '/usr/local/bin', '/bin']) {
try { await access(`${dir}/${command}`); return true; } catch {}
}
return false;
};
const pipewire = await commandAvailable('pw-cat');
const report = {
pipewireCapture: commandAvailable('pw-cat'),
pipewireCapture: pipewire,
wakeEngine: Boolean(process.env.JARVIS_WAKE_COMMAND),
wakeCommand: process.env.JARVIS_WAKE_COMMAND || null,
sampleRate: 16000,
channels: 1,
ttsPlayback: commandAvailable('pw-cat'),
ttsPlayback: pipewire,
gpuRequired: true,
};
console.log(JSON.stringify(report, null, 2));