@warmdrift/kgauto-compiler 2.0.0-alpha.60 → 2.0.0-alpha.62

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +81 -46
  2. package/dist/brain-proxy.js +5 -1
  3. package/dist/brain-proxy.mjs +1 -1
  4. package/dist/{chunk-5TI6PNSK.mjs → chunk-3KQAID63.mjs} +5 -0
  5. package/dist/{chunk-IUWFML6Z.mjs → chunk-65ZMX5OT.mjs} +5 -1
  6. package/dist/{chunk-RQ3BUUB6.mjs → chunk-ABFXMO73.mjs} +1 -1
  7. package/dist/{chunk-IIMPJZNH.mjs → chunk-YZRPNSSQ.mjs} +10 -0
  8. package/dist/dialect.d.mts +14 -2
  9. package/dist/dialect.d.ts +14 -2
  10. package/dist/dialect.js +5 -0
  11. package/dist/dialect.mjs +1 -1
  12. package/dist/glassbox/index.d.mts +3 -3
  13. package/dist/glassbox/index.d.ts +3 -3
  14. package/dist/glassbox-routes/format.d.mts +2 -2
  15. package/dist/glassbox-routes/format.d.ts +2 -2
  16. package/dist/glassbox-routes/index.d.mts +4 -4
  17. package/dist/glassbox-routes/index.d.ts +4 -4
  18. package/dist/glassbox-routes/index.js +10 -0
  19. package/dist/glassbox-routes/index.mjs +1 -1
  20. package/dist/glassbox-routes/react/index.d.mts +2 -2
  21. package/dist/glassbox-routes/react/index.d.ts +2 -2
  22. package/dist/index.d.mts +255 -7
  23. package/dist/index.d.ts +255 -7
  24. package/dist/index.js +841 -7
  25. package/dist/index.mjs +808 -9
  26. package/dist/{ir-BC4uDL98.d.mts → ir-B2dRyJXO.d.mts} +84 -11
  27. package/dist/{ir-B2h0GAEL.d.ts → ir-ClU56aBc.d.ts} +84 -11
  28. package/dist/key-health.js +1 -1
  29. package/dist/key-health.mjs +1 -1
  30. package/dist/profiles.d.mts +1 -1
  31. package/dist/profiles.d.ts +1 -1
  32. package/dist/{types-CKuu7Clz.d.ts → types-ByN3r0_7.d.ts} +1 -1
  33. package/dist/{types-CsB2YASc.d.ts → types-C-Wp7HpI.d.ts} +1 -1
  34. package/dist/{types-B-pzBJKf.d.mts → types-CSDweZsl.d.mts} +1 -1
  35. package/dist/{types-CRy90cjp.d.mts → types-axAX1Bg0.d.mts} +1 -1
  36. package/package.json +3 -3
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CompilePolicy, N as NormalizedResponse, A as ApiKeys, P as ProviderOverrides, a as CompiledRequest, b as PromptIR, c as CallOptions, d as CallResult, S as SystemModelMessage, e as CompileResult, B as BestPracticeAdvisory, f as SectionRewrite, R as RecordInput, g as RecordOutcomeInput, O as OutcomeResult, h as OracleScore, i as Adapter, j as PerAxisMetrics, k as Provider, l as ChainEntry, G as Grounding } from './ir-BC4uDL98.mjs';
2
- export { m as CallAttempt, n as CallError, o as ChainModelEntry, p as ChainWithGrounding, q as Constraints, E as EffortLevel, F as FallbackReason, H as HistoryCachePolicy, I as IntentDeclaration, M as Message, r as MutationApplied, s as NormalizedTokens, t as OutcomeKind, u as PerAxisMetricsByModel, v as PromptSection, w as SectionKind, x as ShadowProbeConfig, T as ToolCall, y as ToolDefinition } from './ir-BC4uDL98.mjs';
1
+ import { C as CompilePolicy, N as NormalizedResponse, A as ApiKeys, P as ProviderOverrides, a as CompiledRequest, b as PromptIR, c as CallOptions, d as CallResult, S as SystemModelMessage, e as CompileResult, B as BestPracticeAdvisory, f as SectionRewrite, R as RecordInput, g as RecordOutcomeInput, O as OutcomeResult, h as OracleScore, i as Adapter, j as PerAxisMetrics, k as Provider, l as ChainEntry, G as Grounding } from './ir-B2dRyJXO.mjs';
2
+ export { m as CallAttempt, n as CallError, o as ChainModelEntry, p as ChainWithGrounding, q as Constraints, E as EffortLevel, F as FallbackReason, r as GoldenCaptureOptions, H as HistoryCachePolicy, I as IntentDeclaration, M as Message, s as MutationApplied, t as NormalizedTokens, u as OutcomeKind, v as PerAxisMetricsByModel, w as PromptSection, x as SectionKind, y as ShadowProbeConfig, T as ToolCall, z as ToolDefinition, D as captureGoldenIr, J as parseGoldenCaptureRate, K as resolveGoldenCaptureRate, L as shouldCaptureGolden } from './ir-B2dRyJXO.mjs';
3
3
  import { ModelProfile, ArchetypeConvention } from './profiles.mjs';
4
4
  export { ALIASES, CacheStrategy, CliffRule, LATENCY_TIER_MS, LatencyTier, LoweringSpec, RecoveryRule, StructuredOutputCapability, SystemPromptMode, allProfiles, getProfile, latencyTierOf, profilesByProvider, tryGetProfile } from './profiles.mjs';
5
5
  export { BrainForwardConfig, BrainForwardRoutes, createBrainForwardRoutes } from './brain-proxy.mjs';
@@ -440,6 +440,65 @@ interface BrainConfig {
440
440
  }
441
441
  declare function configureBrain(config: BrainConfig): void;
442
442
  declare function clearBrain(): void;
