@warmdrift/kgauto-compiler 2.0.0-alpha.77 → 2.0.0-alpha.79

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.
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var LIBRARY_VERSION = "2.0.0-alpha.77";
2
+ var LIBRARY_VERSION = "2.0.0-alpha.79";
3
3
 
4
4
  // src/key-health.ts
5
5
  var JSON_HEADERS = { "Content-Type": "application/json" };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  tryGetProfile
3
- } from "./chunk-N36LE3MK.mjs";
3
+ } from "./chunk-VVRDFE6T.mjs";
4
4
 
5
5
  // src/brain-query.ts
6
6
  var FRESH_SNAPSHOT = {
@@ -323,6 +323,17 @@ function getReachabilityDiagnostic(opts = {}) {
323
323
  }
324
324
  return out;
325
325
  }
326
+ var BRAIN_READ_ENV_NAMES = {
327
+ endpoint: "KGAUTO_V2_BRAIN_SUPABASE_URL",
328
+ jwt: "KGAUTO_V2_BRAIN_JWT",
329
+ anonKey: "KGAUTO_V2_BRAIN_ANON_KEY",
330
+ /** Accepted fallbacks, in resolution order after the canonical name. */
331
+ fallbacks: {
332
+ endpoint: ["KGAUTO_V2_BRAIN_URL"],
333
+ jwt: ["GLASSBOX_BRAIN_JWT"],
334
+ anonKey: []
335
+ }
336
+ };
326
337
  function readBrainReadEnv(envSource = defaultEnv()) {
327
338
  const endpoint = readKeyValue(envSource.KGAUTO_V2_BRAIN_SUPABASE_URL) ?? readKeyValue(envSource.KGAUTO_V2_BRAIN_URL);
328
339
  const jwt = readKeyValue(envSource.KGAUTO_V2_BRAIN_JWT) ?? readKeyValue(envSource.GLASSBOX_BRAIN_JWT);
@@ -704,6 +715,7 @@ export {
704
715
  isProviderReachable,
705
716
  isModelReachable,
706
717
  getReachabilityDiagnostic,
718
+ BRAIN_READ_ENV_NAMES,
707
719
  readBrainReadEnv,
708
720
  isSameModelRetryEnabledFromEnv,
709
721
  loadChainsFromBrain,
@@ -363,6 +363,22 @@ var PROFILES_RAW = [
363
363
  threshold: 16,
364
364
  action: "drop_to_top_relevant",
365
365
  reason: "Haiku reliability degrades above ~16 tools"
366
+ },
367
+ {
368
+ // alpha.78 — the declared `structuredOutput: 'grammar'` does NOT
369
+ // hold on long-input summarize. MEASURED (brain, playbacksam):
370
+ // 21 disambiguated `structured_output_parse_failed` fallover rows
371
+ // 2026-07-22..27, tokens_in 12,280–31,450; PB's gate counted 20/20
372
+ // in-window failures. Clean traffic p50 sits at ~9K tokens_in, so
373
+ // 12K gates the failing band without touching the working one.
374
+ // Short-input summarize carries no failure evidence and stays
375
+ // ungated — this is why it's a cliff, not an archetype-wide
376
+ // `structuredOutputHint: 'avoid'`.
377
+ metric: "input_tokens",
378
+ threshold: 12e3,
379
+ action: "quality_gate_structured",
380
+ whenIntent: "summarize",
381
+ reason: "Structured-output parse failures at 100% in-window on long-input summarize (measured on playbacksam, 2026-07-25..27; haiku only led when input size made price dominate, then failed every time)."
366
382
  }
367
383
  ],
368
384
  costInputPer1m: 1,
@@ -1,6 +1,6 @@
1
- import { G as GlassboxEvent } from '../types-Caq-hOIj.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-Caq-hOIj.mjs';
3
- import '../ir-CRV1_taF.mjs';
1
+ import { G as GlassboxEvent } from '../types-DpcAMmk-.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-DpcAMmk-.mjs';
3
+ import '../ir-BFwWhj2s.mjs';
4
4
  import '../dialect.mjs';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { G as GlassboxEvent } from '../types-C5BX9bzi.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-C5BX9bzi.js';
3
- import '../ir-C02EIElQ.js';
1
+ import { G as GlassboxEvent } from '../types-B4kz3Vs0.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-B4kz3Vs0.js';
3
+ import '../ir-DZKS1tI7.js';
4
4
  import '../dialect.js';
5
5
 
6
6
  /**
@@ -1,5 +1,5 @@
1
- import { T as TraceHealth } from '../types-3WdGMqin.mjs';
2
- import '../ir-CRV1_taF.mjs';
1
+ import { T as TraceHealth } from '../types-hjzSWxtv.mjs';
2
+ import '../ir-BFwWhj2s.mjs';
3
3
  import '../dialect.mjs';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { T as TraceHealth } from '../types-CkRvjxrI.js';
2
- import '../ir-C02EIElQ.js';
1
+ import { T as TraceHealth } from '../types-D_fLt_Xv.js';
2
+ import '../ir-DZKS1tI7.js';
3
3
  import '../dialect.js';
4
4
 
5
5
  /**
@@ -1,7 +1,7 @@
1
- import { G as GlassboxEvent } from '../types-Caq-hOIj.mjs';
2
- import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-3WdGMqin.mjs';
3
- export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-3WdGMqin.mjs';
4
- import '../ir-CRV1_taF.mjs';
1
+ import { G as GlassboxEvent } from '../types-DpcAMmk-.mjs';
2
+ import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-hjzSWxtv.mjs';
3
+ export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-hjzSWxtv.mjs';
4
+ import '../ir-BFwWhj2s.mjs';
5
5
  import '../dialect.mjs';
6
6
 
7
7
  /**
@@ -1,7 +1,7 @@
1
- import { G as GlassboxEvent } from '../types-C5BX9bzi.js';
2
- import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-CkRvjxrI.js';
3
- export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-CkRvjxrI.js';
4
- import '../ir-C02EIElQ.js';
1
+ import { G as GlassboxEvent } from '../types-B4kz3Vs0.js';
2
+ import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-D_fLt_Xv.js';
3
+ export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-D_fLt_Xv.js';
4
+ import '../ir-DZKS1tI7.js';
5
5
  import '../dialect.js';
6
6
 
7
7
  /**
@@ -417,6 +417,22 @@ var PROFILES_RAW = [
417
417
  threshold: 16,
418
418
  action: "drop_to_top_relevant",
419
419
  reason: "Haiku reliability degrades above ~16 tools"
420
+ },
421
+ {
422
+ // alpha.78 — the declared `structuredOutput: 'grammar'` does NOT
423
+ // hold on long-input summarize. MEASURED (brain, playbacksam):
424
+ // 21 disambiguated `structured_output_parse_failed` fallover rows
425
+ // 2026-07-22..27, tokens_in 12,280–31,450; PB's gate counted 20/20
426
+ // in-window failures. Clean traffic p50 sits at ~9K tokens_in, so
427
+ // 12K gates the failing band without touching the working one.
428
+ // Short-input summarize carries no failure evidence and stays
429
+ // ungated — this is why it's a cliff, not an archetype-wide
430
+ // `structuredOutputHint: 'avoid'`.
431
+ metric: "input_tokens",
432
+ threshold: 12e3,
433
+ action: "quality_gate_structured",
434
+ whenIntent: "summarize",
435
+ reason: "Structured-output parse failures at 100% in-window on long-input summarize (measured on playbacksam, 2026-07-25..27; haiku only led when input size made price dominate, then failed every time)."
420
436
  }
421
437
  ],
422
438
  costInputPer1m: 1,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  ARCHETYPE_FLOOR_DEFAULT,
3
3
  getDefaultFallbackChain
4
- } from "../chunk-46U2NVOL.mjs";
4
+ } from "../chunk-FT2FN6ZP.mjs";
5
5
  import {
6
6
  tryGetProfile
7
- } from "../chunk-N36LE3MK.mjs";
7
+ } from "../chunk-VVRDFE6T.mjs";
8
8
  import {
9
9
  subscribe,
10
10
  subscribeApp
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { a as TraceDetail } from '../../types-3WdGMqin.mjs';
3
- import '../../ir-CRV1_taF.mjs';
2
+ import { a as TraceDetail } from '../../types-hjzSWxtv.mjs';
3
+ import '../../ir-BFwWhj2s.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-CkRvjxrI.js';
3
- import '../../ir-C02EIElQ.js';
2
+ import { a as TraceDetail } from '../../types-D_fLt_Xv.js';
3
+ import '../../ir-DZKS1tI7.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, B as BestPracticeAdvisory, F as FallbackReason, 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-CRV1_taF.mjs';
2
- export { m as CallAttempt, n as CallError, o as ChainModelEntry, p as ChainWithGrounding, q as Constraints, E as EffortLevel, 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-CRV1_taF.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 FallbackReason, 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-BFwWhj2s.mjs';
2
+ export { m as CallAttempt, n as CallError, o as ChainModelEntry, p as ChainWithGrounding, q as Constraints, E as EffortLevel, 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 hasMutation, K as mutationId, L as parseGoldenCaptureRate, Q as resolveGoldenCaptureRate, U as shouldCaptureGolden } from './ir-BFwWhj2s.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';
@@ -74,6 +74,20 @@ interface ExecuteOptions {
74
74
  * and `!opts.noStream`.
75
75
  */
76
76
  onChunk?: (chunk: string) => void;
77
+ /**
78
+ * alpha.78 — abort signal for the provider fetch. call() composes
79
+ * `AbortSignal.timeout(attemptTimeoutMs)` with the caller's own
80
+ * `CallOptions.abortSignal`; direct execute() consumers may pass anything.
81
+ * TimeoutError reasons classify retryable `timeout` (chain walks);
82
+ * AbortError reasons classify terminal `aborted` (caller cancelled).
83
+ */
84
+ signal?: AbortSignal;
85
+ /**
86
+ * alpha.78 — per-chunk stall bound, streaming paths only (see
87
+ * StreamingOptions.stallTimeoutMs). Ignored on non-streaming requests,
88
+ * where `signal` carries the total attempt bound instead.
89
+ */
90
+ stallTimeoutMs?: number;
77
91
  }
