feat(apiproxy): projection column on session.list — cold titles with zero log loads

SessionSummary grows an optional projections column (whole value per key,
same passthrough posture as the history-tail block): attached rows cut the
live registry watermark cache; cold rows view the persisted projection
cache's stored rows via the new registry viewCheckpoint face (version-
matching keys only, zero I/O) — the RFC's motivating scenario, every
session's title across a listing without loading one event log. The column
is fail-soft and absence-coded: no registry, no cache row, or a throwing
read serve the row without the column, never breaking the listing.
This commit is contained in:
imccyu
2026-07-28 01:38:15 +08:00
parent c330c1cd3e
commit 003b22a157
10 changed files with 187 additions and 5 deletions

View File

@@ -7,6 +7,7 @@
import { z } from 'zod'
import type { SessionEvent, SessionId } from '@deepseek-ai/dsh-session/types'
import type { SessionProjectionMap } from '@deepseek-ai/dsh-session-projection/types'
import type { RequestPayload, ResponseValue } from './rpc-map.ts'
import type { Wire } from './rpc.schema.ts'
import type {
@@ -37,6 +38,15 @@ export const sessionEventSchema = z.object({
surfaceOp: z.unknown().optional(),
}) as unknown as z.ZodType<SessionEvent>
/**
* Projection-values passthrough (same posture as
* {@link sessionProjectionsBlockSchema}): each value already passed its
* unit's own schema on the host side; deep-validating here would import
* every domain's schema into the carrier.
*/
const projectionValuesSchema =
z.record(z.string(), z.unknown()) as unknown as z.ZodType<Partial<SessionProjectionMap>>
/** SessionSummary row of session.list. */
export const sessionSummarySchema = z.object({
sessionId: sessionIdSchema,
@@ -45,6 +55,7 @@ export const sessionSummarySchema = z.object({
blank: z.boolean(),
parentSessionId: sessionIdSchema.optional(),
cwd: z.string().optional(),
projections: projectionValuesSchema.optional(),
}) satisfies z.ZodType<Wire<SessionSummary>>
/** session.list request payload (cursor is a reserved seat, unimplemented in v1). */