feat(page-ai): add resumable run journal descriptors
This commit is contained in:
@@ -60,6 +60,19 @@ async function signIn(context) {
|
||||
assert(response.ok(), `登录失败: ${response.status()} ${await response.text()}`);
|
||||
}
|
||||
|
||||
async function assertKnowledgeRagDescriptor(context) {
|
||||
const result = await apiJson(context, "GET", `${BASE_URL}/api/page-ai/agents/descriptors?profile=task538-knowledge-rag`);
|
||||
assert(result.ok, `descriptor API 失败: ${result.status} ${result.text.slice(0, 1000)}`);
|
||||
const reasonix = (result.payload?.descriptors || []).find((descriptor) => descriptor.agentId === "reasonix");
|
||||
assert(reasonix, "descriptor 缺少 Reasonix");
|
||||
assert.equal(reasonix.capabilityStates?.knowledge_rag?.enabled, true, "Reasonix descriptor 应声明 knowledge_rag enabled");
|
||||
assert((reasonix.capabilities || []).includes("knowledge_rag"), "Reasonix descriptor capabilities 应包含 knowledge_rag");
|
||||
const toolNames = new Set((reasonix.tools || []).map((tool) => tool.name));
|
||||
for (const toolName of ["mnote.knowledge_rag.status", "mnote.knowledge_rag.query", "mnote.knowledge_rag.open_reference"]) {
|
||||
assert(toolNames.has(toolName), `Reasonix descriptor 缺少 ${toolName}`);
|
||||
}
|
||||
}
|
||||
|
||||
async function status(context) {
|
||||
const params = new URLSearchParams({ rootUri: ROOT_URI, workspaceId: WORKSPACE_ID });
|
||||
const result = await apiJson(context, "GET", `${BASE_URL}/api/knowledge-rag/status?${params.toString()}`);
|
||||
@@ -149,6 +162,7 @@ async function main() {
|
||||
const context = await request.newContext({ baseURL: BASE_URL });
|
||||
try {
|
||||
await signIn(context);
|
||||
await assertKnowledgeRagDescriptor(context);
|
||||
await ingest(context, [sourceA, sourceB]);
|
||||
const indexedStatus = await waitForIndexed(context, [sourceA, sourceB]);
|
||||
const scoped = await query(context, marker, [sourceA]);
|
||||
|
||||
Reference in New Issue
Block a user