/**
 * @codeflowmu/runtime — public API surface (Sprint S5 — Skill Runtime + fcop hard-dep).
 *
 * What's exported:
 *   - AgentRegistry + RuntimeBootstrap + PersistentStore + AgentSdkAdapter
 *     (§2.1 subsystem 3 + 6; Sprint S3 Phase A done — `407cfa5` checkpoint)
 *   - SessionManager + SessionStore + TranscriptWriter + SdkRunHandle
 *     (§2.1 subsystem 1 + decision 4 right-half; Sprint S3 Phase B — `8c49907` checkpoint)
 *   - InboxWatcher + TaskParser + StateHistoryWriter + TaskDispatcher + Runtime
 *     (§2.4 doorbell + §3.3 task lifecycle; Sprint S3 Phase C — `bd7d3d8` checkpoint)
 *   - ReviewEngine + ReviewWriter + NeedsHumanGate + AgentStatusReconciler
 *     (§3.4 review schema + §0.9.4 HITL + REPORT-018 §五决策 B'; Sprint S4 — `1ba2aa6`)
 *   - SkillRegistry + KernelDependencyValidator + MCPInjector
 *     (§0.5 fcop hard-dep + §0.7.5 skill runtime + §3.6 skill schema;
 *      Sprint S5 — this commit)
 *   - State types (runtime-private; layered on @codeflowmu/protocol)
 *
 * What's NOT here (and why):
 *   - codeflowmu-shell EXE      → S6 (Node SEA bundle that imports `Runtime`)
 *   - Mobile Console / relay  → v0.2 (separate effort)
 *   - Cloud agent runtime     → v0.x; binding-mode field exists, but
 *                               local-only is the v0.1 reality
 *   - Real MCP spawning       → v0.2 (`MCPInjector` mode="live" is
 *                               eager-throw-stubbed in v0.1)
 *
 * See `README.md` for the full sprint roadmap and `docs/crash-recovery.md`
 * for the 4 persistence/recovery decisions.
 */

export {
  AgentRegistry,
  type AgentRegistryFilter,
  type AgentRegistryOptions,
  evaluateRoleToolCapability,
  type RoleToolCapabilityDecision,
  type PersistentStore,
  JsonFileStore,
  type JsonFileStoreOptions,
  type AgentSdkAdapter,
  type AgentCreateSpec,
  type AgentSendSpec,
  type SessionSdkImage,
  CursorSdkAdapter,
  type CursorSdkAdapterOptions,
  GoogleGenAiAdapter,
  resolveGoogleModel,
  DoubaoArkAdapter,
  DoubaoRunHandle,
  type DoubaoArkAdapterOptions,
  ClaudeCodeAdapter,
  type ClaudeCodeAdapterOptions,
  CodexCliAdapter,
  buildCodexAppServerArgs,
  buildCodexCliConfig,
  buildCodexCliExecArgs,
  type CodexCliAdapterOptions,
  type CodexCliAuthMode,
  type CodexCliSpawnFn,
  type CodexCliVersionProbe,
  InMemorySdkAdapter,
  InMemoryRunHandle,
  type InMemoryRunHandleOptions,
  InMemorySdkPlantedError,
  ValidationError,
  LayerViolationError,
  AgentNotFoundError,
  RegistryWriteError,
  RuntimeBootstrapError,
  RuntimeNotReadyError,
  SessionNotFoundError,
  InvalidAgentStatusError,
  RuntimeBootstrap,
  type RuntimeBootstrapOptions,
  AgentStatusReconciler,
  type AgentStatusReconcilerLogger,
  type AgentStatusReconcilerOptions,
  KernelDependencyError,
  MCPInjectorLiveModeNotImplementedError,
  SkillSchemaError,
} from "./registry/index.ts";

export {
  SessionManager,
  type SessionManagerOptions,
  type SessionStartPayload,
  type SessionHandle,
  type EmergencyStopResult,
  SessionStore,
  type SessionStoreOptions,
  SessionLeaseStore,
  SessionLeaseConflictError,
  type SessionLeaseKey,
  type SessionLeaseRecord,
  TranscriptWriter,
  type TranscriptWriterOptions,
  type TranscriptEntryKind,
  SdkRunHandle,
  type SdkRunHandleOptions,
  type SdkRunLike,
  type RunHandle,
  buildSdkFailurePayloadFields,
  pickSdkFailureFieldsFromPayload,
  rebuildSdkFailureForSessionEnd,
  SDK_FAILURE_PAYLOAD_KEYS,
  type SdkFailureCategory,
  type SessionRunWithSdkFailure,
  buildGoogleFailurePayloadFields,
  pickGoogleFailureFieldsFromPayload,
  rebuildGoogleFailureForSessionEnd,
  GOOGLE_FAILURE_PAYLOAD_KEYS,
  type GoogleFailureCategory,
  type SessionRunWithGoogleFailure,
} from "./session/index.ts";

export {
  acquireProjectWriteLease,
  acquireProjectWriteLeaseSync,
  isProjectInitializationActive,
  projectInitializationLockPath,
  ProjectWriteBarrierError,
  resetProjectWriteBarrierForTests,
  waitForProjectWriteLeasesToDrain,
  withProjectWriteLease,
  withProjectWriteLeaseSync,
  type ProjectWriteLease,
} from "./project/ProjectWriteBarrier.ts";

