Skip to content

Commit 8686115

Browse files
thymikeeclaude
andcommitted
fix(capabilities): narrow the Revyl plugin setup result instead of casting it
Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 0d0a6d6 commit 8686115

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

‎scripts/capability-matrix/collect.ts‎

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -290,13 +290,12 @@ async function revylSupport(
290290
apiUrl: 'https://revyl.invalid.test',
291291
});
292292
if (!plugin.setup) throw new Error('The Revyl plugin exposes no setup().');
293-
const created = (await plugin.setup({ env: {}, clientVersion: '0.0.0' } as never)) as {
294-
runtime: ProviderDeviceRuntime;
295-
platformModule: { loadRuntime(host: PlatformRuntimeHost): Promise<PlatformRuntimeOwner> };
296-
};
297-
const owner = await created.platformModule.loadRuntime(host);
293+
const created = await plugin.setup({ env: {}, clientVersion: '0.0.0' } as never);
294+
if (!('runtime' in created)) throw new Error('The Revyl plugin built no device runtime.');
295+
const runtime = created.runtime as unknown as ProviderDeviceRuntime;
296+
const owner = (await created.platformModule.loadRuntime(host as never)) as PlatformRuntimeOwner;
298297
const leaseId = `lease-${target.platform}`;
299-
await created.runtime.leaseLifecycle?.allocate?.(
298+
await runtime.leaseLifecycle?.allocate?.(
300299
{
301300
leaseId,
302301
leaseProvider: 'revyl',
@@ -306,14 +305,14 @@ async function revylSupport(
306305
} as never,
307306
{ flags: {} } as never,
308307
);
309-
const devices = await created.runtime.deviceInventoryProvider?.({
308+
const devices = await runtime.deviceInventoryProvider?.({
310309
leaseProvider: 'revyl',
311310
leaseId,
312311
} as never);
313312
const device = devices?.[0];
314313
if (!device) throw new Error('Revyl invented no device for its lease.');
315314
const facts = targetFacts(await owner.inspectFacts(device), commands);
316-
await created.runtime.shutdown?.();
315+
await runtime.shutdown?.();
317316
return facts;
318317
} finally {
319318
globalThis.fetch = previousFetch;

0 commit comments

Comments
 (0)