Skip to content

The open-source full-stack studio for Opus 5.5 motion video. Reverse engineering for any video. Code video with HTML: recreate, edit and render. BYOA + BYOK · Motion.md · Images, Video, Music & Voice.

Reject a present null runtime plugin manifest

luogao14d484c38591
diff --git a/scripts/export-adapters.ts b/scripts/export-adapters.ts
index 73cb7de5..5d518b37 100644
--- a/scripts/export-adapters.ts
+++ b/scripts/export-adapters.ts
@@ -35,8 +35,10 @@ export async function exportAdapters(runtimePath: string, dataPath: string, outp
catch (error) { if ((error as NodeJS.ErrnoException).code === 'ENOENT') return false; throw error; }
};
const manifestFile = path.join(runtime, '.codex-plugin/plugin.json');
- const runtimeManifest = await exists(manifestFile) ? JSON.parse(await readFile(manifestFile, 'utf8')) : null;
- assert(runtimeManifest === null || (typeof runtimeManifest === 'object' && !Array.isArray(runtimeManifest)), 'Invalid runtime plugin manifest.');
+ // Presence is tracked separately so only a missing manifest uses the legacy fallback; a present null is invalid.
+ const manifestPresent = await exists(manifestFile);
+ const runtimeManifest = manifestPresent ? JSON.parse(await readFile(manifestFile, 'utf8')) : null;
+ assert(!manifestPresent || (typeof runtimeManifest === 'object' && runtimeManifest !== null && !Array.isArray(runtimeManifest)), 'Invalid runtime plugin manifest.');
const manifestText = (value: unknown, field: string) => {
if (value === undefined) return undefined;
assert(typeof value === 'string' && value.trim().length > 0, `Invalid runtime plugin manifest ${field}; host discovery requires a non-empty string.`);
diff --git a/tests/adapters.test.ts b/tests/adapters.test.ts
index 76d8a43a..a378b7ee 100644
--- a/tests/adapters.test.ts
+++ b/tests/adapters.test.ts
@@ -139,6 +139,7 @@ test('adapter export rejects invalid runtime discovery manifest fields', async (
await mkdir(path.join(runtime, '.codex-plugin'));
const manifestFile = path.join(runtime, '.codex-plugin/plugin.json');
const cases: [unknown, RegExp][] = [
+ [null, /Invalid runtime plugin manifest\./],
[[], /Invalid runtime plugin manifest\./],
[{ description: 42 }, /manifest description/],
[{ description: '' }, /manifest description/],