Improve local evidence search and AI capabilities
This commit is contained in:
@@ -46,6 +46,14 @@ async function postJson(pathname, data, headers = {}) {
|
||||
})).payload;
|
||||
}
|
||||
|
||||
async function putJson(pathname, data, headers = {}) {
|
||||
return (await fetchJson(pathname, {
|
||||
method: "PUT",
|
||||
headers: { "content-type": "application/json", ...headers },
|
||||
body: JSON.stringify(data),
|
||||
})).payload;
|
||||
}
|
||||
|
||||
async function getText(pathname, headers = {}, timeoutMs = 180_000) {
|
||||
const controller = new AbortController();
|
||||
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
||||
@@ -170,7 +178,7 @@ async function runReasonixAcpEvidenceCheck(input) {
|
||||
allowedRoots: [{ rootUri, permission: "write" }],
|
||||
skillPreferences: {
|
||||
mnote: {
|
||||
"mnote-document-evidence": true,
|
||||
"mnote-local-index": true,
|
||||
"mnote-chat-only": false,
|
||||
},
|
||||
},
|
||||
@@ -245,18 +253,33 @@ async function main() {
|
||||
headers: { cookie },
|
||||
})).payload;
|
||||
const toolNames = (toolsPayload.tools || []).map((tool) => tool.name);
|
||||
for (const name of ["mnote.evidence.search", "mnote.evidence.read", "mnote.evidence.open"]) {
|
||||
for (const name of [
|
||||
"mnote.evidence.search",
|
||||
"mnote.evidence.read",
|
||||
"mnote.evidence.open",
|
||||
"mnote.index.status",
|
||||
"mnote.index.refresh",
|
||||
"mnote.index.update_settings",
|
||||
]) {
|
||||
assert(toolNames.includes(name), `Reasonix tools 列表缺少 ${name}`);
|
||||
}
|
||||
const skillsPayload = (await fetchJson("/api/hermes/client/skills?runtime=mnote&agentId=reasonix", {
|
||||
const capabilitiesPayload = (await fetchJson("/api/hermes/client/capabilities?runtime=mnote&agentId=reasonix&profile=reasonix", {
|
||||
headers: { cookie },
|
||||
})).payload;
|
||||
const mnoteSkills = (skillsPayload.categories || []).flatMap((category) => category.skills || []);
|
||||
const mnoteCapabilities = (capabilitiesPayload.categories || []).flatMap((category) => category.capabilities || category.skills || []);
|
||||
assert(
|
||||
mnoteSkills.some((skill) => skill.id === "mnote-document-evidence" && skill.enabled !== false),
|
||||
"Reasonix agent 缺少启用的 mnote-document-evidence skill",
|
||||
mnoteCapabilities.some((capability) => capability.id === "mnote-local-index" && capability.enabled !== false),
|
||||
"Reasonix agent 缺少启用的 mnote-local-index 能力",
|
||||
);
|
||||
|
||||
const settings = await putJson("/api/search/local-index/settings", {
|
||||
workspaceId,
|
||||
rootUri,
|
||||
includePaths: ["."],
|
||||
scheduleMode: "manual",
|
||||
runOnChange: false,
|
||||
}, actorHeaders);
|
||||
assert.strictEqual(settings.ok, true, "local evidence index settings ok");
|
||||
const refresh = await postJson("/api/search/local-index/refresh", { workspaceId, rootUri }, actorHeaders);
|
||||
assert.strictEqual(refresh.ok, true, "local evidence index refresh ok");
|
||||
|
||||
@@ -297,6 +320,8 @@ async function main() {
|
||||
const toolResult = toolEnvelope.result || toolEnvelope;
|
||||
const toolHit = (toolResult.results || []).find((result) => String(result.quote || "").includes("Printer test page"));
|
||||
assertEvidenceHit(toolHit, { label: "agent-tool", ownerRel, pdfRel });
|
||||
assert(String(toolHit.citationMarkdown || "").includes("](/documents/"), "agent tool 缺少可点击 citationMarkdown");
|
||||
assert(String(toolHit.citationUrl || "").includes("resourceTab="), "agent tool citationUrl 缺少资源 tab 定位参数");
|
||||
assert((toolEnvelope.audit?.evidenceIds || []).includes(toolHit.evidenceId), "agent tool audit 缺少 evidence id");
|
||||
assert.strictEqual(toolEnvelope.audit?.runReceipt?.toolName, "mnote.evidence.search", "run receipt toolName");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user