refactor(agent): 医院信息子代理改为 hospital-info 技能直挂主 agent

删除 hospital-info 子代理,规则移入 agent/infra/skills/hospital-info/SKILL.md;管理端挂载 list/read/write,就诊人端只挂 list/read,只读仍由工具缺失保证;查询改为 read-first,未收录或重名再 list;同步更新两端提示词与测试。
This commit is contained in:
lik
2026-11-18 21:13:13 +08:00
parent 467d7b7383
commit 8e3fc43e08
7 changed files with 67 additions and 125 deletions
-15
View File
@@ -10,7 +10,6 @@ import {
MAX_ENTRY_CHARS,
MAX_READ_CHARS,
} from "../agent/infra/tools/hospital/store.js";
import { createHospitalInfoSubagent } from "../agent/subagent/hospital_info.js";
async function withStore(fn) {
const root = await fs.mkdtemp(path.join(os.tmpdir(), "hospital-knowledge-"));
@@ -317,17 +316,3 @@ test("写入校验日期格式与单条内容长度", async () => {
);
});
});
test("子代理按 allowWrite 生成不同工具集", () => {
const readOnly = createHospitalInfoSubagent({}, { allowWrite: false });
const writable = createHospitalInfoSubagent({}, { allowWrite: true });
const names = (subagent) => subagent.tools.map((item) => item.name);
assert.ok(!names(readOnly).includes("hospital_knowledge_write"));
assert.ok(names(readOnly).includes("hospital_knowledge_list"));
assert.ok(names(readOnly).includes("hospital_knowledge_read"));
assert.ok(names(writable).includes("hospital_knowledge_write"));
assert.match(readOnly.systemPrompt, /只读,不修改知识库/);
assert.doesNotMatch(readOnly.systemPrompt, /# 记录规则/);
assert.match(writable.systemPrompt, /# 记录规则/);
});