refactor: organize supply frontend structure

This commit is contained in:
2026-07-22 18:16:43 +08:00
parent 699a0bced4
commit b9bc9c3d39
96 changed files with 917 additions and 745 deletions
@@ -1,9 +1,7 @@
"use client";
import { ChevronRight } from "lucide-react";
import type { PersonaState } from "@/shared/ai-elements/persona";
import { cn } from "@/lib/utils";
import { MAP_MAJOR_PANEL_RADIUS_CLASS_NAME } from "@/features/map/core/components/map-control-styles";
import { cn } from "@/shared/ui/cn";
import { MAP_MAJOR_PANEL_RADIUS_CLASS_NAME } from "@/features/map/core";
import { AgentPersona } from "./agent-persona";
type AgentCollapsedRailProps = {
@@ -1,5 +1,3 @@
"use client";
import {
Activity,
CheckCircle2,
@@ -23,7 +21,7 @@ import { AnimatePresence, MotionConfig, motion, useReducedMotion } from "motion/
import { useCallback, useEffect, useMemo, useRef, useState, type ReactNode } from "react";
import { createPortal } from "react-dom";
import { useStickToBottomContext } from "use-stick-to-bottom";
import { showMapNotice } from "@/features/map/core/components/notice-actions";
import { showMapNotice } from "@/features/map/core";
import { Agent, AgentContent } from "@/shared/ai-elements/agent";
import {
Conversation,
@@ -48,7 +46,7 @@ import {
DropdownMenuTrigger
} from "@/shared/ui/dropdown-menu";
import { Button } from "@/shared/ui/button";
import { cn } from "@/lib/utils";
import { cn } from "@/shared/ui/cn";
import type { AgentChatSessionSummary } from "../api/client";
import { AgentPersona } from "./agent-persona";
import {
@@ -1,10 +1,8 @@
"use client";
import { Check, Loader2, Pencil, RefreshCw, Trash2, X } from "lucide-react";
import { AnimatePresence, motion } from "motion/react";
import { useState } from "react";
import { Input } from "@/shared/ui/input";
import { cn } from "@/lib/utils";
import { cn } from "@/shared/ui/cn";
import type { AgentChatSessionSummary } from "../api/client";
import {
agentLayoutTransition,
@@ -1,5 +1,3 @@
"use client";
import {
CheckCircle2,
ChevronDown,
@@ -13,7 +11,7 @@ import {
} from "lucide-react";
import { AnimatePresence, motion } from "motion/react";
import { useState, type ReactNode } from "react";
import { cn } from "@/lib/utils";
import { cn } from "@/shared/ui/cn";
import { Button } from "@/shared/ui/button";
import {
agentEase,
@@ -1,5 +1,3 @@
"use client";
import type { Variants } from "motion/react";
export const AGENT_MOTION_DURATION_MS = 180;
@@ -1,5 +1,3 @@
"use client";
import {
ClipboardCheck,
Crosshair,
@@ -8,7 +6,7 @@ import {
Route
} from "lucide-react";
import type { ReactNode } from "react";
import { cn } from "@/lib/utils";
import { cn } from "@/shared/ui/cn";
import type {
AgentChatMessage
} from "../types";
@@ -1,7 +1,7 @@
import { Bot } from "lucide-react";
import { lazy, Suspense, useCallback, useEffect, useRef, useState } from "react";
import type { PersonaState } from "@/shared/ai-elements/persona";
import { cn } from "@/lib/utils";
import { cn } from "@/shared/ui/cn";
const LazyPersona = lazy(async () => {
const module = await import("@/shared/ai-elements/persona");
@@ -1,9 +1,7 @@
"use client";
import { Activity, BarChart3, Database, History, LineChart, MonitorCog } from "lucide-react";
import { AnimatePresence, MotionConfig, motion } from "motion/react";
import type { ReactNode } from "react";
import { cn } from "@/lib/utils";
import { cn } from "@/shared/ui/cn";
import { normalizeSafeChartData, parseChartSpec, type SafeChartData, type SafeChartSeries, type SafeChartSpec } from "../chart-data";
import type { AgentUiResult } from "../types";
import type { UIEnvelope } from "../ui-envelope";
@@ -1,6 +1,4 @@
"use client";
import { cn } from "@/lib/utils";
import { cn } from "@/shared/ui/cn";
import { MessageResponse } from "@/shared/ai-elements/message";
type StreamingTokenResponseProps = {
@@ -1,5 +1,3 @@
"use client";
import { useCallback, useEffect, useRef, useState, useSyncExternalStore } from "react";
import {
splitSpeechTextIntoChunks,
+42 -5
View File
@@ -1,15 +1,56 @@
export { AgentCollapsedRail } from "./components/agent-collapsed-rail";
export { AgentCommandPanel } from "./components/agent-command-panel";
export { AgentPersona } from "./components/agent-persona";
export { createAgentApiClient } from "./api/client";
export type {
AgentApiClient,
AgentChatSessionSummary,
AgentLoadedChatSession,
AgentSessionStreamEvent
} from "./api/client";
export {
agentBootstrapKey,
agentSessionsKey,
fetchAgentBootstrap,
fetchAgentSessions,
type AgentBootstrapData
} from "./api/swr";
export { normalizeSafeChartData, parseChartSpec, pointToLabelValue } from "./chart-data";
export {
FRONTEND_ACTION_NAMES,
parseFrontendActionRegistry,
parseFrontendActionRequest,
readActionResults,
storeActionResult,
type FrontendActionName,
type FrontendActionRegistry,
type FrontendActionRequest,
type FrontendActionResult
} from "./frontend-action";
export { FrontendActionExecutor } from "./frontend-action/executor";
export {
applyPermissionResponse,
applyQuestionResponse,
cancelRunningTodos,
completeRunningProgress,
finalizeAssistantMessageAfterAbort,
toTodoUpdate,
upsertPermission,
upsertProgress,
upsertQuestion
} from "./session-state";
export {
isUiEnvelopeAllowed,
parseUiEnvelope,
parseUiEnvelopePayload,
parseUiRegistry,
toTrustedMapAction,
type TrustedMapAction,
type UIEnvelope,
type UIEnvelopePayload,
type UIRegistry,
type UISurface
} from "./ui-envelope";
export type {
AgentApprovalMode,
AgentChatMessage,
@@ -28,8 +69,4 @@ export type {
AgentTodoUpdate,
AgentUiResult
} from "./types";
export type {
SafeChartData,
SafeChartSeries,
SafeChartSpec
} from "./chart-data";
export type { SafeChartData, SafeChartSeries, SafeChartSpec } from "./chart-data";