@warmdrift/kgauto-compiler 2.0.0-alpha.42 → 2.0.0-alpha.44

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,6 +1,6 @@
1
1
  import {
2
2
  tryGetProfile
3
- } from "./chunk-JQGRWJZO.mjs";
3
+ } from "./chunk-ZHUD3I52.mjs";
4
4
 
5
5
  // src/brain-query.ts
6
6
  var FRESH_SNAPSHOT = {
@@ -562,7 +562,21 @@ var PROFILES_RAW = [
562
562
  critique: 4,
563
563
  hunt: 4
564
564
  // sequential tool calls only — L-040
565
- }
565
+ },
566
+ // alpha.43 — family-level conventions for the `deepseek-chat` family
567
+ // (V4-Flash + future non-thinking-mode members). V4-Flash struggles
568
+ // with summarize-archetype + structured-output: 3 of 4 schema-attempted
569
+ // PB calls (2026-05-18 + 2026-05-22) hit `structured_output_parse_failed`.
570
+ // Surface the friction at compile time so consumers either drop the
571
+ // schema or route to a more schema-reliable family.
572
+ archetypeConventions: [
573
+ {
574
+ archetype: "summarize",
575
+ structuredOutputHint: "avoid",
576
+ cliffWarning: "deepseek-chat family schema compliance on summarize is weak (3 of 4 schema-attempted PB calls hit structured_output_parse_failed). Consider routing summarize+structured-output to a different family (claude-sonnet, gemini-pro, openai-gpt-5.4) or dropping the schema for free-text summaries.",
577
+ reason: "Brain evidence: PB compile_outcomes 2026-05-18 + 2026-05-22, error_type=structured_output_parse_failed on deepseek-v4-flash + summarize archetype."
578
+ }
579
+ ]
566
580
  },
567
581
  {
568
582
  id: "deepseek-v4-pro",
@@ -613,7 +627,51 @@ var PROFILES_RAW = [
613
627
  transform: 6,
614
628
  hunt: 4
615
629
  // sequential tools — same as V4-Flash
616
- }
630
+ },
631
+ // alpha.43 — family-level conventions for the `deepseek-reasoner` family
632
+ // (V4-Pro is the family rep; future thinking-mode members inherit).
633
+ //
634
+ // The decisive-archetype suffix is the load-bearing piece: 2026-05-28
635
+ // first real V4-Pro probe on tt-intel/classify (exclusion-finding ID 20)
636
+ // showed 8/10 judge rationales citing "candidate hedges and fails to
637
+ // commit to a single classification" or "candidate refuses to pick
638
+ // among the labels." Without the forcing-function suffix, every
639
+ // reasoner probe on classify/extract/ask verdicts stay-excluded for
640
+ // model-behavior reasons (epistemic humility is reasoner-shaped),
641
+ // NOT quality reasons. The suffix re-shapes the contract so the model
642
+ // is asked for what it's actually being measured on.
643
+ //
644
+ // The hunt-archetype cliffWarning is the L-040 architectural reading
645
+ // surfaced at compile time. Reasoners produce sequential reasoning
646
+ // chains by design; hunt archetypes with 3+ parallel tools lose
647
+ // substantial throughput (L-040 + L-041). The L-040 cliff in the
648
+ // `cliffs` array already trims to top-relevant tools; this warning
649
+ // tells the consumer the family is wrong for the shape so they can
650
+ // route to gemini-flash (parallel-strong) instead of accepting trimmed
651
+ // throughput silently.
652
+ archetypeConventions: [
653
+ {
654
+ archetype: "classify",
655
+ promptSuffix: "\n\nOutput exactly one classification label. Do not hedge, do not add preamble, do not explain your reasoning. If uncertain, pick the most likely label and commit to it.",
656
+ reason: "Reasoners (deepseek-reasoner family) hedge on decisive-output archetypes by design. Evidence: 2026-05-28 V4-Pro probe on tt-intel/classify (exclusion-finding ID 20, brain probe_outcomes); 8 of 10 judge rationales cited hedging or refusal-to-commit. Forcing-function suffix converts reasoner output to decisive labels."
657
+ },
658
+ {
659
+ archetype: "extract",
660
+ promptSuffix: "\n\nOutput exactly the requested structured fields. Do not hedge, do not add preamble, do not explain your reasoning. If a field is unknown, emit the field with a null/empty value and commit to that \u2014 do not refuse to extract.",
661
+ reason: "Reasoners (deepseek-reasoner family) hedge on decisive-output archetypes by design. Evidence: same family failure shape as classify (exclusion-finding ID 20, 2026-05-28). Forcing-function suffix asks for commitment instead of epistemic-humility hedging."
662
+ },
663
+ {
664
+ archetype: "ask",
665
+ promptSuffix: "\n\nAnswer the question directly. Do not hedge, do not add preamble, do not explain your reasoning unless explicitly asked. If uncertain, give your best answer and commit to it.",
666
+ reason: "Reasoners (deepseek-reasoner family) hedge on decisive-output archetypes by design. Evidence: same family failure shape as classify (exclusion-finding ID 20, 2026-05-28). Forcing-function suffix asks for commitment instead of epistemic-humility hedging."
667
+ },
668
+ {
669
+ archetype: "hunt",
670
+ whenToolCountAtLeast: 3,
671
+ cliffWarning: "Reasoners (deepseek-reasoner family) produce sequential reasoning chains by design; hunt archetypes with 3+ parallel tools lose substantial throughput. Consider gemini-flash family (parallel-strong) instead \u2014 see L-040 / L-041.",
672
+ reason: "L-040 + L-041 architectural reading; 2026-05-28 V4-Pro probe evidence (exclusion-finding ID 20) confirms reasoner-family hunt fit is structurally weak."
673
+ }
674
+ ]
617
675
  },
