@warmdrift/kgauto-compiler 2.0.0-alpha.20 → 2.0.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/glassbox/index.d.mts +3 -3
- package/dist/glassbox/index.d.ts +3 -3
- package/dist/glassbox-routes/index.d.mts +2 -2
- package/dist/glassbox-routes/index.d.ts +2 -2
- package/dist/index.d.mts +119 -7
- package/dist/index.d.ts +119 -7
- package/dist/index.js +235 -70
- package/dist/index.mjs +228 -70
- package/dist/{ir-DTMbSnyE.d.mts → ir-CruZBtpK.d.mts} +56 -1
- package/dist/{ir-CsTU4cMB.d.ts → ir-Wr5lc8Mi.d.ts} +56 -1
- package/dist/profiles.d.mts +1 -1
- package/dist/profiles.d.ts +1 -1
- package/dist/{types-CwtaDaWN.d.ts → types-BiZKJU41.d.ts} +1 -1
- package/dist/{types-BYj1Kl2m.d.mts → types-zk238uNL.d.mts} +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { G as GlassboxEvent } from '../types-
|
|
2
|
-
export { A as AdvisoryFiredData, C as CompileDoneData, a as CompileStartData, E as ExecuteAttemptData, b as ExecuteSuccessData, F as FallbackWalkedData, c as GLASSBOX_STREAM_TTL_MS, d as GlassboxEventKind, e as GlassboxPubSub } from '../types-
|
|
3
|
-
import '../ir-
|
|
1
|
+
import { G as GlassboxEvent } from '../types-zk238uNL.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-zk238uNL.mjs';
|
|
3
|
+
import '../ir-CruZBtpK.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-BiZKJU41.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-BiZKJU41.js';
|
|
3
|
+
import '../ir-Wr5lc8Mi.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, R as RecordInput, e as RecordOutcomeInput, O as OutcomeResult, f as OracleScore, g as CompileResult, B as BestPracticeAdvisory, h as Provider } from './ir-
|
|
2
|
-
export {
|
|
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, R as RecordInput, e as RecordOutcomeInput, O as OutcomeResult, f as OracleScore, g as CompileResult, B as BestPracticeAdvisory, h as Provider, i as ChainEntry, G as Grounding } from './ir-CruZBtpK.mjs';
|
|
2
|
+
export { j as CallAttempt, k as CallError, l as ChainWithGrounding, m as Constraints, F as FallbackReason, H as HistoryCachePolicy, I as IntentDeclaration, M as Message, n as MutationApplied, o as NormalizedTokens, p as OutcomeKind, q as PromptSection, T as ToolCall, r as ToolDefinition } from './ir-CruZBtpK.mjs';
|
|
3
3
|
import { ModelProfile } from './profiles.mjs';
|
|
4
4
|
export { ALIASES, CacheStrategy, CliffRule, LoweringSpec, RecoveryRule, StructuredOutputCapability, SystemPromptMode, allProfiles, getProfile, profilesByProvider, tryGetProfile } from './profiles.mjs';
|
|
5
5
|
import { IntentArchetypeName } from './dialect.mjs';
|
|
@@ -516,6 +516,17 @@ interface GetDefaultFallbackChainOpts {
|
|
|
516
516
|
*/
|
|
517
517
|
toolOrchestration?: 'parallel' | 'sequential' | 'either';
|
|
518
518
|
}
|
|
519
|
+
/**
|
|
520
|
+
* Returns the fallback chain for an archetype as a plain `string[]` of
|
|
521
|
+
* model ids.
|
|
522
|
+
*
|
|
523
|
+
* @deprecated since alpha.21 — prefer
|
|
524
|
+
* {@link getDefaultFallbackChainWithGrounding}, which returns the same chain
|
|
525
|
+
* shape with a `grounding` label on every entry (measured / capability-fact /
|
|
526
|
+
* judgment). The string[] return is preserved indefinitely for back-compat —
|
|
527
|
+
* no functional change in alpha.21. Existing callers don't need to migrate
|
|
528
|
+
* unless they want to surface the grounding gap to users.
|
|
529
|
+
*/
|
|
519
530
|
declare function getDefaultFallbackChain(opts: GetDefaultFallbackChainOpts): string[];
|
|
520
531
|
/**
|
|
521
532
|
* Returns a shallow copy of the hand-curated starter chain for an archetype.
|
|
@@ -527,6 +538,50 @@ declare function getStarterChain(archetype: IntentArchetypeName): string[];
|
|
|
527
538
|
* Useful for the `digest.mjs` readout and consumer audits.
|
|
528
539
|
*/
|
|
529
540
|
declare function getAllStarterChains(): Record<IntentArchetypeName, string[]>;
|
|
541
|
+
/**
|
|
542
|
+
* alpha.20 E3 introspection — returns the sequential-mode overlay for an
|
|
543
|
+
* archetype, or `undefined` when no overlay is registered (the archetype
|
|
544
|
+
* is mode-agnostic and reuses `STARTER_CHAINS[archetype]`).
|
|
545
|
+
*
|
|
546
|
+
* Useful for tests + the `scripts/digest.mjs` operator readout to surface
|
|
547
|
+
* the mode-aware chains.
|
|
548
|
+
*/
|
|
549
|
+
declare function getSequentialStarterChain(archetype: IntentArchetypeName): string[] | undefined;
|
|
550
|
+
/**
|
|
551
|
+
* alpha.21 (s78 Entry 1) — returns the fallback chain as `ChainEntry[]`,
|
|
552
|
+
* with a `grounding` label on every position.
|
|
553
|
+
*
|
|
554
|
+
* Same selection logic as {@link getDefaultFallbackChain} (primary anchoring,
|
|
555
|
+
* blockedModels filter, dedupe, reachability filter, maxDepth cap) — the
|
|
556
|
+
* only difference is the return shape: each position is a `ChainEntry`
|
|
557
|
+
* carrying `{ id, grounding, reason?, n? }` instead of a bare string.
|
|
558
|
+
*
|
|
559
|
+
* Use this when surfacing the chain to consumers who care WHY each entry
|
|
560
|
+
* sits where it sits — Glass-Box panels, operator dashboards, eval
|
|
561
|
+
* scaffolding deciding which entries deserve measurement priority.
|
|
562
|
+
*
|
|
563
|
+
* Returns `[]` when filtering empties the chain (same semantics as the
|
|
564
|
+
* string variant) — consumer decides what to do.
|
|
565
|
+
*/
|
|
566
|
+
declare function getDefaultFallbackChainWithGrounding(opts: GetDefaultFallbackChainOpts): ChainEntry[];
|
|
567
|
+
/**
|
|
568
|
+
* alpha.21 introspection — returns the grounded starter chain for an
|
|
569
|
+
* archetype (no primary anchoring, no policy filtering, no maxDepth cap).
|
|
570
|
+
* Use this when you want the raw, hand-curated grounded chain — every
|
|
571
|
+
* entry carries a `grounding` label and optional reason/n.
|
|
572
|
+
*/
|
|
573
|
+
declare function getStarterChainWithGrounding(archetype: IntentArchetypeName): ChainEntry[];
|
|
574
|
+
/**
|
|
575
|
+
* alpha.21 introspection — all grounded starter chains keyed by archetype.
|
|
576
|
+
* Useful for the `digest.mjs` readout and consumer audits that want to
|
|
577
|
+
* surface the grounding gap across the entire chain table.
|
|
578
|
+
*/
|
|
579
|
+
declare function getAllStarterChainsWithGrounding(): Record<IntentArchetypeName, ChainEntry[]>;
|
|
580
|
+
/**
|
|
581
|
+
* alpha.21 introspection — sequential-mode overlay with grounding labels,
|
|
582
|
+
* or `undefined` when no overlay is registered for the archetype.
|
|
583
|
+
*/
|
|
584
|
+
declare function getSequentialStarterChainWithGrounding(archetype: IntentArchetypeName): ChainEntry[] | undefined;
|
|
530
585
|
|
|
531
586
|
/**
|
|
532
587
|
* chains-brain — alpha.11 KG-11 adapter.
|
|
@@ -563,6 +618,13 @@ declare const loadChainsFromBrain: () => Record<"ask" | "hunt" | "classify" | "s
|
|
|
563
618
|
*/
|
|
564
619
|
|
|
565
620
|
type ArchetypePerfMap = Map<string, Partial<Record<IntentArchetypeName, number>>>;
|
|
621
|
+
/**
|
|
622
|
+
* alpha.21: per-(model, archetype) row count map. Same shape as
|
|
623
|
+
* ArchetypePerfMap but stores brain row counts when the brain backs a
|
|
624
|
+
* placement. Undefined entries → no row count seen → score is the
|
|
625
|
+
* hand-curated cold-start prior (grounding='judgment').
|
|
626
|
+
*/
|
|
627
|
+
type ArchetypePerfNMap = Map<string, Partial<Record<IntentArchetypeName, number>>>;
|
|
566
628
|
/**
|
|
567
629
|
* Sync reader for the brain-driven archetypePerf map. Returns bundled
|
|
568
630
|
* profile.archetypePerf data when brain-query is disabled, cold, or
|
|
@@ -570,11 +632,61 @@ type ArchetypePerfMap = Map<string, Partial<Record<IntentArchetypeName, number>>
|
|
|
570
632
|
*/
|
|
571
633
|
declare const loadArchetypePerfFromBrain: () => ArchetypePerfMap;
|
|
572
634
|
/**
|
|
573
|
-
*
|
|
574
|
-
*
|
|
575
|
-
*
|
|
635
|
+
* alpha.21 — sync reader for the brain row-count map paired with
|
|
636
|
+
* archetype-perf. Returns empty map (no measured backing) on cold start /
|
|
637
|
+
* brain-down / unreachable — all `getArchetypePerfScore` calls then
|
|
638
|
+
* resolve to `grounding: 'judgment'`. When the brain table includes an
|
|
639
|
+
* `n` column on each row, this map mirrors those counts so consumers can
|
|
640
|
+
* see how many measurements back each score.
|
|
641
|
+
*/
|
|
642
|
+
declare const loadArchetypePerfNFromBrain: () => ArchetypePerfNMap;
|
|
643
|
+
/**
|
|
644
|
+
* Threshold above which a brain row count counts as 'measured' grounding.
|
|
645
|
+
* Below this, the score is treated as 'judgment' (cold-start prior or
|
|
646
|
+
* not-yet-enough-evidence). Mirrors the alpha.20 `getCleanPerfScore`
|
|
647
|
+
* `minRows` default — same rule for consistency.
|
|
648
|
+
*/
|
|
649
|
+
declare const MEASURED_GROUNDING_MIN_N = 10;
|
|
650
|
+
/**
|
|
651
|
+
* alpha.21 — return shape for the extended {@link getArchetypePerfScore}.
|
|
652
|
+
* Wraps the existing 0..10 score with:
|
|
653
|
+
*
|
|
654
|
+
* - `n`: brain row count backing this score (0 when no measurement).
|
|
655
|
+
* - `grounding`: derived label — 'measured' when n >= 10, else 'judgment'.
|
|
656
|
+
*
|
|
657
|
+
* The score itself is unchanged from pre-alpha.21 (numeric, 5 = neutral
|
|
658
|
+
* default). 'capability-fact' is NOT a perf-score grounding — capability
|
|
659
|
+
* decisions live on chain entries, not on perf scores.
|
|
660
|
+
*/
|
|
661
|
+
interface ArchetypePerfScoreResult {
|
|
662
|
+
/** 0..10 perf score. 5 = neutral default when no entry exists. */
|
|
663
|
+
score: number;
|
|
664
|
+
/**
|
|
665
|
+
* Brain row count backing this score. 0 when bundled (cold-start prior)
|
|
666
|
+
* or when the brain row didn't carry an `n` column.
|
|
667
|
+
*/
|
|
668
|
+
n: number;
|
|
669
|
+
/**
|
|
670
|
+
* Provenance — 'measured' when `n >= 10`, else 'judgment'.
|
|
671
|
+
* Never 'capability-fact' (that label is reserved for chain-entry
|
|
672
|
+
* inclusion/exclusion decisions).
|
|
673
|
+
*/
|
|
674
|
+
grounding: Grounding;
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* Per-model accessor with grounding (alpha.21). Returns 5 (neutral) when no
|
|
678
|
+
* entry is found — consistent with the master plan §3.3 "missing archetypes
|
|
679
|
+
* default to 5" convention documented in profiles.ts
|
|
680
|
+
* ModelProfile.archetypePerf.
|
|
681
|
+
*
|
|
682
|
+
* Backwards-compat note: pre-alpha.21 callers expected `number` here. The
|
|
683
|
+
* new return shape `{ score, n, grounding }` is a breaking shape change at
|
|
684
|
+
* the type level, but `.score` carries the legacy value. Callers reading
|
|
685
|
+
* `.score` field-by-field continue working; callers using the bare number
|
|
686
|
+
* arithmetically need to switch to `.score`. The migration is single-line
|
|
687
|
+
* (`const x = getArchetypePerfScore(...)` → `const x = getArchetypePerfScore(...).score`).
|
|
576
688
|
*/
|
|
577
|
-
declare function getArchetypePerfScore(modelId: string, archetype: IntentArchetypeName):
|
|
689
|
+
declare function getArchetypePerfScore(modelId: string, archetype: IntentArchetypeName): ArchetypePerfScoreResult;
|
|
578
690
|
|
|
579
691
|
/**
|
|
580
692
|
* pricing-brain — alpha.11 KG-13 adapter.
|
|
@@ -758,4 +870,4 @@ declare const loadAliasesFromBrain: () => Record<string, string>;
|
|
|
758
870
|
*/
|
|
759
871
|
declare function compile(ir: PromptIR, opts?: CompileOptions): CompileResult;
|
|
760
872
|
|
|
761
|
-
export { ApiKeys, type AppOracle, type ArchetypePerfMap, BestPracticeAdvisory, type BrainConfig, type BrainQueryConfig, CallOptions, CallResult, type CompileOptions, CompilePolicy, CompileResult, CompiledRequest, type ExecuteErr, type ExecuteOk, type ExecuteOptions, type ExecuteResult, type FallbackPosture, type GetDefaultFallbackChainOpts, IntentArchetypeName, type LLMJudgeOptions, type ModelBrainRow, ModelProfile, NormalizedResponse, type OracleContext, OracleScore, type OutcomePayload, OutcomeResult, PROVIDER_ENV_KEYS, type PricingRow, type ProfileToRowOptions, PromptIR, Provider, ProviderOverrides, type ProviderReachability, type ReachabilityOpts, RecordInput, RecordOutcomeInput, type SupportedProvider, buildLLMJudge, call, clearBrain, compile, configureBrain, countTokens, execute, getAllStarterChains, getArchetypePerfScore, getDefaultFallbackChain, getReachabilityDiagnostic, getStarterChain, isModelReachable, isProviderReachable, loadAliasesFromBrain, loadArchetypePerfFromBrain, loadChainsFromBrain, loadModelsFromBrain, loadPricingFromBrain, profileToRow, record, recordOutcome, resetTokenizer, resolvePricingAt, resolveProviderKey, runAdvisor, setTokenizer };
|
|
873
|
+
export { ApiKeys, type AppOracle, type ArchetypePerfMap, type ArchetypePerfNMap, type ArchetypePerfScoreResult, BestPracticeAdvisory, type BrainConfig, type BrainQueryConfig, CallOptions, CallResult, ChainEntry, type CompileOptions, CompilePolicy, CompileResult, CompiledRequest, type ExecuteErr, type ExecuteOk, type ExecuteOptions, type ExecuteResult, type FallbackPosture, type GetDefaultFallbackChainOpts, Grounding, IntentArchetypeName, type LLMJudgeOptions, MEASURED_GROUNDING_MIN_N, type ModelBrainRow, ModelProfile, NormalizedResponse, type OracleContext, OracleScore, type OutcomePayload, OutcomeResult, PROVIDER_ENV_KEYS, type PricingRow, type ProfileToRowOptions, PromptIR, Provider, ProviderOverrides, type ProviderReachability, type ReachabilityOpts, RecordInput, RecordOutcomeInput, type SupportedProvider, buildLLMJudge, call, clearBrain, compile, configureBrain, countTokens, execute, getAllStarterChains, getAllStarterChainsWithGrounding, getArchetypePerfScore, getDefaultFallbackChain, getDefaultFallbackChainWithGrounding, getReachabilityDiagnostic, getSequentialStarterChain, getSequentialStarterChainWithGrounding, getStarterChain, getStarterChainWithGrounding, isModelReachable, isProviderReachable, loadAliasesFromBrain, loadArchetypePerfFromBrain, loadArchetypePerfNFromBrain, loadChainsFromBrain, loadModelsFromBrain, loadPricingFromBrain, profileToRow, record, recordOutcome, resetTokenizer, resolvePricingAt, resolveProviderKey, runAdvisor, setTokenizer };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CompilePolicy, N as NormalizedResponse, A as ApiKeys, P as ProviderOverrides, a as CompiledRequest, b as PromptIR, c as CallOptions, d as CallResult, R as RecordInput, e as RecordOutcomeInput, O as OutcomeResult, f as OracleScore, g as CompileResult, B as BestPracticeAdvisory, h as Provider } from './ir-
|
|
2
|
-
export {
|
|
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, R as RecordInput, e as RecordOutcomeInput, O as OutcomeResult, f as OracleScore, g as CompileResult, B as BestPracticeAdvisory, h as Provider, i as ChainEntry, G as Grounding } from './ir-Wr5lc8Mi.js';
|
|
2
|
+
export { j as CallAttempt, k as CallError, l as ChainWithGrounding, m as Constraints, F as FallbackReason, H as HistoryCachePolicy, I as IntentDeclaration, M as Message, n as MutationApplied, o as NormalizedTokens, p as OutcomeKind, q as PromptSection, T as ToolCall, r as ToolDefinition } from './ir-Wr5lc8Mi.js';
|
|
3
3
|
import { ModelProfile } from './profiles.js';
|
|
4
4
|
export { ALIASES, CacheStrategy, CliffRule, LoweringSpec, RecoveryRule, StructuredOutputCapability, SystemPromptMode, allProfiles, getProfile, profilesByProvider, tryGetProfile } from './profiles.js';
|
|
5
5
|
import { IntentArchetypeName } from './dialect.js';
|
|
@@ -516,6 +516,17 @@ interface GetDefaultFallbackChainOpts {
|
|
|
516
516
|
*/
|
|
517
517
|
toolOrchestration?: 'parallel' | 'sequential' | 'either';
|
|
518
518
|
}
|
|
519
|
+
/**
|
|
520
|
+
* Returns the fallback chain for an archetype as a plain `string[]` of
|
|
521
|
+
* model ids.
|
|
522
|
+
*
|
|
523
|
+
* @deprecated since alpha.21 — prefer
|
|
524
|
+
* {@link getDefaultFallbackChainWithGrounding}, which returns the same chain
|
|
525
|
+
* shape with a `grounding` label on every entry (measured / capability-fact /
|
|
526
|
+
* judgment). The string[] return is preserved indefinitely for back-compat —
|
|
527
|
+
* no functional change in alpha.21. Existing callers don't need to migrate
|
|
528
|
+
* unless they want to surface the grounding gap to users.
|
|
529
|
+
*/
|
|
519
530
|
declare function getDefaultFallbackChain(opts: GetDefaultFallbackChainOpts): string[];
|
|
520
531
|
/**
|
|
521
532
|
* Returns a shallow copy of the hand-curated starter chain for an archetype.
|
|
@@ -527,6 +538,50 @@ declare function getStarterChain(archetype: IntentArchetypeName): string[];
|
|
|
527
538
|
* Useful for the `digest.mjs` readout and consumer audits.
|
|
528
539
|
*/
|
|
529
540
|
declare function getAllStarterChains(): Record<IntentArchetypeName, string[]>;
|
|
541
|
+
/**
|
|
542
|
+
* alpha.20 E3 introspection — returns the sequential-mode overlay for an
|
|
543
|
+
* archetype, or `undefined` when no overlay is registered (the archetype
|
|
544
|
+
* is mode-agnostic and reuses `STARTER_CHAINS[archetype]`).
|
|
545
|
+
*
|
|
546
|
+
* Useful for tests + the `scripts/digest.mjs` operator readout to surface
|
|
547
|
+
* the mode-aware chains.
|
|
548
|
+
*/
|
|
549
|
+
declare function getSequentialStarterChain(archetype: IntentArchetypeName): string[] | undefined;
|
|
550
|
+
/**
|
|
551
|
+
* alpha.21 (s78 Entry 1) — returns the fallback chain as `ChainEntry[]`,
|
|
552
|
+
* with a `grounding` label on every position.
|
|
553
|
+
*
|
|
554
|
+
* Same selection logic as {@link getDefaultFallbackChain} (primary anchoring,
|
|
555
|
+
* blockedModels filter, dedupe, reachability filter, maxDepth cap) — the
|
|
556
|
+
* only difference is the return shape: each position is a `ChainEntry`
|
|
557
|
+
* carrying `{ id, grounding, reason?, n? }` instead of a bare string.
|
|
558
|
+
*
|
|
559
|
+
* Use this when surfacing the chain to consumers who care WHY each entry
|
|
560
|
+
* sits where it sits — Glass-Box panels, operator dashboards, eval
|
|
561
|
+
* scaffolding deciding which entries deserve measurement priority.
|
|
562
|
+
*
|
|
563
|
+
* Returns `[]` when filtering empties the chain (same semantics as the
|
|
564
|
+
* string variant) — consumer decides what to do.
|
|
565
|
+
*/
|
|
566
|
+
declare function getDefaultFallbackChainWithGrounding(opts: GetDefaultFallbackChainOpts): ChainEntry[];
|
|
567
|
+
/**
|
|
568
|
+
* alpha.21 introspection — returns the grounded starter chain for an
|
|
569
|
+
* archetype (no primary anchoring, no policy filtering, no maxDepth cap).
|
|
570
|
+
* Use this when you want the raw, hand-curated grounded chain — every
|
|
571
|
+
* entry carries a `grounding` label and optional reason/n.
|
|
572
|
+
*/
|
|
573
|
+
declare function getStarterChainWithGrounding(archetype: IntentArchetypeName): ChainEntry[];
|
|
574
|
+
/**
|
|
575
|
+
* alpha.21 introspection — all grounded starter chains keyed by archetype.
|
|
576
|
+
* Useful for the `digest.mjs` readout and consumer audits that want to
|
|
577
|
+
* surface the grounding gap across the entire chain table.
|
|
578
|
+
*/
|
|
579
|
+
declare function getAllStarterChainsWithGrounding(): Record<IntentArchetypeName, ChainEntry[]>;
|
|
580
|
+
/**
|
|
581
|
+
* alpha.21 introspection — sequential-mode overlay with grounding labels,
|
|
582
|
+
* or `undefined` when no overlay is registered for the archetype.
|
|
583
|
+
*/
|
|
584
|
+
declare function getSequentialStarterChainWithGrounding(archetype: IntentArchetypeName): ChainEntry[] | undefined;
|
|
530
585
|
|
|
531
586
|
/**
|
|
532
587
|
* chains-brain — alpha.11 KG-11 adapter.
|
|
@@ -563,6 +618,13 @@ declare const loadChainsFromBrain: () => Record<"ask" | "hunt" | "classify" | "s
|
|
|
563
618
|
*/
|
|
564
619
|
|
|
565
620
|
type ArchetypePerfMap = Map<string, Partial<Record<IntentArchetypeName, number>>>;
|
|
621
|
+
/**
|
|
622
|
+
* alpha.21: per-(model, archetype) row count map. Same shape as
|
|
623
|
+
* ArchetypePerfMap but stores brain row counts when the brain backs a
|
|
624
|
+
* placement. Undefined entries → no row count seen → score is the
|
|
625
|
+
* hand-curated cold-start prior (grounding='judgment').
|
|
626
|
+
*/
|
|
627
|
+
type ArchetypePerfNMap = Map<string, Partial<Record<IntentArchetypeName, number>>>;
|
|
566
628
|
/**
|
|
567
629
|
* Sync reader for the brain-driven archetypePerf map. Returns bundled
|
|
568
630
|
* profile.archetypePerf data when brain-query is disabled, cold, or
|
|
@@ -570,11 +632,61 @@ type ArchetypePerfMap = Map<string, Partial<Record<IntentArchetypeName, number>>
|
|
|
570
632
|
*/
|
|
571
633
|
declare const loadArchetypePerfFromBrain: () => ArchetypePerfMap;
|
|
572
634
|
/**
|
|
573
|
-
*
|
|
574
|
-
*
|
|
575
|
-
*
|
|
635
|
+
* alpha.21 — sync reader for the brain row-count map paired with
|
|
636
|
+
* archetype-perf. Returns empty map (no measured backing) on cold start /
|
|
637
|
+
* brain-down / unreachable — all `getArchetypePerfScore` calls then
|
|
638
|
+
* resolve to `grounding: 'judgment'`. When the brain table includes an
|
|
639
|
+
* `n` column on each row, this map mirrors those counts so consumers can
|
|
640
|
+
* see how many measurements back each score.
|
|
641
|
+
*/
|
|
642
|
+
declare const loadArchetypePerfNFromBrain: () => ArchetypePerfNMap;
|
|
643
|
+
/**
|
|
644
|
+
* Threshold above which a brain row count counts as 'measured' grounding.
|
|
645
|
+
* Below this, the score is treated as 'judgment' (cold-start prior or
|
|
646
|
+
* not-yet-enough-evidence). Mirrors the alpha.20 `getCleanPerfScore`
|
|
647
|
+
* `minRows` default — same rule for consistency.
|
|
648
|
+
*/
|
|
649
|
+
declare const MEASURED_GROUNDING_MIN_N = 10;
|
|
650
|
+
/**
|
|
651
|
+
* alpha.21 — return shape for the extended {@link getArchetypePerfScore}.
|
|
652
|
+
* Wraps the existing 0..10 score with:
|
|
653
|
+
*
|
|
654
|
+
* - `n`: brain row count backing this score (0 when no measurement).
|
|
655
|
+
* - `grounding`: derived label — 'measured' when n >= 10, else 'judgment'.
|
|
656
|
+
*
|
|
657
|
+
* The score itself is unchanged from pre-alpha.21 (numeric, 5 = neutral
|
|
658
|
+
* default). 'capability-fact' is NOT a perf-score grounding — capability
|
|
659
|
+
* decisions live on chain entries, not on perf scores.
|
|
660
|
+
*/
|
|
661
|
+
interface ArchetypePerfScoreResult {
|
|
662
|
+
/** 0..10 perf score. 5 = neutral default when no entry exists. */
|
|
663
|
+
score: number;
|
|
664
|
+
/**
|
|
665
|
+
* Brain row count backing this score. 0 when bundled (cold-start prior)
|
|
666
|
+
* or when the brain row didn't carry an `n` column.
|
|
667
|
+
*/
|
|
668
|
+
n: number;
|
|
669
|
+
/**
|
|
670
|
+
* Provenance — 'measured' when `n >= 10`, else 'judgment'.
|
|
671
|
+
* Never 'capability-fact' (that label is reserved for chain-entry
|
|
672
|
+
* inclusion/exclusion decisions).
|
|
673
|
+
*/
|
|
674
|
+
grounding: Grounding;
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* Per-model accessor with grounding (alpha.21). Returns 5 (neutral) when no
|
|
678
|
+
* entry is found — consistent with the master plan §3.3 "missing archetypes
|
|
679
|
+
* default to 5" convention documented in profiles.ts
|
|
680
|
+
* ModelProfile.archetypePerf.
|
|
681
|
+
*
|
|
682
|
+
* Backwards-compat note: pre-alpha.21 callers expected `number` here. The
|
|
683
|
+
* new return shape `{ score, n, grounding }` is a breaking shape change at
|
|
684
|
+
* the type level, but `.score` carries the legacy value. Callers reading
|
|
685
|
+
* `.score` field-by-field continue working; callers using the bare number
|
|
686
|
+
* arithmetically need to switch to `.score`. The migration is single-line
|
|
687
|
+
* (`const x = getArchetypePerfScore(...)` → `const x = getArchetypePerfScore(...).score`).
|
|
576
688
|
*/
|
|
577
|
-
declare function getArchetypePerfScore(modelId: string, archetype: IntentArchetypeName):
|
|
689
|
+
declare function getArchetypePerfScore(modelId: string, archetype: IntentArchetypeName): ArchetypePerfScoreResult;
|
|
578
690
|
|
|
579
691
|
/**
|
|
580
692
|
* pricing-brain — alpha.11 KG-13 adapter.
|
|
@@ -758,4 +870,4 @@ declare const loadAliasesFromBrain: () => Record<string, string>;
|
|
|
758
870
|
*/
|
|
759
871
|
declare function compile(ir: PromptIR, opts?: CompileOptions): CompileResult;
|
|
760
872
|
|
|
761
|
-
export { ApiKeys, type AppOracle, type ArchetypePerfMap, BestPracticeAdvisory, type BrainConfig, type BrainQueryConfig, CallOptions, CallResult, type CompileOptions, CompilePolicy, CompileResult, CompiledRequest, type ExecuteErr, type ExecuteOk, type ExecuteOptions, type ExecuteResult, type FallbackPosture, type GetDefaultFallbackChainOpts, IntentArchetypeName, type LLMJudgeOptions, type ModelBrainRow, ModelProfile, NormalizedResponse, type OracleContext, OracleScore, type OutcomePayload, OutcomeResult, PROVIDER_ENV_KEYS, type PricingRow, type ProfileToRowOptions, PromptIR, Provider, ProviderOverrides, type ProviderReachability, type ReachabilityOpts, RecordInput, RecordOutcomeInput, type SupportedProvider, buildLLMJudge, call, clearBrain, compile, configureBrain, countTokens, execute, getAllStarterChains, getArchetypePerfScore, getDefaultFallbackChain, getReachabilityDiagnostic, getStarterChain, isModelReachable, isProviderReachable, loadAliasesFromBrain, loadArchetypePerfFromBrain, loadChainsFromBrain, loadModelsFromBrain, loadPricingFromBrain, profileToRow, record, recordOutcome, resetTokenizer, resolvePricingAt, resolveProviderKey, runAdvisor, setTokenizer };
|
|
873
|
+
export { ApiKeys, type AppOracle, type ArchetypePerfMap, type ArchetypePerfNMap, type ArchetypePerfScoreResult, BestPracticeAdvisory, type BrainConfig, type BrainQueryConfig, CallOptions, CallResult, ChainEntry, type CompileOptions, CompilePolicy, CompileResult, CompiledRequest, type ExecuteErr, type ExecuteOk, type ExecuteOptions, type ExecuteResult, type FallbackPosture, type GetDefaultFallbackChainOpts, Grounding, IntentArchetypeName, type LLMJudgeOptions, MEASURED_GROUNDING_MIN_N, type ModelBrainRow, ModelProfile, NormalizedResponse, type OracleContext, OracleScore, type OutcomePayload, OutcomeResult, PROVIDER_ENV_KEYS, type PricingRow, type ProfileToRowOptions, PromptIR, Provider, ProviderOverrides, type ProviderReachability, type ReachabilityOpts, RecordInput, RecordOutcomeInput, type SupportedProvider, buildLLMJudge, call, clearBrain, compile, configureBrain, countTokens, execute, getAllStarterChains, getAllStarterChainsWithGrounding, getArchetypePerfScore, getDefaultFallbackChain, getDefaultFallbackChainWithGrounding, getReachabilityDiagnostic, getSequentialStarterChain, getSequentialStarterChainWithGrounding, getStarterChain, getStarterChainWithGrounding, isModelReachable, isProviderReachable, loadAliasesFromBrain, loadArchetypePerfFromBrain, loadArchetypePerfNFromBrain, loadChainsFromBrain, loadModelsFromBrain, loadPricingFromBrain, profileToRow, record, recordOutcome, resetTokenizer, resolvePricingAt, resolveProviderKey, runAdvisor, setTokenizer };
|