export {
  InboxWatcher,
  type InboxEvent,
  type InboxEventHandler,
  type InboxValidationFailPolicy,
  type InboxWatcherOpts,
  TaskParser,
  validateDurableTaskForDispatch,
  type ParsedTask,
  type DurableTaskValidationOptions,
  StateHistoryWriter,
  type StateHistoryEntry,
  TaskDispatcher,
  type DispatchTaskStateView,
  type TaskDispatcherLogger,
  type TaskDispatcherOpts,
  type AdHocPriority,
  type AdhocQueueItem,
  TaskParseError,
  TaskFileNotFoundError,
  PlanScheduler,
  type PlanSchedulerOptions,
  type PlanSchedulerLogger,
  type PlanStatus,
  type SprintItem,
  type SprintState,
  FixedTaskRunner,
  buildDefaultRules,
  type FixedTaskRunnerLogger,
  type ScheduleRule,
  type ScheduleEntry,
  PmQueueGuard,
  type PmQueueSnapshot,
  type PmQueuePhase,
  type PmQueueReleaseReason,
  type PmQueueGuardOpts,
  isPmToWorkerDispatch,
  DownstreamAutoNudge,
  ledgerHasWorkerReportForTask,
  DEFAULT_DOWNSTREAM_NUDGE_IDLE_MS,
  DEFAULT_DOWNSTREAM_NUDGE_DEBOUNCE_MS,
  DEFAULT_DOWNSTREAM_NUDGE_POLL_MS,
  DOWNSTREAM_AUTO_NUDGE_EVENT,
  type DownstreamAutoNudgeOpts,
  type DownstreamAutoNudgeLogger,
  allocateTaskSequence,
} from "./scheduler/index.ts";

export {
  ReviewEngine,
  DefaultReviewPolicy,
  defaultMakeReviewId,
  parseVerdict,
  type ReviewEngineLogger,
  type ReviewEngineOptions,
  type ReviewPolicy,
  type TaskReference,
  ReviewWriter,
  renderReviewMarkdown,
  type HumanApproval,
  type ReviewDecision,
  type ReviewSubjectType,
  type ReviewVerdict,
  type ReviewWriterOptions,
  NeedsHumanGate,
  UnsupportedHumanPushSinkError,
  type HumanApprovedSpec,
  type HumanPushRequest,
  type NeedsHumanGateLogger,
  type NeedsHumanGateOptions,
  ReviewWriteError,
  ReviewerNotFoundError,
  VerdictParseError,
  resolveReviewEvidence,
  type ReviewEvidenceResolveInput,
  type ReviewEvidenceTimeWindow,
  type EvidenceSummary,
  type EvidenceSummarySession,
  type EvidenceSummaryCommand,
  type EvidenceSummaryDataQuery,
  resolveExecutionProvenance,
  type ExecutionBindingTuple,
  type ExecutionProvenanceSourceName,
  type ExecutionProvenanceSource,
  type ExecutionProvenanceConflict,
  type ExecutionProvenanceResult,
  type ResolveExecutionProvenanceInput,
  detectReportClaims,
  evaluateReviewFactGate,
  resolveReportedOutcome,
  writeFactCheckReview,
  overruleReviewGate,
  resolveReviewLinkedTaskId,
  type ResolveReviewLinkedTaskIdOptions,
  type FactCheckVerdict,
  type ReviewFactState,
  type FactCheckReasonCode,
  type ReportClaims,
  type FactCheckResult,
  type ExecutionEvidenceState,
  type ReportedOutcome,
  type PmFactDecision,
  FACT_SOURCE_ROOT_REL,
  FACT_SOURCE_SOURCES_REL,
  FACT_SOURCE_STANDARDS_REL,
  FACT_SOURCE_ADAPTER_IDS,
  FACT_VALIDATOR_IDS,
  inspectFactSourceRegistry,
  evaluateBoundThirdPartyFacts,
  type FactSourceDefinition,
  type FactStandardDefinition,
  type FactStandardValidator,
  type FactSourceRegistrySnapshot,
  type ThirdPartyFactCheckResult,
  type ThirdPartySourceState,
  inspectUtf8Text,
  inspectUtf8File,
  decodeUtf8Strict,
  type TextEncodingCheck,
  type TextEncodingState,
  compileAcceptanceContract,
  evaluateAcceptanceContract,
  type AcceptanceContract,
  type AcceptanceContractItem,
  type AcceptanceContractEvaluation,
  type AcceptanceEvidenceType,
  type EvidenceEnvelope,
  FactCheckDecisionService,
  FactCheckDecisionError,
  type FactCheckDecisionAction,
  type FactCheckDecisionRecord,
  type WriteFactCheckReviewInput,
  humanApprovalApprovedAt,
  isReviewPendingHuman,
  reviewMatchesScope,
  buildReviewGateApprovalCard,
  collectReviewGateRedFlags,
  evaluateReviewGateAutoPass,
  REVIEW_GATE_RED_FLAG_LABELS,
  type ReviewGateApprovalCard,
  type ReviewGateAutoPassResult,
  type ReviewGateBuildInput,
  type ReviewGateRedFlag,
  type ReviewGateRisk,
  loadReviewDecisionPolicy,
  saveReviewDecisionPolicy,
  enabledTeamRules,
  renderReviewDecisionPolicyPromptBlock,
  type ReviewDecisionPolicy,
  type PolicyRule,
  type PolicyRuleAction,
  type LoadReviewDecisionPolicyOpts,
} from "./review/index.ts";

