feat(goal-run): add multi-checkpoint goal orchestration with H5 and admin surfaces.

Persist goal runs in MySQL, bind agent runs to checkpoints, expose awaiting-approval
UX in chat, and add admin inspection routes with local verify scripts.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-08-01 17:03:16 +08:00
parent 43bc8bbc2b
commit 666db0b939
47 changed files with 4417 additions and 4 deletions
+22
View File
@@ -1,6 +1,7 @@
import { useEffect, useMemo, useRef, useState } from 'react';
import { useChat } from '../context/ChatProvider';
import { INSUFFICIENT_BALANCE_NOTICE } from '../hooks/useTKMindChat';
import { useGoalRunBanner } from '../hooks/useGoalRunBanner';
import type { CapabilityMap, PortalUser, SessionSummary } from '../types';
import { useNetworkStatus } from '../hooks/useNetworkStatus';
import { getSessionDisplayName } from '../utils/sessions';
@@ -15,6 +16,7 @@ import { WechatBindPrompt } from './WechatBindPrompt';
import { WechatAccountButton } from './WechatAccountButton';
import { ChatHeaderMoreMenu } from './ChatHeaderMoreMenu';
import { NotificationCenter } from './NotificationCenter';
import { GoalRunAwaitingBanner } from './GoalRunAwaitingBanner';
import type { MindSpaceSaveCategory } from '../types';
function RecentSessionRail({
@@ -212,8 +214,18 @@ export function ChatView({
openSubscribe,
uploadChatImage,
uploadChatAttachment,
followAgentRun,
goalRunEnabled,
} = useChat();
const online = useNetworkStatus();
const goalRunBanner = useGoalRunBanner({
userId: user?.id,
sessionId: session?.id,
chatState,
submit,
followAgentRun,
featureEnabled: goalRunEnabled,
});
const [sidebarOpen, setSidebarOpen] = useState(false);
const [packagePanelSession, setPackagePanelSession] = useState<SessionSummary | null>(null);
const [armedSessionId, setArmedSessionId] = useState<string | null>(null);
@@ -487,6 +499,16 @@ export function ChatView({
{user && <WechatBindPrompt returnTo={window.location.pathname} />}
{goalRunBanner.enabled && (
<GoalRunAwaitingBanner
items={goalRunBanner.items}
busy={goalRunBanner.bannerBusy}
onContinue={goalRunBanner.handleContinue}
onDismiss={goalRunBanner.dismissItem}
onRefresh={goalRunBanner.refresh}
/>
)}
{typeof balanceCents === 'number' && balanceCents <= 0 && (
<div className="banner banner-error">
<span>余额不足,请充值后继续使用</span>