import { type StoreMetaFields } from './shared/storeRead.js'; /** Supported AI coding agent types */ export type AgentType = 'claude-code' | 'cursor' | 'replit' | 'chatgpt' | 'custom'; /** Information about the AI agent generating events */ export interface AgentInfo { type: AgentType; version?: string; } /** All possible event types */ export type EventType = 'prompt_received' | 'plan_proposed' | 'assumption_made' | 'clarifying_question' | 'command_ran' | 'file_touched' | 'test_result' | 'backtrack' | 'error' | 'user_correction' | 'run_completed' | 'delegation_sent' | 'delegation_received' | 'delegation_completed'; /** Base event structure */ export interface BaseEvent { ts: string; run_id: string; agent: AgentInfo; type: EventType; } /** Full event with type-specific payload */ export interface VectorEvent extends BaseEvent { payload?: Record; } /** Intent specification from prompt analysis */ export interface PromptIntent { goal?: string; scope?: string[]; non_goals?: string[]; constraints?: string[]; acceptance?: string[]; risk_posture?: 'safe' | 'moderate' | 'aggressive'; } /** Reference to a delegating or delegated agent run */ export interface DelegationRef { agent_id: string; run_id: string; } /** Prompt specification stored with each run */ export interface PromptSpec { run_id: string; agent: AgentInfo; raw_prompt: string; intent?: PromptIntent; anchors?: { adrs?: string[]; memento_packs?: string[]; }; /** Who asked for this run (parent agent/run) */ delegated_by?: DelegationRef; /** Sub-runs spawned from this run */ delegated_to?: DelegationRef[]; created_at: string; } /** Run summary information */ export interface RunInfo { run_id: string; agent: AgentInfo; created_at: string; /** * Always present, so a caller always has something to render. * * This used to be implied by the ABSENCE of `completed_at` / `success` / * `summary` — those are undefined for a run with no terminal event, and * JSON.stringify drops undefined keys, so the row simply arrived without * them. A consumer could not tell "this run never finished" from "these * fields were lost in transit", which is the same absent-versus-empty * ambiguity as ISS-0146 one layer up. * * Deliberately NOT 'running'. Liveness cannot be known from disk — a run * with no terminal event may be in progress or may belong to a process that * exited an hour ago, and today every run on disk is in that state (see * ISS-0148). 'incomplete' claims only what the files actually show. */ status: 'completed' | 'incomplete'; /** * Timestamp of the most recent event. A FACT read off disk, not a judgement. * * This is deliberately not a `completed` flag derived from silence. Nothing * can observe an agent's session ending — the process just exits — so any * "this run finished" computed from a quiet period is an inference wearing * the costume of a fact, and once a consumer inherits it as truth there is * no way back. Different consumers also want different thresholds: an inbox * cares about minutes, a hygiene report about days. Handing over the input * lets each decide, and commits us to nothing. * * Absent only when the run has no events at all, which `event_count: 0` * already states unambiguously. */ last_event_at?: string; completed_at?: string; event_count: number; success?: boolean; summary?: string; } /** Inference load score breakdown */ export interface ScoreBreakdown { nonGoals?: number; acceptance?: number; constraints?: number; scopeBounds?: number; ambiguousVerbs?: number; undefinedNouns?: number; unguardedRiskAreas?: number; } /** Suggestion for reducing inference load */ export interface Suggestion { type: 'add_non_goals' | 'add_acceptance' | 'add_constraints' | 'add_scope' | 'clarify_verbs' | 'bind_nouns' | 'guard_risk'; message: string; priority: 'high' | 'medium' | 'low'; } /** Complete inference score result */ export interface InferenceScore { score: number; breakdown: ScoreBreakdown; suggestions: Suggestion[]; risk_level: 'low' | 'medium' | 'high' | 'critical'; } export interface CreateRunInput { projectId?: string; project_id?: string; agent: AgentInfo; raw_prompt: string; intent?: PromptIntent; /** If this run was delegated from another agent */ delegated_by?: DelegationRef; } export interface LogEventInput { projectId?: string; project_id?: string; run_id: string; type: EventType; payload?: Record; } export interface CompleteRunInput { projectId?: string; project_id?: string; run_id: string; success: boolean; summary?: string; } export interface ListRunsInput { projectId?: string; project_id?: string; limit?: number; agent_type?: AgentType; } export interface GetRunInput { projectId?: string; project_id?: string; run_id: string; include_events?: boolean; } export interface ScorePromptInput { prompt: string; projectId?: string; project_id?: string; } /** * Create a new run for an agent session */ export declare function createRun(input: CreateRunInput): Promise<{ run_id: string; path: string; imported_events?: number; }>; /** * Log an event to an existing run */ export declare function logEvent(input: LogEventInput): Promise<{ success: true; event_count: number; }>; /** * Complete a run with summary */ export declare function completeRun(input: CompleteRunInput): Promise<{ success: true; run_id: string; }>; /** * List runs for a project */ export declare function listRuns(input: ListRunsInput): Promise<{ runs: RunInfo[]; } & StoreMetaFields>; /** * Get details of a specific run */ export declare function getRun(input: GetRunInput): Promise<{ prompt: PromptSpec; events?: VectorEvent[]; event_count: number; completed: boolean; }>; export interface VectorTraceInput { projectId?: string; project_id?: string; run_id: string; /** Max depth to walk (default: 10) */ depth?: number; } export interface TraceNode { run_id: string; agent: AgentInfo; created_at: string; completed: boolean; success?: boolean; parent?: DelegationRef; children: TraceNode[]; } /** * Walk delegation chain from a run_id and return the full tree. * Goes up to the root parent, then down through all children. */ export declare function vectorTrace(input: VectorTraceInput): Promise<{ root: TraceNode; depth: number; }>; /** * Calculate inference load score for a prompt */ export declare function scorePrompt(input: ScorePromptInput): InferenceScore; //# sourceMappingURL=vector.d.ts.map