/** * CLI surface for diagnostician execution. * * Per D-02: Library function exports, no bin scripts, no CLI framework dependency. * External code (e.g., OpenClaw plugin) imports and calls these functions. * * Per D-03: status() returns TaskRecord key fields only (taskId, status, attemptCount, maxAttempts, lastError). * No Run history. */ import type { RuntimeStateManager, CandidateRecord } from '../store/runtime-state-manager.js'; import type { DiagnosticianRunnerLike } from '../pain-signal-bridge.js'; import type { RunnerResult } from '../runner/runner-result.js'; import type { TaskRecord } from '../task-status.js'; import type { LedgerAdapter } from '../candidate-intake.js'; /** Options for pd candidate list */ export interface CandidateListOptions { taskId: string; stateManager: RuntimeStateManager; } /** Result for pd candidate list */ export interface CandidateListResult { readonly taskId: string; readonly candidates: readonly CandidateRecord[]; } /** Options for pd candidate show */ export interface CandidateShowOptions { candidateId: string; stateManager: RuntimeStateManager; } /** Result for pd candidate show */ export interface CandidateShowResult { readonly candidateId: string; readonly artifactId: string; readonly taskId: string; readonly title: string; readonly description: string; readonly confidence: number | null; readonly sourceRunId: string; readonly status: 'pending' | 'consumed' | 'expired'; readonly createdAt: string; readonly ledgerEntryId: string | null; /** F10-1: present when sourceRunId references a non-existent run (lineage corruption). */ readonly warning?: string; readonly reason?: string; readonly nextAction?: string; } /** Options for pd artifact show */ export interface ArtifactShowOptions { artifactId: string; stateManager: RuntimeStateManager; } /** Result for pd artifact show */ export interface ArtifactShowResult { readonly artifactId: string; readonly runId: string; readonly taskId: string; readonly artifactKind: string; readonly contentJson: string; readonly createdAt: string; readonly candidates: readonly CandidateRecord[]; } /** Options for the run() CLI function. */ export interface DiagnoseRunOptions { /** Task ID to execute diagnostician for. */ taskId: string; /** Initialized RuntimeStateManager instance. */ stateManager: RuntimeStateManager; /** DiagnosticianRunner instance (already configured with deps). */ runner: DiagnosticianRunnerLike; } /** Options for the status() CLI function. */ export interface DiagnoseStatusOptions { /** Task ID to inspect. */ taskId: string; /** Initialized RuntimeStateManager instance. */ stateManager: RuntimeStateManager; /** Age threshold in seconds for classifying task as stalled (default: 300) */ stalledThresholdSeconds?: number; } /** Structured status result per D-03, extended per CLIV-04 for commit/candidate info. */ export interface DiagnoseStatusResult { readonly taskId: string; readonly status: TaskRecord['status']; readonly attemptCount: number; readonly maxAttempts: number; readonly lastError: TaskRecord['lastError']; /** Populated only when status is 'succeeded' — the committed commit ID */ readonly commitId: string | null; /** Populated only when status is 'succeeded' — the committed artifact ID */ readonly artifactId: string | null; /** Populated only when status is 'succeeded' — number of candidates registered */ readonly candidateCount: number | null; readonly inputRef?: string | null; readonly age?: number | null; readonly reason?: string | null; readonly nextAction?: string | null; } /** * Execute the diagnostician runner for a task. * * Thin wrapper over DiagnosticianRunner.run(). * Returns the raw RunnerResult for full visibility. */ export declare function run(options: DiagnoseRunOptions): Promise; /** * Inspect diagnostician task status. * * Per D-03: Returns key TaskRecord fields only. * Returns null if the task does not exist. */ export declare function status(options: DiagnoseStatusOptions): Promise; /** * List principle candidates for a task. * * Per CLIV-01: pd candidate list --task-id * Per D-05: joins through tasks→runs→commits→principle_candidates */ export declare function candidateList(options: CandidateListOptions): Promise; /** * Show detail for a single candidate. * * Per CLIV-02: pd candidate show * Returns title, description, confidence, source (runId), status * Returns null if candidate not found. */ export declare function candidateShow(options: CandidateShowOptions & { ledgerAdapter?: LedgerAdapter; }): Promise; /** * Show artifact content and its associated candidates. * * Per CLIV-03: pd artifact show * Per D-06: single query with JOIN, returns artifact + inline candidates array * Returns null if artifact not found. */ export declare function artifactShow(options: ArtifactShowOptions): Promise; //# sourceMappingURL=diagnose.d.ts.map