Skip to content

Commit c727388

Browse files
authored
fix(plugins): localize bundled runtime deps to extensions (#67099)
* fix(plugins): localize bundled runtime deps to extensions * fix(plugins): move staged runtime deps out of root * fix(packaging): harden prepack and runtime dep staging * fix(packaging): preserve optional runtime dep staging * Update CHANGELOG.md * fix(packaging): harden runtime staging filesystem writes * fix(docker): ship preinstall warning in bootstrap layers * fix(packaging): exclude staged plugin node_modules from npm pack
1 parent a780151 commit c727388

29 files changed

Lines changed: 1332 additions & 274 deletions

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Docs: https://docs.openclaw.ai
1010
- Agents/local models: add experimental `agents.defaults.experimental.localModelLean: true` to drop heavyweight default tools like `browser`, `cron`, and `message`, reducing prompt size for weaker local-model setups without changing the normal path. Thanks @ImLukeF.
1111
- QA/Matrix: split Matrix live QA into a source-linked `qa-matrix` runner and keep repo-private `qa-*` surfaces out of packaged and published builds. (#66723) Thanks @gumadeiras.
1212
- Control UI/Overview: add a Model Auth status card showing OAuth token health and provider rate-limit pressure at a glance, with attention callouts when OAuth tokens are expiring or expired. Backed by a new `models.authStatus` gateway method that strips credentials and caches for 60s. (#66211) Thanks @omarshahine.
13+
- Packaging/plugins: localize bundled plugin runtime deps to their owning extensions, trim the published docs payload, and tighten install/package-manager guardrails so published builds stay leaner and core stops carrying extension-owned runtime baggage. Thanks @vincentkoc.
1314
- GitHub Copilot/memory search: add a GitHub Copilot embedding provider for memory search, and expose a dedicated Copilot embedding host helper so plugins can reuse the transport while honoring remote overrides, token refresh, and safer payload validation. (#61718) Thanks @feiskyer and @vincentkoc.
1415

1516
### Fixes

‎Dockerfile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ COPY package.json pnpm-lock.yaml pnpm-workspace.yaml .npmrc ./
6565
COPY openclaw.mjs ./
6666
COPY ui/package.json ./ui/package.json
6767
COPY patches ./patches
68-
COPY scripts/postinstall-bundled-plugins.mjs scripts/npm-runner.mjs scripts/windows-cmd-helpers.mjs ./scripts/
68+
COPY scripts/postinstall-bundled-plugins.mjs scripts/preinstall-package-manager-warning.mjs scripts/npm-runner.mjs scripts/windows-cmd-helpers.mjs ./scripts/
6969

7070
COPY --from=ext-deps /out/ ./${OPENCLAW_BUNDLED_PLUGIN_DIR}/
7171

‎extensions/feishu/src/client.ts‎

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,27 @@ import { resolveAmbientNodeProxyAgent } from "openclaw/plugin-sdk/extension-shar
55
import type { FeishuConfig, FeishuDomain, ResolvedFeishuAccount } from "./types.js";
66

77
const require = createRequire(import.meta.url);
8-
const { version: pluginVersion } = require("../package.json") as { version: string };
8+
const PACKAGE_JSON_CANDIDATES = [
9+
"../package.json",
10+
"./package.json",
11+
"../../package.json",
12+
] as const;
13+
14+
function readPluginVersion(): string {
15+
for (const candidate of PACKAGE_JSON_CANDIDATES) {
16+
try {
17+
const version = (require(candidate) as { version?: unknown }).version;
18+
if (typeof version === "string" && version.trim().length > 0) {
19+
return version;
20+
}
21+
} catch {
22+
// Ignore missing candidate paths across source and bundled layouts.
23+
}
24+
}
25+
return "unknown";
26+
}
27+
28+
const pluginVersion = readPluginVersion();
929

1030
export { pluginVersion };
1131

‎extensions/google/package.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
"@openclaw/plugin-sdk": "workspace:*"
1212
},
1313
"openclaw": {
14+
"bundle": {
15+
"stageRuntimeDependencies": true
16+
},
1417
"extensions": [
1518
"./index.ts"
1619
]

‎extensions/line/package.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
"private": true,
55
"description": "OpenClaw LINE channel plugin",
66
"type": "module",
7+
"dependencies": {
8+
"@line/bot-sdk": "^11.0.0"
9+
},
710
"devDependencies": {
811
"@openclaw/plugin-sdk": "workspace:*",
912
"openclaw": "workspace:*"

‎extensions/openshell/package.json‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
"private": true,
55
"description": "OpenClaw OpenShell sandbox backend",
66
"type": "module",
7+
"dependencies": {
8+
"openshell": "0.1.0"
9+
},
710
"devDependencies": {
811
"@openclaw/plugin-sdk": "workspace:*"
912
},

‎extensions/qqbot/src/api.ts‎

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,26 @@ const TOKEN_URL = "https://bots.qq.com/app/getAppAccessToken";
1111

1212
// Plugin User-Agent format: QQBotPlugin/{version} (Node/{nodeVersion}; {os})
1313
const _require = createRequire(import.meta.url);
14-
let _pluginVersion = "unknown";
15-
try {
16-
_pluginVersion = _require("../package.json").version ?? "unknown";
17-
} catch {
18-
/* fallback */
14+
const PACKAGE_JSON_CANDIDATES = [
15+
"../package.json",
16+
"./package.json",
17+
"../../package.json",
18+
] as const;
19+
20+
function readPluginVersion(): string {
21+
for (const candidate of PACKAGE_JSON_CANDIDATES) {
22+
try {
23+
const version = (_require(candidate) as { version?: unknown }).version;
24+
if (typeof version === "string" && version.trim().length > 0) {
25+
return version;
26+
}
27+
} catch {
28+
// Ignore missing candidate paths across source and bundled layouts.
29+
}
30+
}
31+
return "unknown";
1932
}
33+
const _pluginVersion = readPluginVersion();
2034
export const PLUGIN_USER_AGENT = `QQBotPlugin/${_pluginVersion} (Node/${process.versions.node}; ${os.platform()})`;
2135

2236
// =========================================================================

‎extensions/qqbot/src/slash-commands.ts‎

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,28 @@ import type { QQBotAccountConfig } from "./types.js";
1616
import { debugLog } from "./utils/debug-log.js";
1717
import { getHomeDir, getQQBotDataDir, isWindows } from "./utils/platform.js";
1818
const require = createRequire(import.meta.url);
19+
const PACKAGE_JSON_CANDIDATES = [
20+
"../package.json",
21+
"./package.json",
22+
"../../package.json",
23+
] as const;
24+
25+
function readPluginVersion(): string {
26+
for (const candidate of PACKAGE_JSON_CANDIDATES) {
27+
try {
28+
const version = (require(candidate) as { version?: unknown }).version;
29+
if (typeof version === "string" && version.trim().length > 0) {
30+
return version;
31+
}
32+
} catch {
33+
// Ignore missing candidate paths across source and bundled layouts.
34+
}
35+
}
36+
return "unknown";
37+
}
1938

2039
// Read the package version from package.json.
21-
let PLUGIN_VERSION = "unknown";
22-
try {
23-
const pkg = require("../package.json");
24-
PLUGIN_VERSION = pkg.version ?? "unknown";
25-
} catch {
26-
// fallback
27-
}
40+
const PLUGIN_VERSION = readPluginVersion();
2841

2942
const QQBOT_PLUGIN_GITHUB_URL = "https://github.com/openclaw/openclaw/tree/main/extensions/qqbot";
3043
const QQBOT_UPGRADE_GUIDE_URL = "https://q.qq.com/qqbot/openclaw/upgrade.html";

‎package.json‎

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@
2929
"dist/",
3030
"!dist/**/*.map",
3131
"!dist/plugin-sdk/.tsbuildinfo",
32+
"!dist/extensions/*/node_modules/**",
3233
"!dist/extensions/qa-channel/**",
3334
"dist/extensions/qa-channel/runtime-api.js",
3435
"!dist/extensions/qa-lab/**",
3536
"dist/extensions/qa-lab/runtime-api.js",
3637
"!dist/extensions/qa-matrix/**",
37-
"docs/",
38-
"!docs/.generated/**",
39-
"!docs/.i18n/zh-CN.tm.jsonl",
38+
"docs/reference/templates/",
4039
"qa/scenarios/",
4140
"skills/",
4241
"scripts/npm-runner.mjs",
42+
"scripts/preinstall-package-manager-warning.mjs",
4343
"scripts/postinstall-bundled-plugins.mjs",
4444
"scripts/windows-cmd-helpers.mjs"
4545
],
@@ -1159,6 +1159,7 @@
11591159
"deadcode:report:ci:ts-unused": "mkdir -p .artifacts/deadcode && pnpm deadcode:ts-unused > .artifacts/deadcode/ts-unused-exports.txt 2>&1 || true",
11601160
"deadcode:ts-prune": "pnpm dlx ts-prune src extensions scripts",
11611161
"deadcode:ts-unused": "pnpm dlx ts-unused-exports tsconfig.json --ignoreTestFiles --exitWithCount",
1162+
"deps:root-ownership": "node scripts/root-dependency-ownership-audit.mjs",
11621163
"dev": "node scripts/run-node.mjs",
11631164
"docs:bin": "node scripts/build-docs-list.mjs",
11641165
"docs:check-i18n-glossary": "node scripts/check-docs-i18n-glossary.mjs",
@@ -1234,6 +1235,7 @@
12341235
"plugin-sdk:usage": "node --import tsx scripts/analyze-plugin-sdk-usage.ts",
12351236
"plugins:sync": "node --import tsx scripts/sync-plugin-versions.ts",
12361237
"postinstall": "node scripts/postinstall-bundled-plugins.mjs",
1238+
"preinstall": "node scripts/preinstall-package-manager-warning.mjs",
12371239
"prepack": "node --import tsx scripts/openclaw-prepack.ts",
12381240
"prepare": "command -v git >/dev/null 2>&1 && git rev-parse --is-inside-work-tree >/dev/null 2>&1 && git config core.hooksPath git-hooks || exit 0",
12391241
"prepush:ci": "bash scripts/prepush-ci.sh",
@@ -1374,19 +1376,13 @@
13741376
"dependencies": {
13751377
"@agentclientprotocol/sdk": "0.18.2",
13761378
"@anthropic-ai/vertex-sdk": "^0.15.0",
1377-
"@aws-sdk/client-bedrock": "3.1028.0",
13781379
"@aws-sdk/client-bedrock-runtime": "3.1028.0",
13791380
"@aws-sdk/credential-provider-node": "3.972.30",
1380-
"@aws/bedrock-token-generator": "^1.1.0",
1381-
"@buape/carbon": "0.15.0",
13821381
"@clack/prompts": "^1.2.0",
1383-
"@google/genai": "^1.49.0",
13841382
"@grammyjs/runner": "^2.0.3",
13851383
"@grammyjs/transformer-throttler": "^1.2.1",
13861384
"@homebridge/ciao": "^1.3.6",
13871385
"@lancedb/lancedb": "^0.27.2",
1388-
"@larksuiteoapi/node-sdk": "^1.60.0",
1389-
"@line/bot-sdk": "^11.0.0",
13901386
"@lydell/node-pty": "1.2.0-beta.12",
13911387
"@mariozechner/pi-agent-core": "0.66.1",
13921388
"@mariozechner/pi-ai": "0.66.1",
@@ -1396,23 +1392,19 @@
13961392
"@modelcontextprotocol/sdk": "1.29.0",
13971393
"@mozilla/readability": "^0.6.0",
13981394
"@sinclair/typebox": "0.34.49",
1399-
"@slack/bolt": "^4.7.0",
1400-
"@slack/web-api": "^7.15.0",
14011395
"@whiskeysockets/baileys": "7.0.0-rc.9",
14021396
"ajv": "^8.18.0",
14031397
"chalk": "^5.6.2",
14041398
"chokidar": "^5.0.0",
14051399
"cli-highlight": "^2.1.11",
14061400
"commander": "^14.0.3",
14071401
"croner": "^10.0.1",
1408-
"discord-api-types": "^0.38.45",
14091402
"dotenv": "^17.4.1",
14101403
"express": "^5.2.1",
14111404
"file-type": "22.0.1",
14121405
"gaxios": "7.1.4",
14131406
"google-auth-library": "^10.6.2",
14141407
"grammy": "^1.42.0",
1415-
"hono": "4.12.12",
14161408
"https-proxy-agent": "^9.0.0",
14171409
"ipaddr.js": "^2.3.0",
14181410
"jimp": "^1.6.1",
@@ -1427,7 +1419,6 @@
14271419
"node-edge-tts": "^1.2.10",
14281420
"nostr-tools": "^2.23.3",
14291421
"openai": "^6.34.0",
1430-
"opusscript": "^0.1.1",
14311422
"osc-progress": "^0.3.0",
14321423
"pdfjs-dist": "^5.6.205",
14331424
"playwright-core": "1.59.1",
@@ -1479,11 +1470,9 @@
14791470
}
14801471
},
14811472
"optionalDependencies": {
1482-
"@discordjs/opus": "^0.10.0",
14831473
"@matrix-org/matrix-sdk-crypto-nodejs": "^0.4.0",
14841474
"fake-indexeddb": "^6.2.5",
1485-
"music-metadata": "^11.12.3",
1486-
"openshell": "0.1.0"
1475+
"music-metadata": "^11.12.3"
14871476
},
14881477
"overrides": {
14891478
"axios": "1.15.0",

0 commit comments

Comments
 (0)