Files
paseo/scripts/builtin-plugins-dist.test.mjs
T
Mohamed Boudraandmillerben95 8332f4d1ff feat(muse): add Muse Code as a built-in provider plugin (#5719)
* test(muse): record real host protocol fixtures

* feat(muse): add built-in MSP provider

Co-authored-by: millerben95 <millerben95@users.noreply.github.com>

* fix(muse): expose provider settings in the app

The daemon registered host settings without a client contribution, leaving sandbox, network, and workspace trust unreachable. Share the definition with a settings screen and expose it through Command Center even when installed plugins are disabled.

* docs(muse): publish setup and provider support

* test: correct runtime fixtures and restart readiness

* fix(muse): hide reminder housekeeping from the timeline

* fix(muse): use the official Muse Code mark

Source: https://muse.ai/images/favicon/app-squiggle.svg

Preserve the official silhouette path verbatim. Remove its gradient definition and use currentColor, scaling the original 100-unit coordinates into the 24-unit viewBox. Black silhouette renders match pixel-for-pixel.

* fix(muse): adapt to current plugin APIs

Use the screen API introduced with sidebar plugin items. Usage reports now come from source account discovery; remove the retired agent usage-reference request and headline marker, and exercise discovery through the existing provider fixtures.

---------

Co-authored-by: millerben95 <millerben95@users.noreply.github.com>
2026-09-30 14:56:41 +01:00

84 lines
3.2 KiB
JavaScript

import assert from "node:assert/strict";
import { mkdtemp, readFile, rm, stat } from "node:fs/promises";
import path from "node:path";
import os from "node:os";
import test from "node:test";
import { fileURLToPath } from "node:url";
import pino from "pino";
import {
builtinPlugins,
resolveBuiltinPluginsRoot,
} from "../packages/server/dist/server/server/plugins/builtin/index.js";
import { compilePlugin } from "../packages/server/dist/server/server/plugins/compiler.js";
import { readPluginManifest } from "../packages/server/dist/server/server/plugins/manifest.js";
import { PluginRuntime } from "../packages/server/dist/server/server/plugins/runtime.js";
const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
const packagedRoot = path.join(repoRoot, "packages/server/dist/server/builtin-plugins");
async function findEntry(directory, names) {
for (const name of names) {
const entry = path.join(directory, name);
if ((await stat(entry).catch(() => null))?.isFile()) return entry;
}
return null;
}
test("built output compiles and starts every listed built-in", async () => {
assert.equal(resolveBuiltinPluginsRoot(), packagedRoot);
const { version } = JSON.parse(
await readFile(path.join(repoRoot, "packages/server/package.json"), "utf8"),
);
const settingsDirectory = await mkdtemp(path.join(os.tmpdir(), "builtin-dist-settings-"));
const runtime = new PluginRuntime(pino({ level: "silent" }), version, { settingsDirectory });
runtime.bindPaseoSessionHost({
async attachPluginSocket(_pluginId, socket) {
const closed = new Promise((resolve) => socket.once("close", resolve));
socket.on("message", (data) => {
if (typeof data !== "string") return;
const message = JSON.parse(data);
if (message.type !== "hello") return;
socket.send(
JSON.stringify({
type: "session",
message: {
type: "status",
payload: {
status: "server_info",
serverId: "builtin-dist-test",
hostname: "builtin-dist-test",
version,
features: {},
},
},
}),
);
});
return { closed };
},
});
try {
for (const id of builtinPlugins) {
const directory = path.join(packagedRoot, id);
assert.equal((await readPluginManifest(directory)).id, id);
const bundles = await compilePlugin({
server: await findEntry(directory, ["index.server.ts", "index.server.tsx"]),
client: await findEntry(directory, ["index.client.ts", "index.client.tsx"]),
});
assert.ok(bundles.serverBundle, `${id} must compile a server bundle`);
await runtime.startBuiltinPlugin({ id, directory });
assert.ok(runtime.catalog().some((plugin) => plugin.id === id));
if (id.endsWith("-usage-source")) {
const sourceId = id.slice(0, -"-usage-source".length);
assert.ok(
runtime.getUsageSourceRegistrations(id).some((source) => source.id === sourceId),
`${id} must register usage source ${sourceId}`,
);
}
}
} finally {
await runtime.stopAll();
await rm(settingsDirectory, { recursive: true, force: true });
}
});