443
+ interface BrainHealthSnapshot {
444
+ configState: 'configured' | 'not_configured';
445
+ /** Host of the configured endpoint (never the full URL — no secrets/paths). */
446
+ endpointHost?: string;
447
+ /** True when writes are awaited (BrainConfig.sync). */
448
+ sync: boolean;
449
+ /** Write POSTs attempted (all routes, primary + secondary). */
450
+ sent: number;
451
+ /** Write POSTs acknowledged 2xx without redirect. */
452
+ acked: number;
453
+ /** Write POSTs that failed (non-2xx, redirect, timeout, network throw). */
454
+ failed: number;
455
+ /** Subset of `failed` that failed the redirect check (middleware-drift class). */
456
+ redirected: number;
457
+ lastAckAt?: string;
458
+ lastFailureAt?: string;
459
+ /** Most recent failure message, truncated. */
460
+ lastFailure?: string;
461
+ deadLetterCount: number;
462
+ }
463
+ interface BrainDeadLetterEntry {
464
+ /** Brain route segment the payload was bound for. */
465
+ route: 'outcomes' | 'compile_outcome_quality' | 'probe_outcomes' | 'compile_outcome_advisories' | 'golden_irs';
466
+ /**
467
+ * Endpoint the payload was originally bound for. Flush replays ONLY entries
468
+ * matching the currently-configured endpoint — a reconfigure must never
469
+ * replay another brain's payloads into the new target (caught live by
470
+ * smoke-brain-timeout: a hung-socket test payload auto-flushed into the
471
+ * real brain after the smoke re-pointed configureBrain).
472
+ */
473
+ endpoint: string;
474
+ /** The exact JSON body that failed to land. */
475
+ payload: unknown;
476
+ failedAt: string;
477
+ /** Delivery attempts so far (1 = the original failed POST). */
478
+ attempts: number;
479
+ lastError: string;
480
+ }
481
+ /**
482
+ * Process-local brain write delivery ledger. `acked` is the only number that
483
+ * means "a row landed" — fire-and-forget callers that need delivery evidence
484
+ * read this (or set `BrainConfig.sync`). Cheap enough to attach to any debug
485
+ * or health surface the consumer already exposes.
486
+ */
487
+ declare function brainHealth(): BrainHealthSnapshot;
488
+ /** Read-only view of the pending dead-letter (for consumer-side persistence). */
489
+ declare function peekBrainDeadLetter(): readonly BrainDeadLetterEntry[];
490
+ /**
491
+ * Replay pending dead-letter payloads against the configured brain. Delivered
492
+ * entries are removed; failures increment `attempts` and entries are dropped
493
+ * after 3 total attempts (bounded — never an infinite retry, per the Redis
494
+ * DLQ rule). Safe to call any time; no-ops when unconfigured or already
495
+ * flushing. Also runs opportunistically after any successful write.
496
+ */
497
+ declare function flushBrainDeadLetter(): Promise<{
498
+ attempted: number;
499
+ delivered: number;
500
+ remaining: number;
501
+ }>;
443
502
  declare function record(input: RecordInput): Promise<void>;
444
503
  /**
445
504
  * Wire shape POSTed by `record()` to the brain proxy's `/outcomes` endpoint.
@@ -522,8 +581,10 @@ interface OutcomePayload {
522
581
  * = true for runtime contexts that can't tolerate fire-and-forget teardown
523
582
  * (Vercel Edge, Cloudflare Workers, AWS Lambda) — see L-086.
524
583
  *
525
- * Returns OutcomeResult with ok: false + stable reason on persistence
526
- * failure. Never throws.
584
+ * Returns (alpha.61): `{ok: true}` only when the POST was acknowledged 2xx
585
+ * (sync mode); `{ok: 'queued'}` in fire-and-forget mode (handed to the
586
+ * runtime, NOT acked — read `brainHealth()` for delivery evidence);
587
+ * `{ok: false, reason}` on known failure. Never throws.
527
588
  */
528
589
  declare function recordOutcome(input: RecordOutcomeInput): Promise<OutcomeResult>;
529
590
  /**
@@ -625,6 +686,193 @@ declare function buildShadowProbeRow(input: ShadowProbeRecordInput): {
625
686
  * `/probe_outcomes` the same way they forward `/outcomes`.
626
687
  */
627
688
  declare function recordShadowProbe(input: ShadowProbeRecordInput): Promise<void>;
