1
This commit is contained in:
@@ -2503,6 +2503,34 @@ test('custom world works endpoint returns draft sessions and published worlds to
|
||||
|
||||
assert.equal(publishResponse.status, 200);
|
||||
|
||||
const publishMutationResponse = await httpRequest(
|
||||
`${baseUrl}/api/runtime/custom-world-library/world-published/publish`,
|
||||
withBearer(entry.token, {
|
||||
method: 'POST',
|
||||
}),
|
||||
);
|
||||
|
||||
assert.equal(publishMutationResponse.status, 200);
|
||||
|
||||
const draftOnlyResponse = await httpRequest(
|
||||
`${baseUrl}/api/runtime/custom-world-library/world-draft-only`,
|
||||
withBearer(entry.token, {
|
||||
method: 'PUT',
|
||||
body: JSON.stringify({
|
||||
profile: {
|
||||
id: 'world-draft-only',
|
||||
name: '旧兼容草稿',
|
||||
subtitle: '仍保留在作品库,但不再进入创作中心',
|
||||
summary: '这个条目用来验证阶段三不会继续把 library draft 当主草稿展示。',
|
||||
playableNpcs: [{ id: 'hero-draft', name: '旧草稿角色' }],
|
||||
landmarks: [{ id: 'port-draft', name: '旧草稿地点' }],
|
||||
},
|
||||
}),
|
||||
}),
|
||||
);
|
||||
|
||||
assert.equal(draftOnlyResponse.status, 200);
|
||||
|
||||
const worksResponse = await httpRequest(
|
||||
`${baseUrl}/api/runtime/custom-world/works`,
|
||||
{
|
||||
@@ -2542,6 +2570,10 @@ test('custom world works endpoint returns draft sessions and published worlds to
|
||||
item.canEnterWorld === true,
|
||||
),
|
||||
);
|
||||
assert.equal(
|
||||
worksPayload.items.some((item) => item.profileId === 'world-draft-only'),
|
||||
false,
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -3038,6 +3070,117 @@ test('custom world agent update_draft_card action updates draft profile and card
|
||||
);
|
||||
});
|
||||
|
||||
test('custom world agent sync_result_profile action writes result snapshot back over http', async () => {
|
||||
await withTestServer(
|
||||
'custom-world-agent-sync-result-profile-http',
|
||||
async ({ baseUrl, context }) => {
|
||||
installTestCustomWorldAgentSingleTurnLlm(context);
|
||||
const entry = await authEntry(
|
||||
baseUrl,
|
||||
'cw_agent_sync_result',
|
||||
'secret123',
|
||||
);
|
||||
const session = await createObjectRefiningCustomWorldAgentSession({
|
||||
baseUrl,
|
||||
token: entry.token,
|
||||
});
|
||||
|
||||
const actionResponse = await httpRequest(
|
||||
`${baseUrl}/api/runtime/custom-world/agent/sessions/${encodeURIComponent(session.sessionId)}/actions`,
|
||||
withBearer(entry.token, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify({
|
||||
action: 'sync_result_profile',
|
||||
profile: {
|
||||
id: `agent-draft-${session.sessionId}`,
|
||||
settingText: '被海雾吞没的旧航路群岛',
|
||||
name: '潮雾列岛·结果页回写版',
|
||||
subtitle: '旧灯塔与失控航路',
|
||||
summary: '结果页里的最新世界概述已经回写到当前草稿。',
|
||||
tone: '压抑、潮湿、悬疑',
|
||||
playerGoal: '查清沉船夜与假航灯背后的操盘链。',
|
||||
templateWorldType: 'WUXIA',
|
||||
majorFactions: ['守灯会', '航运公会'],
|
||||
coreConflicts: ['守灯会与航运公会争夺旧航路控制权'],
|
||||
attributeSchema: {
|
||||
id: 'schema:test',
|
||||
worldId: 'CUSTOM',
|
||||
schemaVersion: 1,
|
||||
schemaName: '测试',
|
||||
generatedFrom: {
|
||||
worldType: 'CUSTOM',
|
||||
worldName: '潮雾列岛·结果页回写版',
|
||||
settingSummary: '测试',
|
||||
tone: '测试',
|
||||
conflictCore: '测试',
|
||||
},
|
||||
slots: [],
|
||||
},
|
||||
playableNpcs: [],
|
||||
storyNpcs: [],
|
||||
items: [],
|
||||
landmarks: [],
|
||||
generationMode: 'full',
|
||||
generationStatus: 'complete',
|
||||
},
|
||||
}),
|
||||
}),
|
||||
);
|
||||
const actionPayload = (await actionResponse.json()) as {
|
||||
operation: {
|
||||
operationId: string;
|
||||
status: string;
|
||||
};
|
||||
};
|
||||
|
||||
assert.equal(actionResponse.status, 200);
|
||||
assert.equal(actionPayload.operation.status, 'queued');
|
||||
|
||||
await waitForCustomWorldAgentOperation({
|
||||
baseUrl,
|
||||
token: entry.token,
|
||||
sessionId: session.sessionId,
|
||||
operationId: actionPayload.operation.operationId,
|
||||
expectedStatus: 'completed',
|
||||
});
|
||||
|
||||
const sessionResponse = await httpRequest(
|
||||
`${baseUrl}/api/runtime/custom-world/agent/sessions/${encodeURIComponent(session.sessionId)}`,
|
||||
{
|
||||
headers: {
|
||||
Authorization: `Bearer ${entry.token}`,
|
||||
},
|
||||
},
|
||||
);
|
||||
const sessionPayload = (await sessionResponse.json()) as {
|
||||
draftProfile: {
|
||||
name?: string;
|
||||
summary?: string;
|
||||
legacyResultProfile?: {
|
||||
name?: string;
|
||||
playerGoal?: string;
|
||||
};
|
||||
} | null;
|
||||
};
|
||||
|
||||
assert.equal(sessionResponse.status, 200);
|
||||
assert.equal(sessionPayload.draftProfile?.name, '潮雾列岛·结果页回写版');
|
||||
assert.equal(
|
||||
sessionPayload.draftProfile?.summary,
|
||||
'结果页里的最新世界概述已经回写到当前草稿。',
|
||||
);
|
||||
assert.equal(
|
||||
sessionPayload.draftProfile?.legacyResultProfile?.name,
|
||||
'潮雾列岛·结果页回写版',
|
||||
);
|
||||
assert.equal(
|
||||
sessionPayload.draftProfile?.legacyResultProfile?.playerGoal,
|
||||
'查清沉船夜与假航灯背后的操盘链。',
|
||||
);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
test('custom world agent generate_characters action appends character cards over http', async () => {
|
||||
await withTestServer(
|
||||
'custom-world-agent-phase4-generate-characters-http',
|
||||
|
||||
Reference in New Issue
Block a user