// Generated by scripts/generate-runtime-script-assets.mjs; do not edit. import path from "node:path"; import { fileURLToPath, pathToFileURL } from "node:url"; const dependencyDirectoryEntrypoints = { npm: "npm-cli.js", npx: "npx-cli.js" }; const externalEntrypoints = { sourceCli: "src/entry.ts", sourceUiBuild: "scripts/ui.js", sourcePluginMetadata: "scripts/copy-bundled-plugin-metadata.mjs", sourceRunner: "scripts/run-node.mjs", cliLauncher: "openclaw.mjs", gatewayIndex: "dist/index.js", gatewayIndexModule: "dist/index.mjs", gatewayEntry: "dist/entry.js", gatewayEntryModule: "dist/entry.mjs", preinstall: "scripts/preinstall-package-manager-warning.mjs", postinstall: "scripts/postinstall-bundled-plugins.mjs", fsSafePrebuild: "scripts/lib/fs-safe-prebuild.mjs", }; const toolingEntrypoints = { kyselyTypes: "scripts/generate-kysely-types.mts", npmPackageLock: "scripts/generate-npm-package-lock.worker.mts", testSelectorSourceScan: "scripts/lib/test-selector-source-facts.worker.mts", }; const distRoot = resolveRuntimeProcessDistRoot(fileURLToPath(import.meta.url)); /** @param {string} currentPath */ export function resolveRuntimeProcessDistRoot(currentPath) { const normalized = currentPath.replaceAll(path.sep, "/"); const marker = "/dist/"; const index = normalized.lastIndexOf(marker); return index >= 0 ? currentPath.slice(0, index + marker.length) : undefined; } /** @param {string} modulePath */ function resolveRootEntrypointUrl(modulePath) { return distRoot === undefined ? new URL(modulePath, import.meta.url) : pathToFileURL(path.resolve(distRoot, "..", modulePath)); } /** @param {keyof typeof externalEntrypoints} name */ export function resolveRuntimeBootstrapExternalEntrypointUrl(name) { return resolveRootEntrypointUrl(externalEntrypoints[name]); } /** @param {keyof typeof toolingEntrypoints} name */ export function resolveRuntimeBootstrapToolingEntrypointUrl(name) { return resolveRootEntrypointUrl(toolingEntrypoints[name]); } /** * Resolve a selected dependency entry without substituting the host package tree. * @param {keyof typeof dependencyDirectoryEntrypoints} name * @param {string} directory */ export function resolveRuntimeDependencyEntrypointUrlFromDirectory(name, directory) { return pathToFileURL(path.join(directory, dependencyDirectoryEntrypoints[name])); }