689
+ /**
690
+ * Golden-IR capture input. UNLIKE every other brain write, this row carries the
691
+ * RAW full PromptIR — an explicit, documented posture change from the s51
692
+ * "brain holds no raw consumer prompts" rule, gated on consumer opt-in
693
+ * (`KGAUTO_GOLDEN_CAPTURE` env / `CallOptions.goldenCapture`). The `consent`
694
+ * field records the provenance of that opt-in at capture time.
695
+ */
696
+ interface GoldenIrRecordInput {
697
+ appId: string;
698
+ archetype: string;
699
+ /** hashShape() of the call at compile time (peek before record() pops). */
700
+ shapeKey?: string;
701
+ /** The full PromptIR, verbatim. Plain JSON by construction (ir.ts). */
702
+ ir: unknown;
703
+ incumbentModel: string;
704
+ incumbentOutput?: string;
705
+ incumbentLatencyMs?: number;
706
+ incumbentTokensIn?: number;
707
+ incumbentTokensOut?: number;
708
+ /** 'sampled' (capture flag fired on live traffic) | 'curated' (operator). */
709
+ source: 'sampled' | 'curated';
710
+ /** Consent provenance, e.g. 'KGAUTO_GOLDEN_CAPTURE=0.1 (consumer env opt-in)'. */
711
+ consent: string;
712
+ /** Optional link back to the compile handle of the captured call. */
713
+ outcomeHandle?: string;
714
+ }
715
+ /** Pure builder for the `kgauto_golden_irs` row (snake_case wire shape). */
716
+ declare function buildGoldenIrRow(input: GoldenIrRecordInput): {
717
+ app_id: string;
718
+ intent_archetype: string;
719
+ shape_key: string | null;
720
+ ir: unknown;
721
+ incumbent_model: string;
722
+ incumbent_output: string | null;
723
+ incumbent_latency_ms: number | null;
724
+ incumbent_tokens_in: number | null;
725
+ incumbent_tokens_out: number | null;
726
+ source: 'sampled' | 'curated';
727
+ consent: string;
728
+ outcome_handle: string | null;
729
+ };
730
+ /**
731
+ * Persist one golden IR to `kgauto_golden_irs`. Same G1 write-leg discipline as
732
+ * every other brain route (redirect check, ledger, dead-letter); fire-and-forget
733
+ * by default, honors `BrainConfig.sync`. Never throws.
734
+ */
735
+ declare function recordGoldenIr(input: GoldenIrRecordInput): Promise<void>;
736
+
737
+ /**
738
+ * Golden-set eval engine (alpha.62, eval spine — design brief 2026-07-17).
739
+ *
740
+ * Implements the quality-floor-guarded model-swap contract:
741
+ *
742
+ * > A model replaces another on a surface only by demonstrating
743
+ * > same-or-better quality on that surface's real workload — never by
744
+ * > price, recency, or judgment alone.
745
+ *
746
+ * One eval run: load the active golden set for (app, archetype), replay every
747
+ * IR on BOTH the incumbent and the candidate (fresh outputs on both sides —
748
+ * fair comparison, no stale stored output), apply mechanical hard floors,
749
+ * then a pairwise LLM judge (order-swapped to cancel position bias), and
750
+ * aggregate under the non-inferiority rule:
751
+ *
752
+ * promote-ready ⇔ wins-or-ties ≥ threshold (default 80%)
753
+ * AND zero hard-floor violations
754
+ * AND candidate p50 latency ≤ ratio × incumbent p50
755
+ *
756
+ * Evidence lands as brain rows: one `kgauto_golden_eval_runs` aggregate + one
757
+ * `probe_outcomes` row per case (`replay_source='golden-replay'`, full
758
+ * fidelity by construction) + an evidence-attached advisory on the consumer's
759
+ * advisory surface (trust-ladder Stage 1: eval runs, human clicks promote).
760
+ *
761
+ * Judging is PAIRWISE, not absolute — it operationalizes the quality-floor
762
+ * Common Pattern directly ("same or better, never less"). Each pair is judged
763
+ * twice with A/B order swapped; disagreement between the two orders is scored
764
+ * a tie (the honest reading of positional noise).
765
+ *
766
+ * This module is operator-grade: it talks to the brain via direct PostgREST
767
+ * with a service key (the watchers' convention), never through consumer
768
+ * proxies, and it deliberately does NOT call record() — eval traffic must not
769
+ * pollute compile_outcomes.
770
+ */
771
+
772
+ /**
773
+ * What "better" means per archetype. Fed verbatim into the pairwise judge
774
+ * prompt. Kept deliberately short — the judge sees the full request, so the
775
+ * rubric only needs to name the failure modes that matter for the archetype.
776
+ */
777
+ declare const JUDGE_RUBRICS: Record<string, string>;
778
+ declare function rubricFor(archetype: string): string;
779
+ /** Render the golden IR's request for the judge (system sections + user turn). */
780
+ declare function renderIrForJudge(ir: PromptIR): string;
781
+ declare function buildPairwiseJudgePrompt(args: {
782
+ archetype: string;
783
+ renderedInput: string;
784
+ outputA: string;
785
+ outputB: string;
786
+ }): string;
787
+ type PairwiseWinner = 'A' | 'B' | 'tie';
788
+ /** Parse the judge's JSON verdict. Returns undefined when unparseable. */
789
+ declare function parseJudgeVerdict(raw: string): {
790
+ winner: PairwiseWinner;
791
+ rationale?: string;
792
+ } | undefined;
793
+ /**
794
+ * Combine the two order-swapped verdicts into a case verdict. Both verdicts
795
+ * are expressed in incumbent/candidate terms BEFORE this call (the caller
796
+ * un-swaps run 2). Agreement → that verdict; disagreement → 'tied' (positional
797
+ * noise reads as a tie, never as a win).
798
+ */
799
+ declare function combineOrderSwappedVerdicts(run1: 'candidate-better' | 'current-better' | 'tied', run2: 'candidate-better' | 'current-better' | 'tied'): 'candidate-better' | 'current-better' | 'tied';
800
+ interface GoldenEvalOptions {
801
+ appId: string;
802
+ archetype: string;
803
+ candidateModel: string;
804
+ /**
805
+ * Incumbent to compare against. Default: the most frequent incumbent_model
806
+ * across the loaded golden set (the surface's de-facto leader).
807
+ */
808
+ incumbentModel?: string;
809
+ /** Judge model id. Default 'claude-opus-4-8' (judge chain tier 0). */
810
+ judgeModel?: string;
811
+ /** Max golden cases to load (newest first). Default 50. */
812
+ limit?: number;
813
+ /** Non-inferiority threshold on wins-or-ties. Default 0.8. */
814
+ winOrTieThreshold?: number;
815
+ /** Latency hard floor: candidate p50 ≤ ratio × incumbent p50. Default 3. */
816
+ latencyFloorRatio?: number;
817
+ /** Minimum judged cases for a non-inconclusive verdict. Default 5. */
818
+ minJudgeableCases?: number;
819
+ /** What fired the eval. Default 'manual' (Stage 1). */
820
+ triggerSource?: 'manual' | 'supply' | 'price' | 'demand';
821
+ /** Brain access — direct PostgREST (operator convention). */
822
+ supabaseUrl: string;
823
+ serviceKey: string;
824
+ /** Provider keys for the replay + judge calls. Default: process.env. */
825
+ apiKeys?: ApiKeys;
826
+ fetchImpl?: typeof fetch;
827
+ /** Replay + judge but write NOTHING to the brain. */
828
+ dryRun?: boolean;
829
+ onProgress?: (message: string) => void;
830
+ }
831
+ interface GoldenEvalCase {
832
+ goldenIrId: number;
833
+ verdict: 'candidate-better' | 'tied' | 'current-better' | 'inconclusive';
834
+ judgeRationale?: string;
835
+ /** Hard-floor violations on the candidate side for this case. */
836
+ floorViolations: Array<'empty' | 'schema' | 'candidate_error'>;
837
+ errorClass?: string;
838
+ incumbent?: {
839
+ latencyMs: number;
840
+ tokensIn: number;
841
+ tokensOut: number;
842
+ text: string;
843
+ };
844
+ candidate?: {
845
+ latencyMs: number;
846
+ tokensIn: number;
847
+ tokensOut: number;
848
+ text: string;
849
+ };
850
+ /** Case excluded from the denominator (incumbent replay/judge failed). */
851
+ excludedReason?: string;
852
+ }
853
+ interface GoldenEvalRunResult {
854
+ verdict: 'promote-ready' | 'not-inferior' | 'inconclusive';
855
+ runId?: number;
856
+ appId: string;
857
+ archetype: string;
858
+ incumbentModel: string;
859
+ candidateModel: string;
860
+ judgeModel: string;
861
+ nCases: number;
862
+ wins: number;
863
+ ties: number;
864
+ losses: number;
865
+ floorViolations: number;
866
+ floorDetail: Record<string, number>;
867
+ winOrTieRatio: number | null;
868
+ latencyRatio: number | null;
869
+ costIncumbentUsd: number | null;
870
+ costCandidateUsd: number | null;
871
+ advisoryOutcomeId?: number;
872
+ cases: GoldenEvalCase[];
873
+ notes: string[];
874
+ }
875
+ declare function runGoldenEval(opts: GoldenEvalOptions): Promise<GoldenEvalRunResult>;
628
876
 
629
877
  /**
630
878
  * alpha.60 — the library's own version, baked as a constant so Edge/Worker
@@ -639,7 +887,7 @@ declare function recordShadowProbe(input: ShadowProbeRecordInput): Promise<void>
639
887
  * guard in `tests/version.test.ts` fails the suite (and therefore
640
888
  * `prepublishOnly`) when they diverge — a stale constant cannot reach npm.
641
889
  */
642
- declare const LIBRARY_VERSION = "2.0.0-alpha.60";
890
+ declare const LIBRARY_VERSION = "2.0.0-alpha.62";
643
891
 
644
892
  /**
645
893
  * Oracle contract — how an app tells the brain whether a response was good.
@@ -1825,7 +2073,7 @@ declare function getSequentialStarterChainWithGrounding(archetype: IntentArchety
1825
2073
  * Sync reader for the brain-driven chains map. Returns bundled
1826
2074
  * STARTER_CHAINS when brain-query is disabled, cold, or unreachable.
1827
2075
  */
1828
- declare const loadChainsFromBrain: () => Record<"ask" | "hunt" | "classify" | "summarize" | "generate" | "extract" | "plan" | "critique" | "transform", string[]>;
2076
+ declare const loadChainsFromBrain: () => Record<"ask" | "hunt" | "classify" | "summarize" | "generate" | "extract" | "plan" | "critique" | "transform" | "judge", string[]>;
1829
2077
 
1830
2078
  /**
1831
2079
  * archetype-perf-brain — alpha.11 KG-12 adapter.
@@ -2428,4 +2676,4 @@ declare function markPromoteReadyHandled(opts: MarkPromoteReadyHandledOptions):
2428
2676
  */
