Merge branch 'stack/agent-profiles-7-docs' into stack/agent-profiles-8-authoring

This commit is contained in:
Yichen Jiang
2026-08-07 13:39:41 +08:00
259 changed files with 8059 additions and 1533 deletions

View File

@@ -3,7 +3,7 @@ import { describe, expect, it, vi } from 'vitest'
import { Context, type Fiber } from 'cordis'
import SessionStore, { SESSION_FORMAT_VERSION, SessionId } from '@deepseek-ai/dsh-session'
import type { SessionEvent, SessionHeader, SessionId as SessionIdType } from '@deepseek-ai/dsh-session'
import SessionPersistence, { SessionPersistenceRevision } from '@deepseek-ai/dsh-session-persistence'
import SessionPersistence, { SessionPersistenceCorruptionError, SessionPersistenceRevision } from '@deepseek-ai/dsh-session-persistence'
import SessionQueryService, {
SESSION_QUERY_DEFAULT_PERSISTED_INSPECT_CONCURRENCY,
type SessionEventSurface,
@@ -1114,6 +1114,24 @@ describe('session-query exact reads', () => {
await expect(ctx.sessionQuery.listEvents(SessionId('durable'))).rejects.toThrow(expectCode('SESSION_QUERY_PERSISTENCE_FAILED'))
})
it('wraps persisted corruption as SESSION_QUERY_CORRUPT_SESSION with its cause preserved', async () => {
const durable = header('durable-corrupt')
TestPersistence.reset([{ meta: durable, events: eventLog() }])
const ctx = await liveContext()
await ctx.plugin(TestPersistence)
const corruption = new SessionPersistenceCorruptionError(
'stored prefix failed validation',
{ cause: new Error('torn final record') },
)
TestPersistence.inspectFailure = corruption
await expect(ctx.sessionQuery.readSession(durable.id)).rejects.toMatchObject({
code: 'SESSION_QUERY_CORRUPT_SESSION',
message: `stored session "${durable.id}" is corrupt: stored prefix failed validation`,
cause: corruption,
})
})
it('reports absent sessions, persisted load failures, and persisted header conflicts', async () => {
const durable = header('durable')
TestPersistence.reset([{ meta: durable, events: eventLog() }])