feat: unify live cli backend probes

This commit is contained in:
Peter Steinberger
2026-04-07 10:34:39 +01:00
parent dbc7710938
commit c2f9de3935
28 changed files with 1209 additions and 255 deletions

View File

@@ -102,4 +102,57 @@ describe("stageBundledPluginRuntimeDeps", () => {
expect(fs.existsSync(path.join(stagedRoot, "types"))).toBe(false);
});
});
it("strips non-runtime dependency sections before temp npm staging", async () => {
const repoRoot = makeRepoRoot("openclaw-stage-bundled-runtime-manifest-");
writeRepoFile(
repoRoot,
"dist/extensions/amazon-bedrock/package.json",
JSON.stringify(
{
name: "@openclaw/amazon-bedrock-provider",
version: "2026.4.6",
dependencies: {
"@aws-sdk/client-bedrock": "3.1024.0",
},
devDependencies: {
"@openclaw/plugin-sdk": "workspace:*",
},
peerDependencies: {
openclaw: "^0.0.0",
},
peerDependenciesMeta: {
openclaw: {
optional: true,
},
},
openclaw: {
bundle: {
stageRuntimeDependencies: true,
},
},
},
null,
2,
),
);
const stageBundledPluginRuntimeDeps = await loadStageBundledPluginRuntimeDeps();
const installs: Array<Record<string, unknown>> = [];
stageBundledPluginRuntimeDeps({
repoRoot,
installAttempts: 1,
installPluginRuntimeDepsImpl(params: { packageJson: Record<string, unknown> }) {
installs.push(params.packageJson);
},
});
expect(installs).toHaveLength(1);
expect(installs[0]?.dependencies).toEqual({
"@aws-sdk/client-bedrock": "3.1024.0",
});
expect(installs[0]?.devDependencies).toBeUndefined();
expect(installs[0]?.peerDependencies).toBeUndefined();
expect(installs[0]?.peerDependenciesMeta).toBeUndefined();
});
});

View File

@@ -2017,6 +2017,11 @@ export type OpenClawPluginService = {
stop?: (ctx: OpenClawPluginServiceContext) => void | Promise<void>;
};
export type CliBundleMcpMode =
| "claude-config-file"
| "codex-config-overrides"
| "gemini-system-settings";
/** Plugin-owned CLI backend defaults used by the text-only CLI runner. */
export type CliBackendPlugin = {
/** Provider id used in model refs, for example `claude-cli/opus`. */
@@ -2032,6 +2037,7 @@ export type CliBackendPlugin = {
liveTest?: {
defaultModelRef?: string;
defaultImageProbe?: boolean;
defaultMcpProbe?: boolean;
docker?: {
npmPackage?: string;
binaryName?: string;
@@ -2040,10 +2046,19 @@ export type CliBackendPlugin = {
/**
* Whether OpenClaw should inject bundle MCP config for this backend.
*
* Keep this opt-in. Only backends that explicitly consume an MCP config file
* should enable it.
* Keep this opt-in. Only backends that explicitly consume OpenClaw's bundle
* MCP bridge should enable it.
*/
bundleMcp?: boolean;
/**
* Provider-owned bundle MCP integration strategy.
*
* Different CLIs wire MCP through different surfaces:
* - Claude: `--strict-mcp-config --mcp-config`
* - Codex: `-c mcp_servers=...`
* - Gemini: system-level `settings.json`
*/
bundleMcpMode?: CliBundleMcpMode;
/**
* Optional config normalizer applied after user overrides merge.
*