export {
  OPERATION_APPROVAL_KINDS,
  OperationApprovalError,
  OperationApprovalService,
  classifyCapabilityRequest,
  computeOperationDigest,
  isPendingApprovalStatus,
  buildGitPushApprovalInput,
  buildFilesystemCleanupApprovalInput,
  executeFilesystemCleanupApproval,
  inspectFilesystemCleanup,
  FilesystemCleanupPreflightError,
  evaluateNativeOperationBoundary,
  evaluateUnifiedOperationPolicy,
  buildWorkspaceOperationApprovalInput,
  workspaceOperationInputFromRecord,
  ABSOLUTELY_PROHIBITED,
  APPROVAL_ADAPTER_REQUIRED,
  UNIFIED_OPERATION_POLICY_FEATURE_FLAG,
  CONTROLLED_EXECUTOR_NAMES,
  ControlledExecutorRegistry,
  UniversalApprovalStore,
  APPROVAL_CREATION_PENDING,
  NEGATIVE_PREDICATES,
  NEGATIVE_RULE_IDS,
  buildOperationFacts,
  evaluateNegativePredicates,
  operationFingerprint,
  GOVERNANCE_APPROVAL_CODES,
  GOVERNANCE_RECORD_TYPES,
  GovernanceApprovalError,
  GovernanceApprovalService,
  GOVERNANCE_ADMIN_TOOL_DEFINITIONS,
  GOVERNANCE_ADMIN_TOOL_NAMES,
  invokeGovernanceAdminTool,
  OPERATION_APPROVAL_REQUIRED,
  OPERATION_BOUNDARY_DENIED,
  type CapabilityDecision,
  type CapabilityRequest,
  type HumanConfirmationVerifier,
  type GitPushSubject,
  type GovernanceApprovalCode,
  type GovernanceApprovalServiceOptions,
  type GovernanceAdminToolDefinition,
  type GovernanceAdminToolName,
  type GovernanceAuthorizationReference,
  type GovernanceDecision,
  type GovernanceDecisionRecord,
  type GovernanceRecord,
  type GovernanceRecordInput,
  type GovernanceRecordType,
  type GovernanceSourceVerification,
  type GovernanceSourceVerifier,
  type GovernanceStatus,
  type FilesystemCleanupManifestEntry,
  type FilesystemCleanupMode,
  type FilesystemCleanupPreflight,
  type OperationApprovalKind,
  type OperationApprovalRecord,
  type OperationApprovalServiceOptions,
  type NativeOperationBoundaryDecision,
  type UnifiedOperationInput,
  type UnifiedPolicyDecision,
  type WorkspaceExecutorName,
  type WorkspaceOperationApprovalInput,
  type ControlledExecutionResult,
  type ControlledExecutorAdapter,
  type ControlledExecutorName,
  type AgentApprovalNotice,
  type ApprovalCreationResult,
  type NegativeMatch,
  type NegativeRuleId,
  type OperationFacts,
  type OperationFactsInput,
  type OperationKind,
  type OperationApprovalStatus,
  type OperationEffects,
  type PrepareOperationInput,
} from "./approval/index.ts";

export {
  maybeWriteEvalObservation,
  shouldTriggerEvalObservation,
  buildEvalObservationAnalysisFromRows,
  findEvalObservationBySourceReport,
  ensureEvalObservationForPmFinal,
  ensureEvalObservationForCloseout,
  getAdminTaskCloseout,
  type EvalObservationInput,
  type EvalRiskLevel,
  type EvalFindingPriority,
  type StructuredEvalFinding,
  type EvalScore,
  type PmSummaryConsistency,
  type EvalObservationAnalysis,
  type AdminTaskCloseout,
  type AdminTaskCloseoutOptions,
  type EnsureEvalCloseoutResult,
  type EnsureEvalOptions,
  type EvalObservationWriteOptions,
} from "./eval/index.ts";

export {
  ACTION_LOG_SCHEMA_VERSION,
  ACTION_LOG_SOURCE,
  actionEvidenceLogPath,
  actionLogsDateKey,
  fcopLogsRuntimeCommandsDir,
  fcopLogsRuntimeDir,
  listActionEvidenceLogPaths,
  appendActionEvidence,
  nextActionEventId,
  readActionEvidenceLines,
  readAllActionEvidenceRecords,
  readRecentActionEvidence,
  actionEvidenceToLogCenterRow,
  actionEvidenceDisplayPath,
  writeCommandOutputRefs,
  maybeRecordActionEvidenceFromToolCall,
  maybeRecordReportWriteAction,
  resetActionEvidenceToolCallDedupeForTests,
  resetReportWriteActionDedupeForTests,
  resetActionEventIdCounterForTests,
  type ActionEvidenceRecord,
  type ActionEventType,
  type ActionLogStatus,
  type MaybeRecordActionEvidenceFromToolCallInput,
  type MaybeRecordReportWriteActionInput,
} from "./logs/index.ts";