2429
2677
  declare function compile(ir: PromptIR, opts?: CompileOptions): CompileResult;
2430
2678
 
2431
- export { ABSOLUTE_FLOOR, type AISDKConvertedMessage, ARCHETYPE_FAMILY_FITS, ARCHETYPE_FLOOR_DEFAULT, type ActionableAdvisory, Adapter, type AdvisoryResolutionSource, type AdvisorySeverity, type AdvisoryStatus, type AdvisorySuggestedFix, ApiKeys, type AppOracle, type ApplySectionRewritesArgs, type ApplySectionRewritesResult, ArchetypeConvention, type ArchetypeFamilyFit, type ArchetypePerfMap, type ArchetypePerfNMap, type ArchetypePerfScoreResult, type AttachCacheControlResult, BestPracticeAdvisory, type BrainConfig, type BrainQueryConfig, type BrainReadEnv, CallOptions, CallResult, ChainEntry, type CompatibilityIntent, type CompileForAISDKv6Result, type CompileOptions, CompilePolicy, CompileResult, CompiledRequest, DEFAULT_FINDINGS_ENDPOINT, type ExclusionFindingRow, type ExclusionResolutionSource, type ExecuteErr, type ExecuteOk, type ExecuteOptions, type ExecuteResult, type FallbackPosture, FamilyResolutionError, type GetActionableAdvisoriesOptions, type GetDefaultFallbackChainOpts, type GetPerAxisMetricsOpts, type GetRecommendedPrimaryOptions, Grounding, IntentArchetypeName, LIBRARY_VERSION, type LLMJudgeOptions, MEASURED_GROUNDING_MIN_N, type MarkAdvisoryResolvedOptions, type MarkExclusionFindingHandledOptions, type MarkPromoteReadyHandledOptions, type ModelBrainRow, type ModelCompatibility, ModelProfile, NormalizedResponse, type OracleContext, OracleScore, type OutcomePayload, OutcomeResult, PRODUCER_OWNED_RULE_CODES, PROVIDER_ENV_KEYS, PerAxisMetrics, type PricingRow, type ProbeShadowOptions, type ProbeShadowServed, type ProfileToRowOptions, type PromoteReadyFindingRow, type PromoteReadyResolution, PromptIR, Provider, ProviderOverrides, type ProviderReachability, RULE_SEQUENTIAL_TOOL_CLIFF, type ReachabilityOpts, RecordInput, RecordOutcomeInput, type RunAdvisorPhase2Context, SectionRewrite, type ShadowProbeRecordInput, type SupportedProvider, SystemModelMessage, TRANSLATOR_FLOOR, applyArchetypeConvention, applySectionRewrites, attachCacheControlToStreamTextInput, buildLLMJudge, buildShadowProbeRow, call, clearBrain, compile, compileForAISDKv6, configureBrain, countTokens, deriveFamilyFromModelId, deriveOwnership, execute, findBetterFit, getActionableAdvisories, getAllStarterChains, getAllStarterChainsWithGrounding, getArchetypePerfScore, getDefaultFallbackChain, getDefaultFallbackChainWithGrounding, getModelCompatibility, getPerAxisMetrics, getReachabilityDiagnostic, getRecommendedPrimary, getSequentialStarterChain, getSequentialStarterChainWithGrounding, getStaleExclusionFindings, getStarterChain, getStarterChainWithGrounding, isBrainQueryActiveFor, isBrainSync, isExclusionFindingsBrainActive, isModelReachable, isProviderReachable, loadAliasesFromBrain, loadArchetypePerfFromBrain, loadArchetypePerfNFromBrain, loadChainsFromBrain, loadModelsFromBrain, loadPricingFromBrain, markAdvisoryResolved, markExclusionFindingHandled, markPromoteReadyHandled, probeShadow, profileToRow, readBrainReadEnv, record, recordOutcome, recordShadowProbe, resetTokenizer, resolveConventionsForProfile, resolvePricingAt, resolveProviderKey, runAdvisor, setTokenizer };
2679
+ export { ABSOLUTE_FLOOR, type AISDKConvertedMessage, ARCHETYPE_FAMILY_FITS, ARCHETYPE_FLOOR_DEFAULT, type ActionableAdvisory, Adapter, type AdvisoryResolutionSource, type AdvisorySeverity, type AdvisoryStatus, type AdvisorySuggestedFix, ApiKeys, type AppOracle, type ApplySectionRewritesArgs, type ApplySectionRewritesResult, ArchetypeConvention, type ArchetypeFamilyFit, type ArchetypePerfMap, type ArchetypePerfNMap, type ArchetypePerfScoreResult, type AttachCacheControlResult, BestPracticeAdvisory, type BrainConfig, type BrainDeadLetterEntry, type BrainHealthSnapshot, type BrainQueryConfig, type BrainReadEnv, CallOptions, CallResult, ChainEntry, type CompatibilityIntent, type CompileForAISDKv6Result, type CompileOptions, CompilePolicy, CompileResult, CompiledRequest, DEFAULT_FINDINGS_ENDPOINT, type ExclusionFindingRow, type ExclusionResolutionSource, type ExecuteErr, type ExecuteOk, type ExecuteOptions, type ExecuteResult, type FallbackPosture, FamilyResolutionError, type GetActionableAdvisoriesOptions, type GetDefaultFallbackChainOpts, type GetPerAxisMetricsOpts, type GetRecommendedPrimaryOptions, type GoldenEvalCase, type GoldenEvalOptions, type GoldenEvalRunResult, type GoldenIrRecordInput, Grounding, IntentArchetypeName, JUDGE_RUBRICS, LIBRARY_VERSION, type LLMJudgeOptions, MEASURED_GROUNDING_MIN_N, type MarkAdvisoryResolvedOptions, type MarkExclusionFindingHandledOptions, type MarkPromoteReadyHandledOptions, type ModelBrainRow, type ModelCompatibility, ModelProfile, NormalizedResponse, type OracleContext, OracleScore, type OutcomePayload, OutcomeResult, PRODUCER_OWNED_RULE_CODES, PROVIDER_ENV_KEYS, PerAxisMetrics, type PricingRow, type ProbeShadowOptions, type ProbeShadowServed, type ProfileToRowOptions, type PromoteReadyFindingRow, type PromoteReadyResolution, PromptIR, Provider, ProviderOverrides, type ProviderReachability, RULE_SEQUENTIAL_TOOL_CLIFF, type ReachabilityOpts, RecordInput, RecordOutcomeInput, type RunAdvisorPhase2Context, SectionRewrite, type ShadowProbeRecordInput, type SupportedProvider, SystemModelMessage, TRANSLATOR_FLOOR, applyArchetypeConvention, applySectionRewrites, attachCacheControlToStreamTextInput, brainHealth, buildGoldenIrRow, buildLLMJudge, buildPairwiseJudgePrompt, buildShadowProbeRow, call, clearBrain, combineOrderSwappedVerdicts, compile, compileForAISDKv6, configureBrain, countTokens, deriveFamilyFromModelId, deriveOwnership, execute, findBetterFit, flushBrainDeadLetter, getActionableAdvisories, getAllStarterChains, getAllStarterChainsWithGrounding, getArchetypePerfScore, getDefaultFallbackChain, getDefaultFallbackChainWithGrounding, getModelCompatibility, getPerAxisMetrics, getReachabilityDiagnostic, getRecommendedPrimary, getSequentialStarterChain, getSequentialStarterChainWithGrounding, getStaleExclusionFindings, getStarterChain, getStarterChainWithGrounding, isBrainQueryActiveFor, isBrainSync, isExclusionFindingsBrainActive, isModelReachable, isProviderReachable, loadAliasesFromBrain, loadArchetypePerfFromBrain, loadArchetypePerfNFromBrain, loadChainsFromBrain, loadModelsFromBrain, loadPricingFromBrain, markAdvisoryResolved, markExclusionFindingHandled, markPromoteReadyHandled, parseJudgeVerdict, peekBrainDeadLetter, probeShadow, profileToRow, readBrainReadEnv, record, recordGoldenIr, recordOutcome, recordShadowProbe, renderIrForJudge, resetTokenizer, resolveConventionsForProfile, resolvePricingAt, resolveProviderKey, rubricFor, runAdvisor, runGoldenEval, setTokenizer };
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CompilePolicy, N as NormalizedResponse, A as ApiKeys, P as ProviderOverrides, a as CompiledRequest, b as PromptIR, c as CallOptions, d as CallResult, S as SystemModelMessage, e as CompileResult, B as BestPracticeAdvisory, f as SectionRewrite, R as RecordInput, g as RecordOutcomeInput, O as OutcomeResult, h as OracleScore, i as Adapter, j as PerAxisMetrics, k as Provider, l as ChainEntry, G as Grounding } from './ir-B2h0GAEL.js';
2
- export { m as CallAttempt, n as CallError, o as ChainModelEntry, p as ChainWithGrounding, q as Constraints, E as EffortLevel, F as FallbackReason, H as HistoryCachePolicy, I as IntentDeclaration, M as Message, r as MutationApplied, s as NormalizedTokens, t as OutcomeKind, u as PerAxisMetricsByModel, v as PromptSection, w as SectionKind, x as ShadowProbeConfig, T as ToolCall, y as ToolDefinition } from './ir-B2h0GAEL.js';
1
+ import { C as CompilePolicy, N as NormalizedResponse, A as ApiKeys, P as ProviderOverrides, a as CompiledRequest, b as PromptIR, c as CallOptions, d as CallResult, S as SystemModelMessage, e as CompileResult, B as BestPracticeAdvisory, f as SectionRewrite, R as RecordInput, g as RecordOutcomeInput, O as OutcomeResult, h as OracleScore, i as Adapter, j as PerAxisMetrics, k as Provider, l as ChainEntry, G as Grounding } from './ir-ClU56aBc.js';
2
+ export { m as CallAttempt, n as CallError, o as ChainModelEntry, p as ChainWithGrounding, q as Constraints, E as EffortLevel, F as FallbackReason, r as GoldenCaptureOptions, H as HistoryCachePolicy, I as IntentDeclaration, M as Message, s as MutationApplied, t as NormalizedTokens, u as OutcomeKind, v as PerAxisMetricsByModel, w as PromptSection, x as SectionKind, y as ShadowProbeConfig, T as ToolCall, z as ToolDefinition, D as captureGoldenIr, J as parseGoldenCaptureRate, K as resolveGoldenCaptureRate, L as shouldCaptureGolden } from './ir-ClU56aBc.js';
3
3
  import { ModelProfile, ArchetypeConvention } from './profiles.js';
