删除AGC退役后零引用的真实E2E harness 导出与函数
- runtime-state.mjs 删除只被已删套件使用的 4 个 schema 常量(runProfileBinding / autonomousCompletionContract / autonomousPlaytestReceipt / autonomousGameBuildRunProfile) - assertions/runtime.mjs 删除 runtimePublicStatusMessageId - harness/project.mjs 删除 productionDefaultGameIndexHtml - collaboration-policy.mjs 删除 validateSupervisorSwarmIsolatedSpawnInput 及其专属的静态隔离校验函数族 - persistence.mjs 删除 5 个 supervisorSwarmIsolated*Identity 函数 - 移除随之失去用途的 import(hashJsonValue、isolatedJoinDeliveryTarget、supervisorSwarmIsolatedReviews)
This commit is contained in:
@@ -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}`)
|
||||
|
||||
@@ -396,23 +396,6 @@ export function seededGameHtml() {
|
||||
`;
|
||||
}
|
||||
|
||||
export function productionDefaultGameIndexHtml() {
|
||||
return `<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Genarrative Game Draft</title>
|
||||
<style>
|
||||
body { margin: 0; display: grid; min-height: 100vh; place-items: center; background: #101827; color: #d9e7ff; font: 16px system-ui, sans-serif; }
|
||||
main { width: min(720px, calc(100vw - 32px)); }
|
||||
</style>
|
||||
</head>
|
||||
<body><main>还没有生成游戏。回到聊天输入创意并确认生成后,这里会写入可试玩原型。</main></body>
|
||||
</html>
|
||||
`;
|
||||
}
|
||||
|
||||
export function buildTaskPrompt(suite) {
|
||||
const editorAssetOutcome =
|
||||
suite === 'full'
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
-159
@@ -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 {
|
||||
|
||||
-100
@@ -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) =>
|
||||
|
||||
Reference in New Issue
Block a user