feat: complete mindspace conversation packages

This commit is contained in:
john
2026-07-02 23:46:05 +08:00
parent b084f6d23c
commit b258004dad
31 changed files with 1990 additions and 118 deletions
+49
View File
@@ -98,6 +98,24 @@ test('createConversationArtifact preserves unknown size as null', () => {
assert.equal(artifact.sizeBytes, null);
});
test('createConversationArtifact keeps sort order inside MySQL INT range', () => {
const artifact = createConversationArtifact({
packageId: 'cp_1',
artifactKind: 'public_html',
sortOrder: 1783003000123,
now: 1000,
});
assert.equal(artifact.sortOrder, 1783003000);
const clamped = createConversationArtifact({
packageId: 'cp_1',
artifactKind: 'public_html',
sortOrder: Number.MAX_SAFE_INTEGER,
now: 1000,
});
assert.equal(clamped.sortOrder, 2147483647);
});
test('buildConversationPackageManifest sorts artifacts and emits stable public shape', () => {
const manifest = buildConversationPackageManifest({
packageRecord: {
@@ -113,6 +131,8 @@ test('buildConversationPackageManifest sorts artifacts and emits stable public s
artifactKind: 'page',
displayName: '项目周报',
pageId: 'page-1',
messageId: 'msg-2',
agentRunId: 'run-1',
sortOrder: 2,
createdAt: 3000,
},
@@ -120,6 +140,7 @@ test('buildConversationPackageManifest sorts artifacts and emits stable public s
id: 'ca_first',
artifactKind: 'input_image',
displayName: 'cover.png',
messageId: 'msg-1',
sortOrder: 1,
createdAt: 2000,
},
@@ -129,6 +150,8 @@ test('buildConversationPackageManifest sorts artifacts and emits stable public s
displayName: 'report.html',
pageId: 'page-1',
publicationId: 'pub-1',
messageId: 'msg-2',
agentRunId: 'run-1',
canonicalUrl: 'https://m.tkmind.cn/MindSpace/user-1/public/report.html',
sortOrder: 3,
createdAt: 4000,
@@ -146,6 +169,7 @@ test('buildConversationPackageManifest sorts artifacts and emits stable public s
assert.deepEqual(manifest.artifacts[0], {
artifactId: 'ca_first',
kind: 'input_image',
messageId: 'msg-1',
displayName: 'cover.png',
sortOrder: 1,
createdAt: 2000,
@@ -170,4 +194,29 @@ test('buildConversationPackageManifest sorts artifacts and emits stable public s
updatedAt: 4000,
},
]);
assert.deepEqual(manifest.messages, [
{
messageId: 'msg-1',
artifactIds: ['ca_first'],
kinds: ['input_image'],
createdAt: 2000,
updatedAt: 2000,
},
{
messageId: 'msg-2',
artifactIds: ['ca_late', 'ca_public'],
kinds: ['page', 'public_html'],
createdAt: 3000,
updatedAt: 4000,
},
]);
assert.deepEqual(manifest.agentRuns, [
{
agentRunId: 'run-1',
artifactIds: ['ca_late', 'ca_public'],
kinds: ['page', 'public_html'],
createdAt: 3000,
updatedAt: 4000,
},
]);
});