export {
  SkillRegistry,
  KernelDependencyValidator,
  MCPInjector,
  FCOP_KERNEL_PATTERN,
  profileForLayer,
  profileForAgent,
  isEvalRoleAgentId,
  OBSERVER_TOOLS,
  PM_RUNTIME_CONTROL_TOOLS,
  toolsForProfile,
  toolsForAgent,
  type SkillRecord,
  type SkillToolSpec,
  type SkillProvider,
  type SkillRegistryOptions,
  type SkillRegistryLogger,
  type SkillSkippedEntry,
  type KernelDependencyValidatorOptions,
  type KernelDependencyValidatorLogger,
  type ValidationFailure,
  type MCPInjectorOptions,
  type MCPInjectorLogger,
  type MCPMount,
} from "./skill/index.ts";

export {
  Runtime,
  type RuntimeCreateOptions,
  type RuntimeBootstrapResult,
} from "./Runtime.ts";

export {
  THREAD_SCHEDULE_SCHEMA_VERSION,
  buildThreadScheduleSnapshot,
  type BuildThreadScheduleSnapshotInput,
  type ThreadScheduleAttention,
  type ThreadScheduleConflict,
  type ThreadScheduleEvidenceFact,
  type ThreadScheduleExpectedEvent,
  type ThreadScheduleExpectedEventKind,
  type ThreadScheduleSnapshot,
  type ThreadScheduleTaskFact,
  type ThreadScheduleWorkItem,
} from "./governance/index.ts";

export * from "./tmpa/index.ts";

export * from "./windows-use/index.ts";

export {
  PanelEventBridge,
  PANEL_EVENT_TYPES,
} from "./panel/PanelEventBridge.ts";

export {
  normalizeUiLang,
  readPanelUiLang,
  writePanelUiLang,
  buildThinkingLanguageBlock,
  applyThinkingLanguageToPrompt,
  panelUiLangFilePath,
  isIdentityOrModelQuestion,
  translateIdentityFromThinking,
  replyLooksLikeConfigNarrative,
  alignChatReplyWithThinking,
  type UiLang,
} from "./panel/PanelUiLang.ts";

export {
  LifecycleStateMachine,
  type LifecycleStateMachineOpts,
  LifecycleKernel,
  AuthorityGuard,
  AuthorityError,
  ChildTasksNotAcceptedError,
  ChildTasksOpenError,
  ArchiveGuard,
  TaskFrontmatterStore,
  terminateSingleChildAsParentResidue,
  collectRelatedChildTasks,
  isClosedParentResidueMarked,
  isArchivedByParentMainline,
  isClosedParentResidueTask,
  CLOSED_PARENT_RESIDUE_DISPLAY,
  TransitionRecorder,
  trimTaskTransitions,
  type TrimTaskTransitionsOpts,
  type TrimTaskTransitionsResult,
  isDuplicateTransition,
  transitionCompareFromInput,
  transitionCompareFromRecord,
  assertYamlFallbackWriteAllowed,
  YamlFallbackWriteBlockedError,
  type LifecycleWriteContext,
  type AppendTransitionResult,
  findTaskPathById,
  findTaskPathByIdSync,
  lifecycleRelPath,
  normalizePath,
  stageFromPath,
  type LifecycleAction,
  type LifecycleStage,
  type LifecycleTransitionResult,
  type LifecycleWriteOpts,
  type TaskDoc,
  type TaskFm,
  type TransitionInput,
  findTaskLocationById,
  type TaskLocation,
  type TaskStorageKind,
  repairMisplacedArchivedTasks,
  isHalfArchivedTaskFile,
  type RepairMisplacedArchiveResult,
  reconcileReworkSupersededTasks,
  type ReworkReconcileResult,
} from "./lifecycle/index.ts";

export {
  LIFECYCLE_TOOL_ALIASES,
  lifecycleToolPeerNames,
  isLifecycleToolNameAllowed,
} from "./lifecycle/lifecycleToolNames.ts";

export {
  ensureLedgerLayout,
  resolveLedgerLayout,
  LedgerBuilder,
  scheduleLedgerRebuild,
  flushScheduledLedgerRebuild,
  resetScheduleLedgerRebuildForTests,
  ReportResolver,
  resolveReportAfterWrite,
  locateHotPathTask,
  approveHotPathTaskReview,
  rejectHotPathTaskReview,
  archiveHotPathTask,
  locateProjectedPmReviewLifecycleTask,
  approveProjectedLifecycleTaskReview,
  rejectProjectedLifecycleTaskReview,
  isTaskPendingPmReviewInLedger,
  findDoneReportIdForLifecycleTask,
  type ProjectedLifecycleReviewOpts,
  settleVirtualPmBranchHotPathTask,
  reconcileVirtualPmBranchArchives,
  VIRTUAL_PM_ACTOR,
  VIRTUAL_PM_AUTO_REVIEW_NOTE,
  VIRTUAL_PM_AUTO_ARCHIVE_REASON,
  isVirtualPmSettlementNote,
  isTaskSettledClosed,
  isTaskReopenedForReworkFromLedger,
  type TaskReworkLedgerFields,
  parseMarkdownFrontmatter,
  strField,
  verifyThread,
  verifyRegression237,
  type LedgerTaskRecord,
  type LedgerReportRecord,
  type LedgerThreadRecord,
  type LedgerRebuildResult,
  type LedgerLifecycleBucket,
  type LedgerOrphanRecord,
  type DiagnosticKind,
  type DiagnosticRecord,
  taskSequenceKey,
  type ReconcileResult,
  type ReconcileSummary,
  reconcileTaskDiagnostics,
  isDiagnosticVisible,
  readDiagnosticsJsonl,
  diagnosticsJsonlPath,
  type LedgerEntityInspection,
  type LedgerRegressionVerifyResult,
  type LedgerThreadVerifyResult,
  type HotPathReviewOpts,
  type VirtualPmBranchSettleResult,
} from "./ledger/index.ts";

