/**
 * Browser bundle entry for the Tier 1 runner (built by vite.tier1.config.ts
 * into extension/tier1.bundle.js). Everything reachable from here must stay
 * free of node:fs / node:child_process — the pipeline's pure modules only.
 */
// isomorphic-git's commit/pack paths reach for the global Buffer, which no
// browser context provides. The `buffer` polyfill package is already in the
// dependency graph — promote it to the global the way Node does.
import { Buffer as BufferPolyfill } from 'buffer';
const g = globalThis as { Buffer?: unknown };
if (typeof g.Buffer === 'undefined') g.Buffer = BufferPolyfill;

export { runTier1Job, TIER1_DEFAULT_GATES } from './runner';
// SET 68 — judgment gates: evidence formatting + deterministic ruling parse
// (the offscreen host builds the card and parses the unsupervised ruling).
export { formatJudgmentPrompt, parseLlmRuling } from './judgment';
export type { JudgmentDecision, JudgmentEvidence } from './judgment';
export type { Tier1Event, Tier1Result, Tier1Gates } from './runner';
export { fetchCorpus, DEFAULT_CORPUS_BASE } from './corpus';
export type { Corpus, CorpusManifest } from './corpus';
export { buildRepo, buildRepoZip, repoToZip } from './exportRepo';
export {
  buildTestProgram,
  makeEvalSuiteRunner,
  setProgramParseProbe,
  setModuleEvalProbe,
  GATE_UNAVAILABLE,
  vetProgramParseAfterWriteAsync,
  vetArtifactWritesAsync,
  programParseErrorAsync,
  probeModuleEvalAsync,
  probeErrOrNull,
} from './testExec';
export type { SuiteRunner, SuiteRunResult, ProgramParseProbe, ModuleEvalProbe } from './testExec';
export {
  wireSuiteScaffoldImports,
  scaffoldOwnershipMap,
  isScaffoldOwnedSymbol,
} from './suiteScaffoldWire';
export { LocalLlmClient } from '../core/localLlm';
export type { FeatureSpec, GeneratedFile, LlmClient } from '../core/types';
export { HARNESS_CONTRACT_SYSTEM, composeEncodePrompt } from '../core/prompts';
export {
  promptHasVerifiableResidue,
  scanCapabilities,
  attemptMechanicalFix,
  findPromptLineNumber,
  hasAssertableStructure,
  classifyFailure,
  isCrashClass,
  normalizeCrashSignature,
  crashRepairPrecondition,
  scanTopLevelDeclarations,
  ownerFileForSymbol,
  stripTopLevelDecl,
  refusesModelDraw,
  refusesImplRedrawForOwnedSymbol,
} from './substrate';
export type {
  CapabilityHit,
  OutOfScopeCapability,
  MechanicalFixAttempt,
  MechanicalFixStatus,
  ClassifiedFailure,
  FailureKind,
} from './substrate';
export {
  REPAIR_ORACLE,
  lookupRepairOracle,
  formatRepairOracleHint,
} from './repairOracle.generated';
export type { RepairOracleEntry } from './repairOracle.generated';
export {
  matchPricing,
  estimateCost,
  comparativeCosts,
  pickFamilyRefs,
  buildRunCostSnapshot,
  formatUsd,
  normalizeModelId,
  COST_FAMILIES,
} from './pricing';
export type { PricingTable, PricingFeed, RunCostSnapshot, CostLine } from './pricing';
export { runVanillaJob, counterfactualSubstrate, specFromVanilla } from './vanilla';
export type { RunMode, VanillaResult, CounterfactualReport } from './vanilla';
export { isPrivateHost } from '../core/netHost';
export {
  assembleSuperbuffer,
  extractSpecConstants,
  signatureSimilarity,
  nameTokenOverlap,
  freeformPatternKey,
  shouldProposeCladePromotion,
  draftCladePromotion,
  formatCladeCandidateMessage,
} from './superbuffer';
export type { SuperbufferAssembly, CladePromotionProposal } from './superbuffer';
export {
  attemptSpecConstantConformance,
  parserGuidedImplRepair,
  polishParseCrashContent,
  mergeLessons,
  selectMechanicalCandidate,
} from './substrate';
export { attributeEvalCrash, probeModuleEval, probeWholeArtifactEval } from './testExec';
export {
  caseFamily,
  extractDroppedCaseNames,
  scanRecurringFailures,
  RESPONSE_SHAPE_CLADE,
  FORMAT_STRING_CLADE,
  PAGINATION_CLADE,
} from './clades';
export type { RunFailureSnapshot } from './clades';
export {
  conformExportsToStubs,
  diffExportsVsStubs,
  parseExportedFunctions,
} from './exportConformance';
export type { ExportDiff, ExportContract } from './exportConformance';
export {
  promoteLessonsToHandlerCandidates,
} from './handlerCandidate';
export type { HandlerCandidate, HealedInstance } from './handlerCandidate';
export {
  formatSubstrateHitRate,
  formatClassKeyCoverageRule,
} from './reportEvidence';
export {
  cloneSafeForPersist,
  formatPersistFailed,
  formatCheckpointHeader,
  formatPersistStep,
  emptyPipelineLogLabel,
  isCheckpointedUnfinalized,
  parsePersistAck,
  mergePersistRecord,
  buildMinimalFallbackRecord,
  RUN_RECORD_MISSING,
} from './persistSafe';
