feat: upgrade investigation and presentation runtime
Generic Container CI/CD / test-build-publish (push) Successful in 1m6s
Agent CI/CD / build-test-publish-and-deploy (push) Successful in 1m7s

This commit is contained in:
2026-10-30 17:30:19 +08:00
parent 3b52a0ddab
commit 6336157ff4
104 changed files with 6541 additions and 961 deletions
+13 -3
View File
@@ -1,11 +1,21 @@
import { describe, expect, it } from "bun:test";
import { tool } from "../../.opencode/tool.js";
import presentView from "../../.opencode/tools/present_view.js";
import { unwrapFrontendActionResult } from "../../.opencode/tools/frontend_action.js";
describe("frontend action tool bridge", () => {
it("accepts a presentation without a reason and trims optional explanations", () => {
const schema = tool.schema.object(presentView.args);
const command = { action: "clear_highlights" };
expect(schema.parse({ command })).toEqual({ command });
expect(schema.parse({ command, reason: " 清理上轮定位 " }).reason).toBe("清理上轮定位");
expect(schema.safeParse({ command, reason: " " }).success).toBeFalse();
});
it("returns only validated browser output for successful actions", () => {
expect(unwrapFrontendActionResult(JSON.stringify({
version: "frontend-action-result@1",
version: "frontend-action-result@2",
actionId: "action-1",
status: "succeeded",
output: { cleared: true },
@@ -15,14 +25,14 @@ describe("frontend action tool bridge", () => {
it("throws the browser error for failed and expired actions", () => {
expect(() => unwrapFrontendActionResult(JSON.stringify({
version: "frontend-action-result@1",
version: "frontend-action-result@2",
actionId: "action-1",
status: "failed",
error: { code: "WFS_UNAVAILABLE", message: "SCADA geometry query failed" },
completedAt: Date.now(),
}))).toThrow("WFS_UNAVAILABLE: SCADA geometry query failed");
expect(() => unwrapFrontendActionResult(JSON.stringify({
version: "frontend-action-result@1",
version: "frontend-action-result@2",
actionId: "action-2",
status: "expired",
error: { code: "ACTION_TIMEOUT", message: "browser action timed out" },