fix: expose the projection registration async disposer
This commit is contained in:
1 parent
325c8d880a
commit
4e7193945d
4 files changed
+4
-4
No files matched your search
@@ -909,7 +909,7 @@ Persistence is intentionally not implemented here — the agent lifecycle attach
|
||||
* @returns the fiber-owned disposer.
|
||||
* @throws when another definition already owns this event type.
|
||||
*/
|
||||
registerMessageProjection(projection: SessionMessageProjection): () => void
|
||||
registerMessageProjection(projection: SessionMessageProjection): () => Promise<void>
|
||||
|
||||
/**
|
||||
* Create a session owned by the calling fiber: disposing that fiber stops
|
||||
|
||||
@@ -922,7 +922,7 @@ export class SessionStore extends Service {
|
||||
* @returns the fiber-owned disposer.
|
||||
* @throws when another definition already owns this event type.
|
||||
*/
|
||||
registerMessageProjection(projection: SessionMessageProjection): () => void {
|
||||
registerMessageProjection(projection: SessionMessageProjection): () => Promise<void> {
|
||||
if (this.projections.some(item => item.type === projection.type)) {
|
||||
throw new Error(`session message projection "${projection.type}" is already registered`)
|
||||
}
|
||||
|
||||
@@ -1870,7 +1870,7 @@ export const SERVICE_API: readonly ServiceApiEntry[] = [
|
||||
description: 'In-memory session store (`ctx.sessions`).\n\nPersistence is intentionally not implemented here — the agent lifecycle attaches a session-log writer to each published session\'s write handle; a session published outside that lifecycle persists nothing.',
|
||||
methods: [
|
||||
{
|
||||
signature: 'registerMessageProjection(projection: SessionMessageProjection): () => void',
|
||||
signature: 'registerMessageProjection(projection: SessionMessageProjection): () => Promise<void>',
|
||||
description: 'Register one event interpreter for live creation, restore, and fork. Disposing the contribution makes sessions that used it refuse further derivation.',
|
||||
parameters: [{ name: 'projection', description: 'pure definition owned by the event\'s plugin.' }],
|
||||
returns: 'the fiber-owned disposer.',
|
||||
|
||||
@@ -25,7 +25,7 @@ describe('first-party Session format catalog', () => {
|
||||
header: { ...session.header, delegationDepth: 0 }, inheritedEventCount: 0,
|
||||
events: [...session.snapshotEvents() as unknown as SessionFormatEvent[], { type: 'image/offload', seq: 1, time: 0, data: { targets: [{ seq: 0, imageIndexes: [0] }] } }],
|
||||
}
|
||||
expect(() => validateInstalledCurrentSessionArtifact(artifact)).toThrow(/image index 0 does not exist/)
|
||||
expect(() => { validateInstalledCurrentSessionArtifact(artifact) }).toThrow(/image index 0 does not exist/)
|
||||
})
|
||||
it('statically owns the complete adjacent v0 to v3 chain', () => {
|
||||
const header = {
|
||||
|
||||
Reference in new issue
Block a user