618
676
  // ── OpenAI ──
619
677
  // alpha.16 (2026-05-17): close the half-supported provider gap. env.ts
@@ -1,6 +1,6 @@
1
- import { G as GlassboxEvent } from '../types-eKKDeADI.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-eKKDeADI.mjs';
3
- import '../ir-BG70lg9b.mjs';
1
+ import { G as GlassboxEvent } from '../types-B5DzMhYm.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-B5DzMhYm.mjs';
3
+ import '../ir-DARjQnvZ.mjs';
4
4
  import '../dialect.mjs';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { G as GlassboxEvent } from '../types-Cs_hsBGm.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-Cs_hsBGm.js';
3
- import '../ir-BmumS1Du.js';
1
+ import { G as GlassboxEvent } from '../types-BDqNQxuX.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-BDqNQxuX.js';
3
+ import '../ir-DAUBaPhd.js';
4
4
  import '../dialect.js';
5
5
 
6
6
  /**
@@ -1,5 +1,5 @@
1
- import { T as TraceHealth } from '../types-DIl0tCDX.mjs';
2
- import '../ir-BG70lg9b.mjs';
1
+ import { T as TraceHealth } from '../types-Rq_fywDq.mjs';
2
+ import '../ir-DARjQnvZ.mjs';
3
3
  import '../dialect.mjs';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { T as TraceHealth } from '../types-kFsIDC_5.js';
2
- import '../ir-BmumS1Du.js';
1
+ import { T as TraceHealth } from '../types-CfVyRbCl.js';
2
+ import '../ir-DAUBaPhd.js';
3
3
  import '../dialect.js';
4
4
 
5
5
  /**
@@ -1,7 +1,7 @@
1
- import { G as GlassboxEvent } from '../types-eKKDeADI.mjs';
2
- import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-DIl0tCDX.mjs';
3
- export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-DIl0tCDX.mjs';
4
- import '../ir-BG70lg9b.mjs';
1
+ import { G as GlassboxEvent } from '../types-B5DzMhYm.mjs';
2
+ import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-Rq_fywDq.mjs';
3
+ export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-Rq_fywDq.mjs';
4
+ import '../ir-DARjQnvZ.mjs';
5
5
  import '../dialect.mjs';
6
6
 
7
7
  /**
@@ -1,7 +1,7 @@
1
- import { G as GlassboxEvent } from '../types-Cs_hsBGm.js';
2
- import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-kFsIDC_5.js';
3
- export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-kFsIDC_5.js';
4
- import '../ir-BmumS1Du.js';
1
+ import { G as GlassboxEvent } from '../types-BDqNQxuX.js';
2
+ import { a as TraceDetail, b as TraceSummary, c as TraceCounterfactual } from '../types-CfVyRbCl.js';
3
+ export { A as AdvisoryRecord, T as TraceHealth, d as TraceSectionRewrite } from '../types-CfVyRbCl.js';
4
+ import '../ir-DAUBaPhd.js';
5
5
  import '../dialect.js';
6
6
 
7
7
  /**
@@ -627,7 +627,21 @@ var PROFILES_RAW = [
627
627
  critique: 4,
628
628
  hunt: 4
629
629
  // sequential tool calls only — L-040
630
- }
630
+ },
631
+ // alpha.43 — family-level conventions for the `deepseek-chat` family
632
+ // (V4-Flash + future non-thinking-mode members). V4-Flash struggles
633
+ // with summarize-archetype + structured-output: 3 of 4 schema-attempted
634
+ // PB calls (2026-05-18 + 2026-05-22) hit `structured_output_parse_failed`.
635
+ // Surface the friction at compile time so consumers either drop the
636
+ // schema or route to a more schema-reliable family.
637
+ archetypeConventions: [
638
+ {
639
+ archetype: "summarize",
640
+ structuredOutputHint: "avoid",
641
+ cliffWarning: "deepseek-chat family schema compliance on summarize is weak (3 of 4 schema-attempted PB calls hit structured_output_parse_failed). Consider routing summarize+structured-output to a different family (claude-sonnet, gemini-pro, openai-gpt-5.4) or dropping the schema for free-text summaries.",
642
+ reason: "Brain evidence: PB compile_outcomes 2026-05-18 + 2026-05-22, error_type=structured_output_parse_failed on deepseek-v4-flash + summarize archetype."
643
+ }
644
+ ]
631
645
  },
632
646
  {
633
647
  id: "deepseek-v4-pro",
@@ -678,7 +692,51 @@ var PROFILES_RAW = [
678
692
  transform: 6,
679
693
  hunt: 4
680
694
  // sequential tools — same as V4-Flash
681
- }
695
+ },
696
+ // alpha.43 — family-level conventions for the `deepseek-reasoner` family
697
+ // (V4-Pro is the family rep; future thinking-mode members inherit).
698
+ //
699
+ // The decisive-archetype suffix is the load-bearing piece: 2026-05-28
700
+ // first real V4-Pro probe on tt-intel/classify (exclusion-finding ID 20)
701
+ // showed 8/10 judge rationales citing "candidate hedges and fails to
702
+ // commit to a single classification" or "candidate refuses to pick
703
+ // among the labels." Without the forcing-function suffix, every
704
+ // reasoner probe on classify/extract/ask verdicts stay-excluded for
705
+ // model-behavior reasons (epistemic humility is reasoner-shaped),
706
+ // NOT quality reasons. The suffix re-shapes the contract so the model
707
+ // is asked for what it's actually being measured on.
708
+ //
709
+ // The hunt-archetype cliffWarning is the L-040 architectural reading
710
+ // surfaced at compile time. Reasoners produce sequential reasoning
711
+ // chains by design; hunt archetypes with 3+ parallel tools lose
712
+ // substantial throughput (L-040 + L-041). The L-040 cliff in the
713
+ // `cliffs` array already trims to top-relevant tools; this warning
714
+ // tells the consumer the family is wrong for the shape so they can
715
+ // route to gemini-flash (parallel-strong) instead of accepting trimmed
716
+ // throughput silently.
717
+ archetypeConventions: [
718
+ {
719
+ archetype: "classify",
720
+ promptSuffix: "\n\nOutput exactly one classification label. Do not hedge, do not add preamble, do not explain your reasoning. If uncertain, pick the most likely label and commit to it.",
721
+ reason: "Reasoners (deepseek-reasoner family) hedge on decisive-output archetypes by design. Evidence: 2026-05-28 V4-Pro probe on tt-intel/classify (exclusion-finding ID 20, brain probe_outcomes); 8 of 10 judge rationales cited hedging or refusal-to-commit. Forcing-function suffix converts reasoner output to decisive labels."
722
+ },
723
+ {
724
+ archetype: "extract",
725
+ promptSuffix: "\n\nOutput exactly the requested structured fields. Do not hedge, do not add preamble, do not explain your reasoning. If a field is unknown, emit the field with a null/empty value and commit to that \u2014 do not refuse to extract.",
726
+ reason: "Reasoners (deepseek-reasoner family) hedge on decisive-output archetypes by design. Evidence: same family failure shape as classify (exclusion-finding ID 20, 2026-05-28). Forcing-function suffix asks for commitment instead of epistemic-humility hedging."
727
+ },
728
+ {
729
+ archetype: "ask",
730
+ promptSuffix: "\n\nAnswer the question directly. Do not hedge, do not add preamble, do not explain your reasoning unless explicitly asked. If uncertain, give your best answer and commit to it.",
731
+ reason: "Reasoners (deepseek-reasoner family) hedge on decisive-output archetypes by design. Evidence: same family failure shape as classify (exclusion-finding ID 20, 2026-05-28). Forcing-function suffix asks for commitment instead of epistemic-humility hedging."
732
+ },
733
+ {
734
+ archetype: "hunt",
735
+ whenToolCountAtLeast: 3,
736
+ cliffWarning: "Reasoners (deepseek-reasoner family) produce sequential reasoning chains by design; hunt archetypes with 3+ parallel tools lose substantial throughput. Consider gemini-flash family (parallel-strong) instead \u2014 see L-040 / L-041.",
737
+ reason: "L-040 + L-041 architectural reading; 2026-05-28 V4-Pro probe evidence (exclusion-finding ID 20) confirms reasoner-family hunt fit is structurally weak."
738
+ }
739
+ ]
682
740
  },
683
741
  // ── OpenAI ──
684
742
  // alpha.16 (2026-05-17): close the half-supported provider gap. env.ts
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  ARCHETYPE_FLOOR_DEFAULT,
3
3
  getDefaultFallbackChain
4
- } from "../chunk-KCNQUMHN.mjs";
4
+ } from "../chunk-6MSJQCAP.mjs";
5
5
  import {
6
6
  tryGetProfile
7
- } from "../chunk-JQGRWJZO.mjs";
7
+ } from "../chunk-ZHUD3I52.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-DIl0tCDX.mjs';
3
- import '../../ir-BG70lg9b.mjs';
2
+ import { a as TraceDetail } from '../../types-Rq_fywDq.mjs';
3
+ import '../../ir-DARjQnvZ.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-kFsIDC_5.js';
3
- import '../../ir-BmumS1Du.js';
2
+ import { a as TraceDetail } from '../../types-CfVyRbCl.js';
3
+ import '../../ir-DAUBaPhd.js';
4
4
  import '../../dialect.js';
5
5
 
6
6
  /**
package/dist/index.d.mts CHANGED
@@ -1,6 +1,6 @@
1
- import { C as CompilePolicy, N as NormalizedResponse, A as ApiKeys, P as ProviderOverrides, a as CompiledRequest, b as PromptIR, c as CallOptions, d as CallResult, S as SystemModelMessage, e as CompileResult, f as SectionRewrite, R as RecordInput, g as RecordOutcomeInput, O as OutcomeResult, h as OracleScore, B as BestPracticeAdvisory, i as Adapter, j as PerAxisMetrics, k as Provider, l as ChainEntry, G as Grounding } from './ir-BG70lg9b.mjs';
2
- export { m as CallAttempt, n as CallError, o as ChainModelEntry, p as ChainWithGrounding, q as Constraints, F as FallbackReason, H as HistoryCachePolicy, I as IntentDeclaration, M as Message, r as MutationApplied, s as NormalizedTokens, t as OutcomeKind, u as PerAxisMetricsByModel, v as PromptSection, w as SectionKind, T as ToolCall, x as ToolDefinition } from './ir-BG70lg9b.mjs';
3
- import { ModelProfile } from './profiles.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, f as SectionRewrite, R as RecordInput, g as RecordOutcomeInput, O as OutcomeResult, h as OracleScore, B as BestPracticeAdvisory, i as Adapter, j as PerAxisMetrics, k as Provider, l as ChainEntry, G as Grounding } from './ir-DARjQnvZ.mjs';
2
+ export { m as CallAttempt, n as CallError, o as ChainModelEntry, p as ChainWithGrounding, q as Constraints, F as FallbackReason, H as HistoryCachePolicy, I as IntentDeclaration, M as Message, r as MutationApplied, s as NormalizedTokens, t as OutcomeKind, u as PerAxisMetricsByModel, v as PromptSection, w as SectionKind, T as ToolCall, x as ToolDefinition } from './ir-DARjQnvZ.mjs';
3
+ import { ModelProfile, ArchetypeConvention } 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';
6
6
  export { ALL_ARCHETYPES, ContextBucket, DIALECT_VERSION, HistoryDepth, INTENT_ARCHETYPES, OutputMode, ShapeSignature, ToolCountBucket, bucketContext, bucketHistory, bucketToolCount, hashShape, isArchetype, learningKey } from './dialect.mjs';
@@ -387,6 +387,34 @@ interface LLMJudgeOptions {
387
387
  */
