@warmdrift/kgauto-compiler 2.0.0-alpha.51 → 2.0.0-alpha.53
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/{chunk-HHWBB46W.mjs → chunk-IIMPJZNH.mjs} +1 -1
- package/dist/{chunk-CXH7KC4D.mjs → chunk-QKXTMVCT.mjs} +57 -0
- 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/index.js +57 -0
- package/dist/glassbox-routes/index.mjs +2 -2
- 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 +130 -17
- package/dist/index.d.ts +130 -17
- package/dist/index.js +193 -10
- package/dist/index.mjs +137 -12
- package/dist/{ir-rUUojj0s.d.ts → ir-BiXAMyji.d.ts} +10 -1
- package/dist/{ir-dDcG8Pvu.d.mts → ir-CAlLBu5d.d.mts} +10 -1
- package/dist/profiles.d.mts +1 -1
- package/dist/profiles.d.ts +1 -1
- package/dist/profiles.js +57 -0
- package/dist/profiles.mjs +1 -1
- package/dist/{types-vGo-h0tZ.d.mts → types-C_dkNMA_.d.mts} +1 -1
- package/dist/{types-BTeRoSvM.d.mts → types-Dj5FLhBV.d.mts} +1 -1
- package/dist/{types-B_pdPjxm.d.ts → types-DsA8JFOp.d.ts} +1 -1
- package/dist/{types-UXPxWabQ.d.ts → types-hEDGehpz.d.ts} +1 -1
- package/package.json +1 -1
|
@@ -1356,6 +1356,63 @@ var PROFILES_RAW = [
|
|
|
1356
1356
|
critique: 5
|
|
1357
1357
|
// +1 vs 2.5-flash — but still below Sonnet/Opus reasoning floor
|
|
1358
1358
|
}
|
|
1359
|
+
},
|
|
1360
|
+
{
|
|
1361
|
+
// Auto-onboarded 2026-07-01 from `claude-sonnet-4-6`; VERIFIED 2026-07-02
|
|
1362
|
+
// against the claude-api reference (cc-portfolio ratification pass). The
|
|
1363
|
+
// clone got context right (1M) and pricing right at sticker ($3/$15 —
|
|
1364
|
+
// NOTE an introductory $2/$10 per MTok runs through 2026-08-31; sticker
|
|
1365
|
+
// encoded here per the time-bounded-pricing convention, intro belongs in
|
|
1366
|
+
// brain kgauto_pricing if worth capturing). The clone got max output WRONG:
|
|
1367
|
+
// Sonnet 5 is 128k, not 4-6's 64k — corrected. New tokenizer (~30% more
|
|
1368
|
+
// tokens for the same text vs 4-6): byte-budget consumers should re-baseline.
|
|
1369
|
+
// API quirks (claude-api ref): (a) NON-DEFAULT temperature/top_p/top_k
|
|
1370
|
+
// return 400 — moot for kgauto's own call() path (ANTHROPIC_LOWERING_BASE
|
|
1371
|
+
// emits no sampling params) but a REAL hazard for compileForAISDKv6
|
|
1372
|
+
// consumers that pass temperature themselves (tt-intel scoring uses temp:0
|
|
1373
|
+
// for determinism — that 400s on this model; noted to consumers via the
|
|
1374
|
+
// contract). (b) Omitting `thinking` runs ADAPTIVE by default (4-6 ran
|
|
1375
|
+
// thinking-off) — output spend shifts. (c) Supports effort xhigh. status:
|
|
1376
|
+
// 'preview' per the Fable precedent — no brain evidence yet; promotion to
|
|
1377
|
+
// 'current' is an explicit call. (L-049/L-081.)
|
|
1378
|
+
id: "claude-sonnet-5",
|
|
1379
|
+
verifiedAgainstDocs: "2026-07-02",
|
|
1380
|
+
provider: "anthropic",
|
|
1381
|
+
status: "preview",
|
|
1382
|
+
maxContextTokens: 1e6,
|
|
1383
|
+
maxOutputTokens: 128e3,
|
|
1384
|
+
maxTools: 64,
|
|
1385
|
+
parallelToolCalls: true,
|
|
1386
|
+
structuredOutput: "grammar",
|
|
1387
|
+
systemPromptMode: "inline",
|
|
1388
|
+
streaming: true,
|
|
1389
|
+
cliffs: [],
|
|
1390
|
+
costInputPer1m: 3,
|
|
1391
|
+
costOutputPer1m: 15,
|
|
1392
|
+
lowering: ANTHROPIC_LOWERING_BASE,
|
|
1393
|
+
recovery: [
|
|
1394
|
+
{ signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate" },
|
|
1395
|
+
{ signal: "model_not_found", action: "escalate", reason: "Deprecated \u2014 escalate (L-061)" }
|
|
1396
|
+
],
|
|
1397
|
+
strengths: ["quality", "tool_use", "long_context", "cache_friendly", "extended_thinking"],
|
|
1398
|
+
weaknesses: [],
|
|
1399
|
+
notes: "Sonnet 5 (2026-06): near-Opus quality on coding/agentic work at Sonnet cost. Verified 2026-07-02 against the claude-api reference: 1M ctx, 128k out (clone's 64k corrected), $3/$15 sticker (intro $2/$10 through 2026-08-31). New tokenizer ~30% more tokens vs sonnet-4-6. Consumer hazards: non-default temperature/top_p/top_k 400 (temp:0 rejected \u2014 deterministic-scoring consumers must omit); thinking defaults to adaptive when omitted. status:preview \u2014 no brain evidence yet; earns placement via the machinery.",
|
|
1400
|
+
// Master plan §6.2 anchor. Tier 0 for plan/generate/ask/extract/transform
|
|
1401
|
+
// in starter chains; tier 1 cross-provider for hunt/summarize/classify.
|
|
1402
|
+
archetypePerf: {
|
|
1403
|
+
ask: 9,
|
|
1404
|
+
generate: 9,
|
|
1405
|
+
plan: 9,
|
|
1406
|
+
critique: 9,
|
|
1407
|
+
extract: 9,
|
|
1408
|
+
transform: 9,
|
|
1409
|
+
hunt: 7,
|
|
1410
|
+
// strong but Flash beats on parallel tool throughput
|
|
1411
|
+
summarize: 8,
|
|
1412
|
+
// overkill for tolerant archetype
|
|
1413
|
+
classify: 8
|
|
1414
|
+
// overkill
|
|
1415
|
+
}
|
|
1359
1416
|
}
|
|
1360
1417
|
];
|
|
1361
1418
|
var ALIASES = {
|
|
@@ -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-C_dkNMA_.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-C_dkNMA_.mjs';
|
|
3
|
+
import '../ir-CAlLBu5d.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-hEDGehpz.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-hEDGehpz.js';
|
|
3
|
+
import '../ir-BiXAMyji.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-C_dkNMA_.mjs';
|
|
2
|
+
import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-Dj5FLhBV.mjs';
|
|
3
|
+
export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-Dj5FLhBV.mjs';
|
|
4
|
+
import '../ir-CAlLBu5d.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-hEDGehpz.js';
|
|
2
|
+
import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-DsA8JFOp.js';
|
|
3
|
+
export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-DsA8JFOp.js';
|
|
4
|
+
import '../ir-BiXAMyji.js';
|
|
5
5
|
import '../dialect.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -1410,6 +1410,63 @@ var PROFILES_RAW = [
|
|
|
1410
1410
|
critique: 5
|
|
1411
1411
|
// +1 vs 2.5-flash — but still below Sonnet/Opus reasoning floor
|
|
1412
1412
|
}
|
|
1413
|
+
},
|
|
1414
|
+
{
|
|
1415
|
+
// Auto-onboarded 2026-07-01 from `claude-sonnet-4-6`; VERIFIED 2026-07-02
|
|
1416
|
+
// against the claude-api reference (cc-portfolio ratification pass). The
|
|
1417
|
+
// clone got context right (1M) and pricing right at sticker ($3/$15 —
|
|
1418
|
+
// NOTE an introductory $2/$10 per MTok runs through 2026-08-31; sticker
|
|
1419
|
+
// encoded here per the time-bounded-pricing convention, intro belongs in
|
|
1420
|
+
// brain kgauto_pricing if worth capturing). The clone got max output WRONG:
|
|
1421
|
+
// Sonnet 5 is 128k, not 4-6's 64k — corrected. New tokenizer (~30% more
|
|
1422
|
+
// tokens for the same text vs 4-6): byte-budget consumers should re-baseline.
|
|
1423
|
+
// API quirks (claude-api ref): (a) NON-DEFAULT temperature/top_p/top_k
|
|
1424
|
+
// return 400 — moot for kgauto's own call() path (ANTHROPIC_LOWERING_BASE
|
|
1425
|
+
// emits no sampling params) but a REAL hazard for compileForAISDKv6
|
|
1426
|
+
// consumers that pass temperature themselves (tt-intel scoring uses temp:0
|
|
1427
|
+
// for determinism — that 400s on this model; noted to consumers via the
|
|
1428
|
+
// contract). (b) Omitting `thinking` runs ADAPTIVE by default (4-6 ran
|
|
1429
|
+
// thinking-off) — output spend shifts. (c) Supports effort xhigh. status:
|
|
1430
|
+
// 'preview' per the Fable precedent — no brain evidence yet; promotion to
|
|
1431
|
+
// 'current' is an explicit call. (L-049/L-081.)
|
|
1432
|
+
id: "claude-sonnet-5",
|
|
1433
|
+
verifiedAgainstDocs: "2026-07-02",
|
|
1434
|
+
provider: "anthropic",
|
|
1435
|
+
status: "preview",
|
|
1436
|
+
maxContextTokens: 1e6,
|
|
1437
|
+
maxOutputTokens: 128e3,
|
|
1438
|
+
maxTools: 64,
|
|
1439
|
+
parallelToolCalls: true,
|
|
1440
|
+
structuredOutput: "grammar",
|
|
1441
|
+
systemPromptMode: "inline",
|
|
1442
|
+
streaming: true,
|
|
1443
|
+
cliffs: [],
|
|
1444
|
+
costInputPer1m: 3,
|
|
1445
|
+
costOutputPer1m: 15,
|
|
1446
|
+
lowering: ANTHROPIC_LOWERING_BASE,
|
|
1447
|
+
recovery: [
|
|
1448
|
+
{ signal: "rate_limit", action: "escalate", reason: "429 \u2014 escalate" },
|
|
1449
|
+
{ signal: "model_not_found", action: "escalate", reason: "Deprecated \u2014 escalate (L-061)" }
|
|
1450
|
+
],
|
|
1451
|
+
strengths: ["quality", "tool_use", "long_context", "cache_friendly", "extended_thinking"],
|
|
1452
|
+
weaknesses: [],
|
|
1453
|
+
notes: "Sonnet 5 (2026-06): near-Opus quality on coding/agentic work at Sonnet cost. Verified 2026-07-02 against the claude-api reference: 1M ctx, 128k out (clone's 64k corrected), $3/$15 sticker (intro $2/$10 through 2026-08-31). New tokenizer ~30% more tokens vs sonnet-4-6. Consumer hazards: non-default temperature/top_p/top_k 400 (temp:0 rejected \u2014 deterministic-scoring consumers must omit); thinking defaults to adaptive when omitted. status:preview \u2014 no brain evidence yet; earns placement via the machinery.",
|
|
1454
|
+
// Master plan §6.2 anchor. Tier 0 for plan/generate/ask/extract/transform
|
|
1455
|
+
// in starter chains; tier 1 cross-provider for hunt/summarize/classify.
|
|
1456
|
+
archetypePerf: {
|
|
1457
|
+
ask: 9,
|
|
1458
|
+
generate: 9,
|
|
1459
|
+
plan: 9,
|
|
1460
|
+
critique: 9,
|
|
1461
|
+
extract: 9,
|
|
1462
|
+
transform: 9,
|
|
1463
|
+
hunt: 7,
|
|
1464
|
+
// strong but Flash beats on parallel tool throughput
|
|
1465
|
+
summarize: 8,
|
|
1466
|
+
// overkill for tolerant archetype
|
|
1467
|
+
classify: 8
|
|
1468
|
+
// overkill
|
|
1469
|
+
}
|
|
1413
1470
|
}
|
|
1414
1471
|
];
|
|
1415
1472
|
var ALIASES = {
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ARCHETYPE_FLOOR_DEFAULT,
|
|
3
3
|
getDefaultFallbackChain
|
|
4
|
-
} from "../chunk-
|
|
4
|
+
} from "../chunk-IIMPJZNH.mjs";
|
|
5
5
|
import {
|
|
6
6
|
tryGetProfile
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-QKXTMVCT.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-
|
|
3
|
-
import '../../ir-
|
|
2
|
+
import { a as TraceDetail } from '../../types-Dj5FLhBV.mjs';
|
|
3
|
+
import '../../ir-CAlLBu5d.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-DsA8JFOp.js';
|
|
3
|
+
import '../../ir-BiXAMyji.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,
|
|
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, x as ShadowProbeConfig, T as ToolCall, y as ToolDefinition } from './ir-
|
|
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-CAlLBu5d.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, x as ShadowProbeConfig, T as ToolCall, y as ToolDefinition } from './ir-CAlLBu5d.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
|
import { IntentArchetypeName } from './dialect.mjs';
|
|
@@ -250,6 +250,100 @@ interface AttachCacheControlResult {
|
|
|
250
250
|
*/
|
|
251
251
|
declare function attachCacheControlToStreamTextInput(result: CompileResult, convertedMessages: AISDKConvertedMessage[]): AttachCacheControlResult;
|
|
252
252
|
|
|
253
|
+
/**
|
|
254
|
+
* alpha.52 — official AI-SDK-v6 compile adapter + compile-then-discard guard.
|
|
255
|
+
*
|
|
256
|
+
* Until now each AI-SDK consumer (tt-intel, IC) hand-rolled this adapter in
|
|
257
|
+
* its own `lib/kgauto-v2/index.ts`: `compile()` → reassemble the system param
|
|
258
|
+
* per provider → extract kept tool names per provider → re-derive the history
|
|
259
|
+
* cache-mark index (a copy of the compiler's own `historyCacheMarkIndex`
|
|
260
|
+
* logic — drift-prone). This centralizes that boilerplate and DRYs the two
|
|
261
|
+
* near-identical wrappers.
|
|
262
|
+
*
|
|
263
|
+
* It also closes the compile-then-discard hole. The discard pattern is:
|
|
264
|
+
*
|
|
265
|
+
* const c = compileForAISDKv6(ir); // compile runs
|
|
266
|
+
* const out = await generateText({ // …but a hand-built prompt
|
|
267
|
+
* model: getModel(otherId), prompt }); // + a DIFFERENT model run
|
|
268
|
+
* await record({ handle: c.handle, … }); // brain row attributed to `c`
|
|
269
|
+
*
|
|
270
|
+
* The recorded row's `mutations_applied` / `estimated_tokens_in` /
|
|
271
|
+
* `system_prompt_chars` then describe a compile that never reached the wire.
|
|
272
|
+
* A library-level runtime guard could NOT catch this while the adapter lived
|
|
273
|
+
* in consumer code (the consumer wrapper always reads `compile()`'s result to
|
|
274
|
+
* build its own object, so any getter there is "consumed" every time,
|
|
275
|
+
* regardless of whether the final caller used the wrapper output). With the
|
|
276
|
+
* adapter IN the library, the object the FINAL caller reads is library-owned,
|
|
277
|
+
* so consume-tracking getters on `.system` / `.model` / `.raw` detect non-use
|
|
278
|
+
* and `record()` warns. See `interfaces/kgauto.md` (## Requested:
|
|
279
|
+
* `compiled-output-discarded-guard`).
|
|
280
|
+
*
|
|
281
|
+
* The guard is OPT-IN-BY-USE: only `compileForAISDKv6` arms tracking, so
|
|
282
|
+
* `call()` paths and raw `compile()` users never see a false warning.
|
|
283
|
+
*/
|
|
284
|
+
|
|
285
|
+
interface CompileForAISDKv6Result {
|
|
286
|
+
/**
|
|
287
|
+
* Pass to `streamText`/`generateText({ model })` — the caller maps this id
|
|
288
|
+
* to an AI-SDK `LanguageModel`. Reading this marks the compile "consumed"
|
|
289
|
+
* (silences the compile-then-discard guard).
|
|
290
|
+
*/
|
|
291
|
+
readonly model: string;
|
|
292
|
+
/**
|
|
293
|
+
* System parameter for `streamText`/`generateText({ system })`. Returns the
|
|
294
|
+
* structured `SystemModelMessage[]` form when the target is Anthropic AND a
|
|
295
|
+
* cacheable section exists (preserves the cache_control marker across the
|
|
296
|
+
* wire); a flat concatenated string otherwise. Reading this marks
|
|
297
|
+
* "consumed". (Same rule as `attachCacheControlToStreamTextInput`.)
|
|
298
|
+
*/
|
|
299
|
+
readonly system: string | SystemModelMessage[];
|
|
300
|
+
/**
|
|
301
|
+
* The raw kgauto `CompileResult` — for `attachCacheControlToStreamTextInput(raw, msgs)`
|
|
302
|
+
* and `probeShadow(raw.ir-equivalent, …)` paths. Reading this marks
|
|
303
|
+
* "consumed" (it means you're using the compile output via the raw result).
|
|
304
|
+
*/
|
|
305
|
+
readonly raw: CompileResult;
|
|
306
|
+
/** Tool names that survived budget + relevance — filter your SDK tool map to these. */
|
|
307
|
+
keptToolNames: Set<string>;
|
|
308
|
+
/** providerOptions for `streamText` — Anthropic cache_control on the cacheable prefix. Undefined otherwise. */
|
|
309
|
+
providerOptions?: {
|
|
310
|
+
anthropic?: {
|
|
311
|
+
cacheControl?: {
|
|
312
|
+
type: 'ephemeral';
|
|
313
|
+
};
|
|
314
|
+
};
|
|
315
|
+
};
|
|
316
|
+
/**
|
|
317
|
+
* Index (into post-strip history) for the Anthropic history cache marker
|
|
318
|
+
* (alpha.33). Mirror of `result.diagnostics.historyCacheMarkIndex` — no
|
|
319
|
+
* consumer re-derivation needed. Undefined when no marker fires.
|
|
320
|
+
*/
|
|
321
|
+
historyCacheMarkIndex?: number;
|
|
322
|
+
/** Compile handle — pass to `record()` after the call. */
|
|
323
|
+
handle: string;
|
|
324
|
+
/** Mutation ids the compiler fired (informational). */
|
|
325
|
+
mutationsApplied: string[];
|
|
326
|
+
/** Best-practice advisories (alpha.6). Empty when none fired. */
|
|
327
|
+
advisories: BestPracticeAdvisory[];
|
|
328
|
+
/** Compiler diagnostics + the three commonly-logged top-level fields. */
|
|
329
|
+
diagnostics: CompileResult['diagnostics'] & {
|
|
330
|
+
targetProvider: string;
|
|
331
|
+
estimatedCostUsd: number;
|
|
332
|
+
fallbackChain: string[];
|
|
333
|
+
};
|
|
334
|
+
/** The compiled IR — pass to `probeShadow(ir, …)` in `onFinish` (alpha.48). */
|
|
335
|
+
ir: PromptIR;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Compile a `PromptIR` and lower it to an AI-SDK-v6 `streamText`/`generateText`
|
|
339
|
+
* bundle. Replaces the hand-rolled per-consumer adapter.
|
|
340
|
+
*
|
|
341
|
+
* Arms the compile-then-discard guard: read `.system` / `.model` / `.raw` to
|
|
342
|
+
* serve the call. If you `record()` the handle without reading any of them,
|
|
343
|
+
* `record()` emits a dev-mode warning that the compile was discarded.
|
|
344
|
+
*/
|
|
345
|
+
declare function compileForAISDKv6(ir: PromptIR, opts?: CompileOptions): CompileForAISDKv6Result;
|
|
346
|
+
|
|
253
347
|
/**
|
|
254
348
|
* alpha.11 — opt-in nested config for brain-query mode (chains / archetype
|
|
255
349
|
* perf / pricing / models registry). Enabled by default when endpoint is
|
|
@@ -304,16 +398,21 @@ interface BrainConfig {
|
|
|
304
398
|
/** alpha.11 — brain-query mode for config tables. Default-on per table
|
|
305
399
|
* when endpoint is set; opt-out via `false`. See BrainQueryConfig. */
|
|
306
400
|
brainQuery?: BrainQueryConfig;
|
|
401
|
+
/**
|
|
402
|
+
* alpha.52 — emit a dev-mode `console.warn` when a `compileForAISDKv6()`
|
|
403
|
+
* result is passed to record() but its `.system` / `.model` / `.raw` were
|
|
404
|
+
* never read (the compile-then-discard pattern: the recorded brain row's
|
|
405
|
+
* `mutations_applied` / `estimated_tokens_in` / `system_prompt_chars`
|
|
406
|
+
* describe a compile that did NOT shape the served call). Default: warn
|
|
407
|
+
* when `NODE_ENV !== 'production'`, silent in production. Set `true` to
|
|
408
|
+
* force-on (e.g. a prod audit window) or `false` to silence. No-op for
|
|
409
|
+
* `call()` paths and raw `compile()` users — only `compileForAISDKv6`
|
|
410
|
+
* arms the tracking, so good actors never see a false warning.
|
|
411
|
+
*/
|
|
412
|
+
warnOnDiscardedCompile?: boolean;
|
|
307
413
|
}
|
|
308
414
|
declare function configureBrain(config: BrainConfig): void;
|
|
309
415
|
declare function clearBrain(): void;
|
|
310
|
-
/**
|
|
311
|
-
* Record the outcome of a compiled call. Fire-and-forget by default.
|
|
312
|
-
*
|
|
313
|
-
* Returns a Promise so callers in `sync` mode can await; in async mode the
|
|
314
|
-
* promise resolves immediately (after the request is queued) and any
|
|
315
|
-
* network error is swallowed/forwarded to onError.
|
|
316
|
-
*/
|
|
317
416
|
declare function record(input: RecordInput): Promise<void>;
|
|
318
417
|
/**
|
|
319
418
|
* Wire shape POSTed by `record()` to the brain proxy's `/outcomes` endpoint.
|
|
@@ -437,13 +536,26 @@ interface ShadowProbeRecordInput {
|
|
|
437
536
|
/** Wall-clock latency of the candidate replay call, ms (alpha.46). */
|
|
438
537
|
latencyCandidateMs?: number;
|
|
439
538
|
/**
|
|
440
|
-
* alpha — probe-row class (migration 029
|
|
441
|
-
* pre-029 row shape: candidate ran, columns
|
|
442
|
-
* and `'skipped_slow_tier_sync'` are
|
|
443
|
-
*
|
|
444
|
-
*
|
|
539
|
+
* alpha — probe-row class (migration 029; `candidate_error` added by 032).
|
|
540
|
+
* Defaults to `'completed'` (the pre-029 row shape: candidate ran, columns
|
|
541
|
+
* populated). `'aborted_latency_budget'` and `'skipped_slow_tier_sync'` are
|
|
542
|
+
* DIAGNOSTIC rows from sync-mode latency protection; `'candidate_error'`
|
|
543
|
+
* (alpha.53) is the failed-candidate diagnostic — the candidate call
|
|
544
|
+
* errored, with the error class + latency-at-death recorded instead of
|
|
545
|
+
* silence (the IC demo-night probe deaths were invisible for ~90 min under
|
|
546
|
+
* the old record-no-row rule). Diagnostic rows carry no candidate response
|
|
547
|
+
* and no verdict — no false quality signal. A verdict rollup MUST filter to
|
|
548
|
+
* `outcome='completed'`.
|
|
549
|
+
*/
|
|
550
|
+
outcome?: 'completed' | 'aborted_latency_budget' | 'skipped_slow_tier_sync' | 'candidate_error';
|
|
551
|
+
/**
|
|
552
|
+
* alpha.53 (migration 032) — error class for `outcome='candidate_error'`
|
|
553
|
+
* rows. Values follow execute()'s taxonomy (`rate_limit`, `timeout`,
|
|
554
|
+
* `server_error`, `model_not_found`, `auth`, `invalid_request`, `unknown`)
|
|
555
|
+
* plus `execute_rejected` (the execute promise rejected outright). NULL /
|
|
556
|
+
* omitted on all other row classes.
|
|
445
557
|
*/
|
|
446
|
-
|
|
558
|
+
errorClass?: string;
|
|
447
559
|
}
|
|
448
560
|
/**
|
|
449
561
|
* Pure builder for the `probe_outcomes` row written by the inline shadow-probe.
|
|
@@ -475,7 +587,8 @@ declare function buildShadowProbeRow(input: ShadowProbeRecordInput): {
|
|
|
475
587
|
latency_candidate_ms: number | null;
|
|
476
588
|
prompt_fidelity: number;
|
|
477
589
|
replay_source: 'inline-full-ir';
|
|
478
|
-
outcome: 'completed' | 'aborted_latency_budget' | 'skipped_slow_tier_sync';
|
|
590
|
+
outcome: 'completed' | 'aborted_latency_budget' | 'skipped_slow_tier_sync' | 'candidate_error';
|
|
591
|
+
error_class: string | null;
|
|
479
592
|
};
|
|
480
593
|
/**
|
|
481
594
|
* Persist one inline shadow-probe row to `probe_outcomes`. Fire-and-forget by
|
|
@@ -2272,4 +2385,4 @@ declare function markPromoteReadyHandled(opts: MarkPromoteReadyHandledOptions):
|
|
|
2272
2385
|
*/
|
|
2273
2386
|
declare function compile(ir: PromptIR, opts?: CompileOptions): CompileResult;
|
|
2274
2387
|
|
|
2275
|
-
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 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, 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, 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 };
|
|
2388
|
+
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, 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 };
|
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,
|
|
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, x as ShadowProbeConfig, T as ToolCall, y as ToolDefinition } from './ir-
|
|
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-BiXAMyji.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, x as ShadowProbeConfig, T as ToolCall, y as ToolDefinition } from './ir-BiXAMyji.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
|
import { IntentArchetypeName } from './dialect.js';
|
|
@@ -250,6 +250,100 @@ interface AttachCacheControlResult {
|
|
|
250
250
|
*/
|
|
251
251
|
declare function attachCacheControlToStreamTextInput(result: CompileResult, convertedMessages: AISDKConvertedMessage[]): AttachCacheControlResult;
|
|
252
252
|
|
|
253
|
+
/**
|
|
254
|
+
* alpha.52 — official AI-SDK-v6 compile adapter + compile-then-discard guard.
|
|
255
|
+
*
|
|
256
|
+
* Until now each AI-SDK consumer (tt-intel, IC) hand-rolled this adapter in
|
|
257
|
+
* its own `lib/kgauto-v2/index.ts`: `compile()` → reassemble the system param
|
|
258
|
+
* per provider → extract kept tool names per provider → re-derive the history
|
|
259
|
+
* cache-mark index (a copy of the compiler's own `historyCacheMarkIndex`
|
|
260
|
+
* logic — drift-prone). This centralizes that boilerplate and DRYs the two
|
|
261
|
+
* near-identical wrappers.
|
|
262
|
+
*
|
|
263
|
+
* It also closes the compile-then-discard hole. The discard pattern is:
|
|
264
|
+
*
|
|
265
|
+
* const c = compileForAISDKv6(ir); // compile runs
|
|
266
|
+
* const out = await generateText({ // …but a hand-built prompt
|
|
267
|
+
* model: getModel(otherId), prompt }); // + a DIFFERENT model run
|
|
268
|
+
* await record({ handle: c.handle, … }); // brain row attributed to `c`
|
|
269
|
+
*
|
|
270
|
+
* The recorded row's `mutations_applied` / `estimated_tokens_in` /
|
|
271
|
+
* `system_prompt_chars` then describe a compile that never reached the wire.
|
|
272
|
+
* A library-level runtime guard could NOT catch this while the adapter lived
|
|
273
|
+
* in consumer code (the consumer wrapper always reads `compile()`'s result to
|
|
274
|
+
* build its own object, so any getter there is "consumed" every time,
|
|
275
|
+
* regardless of whether the final caller used the wrapper output). With the
|
|
276
|
+
* adapter IN the library, the object the FINAL caller reads is library-owned,
|
|
277
|
+
* so consume-tracking getters on `.system` / `.model` / `.raw` detect non-use
|
|
278
|
+
* and `record()` warns. See `interfaces/kgauto.md` (## Requested:
|
|
279
|
+
* `compiled-output-discarded-guard`).
|
|
280
|
+
*
|
|
281
|
+
* The guard is OPT-IN-BY-USE: only `compileForAISDKv6` arms tracking, so
|
|
282
|
+
* `call()` paths and raw `compile()` users never see a false warning.
|
|
283
|
+
*/
|
|
284
|
+
|
|
285
|
+
interface CompileForAISDKv6Result {
|
|
286
|
+
/**
|
|
287
|
+
* Pass to `streamText`/`generateText({ model })` — the caller maps this id
|
|
288
|
+
* to an AI-SDK `LanguageModel`. Reading this marks the compile "consumed"
|
|
289
|
+
* (silences the compile-then-discard guard).
|
|
290
|
+
*/
|
|
291
|
+
readonly model: string;
|
|
292
|
+
/**
|
|
293
|
+
* System parameter for `streamText`/`generateText({ system })`. Returns the
|
|
294
|
+
* structured `SystemModelMessage[]` form when the target is Anthropic AND a
|
|
295
|
+
* cacheable section exists (preserves the cache_control marker across the
|
|
296
|
+
* wire); a flat concatenated string otherwise. Reading this marks
|
|
297
|
+
* "consumed". (Same rule as `attachCacheControlToStreamTextInput`.)
|
|
298
|
+
*/
|
|
299
|
+
readonly system: string | SystemModelMessage[];
|
|
300
|
+
/**
|
|
301
|
+
* The raw kgauto `CompileResult` — for `attachCacheControlToStreamTextInput(raw, msgs)`
|
|
302
|
+
* and `probeShadow(raw.ir-equivalent, …)` paths. Reading this marks
|
|
303
|
+
* "consumed" (it means you're using the compile output via the raw result).
|
|
304
|
+
*/
|
|
305
|
+
readonly raw: CompileResult;
|
|
306
|
+
/** Tool names that survived budget + relevance — filter your SDK tool map to these. */
|
|
307
|
+
keptToolNames: Set<string>;
|
|
308
|
+
/** providerOptions for `streamText` — Anthropic cache_control on the cacheable prefix. Undefined otherwise. */
|
|
309
|
+
providerOptions?: {
|
|
310
|
+
anthropic?: {
|
|
311
|
+
cacheControl?: {
|
|
312
|
+
type: 'ephemeral';
|
|
313
|
+
};
|
|
314
|
+
};
|
|
315
|
+
};
|
|
316
|
+
/**
|
|
317
|
+
* Index (into post-strip history) for the Anthropic history cache marker
|
|
318
|
+
* (alpha.33). Mirror of `result.diagnostics.historyCacheMarkIndex` — no
|
|
319
|
+
* consumer re-derivation needed. Undefined when no marker fires.
|
|
320
|
+
*/
|
|
321
|
+
historyCacheMarkIndex?: number;
|
|
322
|
+
/** Compile handle — pass to `record()` after the call. */
|
|
323
|
+
handle: string;
|
|
324
|
+
/** Mutation ids the compiler fired (informational). */
|
|
325
|
+
mutationsApplied: string[];
|
|
326
|
+
/** Best-practice advisories (alpha.6). Empty when none fired. */
|
|
327
|
+
advisories: BestPracticeAdvisory[];
|
|
328
|
+
/** Compiler diagnostics + the three commonly-logged top-level fields. */
|
|
329
|
+
diagnostics: CompileResult['diagnostics'] & {
|
|
330
|
+
targetProvider: string;
|
|
331
|
+
estimatedCostUsd: number;
|
|
332
|
+
fallbackChain: string[];
|
|
333
|
+
};
|
|
334
|
+
/** The compiled IR — pass to `probeShadow(ir, …)` in `onFinish` (alpha.48). */
|
|
335
|
+
ir: PromptIR;
|
|
336
|
+
}
|
|
337
|
+
/**
|
|
338
|
+
* Compile a `PromptIR` and lower it to an AI-SDK-v6 `streamText`/`generateText`
|
|
339
|
+
* bundle. Replaces the hand-rolled per-consumer adapter.
|
|
340
|
+
*
|
|
341
|
+
* Arms the compile-then-discard guard: read `.system` / `.model` / `.raw` to
|
|
342
|
+
* serve the call. If you `record()` the handle without reading any of them,
|
|
343
|
+
* `record()` emits a dev-mode warning that the compile was discarded.
|
|
344
|
+
*/
|
|
345
|
+
declare function compileForAISDKv6(ir: PromptIR, opts?: CompileOptions): CompileForAISDKv6Result;
|
|
346
|
+
|
|
253
347
|
/**
|
|
254
348
|
* alpha.11 — opt-in nested config for brain-query mode (chains / archetype
|
|
255
349
|
* perf / pricing / models registry). Enabled by default when endpoint is
|
|
@@ -304,16 +398,21 @@ interface BrainConfig {
|
|
|
304
398
|
/** alpha.11 — brain-query mode for config tables. Default-on per table
|
|
305
399
|
* when endpoint is set; opt-out via `false`. See BrainQueryConfig. */
|
|
306
400
|
brainQuery?: BrainQueryConfig;
|
|
401
|
+
/**
|
|
402
|
+
* alpha.52 — emit a dev-mode `console.warn` when a `compileForAISDKv6()`
|
|
403
|
+
* result is passed to record() but its `.system` / `.model` / `.raw` were
|
|
404
|
+
* never read (the compile-then-discard pattern: the recorded brain row's
|
|
405
|
+
* `mutations_applied` / `estimated_tokens_in` / `system_prompt_chars`
|
|
406
|
+
* describe a compile that did NOT shape the served call). Default: warn
|
|
407
|
+
* when `NODE_ENV !== 'production'`, silent in production. Set `true` to
|
|
408
|
+
* force-on (e.g. a prod audit window) or `false` to silence. No-op for
|
|
409
|
+
* `call()` paths and raw `compile()` users — only `compileForAISDKv6`
|
|
410
|
+
* arms the tracking, so good actors never see a false warning.
|
|
411
|
+
*/
|
|
412
|
+
warnOnDiscardedCompile?: boolean;
|
|
307
413
|
}
|
|
308
414
|
declare function configureBrain(config: BrainConfig): void;
|
|
309
415
|
declare function clearBrain(): void;
|
|
310
|
-
/**
|
|
311
|
-
* Record the outcome of a compiled call. Fire-and-forget by default.
|
|
312
|
-
*
|
|
313
|
-
* Returns a Promise so callers in `sync` mode can await; in async mode the
|
|
314
|
-
* promise resolves immediately (after the request is queued) and any
|
|
315
|
-
* network error is swallowed/forwarded to onError.
|
|
316
|
-
*/
|
|
317
416
|
declare function record(input: RecordInput): Promise<void>;
|
|
318
417
|
/**
|
|
319
418
|
* Wire shape POSTed by `record()` to the brain proxy's `/outcomes` endpoint.
|
|
@@ -437,13 +536,26 @@ interface ShadowProbeRecordInput {
|
|
|
437
536
|
/** Wall-clock latency of the candidate replay call, ms (alpha.46). */
|
|
438
537
|
latencyCandidateMs?: number;
|
|
439
538
|
/**
|
|
440
|
-
* alpha — probe-row class (migration 029
|
|
441
|
-
* pre-029 row shape: candidate ran, columns
|
|
442
|
-
* and `'skipped_slow_tier_sync'` are
|
|
443
|
-
*
|
|
444
|
-
*
|
|
539
|
+
* alpha — probe-row class (migration 029; `candidate_error` added by 032).
|
|
540
|
+
* Defaults to `'completed'` (the pre-029 row shape: candidate ran, columns
|
|
541
|
+
* populated). `'aborted_latency_budget'` and `'skipped_slow_tier_sync'` are
|
|
542
|
+
* DIAGNOSTIC rows from sync-mode latency protection; `'candidate_error'`
|
|
543
|
+
* (alpha.53) is the failed-candidate diagnostic — the candidate call
|
|
544
|
+
* errored, with the error class + latency-at-death recorded instead of
|
|
545
|
+
* silence (the IC demo-night probe deaths were invisible for ~90 min under
|
|
546
|
+
* the old record-no-row rule). Diagnostic rows carry no candidate response
|
|
547
|
+
* and no verdict — no false quality signal. A verdict rollup MUST filter to
|
|
548
|
+
* `outcome='completed'`.
|
|
549
|
+
*/
|
|
550
|
+
outcome?: 'completed' | 'aborted_latency_budget' | 'skipped_slow_tier_sync' | 'candidate_error';
|
|
551
|
+
/**
|
|
552
|
+
* alpha.53 (migration 032) — error class for `outcome='candidate_error'`
|
|
553
|
+
* rows. Values follow execute()'s taxonomy (`rate_limit`, `timeout`,
|
|
554
|
+
* `server_error`, `model_not_found`, `auth`, `invalid_request`, `unknown`)
|
|
555
|
+
* plus `execute_rejected` (the execute promise rejected outright). NULL /
|
|
556
|
+
* omitted on all other row classes.
|
|
445
557
|
*/
|
|
446
|
-
|
|
558
|
+
errorClass?: string;
|
|
447
559
|
}
|
|
448
560
|
/**
|
|
449
561
|
* Pure builder for the `probe_outcomes` row written by the inline shadow-probe.
|
|
@@ -475,7 +587,8 @@ declare function buildShadowProbeRow(input: ShadowProbeRecordInput): {
|
|
|
475
587
|
latency_candidate_ms: number | null;
|
|
476
588
|
prompt_fidelity: number;
|
|
477
589
|
replay_source: 'inline-full-ir';
|
|
478
|
-
outcome: 'completed' | 'aborted_latency_budget' | 'skipped_slow_tier_sync';
|
|
590
|
+
outcome: 'completed' | 'aborted_latency_budget' | 'skipped_slow_tier_sync' | 'candidate_error';
|
|
591
|
+
error_class: string | null;
|
|
479
592
|
};
|
|
480
593
|
/**
|
|
481
594
|
* Persist one inline shadow-probe row to `probe_outcomes`. Fire-and-forget by
|
|
@@ -2272,4 +2385,4 @@ declare function markPromoteReadyHandled(opts: MarkPromoteReadyHandledOptions):
|
|
|
2272
2385
|
*/
|
|
2273
2386
|
declare function compile(ir: PromptIR, opts?: CompileOptions): CompileResult;
|
|
2274
2387
|
|
|
2275
|
-
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 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, 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, 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 };
|
|
2388
|
+
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, 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 };
|