diff --git a/apps/ai-game-creator-shell/scripts/agent-runtime-real-e2e/assertions/runtime.mjs b/apps/ai-game-creator-shell/scripts/agent-runtime-real-e2e/assertions/runtime.mjs index 4b49e89d9..ee48a17c4 100644 --- a/apps/ai-game-creator-shell/scripts/agent-runtime-real-e2e/assertions/runtime.mjs +++ b/apps/ai-game-creator-shell/scripts/agent-runtime-real-e2e/assertions/runtime.mjs @@ -2419,24 +2419,6 @@ export function finalMessageId(agentId, sessionId, runId) { ).slice(0, 32)}`; } -export function runtimePublicStatusMessageId( - agentId, - sessionId, - runId, - status, -) { - const correlationId = runtimeMessageCorrelationId( - agentId, - sessionId, - runId, - ).slice(0, 32); - const statusFingerprint = createHash('sha256') - .update(status) - .digest('hex') - .slice(0, 16); - return `runtime-public-status-${correlationId}-${statusFingerprint}`; -} - export function backgroundTaskMessageId(agentId, sessionId, runId, source) { const fingerprint = createHash('sha256') .update(`${agentId}\n${sessionId}\n${runId}\n${source}`) diff --git a/apps/ai-game-creator-shell/scripts/agent-runtime-real-e2e/harness/project.mjs b/apps/ai-game-creator-shell/scripts/agent-runtime-real-e2e/harness/project.mjs index 9f787680f..883e5fbea 100644 --- a/apps/ai-game-creator-shell/scripts/agent-runtime-real-e2e/harness/project.mjs +++ b/apps/ai-game-creator-shell/scripts/agent-runtime-real-e2e/harness/project.mjs @@ -396,23 +396,6 @@ export function seededGameHtml() { `; } -export function productionDefaultGameIndexHtml() { - return ` - - - - - Genarrative Game Draft - - -
还没有生成游戏。回到聊天输入创意并确认生成后,这里会写入可试玩原型。
- -`; -} - export function buildTaskPrompt(suite) { const editorAssetOutcome = suite === 'full' diff --git a/apps/ai-game-creator-shell/scripts/agent-runtime-real-e2e/runtime-state.mjs b/apps/ai-game-creator-shell/scripts/agent-runtime-real-e2e/runtime-state.mjs index a542f9e8a..88e662cfc 100644 --- a/apps/ai-game-creator-shell/scripts/agent-runtime-real-e2e/runtime-state.mjs +++ b/apps/ai-game-creator-shell/scripts/agent-runtime-real-e2e/runtime-state.mjs @@ -190,17 +190,6 @@ export const providerRequestLifecycleSchemaVersion = export const providerActionBatchSchemaVersion = 'game-creator-provider-action-batch.v2'; -export const runProfileBindingSchemaVersion = - 'game-creator-run-profile-binding.v1'; - -export const autonomousCompletionContractSchemaVersion = - 'game-creator-autonomous-completion-contract.v2'; - -export const autonomousPlaytestReceiptSchemaVersion = - 'game-creator-autonomous-playtest-receipt.v2'; - -export const autonomousGameBuildRunProfile = 'autonomous-game-build'; - export const supervisorCollaborationPolicySchemaVersion = 'game-creator-supervisor-collaboration-policy.v1'; diff --git a/apps/ai-game-creator-shell/scripts/agent-runtime-real-e2e/suites/supervisor-swarm/collaboration-policy.mjs b/apps/ai-game-creator-shell/scripts/agent-runtime-real-e2e/suites/supervisor-swarm/collaboration-policy.mjs index fd13dbbdd..da6f06b93 100644 --- a/apps/ai-game-creator-shell/scripts/agent-runtime-real-e2e/suites/supervisor-swarm/collaboration-policy.mjs +++ b/apps/ai-game-creator-shell/scripts/agent-runtime-real-e2e/suites/supervisor-swarm/collaboration-policy.mjs @@ -27,7 +27,6 @@ import { supervisorCollaborationPolicySnapshotSchemaVersion, supervisorSwarmDesignAgentId, supervisorSwarmDesignPath, - supervisorSwarmIsolatedReviews, supervisorSwarmQualityAgentId, supervisorSwarmQualityPath, supervisorSwarmSessionId, @@ -67,164 +66,6 @@ export function assertSupervisorSwarmContractShape( ); } -export function supervisorSwarmIsolatedWriteScopeRoots(children) { - const roots = children.map((child) => { - assert( - Array.isArray(child.writeScopes) && - child.writeScopes.length === 1 && - isNonEmptyString(child.writeScopes[0]) && - child.writeScopes[0].endsWith('/**'), - 'supervisor-swarm-mixed-child-write-scope-invalid', - ); - const root = child.writeScopes[0].slice(0, -3); - assert( - isNonEmptyString(root) && - !path.posix.isAbsolute(root) && - path.posix.normalize(root) === root && - !root.split('/').includes('..') && - !['.agent', '.git'].some( - (privateRoot) => - root === privateRoot || root.startsWith(`${privateRoot}/`), - ), - 'supervisor-swarm-mixed-child-write-scope-unsafe', - ); - return root; - }); - for (let leftIndex = 0; leftIndex < roots.length; leftIndex += 1) { - for ( - let rightIndex = leftIndex + 1; - rightIndex < roots.length; - rightIndex += 1 - ) { - const left = roots[leftIndex]; - const right = roots[rightIndex]; - assert( - left !== right && - !left.startsWith(`${right}/`) && - !right.startsWith(`${left}/`), - 'supervisor-swarm-mixed-child-write-scopes-overlap', - ); - } - } - return roots; -} - -export function supervisorSwarmIsolatedReviewGroupIndex( - children, - reviewGroups = [supervisorSwarmIsolatedReviews], -) { - if (!Array.isArray(children) || children.length === 0) return -1; - const actualPaths = children - .map((child) => child?.expectedArtifacts?.[0]) - .filter(isNonEmptyString) - .sort(); - if (actualPaths.length !== children.length) return -1; - return reviewGroups.findIndex( - (reviews) => - JSON.stringify(actualPaths) === - JSON.stringify(reviews.map((review) => review.path).sort()), - ); -} - -export function supervisorSwarmIsolatedReviewsForGroupIndex( - groupIndex, - reviewGroups = [supervisorSwarmIsolatedReviews], -) { - const reviews = reviewGroups[groupIndex]; - assert( - Array.isArray(reviews) && reviews.length > 0, - 'supervisor-swarm-mixed-review-group-index-invalid', - ); - return reviews; -} - -export function assertSupervisorSwarmIsolatedChildBusinessContract( - child, - review, -) { - const contract = [child.task, ...(child.acceptanceCriteria ?? [])] - .join('\n') - .toLowerCase(); - assert( - review.boundaryTerms.some((term) => contract.includes(term)) && - /read[- ]?only|audit[- ]?only|do not (?:change|modify|write)|leave [^\n]* unchanged|只读|不得修改|不要修改/iu.test( - contract, - ), - 'supervisor-swarm-mixed-child-business-boundary-invalid', - ); -} - -export function validateSupervisorSwarmIsolatedSpawnInput( - input, - groupIndex, - codePrefix, - reviewGroups = [supervisorSwarmIsolatedReviews], -) { - const reviews = supervisorSwarmIsolatedReviewsForGroupIndex( - groupIndex, - reviewGroups, - ); - assert( - isPlainObject(input) && - JSON.stringify(Object.keys(input).sort()) === - JSON.stringify(['children', 'joinMode'].sort()) && - input.joinMode === 'all' && - Array.isArray(input.children) && - input.children.length === reviews.length && - supervisorSwarmIsolatedReviewGroupIndex(input.children, reviewGroups) === - groupIndex, - `${codePrefix}-spawn-action-invalid`, - ); - const expectedPaths = new Set(reviews.map((review) => review.path)); - for (const child of input.children) { - const review = reviews.find( - (candidate) => candidate.path === child?.expectedArtifacts?.[0], - ); - assert( - isPlainObject(child) && - JSON.stringify(Object.keys(child).sort()) === - JSON.stringify( - [ - 'templateAgentId', - 'task', - 'acceptanceCriteria', - 'expectedArtifacts', - 'writeScopes', - ].sort(), - ), - `${codePrefix}-child-shape-invalid`, - ); - assert( - isNonEmptyString(child.templateAgentId), - `${codePrefix}-child-template-invalid`, - ); - assert( - isNonEmptyString(child.task) && - Array.isArray(child.acceptanceCriteria) && - child.acceptanceCriteria.length > 0 && - child.acceptanceCriteria.every(isNonEmptyString), - `${codePrefix}-child-task-contract-invalid`, - ); - assert( - Array.isArray(child.expectedArtifacts) && - child.expectedArtifacts.length === 1 && - review != null && - expectedPaths.delete(child.expectedArtifacts[0]), - `${codePrefix}-child-artifact-contract-invalid`, - ); - assert( - Array.isArray(child.writeScopes) && - child.writeScopes.length === 1 && - child.writeScopes[0] === review.scope, - `${codePrefix}-child-write-scope-count-invalid`, - ); - assertSupervisorSwarmIsolatedChildBusinessContract(child, review); - } - supervisorSwarmIsolatedWriteScopeRoots(input.children); - assert(expectedPaths.size === 0, `${codePrefix}-child-boundaries-incomplete`); - return hashJsonValue(input); -} - export function supervisorSwarmCollaborationPolicySnapshotIdentity(snapshot) { if (!isPlainObject(snapshot)) return null; return { diff --git a/apps/ai-game-creator-shell/scripts/agent-runtime-real-e2e/suites/supervisor-swarm/persistence.mjs b/apps/ai-game-creator-shell/scripts/agent-runtime-real-e2e/suites/supervisor-swarm/persistence.mjs index 278c7acf3..c2ab0f2fc 100644 --- a/apps/ai-game-creator-shell/scripts/agent-runtime-real-e2e/suites/supervisor-swarm/persistence.mjs +++ b/apps/ai-game-creator-shell/scripts/agent-runtime-real-e2e/suites/supervisor-swarm/persistence.mjs @@ -6,10 +6,8 @@ import { codedError, collectPartialRuntimeJsonlSurface, fs, - hashJsonValue, hashValue, isNonEmptyString, - isolatedJoinDeliveryTarget, isPlainObject, listFiles, path, @@ -586,104 +584,6 @@ export function supervisorSwarmTaskIdentity(task) { }; } -export function supervisorSwarmIsolatedGroupIdentity(group) { - return { - schemaVersion: group.schemaVersion, - parentAgentId: group.parentAgentId, - parentSessionId: group.parentSessionId, - parentRunId: group.parentRunId, - parentActionId: group.parentActionId, - delegationGroupId: group.delegationGroupId, - joinRunId: group.joinRunId, - depth: group.depth, - joinMode: group.joinMode, - requestSha256: hashJsonValue(group.request ?? null), - instanceIds: [...(group.instanceIds ?? [])].sort(), - createdAt: group.createdAt, - }; -} - -export function supervisorSwarmIsolatedInstanceIdentity(instance) { - return { - schemaVersion: instance.schemaVersion, - parentAgentId: instance.parentAgentId, - parentSessionId: instance.parentSessionId, - parentRunId: instance.parentRunId, - parentActionId: instance.parentActionId, - delegationGroupId: instance.delegationGroupId, - delegationId: instance.delegationId, - childIndex: instance.childIndex, - instanceId: instance.instanceId, - templateAgentId: instance.templateAgentId, - sessionId: instance.sessionId, - runId: instance.runId, - depth: instance.depth, - taskSha256: hashValue(instance.task ?? ''), - acceptanceCriteriaSha256: hashValue( - JSON.stringify(instance.acceptanceCriteria ?? []), - ), - expectedArtifacts: instance.expectedArtifacts, - writeScopes: instance.writeScopes, - createdAt: instance.createdAt, - }; -} - -export function supervisorSwarmIsolatedResultIdentity(record) { - const result = record.result ?? {}; - return { - schemaVersion: record.schemaVersion, - delegationGroupId: record.delegationGroupId, - childIndex: record.childIndex, - delegationId: result.delegationId, - instanceId: result.instanceId, - templateAgentId: result.templateAgentId, - runId: result.runId, - status: result.status, - summarySha256: hashValue(result.summary ?? ''), - artifacts: result.artifacts, - evidenceSha256: hashValue(JSON.stringify(result.evidence ?? [])), - verifiedRevision: result.verifiedRevision ?? null, - errorSha256: result.error == null ? null : hashValue(result.error), - recordedAt: record.recordedAt, - }; -} - -export function supervisorSwarmIsolatedJoinIdentity(delivery) { - return { - schemaVersion: delivery.schemaVersion, - parentAgentId: delivery.parentAgentId, - parentRunId: delivery.parentRunId, - delegationGroupId: delivery.delegationGroupId, - joinRunId: delivery.joinRunId, - status: delivery.status, - deliveryTarget: isolatedJoinDeliveryTarget(delivery), - queuedRunId: delivery.queuedRunId ?? null, - claimedByActionId: delivery.claimedByActionId ?? null, - updatedAt: delivery.updatedAt, - }; -} - -export function supervisorSwarmIsolatedJoinClaimIdentity(claim) { - return { - schemaVersion: claim.schemaVersion, - parentAgentId: claim.parentAgentId, - parentRunId: claim.parentRunId, - actionId: claim.actionId, - status: claim.status, - joins: (claim.joins ?? []) - .map((join) => ({ - parentActionId: join.parentActionId, - delegationGroupId: join.delegationGroupId, - joinRunId: join.joinRunId, - source: join.source, - })) - .sort((left, right) => - left.delegationGroupId.localeCompare(right.delegationGroupId), - ), - updatedAt: claim.updatedAt, - }; -} - export function supervisorSwarmParentIsolatedRecords(persistence) { const groups = (persistence.isolatedGroups ?? []).filter( (group) =>