4
4
  export { ALIASES, CacheStrategy, CliffRule, LATENCY_TIER_MS, LatencyTier, LoweringSpec, RecoveryRule, StructuredOutputCapability, SystemPromptMode, allProfiles, getProfile, latencyTierOf, profilesByProvider, tryGetProfile } from './profiles.js';
5
5
  export { BrainForwardConfig, BrainForwardRoutes, createBrainForwardRoutes } from './brain-proxy.js';
@@ -440,6 +440,65 @@ interface BrainConfig {
440
440
  }
441
441
  declare function configureBrain(config: BrainConfig): void;
442
442
  declare function clearBrain(): void;
443
+ interface BrainHealthSnapshot {
444
+ configState: 'configured' | 'not_configured';
445
+ /** Host of the configured endpoint (never the full URL — no secrets/paths). */
446
+ endpointHost?: string;
447
+ /** True when writes are awaited (BrainConfig.sync). */
448
+ sync: boolean;
449
+ /** Write POSTs attempted (all routes, primary + secondary). */
450
+ sent: number;
451
+ /** Write POSTs acknowledged 2xx without redirect. */
452
+ acked: number;
453
+ /** Write POSTs that failed (non-2xx, redirect, timeout, network throw). */
454
+ failed: number;
455
+ /** Subset of `failed` that failed the redirect check (middleware-drift class). */
456
+ redirected: number;
457
+ lastAckAt?: string;
458
+ lastFailureAt?: string;
459
+ /** Most recent failure message, truncated. */
460
+ lastFailure?: string;
461
+ deadLetterCount: number;
462
+ }
463
+ interface BrainDeadLetterEntry {
464
+ /** Brain route segment the payload was bound for. */
465
+ route: 'outcomes' | 'compile_outcome_quality' | 'probe_outcomes' | 'compile_outcome_advisories' | 'golden_irs';
466
+ /**
467
+ * Endpoint the payload was originally bound for. Flush replays ONLY entries
468
+ * matching the currently-configured endpoint — a reconfigure must never
469
+ * replay another brain's payloads into the new target (caught live by
470
+ * smoke-brain-timeout: a hung-socket test payload auto-flushed into the
471
+ * real brain after the smoke re-pointed configureBrain).
472
+ */
473
+ endpoint: string;
474
+ /** The exact JSON body that failed to land. */
475
+ payload: unknown;
476
+ failedAt: string;
477
+ /** Delivery attempts so far (1 = the original failed POST). */
478
+ attempts: number;
479
+ lastError: string;
480
+ }
481
+ /**
482
+ * Process-local brain write delivery ledger. `acked` is the only number that
483
+ * means "a row landed" — fire-and-forget callers that need delivery evidence
484
+ * read this (or set `BrainConfig.sync`). Cheap enough to attach to any debug
485
+ * or health surface the consumer already exposes.
486
+ */
487
+ declare function brainHealth(): BrainHealthSnapshot;
488
+ /** Read-only view of the pending dead-letter (for consumer-side persistence). */
489
+ declare function peekBrainDeadLetter(): readonly BrainDeadLetterEntry[];
490
+ /**
491
+ * Replay pending dead-letter payloads against the configured brain. Delivered
492
+ * entries are removed; failures increment `attempts` and entries are dropped
493
+ * after 3 total attempts (bounded — never an infinite retry, per the Redis
494
+ * DLQ rule). Safe to call any time; no-ops when unconfigured or already
495
+ * flushing. Also runs opportunistically after any successful write.
496
+ */
497
+ declare function flushBrainDeadLetter(): Promise<{
498
+ attempted: number;
499
+ delivered: number;
500
+ remaining: number;
501
+ }>;
443
502
  declare function record(input: RecordInput): Promise<void>;
