import type { PainDetectedData, PainProvenance, PainEvidenceEntry, PainProgressReport, PainCandidateOutcome } from './pain-signal-bridge.js'; import type { PainIngressV1Payload } from './pain-ingress-payload.js'; import type { LedgerAdapter } from './candidate-intake.js'; import type { EffectivePdConfig } from './config/pd-config-types.js'; import type { IntentDocReader } from './intent/intent-doc-reader-port.js'; import type { TrajectoryTurnReader } from './store/context/trajectory-turn-reader.js'; import type { TelemetryEvent } from '../telemetry-event.js'; export type FailureCategory = 'runtime_unavailable' | 'config_missing' | 'runtime_timeout' | 'output_invalid' | 'artifact_missing' | 'ledger_write_failed' | 'candidate_missing' /** * PRI-638: the Owner disabled the Diagnostician capability. Distinct from * `config_missing` on purpose — a deliberate kill switch must never be * reported to the Owner as a broken runtime or a bad configuration. */ | 'capability_disabled'; export interface PainToPrincipleServiceOptions { workspaceDir: string; stateDir: string; ledgerAdapter: LedgerAdapter; owner?: string; autoIntakeEnabled?: boolean; /** PRI-306: Effective PD config for config-driven runtime binding. * When provided, createPainSignalBridge uses config-based binding resolution * instead of the legacy WorkflowFunnelLoader path. */ effectiveConfig?: EffectivePdConfig; /** PRI-306: Env var accessor for readiness checks. Defaults to process.env. */ getEnvVar?: (name: string) => string | undefined; /** PRI-369: When true, recordPain returns immediately after task creation (status='submitted'). * The diagnosis runs in background via orchestrator wakeOnce/recovery-sweep. */ asyncMode?: boolean; /** * PRI-468: Optional INTENT.md reader for Stage A intent tension check. * Plugin layer supplies the concrete I/O adapter; core only consumes the port. */ intentDocReader?: IntentDocReader; trajectoryTurnReader?: TrajectoryTurnReader; /** * PRI-939 Option A: optional workspace-scoped telemetry sink forwarded to * createPainSignalBridge so short-lived CLI processes persist the allowlisted * bridge events (reuse_gate_triggered / reuse_evaluation_unavailable). * Absent = pre-Option-A behavior (unsubscribed storeEmitter singleton). */ telemetrySink?: { emitTelemetry: (event: TelemetryEvent) => void; }; } export interface PainToPrincipleInput { painId: string; painType: PainDetectedData['painType']; source: string; reason: string; score?: number; sessionId?: string; agentId?: string; taskId?: string; traceId?: string; provenance?: PainProvenance; hostKind?: PainDetectedData['hostKind']; evidence?: PainEvidenceEntry[]; /** * PRI-844: the Owner's verbatim correction, forwarded by hook emitters when * the pain carries correction context. Rides into the diagnostic task's * diagnosticJson via PainDetectedData — absent means no correction context, * never fabricated (rc-9). */ correctionEvidence?: PainDetectedData['correctionEvidence']; recordObservability?: boolean; /** PRI-642 SPEC §9: validated rev-2 ingress facts persisted under painIngress.v1. */ painIngress?: PainIngressV1Payload; } export interface PainToPrincipleOutput { status: 'succeeded' | 'skipped' | 'failed' | 'retried' | 'degraded' | 'submitted'; painId: string; taskId: string; runId?: string; artifactId?: string; candidateIds: string[]; ledgerEntryIds: string[]; admissionResults?: { candidateId: string; recommendationKind: string; admission: { decision: string; reason: string; nextAction: string; evidenceStatus: string; }; }[]; /** PRI-642 §10: aggregate progress (at-least-one semantics). */ progress?: PainProgressReport; /** PRI-642 §10: per-candidate disposition — the authority for mixed results. */ candidateOutcomes?: PainCandidateOutcome[]; message?: string; observabilityWarnings: string[]; failureCategory?: FailureCategory; latencyMs: number; nextAction?: string; } export declare class PainToPrincipleService { private readonly opts; constructor(opts: PainToPrincipleServiceOptions); recordPain(input: PainToPrincipleInput): Promise; } //# sourceMappingURL=pain-to-principle-service.d.ts.map