mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-23 22:55:24 +00:00
refactor(plugins): harden package boundary sdk prep
This commit is contained in:
@@ -18,22 +18,6 @@ export const EXTENSION_PACKAGE_BOUNDARY_BASE_PATHS = {
|
||||
"openclaw/extension-api": ["../src/extensionAPI.ts"],
|
||||
"openclaw/plugin-sdk": ["../dist/plugin-sdk/index.d.ts"],
|
||||
"openclaw/plugin-sdk/*": ["../dist/plugin-sdk/*.d.ts"],
|
||||
"openclaw/plugin-sdk/account-id": ["../dist/plugin-sdk/account-id.d.ts"],
|
||||
"openclaw/plugin-sdk/channel-entry-contract": [
|
||||
"../packages/plugin-sdk/dist/src/plugin-sdk/channel-entry-contract.d.ts",
|
||||
],
|
||||
"openclaw/plugin-sdk/browser-maintenance": [
|
||||
"../packages/plugin-sdk/dist/extensions/browser/browser-maintenance.d.ts",
|
||||
],
|
||||
"openclaw/plugin-sdk/provider-catalog-shared": [
|
||||
"../packages/plugin-sdk/dist/src/plugin-sdk/provider-catalog-shared.d.ts",
|
||||
],
|
||||
"openclaw/plugin-sdk/provider-entry": [
|
||||
"../packages/plugin-sdk/dist/src/plugin-sdk/provider-entry.d.ts",
|
||||
],
|
||||
"openclaw/plugin-sdk/secret-ref-runtime": [
|
||||
"../dist/plugin-sdk/src/plugin-sdk/secret-ref-runtime.d.ts",
|
||||
],
|
||||
"@openclaw/*.js": ["../packages/plugin-sdk/dist/extensions/*.d.ts", "../extensions/*"],
|
||||
"@openclaw/*": ["../packages/plugin-sdk/dist/extensions/*", "../extensions/*"],
|
||||
"@openclaw/plugin-sdk/*": ["../dist/plugin-sdk/*.d.ts"],
|
||||
|
||||
@@ -205,6 +205,7 @@
|
||||
"provider-entry",
|
||||
"provider-env-vars",
|
||||
"provider-http",
|
||||
"provider-model-types",
|
||||
"provider-model-shared",
|
||||
"volc-model-catalog-shared",
|
||||
"provider-onboard",
|
||||
|
||||
35
scripts/prepare-extension-package-boundary-artifacts.mjs
Normal file
35
scripts/prepare-extension-package-boundary-artifacts.mjs
Normal file
@@ -0,0 +1,35 @@
|
||||
import { spawnSync } from "node:child_process";
|
||||
import { createRequire } from "node:module";
|
||||
import { resolve } from "node:path";
|
||||
|
||||
const require = createRequire(import.meta.url);
|
||||
const repoRoot = resolve(import.meta.dirname, "..");
|
||||
const tscBin = require.resolve("typescript/bin/tsc");
|
||||
|
||||
function runNodeStep(label, args, timeoutMs) {
|
||||
const result = spawnSync(process.execPath, args, {
|
||||
cwd: repoRoot,
|
||||
encoding: "utf8",
|
||||
maxBuffer: 16 * 1024 * 1024,
|
||||
timeout: timeoutMs,
|
||||
});
|
||||
|
||||
if (result.status === 0 && !result.error) {
|
||||
return;
|
||||
}
|
||||
|
||||
const timeoutSuffix =
|
||||
result.error?.name === "Error" && result.error.message.includes("ETIMEDOUT")
|
||||
? `\n${label} timed out after ${timeoutMs}ms`
|
||||
: "";
|
||||
const errorSuffix = result.error ? `\n${result.error.message}` : "";
|
||||
process.stderr.write(`${label}\n${result.stdout}${result.stderr}${timeoutSuffix}${errorSuffix}`);
|
||||
process.exit(result.status ?? 1);
|
||||
}
|
||||
|
||||
runNodeStep("plugin-sdk boundary dts", [tscBin, "-p", "tsconfig.plugin-sdk.dts.json"], 300_000);
|
||||
runNodeStep(
|
||||
"plugin-sdk boundary root shims",
|
||||
["--import", "tsx", resolve(repoRoot, "scripts/write-plugin-sdk-entry-dts.ts")],
|
||||
120_000,
|
||||
);
|
||||
Reference in New Issue
Block a user