444
503
  /**
445
504
  * Wire shape POSTed by `record()` to the brain proxy's `/outcomes` endpoint.
@@ -522,8 +581,10 @@ interface OutcomePayload {
522
581
  * = true for runtime contexts that can't tolerate fire-and-forget teardown
523
582
  * (Vercel Edge, Cloudflare Workers, AWS Lambda) — see L-086.
524
583
  *
525
- * Returns OutcomeResult with ok: false + stable reason on persistence
526
- * failure. Never throws.
584
+ * Returns (alpha.61): `{ok: true}` only when the POST was acknowledged 2xx
585
+ * (sync mode); `{ok: 'queued'}` in fire-and-forget mode (handed to the
586
+ * runtime, NOT acked — read `brainHealth()` for delivery evidence);
587
+ * `{ok: false, reason}` on known failure. Never throws.
527
588
  */
528
589
  declare function recordOutcome(input: RecordOutcomeInput): Promise<OutcomeResult>;
529
590
  /**
@@ -625,6 +686,193 @@ declare function buildShadowProbeRow(input: ShadowProbeRecordInput): {
625
686
  * `/probe_outcomes` the same way they forward `/outcomes`.
626
687
  */
627
688
  declare function recordShadowProbe(input: ShadowProbeRecordInput): Promise<void>;
689
+ /**
690
+ * Golden-IR capture input. UNLIKE every other brain write, this row carries the
691
+ * RAW full PromptIR — an explicit, documented posture change from the s51
692
+ * "brain holds no raw consumer prompts" rule, gated on consumer opt-in
693
+ * (`KGAUTO_GOLDEN_CAPTURE` env / `CallOptions.goldenCapture`). The `consent`
694
+ * field records the provenance of that opt-in at capture time.
695
+ */
696
+ interface GoldenIrRecordInput {
697
+ appId: string;
698
+ archetype: string;
699
+ /** hashShape() of the call at compile time (peek before record() pops). */
700
+ shapeKey?: string;
701
+ /** The full PromptIR, verbatim. Plain JSON by construction (ir.ts). */
702
+ ir: unknown;
703
+ incumbentModel: string;
704
+ incumbentOutput?: string;
705
+ incumbentLatencyMs?: number;
706
+ incumbentTokensIn?: number;
707
+ incumbentTokensOut?: number;
708
+ /** 'sampled' (capture flag fired on live traffic) | 'curated' (operator). */
709
+ source: 'sampled' | 'curated';
710
+ /** Consent provenance, e.g. 'KGAUTO_GOLDEN_CAPTURE=0.1 (consumer env opt-in)'. */
711
+ consent: string;
712
+ /** Optional link back to the compile handle of the captured call. */
713
+ outcomeHandle?: string;
714
+ }
715
+ /** Pure builder for the `kgauto_golden_irs` row (snake_case wire shape). */
716
+ declare function buildGoldenIrRow(input: GoldenIrRecordInput): {
717
+ app_id: string;
718
+ intent_archetype: string;
719
+ shape_key: string | null;
720
+ ir: unknown;
721
+ incumbent_model: string;
722
+ incumbent_output: string | null;
723
+ incumbent_latency_ms: number | null;
724
+ incumbent_tokens_in: number | null;
725
+ incumbent_tokens_out: number | null;
726
+ source: 'sampled' | 'curated';
727
+ consent: string;
728
+ outcome_handle: string | null;
729
+ };
730
+ /**
731
+ * Persist one golden IR to `kgauto_golden_irs`. Same G1 write-leg discipline as
732
+ * every other brain route (redirect check, ledger, dead-letter); fire-and-forget
733
+ * by default, honors `BrainConfig.sync`. Never throws.
734
+ */
735
+ declare function recordGoldenIr(input: GoldenIrRecordInput): Promise<void>;
736
+
737
+ /**
738
+ * Golden-set eval engine (alpha.62, eval spine — design brief 2026-07-17).
739
+ *
740
+ * Implements the quality-floor-guarded model-swap contract:
741
+ *
742
+ * > A model replaces another on a surface only by demonstrating
743
+ * > same-or-better quality on that surface's real workload — never by
744
+ * > price, recency, or judgment alone.
745
+ *
746
+ * One eval run: load the active golden set for (app, archetype), replay every
747
+ * IR on BOTH the incumbent and the candidate (fresh outputs on both sides —
748
+ * fair comparison, no stale stored output), apply mechanical hard floors,
749
+ * then a pairwise LLM judge (order-swapped to cancel position bias), and
750
+ * aggregate under the non-inferiority rule:
751
+ *
752
+ * promote-ready ⇔ wins-or-ties ≥ threshold (default 80%)
753
+ * AND zero hard-floor violations
754
+ * AND candidate p50 latency ≤ ratio × incumbent p50
755
+ *
756
+ * Evidence lands as brain rows: one `kgauto_golden_eval_runs` aggregate + one
757
+ * `probe_outcomes` row per case (`replay_source='golden-replay'`, full
758
+ * fidelity by construction) + an evidence-attached advisory on the consumer's
759
+ * advisory surface (trust-ladder Stage 1: eval runs, human clicks promote).
760
+ *
761
+ * Judging is PAIRWISE, not absolute — it operationalizes the quality-floor
762
+ * Common Pattern directly ("same or better, never less"). Each pair is judged
763
+ * twice with A/B order swapped; disagreement between the two orders is scored
764
+ * a tie (the honest reading of positional noise).
765
+ *
766
+ * This module is operator-grade: it talks to the brain via direct PostgREST
767
+ * with a service key (the watchers' convention), never through consumer
768
+ * proxies, and it deliberately does NOT call record() — eval traffic must not
769
+ * pollute compile_outcomes.
770
+ */
771
+
772
+ /**
773
+ * What "better" means per archetype. Fed verbatim into the pairwise judge
774
+ * prompt. Kept deliberately short — the judge sees the full request, so the
775
+ * rubric only needs to name the failure modes that matter for the archetype.
776
+ */
777
+ declare const JUDGE_RUBRICS: Record<string, string>;
778
+ declare function rubricFor(archetype: string): string;
779
+ /** Render the golden IR's request for the judge (system sections + user turn). */
780
+ declare function renderIrForJudge(ir: PromptIR): string;
781
+ declare function buildPairwiseJudgePrompt(args: {
782
+ archetype: string;
783
+ renderedInput: string;
784
+ outputA: string;
785
+ outputB: string;
786
+ }): string;
787
+ type PairwiseWinner = 'A' | 'B' | 'tie';
788
+ /** Parse the judge's JSON verdict. Returns undefined when unparseable. */
789
+ declare function parseJudgeVerdict(raw: string): {
790
+ winner: PairwiseWinner;
791
+ rationale?: string;
792
+ } | undefined;
793
+ /**
794
+ * Combine the two order-swapped verdicts into a case verdict. Both verdicts
795
+ * are expressed in incumbent/candidate terms BEFORE this call (the caller
796
+ * un-swaps run 2). Agreement → that verdict; disagreement → 'tied' (positional
797
+ * noise reads as a tie, never as a win).
798
+ */
799
+ declare function combineOrderSwappedVerdicts(run1: 'candidate-better' | 'current-better' | 'tied', run2: 'candidate-better' | 'current-better' | 'tied'): 'candidate-better' | 'current-better' | 'tied';
800
+ interface GoldenEvalOptions {
801
+ appId: string;
802
+ archetype: string;
803
+ candidateModel: string;
804
+ /**
805
+ * Incumbent to compare against. Default: the most frequent incumbent_model
806
+ * across the loaded golden set (the surface's de-facto leader).
807
+ */
808
+ incumbentModel?: string;
809
+ /** Judge model id. Default 'claude-opus-4-8' (judge chain tier 0). */
810
+ judgeModel?: string;
811
+ /** Max golden cases to load (newest first). Default 50. */
812
+ limit?: number;
813
+ /** Non-inferiority threshold on wins-or-ties. Default 0.8. */
814
+ winOrTieThreshold?: number;
815
+ /** Latency hard floor: candidate p50 ≤ ratio × incumbent p50. Default 3. */
816
+ latencyFloorRatio?: number;
817
+ /** Minimum judged cases for a non-inconclusive verdict. Default 5. */
818
+ minJudgeableCases?: number;
819
+ /** What fired the eval. Default 'manual' (Stage 1). */
820
+ triggerSource?: 'manual' | 'supply' | 'price' | 'demand';
821
+ /** Brain access — direct PostgREST (operator convention). */
822
+ supabaseUrl: string;
823
+ serviceKey: string;
824
+ /** Provider keys for the replay + judge calls. Default: process.env. */
825
+ apiKeys?: ApiKeys;
826
+ fetchImpl?: typeof fetch;
827
+ /** Replay + judge but write NOTHING to the brain. */
828
+ dryRun?: boolean;
829
+ onProgress?: (message: string) => void;
830
+ }
831
+ interface GoldenEvalCase {
832
+ goldenIrId: number;
833
+ verdict: 'candidate-better' | 'tied' | 'current-better' | 'inconclusive';
834
+ judgeRationale?: string;
835
+ /** Hard-floor violations on the candidate side for this case. */
836
+ floorViolations: Array<'empty' | 'schema' | 'candidate_error'>;
837
+ errorClass?: string;
838
+ incumbent?: {
839
+ latencyMs: number;
840
+ tokensIn: number;
841
+ tokensOut: number;
842
+ text: string;
843
+ };
844
+ candidate?: {
845
+ latencyMs: number;
846
+ tokensIn: number;
847
+ tokensOut: number;
848
+ text: string;
849
+ };
850
+ /** Case excluded from the denominator (incumbent replay/judge failed). */
851
+ excludedReason?: string;
852
+ }
853
+ interface GoldenEvalRunResult {
854
+ verdict: 'promote-ready' | 'not-inferior' | 'inconclusive';
855
+ runId?: number;
856
+ appId: string;
857
+ archetype: string;
858
+ incumbentModel: string;
859
+ candidateModel: string;
860
+ judgeModel: string;
861
+ nCases: number;
862
+ wins: number;
863
+ ties: number;
864
+ losses: number;
865
+ floorViolations: number;
866
+ floorDetail: Record<string, number>;
867
+ winOrTieRatio: number | null;
868
+ latencyRatio: number | null;
869
+ costIncumbentUsd: number | null;
870
+ costCandidateUsd: number | null;
871
+ advisoryOutcomeId?: number;
872
+ cases: GoldenEvalCase[];
873
+ notes: string[];
874
+ }
875
+ declare function runGoldenEval(opts: GoldenEvalOptions): Promise<GoldenEvalRunResult>;
628
876
 
