mirror of
http://192.168.0.88:13333/lywsvip/openclaw-zero-token.git
synced 2026-05-08 08:08:33 +08:00
Major upgrade from e26988a38 to upstream v2026.3.28 (f9b107928).
Key changes:
- Upstream src/, ui/, extensions/ (89 bundled extensions)
- Zero-token web providers preserved in src/zero-token/
- AskOnce plugin restored and registered as CLI command
- Added missing packages: @anthropic-ai/vertex-sdk, @modelcontextprotocol/sdk
- Fixed tsconfig rootDir, skipLibCheck for plugin-sdk DTS build
- Added askonce to bundled plugin metadata and package.json exports
- Fixed AskOnce CLI command registration (missing commands metadata)
- Restored AskOnce adapter imports (correct 5-level relative paths)
- Removed stale migration artifacts from root directory
86 lines
2.3 KiB
TypeScript
86 lines
2.3 KiB
TypeScript
import fs from "node:fs";
|
|
import path from "node:path";
|
|
import { GENERATED_BUNDLED_PLUGIN_METADATA } from "./bundled-plugin-metadata.generated.js";
|
|
import type { PluginManifest, OpenClawPackageManifest } from "./manifest.js";
|
|
|
|
const PUBLIC_SURFACE_SOURCE_EXTENSIONS = [".ts", ".mts", ".js", ".mjs", ".cts", ".cjs"] as const;
|
|
|
|
type GeneratedBundledPluginPathPair = {
|
|
source: string;
|
|
built: string;
|
|
};
|
|
|
|
export type GeneratedBundledPluginMetadata = {
|
|
dirName: string;
|
|
idHint: string;
|
|
source: GeneratedBundledPluginPathPair;
|
|
setupSource?: GeneratedBundledPluginPathPair;
|
|
publicSurfaceArtifacts?: readonly string[];
|
|
runtimeSidecarArtifacts?: readonly string[];
|
|
packageName?: string;
|
|
packageVersion?: string;
|
|
packageDescription?: string;
|
|
packageManifest?: OpenClawPackageManifest;
|
|
manifest: PluginManifest;
|
|
};
|
|
|
|
export const BUNDLED_PLUGIN_METADATA =
|
|
GENERATED_BUNDLED_PLUGIN_METADATA as unknown as readonly GeneratedBundledPluginMetadata[];
|
|
|
|
export function resolveBundledPluginGeneratedPath(
|
|
rootDir: string,
|
|
entry: GeneratedBundledPluginPathPair | undefined,
|
|
): string | null {
|
|
if (!entry) {
|
|
return null;
|
|
}
|
|
const candidates = [entry.built, entry.source]
|
|
.filter(
|
|
(candidate): candidate is string => typeof candidate === "string" && candidate.length > 0,
|
|
)
|
|
.map((candidate) => path.resolve(rootDir, candidate));
|
|
for (const candidate of candidates) {
|
|
if (fs.existsSync(candidate)) {
|
|
return candidate;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
export function resolveBundledPluginPublicSurfacePath(params: {
|
|
rootDir: string;
|
|
dirName: string;
|
|
artifactBasename: string;
|
|
}): string | null {
|
|
const artifactBasename = params.artifactBasename.replace(/^\.\//u, "");
|
|
if (!artifactBasename) {
|
|
return null;
|
|
}
|
|
|
|
const builtCandidate = path.resolve(
|
|
params.rootDir,
|
|
"dist",
|
|
"extensions",
|
|
params.dirName,
|
|
artifactBasename,
|
|
);
|
|
if (fs.existsSync(builtCandidate)) {
|
|
return builtCandidate;
|
|
}
|
|
|
|
const sourceBaseName = artifactBasename.replace(/\.js$/u, "");
|
|
for (const ext of PUBLIC_SURFACE_SOURCE_EXTENSIONS) {
|
|
const sourceCandidate = path.resolve(
|
|
params.rootDir,
|
|
"extensions",
|
|
params.dirName,
|
|
`${sourceBaseName}${ext}`,
|
|
);
|
|
if (fs.existsSync(sourceCandidate)) {
|
|
return sourceCandidate;
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|