export {
  resolveThreadContext,
  summarizeThread,
  closeAdminTaskDraft,
  detectThreadStall,
  reviewCheck,
  isQaWorkerReportToPm,
  evaluateQaReportAcceptance,
  type QaAcceptanceEvaluation,
  type QaAcceptanceVerdict,
  buildWakeDownstreamRequest,
  buildAdminRejectPmWakeRequest,
  buildPmAdminRejectReworkPromptBlock,
  extractPmAdminRejectTodoSection,
  extractTaskIdPrefixesFromText,
  resolveAdminRejectExecutionMode,
  shouldEscalatePmChatToAdminRejectColdPath,
  shouldEscalatePmChatToAdminRejectHotPath,
  isTaskHotPathBody,
  readTaskBodyByIdPrefix,
  PM_ADMIN_REJECT_TODO_HEADING,
  type AdminRejectExecutionMode,
  appendWakeJournal,
  defaultAgentIdForRole,
  aggregateUsageForThread,
  PM_BUILTIN_SKILLS,
  buildPmSkillManifestFile,
  listPmBuiltinSkills,
  listPmSkillsForRole,
  formatPmBuiltinSkillsPlaybookBlock,
  PM_CORE_CAPABILITIES_HEADING,
  buildPmCoreCapabilitiesBlock,
  ensurePmCoreCapabilitiesInSystemPrompt,
  hasPmCoreCapabilitiesInPrompt,
  pmSkillsManifestPath,
  readPmSkillManifest,
  plantPmSkillManifestIfMissing,
  runPmGovernanceCycle,
  evaluateProductDeliveryGate,
  evaluatePmSummaryGate,
  classifyProductTask,
  productBriefPath,
  planningArtifactPath,
  writePlanningArtifact,
  recordPlanningLevelOverride,
  PRODUCT_DESIGN_REQUIRED_SKILLS,
  LONG_HORIZON_SKILL_ID,
  classifyLongHorizonPlanning,
  validateLongHorizonPlan,
  persistPlanningValidation,
  readPlanningValidation,
  planningValidationPath,
  sha256Digest,
  PLANNING_GATE_DECISIONS,
  planningGateHistoryPath,
  submitPlanningGate,
  decidePlanningGate,
  recordPlanningGateDelivery,
  readPlanningGateHistory,
  currentPlanningGateState,
  planningGrantHistoryPath,
  readPlanningGrantHistory,
  issuePlanningGrant,
  currentPlanningGrant,
  planningGrantAllows,
  type PlanningGrant,
  type PmPlanningLevel,
  type PlanningArtifactStatus,
  authorizePlanningRuntimeIdentity,
  assertPlanningRuntimeIdentity,
  PlanningRuntimeIdentityError,
  type VerifiedPlanningRuntimeIdentity,
  type LongHorizonClassification,
  type PlanningFinding,
  type PlanningValidationResult,
  type ValidateLongHorizonPlanInput,
  type PlanningGateDecisionValue,
  type PlanningGateSubmission,
  type PlanningGateDecision,
  type PlanningGateRecord,
  readRecentPmGovernanceCycles,
  formatPmGovernanceCycleBlock,
  flattenRecentPmGovernanceDecisions,
  type ThreadSummary,
  type ThreadStallDetection,
  type CloseAdminTaskDraft,
  type WakeDownstreamRequest,
  type ReviewCheckResult,
  type ReviewCheckInput,
  type PmSkillManifestFile,
  type PmBuiltinSkillDefinition,
  PM_RUNTIME_CONTROL_TOOL_NAMES,
  PM_RUNTIME_CONTROL_TOOL_DEFINITIONS,
  isPmRuntimeControlTool,
  invokePmRuntimeControlTool,
  type PmRuntimeControlToolName,
  type PmRuntimeControlToolDefinition,
  type ThreadUsageSummary,
  type PmGovernanceCycleRecord,
  type PmGovernanceDecision,
  type PmGovernanceTrigger,
  type PmGovernanceDetectedState,
  type PmGovernanceSafetyLevel,
  type RunPmGovernanceCycleOpts,
  type WakeDownstreamExecutor,
  type WakeDownstreamExecutorResult,
  skillInvocationJournalPath,
  recordSkillInvocation,
  recordPlanningSkillEvidence,
  verifySkillInvocationIntegrity,
  readRecentSkillInvocations,
  enrichSkillInvocationsForDisplay,
  channelFromGovernanceTrigger,
  skillInvocationToLogCenterRow,
  invokePmSkillWithJournal,
  maybeRecordPlaybookSkillFromToolCall,
  buildSkillDisplayNameMap,
  resetPlaybookSkillDedupeForTests,
  matchPmPlaybookSkills,
  formatPmPlaybookAutoInjectBlock,
  resolveAndInjectPmPlaybookSkills,
  type SkillInvocationChannel,
  type SkillInvocationOutcome,
  type SkillInvocationRecord,
  type PmPlaybookIntent,
  type PmPlaybookMatch,
  type ResolvePmPlaybookSkillsOpts,
  type ResolvePmPlaybookSkillsResult,
  MAX_DOWNSTREAM_AUTO_NUDGES,
  evaluateWorkerReceiptWaiting,
  anyWorkerReceiptStillWaiting,
  pickQueueWorkerReceiptState,
  type WorkerReceiptWaitingPhase,
  type WorkerReceiptWaitingResult,
  type WorkerReceiptWaitingOpts,
  LIFECYCLE_STAGE_RE,
  resolveTaskCurrentBucket,
  isWorkerReceiptWaitingBucket,
  shouldShowThreadOnTeamDynamics,
  type TaskBucketInput,
  type ShouldShowThreadOpts,
  type TeamDynamicsTask,
  aggregateLifecycleCountsFromPhysical,
  collectPmOpenMainlineTasks,
  listExecutingEvidence,
  isAdminAwaitingReviewScenario,
  hasOpenCurrentBucketTask,
  hasPmFinalReportForRoot,
  resolveWorkerReceiptDurableHints,
  persistWorkerReceiptFailed,
  clearWorkerReceiptFailed,
  pruneStaleDownstreamReceiptFailures,
  mergeWorkerReceiptSignals,
  type WorkerReceiptDurableHints,
  reconcileSessionReceiptQueue,
  isRecoverableSessionFailure,
  RECOVERABLE_FAILURE_CODES,
  type SessionReceiptQueueState,
  type SessionEventSummary,
  recoverTaskExecution,
  type RecoverTaskExecutionOpts,
  type RecoverTaskExecutionResult,
  agentTaskQueuePath,
  loadAgentTaskQueue,
  enqueueAgentTask,
  getTaskDispatchStatus,
  isTaskPaused,
  isTaskQueued,
  pauseTaskExecution,
  resumeTaskExecution,
  advanceAgentQueue,
  getAgentQueueApiSnapshot,
  enqueueTaskWhenAgentBusy,
  type DispatchStatus,
  type AgentTaskQueueFile,
  scheduleDelayedPmWakeRetry,
  resetDelayedPmWakeRetryForTests,
  adminForceRecovery,
  type AdminForceRecoveryOpts,
  type AdminForceRecoveryResult,
  evaluateSequentialDispatchGuard,
  markPmStop,
  tryBeginPmRecover,
  clearPmAbnormalWindow,
  shouldEscalateAdminForceRecovery,
  resetPmExecutionGovernanceForTests,
  PM_STOP_POLICY,
  ADMIN_FORCE_RECOVERY_POLICY,
  type SequentialDispatchDecision,
  reconcileAgentTaskState,
  findPmSummaryBlockers,
  type AgentTaskReconcileState,
  type ReconcileAgentTaskStateOpts,
  type ReconcileAgentTaskStateResult,
  resolveCanonicalTaskRuntimeState,
  buildCanonicalTaskRuntimeSnapshot,
  type CanonicalTaskRuntimeState,
  type CanonicalTaskRuntimeSuggestedAction,
  type CanonicalTaskRuntimeEvidence,
  type CanonicalTaskRuntimeConflict,
  type CanonicalTaskRuntimeSnapshot,
  type CanonicalFormalReport,
  type CanonicalRegistryProjection,
  type ResolveCanonicalTaskRuntimeStateInput,
  type BuildCanonicalTaskRuntimeSnapshotInput,
  appendAgentReconcileEvent,
  AGENT_RECONCILE_EVENT_TYPES,
  type AgentReconcileEventType,
  type AgentReconcileEventPayload,
  tryAutoApprovePmWorkerReviewTask,
  reconcilePmWorkerReviewsPendingApprove,
  isPmWorkerReviewAutoApproveCandidate,
  appendAutoRecoveryEvent,
  AUTO_RECOVERY_EVENT_TYPES,
  type AutoRecoveryEventPayload,
  type AutoRecoveryEventType,
  listAutoRecoveryHistory,
  formatAutoRecoveryForPanel,
  type AutoRecoveryHistoryEntry,
  type AutoRecoveryPanelEntry,
  detectDeadlocks,
  detectPrimaryDeadlock,
  planRecovery,
  executeRecoveryPlan,
  buildAutoRecoveryContext,
  runAutoRecovery,
  getRecoveryCount,
  getKindAttemptCount,
  isDedupBlocked,
  isRecoveryLimitReached,
  recordRecoveryAction,
  tryAcquireRecoveryFence,
  releaseRecoveryFence,
  resetAutoRecoveryStateForTests,
  AUTO_RECOVERY_MAX_PER_TASK_AGENT,
  AUTO_RECOVERY_DEDUP_MS,
  AUTO_RECOVERY_MIN_RETRY_MS,
  DEADLOCK_KIND_PRIORITY,
  evaluateTaskSpecAdmission,
  persistTaskSpecAdmissionResult,
  taskSpecContentDigest,
  taskSpecAuthoredSnapshot,
  taskSpecAdmissionRecordPath,
  verifyTaskSpecAdmissionForDispatch,
  TASK_SPEC_INVALID,
  TASK_SPEC_VALID,
  type TaskSpecAdmissionAccepted,
  type TaskSpecAdmissionDiagnostics,
  type TaskSpecAuthoredSnapshot,
  type TaskSpecCapabilityMatrixRow,
  type TaskSpecAdmissionFinding,
  type TaskSpecAdmissionFindingId,
  type TaskSpecAdmissionInput,
  type TaskSpecAdmissionRejected,
  type TaskSpecAdmissionResult,
  type PlanRecoveryOpts,
  type BuildAutoRecoveryContextInput,
  type RunAutoRecoveryOpts,
  type RecoveryExecutorDeps,
  type DeadlockKind,
  type RecoveryTrigger,
  type RecoveryPlanAction,
  type RecoveryPlanStatus,
  type DeadlockDetectContext,
  type DeadlockDetection,
  type RecoveryPlan,
  type RecoveryExecutionResult,
  type RecoveryFence,
} from "./pm/index.ts";