629
877
  /**
630
878
  * alpha.60 — the library's own version, baked as a constant so Edge/Worker
@@ -639,7 +887,7 @@ declare function recordShadowProbe(input: ShadowProbeRecordInput): Promise<void>
639
887
  * guard in `tests/version.test.ts` fails the suite (and therefore
640
888
  * `prepublishOnly`) when they diverge — a stale constant cannot reach npm.
641
889
  */
642
- declare const LIBRARY_VERSION = "2.0.0-alpha.60";
890
+ declare const LIBRARY_VERSION = "2.0.0-alpha.62";
643
891
 
644
892
  /**
645
893
  * Oracle contract — how an app tells the brain whether a response was good.
@@ -1825,7 +2073,7 @@ declare function getSequentialStarterChainWithGrounding(archetype: IntentArchety
1825
2073
  * Sync reader for the brain-driven chains map. Returns bundled
1826
2074
  * STARTER_CHAINS when brain-query is disabled, cold, or unreachable.
1827
2075
  */
1828
- declare const loadChainsFromBrain: () => Record<"ask" | "hunt" | "classify" | "summarize" | "generate" | "extract" | "plan" | "critique" | "transform", string[]>;
2076
+ declare const loadChainsFromBrain: () => Record<"ask" | "hunt" | "classify" | "summarize" | "generate" | "extract" | "plan" | "critique" | "transform" | "judge", string[]>;
1829
2077
 
1830
2078
  /**
1831
2079
  * archetype-perf-brain — alpha.11 KG-12 adapter.
@@ -2428,4 +2676,4 @@ declare function markPromoteReadyHandled(opts: MarkPromoteReadyHandledOptions):
2428
2676
  */
2429
2677
  declare function compile(ir: PromptIR, opts?: CompileOptions): CompileResult;
2430
2678
 