388
388
  declare function buildLLMJudge(opts: LLMJudgeOptions): AppOracle;
389
389
 
390
+ /**
391
+ * Resolve the effective ArchetypeConvention[] for a given selected profile,
392
+ * walking family inheritance once. Model-specific entries on the selected
393
+ * profile take precedence over family-level entries for the same archetype.
394
+ *
395
+ * Pure; safe to call from any context (probe-watcher uses the same logic
396
+ * via `applyArchetypeConvention`).
397
+ */
398
+ declare function resolveConventionsForProfile(profile: ModelProfile): ArchetypeConvention[];
399
+ /**
400
+ * Pure helper: apply the matching ArchetypeConvention's suffix (and
401
+ * prefix, when meaningful) to a plain prompt-text string. Used by the
402
+ * exclusion-probe-watcher (`probeOne`) so probe calls carry the same
403
+ * forcing-function shape consumers see at compile time. Without this,
404
+ * every reasoner probe on a decisive archetype gets unfairly stay-excluded
405
+ * for hedging — as ID 20 demonstrated on 2026-05-28.
406
+ *
407
+ * Resolution: looks up the family-rep profile for `family` and reads its
408
+ * `archetypeConventions`. Returns the original text unchanged when no
409
+ * convention matches or when the suffix is already present.
410
+ *
411
+ * @param promptText raw user-prompt text (or prompt_preview from outcome)
412
+ * @param archetype intent_archetype from the finding row
413
+ * @param family family tag from deriveFamilyFromModelId / brain row
414
+ * @returns text with prefix/suffix applied (idempotent)
415
+ */
416
+ declare function applyArchetypeConvention(promptText: string, archetype: string, family: string): string;
417
+
390
418
  /**
391
419
  * Tokenizer abstraction.
392
420
  *
@@ -410,6 +438,75 @@ declare function resetTokenizer(): void;
410
438
  */
