@warmdrift/kgauto-compiler 2.0.0-alpha.39 → 2.0.0-alpha.41
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.
- package/dist/glassbox/index.d.mts +3 -3
- package/dist/glassbox/index.d.ts +3 -3
- package/dist/glassbox-routes/format.d.mts +2 -2
- package/dist/glassbox-routes/format.d.ts +2 -2
- package/dist/glassbox-routes/index.d.mts +4 -4
- package/dist/glassbox-routes/index.d.ts +4 -4
- package/dist/glassbox-routes/react/index.d.mts +2 -2
- package/dist/glassbox-routes/react/index.d.ts +2 -2
- package/dist/index.d.mts +234 -3
- package/dist/index.d.ts +234 -3
- package/dist/index.js +710 -138
- package/dist/index.mjs +706 -138
- package/dist/{ir-CZ9Ng96k.d.ts → ir-DYpvUSEw.d.ts} +32 -3
- package/dist/{ir-BiZSAVCJ.d.mts → ir-D_kgJcaV.d.mts} +32 -3
- package/dist/profiles.d.mts +28 -1
- package/dist/profiles.d.ts +28 -1
- package/dist/{types-HEl2tS4P.d.ts → types-C8gOJ7hV.d.ts} +1 -1
- package/dist/{types-kzYpX7wB.d.mts → types-CYY769Ls.d.mts} +1 -1
- package/dist/{types-CsFP-H-U.d.ts → types-DigtHnEt.d.ts} +1 -1
- package/dist/{types-f7idIVsm.d.mts → types-MkiWUPM8.d.mts} +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { G as GlassboxEvent } from '../types-
|
|
2
|
-
export { A as AdvisoryFiredData, C as CompileDoneData, a as CompileStartData, E as ExecuteAttemptData, b as ExecuteSuccessData, F as FallbackWalkedData, c as GLASSBOX_STREAM_TTL_MS, d as GlassboxEventKind, e as GlassboxPubSub } from '../types-
|
|
3
|
-
import '../ir-
|
|
1
|
+
import { G as GlassboxEvent } from '../types-MkiWUPM8.mjs';
|
|
2
|
+
export { A as AdvisoryFiredData, C as CompileDoneData, a as CompileStartData, E as ExecuteAttemptData, b as ExecuteSuccessData, F as FallbackWalkedData, c as GLASSBOX_STREAM_TTL_MS, d as GlassboxEventKind, e as GlassboxPubSub } from '../types-MkiWUPM8.mjs';
|
|
3
|
+
import '../ir-D_kgJcaV.mjs';
|
|
4
4
|
import '../dialect.mjs';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/glassbox/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { G as GlassboxEvent } from '../types-
|
|
2
|
-
export { A as AdvisoryFiredData, C as CompileDoneData, a as CompileStartData, E as ExecuteAttemptData, b as ExecuteSuccessData, F as FallbackWalkedData, c as GLASSBOX_STREAM_TTL_MS, d as GlassboxEventKind, e as GlassboxPubSub } from '../types-
|
|
3
|
-
import '../ir-
|
|
1
|
+
import { G as GlassboxEvent } from '../types-DigtHnEt.js';
|
|
2
|
+
export { A as AdvisoryFiredData, C as CompileDoneData, a as CompileStartData, E as ExecuteAttemptData, b as ExecuteSuccessData, F as FallbackWalkedData, c as GLASSBOX_STREAM_TTL_MS, d as GlassboxEventKind, e as GlassboxPubSub } from '../types-DigtHnEt.js';
|
|
3
|
+
import '../ir-DYpvUSEw.js';
|
|
4
4
|
import '../dialect.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { G as GlassboxEvent } from '../types-
|
|
2
|
-
import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-
|
|
3
|
-
export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-
|
|
4
|
-
import '../ir-
|
|
1
|
+
import { G as GlassboxEvent } from '../types-MkiWUPM8.mjs';
|
|
2
|
+
import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-CYY769Ls.mjs';
|
|
3
|
+
export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-CYY769Ls.mjs';
|
|
4
|
+
import '../ir-D_kgJcaV.mjs';
|
|
5
5
|
import '../dialect.mjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { G as GlassboxEvent } from '../types-
|
|
2
|
-
import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-
|
|
3
|
-
export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-
|
|
4
|
-
import '../ir-
|
|
1
|
+
import { G as GlassboxEvent } from '../types-DigtHnEt.js';
|
|
2
|
+
import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-C8gOJ7hV.js';
|
|
3
|
+
export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-C8gOJ7hV.js';
|
|
4
|
+
import '../ir-DYpvUSEw.js';
|
|
5
5
|
import '../dialect.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { a as TraceDetail } from '../../types-
|
|
3
|
-
import '../../ir-
|
|
2
|
+
import { a as TraceDetail } from '../../types-CYY769Ls.mjs';
|
|
3
|
+
import '../../ir-D_kgJcaV.mjs';
|
|
4
4
|
import '../../dialect.mjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { a as TraceDetail } from '../../types-
|
|
3
|
-
import '../../ir-
|
|
2
|
+
import { a as TraceDetail } from '../../types-C8gOJ7hV.js';
|
|
3
|
+
import '../../ir-DYpvUSEw.js';
|
|
4
4
|
import '../../dialect.js';
|
|
5
5
|
|
|
6
6
|
/**
|
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, f as SectionRewrite, R as RecordInput, g as RecordOutcomeInput, O as OutcomeResult, h as OracleScore, B as BestPracticeAdvisory, i as Adapter, j as PerAxisMetrics, k as Provider, l as ChainEntry, G as Grounding } from './ir-
|
|
2
|
-
export { m as CallAttempt, n as CallError, o as
|
|
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, f as SectionRewrite, R as RecordInput, g as RecordOutcomeInput, O as OutcomeResult, h as OracleScore, B as BestPracticeAdvisory, i as Adapter, j as PerAxisMetrics, k as Provider, l as ChainEntry, G as Grounding } from './ir-D_kgJcaV.mjs';
|
|
2
|
+
export { m as CallAttempt, n as CallError, o as ChainModelEntry, p as ChainWithGrounding, q as Constraints, 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, T as ToolCall, x as ToolDefinition } from './ir-D_kgJcaV.mjs';
|
|
3
3
|
import { ModelProfile } from './profiles.mjs';
|
|
4
4
|
export { ALIASES, CacheStrategy, CliffRule, LoweringSpec, RecoveryRule, StructuredOutputCapability, SystemPromptMode, allProfiles, getProfile, profilesByProvider, tryGetProfile } from './profiles.mjs';
|
|
5
5
|
import { IntentArchetypeName } from './dialect.mjs';
|
|
@@ -1515,6 +1515,8 @@ interface ModelBrainRow {
|
|
|
1515
1515
|
version_added?: string;
|
|
1516
1516
|
version_removed?: string | null;
|
|
1517
1517
|
active?: boolean;
|
|
1518
|
+
/** alpha.41 — model-family tag (migration 024 column). */
|
|
1519
|
+
family?: string | null;
|
|
1518
1520
|
}
|
|
1519
1521
|
interface ProfileToRowOptions {
|
|
1520
1522
|
/** e.g. `'2.0.0-alpha.12'` — leave undefined to omit from row. */
|
|
@@ -1655,6 +1657,235 @@ interface GetExclusionFindingsOpts {
|
|
|
1655
1657
|
*/
|
|
1656
1658
|
declare function getStaleExclusionFindings(opts: GetExclusionFindingsOpts): ExclusionFindingRow[];
|
|
1657
1659
|
|
|
1660
|
+
/**
|
|
1661
|
+
* Family resolution — alpha.41.
|
|
1662
|
+
*
|
|
1663
|
+
* "I want the latest Opus" → kgauto picks the current+active model in the
|
|
1664
|
+
* `claude-opus` family. Closes the loop where consumer code carries hardcoded
|
|
1665
|
+
* `claude-opus-4-6` literals long after `claude-opus-4-7` ships and goes
|
|
1666
|
+
* current — the s47 trigger (IC's `generate` chain still routing 43 calls to
|
|
1667
|
+
* legacy 4-6 in production).
|
|
1668
|
+
*
|
|
1669
|
+
* Two surfaces:
|
|
1670
|
+
* - `getRecommendedPrimary({ family, ..., fallback })` — public, sync,
|
|
1671
|
+
* used at IR-construction time when the consumer wants a literal id back
|
|
1672
|
+
* (with a fallback floor for cold-start brain).
|
|
1673
|
+
* - `resolveFamilyEntry({ family, archetype?, appId? })` — internal,
|
|
1674
|
+
* called from compile() when an IR's `models[]` entry is shaped
|
|
1675
|
+
* `{ family: string }`. Throws `FamilyResolutionError` on failure.
|
|
1676
|
+
*
|
|
1677
|
+
* Both routes share the same algorithm (locked in the alpha.41 Phase 0
|
|
1678
|
+
* design contract); they differ only in the fallback ergonomics. The
|
|
1679
|
+
* public route accepts a required `fallback: string`; the IR route throws.
|
|
1680
|
+
*
|
|
1681
|
+
* Pure resolution. No network. No async. Brain-registry reads go through
|
|
1682
|
+
* the existing SWR cache (`loadModelsFromBrain` from `models-brain.ts`) —
|
|
1683
|
+
* cold-start returns bundled profiles, which still resolve via the
|
|
1684
|
+
* `deriveFamilyFromModelId` fallback when the brain row's `family` column
|
|
1685
|
+
* is null (G1 contract: graceful pre-migration behavior).
|
|
1686
|
+
*
|
|
1687
|
+
* @see command-center/advisory/kgauto/2026-05-26_alpha-41-model-family-aliases-and-promotion-probe-watcher.md
|
|
1688
|
+
*/
|
|
1689
|
+
|
|
1690
|
+
interface GetRecommendedPrimaryOptions {
|
|
1691
|
+
/**
|
|
1692
|
+
* Family tag (e.g. `'claude-opus'`, `'gemini-flash'`). See the Phase 0
|
|
1693
|
+
* design contract's family taxonomy table for the locked initial set;
|
|
1694
|
+
* extensible via brain migrations.
|
|
1695
|
+
*/
|
|
1696
|
+
family: string;
|
|
1697
|
+
/**
|
|
1698
|
+
* Optional archetype gate. When provided, candidates must clear
|
|
1699
|
+
* {@link ARCHETYPE_FLOOR_DEFAULT} on `archetypePerf[archetype]`. Also used
|
|
1700
|
+
* as the primary sort key (DESC) when multiple candidates qualify.
|
|
1701
|
+
*/
|
|
1702
|
+
archetype?: IntentArchetypeName;
|
|
1703
|
+
/**
|
|
1704
|
+
* Optional consumer-app id. When provided, candidates matching a
|
|
1705
|
+
* `stay-excluded` finding for `(appId, archetype)` in the
|
|
1706
|
+
* exclusion-findings cache (alpha.38 substrate) are filtered out.
|
|
1707
|
+
*/
|
|
1708
|
+
appId?: string;
|
|
1709
|
+
/**
|
|
1710
|
+
* Consumer-posture tag. `'locked'` short-circuits resolution and returns
|
|
1711
|
+
* the literal `fallback` unconditionally — useful for compliance /
|
|
1712
|
+
* contract / brand-promise flows where the consumer doesn't want kgauto
|
|
1713
|
+
* picking the model on their behalf.
|
|
1714
|
+
*/
|
|
1715
|
+
posture?: 'preferred' | 'open' | 'locked';
|
|
1716
|
+
/**
|
|
1717
|
+
* Last-resort literal model id. REQUIRED. Returned when (a) brain
|
|
1718
|
+
* registry is cold / no candidates exist, (b) `posture === 'locked'`,
|
|
1719
|
+
* (c) every candidate was filtered out by archetype / exclusion gates.
|
|
1720
|
+
*
|
|
1721
|
+
* The fallback is NOT validated against the family — kgauto trusts the
|
|
1722
|
+
* consumer to pass a meaningful floor. The contract intent is "even when
|
|
1723
|
+
* everything below is on fire, you still get a model id back."
|
|
1724
|
+
*/
|
|
1725
|
+
fallback: string;
|
|
1726
|
+
}
|
|
1727
|
+
/**
|
|
1728
|
+
* Thrown by `resolveFamilyEntry` (the internal compile-time twin) when a
|
|
1729
|
+
* `{ family: string }` IR entry can't resolve to any current+active model.
|
|
1730
|
+
* Surfaces with the family string + a one-line cause so consumer error
|
|
1731
|
+
* handling can distinguish "you typo'd the family tag" from "brain is cold
|
|
1732
|
+
* and nothing matches."
|
|
1733
|
+
*
|
|
1734
|
+
* The public `getRecommendedPrimary` does NOT throw — it returns
|
|
1735
|
+
* `fallback` instead.
|
|
1736
|
+
*/
|
|
1737
|
+
declare class FamilyResolutionError extends Error {
|
|
1738
|
+
readonly family: string;
|
|
1739
|
+
readonly cause: string;
|
|
1740
|
+
constructor(family: string, cause: string);
|
|
1741
|
+
}
|
|
1742
|
+
/**
|
|
1743
|
+
* Deterministic model_id → family inference. Pure function; no brain
|
|
1744
|
+
* lookup. Used as the runtime fallback when a brain row's `family` column
|
|
1745
|
+
* is null (pre-migration 024) and as the canonical mapping that migration
|
|
1746
|
+
* 024's CASE statement mirrors.
|
|
1747
|
+
*
|
|
1748
|
+
* Returns null for unrecognized ids — caller must handle (typically by
|
|
1749
|
+
* skipping the row in family resolution).
|
|
1750
|
+
*
|
|
1751
|
+
* Order matters: more specific patterns first (e.g. `flash-lite` before
|
|
1752
|
+
* `flash`; `pro` before `chat`). The brain-side CASE statement uses the
|
|
1753
|
+
* same priority.
|
|
1754
|
+
*/
|
|
1755
|
+
declare function deriveFamilyFromModelId(modelId: string): string | null;
|
|
1756
|
+
/**
|
|
1757
|
+
* Public sync resolver. Pure (modulo brain snapshot read). Returns the
|
|
1758
|
+
* literal model id of the best candidate, or `fallback` when resolution
|
|
1759
|
+
* yields nothing.
|
|
1760
|
+
*/
|
|
1761
|
+
declare function getRecommendedPrimary(opts: GetRecommendedPrimaryOptions): string;
|
|
1762
|
+
|
|
1763
|
+
/**
|
|
1764
|
+
* promote-ready-brain — alpha.41 substrate.
|
|
1765
|
+
*
|
|
1766
|
+
* Per-tenant SWR cache for the `promote_ready_findings` table populated by
|
|
1767
|
+
* the autonomous `promotion-probe-watcher` (Mode 2). Mirrors
|
|
1768
|
+
* `exclusion-findings-brain.ts` shape byte-for-byte where applicable; this
|
|
1769
|
+
* is the read-side substrate for the compile-time `promote-ready` advisor
|
|
1770
|
+
* rule.
|
|
1771
|
+
*
|
|
1772
|
+
* Architecture (mirror of exclusion-findings-brain):
|
|
1773
|
+
*
|
|
1774
|
+
* - **Sync API surface.** `getPromoteReadyFindings({ appId, archetype,
|
|
1775
|
+
* family })` returns `PromoteReadyFindingRow[]` immediately. First call
|
|
1776
|
+
* returns the bundled fallback (empty array); async refresh fires in
|
|
1777
|
+
* background; subsequent calls within TTL return brain data.
|
|
1778
|
+
*
|
|
1779
|
+
* - **Per-appId snapshot.** Each appId gets its own cache entry. One fetch
|
|
1780
|
+
* per appId per TTL window. Tests reset between cases via
|
|
1781
|
+
* `_testResetPromoteReadyFindings()`.
|
|
1782
|
+
*
|
|
1783
|
+
* - **Tolerant.** Brain down / endpoint misconfigured / unexpected shape →
|
|
1784
|
+
* silent bundled fallback (empty array). Never throws. Warns once per
|
|
1785
|
+
* process per error to avoid log spam.
|
|
1786
|
+
*
|
|
1787
|
+
* - **Opt-in.** Activation gated on `configurePromoteReadyBrain()` having
|
|
1788
|
+
* been called with a runtime. The public `configureBrain()` in brain.ts
|
|
1789
|
+
* wires this up automatically when
|
|
1790
|
+
* `BrainConfig.brainQuery.findingsPromoteReady !== false`.
|
|
1791
|
+
*
|
|
1792
|
+
* Plus: `markPromoteReadyHandled` — direct PostgREST PATCH against the
|
|
1793
|
+
* brain (no kgauto proxy). Mirrors `markExclusionFindingHandled` shape
|
|
1794
|
+
* byte-for-byte. Idempotent on `resolved_at=is.null` filter.
|
|
1795
|
+
*
|
|
1796
|
+
* Default endpoint:
|
|
1797
|
+
* `https://kgauto-dashboard.vercel.app/api/kgauto-v2/findings/promote-ready`
|
|
1798
|
+
* The route accepts `?app_id=X` and returns a JSON array of findings
|
|
1799
|
+
* for that app filtered to `resolved_at IS NULL`.
|
|
1800
|
+
*/
|
|
1801
|
+
|
|
1802
|
+
/**
|
|
1803
|
+
* Shape of one row from the `promote_ready_findings` cache table. Mirrors
|
|
1804
|
+
* the snake_case JSONB returned by the brain endpoint, mapped to camelCase
|
|
1805
|
+
* at the boundary (rowToFinding) so the in-memory shape stays consistent
|
|
1806
|
+
* with the rest of the library.
|
|
1807
|
+
*/
|
|
1808
|
+
interface PromoteReadyFindingRow {
|
|
1809
|
+
/** Intent archetype the finding applies to. */
|
|
1810
|
+
archetype: string;
|
|
1811
|
+
/** Model family (e.g. 'claude-opus', 'gemini-flash'). */
|
|
1812
|
+
family: string;
|
|
1813
|
+
/** The candidate model that the probe validated. */
|
|
1814
|
+
candidateModel: string;
|
|
1815
|
+
/** The current production model the candidate was compared against. */
|
|
1816
|
+
currentModel: string;
|
|
1817
|
+
/** Sample size of the probe run (typically 10). */
|
|
1818
|
+
sampleN: number;
|
|
1819
|
+
/** Fraction of probes where the judge verdict was 'candidate-better' or
|
|
1820
|
+
* 'tied'. 0.000 to 1.000. */
|
|
1821
|
+
judgePassRate: number;
|
|
1822
|
+
/** Mean judge score across the probe sample. 1.00 to 5.00. */
|
|
1823
|
+
judgeAvgScore: number;
|
|
1824
|
+
/** Signed cost delta as a fraction (negative = candidate is cheaper).
|
|
1825
|
+
* Null when pricing data was incomplete at probe time. */
|
|
1826
|
+
costDeltaPct: number | null;
|
|
1827
|
+
/** ISO timestamp of detection (when the probe wrote the row). */
|
|
1828
|
+
detectedAt: string;
|
|
1829
|
+
}
|
|
1830
|
+
/**
|
|
1831
|
+
* Resolution sources supported by alpha.41 `markPromoteReadyHandled`. The
|
|
1832
|
+
* three values map to the three CHECK-constrained resolution values on
|
|
1833
|
+
* `promote_ready_findings.resolution`:
|
|
1834
|
+
*
|
|
1835
|
+
* - `'promoted'` — consumer migrated to the candidate model. Strong
|
|
1836
|
+
* positive signal; the probe was right.
|
|
1837
|
+
* - `'declined'` — consumer evaluated and chose not to promote.
|
|
1838
|
+
* Strong negative signal; revisit only on new
|
|
1839
|
+
* family entries or material score swings.
|
|
1840
|
+
* - `'still-evaluating'` — consumer acknowledges the finding but defers
|
|
1841
|
+
* the decision. Acknowledges-without-deciding;
|
|
1842
|
+
* finding silences this cycle but next probe may
|
|
1843
|
+
* re-surface.
|
|
1844
|
+
*/
|
|
1845
|
+
type PromoteReadyResolution = 'promoted' | 'declined' | 'still-evaluating';
|
|
1846
|
+
interface MarkPromoteReadyHandledOptions {
|
|
1847
|
+
/** App id the finding belongs to. Required (RLS scopes writes by this). */
|
|
1848
|
+
appId: string;
|
|
1849
|
+
/** Archetype the finding applies to (e.g. 'hunt', 'classify'). */
|
|
1850
|
+
archetype: IntentArchetypeName | string;
|
|
1851
|
+
/** Model family the finding applies to (e.g. 'claude-opus'). */
|
|
1852
|
+
family: string;
|
|
1853
|
+
/** Resolution semantics — see `PromoteReadyResolution`. */
|
|
1854
|
+
resolution: PromoteReadyResolution;
|
|
1855
|
+
/** Optional free-form note explaining the decision. */
|
|
1856
|
+
resolutionNote?: string;
|
|
1857
|
+
/** Brain Supabase URL base (e.g. `https://<project>.supabase.co`). */
|
|
1858
|
+
brainEndpoint: string;
|
|
1859
|
+
/** Consumer-scoped JWT carrying the `app_id` claim. */
|
|
1860
|
+
brainJwt: string;
|
|
1861
|
+
/** Supabase anon key for the `apikey` header. */
|
|
1862
|
+
brainAnonKey: string;
|
|
1863
|
+
/** Injected fetch for tests. Defaults to global fetch. */
|
|
1864
|
+
fetch?: typeof fetch;
|
|
1865
|
+
}
|
|
1866
|
+
/**
|
|
1867
|
+
* Mark a probe-validated promote-ready finding as handled. Returns an
|
|
1868
|
+
* `ok/reason` envelope matching `markExclusionFindingHandled`.
|
|
1869
|
+
*
|
|
1870
|
+
* Idempotent: if no row matches the (app_id, archetype, family) tuple
|
|
1871
|
+
* (already resolved, never existed, watcher not yet UPSERTed), PostgREST
|
|
1872
|
+
* returns 200/204 with zero affected rows and we return `{ ok: true }`.
|
|
1873
|
+
*
|
|
1874
|
+
* Reasons surfaced on failure:
|
|
1875
|
+
* - `app_id_required` / `archetype_required` / `family_required`
|
|
1876
|
+
* - `resolution_invalid` — not one of the three documented values
|
|
1877
|
+
* - `brain_auth_misconfig` — 401/403
|
|
1878
|
+
* - `brain_unavailable` — 5xx
|
|
1879
|
+
* - `network_error:<message>` — fetch threw
|
|
1880
|
+
* - `patch_failed:<status>` — anything else non-2xx
|
|
1881
|
+
*/
|
|
1882
|
+
declare function markPromoteReadyHandled(opts: MarkPromoteReadyHandledOptions): Promise<{
|
|
1883
|
+
ok: true;
|
|
1884
|
+
} | {
|
|
1885
|
+
ok: false;
|
|
1886
|
+
reason: string;
|
|
1887
|
+
}>;
|
|
1888
|
+
|
|
1658
1889
|
/**
|
|
1659
1890
|
* @warmdrift/kgauto v2 — prompt compiler + central learning brain.
|
|
1660
1891
|
*
|
|
@@ -1701,4 +1932,4 @@ declare function getStaleExclusionFindings(opts: GetExclusionFindingsOpts): Excl
|
|
|
1701
1932
|
*/
|
|
1702
1933
|
declare function compile(ir: PromptIR, opts?: CompileOptions): CompileResult;
|
|
1703
1934
|
|
|
1704
|
-
export { ABSOLUTE_FLOOR, type AISDKConvertedMessage, ARCHETYPE_FLOOR_DEFAULT, type ActionableAdvisory, Adapter, type AdvisoryResolutionSource, type AdvisorySeverity, type AdvisoryStatus, type AdvisorySuggestedFix, ApiKeys, type AppOracle, type ApplySectionRewritesArgs, type ApplySectionRewritesResult, type ArchetypePerfMap, type ArchetypePerfNMap, type ArchetypePerfScoreResult, type AttachCacheControlResult, BestPracticeAdvisory, type BrainConfig, type BrainQueryConfig, CallOptions, CallResult, ChainEntry, type CompatibilityIntent, type CompileOptions, CompilePolicy, CompileResult, CompiledRequest, DEFAULT_FINDINGS_ENDPOINT, type ExclusionFindingRow, type ExclusionResolutionSource, type ExecuteErr, type ExecuteOk, type ExecuteOptions, type ExecuteResult, type FallbackPosture, type GetActionableAdvisoriesOptions, type GetDefaultFallbackChainOpts, type GetPerAxisMetricsOpts, Grounding, IntentArchetypeName, type LLMJudgeOptions, MEASURED_GROUNDING_MIN_N, type MarkAdvisoryResolvedOptions, type MarkExclusionFindingHandledOptions, type ModelBrainRow, type ModelCompatibility, ModelProfile, NormalizedResponse, type OracleContext, OracleScore, type OutcomePayload, OutcomeResult, PROVIDER_ENV_KEYS, PerAxisMetrics, type PricingRow, type ProfileToRowOptions, PromptIR, Provider, ProviderOverrides, type ProviderReachability, RULE_SEQUENTIAL_TOOL_CLIFF, type ReachabilityOpts, RecordInput, RecordOutcomeInput, type RunAdvisorPhase2Context, SectionRewrite, type SupportedProvider, SystemModelMessage, TRANSLATOR_FLOOR, applySectionRewrites, attachCacheControlToStreamTextInput, buildLLMJudge, call, clearBrain, compile, configureBrain, countTokens, execute, getActionableAdvisories, getAllStarterChains, getAllStarterChainsWithGrounding, getArchetypePerfScore, getDefaultFallbackChain, getDefaultFallbackChainWithGrounding, getModelCompatibility, getPerAxisMetrics, getReachabilityDiagnostic, getSequentialStarterChain, getSequentialStarterChainWithGrounding, getStaleExclusionFindings, getStarterChain, getStarterChainWithGrounding, isBrainQueryActiveFor, isExclusionFindingsBrainActive, isModelReachable, isProviderReachable, loadAliasesFromBrain, loadArchetypePerfFromBrain, loadArchetypePerfNFromBrain, loadChainsFromBrain, loadModelsFromBrain, loadPricingFromBrain, markAdvisoryResolved, markExclusionFindingHandled, profileToRow, record, recordOutcome, resetTokenizer, resolvePricingAt, resolveProviderKey, runAdvisor, setTokenizer };
|
|
1935
|
+
export { ABSOLUTE_FLOOR, type AISDKConvertedMessage, ARCHETYPE_FLOOR_DEFAULT, type ActionableAdvisory, Adapter, type AdvisoryResolutionSource, type AdvisorySeverity, type AdvisoryStatus, type AdvisorySuggestedFix, ApiKeys, type AppOracle, type ApplySectionRewritesArgs, type ApplySectionRewritesResult, type ArchetypePerfMap, type ArchetypePerfNMap, type ArchetypePerfScoreResult, type AttachCacheControlResult, BestPracticeAdvisory, type BrainConfig, type BrainQueryConfig, CallOptions, CallResult, ChainEntry, type CompatibilityIntent, 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, type LLMJudgeOptions, MEASURED_GROUNDING_MIN_N, type MarkAdvisoryResolvedOptions, type MarkExclusionFindingHandledOptions, type MarkPromoteReadyHandledOptions, type ModelBrainRow, type ModelCompatibility, ModelProfile, NormalizedResponse, type OracleContext, OracleScore, type OutcomePayload, OutcomeResult, PROVIDER_ENV_KEYS, PerAxisMetrics, type PricingRow, type ProfileToRowOptions, type PromoteReadyFindingRow, type PromoteReadyResolution, PromptIR, Provider, ProviderOverrides, type ProviderReachability, RULE_SEQUENTIAL_TOOL_CLIFF, type ReachabilityOpts, RecordInput, RecordOutcomeInput, type RunAdvisorPhase2Context, SectionRewrite, type SupportedProvider, SystemModelMessage, TRANSLATOR_FLOOR, applySectionRewrites, attachCacheControlToStreamTextInput, buildLLMJudge, call, clearBrain, compile, configureBrain, countTokens, deriveFamilyFromModelId, execute, getActionableAdvisories, getAllStarterChains, getAllStarterChainsWithGrounding, getArchetypePerfScore, getDefaultFallbackChain, getDefaultFallbackChainWithGrounding, getModelCompatibility, getPerAxisMetrics, getReachabilityDiagnostic, getRecommendedPrimary, getSequentialStarterChain, getSequentialStarterChainWithGrounding, getStaleExclusionFindings, getStarterChain, getStarterChainWithGrounding, isBrainQueryActiveFor, isExclusionFindingsBrainActive, isModelReachable, isProviderReachable, loadAliasesFromBrain, loadArchetypePerfFromBrain, loadArchetypePerfNFromBrain, loadChainsFromBrain, loadModelsFromBrain, loadPricingFromBrain, markAdvisoryResolved, markExclusionFindingHandled, markPromoteReadyHandled, profileToRow, record, recordOutcome, resetTokenizer, resolvePricingAt, resolveProviderKey, runAdvisor, 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, f as SectionRewrite, R as RecordInput, g as RecordOutcomeInput, O as OutcomeResult, h as OracleScore, B as BestPracticeAdvisory, i as Adapter, j as PerAxisMetrics, k as Provider, l as ChainEntry, G as Grounding } from './ir-
|
|
2
|
-
export { m as CallAttempt, n as CallError, o as
|
|
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, f as SectionRewrite, R as RecordInput, g as RecordOutcomeInput, O as OutcomeResult, h as OracleScore, B as BestPracticeAdvisory, i as Adapter, j as PerAxisMetrics, k as Provider, l as ChainEntry, G as Grounding } from './ir-DYpvUSEw.js';
|
|
2
|
+
export { m as CallAttempt, n as CallError, o as ChainModelEntry, p as ChainWithGrounding, q as Constraints, 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, T as ToolCall, x as ToolDefinition } from './ir-DYpvUSEw.js';
|
|
3
3
|
import { ModelProfile } from './profiles.js';
|
|
4
4
|
export { ALIASES, CacheStrategy, CliffRule, LoweringSpec, RecoveryRule, StructuredOutputCapability, SystemPromptMode, allProfiles, getProfile, profilesByProvider, tryGetProfile } from './profiles.js';
|
|
5
5
|
import { IntentArchetypeName } from './dialect.js';
|
|
@@ -1515,6 +1515,8 @@ interface ModelBrainRow {
|
|
|
1515
1515
|
version_added?: string;
|
|
1516
1516
|
version_removed?: string | null;
|
|
1517
1517
|
active?: boolean;
|
|
1518
|
+
/** alpha.41 — model-family tag (migration 024 column). */
|
|
1519
|
+
family?: string | null;
|
|
1518
1520
|
}
|
|
1519
1521
|
interface ProfileToRowOptions {
|
|
1520
1522
|
/** e.g. `'2.0.0-alpha.12'` — leave undefined to omit from row. */
|
|
@@ -1655,6 +1657,235 @@ interface GetExclusionFindingsOpts {
|
|
|
1655
1657
|
*/
|
|
1656
1658
|
declare function getStaleExclusionFindings(opts: GetExclusionFindingsOpts): ExclusionFindingRow[];
|
|
1657
1659
|
|
|
1660
|
+
/**
|
|
1661
|
+
* Family resolution — alpha.41.
|
|
1662
|
+
*
|
|
1663
|
+
* "I want the latest Opus" → kgauto picks the current+active model in the
|
|
1664
|
+
* `claude-opus` family. Closes the loop where consumer code carries hardcoded
|
|
1665
|
+
* `claude-opus-4-6` literals long after `claude-opus-4-7` ships and goes
|
|
1666
|
+
* current — the s47 trigger (IC's `generate` chain still routing 43 calls to
|
|
1667
|
+
* legacy 4-6 in production).
|
|
1668
|
+
*
|
|
1669
|
+
* Two surfaces:
|
|
1670
|
+
* - `getRecommendedPrimary({ family, ..., fallback })` — public, sync,
|
|
1671
|
+
* used at IR-construction time when the consumer wants a literal id back
|
|
1672
|
+
* (with a fallback floor for cold-start brain).
|
|
1673
|
+
* - `resolveFamilyEntry({ family, archetype?, appId? })` — internal,
|
|
1674
|
+
* called from compile() when an IR's `models[]` entry is shaped
|
|
1675
|
+
* `{ family: string }`. Throws `FamilyResolutionError` on failure.
|
|
1676
|
+
*
|
|
1677
|
+
* Both routes share the same algorithm (locked in the alpha.41 Phase 0
|
|
1678
|
+
* design contract); they differ only in the fallback ergonomics. The
|
|
1679
|
+
* public route accepts a required `fallback: string`; the IR route throws.
|
|
1680
|
+
*
|
|
1681
|
+
* Pure resolution. No network. No async. Brain-registry reads go through
|
|
1682
|
+
* the existing SWR cache (`loadModelsFromBrain` from `models-brain.ts`) —
|
|
1683
|
+
* cold-start returns bundled profiles, which still resolve via the
|
|
1684
|
+
* `deriveFamilyFromModelId` fallback when the brain row's `family` column
|
|
1685
|
+
* is null (G1 contract: graceful pre-migration behavior).
|
|
1686
|
+
*
|
|
1687
|
+
* @see command-center/advisory/kgauto/2026-05-26_alpha-41-model-family-aliases-and-promotion-probe-watcher.md
|
|
1688
|
+
*/
|
|
1689
|
+
|
|
1690
|
+
interface GetRecommendedPrimaryOptions {
|
|
1691
|
+
/**
|
|
1692
|
+
* Family tag (e.g. `'claude-opus'`, `'gemini-flash'`). See the Phase 0
|
|
1693
|
+
* design contract's family taxonomy table for the locked initial set;
|
|
1694
|
+
* extensible via brain migrations.
|
|
1695
|
+
*/
|
|
1696
|
+
family: string;
|
|
1697
|
+
/**
|
|
1698
|
+
* Optional archetype gate. When provided, candidates must clear
|
|
1699
|
+
* {@link ARCHETYPE_FLOOR_DEFAULT} on `archetypePerf[archetype]`. Also used
|
|
1700
|
+
* as the primary sort key (DESC) when multiple candidates qualify.
|
|
1701
|
+
*/
|
|
1702
|
+
archetype?: IntentArchetypeName;
|
|
1703
|
+
/**
|
|
1704
|
+
* Optional consumer-app id. When provided, candidates matching a
|
|
1705
|
+
* `stay-excluded` finding for `(appId, archetype)` in the
|
|
1706
|
+
* exclusion-findings cache (alpha.38 substrate) are filtered out.
|
|
1707
|
+
*/
|
|
1708
|
+
appId?: string;
|
|
1709
|
+
/**
|
|
1710
|
+
* Consumer-posture tag. `'locked'` short-circuits resolution and returns
|
|
1711
|
+
* the literal `fallback` unconditionally — useful for compliance /
|
|
1712
|
+
* contract / brand-promise flows where the consumer doesn't want kgauto
|
|
1713
|
+
* picking the model on their behalf.
|
|
1714
|
+
*/
|
|
1715
|
+
posture?: 'preferred' | 'open' | 'locked';
|
|
1716
|
+
/**
|
|
1717
|
+
* Last-resort literal model id. REQUIRED. Returned when (a) brain
|
|
1718
|
+
* registry is cold / no candidates exist, (b) `posture === 'locked'`,
|
|
1719
|
+
* (c) every candidate was filtered out by archetype / exclusion gates.
|
|
1720
|
+
*
|
|
1721
|
+
* The fallback is NOT validated against the family — kgauto trusts the
|
|
1722
|
+
* consumer to pass a meaningful floor. The contract intent is "even when
|
|
1723
|
+
* everything below is on fire, you still get a model id back."
|
|
1724
|
+
*/
|
|
1725
|
+
fallback: string;
|
|
1726
|
+
}
|
|
1727
|
+
/**
|
|
1728
|
+
* Thrown by `resolveFamilyEntry` (the internal compile-time twin) when a
|
|
1729
|
+
* `{ family: string }` IR entry can't resolve to any current+active model.
|
|
1730
|
+
* Surfaces with the family string + a one-line cause so consumer error
|
|
1731
|
+
* handling can distinguish "you typo'd the family tag" from "brain is cold
|
|
1732
|
+
* and nothing matches."
|
|
1733
|
+
*
|
|
1734
|
+
* The public `getRecommendedPrimary` does NOT throw — it returns
|
|
1735
|
+
* `fallback` instead.
|
|
1736
|
+
*/
|
|
1737
|
+
declare class FamilyResolutionError extends Error {
|
|
1738
|
+
readonly family: string;
|
|
1739
|
+
readonly cause: string;
|
|
1740
|
+
constructor(family: string, cause: string);
|
|
1741
|
+
}
|
|
1742
|
+
/**
|
|
1743
|
+
* Deterministic model_id → family inference. Pure function; no brain
|
|
1744
|
+
* lookup. Used as the runtime fallback when a brain row's `family` column
|
|
1745
|
+
* is null (pre-migration 024) and as the canonical mapping that migration
|
|
1746
|
+
* 024's CASE statement mirrors.
|
|
1747
|
+
*
|
|
1748
|
+
* Returns null for unrecognized ids — caller must handle (typically by
|
|
1749
|
+
* skipping the row in family resolution).
|
|
1750
|
+
*
|
|
1751
|
+
* Order matters: more specific patterns first (e.g. `flash-lite` before
|
|
1752
|
+
* `flash`; `pro` before `chat`). The brain-side CASE statement uses the
|
|
1753
|
+
* same priority.
|
|
1754
|
+
*/
|
|
1755
|
+
declare function deriveFamilyFromModelId(modelId: string): string | null;
|
|
1756
|
+
/**
|
|
1757
|
+
* Public sync resolver. Pure (modulo brain snapshot read). Returns the
|
|
1758
|
+
* literal model id of the best candidate, or `fallback` when resolution
|
|
1759
|
+
* yields nothing.
|
|
1760
|
+
*/
|
|
1761
|
+
declare function getRecommendedPrimary(opts: GetRecommendedPrimaryOptions): string;
|
|
1762
|
+
|
|
1763
|
+
/**
|
|
1764
|
+
* promote-ready-brain — alpha.41 substrate.
|
|
1765
|
+
*
|
|
1766
|
+
* Per-tenant SWR cache for the `promote_ready_findings` table populated by
|
|
1767
|
+
* the autonomous `promotion-probe-watcher` (Mode 2). Mirrors
|
|
1768
|
+
* `exclusion-findings-brain.ts` shape byte-for-byte where applicable; this
|
|
1769
|
+
* is the read-side substrate for the compile-time `promote-ready` advisor
|
|
1770
|
+
* rule.
|
|
1771
|
+
*
|
|
1772
|
+
* Architecture (mirror of exclusion-findings-brain):
|
|
1773
|
+
*
|
|
1774
|
+
* - **Sync API surface.** `getPromoteReadyFindings({ appId, archetype,
|
|
1775
|
+
* family })` returns `PromoteReadyFindingRow[]` immediately. First call
|
|
1776
|
+
* returns the bundled fallback (empty array); async refresh fires in
|
|
1777
|
+
* background; subsequent calls within TTL return brain data.
|
|
1778
|
+
*
|
|
1779
|
+
* - **Per-appId snapshot.** Each appId gets its own cache entry. One fetch
|
|
1780
|
+
* per appId per TTL window. Tests reset between cases via
|
|
1781
|
+
* `_testResetPromoteReadyFindings()`.
|
|
1782
|
+
*
|
|
1783
|
+
* - **Tolerant.** Brain down / endpoint misconfigured / unexpected shape →
|
|
1784
|
+
* silent bundled fallback (empty array). Never throws. Warns once per
|
|
1785
|
+
* process per error to avoid log spam.
|
|
1786
|
+
*
|
|
1787
|
+
* - **Opt-in.** Activation gated on `configurePromoteReadyBrain()` having
|
|
1788
|
+
* been called with a runtime. The public `configureBrain()` in brain.ts
|
|
1789
|
+
* wires this up automatically when
|
|
1790
|
+
* `BrainConfig.brainQuery.findingsPromoteReady !== false`.
|
|
1791
|
+
*
|
|
1792
|
+
* Plus: `markPromoteReadyHandled` — direct PostgREST PATCH against the
|
|
1793
|
+
* brain (no kgauto proxy). Mirrors `markExclusionFindingHandled` shape
|
|
1794
|
+
* byte-for-byte. Idempotent on `resolved_at=is.null` filter.
|
|
1795
|
+
*
|
|
1796
|
+
* Default endpoint:
|
|
1797
|
+
* `https://kgauto-dashboard.vercel.app/api/kgauto-v2/findings/promote-ready`
|
|
1798
|
+
* The route accepts `?app_id=X` and returns a JSON array of findings
|
|
1799
|
+
* for that app filtered to `resolved_at IS NULL`.
|
|
1800
|
+
*/
|
|
1801
|
+
|
|
1802
|
+
/**
|
|
1803
|
+
* Shape of one row from the `promote_ready_findings` cache table. Mirrors
|
|
1804
|
+
* the snake_case JSONB returned by the brain endpoint, mapped to camelCase
|
|
1805
|
+
* at the boundary (rowToFinding) so the in-memory shape stays consistent
|
|
1806
|
+
* with the rest of the library.
|
|
1807
|
+
*/
|
|
1808
|
+
interface PromoteReadyFindingRow {
|
|
1809
|
+
/** Intent archetype the finding applies to. */
|
|
1810
|
+
archetype: string;
|
|
1811
|
+
/** Model family (e.g. 'claude-opus', 'gemini-flash'). */
|
|
1812
|
+
family: string;
|
|
1813
|
+
/** The candidate model that the probe validated. */
|
|
1814
|
+
candidateModel: string;
|
|
1815
|
+
/** The current production model the candidate was compared against. */
|
|
1816
|
+
currentModel: string;
|
|
1817
|
+
/** Sample size of the probe run (typically 10). */
|
|
1818
|
+
sampleN: number;
|
|
1819
|
+
/** Fraction of probes where the judge verdict was 'candidate-better' or
|
|
1820
|
+
* 'tied'. 0.000 to 1.000. */
|
|
1821
|
+
judgePassRate: number;
|
|
1822
|
+
/** Mean judge score across the probe sample. 1.00 to 5.00. */
|
|
1823
|
+
judgeAvgScore: number;
|
|
1824
|
+
/** Signed cost delta as a fraction (negative = candidate is cheaper).
|
|
1825
|
+
* Null when pricing data was incomplete at probe time. */
|
|
1826
|
+
costDeltaPct: number | null;
|
|
1827
|
+
/** ISO timestamp of detection (when the probe wrote the row). */
|
|
1828
|
+
detectedAt: string;
|
|
1829
|
+
}
|
|
1830
|
+
/**
|
|
1831
|
+
* Resolution sources supported by alpha.41 `markPromoteReadyHandled`. The
|
|
1832
|
+
* three values map to the three CHECK-constrained resolution values on
|
|
1833
|
+
* `promote_ready_findings.resolution`:
|
|
1834
|
+
*
|
|
1835
|
+
* - `'promoted'` — consumer migrated to the candidate model. Strong
|
|
1836
|
+
* positive signal; the probe was right.
|
|
1837
|
+
* - `'declined'` — consumer evaluated and chose not to promote.
|
|
1838
|
+
* Strong negative signal; revisit only on new
|
|
1839
|
+
* family entries or material score swings.
|
|
1840
|
+
* - `'still-evaluating'` — consumer acknowledges the finding but defers
|
|
1841
|
+
* the decision. Acknowledges-without-deciding;
|
|
1842
|
+
* finding silences this cycle but next probe may
|
|
1843
|
+
* re-surface.
|
|
1844
|
+
*/
|
|
1845
|
+
type PromoteReadyResolution = 'promoted' | 'declined' | 'still-evaluating';
|
|
1846
|
+
interface MarkPromoteReadyHandledOptions {
|
|
1847
|
+
/** App id the finding belongs to. Required (RLS scopes writes by this). */
|
|
1848
|
+
appId: string;
|
|
1849
|
+
/** Archetype the finding applies to (e.g. 'hunt', 'classify'). */
|
|
1850
|
+
archetype: IntentArchetypeName | string;
|
|
1851
|
+
/** Model family the finding applies to (e.g. 'claude-opus'). */
|
|
1852
|
+
family: string;
|
|
1853
|
+
/** Resolution semantics — see `PromoteReadyResolution`. */
|
|
1854
|
+
resolution: PromoteReadyResolution;
|
|
1855
|
+
/** Optional free-form note explaining the decision. */
|
|
1856
|
+
resolutionNote?: string;
|
|
1857
|
+
/** Brain Supabase URL base (e.g. `https://<project>.supabase.co`). */
|
|
1858
|
+
brainEndpoint: string;
|
|
1859
|
+
/** Consumer-scoped JWT carrying the `app_id` claim. */
|
|
1860
|
+
brainJwt: string;
|
|
1861
|
+
/** Supabase anon key for the `apikey` header. */
|
|
1862
|
+
brainAnonKey: string;
|
|
1863
|
+
/** Injected fetch for tests. Defaults to global fetch. */
|
|
1864
|
+
fetch?: typeof fetch;
|
|
1865
|
+
}
|
|
1866
|
+
/**
|
|
1867
|
+
* Mark a probe-validated promote-ready finding as handled. Returns an
|
|
1868
|
+
* `ok/reason` envelope matching `markExclusionFindingHandled`.
|
|
1869
|
+
*
|
|
1870
|
+
* Idempotent: if no row matches the (app_id, archetype, family) tuple
|
|
1871
|
+
* (already resolved, never existed, watcher not yet UPSERTed), PostgREST
|
|
1872
|
+
* returns 200/204 with zero affected rows and we return `{ ok: true }`.
|
|
1873
|
+
*
|
|
1874
|
+
* Reasons surfaced on failure:
|
|
1875
|
+
* - `app_id_required` / `archetype_required` / `family_required`
|
|
1876
|
+
* - `resolution_invalid` — not one of the three documented values
|
|
1877
|
+
* - `brain_auth_misconfig` — 401/403
|
|
1878
|
+
* - `brain_unavailable` — 5xx
|
|
1879
|
+
* - `network_error:<message>` — fetch threw
|
|
1880
|
+
* - `patch_failed:<status>` — anything else non-2xx
|
|
1881
|
+
*/
|
|
1882
|
+
declare function markPromoteReadyHandled(opts: MarkPromoteReadyHandledOptions): Promise<{
|
|
1883
|
+
ok: true;
|
|
1884
|
+
} | {
|
|
1885
|
+
ok: false;
|
|
1886
|
+
reason: string;
|
|
1887
|
+
}>;
|
|
1888
|
+
|
|
1658
1889
|
/**
|
|
1659
1890
|
* @warmdrift/kgauto v2 — prompt compiler + central learning brain.
|
|
1660
1891
|
*
|
|
@@ -1701,4 +1932,4 @@ declare function getStaleExclusionFindings(opts: GetExclusionFindingsOpts): Excl
|
|
|
1701
1932
|
*/
|
|
1702
1933
|
declare function compile(ir: PromptIR, opts?: CompileOptions): CompileResult;
|
|
1703
1934
|
|
|
1704
|
-
export { ABSOLUTE_FLOOR, type AISDKConvertedMessage, ARCHETYPE_FLOOR_DEFAULT, type ActionableAdvisory, Adapter, type AdvisoryResolutionSource, type AdvisorySeverity, type AdvisoryStatus, type AdvisorySuggestedFix, ApiKeys, type AppOracle, type ApplySectionRewritesArgs, type ApplySectionRewritesResult, type ArchetypePerfMap, type ArchetypePerfNMap, type ArchetypePerfScoreResult, type AttachCacheControlResult, BestPracticeAdvisory, type BrainConfig, type BrainQueryConfig, CallOptions, CallResult, ChainEntry, type CompatibilityIntent, type CompileOptions, CompilePolicy, CompileResult, CompiledRequest, DEFAULT_FINDINGS_ENDPOINT, type ExclusionFindingRow, type ExclusionResolutionSource, type ExecuteErr, type ExecuteOk, type ExecuteOptions, type ExecuteResult, type FallbackPosture, type GetActionableAdvisoriesOptions, type GetDefaultFallbackChainOpts, type GetPerAxisMetricsOpts, Grounding, IntentArchetypeName, type LLMJudgeOptions, MEASURED_GROUNDING_MIN_N, type MarkAdvisoryResolvedOptions, type MarkExclusionFindingHandledOptions, type ModelBrainRow, type ModelCompatibility, ModelProfile, NormalizedResponse, type OracleContext, OracleScore, type OutcomePayload, OutcomeResult, PROVIDER_ENV_KEYS, PerAxisMetrics, type PricingRow, type ProfileToRowOptions, PromptIR, Provider, ProviderOverrides, type ProviderReachability, RULE_SEQUENTIAL_TOOL_CLIFF, type ReachabilityOpts, RecordInput, RecordOutcomeInput, type RunAdvisorPhase2Context, SectionRewrite, type SupportedProvider, SystemModelMessage, TRANSLATOR_FLOOR, applySectionRewrites, attachCacheControlToStreamTextInput, buildLLMJudge, call, clearBrain, compile, configureBrain, countTokens, execute, getActionableAdvisories, getAllStarterChains, getAllStarterChainsWithGrounding, getArchetypePerfScore, getDefaultFallbackChain, getDefaultFallbackChainWithGrounding, getModelCompatibility, getPerAxisMetrics, getReachabilityDiagnostic, getSequentialStarterChain, getSequentialStarterChainWithGrounding, getStaleExclusionFindings, getStarterChain, getStarterChainWithGrounding, isBrainQueryActiveFor, isExclusionFindingsBrainActive, isModelReachable, isProviderReachable, loadAliasesFromBrain, loadArchetypePerfFromBrain, loadArchetypePerfNFromBrain, loadChainsFromBrain, loadModelsFromBrain, loadPricingFromBrain, markAdvisoryResolved, markExclusionFindingHandled, profileToRow, record, recordOutcome, resetTokenizer, resolvePricingAt, resolveProviderKey, runAdvisor, setTokenizer };
|
|
1935
|
+
export { ABSOLUTE_FLOOR, type AISDKConvertedMessage, ARCHETYPE_FLOOR_DEFAULT, type ActionableAdvisory, Adapter, type AdvisoryResolutionSource, type AdvisorySeverity, type AdvisoryStatus, type AdvisorySuggestedFix, ApiKeys, type AppOracle, type ApplySectionRewritesArgs, type ApplySectionRewritesResult, type ArchetypePerfMap, type ArchetypePerfNMap, type ArchetypePerfScoreResult, type AttachCacheControlResult, BestPracticeAdvisory, type BrainConfig, type BrainQueryConfig, CallOptions, CallResult, ChainEntry, type CompatibilityIntent, 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, type LLMJudgeOptions, MEASURED_GROUNDING_MIN_N, type MarkAdvisoryResolvedOptions, type MarkExclusionFindingHandledOptions, type MarkPromoteReadyHandledOptions, type ModelBrainRow, type ModelCompatibility, ModelProfile, NormalizedResponse, type OracleContext, OracleScore, type OutcomePayload, OutcomeResult, PROVIDER_ENV_KEYS, PerAxisMetrics, type PricingRow, type ProfileToRowOptions, type PromoteReadyFindingRow, type PromoteReadyResolution, PromptIR, Provider, ProviderOverrides, type ProviderReachability, RULE_SEQUENTIAL_TOOL_CLIFF, type ReachabilityOpts, RecordInput, RecordOutcomeInput, type RunAdvisorPhase2Context, SectionRewrite, type SupportedProvider, SystemModelMessage, TRANSLATOR_FLOOR, applySectionRewrites, attachCacheControlToStreamTextInput, buildLLMJudge, call, clearBrain, compile, configureBrain, countTokens, deriveFamilyFromModelId, execute, getActionableAdvisories, getAllStarterChains, getAllStarterChainsWithGrounding, getArchetypePerfScore, getDefaultFallbackChain, getDefaultFallbackChainWithGrounding, getModelCompatibility, getPerAxisMetrics, getReachabilityDiagnostic, getRecommendedPrimary, getSequentialStarterChain, getSequentialStarterChainWithGrounding, getStaleExclusionFindings, getStarterChain, getStarterChainWithGrounding, isBrainQueryActiveFor, isExclusionFindingsBrainActive, isModelReachable, isProviderReachable, loadAliasesFromBrain, loadArchetypePerfFromBrain, loadArchetypePerfNFromBrain, loadChainsFromBrain, loadModelsFromBrain, loadPricingFromBrain, markAdvisoryResolved, markExclusionFindingHandled, markPromoteReadyHandled, profileToRow, record, recordOutcome, resetTokenizer, resolvePricingAt, resolveProviderKey, runAdvisor, setTokenizer };
|