export {
  PROJECT_EXECUTION_CONTEXT_VERSION,
  createProjectExecutionContext,
  assertProjectExecutionContext,
  type ProjectExecutionContext,
  type ProjectExecutionContextInput,
} from "./project/ProjectExecutionContext.ts";

export {
  AGENT_SKILLS_MANIFEST_SOURCE_REL,
  AGENT_SKILLS_MANIFEST_PROJECTION_REL,
  agentSkillsManifestSourcePath,
  agentSkillsManifestProjectionPath,
  collectAgentSkillPackagePaths,
  mergeAgentSkillsManifest,
  plantAgentSkillsManifestIfMissing,
  syncAgentPlaybookAssets,
  type PlantAgentSkillsManifestResult,
  type SyncAgentPlaybookAssetsResult,
} from "./skills/AgentPlaybookManifest.ts";

export {
  PLAYBOOK_SKILL_GROUP_DEFS,
  readAgentSkillsManifestResolved,
  buildAgentSkillsCatalog,
  enrichAgentSkillsCatalogPackages,
  loadAgentSkillsCatalog,
  AgentSkillsManifestMissingError,
  AgentSkillsManifestReadError,
  AgentSkillsManifestInvalidError,
  type AgentSkillCatalogEntry,
  type AgentSkillCatalogGroup,
  type AgentSkillsCatalog,
  type AgentSkillsManifestReadFrom,
  type ReadAgentSkillsManifestResult,
} from "./skills/AgentPlaybookCatalog.ts";

