Updates
This commit is contained in:
@@ -16,9 +16,18 @@ export const QVAC_MASTER = Object.freeze({
|
||||
gpuLayers: 99,
|
||||
});
|
||||
|
||||
export function assertSdkVersion() {
|
||||
const sdkPackage = require(path.join(harnessPath, 'node_modules/@qvac/sdk/package.json'));
|
||||
if (!/^0\.19\./.test(sdkPackage.version)) {
|
||||
throw new Error(`Jarvis requires vendored @qvac/sdk in the 0.19.x series; found ${sdkPackage.version}`);
|
||||
}
|
||||
return sdkPackage.version;
|
||||
}
|
||||
|
||||
export async function acquireQvac() {
|
||||
ownerCount += 1;
|
||||
if (!loadPromise) {
|
||||
assertSdkVersion();
|
||||
const resources = await Agent.engine.resources();
|
||||
const gpuVisible = (resources.gpus?.length || 0) > 0 ||
|
||||
Boolean(resources.drivers?.vulkan || resources.drivers?.cuda || resources.drivers?.opencl || resources.gpu);
|
||||
@@ -54,6 +63,28 @@ export async function closeQvac() {
|
||||
await Agent.engine.close();
|
||||
}
|
||||
|
||||
export async function cancelQvac() {
|
||||
await Agent.engine.cancel();
|
||||
}
|
||||
|
||||
export async function suspendQvac() {
|
||||
const sdk = await Agent.engine.ensureInit();
|
||||
if (typeof sdk.suspend !== 'function') throw new Error('QVAC runtime does not expose suspend()');
|
||||
await sdk.suspend();
|
||||
}
|
||||
|
||||
export async function resumeQvac() {
|
||||
const sdk = await Agent.engine.ensureInit();
|
||||
if (typeof sdk.resume !== 'function') throw new Error('QVAC runtime does not expose resume()');
|
||||
await sdk.resume();
|
||||
}
|
||||
|
||||
export async function qvacRuntimeState() {
|
||||
const sdk = await Agent.engine.ensureInit();
|
||||
if (typeof sdk.state !== 'function') return 'unknown';
|
||||
return sdk.state();
|
||||
}
|
||||
|
||||
export function qvacStatus() {
|
||||
return { ...QVAC_MASTER, owners: ownerCount, loaded: Agent.engine.getLoaded() };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user