feat: cut over rust web main shell

This commit is contained in:
lix-2026
2026-04-29 12:24:44 +08:00
parent 7965c6c107
commit 048fe28a4d
97 changed files with 9396 additions and 1263 deletions
@@ -1,6 +1,7 @@
import { describe, expect, it, vi } from "vitest";
import type { Json } from "@/types/supabase";
import {
DOCUMENT_AI_BRIDGE_ISLAND_CONTRACT,
applyDocWriteToolResultToPageBody,
buildAiAgentSessionsStoragePayload,
extractCurrentPageTitleFromSlashToolResult,
@@ -260,3 +261,16 @@ describe("extractCurrentPageTitleFromSlashToolResult", () => {
).toBeNull();
});
});
describe("DocumentAiAgentPanel.runtime island contract", () => {
it("AI bridge runtime 固定为 Rust Web/Hermes owned island", () => {
expect(DOCUMENT_AI_BRIDGE_ISLAND_CONTRACT).toMatchObject({
shellOwner: "mnote-web",
bridgeOwner: "rust-web-hermes",
runtimeRole: "react_interaction_island",
runEndpoint: "/api/hermes/bridge",
legacyCompatEndpoint: "/api/ai-agent/run",
});
});
});
@@ -27,6 +27,14 @@ type CodexMode = "chat" | "test" | "dev";
const OLLAMA_QWEN3_30B = "qwen3:30b-a3b-instruct-2507-q4_K_M";
export const DOCUMENT_AI_BRIDGE_ISLAND_CONTRACT = {
shellOwner: "mnote-web",
bridgeOwner: "rust-web-hermes",
runtimeRole: "react_interaction_island",
runEndpoint: "/api/hermes/bridge",
legacyCompatEndpoint: "/api/ai-agent/run",
} as const;
const extractCodexMode = (text: string): CodexMode => {
const s = String(text ?? "");
const m = s.match(/^\s*#(chat|test|dev)\b/i);
@@ -863,6 +871,12 @@ export function DocumentAiAgentPanelRuntime({
className="w-[min(1400px,calc(100vw-24px))] max-w-none border-l-0 bg-transparent p-3 shadow-none sm:max-w-none"
>
<SheetTitle className="sr-only"> AI</SheetTitle>
<div
data-react-island="document_ai_bridge"
data-runtime-role={DOCUMENT_AI_BRIDGE_ISLAND_CONTRACT.runtimeRole}
data-bridge-owner={DOCUMENT_AI_BRIDGE_ISLAND_CONTRACT.bridgeOwner}
className="h-[calc(100vh-24px)] min-h-0"
>
<AiBridgePanel
title={pageTitle}
subtitle="页面 AI"
@@ -1757,6 +1771,7 @@ export function DocumentAiAgentPanelRuntime({
</DialogContent>
</Dialog>
</AiBridgePanel>
</div>
</SheetContent>
</Sheet>
);