78
92
  interface ExecuteOk {
79
93
  ok: true;
@@ -343,7 +357,20 @@ interface CompileForAISDKv6Result {
343
357
  historyCacheMarkIndex?: number;
344
358
  /** Compile handle — pass to `record()` after the call. */
345
359
  handle: string;
346
- /** Mutation ids the compiler fired (informational). */
360
+ /**
361
+ * Mutation ids the compiler fired (informational).
362
+ *
363
+ * ⚠️ alpha.78 — element type differs BY SURFACE: this adapter carries
364
+ * `string[]` (ids), while `CompileResult`/`CallResult.mutationsApplied`
365
+ * carry `MutationApplied[]` (objects with `description`, `rankDelta`, …).
366
+ * Coding to one surface's type while reading the other's runtime is a
367
+ * silent false negative (PB 2026-07-25). Use the shape-proof helpers
368
+ * `mutationId(m)` / `hasMutation(list, 'quality-gate-measured-*')` from
369
+ * the package root instead of `typeof` checks. Neither element type can
370
+ * change without breaking a live consumer (tt-intel joins these ids;
371
+ * object readers want `description`), so the divergence is documented
372
+ * rather than unified.
373
+ */
347
374
  mutationsApplied: string[];
348
375
  /** Best-practice advisories (alpha.6). Empty when none fired. */
349
376
  advisories: BestPracticeAdvisory[];
@@ -1119,7 +1146,7 @@ declare function runStrategyEvalWithAttribution(opts: Omit<GoldenEvalOptions, 'a
1119
1146
  * guard in `tests/version.test.ts` fails the suite (and therefore
1120
1147
  * `prepublishOnly`) when they diverge — a stale constant cannot reach npm.
1121
1148
  */
1122
- declare const LIBRARY_VERSION = "2.0.0-alpha.77";
1149
+ declare const LIBRARY_VERSION = "2.0.0-alpha.79";
1123
1150
 
1124
1151
  /**
1125
1152
  * Oracle contract — how an app tells the brain whether a response was good.
@@ -1223,6 +1250,155 @@ declare function resetTokenizer(): void;
1223
1250
  */
1224
1251
  declare function countTokens(text: string): number;
1225
1252
 
1253
+ /**
1254
+ * delegate — Release D, the R2 primitive (delegation-fanout accelerator §5.2,
1255
+ * design contract advisory/kgauto/2026-07-24_delegation-fanout-accelerator-design.md).
1256
+ *
1257
+ * A consumer-mountable TOOL the orchestrating model calls mid-loop:
1258
+ * `{ sub_archetype, input, quality_floor? }`. kgauto selects the executor
1259
+ * from evidence, runs the sub-call through the compiler + call(), returns
1260
+ * the result into the loop, links parent↔child rows (R0), and enforces
1261
+ * `policy.maxCostPerTraceUsd` against the running trace spend — the field
1262
+ * that shipped INERT in Release A precisely so this release could turn it on.
1263
+ *
1264
+ * THE AUTHORITY SPLIT IS THE CONTAINMENT (§3):
1265
+ * - the MODEL decides whether and what to delegate (kgauto never
1266
+ * decomposes uninvited — §10);
1267
+ * - KGAUTO decides only who runs it — and never selects a model absent
1268
+ * from the consumer's declared `ir.models`;
1269
+ * - the CONSUMER consents: default OFF, `KGAUTO_AUTO_PROMOTE` posture
1270
+ * (explicit option beats `KGAUTO_DELEGATE` env; neither ⇒ the handler
1271
+ * refuses observably, never silently).
1272
+ *
1273
+ * Budget refusals and floor refusals are RETURNED to the model as
1274
+ * structured tool results, never thrown — the orchestrator must be able to
1275
+ * compose with what it has (a refusal mid-loop that crashes the loop would
1276
+ * convert a budget into an outage).
1277
+ *
1278
+ * Composition-verification (§7a): every sub-result is 'trusted' until the
1279
+ * orchestrator/consumer reports otherwise via `reportComposition` —
1280
+ * absence-of-report IS the recorded state (migration 052). Rung 3 reads
1281
+ * this to attribute composition failures to stitching, not executor choice.
1282
+ *
1283
+ * Trace-budget honesty (v1 limits, stated where consumers read):
1284
+ * - the in-process ledger sums DELEGATED spend for this trace (parent's
1285
+ * own root-call spend is not visible to a library ledger until a
1286
+ * brain-informed ledger lands; documented on `maxCostPerTraceUsd`);
1287
+ * - enforcement is estimate-ahead: a sub-call whose compile-time estimate
1288
+ * would cross the ceiling is refused BEFORE any spend;
1289
+ * - realized spend is computed from actual tokens × the executor
1290
+ * profile's prices after each sub-call.
1291
+ */
1292
+
1293
+ declare function isDelegateEnabledFromEnv(envSource?: Record<string, string | undefined>): boolean;
1294
+ /** Arguments the ORCHESTRATING MODEL supplies when it calls the tool. */
1295
+ interface DelegateToolArgs {
1296
+ /** The sub-task's archetype — its own learning_key downstream. */
1297
+ sub_archetype: IntentArchetypeName | string;
1298
+ /** Complete, self-contained sub-task input. The model owns fidelity here
1299
+ * (authority split): kgauto runs exactly what it is handed. */
1300
+ input: string;
1301
+ /**
1302
+ * Minimum archetype-perf score (0..10) the executor must carry for this
1303
+ * sub-archetype. Candidates below the floor are excluded BEFORE ranking;
1304
+ * if nothing in the parent's declared pool clears it, the tool refuses
1305
+ * with the scores so the model can lower the floor or do the work itself.
1306
+ */
1307
+ quality_floor?: number;
1308
+ }
1309
+ type DelegateRefusalReason = 'delegate_not_enabled' | 'invalid_sub_archetype' | 'no_qualified_executor' | 'trace_budget_exhausted' | 'call_failed';
1310
+ type DelegateResult = {
1311
+ ok: true;
1312
+ /** The sub-result text (or serialized structured output). */
1313
+ output: string;
1314
+ /** Branch handle — pass to reportComposition; joins the brain row. */
1315
+ subHandle: string;
1316
+ executorModel: string;
1317
+ costUsd: number;
1318
+ latencyMs: number;
1319
+ /** Always 'trusted' at return time — flips only via reportComposition. */
1320
+ verification: 'trusted';
1321
+ } | {
1322
+ ok: false;
1323
+ reason: DelegateRefusalReason;
1324
+ /** Human/model-readable detail — written to be COMPOSABLE (“continue
1325
+ * without this sub-result”), never a stack trace. */
1326
+ detail: string;
1327
+ };
1328
+ /**
1329
+ * Provider-agnostic tool definition. Consumers adapt `inputSchema` to their
1330
+ * SDK's tool shape (AI-SDK `parameters`, Anthropic `input_schema`, …). The
1331
+ * description IS prompt surface — it teaches the model the authority split
1332
+ * and the compose-on-refusal discipline (gates 4/5 of discipline-gates-v1
1333
+ * in tool-description form).
1334
+ */
1335
+ declare const DELEGATE_TOOL_DEFINITION: {
1336
+ readonly name: "delegate";
1337
+ readonly description: string;
1338
+ readonly inputSchema: {
1339
+ readonly type: "object";
1340
+ readonly properties: {
1341
+ readonly sub_archetype: {
1342
+ readonly type: "string";
1343
+ readonly enum: ("ask" | "hunt" | "classify" | "summarize" | "generate" | "extract" | "plan" | "critique" | "transform" | "judge")[];
1344
+ readonly description: "What kind of work the sub-task is (its routing archetype).";
1345
+ };
1346
+ readonly input: {
1347
+ readonly type: "string";
1348
+ readonly description: "Complete, self-contained sub-task input. Include everything the executor needs — it sees nothing else.";
1349
+ };
1350
+ readonly quality_floor: {
1351
+ readonly type: "number";
1352
+ readonly minimum: 0;
1353
+ readonly maximum: 10;
1354
+ readonly description: "Optional minimum executor quality score (0-10) for this archetype. Omit to accept the evidence-ranked default.";
1355
+ };
1356
+ };
1357
+ readonly required: readonly ["sub_archetype", "input"];
1358
+ readonly additionalProperties: false;
1359
+ };
1360
+ };
1361
+ interface CreateDelegateOpts {
1362
+ /** The PARENT call's IR — supplies the declared model pool (the containment
1363
+ * boundary), appId, and dialect context. */
1364
+ parentIr: PromptIR;
1365
+ /** The parent's compile/call handle — R0 linkage root. Branch rows record
1366
+ * `parent_handle=<this>` and inherit `trace_id`. */
1367
+ parentHandle: string;
1368
+ /**
1369
+ * Options forwarded to the sub-`call()` (apiKeys, fetchImpl,
1370
+ * attemptTimeoutMs, policy…). `policy.maxCostPerTraceUsd` here is what the
1371
+ * ledger enforces. `parentHandle` is set by the factory — a value passed
1372
+ * in callOpts is overridden.
1373
+ */
1374
+ callOpts?: CallOptions & {
1375
+ policy?: CompilePolicy;
1376
+ };
1377
+ /** Explicit consent — beats KGAUTO_DELEGATE env (AUTO_PROMOTE posture). */
1378
+ enabled?: boolean;
1379
+ }
1380
+ interface DelegateHandle {
1381
+ toolDefinition: typeof DELEGATE_TOOL_DEFINITION;
1382
+ handler: (args: DelegateToolArgs) => Promise<DelegateResult>;
1383
+ /**
1384
+ * §7a — report what the orchestrator did with a sub-result. Writes a
1385
+ * migration-052 row via the brain-read env trio (RLS-scoped to appId).
1386
+ * Unreported sub-results are 'trusted' by definition — report only
1387
+ * 'verified' and 'discarded'.
1388
+ */
1389
+ reportComposition: (report: {
1390
+ subHandle: string;
1391
+ disposition: 'verified' | 'discarded';
1392
+ note?: string;
1393
+ }) => Promise<{
1394
+ ok: boolean;
1395
+ reason?: string;
1396
+ }>;
1397
+ /** Ledger introspection: delegated spend recorded for this trace so far. */
1398
+ traceSpendUsd: () => number;
1399
+ }
1400
+ declare function createDelegate(opts: CreateDelegateOpts): DelegateHandle;
1401
+
1226
1402
  /**
1227
1403
  * archetype-fits — alpha.43.
1228
1404
  *
@@ -1651,18 +1827,30 @@ interface GetActionableAdvisoriesOptions {
1651
1827
  severity?: AdvisorySeverity;
1652
1828
  /** Status filter; defaults to 'open'. Pass 'all' for the full set. */
1653
1829
  status?: 'open' | 'snoozed' | 'resolved' | 'all';
1654
- brainEndpoint: string;
1655
- brainJwt: string;
1656
- brainAnonKey: string;
1830
+ /**
1831
+ * alpha.78 (PB adoption-gap ask 2): the trio now DEFAULTS from
1832
+ * `readBrainReadEnv()` when omitted, so a consumer that passes nothing
1833
+ * gets correct behavior from the canonical env names instead of a
1834
+ * self-authored config error. Explicit values still win.
1835
+ */
1836
+ brainEndpoint?: string;
1837
+ brainJwt?: string;
1838
+ brainAnonKey?: string;
1657
1839
  fetch?: typeof fetch;
1658
1840
  }
1659
1841
  interface MarkAdvisoryResolvedOptions {
1660
1842
  /** Stable id from a prior `getActionableAdvisories` call. */
1661
1843
  id: string;
1662
1844
  resolutionNote?: string;
1663
- brainEndpoint: string;
1664
- brainJwt: string;
1665
- brainAnonKey: string;
1845
+ /**
1846
+ * alpha.78 (PB adoption-gap ask 2): the trio now DEFAULTS from
1847
+ * `readBrainReadEnv()` when omitted, so a consumer that passes nothing
1848
+ * gets correct behavior from the canonical env names instead of a
1849
+ * self-authored config error. Explicit values still win.
1850
+ */
1851
+ brainEndpoint?: string;
1852
+ brainJwt?: string;
1853
+ brainAnonKey?: string;
1666
1854
  fetch?: typeof fetch;
1667
1855
  }
1668
1856
  /**
@@ -1686,8 +1874,10 @@ declare function getActionableAdvisories(opts: GetActionableAdvisoriesOptions):
1686
1874
  * Lookup strategy:
1687
1875
  * 1. Query `actionable_advisories_v?id=eq.<id>` to find the (app_id, code)
1688
1876
  * tuple for this advisory.
1689
- * 2. PATCH the latest unresolved firing in `compile_outcome_advisories`
1690
- * matching that tuple via the underlying outcome's app_id.
1877
+ * 2. PATCH EVERY unresolved firing in `compile_outcome_advisories`
1878
+ * matching that tuple via the underlying outcome's app_id. (One call
1879
+ * closes the whole rollup — the alpha.71-era docblock said "latest
1880
+ * firing", which was never what the code did; corrected alpha.78.)
1691
1881
  *
1692
1882
  * The (app_id, code) lookup is necessary because `compile_outcome_advisories`
1693
1883
  * has no `app_id` column — it inherits scope via the FK to compile_outcomes.
@@ -1696,16 +1886,27 @@ declare function getActionableAdvisories(opts: GetActionableAdvisoriesOptions):
1696
1886
  * acceptable because marks are low-frequency operator actions, not per-call
1697
1887
  * hot path.
1698
1888
  *
1699
- * Idempotent re-marks: if the advisory is already resolved (no unresolved
1700
- * firings match), the PATCH affects zero rows and the call still returns
1701
- * `ok: true`. The function returns `ok: false` only on transport / auth /
1702
- * lookup failures.
1889
+ * alpha.78 envelope (PB `resolve-envelope-cannot-close-a-rollup`, 2026-07-25):
1890
+ * the return now reports WHAT HAPPENED, not that the request was received —
1891
+ * `firingsResolved` is the count of rows this call actually flipped, and
1892
+ * `status` is the rollup's state after the write. PB measured the old
1893
+ * `ok: true` live against prod: the PATCH was being RLS-filtered to zero
1894
+ * rows (consumer JWTs had read-grant but no update-grant — migration 049
1895
+ * adds it) and the envelope reported success anyway. "When an API can
1896
+ * succeed without doing anything, the return value should distinguish those
1897
+ * cases" — this is that distinction. `firingsResolved: 0, status: 'open'`
1898
+ * on a rollup you expected to close now points at the write grant.
1899
+ *
1900
+ * Idempotent re-marks stay ok: an already-resolved advisory returns
1901
+ * `{ ok: true, firingsResolved: 0, status: 'resolved' }`.
1703
1902
  *
1704
1903
  * Returns ok/reason envelope (vs throwing) because consumer Admin UIs
1705
1904
  * typically want to render the failure inline rather than crash.
1706
1905
  */
1707
1906
  declare function markAdvisoryResolved(opts: MarkAdvisoryResolvedOptions): Promise<{
1708
1907
  ok: true;
1908
+ firingsResolved: number;
1909
+ status: 'open' | 'resolved' | 'unknown';
1709
1910
  } | {
1710
1911
  ok: false;
1711
1912
  reason: string;
@@ -1748,14 +1949,17 @@ interface MarkExclusionFindingHandledOptions {
1748
1949
  * digests + dashboards alongside the resolution_source. */
1749
1950
  resolutionNote?: string;
1750
1951
  /** Brain Supabase URL base (e.g. `https://<project>.supabase.co`). The
1751
- * function appends `/rest/v1/exclusion_findings?...`. */
1752
- brainEndpoint: string;
1952
+ * function appends `/rest/v1/exclusion_findings?...`.
1953
+ * alpha.78: defaults from `readBrainReadEnv()` when omitted. */
1954
+ brainEndpoint?: string;
1753
1955
  /** Consumer-scoped JWT carrying the `app_id` claim. The brain's RLS
1754
1956
  * policy enforces that the JWT's app_id matches the finding's app_id;
1755
- * cross-tenant writes fail at the database layer regardless of input. */
1756
- brainJwt: string;
1757
- /** Supabase anon key for the `apikey` header (PostgREST requires it). */
1758
- brainAnonKey: string;
1957
+ * cross-tenant writes fail at the database layer regardless of input.
1958
+ * alpha.78: defaults from `readBrainReadEnv()` when omitted. */
1959
+ brainJwt?: string;
1960
+ /** Supabase anon key for the `apikey` header (PostgREST requires it).
1961
+ * alpha.78: defaults from `readBrainReadEnv()` when omitted. */
1962
+ brainAnonKey?: string;
1759
1963
  /** Injected fetch for tests. Defaults to global fetch. */
1760
1964
  fetch?: typeof fetch;
1761
1965
  }
@@ -2153,6 +2357,23 @@ interface BrainReadEnv {
2153
2357
  */
2154
2358
  missingEnv: string[];
2155
2359
  }
2360
+ /**
2361
+ * alpha.78 (PB adoption-gap ask 2) — the canonical brain-read env names as
2362
+ * an exported constant, so consumers reference them instead of retyping
2363
+ * (PB invented three plausible-but-wrong names and carried the resulting
2364
+ * self-authored 503 for two months).
2365
+ */
2366
+ declare const BRAIN_READ_ENV_NAMES: {
2367
+ readonly endpoint: "KGAUTO_V2_BRAIN_SUPABASE_URL";
2368
+ readonly jwt: "KGAUTO_V2_BRAIN_JWT";
2369
+ readonly anonKey: "KGAUTO_V2_BRAIN_ANON_KEY";
2370
+ /** Accepted fallbacks, in resolution order after the canonical name. */
2371
+ readonly fallbacks: {
2372
+ readonly endpoint: readonly ["KGAUTO_V2_BRAIN_URL"];
2373
+ readonly jwt: readonly ["GLASSBOX_BRAIN_JWT"];
2374
+ readonly anonKey: readonly [];
2375
+ };
2376
+ };
2156
2377
  /**
2157
2378
  * Resolve brain-read env vars. Defaults to `process.env`; pass `envSource`
2158
2379
  * for hermetic tests. Trims surrounding whitespace and treats
@@ -2984,6 +3205,18 @@ interface PromotionRow {
2984
3205
  suppressQualityGate: boolean;
2985
3206
  /** ISO timestamp the promotion went active. */
2986
3207
  promotedAt: string;
3208
+ /**
3209
+ * alpha.78 — lifecycle status. The endpoint serves rolled_back rows only
3210
+ * when the library asks (`with_rollbacks=1`), so pre-.78 clients can
3211
+ * never receive one. Every reader that APPLIES a promotion must filter
3212
+ * to 'active'; rolled_back rows exist so advisors can see what the guard
3213
+ * already adjudicated instead of re-recommending it (PB Finding 3).
3214
+ */
3215
+ status: 'active' | 'rolled_back';
3216
+ /** ISO timestamp of the guard's revert, rolled_back rows only. */
3217
+ rolledBackAt?: string;
3218
+ /** Guard's classification ('latency' | 'economics' | 'strategy' | …). */
3219
+ rollbackClass?: string;
2987
3220
  }
2988
3221
  interface PromotionsRuntime {
2989
3222
  /** Endpoint base URL. The library appends `?app_id=<id>`. */
@@ -3038,6 +3271,30 @@ interface GetApplicablePromotionOpts {
3038
3271
  * NEVER throws. Not configured / brain down / cold → undefined.
3039
3272
  */
3040
3273
  declare function getApplicablePromotion(opts: GetApplicablePromotionOpts): PromotionRow | undefined;
3274
+ /**
3275
+ * alpha.78 — how long a guard rollback suppresses re-recommending the same
3276
+ * model on the same surface. Matches the measured-failure evidence window:
3277
+ * a `rollback_class='latency'` revert deliberately keeps the model ELIGIBLE
3278
+ * long-term (traffic patterns change), so the suppression is windowed, not
3279
+ * permanent.
3280
+ */
3281
+ declare const ROLLBACK_SUPPRESSION_WINDOW_DAYS = 28;
3282
+ /**
3283
+ * alpha.78 (PB Finding 3) — sync reader: did the promotion guard recently
3284
+ * roll back `model` on `(appId, archetype)`? The cost advisor consults this
3285
+ * so it stops recommending "exactly the downswap your own machinery
3286
+ * auto-reverted three days ago" — an advisory acting on it would
3287
+ * re-litigate a decision the guard already made correctly. Same SWR
3288
+ * posture as `getApplicablePromotion`: cold/unconfigured → undefined
3289
+ * (advisor proceeds without rollback knowledge, as before alpha.78).
3290
+ */
3291
+ declare function getRecentRollback(opts: {
3292
+ appId: string;
3293
+ archetype: IntentArchetypeName | string;
3294
+ model: string;
3295
+ windowDays?: number;
3296
+ nowMs?: number;
3297
+ }): PromotionRow | undefined;
3041
3298
  /** Reset module state. Tests must call between cases. */
3042
3299
  declare function _testResetPromotions(): void;
3043
3300
  /** Wait for any in-flight refresh to settle. */
@@ -3141,11 +3398,30 @@ interface MeasuredFailureVerdict {
3141
3398
  n: number;
3142
3399
  nFail: number;
3143
3400
  }
3401
+ /**
3402
+ * alpha.78 — public row normalizer (PB 2026-07-25 trap): the counts
3403
+ * endpoint speaks snake_case (`intent_archetype`, `n_fail`) and this module
3404
+ * speaks camelCase. A consumer reproducing a gate decision by hand from the
3405
+ * endpoint previously got a silent `gated: false` — `wilsonLowerBound(
3406
+ * undefined, 13)` returns a clean 0 rather than throwing. Exported so the
3407
+ * bridge exists exactly once.
3408
+ */
3409
+ declare function mapMeasuredFailureRows(rows: unknown[]): SurfaceFailureRow[];
3144
3410
  /**
3145
3411
  * Pure decision, exported for tests and for the advisory text. Separated
3146
3412
  * from the I/O so the policy can be exercised without a brain.
3413
+ *
3414
+ * alpha.78 — accepts BOTH row shapes: the module's camelCase
3415
+ * `SurfaceFailureRow` and the counts endpoint's raw snake_case row. A
3416
+ * snake_case row previously slipped through the type system (all fields
3417
+ * `undefined`) and judged `gated: false` silently.
3147
3418
  */
3148
- declare function judgeMeasuredFailure(row: SurfaceFailureRow | undefined, cfg?: typeof MEASURED_FAILURE_CFG): MeasuredFailureVerdict | undefined;
3419
+ declare function judgeMeasuredFailure(row: SurfaceFailureRow | {
3420
+ intent_archetype: string;
3421
+ model: string;
3422
+ n: number | string;
3423
+ n_fail: number | string;
3424
+ } | undefined, cfg?: typeof MEASURED_FAILURE_CFG): MeasuredFailureVerdict | undefined;
3149
3425
  interface MeasuredFailureRuntime {
3150
3426
  /** Endpoint base URL. The library appends `?app_id=<id>`. */
3151
3427
  endpoint: string;
@@ -3404,4 +3680,4 @@ declare function planDecomposition(args: PlanDecompositionArgs): DecompositionPl
3404
3680
  */
3405
3681
  declare function compile(ir: PromptIR, opts?: CompileOptions): CompileResult;
3406
3682
 
3407
- 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, COACH_CFG, CallOptions, CallResult, ChainEntry, type CompatibilityIntent, type CompileForAISDKv6Result, type CompileOptions, CompilePolicy, CompileResult, CompiledRequest, DECOMPOSITION_TEMPLATES, DECOMPOSITION_TEMPLATES_VERSION, DEFAULT_FINDINGS_ENDPOINT, DEFAULT_MEASURED_FAILURE_ENDPOINT, DEFAULT_PROMOTIONS_ENDPOINT, DISCIPLINE_GATES_V1_ALT_HEADER, type DecompositionPlan, type DecompositionStep, type DecompositionTemplate, type ExclusionFindingRow, type ExclusionResolutionSource, type ExecuteErr, type ExecuteOk, type ExecuteOptions, type ExecuteResult, type ExecutorCandidate, type FallbackPosture, FallbackReason, FamilyResolutionError, type GetActionableAdvisoriesOptions, type GetApplicablePromotionOpts, type GetDefaultFallbackChainOpts, type GetMeasuredFailureOpts, type GetPerAxisMetricsOpts, type GetRecommendedPrimaryOptions, type GoldenEvalAxis, type GoldenEvalCase, type GoldenEvalOptions, type GoldenEvalRunResult, type GoldenEvalStrategyId, type GoldenIrRecordInput, Grounding, IntentArchetypeName, JUDGE_RUBRICS, LIBRARY_VERSION, type LLMJudgeOptions, MEASURED_FAILURE_CFG, MEASURED_GROUNDING_MIN_N, type MarkAdvisoryResolvedOptions, type MarkExclusionFindingHandledOptions, type MarkPromoteReadyHandledOptions, type MeasuredFailureRuntime, type MeasuredFailureVerdict, type ModelBrainRow, type ModelCompatibility, ModelProfile, NormalizedResponse, type OracleContext, OracleScore, type OutcomePayload, OutcomeResult, OutputMode, PRODUCER_OWNED_RULE_CODES, PROVIDER_ENV_KEYS, PerAxisMetrics, type PlannedStep, type PricingRow, type ProbeShadowOptions, type ProbeShadowServed, type ProfileToRowOptions, type PromoteReadyFindingRow, type PromoteReadyResolution, type PromotionRow, type PromotionsRuntime, PromptIR, Provider, ProviderOverrides, type ProviderReachability, RULE_DISCIPLINE_GATES_V1, RULE_DISCIPLINE_GATES_V1_STRUCTURED, RULE_SEQUENTIAL_TOOL_CLIFF, type ReachabilityOpts, RecordInput, RecordOutcomeInput, type RunAdvisorPhase2Context, STRATEGY_AUTHORSHIP_LIMITATION, SectionRewrite, type ShadowProbeRecordInput, type StrategyAttribution, type StrategyAttributionResult, type StrategyOutcome, type SupportedProvider, type SurfaceFailureRow, type SurfaceStats, SystemModelMessage, TRANSLATOR_FLOOR, _testResetMeasuredFailure, _testResetPromotions, _testWaitForMeasuredFailureRefresh, _testWaitForPromotionsRefresh, altGatesBlockFor, applyArchetypeConvention, applySectionRewrites, attachCacheControlToStreamTextInput, awaitMeasuredFailureReady, brainHealth, buildGoldenIrRow, buildLLMJudge, buildPairwiseJudgePrompt, buildShadowProbeRow, call, classifyStrategyOutcome, clearBrain, combineOrderSwappedVerdicts, compile, compileForAISDKv6, configureBrain, configureMeasuredFailureBrain, configurePromotionsBrain, countTokens, deriveFamilyFromModelId, deriveOwnership, execute, findBetterFit, flushBrainDeadLetter, getActionableAdvisories, getAllStarterChains, getAllStarterChainsWithGrounding, getApplicablePromotion, getArchetypePerfScore, getDefaultFallbackChain, getDefaultFallbackChainWithGrounding, getMeasuredFailureVerdict, getModelCompatibility, getPerAxisMetrics, getReachabilityDiagnostic, getRecommendedPrimary, getSequentialStarterChain, getSequentialStarterChainWithGrounding, getStaleExclusionFindings, getStarterChain, getStarterChainWithGrounding, isAutoPromoteEnabledFromEnv, isBrainQueryActiveFor, isBrainSync, isExclusionFindingsBrainActive, isMeasuredFailureBrainActive, isMeasuredFailureGateEnabledFromEnv, isModelReachable, isPromotionsBrainActive, isProviderReachable, judgeMeasuredFailure, loadAliasesFromBrain, loadArchetypePerfFromBrain, loadArchetypePerfNFromBrain, loadChainsFromBrain, loadModelsFromBrain, loadPricingFromBrain, markAdvisoryResolved, markExclusionFindingHandled, markPromoteReadyHandled, parseJudgeVerdict, peekBrainDeadLetter, planDecomposition, prefetchMeasuredFailure, probeShadow, profileToRow, readBrainReadEnv, record, recordGoldenIr, recordOutcome, recordShadowProbe, renderIrForJudge, resetTokenizer, resolveConventionsForProfile, resolvePricingAt, resolveProviderKey, rubricFor, runAdvisor, runGoldenEval, runStrategyEvalWithAttribution, setTokenizer, wilsonLowerBound, withAltDisciplineContract, withDisciplineContract };
3683
+ 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, BRAIN_READ_ENV_NAMES, BestPracticeAdvisory, type BrainConfig, type BrainDeadLetterEntry, type BrainHealthSnapshot, type BrainQueryConfig, type BrainReadEnv, COACH_CFG, CallOptions, CallResult, ChainEntry, type CompatibilityIntent, type CompileForAISDKv6Result, type CompileOptions, CompilePolicy, CompileResult, CompiledRequest, type CreateDelegateOpts, DECOMPOSITION_TEMPLATES, DECOMPOSITION_TEMPLATES_VERSION, DEFAULT_FINDINGS_ENDPOINT, DEFAULT_MEASURED_FAILURE_ENDPOINT, DEFAULT_PROMOTIONS_ENDPOINT, DELEGATE_TOOL_DEFINITION, DISCIPLINE_GATES_V1_ALT_HEADER, type DecompositionPlan, type DecompositionStep, type DecompositionTemplate, type DelegateHandle, type DelegateRefusalReason, type DelegateResult, type DelegateToolArgs, type ExclusionFindingRow, type ExclusionResolutionSource, type ExecuteErr, type ExecuteOk, type ExecuteOptions, type ExecuteResult, type ExecutorCandidate, type FallbackPosture, FallbackReason, FamilyResolutionError, type GetActionableAdvisoriesOptions, type GetApplicablePromotionOpts, type GetDefaultFallbackChainOpts, type GetMeasuredFailureOpts, type GetPerAxisMetricsOpts, type GetRecommendedPrimaryOptions, type GoldenEvalAxis, type GoldenEvalCase, type GoldenEvalOptions, type GoldenEvalRunResult, type GoldenEvalStrategyId, type GoldenIrRecordInput, Grounding, IntentArchetypeName, JUDGE_RUBRICS, LIBRARY_VERSION, type LLMJudgeOptions, MEASURED_FAILURE_CFG, MEASURED_GROUNDING_MIN_N, type MarkAdvisoryResolvedOptions, type MarkExclusionFindingHandledOptions, type MarkPromoteReadyHandledOptions, type MeasuredFailureRuntime, type MeasuredFailureVerdict, type ModelBrainRow, type ModelCompatibility, ModelProfile, NormalizedResponse, type OracleContext, OracleScore, type OutcomePayload, OutcomeResult, OutputMode, PRODUCER_OWNED_RULE_CODES, PROVIDER_ENV_KEYS, PerAxisMetrics, type PlannedStep, type PricingRow, type ProbeShadowOptions, type ProbeShadowServed, type ProfileToRowOptions, type PromoteReadyFindingRow, type PromoteReadyResolution, type PromotionRow, type PromotionsRuntime, PromptIR, Provider, ProviderOverrides, type ProviderReachability, ROLLBACK_SUPPRESSION_WINDOW_DAYS, RULE_DISCIPLINE_GATES_V1, RULE_DISCIPLINE_GATES_V1_STRUCTURED, RULE_SEQUENTIAL_TOOL_CLIFF, type ReachabilityOpts, RecordInput, RecordOutcomeInput, type RunAdvisorPhase2Context, STRATEGY_AUTHORSHIP_LIMITATION, SectionRewrite, type ShadowProbeRecordInput, type StrategyAttribution, type StrategyAttributionResult, type StrategyOutcome, type SupportedProvider, type SurfaceFailureRow, type SurfaceStats, SystemModelMessage, TRANSLATOR_FLOOR, _testResetMeasuredFailure, _testResetPromotions, _testWaitForMeasuredFailureRefresh, _testWaitForPromotionsRefresh, altGatesBlockFor, applyArchetypeConvention, applySectionRewrites, attachCacheControlToStreamTextInput, awaitMeasuredFailureReady, brainHealth, buildGoldenIrRow, buildLLMJudge, buildPairwiseJudgePrompt, buildShadowProbeRow, call, classifyStrategyOutcome, clearBrain, combineOrderSwappedVerdicts, compile, compileForAISDKv6, configureBrain, configureMeasuredFailureBrain, configurePromotionsBrain, countTokens, createDelegate, deriveFamilyFromModelId, deriveOwnership, execute, findBetterFit, flushBrainDeadLetter, getActionableAdvisories, getAllStarterChains, getAllStarterChainsWithGrounding, getApplicablePromotion, getArchetypePerfScore, getDefaultFallbackChain, getDefaultFallbackChainWithGrounding, getMeasuredFailureVerdict, getModelCompatibility, getPerAxisMetrics, getReachabilityDiagnostic, getRecentRollback, getRecommendedPrimary, getSequentialStarterChain, getSequentialStarterChainWithGrounding, getStaleExclusionFindings, getStarterChain, getStarterChainWithGrounding, isAutoPromoteEnabledFromEnv, isBrainQueryActiveFor, isBrainSync, isDelegateEnabledFromEnv, isExclusionFindingsBrainActive, isMeasuredFailureBrainActive, isMeasuredFailureGateEnabledFromEnv, isModelReachable, isPromotionsBrainActive, isProviderReachable, judgeMeasuredFailure, loadAliasesFromBrain, loadArchetypePerfFromBrain, loadArchetypePerfNFromBrain, loadChainsFromBrain, loadModelsFromBrain, loadPricingFromBrain, mapMeasuredFailureRows, markAdvisoryResolved, markExclusionFindingHandled, markPromoteReadyHandled, parseJudgeVerdict, peekBrainDeadLetter, planDecomposition, prefetchMeasuredFailure, probeShadow, profileToRow, readBrainReadEnv, record, recordGoldenIr, recordOutcome, recordShadowProbe, renderIrForJudge, resetTokenizer, resolveConventionsForProfile, resolvePricingAt, resolveProviderKey, rubricFor, runAdvisor, runGoldenEval, runStrategyEvalWithAttribution, setTokenizer, wilsonLowerBound, withAltDisciplineContract, withDisciplineContract };