import type { PersistentSupervisorStatus } from './supervisor.js'; import type { AutomationRun } from './adapters/automation.js'; /** Stable reason codes emitted by DeepCanary providers. */ export type ReasonCode = 'HUMAN_APPROVAL_REQUIRED' | 'HUMAN_QUESTION_PENDING' | 'HOST_UNREACHABLE' | 'HOST_SUSPECTED_STALL' | 'TOOL_FAILURE_LOOP' | 'NO_MEANINGFUL_PROGRESS' | 'SUBAGENT_PRESSURE' | 'CONTEXT_PRESSURE' | 'COMPACTION_OCCURRED' | 'TASK_COMPLETED' | 'TASK_FAILED' | 'TASK_ABORTED' | 'COMPLETION_SUSPICIOUS' | 'HOST_STALL_RECOVERED'; /** Low-risk event classes that a user may silence persistently from the Inbox. */ export type SuppressibleReasonCode = 'TASK_COMPLETED' | 'COMPACTION_OCCURRED' | 'SUBAGENT_PRESSURE'; export declare const SUPPRESSIBLE_REASON_CODES: readonly SuppressibleReasonCode[]; /** Version of the browser-facing state/action contract. */ export declare const ATTENTION_PROTOCOL_VERSION = 3; /** Version of the deterministic attention policy used to create verdicts. */ export declare const ATTENTION_POLICY_VERSION = "attention-policy.v2"; /** Values safe to expose as interpolation parameters in localized copy. */ export type MessageParams = Record; export type FeedbackValue = 'useful' | 'not-relevant' | 'wrong-level' | 'already-resolved'; export type AttentionLevel = 'C0' | 'C1' | 'C2' | 'C3'; export type AttentionAction = 'IGNORE' | 'INBOX' | 'DIGEST' | 'INTERRUPT' | 'ESCALATE'; export type SupervisorMode = 'off' | 'experimental'; export type EvidenceType = 'session-event' | 'runtime-probe' | 'tool-history' | 'subagent-state' | 'http-probe' | 'process-probe' | 'user-policy' | 'model-judgment'; export type EvidenceAuthority = 'host' | 'runtime' | 'derived' | 'heuristic'; export interface EvidenceRef { type: EvidenceType; authority: EvidenceAuthority; ref: string; summary: string; } /** A privacy-safe explanation of how one deterministic policy decision was reached. */ export interface PolicyDecisionTrace { schemaVersion: 1; policyVersion: string; verdictId: string; matchedRules: string[]; appliedScopes: string[]; suppressedBy: string[]; bundledWith?: { eventCount: number; reasonCodes: ReasonCode[]; }; authoritySummary: { strongest: EvidenceAuthority; counts: Record; }; finalLevel: AttentionLevel; finalAction: AttentionAction; recoveryRule?: string; } /** The normalized, lossless-free signal exchanged inside the plugin. */ export interface CanarySignal { schemaVersion: 1; id: string; occurredAt: string; source: 'session' | 'agent' | 'subagent' | 'tool' | 'host' | 'windows' | 'usage' | 'external'; kind: ReasonCode; sessionId?: string; workspaceId?: string; severityHint?: 0 | 1 | 2 | 3; evidence: EvidenceRef[]; dedupeKey?: string; /** Optional root-cause key used to combine adjacent attention items. */ bundleKey?: string; task?: TaskContext; data: Record; } export interface AttentionVerdict { schemaVersion: typeof ATTENTION_PROTOCOL_VERSION; eventId: string; level: AttentionLevel; action: AttentionAction; confidence: number; reasonCode: ReasonCode; messageKey: string; messageParams?: MessageParams; suggestionKey?: string; policyVersion: string; why: string; suggestedAction?: string; evidence: EvidenceRef[]; decisionTrace?: PolicyDecisionTrace; } export type InboxStatus = 'open' | 'seen' | 'acknowledged' | 'snoozed' | 'muted' | 'recovered' | 'expired'; /** Runtime task fact kept separate from the user's Inbox handling state. */ export type TaskState = 'running' | 'waiting-human' | 'completed' | 'failed' | 'aborted' | 'disposed' | 'unknown'; /** Opaque identities derived only from public owner and execution metadata. */ export interface TaskContext { taskRef: string; executionGeneration: string; kind: 'session' | 'subagent' | 'fork' | 'job' | 'automation'; parentTaskRef?: string; runRef?: string; humanActionRef?: string; sourceSeq?: number; } export interface InboxItem extends AttentionVerdict { id: string; task?: TaskContext; sessionId?: string; workspaceId?: string; /** Hashes retained across restart so live sessions can be re-associated without persisting raw IDs. */ sessionRef?: string; workspaceRef?: string; occurredAt: string; status: InboxStatus; snoozedUntil?: string; /** Explicit rescheduling creates a new delivery generation within the same reminder. */ notificationGeneration?: number; reminderPending?: boolean; lastReminderAt?: string; seenAt?: string; acknowledgedAt?: string; recoveredAt?: string; expiredAt?: string; /** Internal timestamp for the bounded authoritative-session orphan grace window. */ orphanedAt?: string; /** Temporary delivery suppression; the Inbox item remains available while it is active. */ mutedUntil?: string; /** Whether the observed task is still available for native session navigation. */ targetAvailable?: boolean; /** Last structured task lifecycle fact associated with this item. */ taskState?: TaskState; /** Timed question lifecycle; call identity is retained only as a bundle hash. */ questionState?: 'open' | 'continued'; feedback?: { useful: boolean; value?: FeedbackValue; note?: string; at: string; }; /** Internal privacy-safe hash used to join adjacent events. */ bundleKey?: string; bundleCount: number; reasonCodes: ReasonCode[]; } export interface QuietHours { enabled: boolean; start: string; end: string; /** Missing in older settings means the Host's local time zone. */ timeZone?: string; } export interface DeepCanaryConfig { stateDir: string; notificationLevel: 'C1' | 'C2' | 'C3'; openOnCritical: boolean; maxInterruptsPerHour: number; dedupeWindowMinutes: number; bundleWindowSeconds: number; longRunThresholdMinutes: number; subagentPressure: 'relaxed' | 'standard' | 'strict'; quietHours: QuietHours; privacySafeSummary: boolean; healthPollSeconds: number; maxInboxItems: number; /** The Persistent Supervisor remains an explicit engineering opt-in until Gate E is complete. */ supervisorMode: SupervisorMode; } export interface WorkspaceIdentity { canonicalId: string; hostPath?: string; wslPath?: string; platform: 'windows' | 'wsl' | 'other'; windowsInterop: 'available' | 'unavailable' | 'unknown'; nativeToast: 'available' | 'unavailable'; } export interface PublicSettings { notificationLevel: 'C1' | 'C2' | 'C3'; openOnCritical: boolean; maxInterruptsPerHour: number; dedupeWindowMinutes: number; bundleWindowSeconds: number; longRunThresholdMinutes: number; subagentPressure: 'relaxed' | 'standard' | 'strict'; quietHours: QuietHours; privacySafeSummary: boolean; healthPollSeconds: number; maxInboxItems: number; supervisorMode: SupervisorMode; suppressedReasonCodes: SuppressibleReasonCode[]; } export interface DeliveryStatus { interruptBudget: { limit: number; used: number; remaining: number; }; quietHours: QuietHours & { active: boolean; }; dedupeWindowMinutes: number; bundleWindowSeconds: number; hostProbe: { port?: number; healthy: boolean; consecutiveFailures: number; state: 'healthy' | 'outage-open' | 'recovered' | 'recovery-continued'; outageId?: string; lastCheckedAt?: string; recoveredAt?: string; }; } /** Public health projection for the DSH authoritative-session reconciliation loop. */ export type ReconciliationPhase = 'unavailable' | 'reconciling' | 'ready'; export interface ReconciliationStatus { epoch: number; phase: ReconciliationPhase; authoritative: boolean; verified: boolean; listedSessions: number; /** Events still buffered at the status boundary; a completed pass reports zero. */ bufferedEvents: number; skippedBufferedEvents: number; detail?: string; } export interface RuntimeStatus { persistence?: { state: 'ready' | 'write-failed'; }; plugin: { name: string; version: string; state: 'ready' | 'loading' | 'degraded'; }; process: { platform: string; node: string; }; workspace: Pick; sessions: number; background?: { available: boolean; running: number; unknown: number; limited: boolean; }; tools: string[]; openInbox: number; revision: number; indicator: 'gray' | 'yellow' | 'orange' | 'red'; capabilities: { browserNotification: boolean; nativeToast: boolean; windowsInterop: 'available' | 'unavailable' | 'unknown'; destructiveActions: false; }; delivery: DeliveryStatus; reconciliation: ReconciliationStatus; supervisor: PersistentSupervisorStatus; } export interface PublicInboxItem { id: string; task?: TaskContext; sessionId?: string; occurredAt: string; level: AttentionLevel; action: AttentionAction; reasonCode: ReasonCode; messageKey: string; messageParams?: MessageParams; suggestionKey?: string; policyVersion: string; why: string; suggestedAction?: string; evidence: Array>; decisionTrace?: PolicyDecisionTrace; status: InboxStatus; snoozedUntil?: string; notificationGeneration?: number; notificationEligible?: boolean; notificationExhausted?: boolean; reminderPending?: boolean; lastReminderAt?: string; seenAt?: string; acknowledgedAt?: string; recoveredAt?: string; expiredAt?: string; mutedUntil?: string; targetAvailable?: boolean; taskState?: TaskState; questionState?: 'open' | 'continued'; feedback?: { useful: boolean; value?: FeedbackValue; at: string; }; bundleCount: number; reasonCodes: ReasonCode[]; } /** Structured input accepted by the read-only Policy Dry-run surface. */ export interface DryRunSignalInput { id?: string; kind: ReasonCode; authority: EvidenceAuthority; severityHint?: 0 | 1 | 2 | 3; healthy?: boolean; userViewing?: boolean; threshold?: number; failureCount?: number; activeSubagents?: number; idleMs?: number; } export interface DryRunPolicyInput { notificationLevel?: 'C1' | 'C2' | 'C3'; quietHours?: Partial; } export interface DryRunRequest { signal: DryRunSignalInput; candidate?: DryRunPolicyInput; } export interface DryRunDifference { field: 'level' | 'action' | 'reasonCode'; current: string; candidate: string; } export interface DryRunResult { schemaVersion: 1; mode: 'dry-run'; readOnly: true; generatedAt: string; input: DryRunSignalInput; current: AttentionVerdict; candidate: AttentionVerdict; differences: DryRunDifference[]; changed: boolean; } export interface PublicSnapshot { schemaVersion: typeof ATTENTION_PROTOCOL_VERSION; revision: number; generatedAt: string; status: RuntimeStatus; settings: PublicSettings; inbox: PublicInboxItem[]; /** Pending items deliberately scheduled for a future time. */ scheduled?: PublicInboxItem[]; activity?: PublicInboxItem[]; automation?: { runs: AutomationRun[]; limited: boolean; }; retention?: { limit: number; limited: boolean; deferredSessions: number; }; } /** Version of the privacy-safe outcome record written by DeepCanary. */ export declare const OUTCOME_RECEIPT_SCHEMA_VERSION: 1; /** Provenance of an outcome record; reports must keep these sources separate. */ export type OutcomeSource = 'real' | 'controlled' | 'replay'; /** * Intent of the work an outcome record observes. Task intent is independent of * `OutcomeSource`: capture provenance never implies, upgrades, or downgrades * it. An absent origin means `unknown` and is never inferred as `natural`. */ export type OutcomeTaskOrigin = 'natural' | 'controlled' | 'replay' | 'unknown'; export type OutcomeEventClass = 'human-needed' | 'host-health' | 'stuck-progress' | 'subagent-pressure' | 'context-pressure' | 'completion'; export type OutcomeFeedback = 'unrated' | 'useful' | 'not-useful'; export type OutcomeLaterOutcome = 'unknown' | 'continued' | 'completed' | 'failed' | 'aborted' | 'recovered' | 'user-stopped'; export type OutcomeLatencyBucket = 'unknown' | 'not-opened' | 'under-1m' | '1-5m' | '5-15m' | 'over-15m'; export type OutcomeReviewFlag = 'missed-human-needed' | 'false-stall' | 'wrong-level' | 'duplicate-final-interrupt' | 'provider-error' | 'sink-error' | 'dropped-event'; /** A redacted, append-and-update record connecting one decision to its observed outcome. */ export interface OutcomeReceipt { schemaVersion: typeof OUTCOME_RECEIPT_SCHEMA_VERSION; receiptId: string; attentionRef: string; trialId: string; source: OutcomeSource; /** * Task intent behind the observed work, separate from the capture `source`. * Optional for backward compatibility: a schemaVersion 1 record written * before this field exists stays valid and reads as `unknown`. */ taskOrigin?: OutcomeTaskOrigin; /** Opaque reference to the originating task: 16 lowercase hex characters, never a raw task identifier. */ taskRef?: string; policyVersion: string; eventClass: OutcomeEventClass; reasonCode: ReasonCode; level: AttentionLevel; action: AttentionAction; sourceAuthority: EvidenceAuthority; opened: boolean; acknowledged: boolean; snoozed: boolean; muted: boolean; feedback: OutcomeFeedback; laterOutcome: OutcomeLaterOutcome; recoveredBeforeOpen: boolean; latencyBucket: OutcomeLatencyBucket; reviewFlags: OutcomeReviewFlag[]; recordedAt: string; } /** User-supplied, bounded fields accepted when recording an outcome. */ export interface OutcomeReceiptInput { source: OutcomeSource; trialId: string; /** Optional task intent; it is independent of the capture `source`. */ taskOrigin?: OutcomeTaskOrigin; /** Optional opaque task reference: 16 lowercase hex characters. */ taskRef?: string; opened?: boolean; acknowledged?: boolean; snoozed?: boolean; muted?: boolean; feedback?: OutcomeFeedback; laterOutcome?: OutcomeLaterOutcome; recoveredBeforeOpen?: boolean; latencyBucket?: OutcomeLatencyBucket; reviewFlags?: OutcomeReviewFlag[]; } /** Explicit selector for local outcome withdrawal or retention cleanup. */ export interface OutcomeDeleteFilter { source?: OutcomeSource; trialId?: string; before?: string; } //# sourceMappingURL=types.d.ts.map