import assert from "node:assert/strict";
import { describe, it } from "node:test";
import { CREATE_TASK_INSTANCE_COMMENT_TOOL, UPDATE_MEMORY_TOOL } from "./mcp-tools.js";
describe("create_task_instance_comment tool", () => {
    it("documents that follow-up node notes should be left as task comments", () => {
        assert.match(CREATE_TASK_INSTANCE_COMMENT_TOOL.description ?? "", /当需要告知后续节点需要注意的点时使用留言进行留言/);
    });
});
describe("update_memory tool", () => {
    it("uses an ACode provider compatible top-level object schema", () => {
        const schema = UPDATE_MEMORY_TOOL.inputSchema;
        assert.equal(schema.type, "object");
        assert.deepEqual(schema.required, ["uri"]);
        assertNoForbiddenTopLevelSchemaKeyword(schema);
    });
    it("guides replacement calls to provide old and new strings together", () => {
        const schema = UPDATE_MEMORY_TOOL.inputSchema;
        assertRecord(schema.properties, "update_memory properties");
        const oldStringSchema = schema.properties.old_string;
        const newStringSchema = schema.properties.new_string;
        assertRecord(oldStringSchema, "old_string schema");
        assertRecord(newStringSchema, "new_string schema");
        assert.match(String(oldStringSchema.description), /必须与 new_string 同时传入/);
        assert.match(String(newStringSchema.description), /必须与 old_string 同时传入/);
    });
    it("guides append calls to avoid replacement fields", () => {
        const schema = UPDATE_MEMORY_TOOL.inputSchema;
        assertRecord(schema.properties, "update_memory properties");
        const appendSchema = schema.properties.append;
        assertRecord(appendSchema, "append schema");
        assert.match(String(appendSchema.description), /只传 append/);
        assert.match(String(appendSchema.description), /不要传 old_string\/new_string/);
    });
});
function assertNoForbiddenTopLevelSchemaKeyword(schema) {
    const forbiddenTopLevelKeywords = ["oneOf", "anyOf", "allOf", "enum", "const", "not"];
    for (const keyword of forbiddenTopLevelKeywords) {
        assert.equal(keyword in schema, false, `top-level ${keyword} should not be present`);
    }
}
function assertRecord(value, label) {
    assert.equal(typeof value, "object", `${label} should be an object`);
    assert.notEqual(value, null, `${label} should not be null`);
}
//# sourceMappingURL=mcp-tools.test.js.map