Просмотр исходного кода

test: cover projection-aware session helpers

_Kerman 1 месяц назад
Родитель
Сommit
c46c3df2f2

+ 2 - 0
packages/preset/agent-presets/tests/remote.spec.ts

@@ -17,6 +17,7 @@ import SystemPrompt from '@deepseek-ai/dsh-system-prompt'
 import ToolRuntime from '@deepseek-ai/dsh-tools'
 import AgentRegistry, { type Agent } from '@deepseek-ai/dsh-agent'
 import AgentLoop from '@deepseek-ai/dsh-agent-loop'
+import SessionProjectionRegistry from '@deepseek-ai/dsh-session-projection'
 import { TypertRemoteFailure, type RemoteFailure } from '@deepseek-ai/dsh-typert-protocol'
 import { afterEach, describe, expect, it, vi } from 'vitest'
 import AgentPresets, { COMPOSITION_FILE, METADATA_FILE } from '@deepseek-ai/dsh-agent-presets'
@@ -72,6 +73,7 @@ async function harness(
   ctx.loader.builtins.include = Include
   await ctx.plugin(LlmRuntime)
   await ctx.plugin(SessionStore)
+  await ctx.plugin(SessionProjectionRegistry)
   await ctx.plugin(SystemPrompt, { persona: '' })
   await ctx.plugin(ToolRuntime)
   await ctx.plugin(AgentRegistry)

+ 15 - 0
packages/session-query/session-query/tests/observation.spec.ts

@@ -89,6 +89,21 @@ describe('SessionObservationReader', () => {
     await ctx.fiber.dispose()
   })
 
+  it('omits prepared projections when the registry is absent', async () => {
+    const ctx = new Context()
+    await ctx.plugin(SessionStore)
+    const meta = header('prepared-without-projections')
+    ctx.provide('sessionPersistence', {
+      borrowSession: () => Promise.resolve(preparedSource(meta)),
+    } as never)
+
+    using observed = await new SessionObservationReader(ctx).read(meta.id)
+
+    expect(observed.source).toBe('prepared')
+    expect(observed.projections).toBeUndefined()
+    await ctx.fiber.dispose()
+  })
+
   it('reference-counts prepared leases and rejects retention after disposal', async () => {
     const ctx = new Context()
     await ctx.plugin(SessionStore)