/** * Trajectory Evidence Builder — PRI-326, PRI-642 * * Extracted from pain.ts to avoid circular imports between * pain.ts and after-tool-call-helpers.ts. * * Pure data extraction — reads from trajectory DB, sanitizes, returns evidence entries. * * PRI-642 Scope A adds the typed acquisition API `acquireTrajectoryEvidence` * (discriminated available/unavailable, SPEC §7.2). The legacy array API * `buildTrajectoryEvidence` remains as a compatibility wrapper for automatic * emitters and MUST keep its exact sentinel shapes until Scope B migrates * those consumers (frozen decision #3). */ import type { PainEvidenceEntry } from '@principles/core/runtime-v2'; import type { WorkspaceContext } from '../core/workspace-context.js'; /** * PRI-642 (SPEC §7.2): discriminated acquisition result. `unavailable` carries * a distinct reasonCode so callers can degrade explicitly instead of counting * sentinel placeholder entries as trajectory evidence. */ export type TrajectoryEvidenceAcquisition = { status: 'available'; entries: PainEvidenceEntry[]; } | { status: 'unavailable'; reasonCode: 'trajectory_unavailable' | 'session_not_found' | 'empty_trajectory' | 'evidence_read_failed'; detail: string; }; /** * PRI-642 Scope A typed acquisition — returns the discriminated * available/unavailable result. `available` requires at least one entry that * references a real behavior trace; sentinel placeholder entries never count * as available evidence. */ export declare function acquireTrajectoryEvidence(wctx: WorkspaceContext, sessionId: string): TrajectoryEvidenceAcquisition; /** * Legacy array API (compatibility wrapper, PRI-642 frozen decision #3). * Automatic emitters still consume this shape; Scope B migrates them to the * typed API one family at a time before this wrapper may be removed. */ export declare function buildTrajectoryEvidence(wctx: WorkspaceContext, sessionId: string): PainEvidenceEntry[];