Expose conversation package manifests
This commit is contained in:
@@ -150,6 +150,46 @@ test('conversation package registry records artifacts and writes manifest throug
|
||||
]);
|
||||
});
|
||||
|
||||
test('conversation package registry reads manifest without writing storage', async () => {
|
||||
const root = await fs.mkdtemp(path.join(os.tmpdir(), 'mindspace-registry-'));
|
||||
const service = createMindSpaceServiceFacade({
|
||||
storageAdapter: createLocalMindSpaceStorageAdapter(root),
|
||||
publicBaseUrl: 'https://m.tkmind.cn',
|
||||
});
|
||||
const store = createConversationPackageStore(createFakePool());
|
||||
const registry = createConversationPackageRegistry({ store, service });
|
||||
const packageRecord = await registry.ensurePackage({
|
||||
userId: 'user-1',
|
||||
sessionId: 'session-1',
|
||||
title: '输入与页面',
|
||||
now: 1000,
|
||||
});
|
||||
await registry.recordArtifact({
|
||||
id: 'ca_image',
|
||||
packageId: packageRecord.id,
|
||||
artifactKind: 'input_image',
|
||||
displayName: 'cover.png',
|
||||
sortOrder: 1,
|
||||
now: 1000,
|
||||
});
|
||||
|
||||
const manifest = await registry.readManifestForSession({
|
||||
userId: 'user-1',
|
||||
sessionId: 'session-1',
|
||||
});
|
||||
|
||||
assert.equal(manifest.packageId, 'cp_session-1');
|
||||
assert.equal(manifest.title, '输入与页面');
|
||||
assert.deepEqual(
|
||||
manifest.artifacts.map((item) => item.kind),
|
||||
['input_image'],
|
||||
);
|
||||
assert.equal(
|
||||
await service.statPackageObject({ packageRecord, relativePath: 'manifest.json' }).then((stat) => stat.exists),
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
test('conversation package registry skips manifest writes for unknown sessions', async () => {
|
||||
const root = await fs.mkdtemp(path.join(os.tmpdir(), 'mindspace-registry-'));
|
||||
const registry = createConversationPackageRegistry({
|
||||
|
||||
Reference in New Issue
Block a user