411
439
  declare function countTokens(text: string): number;
412
440
 
441
+ /**
442
+ * archetype-fits — alpha.43.
443
+ *
444
+ * Static table of "this archetype tends to be a better fit for this family"
445
+ * recommendations. Powers the `cross-family-fit-candidate` compile-time
446
+ * advisor (see `advisor-rules/cross-family-fit.ts`).
447
+ *
448
+ * Strategic framing (Sacha, 2026-05-28): "If we get better results and
449
+ * better price then we do. Even if volume is currently low, that's not an
450
+ * argument to not do it. Volume can increase quickly if tools is great to
451
+ * use, let's not create future bottlenecks because we could have wired in
452
+ * better solution at moment of knowing."
453
+ *
454
+ * The convention substrate (passApplyConventions) is the NEGATIVE side:
455
+ * make a family usable on archetypes it currently fails. This table is the
456
+ * POSITIVE side: actively surface that a different family is the better
457
+ * fit for the archetype's shape — even when current volume is low.
458
+ *
459
+ * Entries are added only when:
460
+ * - the archetype's shape and the family's behavior have a clear
461
+ * architectural fit (not vibes)
462
+ * - real-world evidence (brain rows, probe outcomes, or published
463
+ * benchmark) backs the claim, OR the reasoning is structurally so clear
464
+ * that "wait for volume" would create a future bottleneck
465
+ *
466
+ * Alpha.43 ships two entries — `plan` and `critique`. Both fit the
467
+ * reasoner-family architectural read: plan is multi-step reasoning;
468
+ * critique rewards epistemic humility and explicit reasoning. Other
469
+ * archetype-family-fits ride later alphas as evidence accumulates.
470
+ *
471
+ * Anti-pattern: do NOT add archetype-family-fits for archetypes where the
472
+ * fit is unclear (summarize, classify, extract, hunt with parallel tools).
473
+ * The advisor only earns trust when its recommendations land.
474
+ */
475
+
476
+ /**
477
+ * One archetype-family-fit recommendation. Read by the compile-time
478
+ * `cross-family-fit-candidate` advisor to decide when to surface a positive
479
+ * recommendation. The advisor pulls `costGuidance` verbatim into the
480
+ * advisory message.
481
+ */
482
+ interface ArchetypeFamilyFit {
483
+ /** Intent archetype this fit applies to. */
484
+ archetype: IntentArchetypeName;
485
+ /** Family tag that fits the archetype better than alternatives. Matches the
486
+ * same family taxonomy used by `family-resolution.deriveFamilyFromModelId`
487
+ * (e.g. `'deepseek-reasoner'`, `'gemini-flash'`, `'claude-opus'`). */
488
+ betterFitFamily: string;
489
+ /** Architectural / evidentiary justification. Appears in the advisor's
490
+ * internal logs and the advisory `evidence` payload, NOT verbatim in the
491
+ * consumer-facing message. */
492
+ reason: string;
493
+ /** Cost-context clause surfaced VERBATIM in the consumer-facing advisory
494
+ * message (e.g. "substantially cheaper at current pricing"). Keep
495
+ * declarative; the advisor wraps this into the larger sentence. */
496
+ costGuidance: string;
497
+ }
498
+ /**
499
+ * Frozen registry. Add entries by extending the array. Order is irrelevant
500
+ * — the advisor filters by `(archetype, currentFamily)` independently.
501
+ */
502
+ declare const ARCHETYPE_FAMILY_FITS: readonly ArchetypeFamilyFit[];
503
+ /**
504
+ * Pure lookup: does `(archetype, currentFamily)` have a better-fit family?
505
+ * Returns the fit entry when the current family is NOT the better fit; null
506
+ * otherwise. Used by the advisor to decide whether to fire.
507
+ */
508
+ declare function findBetterFit(archetype: string, currentFamily: string): ArchetypeFamilyFit | null;
509
+
413
510
  /**
414
511
  * Best-practice advisor — alpha.6 Phase 1.
415
512
  *
@@ -2022,4 +2119,4 @@ declare function markPromoteReadyHandled(opts: MarkPromoteReadyHandledOptions):
2022
2119
  */
