feat(web): W4-A wire console to real endpoints

- Agent page uses contracts (AgentRun/AgentRunDetail/AgentGoalReport) instead of a local
  mirror; ?mock=1 stays as an explicit demo switch; run snapshot refreshes on agent.run_status;
  stream auto-follow only while the user stays near the bottom (abort stays reachable)
- settings: Pi provider select incl. fake, new Agent runtime card (budgets, fakeScript)
- download trace uses /tasks?subjectId= and /organization-records?downloadTaskId= instead of
  time-window engine run matching and path matching; new business-task tab with cancel/retry
- workbench download dialog posts /acquisition-plans and shows per-slot rejection reasons
- preference tag revision history; subscription search by title/kind; identity/alias/subscription
  lists show entity titles; slot cards show current asset summary; policy preview sample titles
- DecisionSummary / IdentityRevisionList / ReleaseIdentityResult / TaskAccepted / PolicyPreviewSummary /
  OrganizePlanArtifactContent taken from contracts
- docs: SSE for console (cookie) vs GET /events?after=&limit= JSON replay for API keys

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
rootandClaude Opus 5.5 committed 2026-09-27 21:32:11 +08:00
1 parent 34e8751b45
commit 1023642ef9
30 files changed
+703 -271

No files matched your search

+7 -9
View File
@@ -4,7 +4,6 @@ import { useState } from "react";
import { useNavigate } from "react-router";
import { toast } from "sonner";
import { type AgentRunView, agentMockEnabled, RUN_STATUS_LABEL, useAgentRuns, useCreateAgentRun } from "~/api/agent.ts";
import { isMissingEndpoint } from "~/api/parse.ts";
import { RunStatusBadge } from "~/components/agent/agent-conversation.tsx";
import { GoalComposer } from "~/components/agent/agent-run-panel.tsx";
import { type DataColumn, DataTable } from "~/components/console/data-table.tsx";
@@ -47,7 +46,6 @@ export default function AgentPage() {
const create = useCreateAgentRun();
const navigate = useNavigate();
const mock = agentMockEnabled();
const missing = !mock && isMissingEndpoint(runs.error);
const rows = runs.data?.pages.flatMap((p) => p.items);
return (
@@ -56,12 +54,12 @@ export default function AgentPage() {
title="Agent 会话"
description="交代目标,Agent 在授权范围内边执行边汇报;只要方案时,它只调查不执行。"
/>
{missing ? (
{mock ? (
<div className="mb-4 flex flex-wrap items-center gap-3 rounded-xl border border-warning/40 bg-warning/10 px-4 py-3 text-caption text-warning">
<FlaskConical className="h-4 w-4 shrink-0" />
<span className="min-w-0 flex-1">Agent 会话端点还没上线(W2-D 实现中)。可以先用 mock 数据预览交互。</span>
<Button variant="outline" size="sm" onClick={() => window.location.assign("/console/agent?mock=1")}>
用 mock 预览
<span className="min-w-0 flex-1">演示模式:会话是本地假数据,不连后端,不会产生任何动作。</span>
<Button variant="outline" size="sm" onClick={() => window.location.assign("/console/agent?mock=0")}>
退出演示
</Button>
</div>
) : null}
@@ -89,14 +87,14 @@ export default function AgentPage() {
</FilterBar>
<DataTable
columns={COLUMNS}
rows={missing ? [] : rows}
rows={rows}
rowKey={(r) => r.id}
loading={runs.isPending}
error={missing ? undefined : runs.error}
error={runs.error}
onRetry={() => void runs.refetch()}
empty={{
icon: Bot,
title: missing ? "会话端点未就绪" : "还没有会话",
title: "还没有会话",
description: "例如:“把某部电影的 1080p 收进来”,或在任意页面右上角打开 Agent 侧栏。",
}}
onRowClick={(r) => navigate(`/console/agent/${r.id}${mock ? "?mock=1" : ""}`)}