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:
1 parent
34e8751b45
commit
1023642ef9
30 files changed
+703
-271
No files matched your search
@@ -5,13 +5,14 @@ import {
|
||||
type IdentityCandidateReason,
|
||||
type IdentityCandidateStatus,
|
||||
IdentityPoolItem,
|
||||
IdentityRevision,
|
||||
IdentityRevisionList,
|
||||
type IdentityStatus,
|
||||
type ReleaseIdentityAssign,
|
||||
ReleaseIdentityResult,
|
||||
TaskAccepted,
|
||||
TitleAlias,
|
||||
type TitleAliasCreate,
|
||||
} from "@umt/contracts";
|
||||
import { z } from "zod";
|
||||
import { api } from "~/lib/api.ts";
|
||||
import { getParsed, parseOrThrow } from "./library.ts";
|
||||
|
||||
@@ -32,8 +33,6 @@ export type AliasFilters = { mediaEntityId?: string; q?: string };
|
||||
const PoolPage = cursorPage(IdentityPoolItem);
|
||||
const IdentityPage = cursorPage(ExternalIdentity);
|
||||
const AliasPage = cursorPage(TitleAlias);
|
||||
/** 服务端返回 { items }(无 nextCursor);兼容数组与分页两种形状 */
|
||||
const RevisionList = z.union([z.array(IdentityRevision), z.object({ items: z.array(IdentityRevision) })]);
|
||||
|
||||
export function useIdentityPool(filters: PoolFilters) {
|
||||
return useInfiniteQuery({
|
||||
@@ -61,10 +60,8 @@ export function useIdentityRevisions(id: string | undefined) {
|
||||
return useQuery({
|
||||
queryKey: identityKeys.revisions(id ?? ""),
|
||||
enabled: !!id,
|
||||
queryFn: async ({ signal }) => {
|
||||
const r = await getParsed(RevisionList, `/external-identities/${id}/revisions`, undefined, signal);
|
||||
return Array.isArray(r) ? r : r.items;
|
||||
},
|
||||
queryFn: async ({ signal }) =>
|
||||
(await getParsed(IdentityRevisionList, `/external-identities/${id}/revisions`, undefined, signal)).items,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -94,7 +91,9 @@ export function useAssignPool() {
|
||||
const done = useInvalidate();
|
||||
return useMutation({
|
||||
mutationFn: ({ id, ...body }: ReleaseIdentityAssign & { id: string }) =>
|
||||
api.post<unknown>(`/identity-pool/${id}/assign`, body),
|
||||
api
|
||||
.post<unknown>(`/identity-pool/${id}/assign`, body)
|
||||
.then((d) => parseOrThrow(ReleaseIdentityResult, d, "/identity-pool/assign")),
|
||||
onSuccess: done,
|
||||
});
|
||||
}
|
||||
@@ -111,7 +110,10 @@ export function useDismissPool() {
|
||||
export function useRetryPool() {
|
||||
const done = useInvalidate();
|
||||
return useMutation({
|
||||
mutationFn: (id: string) => api.post<unknown>(`/identity-pool/${id}/retry`),
|
||||
mutationFn: (id: string) =>
|
||||
api
|
||||
.post<unknown>(`/identity-pool/${id}/retry`)
|
||||
.then((d) => parseOrThrow(TaskAccepted, d, "/identity-pool/retry")),
|
||||
onSuccess: done,
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user