mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-21 16:27:18 +02:00
Add the external Runner foundation with distinct Dot/Grok V6, canonical home-mode V7 and Muse V8 contracts. Keep generated schemas and profiles synchronized. Bound default question-answer command IDs in a disjoint namespace while preserving existing IDs and durable replay. Preserve canonical migration history and add normally generated, replay-safe Muse schema milestones with literal preview-history fixtures. Refs #16444. Co-Authored-By: Paperclip <noreply@paperclip.ing>
24 lines
1.1 KiB
JavaScript
24 lines
1.1 KiB
JavaScript
import { readFile, realpath } from "node:fs/promises";
|
|
import { resolve } from "node:path";
|
|
|
|
/** Seed every installed runtime root before traversing its dependency graph. */
|
|
export async function collectRunnerRuntimeDependencyRoots(runnerRoot) {
|
|
const manifest = JSON.parse(await readFile(resolve(runnerRoot, "package.json"), "utf8"));
|
|
const required = manifest.dependencies ?? {};
|
|
const optional = manifest.optionalDependencies ?? {};
|
|
const roots = [];
|
|
for (const dependencyName of Object.keys({ ...required, ...optional }).sort()) {
|
|
let packageRoot;
|
|
try {
|
|
packageRoot = await realpath(resolve(runnerRoot, "node_modules", dependencyName));
|
|
} catch (error) {
|
|
// Platform-filtered optional packages may be absent. Malformed installed
|
|
// roots and required dependencies must still fail the distribution check.
|
|
if (!Object.hasOwn(required, dependencyName) && Object.hasOwn(optional, dependencyName) && error?.code === "ENOENT") continue;
|
|
throw error;
|
|
}
|
|
roots.push({ dependencyName, packageRoot });
|
|
}
|
|
return roots;
|
|
}
|