Files
deepseek-harness/website/zh-CN/api/harness/session-query.md
T

3.6 KiB

ctx.sessionQuery

SessionQueryService — provided by @deepseek-ai/dsh-session-query.

Live-preferred logical-corpus exact-read and relationship-tracing service.

Source

ctx.sessionQuery.listSessions()

/**
 * List the complete logical corpus using live-preferred records.
 * @returns deterministic newest-first cloned session records.
 */
listSessions(): Promise<SessionRecord[]>

List the complete logical corpus using live-preferred records.

Returns deterministic newest-first cloned session records.

Source

ctx.sessionQuery.listEvents(sessionId)

/**
 * List lightweight raw-log event records for one logical session.
 * @param sessionId - live-preferred session id to read.
 * @returns event records in ascending seq order.
 */
async listEvents(sessionId: SessionId): Promise<SessionEventRecord[]>

List lightweight raw-log event records for one logical session.

  • sessionId — live-preferred session id to read.

Returns event records in ascending seq order.

Source

ctx.sessionQuery.traceSession(sessionId)

/**
 * Trace known ancestry and descendants from one corpus observation.
 * @param sessionId - logical session id to trace.
 * @returns a complete lineage or an explicit unresolved parent boundary.
 * @throws when corpus resolution fails, the target is absent, or its known ancestry cycles.
 */
async traceSession(sessionId: SessionId): Promise<SessionLineageTrace>

Trace known ancestry and descendants from one corpus observation.

  • sessionId — logical session id to trace.

Returns a complete lineage or an explicit unresolved parent boundary.

Source

ctx.sessionQuery.traceEvent(request)

/**
 * Trace one event's direct positional and provenance relationships.
 * @param request - target session id and event seq.
 * @returns direct links plus the target's positional replacement chain.
 * @throws when source resolution fails, the target is absent, or surface/provenance validation fails.
 */
async traceEvent(request: SessionEventTraceRequest): Promise<SessionEventTrace>

Trace one event's direct positional and provenance relationships.

  • request — target session id and event seq.

Returns direct links plus the target's positional replacement chain.

Source

ctx.sessionQuery.readEvent(request)

/**
 * Read one full event plus a bounded raw-log context window.
 * @param request - target session/seq and context sizes.
 * @returns cloned target and neighboring events.
 */
async readEvent(request: SessionEventReadRequest): Promise<SessionEventWindow>

Read one full event plus a bounded raw-log context window.

  • request — target session/seq and context sizes.

Returns cloned target and neighboring events.

Source