export {
  matchAgentContextSkills,
  formatSkillContextAutoInjectBlock,
  resolveAndInjectAgentContextSkills,
  type SkillRouteIntent,
  type SkillContextMatch,
  type ResolveSkillContextOpts,
  type ResolveSkillContextResult,
} from "./skills/SkillContextRouter.ts";

export {
  AGENT_SKILL_ROUTING_HEADING,
  buildAgentSkillRoutingBlock,
  ensureAgentSkillRoutingInSystemPrompt,
  hasAgentSkillRoutingInPrompt,
} from "./skills/AgentSkillRouting.ts";

export type {
  AgentRecord,
  SessionRecord,
  RuntimeBindingMode,
  AgentFailure,
  RuntimeEvent,
  RuntimeEventType,
  Unsubscribe,
  ReconciliationReport,
  ReconciliationSuccessEntry,
  ReconciliationFailedEntry,
  ReconciliationOrphanedEntry,
  ReconciliationRecreatedEntry,
  ReconciliationForeignEntry,
  ReconciliationDriftEntry,
  KernelValidationFailureEntry,
} from "./types/state.ts";

export { ReconciliationStrategy } from "./types/state.ts";

// ─────────────────────────────────────────────────────────────────────────
// P4 sprint Day 1 (TASK-20260511-007) — fcop@1.1.0 bridge via pythonia.
// `FcopProjectClient` is the new TS façade for fcop's Python API. Calling
// any exported symbol from here boots the pythonia child Python process
// (StdioCom.start runs at `import 'pythonia'` time), so consumers MUST
// also call `disposeFcopBridge()` on graceful shutdown — see fcop-client.ts
// JSDoc.
// ─────────────────────────────────────────────────────────────────────────
export {
  FcopProjectClient,
  FcopClientError,
  assertFcopReady,
  disposeFcopBridge,
  type FcopProjectClientOptions,
  type FcopTask,
  type FcopTaskFrontmatter,
  type FcopReview,
  type FcopHumanApproval,
  type FcopValidationIssue,
  type WriteTaskSpec,
  type ListTasksFilter,
  type WriteReviewSpec,
  type MarkHumanApprovedSpec,
  type Priority as FcopPriority,
  type RiskLevel as FcopRiskLevel,
  type ReviewDecision as FcopReviewDecision,
  type ReviewSubjectType as FcopReviewSubjectType,
  type HumanApprovalDecision,
  type HumanApprovalChannel,
} from "./_external/fcop-client.ts";

