feat: cut over rust web main shell
This commit is contained in:
@@ -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>
|
||||
);
|
||||
|
||||
@@ -8,6 +8,13 @@ type SearchPaletteProps = {
|
||||
workspaceId: string | null;
|
||||
};
|
||||
|
||||
export const SEARCH_PALETTE_ISLAND_CONTRACT = {
|
||||
shellOwner: "mnote-web",
|
||||
runtimeRole: "react_interaction_island",
|
||||
island: "search_palette",
|
||||
transport: "/api/search/documents",
|
||||
} as const;
|
||||
|
||||
const SearchPaletteRuntime = dynamic<SearchPaletteProps>(
|
||||
() => import("./search-palette.runtime").then((mod) => mod.SearchPalette),
|
||||
{
|
||||
@@ -46,5 +53,13 @@ export function SearchPaletteHost({ workspaceId }: SearchPaletteProps) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return <SearchPaletteRuntime workspaceId={workspaceId} />;
|
||||
return (
|
||||
<div
|
||||
data-react-island={SEARCH_PALETTE_ISLAND_CONTRACT.island}
|
||||
data-runtime-role={SEARCH_PALETTE_ISLAND_CONTRACT.runtimeRole}
|
||||
data-shell-owner={SEARCH_PALETTE_ISLAND_CONTRACT.shellOwner}
|
||||
>
|
||||
<SearchPaletteRuntime workspaceId={workspaceId} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user