2431
- export { ABSOLUTE_FLOOR, type AISDKConvertedMessage, ARCHETYPE_FAMILY_FITS, ARCHETYPE_FLOOR_DEFAULT, type ActionableAdvisory, Adapter, type AdvisoryResolutionSource, type AdvisorySeverity, type AdvisoryStatus, type AdvisorySuggestedFix, ApiKeys, type AppOracle, type ApplySectionRewritesArgs, type ApplySectionRewritesResult, ArchetypeConvention, type ArchetypeFamilyFit, type ArchetypePerfMap, type ArchetypePerfNMap, type ArchetypePerfScoreResult, type AttachCacheControlResult, BestPracticeAdvisory, type BrainConfig, type BrainQueryConfig, type BrainReadEnv, CallOptions, CallResult, ChainEntry, type CompatibilityIntent, type CompileForAISDKv6Result, type CompileOptions, CompilePolicy, CompileResult, CompiledRequest, DEFAULT_FINDINGS_ENDPOINT, type ExclusionFindingRow, type ExclusionResolutionSource, type ExecuteErr, type ExecuteOk, type ExecuteOptions, type ExecuteResult, type FallbackPosture, FamilyResolutionError, type GetActionableAdvisoriesOptions, type GetDefaultFallbackChainOpts, type GetPerAxisMetricsOpts, type GetRecommendedPrimaryOptions, Grounding, IntentArchetypeName, LIBRARY_VERSION, type LLMJudgeOptions, MEASURED_GROUNDING_MIN_N, type MarkAdvisoryResolvedOptions, type MarkExclusionFindingHandledOptions, type MarkPromoteReadyHandledOptions, type ModelBrainRow, type ModelCompatibility, ModelProfile, NormalizedResponse, type OracleContext, OracleScore, type OutcomePayload, OutcomeResult, PRODUCER_OWNED_RULE_CODES, PROVIDER_ENV_KEYS, PerAxisMetrics, type PricingRow, type ProbeShadowOptions, type ProbeShadowServed, type ProfileToRowOptions, type PromoteReadyFindingRow, type PromoteReadyResolution, PromptIR, Provider, ProviderOverrides, type ProviderReachability, RULE_SEQUENTIAL_TOOL_CLIFF, type ReachabilityOpts, RecordInput, RecordOutcomeInput, type RunAdvisorPhase2Context, SectionRewrite, type ShadowProbeRecordInput, type SupportedProvider, SystemModelMessage, TRANSLATOR_FLOOR, applyArchetypeConvention, applySectionRewrites, attachCacheControlToStreamTextInput, buildLLMJudge, buildShadowProbeRow, call, clearBrain, compile, compileForAISDKv6, configureBrain, countTokens, deriveFamilyFromModelId, deriveOwnership, execute, findBetterFit, getActionableAdvisories, getAllStarterChains, getAllStarterChainsWithGrounding, getArchetypePerfScore, getDefaultFallbackChain, getDefaultFallbackChainWithGrounding, getModelCompatibility, getPerAxisMetrics, getReachabilityDiagnostic, getRecommendedPrimary, getSequentialStarterChain, getSequentialStarterChainWithGrounding, getStaleExclusionFindings, getStarterChain, getStarterChainWithGrounding, isBrainQueryActiveFor, isBrainSync, isExclusionFindingsBrainActive, isModelReachable, isProviderReachable, loadAliasesFromBrain, loadArchetypePerfFromBrain, loadArchetypePerfNFromBrain, loadChainsFromBrain, loadModelsFromBrain, loadPricingFromBrain, markAdvisoryResolved, markExclusionFindingHandled, markPromoteReadyHandled, probeShadow, profileToRow, readBrainReadEnv, record, recordOutcome, recordShadowProbe, resetTokenizer, resolveConventionsForProfile, resolvePricingAt, resolveProviderKey, runAdvisor, setTokenizer };
2679
+ export { ABSOLUTE_FLOOR, type AISDKConvertedMessage, ARCHETYPE_FAMILY_FITS, ARCHETYPE_FLOOR_DEFAULT, type ActionableAdvisory, Adapter, type AdvisoryResolutionSource, type AdvisorySeverity, type AdvisoryStatus, type AdvisorySuggestedFix, ApiKeys, type AppOracle, type ApplySectionRewritesArgs, type ApplySectionRewritesResult, ArchetypeConvention, type ArchetypeFamilyFit, type ArchetypePerfMap, type ArchetypePerfNMap, type ArchetypePerfScoreResult, type AttachCacheControlResult, BestPracticeAdvisory, type BrainConfig, type BrainDeadLetterEntry, type BrainHealthSnapshot, type BrainQueryConfig, type BrainReadEnv, CallOptions, CallResult, ChainEntry, type CompatibilityIntent, type CompileForAISDKv6Result, type CompileOptions, CompilePolicy, CompileResult, CompiledRequest, DEFAULT_FINDINGS_ENDPOINT, type ExclusionFindingRow, type ExclusionResolutionSource, type ExecuteErr, type ExecuteOk, type ExecuteOptions, type ExecuteResult, type FallbackPosture, FamilyResolutionError, type GetActionableAdvisoriesOptions, type GetDefaultFallbackChainOpts, type GetPerAxisMetricsOpts, type GetRecommendedPrimaryOptions, type GoldenEvalCase, type GoldenEvalOptions, type GoldenEvalRunResult, type GoldenIrRecordInput, Grounding, IntentArchetypeName, JUDGE_RUBRICS, LIBRARY_VERSION, type LLMJudgeOptions, MEASURED_GROUNDING_MIN_N, type MarkAdvisoryResolvedOptions, type MarkExclusionFindingHandledOptions, type MarkPromoteReadyHandledOptions, type ModelBrainRow, type ModelCompatibility, ModelProfile, NormalizedResponse, type OracleContext, OracleScore, type OutcomePayload, OutcomeResult, PRODUCER_OWNED_RULE_CODES, PROVIDER_ENV_KEYS, PerAxisMetrics, type PricingRow, type ProbeShadowOptions, type ProbeShadowServed, type ProfileToRowOptions, type PromoteReadyFindingRow, type PromoteReadyResolution, PromptIR, Provider, ProviderOverrides, type ProviderReachability, RULE_SEQUENTIAL_TOOL_CLIFF, type ReachabilityOpts, RecordInput, RecordOutcomeInput, type RunAdvisorPhase2Context, SectionRewrite, type ShadowProbeRecordInput, type SupportedProvider, SystemModelMessage, TRANSLATOR_FLOOR, applyArchetypeConvention, applySectionRewrites, attachCacheControlToStreamTextInput, brainHealth, buildGoldenIrRow, buildLLMJudge, buildPairwiseJudgePrompt, buildShadowProbeRow, call, clearBrain, combineOrderSwappedVerdicts, compile, compileForAISDKv6, configureBrain, countTokens, deriveFamilyFromModelId, deriveOwnership, execute, findBetterFit, flushBrainDeadLetter, getActionableAdvisories, getAllStarterChains, getAllStarterChainsWithGrounding, getArchetypePerfScore, getDefaultFallbackChain, getDefaultFallbackChainWithGrounding, getModelCompatibility, getPerAxisMetrics, getReachabilityDiagnostic, getRecommendedPrimary, getSequentialStarterChain, getSequentialStarterChainWithGrounding, getStaleExclusionFindings, getStarterChain, getStarterChainWithGrounding, isBrainQueryActiveFor, isBrainSync, isExclusionFindingsBrainActive, isModelReachable, isProviderReachable, loadAliasesFromBrain, loadArchetypePerfFromBrain, loadArchetypePerfNFromBrain, loadChainsFromBrain, loadModelsFromBrain, loadPricingFromBrain, markAdvisoryResolved, markExclusionFindingHandled, markPromoteReadyHandled, parseJudgeVerdict, peekBrainDeadLetter, probeShadow, profileToRow, readBrainReadEnv, record, recordGoldenIr, recordOutcome, recordShadowProbe, renderIrForJudge, resetTokenizer, resolveConventionsForProfile, resolvePricingAt, resolveProviderKey, rubricFor, runAdvisor, runGoldenEval, setTokenizer };