mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-18 08:31:49 -06:00
f4387b7a5e
* feat(plugins): support the Agent Plugins bundle format * docs(plugins): document the Agent Plugins bundle format * test(agents): preserve agent bundle runtime discovery * fix(plugins): isolate Agent Plugins data-dir failures and align MCP support reporting * docs(plugins): list Agent Plugins in the canonical plugin-format guides * fix(plugins): gate Agent Plugins detection on schema, pure inspection, root-relative cwd * fix(plugins): record Agent Plugins data-dir ownership explicitly * docs(plugins): cover Agent Plugins in the CLI install detection guide * fix(plugins): carry Agent Plugins data-dir and transport contracts through external MCP projections
68 lines
2.0 KiB
TypeScript
68 lines
2.0 KiB
TypeScript
// Plugin list format tests cover installed plugin table and JSON formatting.
|
|
import { describe, expect, it } from "vitest";
|
|
import { createPluginRecord } from "../plugins/status.test-fixtures.js";
|
|
import { formatPluginLine } from "./plugins-list-format.js";
|
|
|
|
describe("formatPluginLine", () => {
|
|
it("labels active registry entries as enabled rather than loaded", () => {
|
|
const output = formatPluginLine(createPluginRecord({ id: "demo", enabled: true }));
|
|
|
|
expect(output).toContain("enabled");
|
|
expect(output).not.toContain("loaded");
|
|
});
|
|
|
|
it("shows imported state in verbose output", () => {
|
|
const output = formatPluginLine(
|
|
createPluginRecord({
|
|
id: "demo",
|
|
name: "Demo Plugin",
|
|
imported: false,
|
|
activated: true,
|
|
explicitlyEnabled: false,
|
|
}),
|
|
true,
|
|
);
|
|
|
|
expect(output).toContain("activated: yes");
|
|
expect(output).toContain("imported: no");
|
|
expect(output).toContain("explicitly enabled: no");
|
|
});
|
|
|
|
it("labels portable bundle records as Agent Plugins", () => {
|
|
const output = formatPluginLine(
|
|
createPluginRecord({
|
|
id: "portable",
|
|
format: "bundle",
|
|
bundleFormat: "agent",
|
|
}),
|
|
true,
|
|
);
|
|
|
|
expect(output).toContain("bundle format: agent (Agent Plugins)");
|
|
});
|
|
|
|
it("sanitizes activation reasons in verbose output", () => {
|
|
const output = formatPluginLine(
|
|
createPluginRecord({
|
|
id: "demo",
|
|
name: "Demo Plugin",
|
|
activated: true,
|
|
activationSource: "auto",
|
|
activationReason: "\u001B[31mconfigured\nnext\tstep",
|
|
}),
|
|
true,
|
|
);
|
|
|
|
expect(output).toContain("activation reason: configured\\nnext\\tstep");
|
|
expect(output).not.toContain("\u001B[31m");
|
|
expect(output.match(/activation reason:/g)).toHaveLength(1);
|
|
});
|
|
|
|
it("keeps truncated descriptions free of lone surrogates", () => {
|
|
const output = formatPluginLine(
|
|
createPluginRecord({ id: "demo", description: `${"a".repeat(56)}😀tail` }),
|
|
);
|
|
expect(Buffer.from(output).toString()).toBe(output);
|
|
});
|
|
});
|