Expose VoidBot MCP schema fingerprint
This commit is contained in:
parent
aa454ff1a2
commit
df83123c96
8 changed files with 95 additions and 3 deletions
|
|
@ -4,6 +4,19 @@ import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js"
|
|||
import { existsSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
|
||||
const requiredSelfStateDocumentTypes = [
|
||||
"void.self_profile",
|
||||
"void.moderation_cursor",
|
||||
"void.speech_receipts",
|
||||
"void.thought_memory",
|
||||
"void.scheduled_runtime",
|
||||
"void.agency_pressure",
|
||||
"void.candidate_interventions",
|
||||
"void.face_affect",
|
||||
];
|
||||
const requiredSelfStateSchemaFingerprint =
|
||||
`void-self-state.v1:${requiredSelfStateDocumentTypes.join("|")}`;
|
||||
|
||||
const workspaceRoot = resolve(process.cwd());
|
||||
const serverPath = resolve(workspaceRoot, "apps", "worker", "dist", "mcp-server.js");
|
||||
const identity = readArg("--identity") ?? "nibu";
|
||||
|
|
@ -30,6 +43,12 @@ const client = new Client({
|
|||
|
||||
try {
|
||||
await client.connect(transport);
|
||||
const runtimeResult = await client.callTool({
|
||||
name: "get_voidbot_runtime_info",
|
||||
arguments: {},
|
||||
});
|
||||
assertRuntimeInfo(runtimeResult);
|
||||
|
||||
const result = await client.callTool({
|
||||
name: "read_repo_face_state",
|
||||
arguments: { identity },
|
||||
|
|
@ -73,6 +92,30 @@ try {
|
|||
await client.close();
|
||||
}
|
||||
|
||||
function assertRuntimeInfo(result) {
|
||||
if (result.isError) {
|
||||
throw new Error(renderToolText(result) || "get_voidbot_runtime_info returned isError.");
|
||||
}
|
||||
const runtimeInfo = result.structuredContent;
|
||||
if (!runtimeInfo || typeof runtimeInfo !== "object") {
|
||||
throw new Error("get_voidbot_runtime_info did not return structured runtime info.");
|
||||
}
|
||||
if (runtimeInfo.selfStateSchemaFingerprint !== requiredSelfStateSchemaFingerprint) {
|
||||
throw new Error(
|
||||
`VoidBot MCP self-state schema fingerprint mismatch. Expected ${requiredSelfStateSchemaFingerprint}, got ${runtimeInfo.selfStateSchemaFingerprint ?? "(missing)"}.`,
|
||||
);
|
||||
}
|
||||
const documentTypes = runtimeInfo.selfStateDocumentTypes;
|
||||
if (!Array.isArray(documentTypes)) {
|
||||
throw new Error("VoidBot MCP runtime info did not expose selfStateDocumentTypes.");
|
||||
}
|
||||
for (const documentType of requiredSelfStateDocumentTypes) {
|
||||
if (!documentTypes.includes(documentType)) {
|
||||
throw new Error(`VoidBot MCP runtime is missing self-state document type ${documentType}.`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function readArg(name) {
|
||||
const index = process.argv.indexOf(name);
|
||||
if (index < 0) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue