Files
mnote/scripts/task116-rust-web-islands-smoke.js
Agent Board 262e66b02e feat: purge legacy agent hosts and land vault Chrome extension path
Retire ACP/Hermes/OpenCode surfaces and rename hermes_tools to
mnote_agent_tools so Page AI stays on Pi Lab only. Add Chrome vault
extension + extension token route, pre-release purge design, and soft-retire
legacy smokes for the small-group production cut.
2026-07-25 14:25:37 +08:00

87 lines
3.2 KiB
JavaScript

"use strict";
const BASE_URL = (process.env.MNOTE_UI_BASE_URL || "http://127.0.0.1:3000").replace(/\/+$/, "");
const REQUEST_TIMEOUT_MS = Number(process.env.MNOTE_SMOKE_TIMEOUT_MS || 20_000);
function assert(condition, message) {
if (!condition) {
throw new Error(message);
}
}
async function fetchWithTimeout(path, init = {}) {
const controller = new AbortController();
const timeout = setTimeout(() => controller.abort(), REQUEST_TIMEOUT_MS);
try {
return await fetch(`${BASE_URL}${path}`, {
...init,
signal: controller.signal,
});
} finally {
clearTimeout(timeout);
}
}
async function readTextResponse(path, init) {
const response = await fetchWithTimeout(path, init);
const text = await response.text();
assert(response.ok, `${path} 请求失败: ${response.status} ${text.slice(0, 200)}`);
return { response, text };
}
async function checkSearchShell() {
const { response, text } = await readTextResponse("/search?workspaceId=ws_task116&q=Rust");
assert(response.headers.get("x-mnote-web-owner") === "mnote-web", "Search shell 缺少 mnote-web owner header");
assert(response.headers.get("x-mnote-web-shell") === "search", "Search shell 缺少 search shell header");
assert(text.includes("mnote.search_shell.v1"), "Search shell 缺少 contract schema");
assert(text.includes("search_interaction_island"), "Search shell 缺少 search interaction island");
return { owner: "mnote-web", shell: "search", island: "search_interaction_island" };
}
async function checkAgentTools() {
const { response, text } = await readTextResponse("/api/mnote/tools/manifest");
const payload = JSON.parse(text);
const schema = payload?.manifest?.schemaVersion || payload?.schema || payload?.contract?.schema || "";
assert(
schema === "mnote.agent_tool_manifest.v1" || String(text).includes("mnote.agent_tool_manifest.v1"),
`tools manifest schema 不正确: ${schema || text.slice(0, 200)}`,
);
const owner = response.headers.get("x-mnote-agent-tool-owner") || payload?.owner || "";
return { owner: owner || "mnote-web-agent-tools", schema: "mnote.agent_tool_manifest.v1" };
}
async function checkMindmapShell() {
const { response, text } = await readTextResponse("/mindmap/doc_task116/mind_task116");
assert(response.headers.get("x-mnote-web-owner") === "mnote-web", "Mindmap shell 缺少 mnote-web owner header");
assert(response.headers.get("x-mnote-web-shell") === "mindmap", "Mindmap shell 缺少 mindmap shell header");
assert(text.includes("mnote.mindmap_shell.v1"), "Mindmap shell 缺少 contract schema");
assert(text.includes('data-react-island="mindmap_runtime"'), "Mindmap shell 缺少 mindmap runtime island");
return { owner: "mnote-web", shell: "mindmap", island: "mindmap_runtime" };
}
async function main() {
const search = await checkSearchShell();
const agentTools = await checkAgentTools();
const mindmap = await checkMindmapShell();
console.log(
JSON.stringify(
{
ok: true,
baseUrl: BASE_URL,
results: {
search,
agentTools,
mindmap,
},
},
null,
2,
),
);
}
main().catch((error) => {
console.error(error instanceof Error ? error.stack || error.message : String(error));
process.exit(1);
});