35 lines
1.3 KiB
TypeScript
35 lines
1.3 KiB
TypeScript
/** Public configuration and typed failures for session-query. */
|
|
|
|
import { HarnessError } from '@deepseek-ai/dsh-llm'
|
|
|
|
/** Default maximum `before`/`after` raw-event window. */
|
|
export const SESSION_QUERY_READ_WINDOW_MAX = 50
|
|
|
|
/** Configuration for exact session-query reads and traces. */
|
|
export interface Config {
|
|
/** Maximum accepted raw read context on either side. Defaults to 50. */
|
|
readWindowMax?: number
|
|
}
|
|
|
|
/** Stable machine-routable failure taxonomy for exact session reads and traces. */
|
|
export type SessionQueryErrorCode =
|
|
| 'SESSION_QUERY_EVENT_NOT_FOUND'
|
|
| 'SESSION_QUERY_INVALID_CONFIG'
|
|
| 'SESSION_QUERY_INVALID_LINEAGE'
|
|
| 'SESSION_QUERY_INVALID_SURFACE'
|
|
| 'SESSION_QUERY_INVALID_WINDOW'
|
|
| 'SESSION_QUERY_PERSISTENCE_FAILED'
|
|
| 'SESSION_QUERY_SESSION_NOT_FOUND'
|
|
| 'SESSION_QUERY_SOURCE_CONFLICT'
|
|
|
|
/** Typed session-query failure whose `code` is one closed taxonomy member. */
|
|
export class SessionQueryError extends HarnessError {
|
|
declare readonly code: SessionQueryErrorCode
|
|
|
|
// The base stores the value; this signature narrows its open string code.
|
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
constructor(message: string, code: SessionQueryErrorCode, options?: ErrorOptions) {
|
|
super(message, code, options)
|
|
}
|
|
}
|