export {
  isTransientSdkError,
  TRANSIENT_SDK_BACKOFF_MS,
  TRANSIENT_SDK_DELAYED,
  TransientSdkDelayedError,
  withTransientSdkRetry,
  type TransientSdkRetryOptions,
  type TransientSdkRetryResult,
} from "./_internal/transient-sdk-error.ts";

export { CheckThrottle } from "./_internal/check-throttle.ts";

export {
  agentSdkMutex,
  agentWakeMutex,
  globalFileWriteMutex,
  taskLifecycleMutex,
  KeyedMutex,
} from "./_internal/KeyedMutex.ts";

export {
  evaluateAgentWakeGate,
  evaluateTaskDispatchWakeGate,
  type AgentWakeGateResult,
  type AgentWakeSkipReason,
} from "./_internal/AgentWakeGuard.ts";

export {
  lifecycleTransitionDedupe,
  LifecycleTransitionDedupe,
  buildLifecycleTransitionKey,
} from "./_internal/LifecycleTransitionDedupe.ts";

export {
  eventDisplayDedupeRegistry,
  EventDisplayDedupeRegistry,
  buildDisplayDedupeKey,
} from "./_internal/EventDisplayDedupe.ts";

export {
  isGovernanceReportToPm,
  isWorkerReportToPm,
  GOVERNANCE_REPORT_SENDERS,
} from "./fcop/governance.ts";

export {
  findReportForTaskOnDisk,
  findReportPathForTaskOnDisk,
  roleFromAgentId,
  type FindReportForTaskOpts,
} from "./_internal/report-reconcile.ts";

export {
  isAdminToPmRootTask,
  reportBelongsToLedgerTask,
} from "./ledger/reportParenting.ts";

export {
  isEphemeralCoordinationFilename,
  isCanonicalReportMarkdownFilename,
  shouldIgnoreCoordinationWatchPath,
  canonicalReportBasenameFromTmp,
} from "./_internal/report-ephemeral.ts";

export {
  quarantineStaleReportTmps,
  type QuarantineTmpReportsResult,
} from "./_internal/report-tmp-quarantine.ts";

export {
  atomicWriteJson,
  atomicWriteFcopMarkdown,
  withReportWriteLock,
  cleanupStaleReportTmpsForTarget,
  buildUniqueTmpPath,
  type AtomicWriteFcopResult,
} from "./_internal/atomic-write.ts";

export {
  runtimeAlertManager,
  RuntimeAlertManager,
  type IngestRuntimeAlertInput,
  type IngestFromEventInput,
} from "./alerts/RuntimeAlertManager.ts";

export {
  CATEGORY_LABELS,
  NO_TOAST_CODES,
  type RuntimeAlert,
  type RuntimeAlertsSnapshot,
  type AlertCategory,
  type AlertSeverity,
  type AlertStatus,
} from "./alerts/alert-taxonomy.ts";

export {
  type ExecutionState,
  artifactPathExists,
  isTaskCancelled,
  isTaskSuperseded,
  normalizeTaskIdPrefix,
  resolveArtifactPathForThread,
  resolveExecutionState,
} from "./pm/executionState.ts";

export {
  type ExecutionGateContext,
  type ExecutionTaskMeta,
  filterThreadTasks,
  ledgerTaskToGateRef,
  loadDispatchGateContext,
  loadExecutionGateContext,
} from "./pm/taskDispatchContext.ts";

export {
  type QaDispatchBlockReason,
  type QaDispatchGateResult,
  canDispatchQA,
  qaGateToDispatchSkipReason,
} from "./pm/qaDispatchGate.ts";

export {
  type PmEvaluateAction,
  type PmEvaluateResult,
  pmEvaluate,
} from "./pm/pmEvaluate.ts";

export {
  classifyFcopToolOutcome,
  type ClassifiedToolOutcome,
  type ToolOutcomeKind,
} from "./registry/FcopToolOutcome.ts";

export {
  type DispatchGateReportRef,
  type DispatchGateTaskRef,
  evaluateDispatchEligibility,
  isDoneReportStatus,
  isUpstreamWorkerSettled,
} from "./pm/taskDispatchGate.ts";

export {
  DispatchAttemptStore,
  type DispatchAttempt,
  type DispatchAttemptStatus,
  type ExecutionLease,
  type ClaimExecutionLeaseResult,
} from "./scheduler/DispatchAttemptStore.ts";

export {
  classifyTaskDispatchStall,
  type TaskDispatchStallClassification,
  type TaskDispatchStallInput,
  type TaskDispatchStallState,
} from "./scheduler/TaskDispatchStall.ts";

export {
  RUNTIME_TASK_CONTROL_TOOL_NAMES,
  RUNTIME_TASK_CONTROL_TOOL_DEFINITIONS,
  isRuntimeTaskControlTool,
  invokeRuntimeTaskControlTool,
  type RuntimeTaskControlToolName,
  type RuntimeTaskControlToolDefinition,
} from "./scheduler/RuntimeTaskControlTools.ts";

export {
  resolveProjectRoot,
  sameProjectRoot,
  type ProjectRootResolution,
} from "./project/ProjectRootResolver.ts";

export * from "./switchboard/index.ts";

