feat: add task artifact validation for code runs

This commit is contained in:
Your Name
2026-07-02 12:31:29 +08:00
parent 201cc5fb7a
commit 7a47dc6a98
5 changed files with 251 additions and 14 deletions
+8 -2
View File
@@ -13,6 +13,7 @@ import {
uploadMindSpaceAsset,
subscribeSessionEvents,
} from '../api/client';
import type { AgentRun } from '../api/client';
import type { ChatState, Message, MindSpaceChatContext, PortalUser, Session, SessionEvent } from '../types';
import { buildContextPrefix } from '../utils/mindspaceChatContext';
import { buildUserAddressPrefix } from '../utils/userAddress';
@@ -29,8 +30,8 @@ import {
pushMessage,
} from '../utils/message';
async function waitForAgentRun(runId: string) {
return await new Promise((resolve, reject) => {
async function waitForAgentRun(runId: string): Promise<AgentRun> {
return await new Promise<AgentRun>((resolve, reject) => {
const unsubscribe = subscribeAgentRunEvents(
runId,
(run) => {
@@ -349,6 +350,11 @@ export function usePageEditSubChat({
forceCode: true,
userId: user?.id ?? null,
requestId,
mindspaceContext: context,
pageEdit: {
pageId,
pageTitle,
},
}),
);
const finishedRun =
+4 -2
View File
@@ -24,6 +24,7 @@ import {
syncUserMemory,
updateProvider,
} from '../api/client';
import type { AgentRun } from '../api/client';
import { appConfig } from '../config';
import {
clearStoredSessionId,
@@ -74,8 +75,8 @@ const FINISH_SYNC_RETRY_DELAYS_MS = [500, 1500, 3000];
const ACTIVE_REQUEST_MISSING_GRACE_MS = 2500;
export { INSUFFICIENT_BALANCE_NOTICE };
async function waitForAgentRun(runId: string) {
return await new Promise((resolve, reject) => {
async function waitForAgentRun(runId: string): Promise<AgentRun> {
return await new Promise<AgentRun>((resolve, reject) => {
const unsubscribe = subscribeAgentRunEvents(
runId,
(run) => {
@@ -1177,6 +1178,7 @@ export function useTKMindChat(
taskType: 'h5_chat_code_task',
userId: userRef.current?.id ?? null,
requestId,
mindspaceContext: options?.mindspaceContext ?? null,
}),
);
const finishedRun =