2023
2120
  declare function compile(ir: PromptIR, opts?: CompileOptions): CompileResult;
2024
2121
 
2025
- export { ABSOLUTE_FLOOR, type AISDKConvertedMessage, ARCHETYPE_FLOOR_DEFAULT, type ActionableAdvisory, Adapter, type AdvisoryResolutionSource, type AdvisorySeverity, type AdvisoryStatus, type AdvisorySuggestedFix, ApiKeys, type AppOracle, type ApplySectionRewritesArgs, type ApplySectionRewritesResult, type ArchetypePerfMap, type ArchetypePerfNMap, type ArchetypePerfScoreResult, type AttachCacheControlResult, BestPracticeAdvisory, type BrainConfig, type BrainQueryConfig, 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 ProfileToRowOptions, type PromoteReadyFindingRow, type PromoteReadyResolution, PromptIR, Provider, ProviderOverrides, type ProviderReachability, RULE_SEQUENTIAL_TOOL_CLIFF, type ReachabilityOpts, RecordInput, RecordOutcomeInput, type RunAdvisorPhase2Context, SectionRewrite, type SupportedProvider, SystemModelMessage, TRANSLATOR_FLOOR, applySectionRewrites, attachCacheControlToStreamTextInput, buildLLMJudge, call, clearBrain, compile, configureBrain, countTokens, deriveFamilyFromModelId, deriveOwnership, execute, getActionableAdvisories, getAllStarterChains, getAllStarterChainsWithGrounding, getArchetypePerfScore, getDefaultFallbackChain, getDefaultFallbackChainWithGrounding, getModelCompatibility, getPerAxisMetrics, getReachabilityDiagnostic, getRecommendedPrimary, getSequentialStarterChain, getSequentialStarterChainWithGrounding, getStaleExclusionFindings, getStarterChain, getStarterChainWithGrounding, isBrainQueryActiveFor, isExclusionFindingsBrainActive, isModelReachable, isProviderReachable, loadAliasesFromBrain, loadArchetypePerfFromBrain, loadArchetypePerfNFromBrain, loadChainsFromBrain, loadModelsFromBrain, loadPricingFromBrain, markAdvisoryResolved, markExclusionFindingHandled, markPromoteReadyHandled, profileToRow, readBrainReadEnv, record, recordOutcome, resetTokenizer, resolvePricingAt, resolveProviderKey, runAdvisor, setTokenizer };
2122
+ 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 ProfileToRowOptions, type PromoteReadyFindingRow, type PromoteReadyResolution, PromptIR, Provider, ProviderOverrides, type ProviderReachability, RULE_SEQUENTIAL_TOOL_CLIFF, type ReachabilityOpts, RecordInput, RecordOutcomeInput, type RunAdvisorPhase2Context, SectionRewrite, type SupportedProvider, SystemModelMessage, TRANSLATOR_FLOOR, applyArchetypeConvention, applySectionRewrites, attachCacheControlToStreamTextInput, buildLLMJudge, 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, isExclusionFindingsBrainActive, isModelReachable, isProviderReachable, loadAliasesFromBrain, loadArchetypePerfFromBrain, loadArchetypePerfNFromBrain, loadChainsFromBrain, loadModelsFromBrain, loadPricingFromBrain, markAdvisoryResolved, markExclusionFindingHandled, markPromoteReadyHandled, profileToRow, readBrainReadEnv, record, recordOutcome, resetTokenizer, resolveConventionsForProfile, resolvePricingAt, resolveProviderKey, runAdvisor, setTokenizer };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { C as CompilePolicy, N as NormalizedResponse, A as ApiKeys, P as ProviderOverrides, a as CompiledRequest, b as PromptIR, c as CallOptions, d as CallResult, S as SystemModelMessage, e as CompileResult, f as SectionRewrite, R as RecordInput, g as RecordOutcomeInput, O as OutcomeResult, h as OracleScore, B as BestPracticeAdvisory, i as Adapter, j as PerAxisMetrics, k as Provider, l as ChainEntry, G as Grounding } from './ir-BmumS1Du.js';
2
- export { m as CallAttempt, n as CallError, o as ChainModelEntry, p as ChainWithGrounding, q as Constraints, F as FallbackReason, H as HistoryCachePolicy, I as IntentDeclaration, M as Message, r as MutationApplied, s as NormalizedTokens, t as OutcomeKind, u as PerAxisMetricsByModel, v as PromptSection, w as SectionKind, T as ToolCall, x as ToolDefinition } from './ir-BmumS1Du.js';
3
- import { ModelProfile } from './profiles.js';
1
+ import { C as CompilePolicy, N as NormalizedResponse, A as ApiKeys, P as ProviderOverrides, a as CompiledRequest, b as PromptIR, c as CallOptions, d as CallResult, S as SystemModelMessage, e as CompileResult, f as SectionRewrite, R as RecordInput, g as RecordOutcomeInput, O as OutcomeResult, h as OracleScore, B as BestPracticeAdvisory, i as Adapter, j as PerAxisMetrics, k as Provider, l as ChainEntry, G as Grounding } from './ir-DAUBaPhd.js';
2
+ export { m as CallAttempt, n as CallError, o as ChainModelEntry, p as ChainWithGrounding, q as Constraints, F as FallbackReason, H as HistoryCachePolicy, I as IntentDeclaration, M as Message, r as MutationApplied, s as NormalizedTokens, t as OutcomeKind, u as PerAxisMetricsByModel, v as PromptSection, w as SectionKind, T as ToolCall, x as ToolDefinition } from './ir-DAUBaPhd.js';
3
+ import { ModelProfile, ArchetypeConvention } 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';
6
6
  export { ALL_ARCHETYPES, ContextBucket, DIALECT_VERSION, HistoryDepth, INTENT_ARCHETYPES, OutputMode, ShapeSignature, ToolCountBucket, bucketContext, bucketHistory, bucketToolCount, hashShape, isArchetype, learningKey } from './dialect.js';
