|
|
@@ -5,7 +5,7 @@ import SessionStore, { Session, SessionId } from '@deepseek-ai/dsh-session'
|
|
|
import type { UserMessage } from '@deepseek-ai/dsh-session'
|
|
|
import SessionProjectionRegistry from '@deepseek-ai/dsh-session-projection'
|
|
|
import { describe, expect, it } from 'vitest'
|
|
|
-import { inboxProjectionDefinition, ReactLoopInbox } from '../src/inbox.ts'
|
|
|
+import { ReactLoopInbox } from '../src/inbox.ts'
|
|
|
|
|
|
function unsupportedInbox(): Agent['inbox'] {
|
|
|
const rejectMutation = (): never => {
|
|
|
@@ -48,7 +48,6 @@ async function inboxAgent(rawId: string): Promise<{
|
|
|
const ctx = new Context()
|
|
|
await ctx.plugin(SessionStore)
|
|
|
await ctx.plugin(SessionProjectionRegistry)
|
|
|
- ctx.sessionProjections.register(inboxProjectionDefinition)
|
|
|
const session = ctx.sessions.create(SessionId(rawId))
|
|
|
const agent = stubAgent(rawId, { ctx, session })
|
|
|
const inbox = new ReactLoopInbox(ctx.sessionProjections, session, agentEvents(ctx, agent))
|
|
|
@@ -65,7 +64,6 @@ async function reconstructPersistedInbox(
|
|
|
const session = ctx.sessions.create(SessionId(rawId))
|
|
|
populate(session)
|
|
|
await ctx.plugin(SessionProjectionRegistry)
|
|
|
- ctx.sessionProjections.register(inboxProjectionDefinition)
|
|
|
const agent = stubAgent(rawId, { ctx, session })
|
|
|
const inbox = new ReactLoopInbox(ctx.sessionProjections, session, agentEvents(ctx, agent))
|
|
|
try {
|
|
|
@@ -78,11 +76,10 @@ async function reconstructPersistedInbox(
|
|
|
}
|
|
|
|
|
|
describe('ReactLoopInbox', () => {
|
|
|
- it('reads restored pending input from the shared projection', async () => {
|
|
|
+ it('registers the durable projection in its constructor', async () => {
|
|
|
const ctx = new Context()
|
|
|
await ctx.plugin(SessionStore)
|
|
|
await ctx.plugin(SessionProjectionRegistry)
|
|
|
- ctx.sessionProjections.register(inboxProjectionDefinition)
|
|
|
const session = ctx.sessions.create(SessionId('inbox-projection'))
|
|
|
const pending = createUserMessage({
|
|
|
content: [{ type: 'text', text: 'pending' }],
|
|
|
@@ -133,7 +130,6 @@ describe('ReactLoopInbox', () => {
|
|
|
const ctx = new Context()
|
|
|
await ctx.plugin(SessionStore)
|
|
|
await ctx.plugin(SessionProjectionRegistry)
|
|
|
- ctx.sessionProjections.register(inboxProjectionDefinition)
|
|
|
const parent = ctx.sessions.create(SessionId('inbox-fork-parent'))
|
|
|
const parentAgent = stubAgent('inbox-fork-parent', { ctx, session: parent })
|
|
|
const parentInbox = new ReactLoopInbox(ctx.sessionProjections, parent, agentEvents(ctx, parentAgent))
|