Run daemon on packaged Bare runtime
This commit is contained in:
@@ -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}`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user