@@ -387,6 +387,34 @@ interface LLMJudgeOptions {
387
387
  */
388
388
  declare function buildLLMJudge(opts: LLMJudgeOptions): AppOracle;
389
389
 
390
+ /**
391
+ * Resolve the effective ArchetypeConvention[] for a given selected profile,
392
+ * walking family inheritance once. Model-specific entries on the selected
393
+ * profile take precedence over family-level entries for the same archetype.
394
+ *
395
+ * Pure; safe to call from any context (probe-watcher uses the same logic
396
+ * via `applyArchetypeConvention`).
397
+ */
398
+ declare function resolveConventionsForProfile(profile: ModelProfile): ArchetypeConvention[];
399
+ /**
400
+ * Pure helper: apply the matching ArchetypeConvention's suffix (and
401
+ * prefix, when meaningful) to a plain prompt-text string. Used by the
402
+ * exclusion-probe-watcher (`probeOne`) so probe calls carry the same
403
+ * forcing-function shape consumers see at compile time. Without this,
404
+ * every reasoner probe on a decisive archetype gets unfairly stay-excluded
405
+ * for hedging — as ID 20 demonstrated on 2026-05-28.
406
+ *
407
+ * Resolution: looks up the family-rep profile for `family` and reads its
408
+ * `archetypeConventions`. Returns the original text unchanged when no
409
+ * convention matches or when the suffix is already present.
410
+ *
411
+ * @param promptText raw user-prompt text (or prompt_preview from outcome)
412
+ * @param archetype intent_archetype from the finding row
413
+ * @param family family tag from deriveFamilyFromModelId / brain row
414
+ * @returns text with prefix/suffix applied (idempotent)
415
+ */
416
+ declare function applyArchetypeConvention(promptText: string, archetype: string, family: string): string;
417
+
390
418
  /**
391
419
  * Tokenizer abstraction.
392
420
  *
@@ -410,6 +438,75 @@ declare function resetTokenizer(): void;
410
438
  */
411
439
  declare function countTokens(text: string): number;
412
440
 
441
+ /**
442
+ * archetype-fits — alpha.43.
443
+ *
444
+ * Static table of "this archetype tends to be a better fit for this family"
445
+ * recommendations. Powers the `cross-family-fit-candidate` compile-time
446
+ * advisor (see `advisor-rules/cross-family-fit.ts`).
447
+ *
448
+ * Strategic framing (Sacha, 2026-05-28): "If we get better results and
449
+ * better price then we do. Even if volume is currently low, that's not an
450
+ * argument to not do it. Volume can increase quickly if tools is great to
451
+ * use, let's not create future bottlenecks because we could have wired in
452
+ * better solution at moment of knowing."
453
+ *
454
+ * The convention substrate (passApplyConventions) is the NEGATIVE side:
455
+ * make a family usable on archetypes it currently fails. This table is the
456
+ * POSITIVE side: actively surface that a different family is the better
457
+ * fit for the archetype's shape — even when current volume is low.
458
+ *
459
+ * Entries are added only when:
460
+ * - the archetype's shape and the family's behavior have a clear
461
+ * architectural fit (not vibes)
462
+ * - real-world evidence (brain rows, probe outcomes, or published
463
+ * benchmark) backs the claim, OR the reasoning is structurally so clear
464
+ * that "wait for volume" would create a future bottleneck
465
+ *
466
+ * Alpha.43 ships two entries — `plan` and `critique`. Both fit the
467
+ * reasoner-family architectural read: plan is multi-step reasoning;
468
+ * critique rewards epistemic humility and explicit reasoning. Other
469
+ * archetype-family-fits ride later alphas as evidence accumulates.
470
+ *
471
+ * Anti-pattern: do NOT add archetype-family-fits for archetypes where the
472
+ * fit is unclear (summarize, classify, extract, hunt with parallel tools).
473
+ * The advisor only earns trust when its recommendations land.
474
+ */
475
+
476
+ /**
477
+ * One archetype-family-fit recommendation. Read by the compile-time
478
+ * `cross-family-fit-candidate` advisor to decide when to surface a positive
479
+ * recommendation. The advisor pulls `costGuidance` verbatim into the
480
+ * advisory message.
481
+ */
482
+ interface ArchetypeFamilyFit {
483
+ /** Intent archetype this fit applies to. */
484
+ archetype: IntentArchetypeName;
485
+ /** Family tag that fits the archetype better than alternatives. Matches the
486
+ * same family taxonomy used by `family-resolution.deriveFamilyFromModelId`
487
+ * (e.g. `'deepseek-reasoner'`, `'gemini-flash'`, `'claude-opus'`). */
488
+ betterFitFamily: string;
489
+ /** Architectural / evidentiary justification. Appears in the advisor's
490
+ * internal logs and the advisory `evidence` payload, NOT verbatim in the
491
+ * consumer-facing message. */
492
+ reason: string;
493
+ /** Cost-context clause surfaced VERBATIM in the consumer-facing advisory
494
+ * message (e.g. "substantially cheaper at current pricing"). Keep
495
+ * declarative; the advisor wraps this into the larger sentence. */
496
+ costGuidance: string;
497
+ }
498
+ /**
499
+ * Frozen registry. Add entries by extending the array. Order is irrelevant
500
+ * — the advisor filters by `(archetype, currentFamily)` independently.
501
+ */
502
+ declare const ARCHETYPE_FAMILY_FITS: readonly ArchetypeFamilyFit[];
503
+ /**
504
+ * Pure lookup: does `(archetype, currentFamily)` have a better-fit family?
505
+ * Returns the fit entry when the current family is NOT the better fit; null
506
+ * otherwise. Used by the advisor to decide whether to fire.
507
+ */
508
+ declare function findBetterFit(archetype: string, currentFamily: string): ArchetypeFamilyFit | null;
509
+
413
510
  /**
414
511
  * Best-practice advisor — alpha.6 Phase 1.
415
512
  *
@@ -2022,4 +2119,4 @@ declare function markPromoteReadyHandled(opts: MarkPromoteReadyHandledOptions):
2022
2119
  */
2023
2120
  declare function compile(ir: PromptIR, opts?: CompileOptions): CompileResult;
2024
2121
 
2025
- export { ABSOLUTE_FLOOR, type AISDKConvertedMessage, ARCHETYPE_FLOOR_DEFAULT, type ActionableAdvisory, Adapter, type AdvisoryResolutionSource, type AdvisorySeverity, type AdvisoryStatus, type AdvisorySuggestedFix, ApiKeys, type AppOracle, type ApplySectionRewritesArgs, type ApplySectionRewritesResult, type ArchetypePerfMap, type ArchetypePerfNMap, type ArchetypePerfScoreResult, type AttachCacheControlResult, BestPracticeAdvisory, type BrainConfig, type BrainQueryConfig, 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 ProfileToRowOptions, type PromoteReadyFindingRow, type PromoteReadyResolution, PromptIR, Provider, ProviderOverrides, type ProviderReachability, RULE_SEQUENTIAL_TOOL_CLIFF, type ReachabilityOpts, RecordInput, RecordOutcomeInput, type RunAdvisorPhase2Context, SectionRewrite, type SupportedProvider, SystemModelMessage, TRANSLATOR_FLOOR, applySectionRewrites, attachCacheControlToStreamTextInput, buildLLMJudge, call, clearBrain, compile, configureBrain, countTokens, deriveFamilyFromModelId, deriveOwnership, execute, getActionableAdvisories, getAllStarterChains, getAllStarterChainsWithGrounding, getArchetypePerfScore, getDefaultFallbackChain, getDefaultFallbackChainWithGrounding, getModelCompatibility, getPerAxisMetrics, getReachabilityDiagnostic, getRecommendedPrimary, getSequentialStarterChain, getSequentialStarterChainWithGrounding, getStaleExclusionFindings, getStarterChain, getStarterChainWithGrounding, isBrainQueryActiveFor, isExclusionFindingsBrainActive, isModelReachable, isProviderReachable, loadAliasesFromBrain, loadArchetypePerfFromBrain, loadArchetypePerfNFromBrain, loadChainsFromBrain, loadModelsFromBrain, loadPricingFromBrain, markAdvisoryResolved, markExclusionFindingHandled, markPromoteReadyHandled, profileToRow, readBrainReadEnv, record, recordOutcome, resetTokenizer, resolvePricingAt, resolveProviderKey, runAdvisor, setTokenizer };
2122
+ 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 ProfileToRowOptions, type PromoteReadyFindingRow, type PromoteReadyResolution, PromptIR, Provider, ProviderOverrides, type ProviderReachability, RULE_SEQUENTIAL_TOOL_CLIFF, type ReachabilityOpts, RecordInput, RecordOutcomeInput, type RunAdvisorPhase2Context, SectionRewrite, type SupportedProvider, SystemModelMessage, TRANSLATOR_FLOOR, applyArchetypeConvention, applySectionRewrites, attachCacheControlToStreamTextInput, buildLLMJudge, 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, isExclusionFindingsBrainActive, isModelReachable, isProviderReachable, loadAliasesFromBrain, loadArchetypePerfFromBrain, loadArchetypePerfNFromBrain, loadChainsFromBrain, loadModelsFromBrain, loadPricingFromBrain, markAdvisoryResolved, markExclusionFindingHandled, markPromoteReadyHandled, profileToRow, readBrainReadEnv, record, recordOutcome, resetTokenizer, resolveConventionsForProfile, resolvePricingAt, resolveProviderKey, runAdvisor, setTokenizer };