config.ts 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. /** Public configuration and typed failures for session-query. */
  2. import { HarnessError } from '@deepseek-ai/dsh-llm'
  3. /** Default maximum `before`/`after` raw-event window. */
  4. export const SESSION_QUERY_READ_WINDOW_MAX = 50
  5. /** Configuration for exact session-query reads and traces. */
  6. export interface Config {
  7. /** Maximum accepted raw read context on either side. Defaults to 50. */
  8. readWindowMax?: number
  9. }
  10. /** Stable machine-routable failure taxonomy for exact session reads and traces. */
  11. export type SessionQueryErrorCode =
  12. | 'SESSION_QUERY_EVENT_NOT_FOUND'
  13. | 'SESSION_QUERY_INVALID_CONFIG'
  14. | 'SESSION_QUERY_INVALID_LINEAGE'
  15. | 'SESSION_QUERY_INVALID_SURFACE'
  16. | 'SESSION_QUERY_INVALID_WINDOW'
  17. | 'SESSION_QUERY_PERSISTENCE_FAILED'
  18. | 'SESSION_QUERY_SESSION_NOT_FOUND'
  19. | 'SESSION_QUERY_SOURCE_CONFLICT'
  20. /** Typed session-query failure whose `code` is one closed taxonomy member. */
  21. export class SessionQueryError extends HarnessError {
  22. declare readonly code: SessionQueryErrorCode
  23. // The base stores the value; this signature narrows its open string code.
  24. // eslint-disable-next-line @typescript-eslint/no-useless-constructor
  25. constructor(message: string, code: SessionQueryErrorCode, options?: ErrorOptions) {
  26. super(message, code, options)
  27. }
  28. }