chore: checkpoint pi lab rust integration work

This commit is contained in:
Agent Board
2026-07-11 20:39:18 +08:00
parent d47f6447fd
commit d16eccfe10
39 changed files with 4843 additions and 455 deletions
+28 -10
View File
@@ -88,13 +88,13 @@ async function main() {
result.checks.sendInsideInputWrap = await page.locator(".wolai-page-ai-pi-lab-input-wrap [data-page-ai-pi-lab-btn-send]").count() === 1;
result.checks.bottomQuickKinds = await page.locator(".wolai-page-ai-pi-lab-modebar [data-page-ai-pi-lab-quick]").evaluateAll((nodes) => nodes.map((node) => node.getAttribute("data-page-ai-pi-lab-quick")));
result.checks.actionMenuToggleCount = await page.locator("[data-page-ai-pi-lab-action-menu-toggle]").count();
result.checks.thinkingControlVisible = await page.locator("[data-page-ai-pi-lab-thinking]").isVisible();
result.checks.thinkingControlVisible = await page.locator("[data-page-ai-pi-lab-thinking-menu-wrap]").isVisible();
result.checks.permissionControlVisible = await page.locator("[data-page-ai-pi-lab-permission]").isVisible();
assert.equal(result.checks.composerQuickButtonCount, 0, "输入框下方不应再重复显示当前页/选区/LightRAG");
assert.equal(result.checks.composerBarCount, 0, "发送按钮不应单独占用一整行 composer bar");
assert.equal(result.checks.sendModeButtonCount, 0, "流式插队模式不应作为常驻工具栏按钮");
assert(result.checks.sendInsideInputWrap, "发送按钮应收进输入框区域");
assert.deepEqual(result.checks.bottomQuickKinds, ["read-page", "selection", "rag"], "底部工具栏应保留 Pi 实际上下文工具");
assert.deepEqual(result.checks.bottomQuickKinds, ["read-page", "current-folder", "selection", "rag"], "底部工具栏应保留 Pi 实际上下文工具");
assert.equal(result.checks.actionMenuToggleCount, 1, "+ 菜单应作为输入区操作入口");
assert(result.checks.thinkingControlVisible, "Pi 官方 thinking level 应在输入区可见");
assert(result.checks.permissionControlVisible, "MNote 权限/审批状态应在输入区可见");
@@ -209,21 +209,39 @@ async function main() {
assert(result.checks.historyLayerVisible, "history 应以左侧抽屉层打开");
assert(result.checks.historyDrawerFromLeft, "history 应从 Pi 面板左侧弹出");
assert(result.checks.commandbarRemovedNoopButtons, "顶部工具栏不应保留无实际意义按钮");
assert(result.checks.commandbarIconCount <= 5, "顶部工具栏应只保留少量有效 SVG 图标");
assert(result.checks.commandbarIconCount <= 6, "顶部工具栏应只保留少量有效 SVG 图标");
await historyRow.locator(`[data-page-ai-pi-lab-history-session="${sessionId}"]`).first().click();
await page.locator("[data-page-ai-pi-lab-replay-banner]").waitFor({ state: "visible", timeout: TIMEOUT });
result.checks.historyReplayBannerVisible = await page.locator("[data-page-ai-pi-lab-replay-banner]").isVisible();
await page.locator("[data-page-ai-pi-lab-replay-banner]").waitFor({ state: "hidden", timeout: TIMEOUT });
await page.locator("[data-page-ai-pi-lab-input]").fill("history continue smoke");
result.checks.historyReplayBannerVisible = await page.locator("[data-page-ai-pi-lab-replay-banner]").isVisible().catch(() => false);
result.checks.historyReplayInputDisabled = await page.locator("[data-page-ai-pi-lab-input]").isDisabled();
result.checks.historyReplaySendDisabled = await page.locator("[data-page-ai-pi-lab-btn-send]").isDisabled();
await page.screenshot({ path: path.join(OUT, "01b-history-readonly-replay.png"), fullPage: false });
result.screenshots.historyReplay = path.join(OUT, "01b-history-readonly-replay.png");
assert(result.checks.historyReplayBannerVisible, "打开历史应显示只读 replay 提示");
assert(result.checks.historyReplayInputDisabled, "打开历史后输入框应只读");
assert(result.checks.historyReplaySendDisabled, "打开历史后发送按钮应用");
await page.screenshot({ path: path.join(OUT, "01b-history-session-continue.png"), fullPage: false });
result.screenshots.historyReplay = path.join(OUT, "01b-history-session-continue.png");
assert.equal(result.checks.historyReplayBannerVisible, false, "打开历史 session 后不应显示只读 replay 提示");
assert.equal(result.checks.historyReplayInputDisabled, false, "打开历史 session 后输入框应可继续编辑");
assert.equal(result.checks.historyReplaySendDisabled, false, "打开历史 session 后发送按钮应用");
await page.locator("[data-page-ai-pi-lab-new]").click();
await page.locator("[data-page-ai-pi-lab-replay-banner]").waitFor({ state: "hidden", timeout: TIMEOUT });
const confirmMode = await page.request.fetch(`${BASE}/api/page-ai/pi/configure`, {
method: "POST",
headers: { "content-type": "application/json", accept: "application/json" },
data: {
sessionId,
permissionMode: "confirm",
},
});
const confirmModeJson = await confirmMode.json();
result.checks.confirmModeConfigured = confirmModeJson.ok === true
&& ((confirmModeJson.session && confirmModeJson.session.permissionMode === "confirm")
|| (confirmModeJson.session
&& confirmModeJson.session.runtimePolicySnapshot
&& confirmModeJson.session.runtimePolicySnapshot.permissionMode === "confirm"));
assert(confirmMode.ok(), `configure confirm request failed: ${confirmMode.status()}`);
assert(result.checks.confirmModeConfigured, "安全审批 smoke 必须先显式切到 confirm 模式");
const unapproved = await page.request.fetch(`${BASE}/api/page-ai/pi/tool-call`, {
method: "POST",
headers: { "content-type": "application/json", accept: "application/json" },