@mindot/will 0.7.0 → 0.8.0

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.
Files changed (35) hide show
  1. package/README.md +87 -22
  2. package/dist/channels/discord.d.ts +1 -1
  3. package/dist/channels/whatsapp.d.ts +1 -1
  4. package/dist/cli.js +10823 -10454
  5. package/dist/cli.js.map +1 -1
  6. package/dist/index.d.ts +2 -2
  7. package/dist/index.js +562 -226
  8. package/dist/index.js.map +1 -1
  9. package/dist/mcp/effectors.d.ts +1 -1
  10. package/dist/{will-DAW0l-lY.d.ts → will-cS6k4uiJ.d.ts} +470 -84
  11. package/package.json +1 -1
  12. package/src/cognition/agency/engines/action.selector.ts +2 -1
  13. package/src/cognition/agency/engines/reafference.engine.ts +12 -2
  14. package/src/cognition/agency/reconcile.learning.ts +16 -2
  15. package/src/cognition/agency/schemas/repertoire.ts +12 -5
  16. package/src/cognition/config.mirror.entities.ts +1 -1
  17. package/src/cognition/faculties/executive.engine/engine.ts +136 -58
  18. package/src/cognition/faculties/executive.engine/facet.ts +10 -2
  19. package/src/cognition/faculties/executive.engine/prompt.factory.ts +2 -1
  20. package/src/cognition/index.ts +4 -0
  21. package/src/cognition/memory/vector.embedder.ts +9 -5
  22. package/src/cognition/utilities/token.tracker.ts +191 -96
  23. package/src/host/boot.ts +78 -22
  24. package/src/index.ts +35 -0
  25. package/src/llm/index.ts +397 -96
  26. package/src/llm/routing.ts +198 -0
  27. package/src/llm/summarizer.ts +5 -1
  28. package/src/runners/thin-shim.runner.ts +18 -6
  29. package/src/sdk/will.ts +82 -16
  30. package/src/stem/guards/identity.coherence.ts +17 -6
  31. package/src/stem/index.ts +3 -3
  32. package/src/stem/mind.ts +155 -24
  33. package/src/stem/policy/arbiter.ts +49 -14
  34. package/src/stem/policy/rule.table.ts +2 -2
  35. package/src/stem/tracts/effector.controller.ts +56 -9
@@ -1586,32 +1586,60 @@ declare class GoalManager implements SimulationEngine, CognitiveEngine {
1586
1586
  private _persistGoals;
1587
1587
  }
1588
1588
 
1589
- /**
1590
- * TokenTracker monitors LLM token consumption across all engines.
1591
- *
1592
- * Hooks into the LLM calls to record:
1593
- * - Prompt tokens (input)
1594
- * - Completion tokens (output)
1595
- * - Total tokens
1596
- * - Cost (based on model pricing)
1597
- * - Per-engine breakdowns
1598
- * - Per-agent breakdowns
1599
- *
1600
- * Exposes as metrics so the orchestrator and runner can log costs,
1601
- * and the ParameterOptimizer can factor cost into optimization decisions.
1602
- */
1603
-
1589
+ /** Top-level cost bucket for an LLM call. */
1590
+ type LLMCallCategory = 'executive' | 'summarizer' | 'embedding' | 'identity-guard';
1591
+ /** The actor/subsystem doing the work. */
1592
+ type LLMCallAttribute = 'master' | 'facet' | 'memory' | 'guard';
1593
+ /** The specific cognitive function being paid for. */
1594
+ type LLMCallFunction = 'decision' | 'ideation' | 'deliberation' | 'conversation' | 'outreach' | 'planning' | 'supervision' | 'consolidation' | 'recall' | 'index' | 'identity-coherence';
1604
1595
  /** One attributed ledger record (5-axis attribution + tokens + cost). */
1605
1596
  type TokenLedgerRecord = Record<string, unknown>;
1606
1597
  type TokenRecordListener = (record: TokenLedgerRecord) => void;
1607
- /** Resolve the pricing row for any model id (exact, normalized, then default). */
1608
- declare function resolvePricing(model: string): {
1598
+ /** USD per 1M tokens for one model. */
1599
+ interface ModelPrice {
1609
1600
  input: number;
1610
1601
  output: number;
1611
- };
1602
+ }
1603
+ /**
1604
+ * Host-supplied prices, keyed by model id. Matching is exact first, then
1605
+ * normalized (provider prefix, date stamp and context qualifier stripped), so
1606
+ * `claude-sonnet-5` matches `claude-sonnet-5-20260114`.
1607
+ *
1608
+ * Prices belong to the host: they change on a vendor's schedule, differ per
1609
+ * account, and are ~0 for a self-hosted model. The engine ships none.
1610
+ */
1611
+ type PriceTable = Record<string, ModelPrice>;
1612
+ /**
1613
+ * Resolve the price for a model id from the host's table.
1614
+ *
1615
+ * The engine ships no prices at all. A table baked into a release is wrong the
1616
+ * week a vendor changes a rate, differs per account, and is meaningless for a
1617
+ * self-hosted model — and a *partial* table is worse than none, because some
1618
+ * models then report plausible-but-stale numbers while others honestly report
1619
+ * nothing. Prices live with the host, next to the routing policy they inform.
1620
+ *
1621
+ * `null` does NOT mean free — it means *unknown*, and the caller reports zero
1622
+ * cost with `priced: false` so the gap stays visible rather than confidently
1623
+ * wrong. (The removed built-in default priced every unrecognised model at
1624
+ * Sonnet's rate, overstating a budget model's output by ~54×.)
1625
+ */
1626
+ declare function resolvePricing(model: string, hostPrices?: PriceTable): ModelPrice | null;
1612
1627
  interface TokenUsage {
1613
1628
  /** Model identifier (e.g., 'openai/gpt-4o') */
1614
1629
  model: string;
1630
+ /**
1631
+ * The provider that actually served this call.
1632
+ *
1633
+ * Not derivable from `model`: routing is what makes the same model id
1634
+ * reachable from several places — `deepseek-v3` direct, through a gateway, or
1635
+ * self-hosted — at prices that differ by orders of magnitude. Without this a
1636
+ * host billing across a multi-vendor routing table can attribute spend to a
1637
+ * model but never to the vendor it actually paid.
1638
+ *
1639
+ * Optional because a caller recording usage directly (outside the LLM
1640
+ * director) may not know it; absent means unattributed, not "the default".
1641
+ */
1642
+ provider?: string;
1615
1643
  /** Input/prompt tokens consumed */
1616
1644
  promptTokens: number;
1617
1645
  /** Output/completion tokens consumed */
@@ -1622,14 +1650,18 @@ interface TokenUsage {
1622
1650
  cacheReadTokens?: number;
1623
1651
  /** Anthropic prompt-cache write tokens (billed at 1.25× input). Optional. */
1624
1652
  cacheWriteTokens?: number;
1625
- /** Estimated cost in USD */
1653
+ /** Estimated cost in USD. Zero when `priced` is false — unknown, not free. */
1626
1654
  estimatedCostUsd: number;
1627
- /** Top-level cost bucket: 'executive' | 'summarizer' | 'embedding' | 'identity-guard' | … */
1628
- category: string;
1629
- /** Actor/subsystem doing the work: 'master' | 'facet' | 'memory' | 'guard' | … */
1630
- attribute: string;
1631
- /** Cognitive function: 'decision' | 'ideation' | 'conversation' | 'planning' | 'deliberation' | 'outreach' | 'consolidation' | 'recall' | 'index' | 'identity-coherence' | … */
1632
- function: string;
1655
+ /**
1656
+ * Whether a price was found for this model. False ⇒ `estimatedCostUsd` is 0
1657
+ * because nothing priced it, NOT because the call was free. A consumer
1658
+ * summing costs should surface unpriced calls rather than fold them in as
1659
+ * zero.
1660
+ */
1661
+ priced: boolean;
1662
+ category: LLMCallCategory;
1663
+ attribute: LLMCallAttribute;
1664
+ function: LLMCallFunction;
1633
1665
  /** Optional specific id or namespace: facet id, entity id, model name. */
1634
1666
  scope?: string;
1635
1667
  /** Human-readable label — auto-composed from the axes when the caller omits it. */
@@ -1642,10 +1674,16 @@ interface TokenUsage {
1642
1674
  latencyMs: number;
1643
1675
  }
1644
1676
  /** What callers pass to {@link TokenTracker.recordUsage} — cost and label are derived. */
1645
- type RecordUsageInput = Omit<TokenUsage, 'estimatedCostUsd' | 'label'> & {
1677
+ type RecordUsageInput = Omit<TokenUsage, 'estimatedCostUsd' | 'label' | 'priced'> & {
1646
1678
  label?: string;
1647
1679
  };
1648
1680
  interface TokenTrackerConfig {
1681
+ /**
1682
+ * Host-supplied model prices (USD per 1M tokens), merged from the per-provider
1683
+ * `prices` maps in `WillLLMConfig.providers`. These win over the built-in
1684
+ * fallback table. Omitted ⇒ fallback only.
1685
+ */
1686
+ prices?: PriceTable;
1649
1687
  /** Whether to emit cost events */
1650
1688
  emitCostEvents?: boolean;
1651
1689
  /** Cost threshold for warning events */
@@ -1664,6 +1702,7 @@ declare class TokenTracker implements SimulationEngine {
1664
1702
  readonly name = "token-tracker";
1665
1703
  private _emitCostEvents;
1666
1704
  private _costWarningThreshold;
1705
+ private _prices;
1667
1706
  private _usageLog;
1668
1707
  private _totalPromptTokens;
1669
1708
  private _totalCompletionTokens;
@@ -1672,6 +1711,8 @@ declare class TokenTracker implements SimulationEngine {
1672
1711
  private _categoryTokens;
1673
1712
  private _functionCosts;
1674
1713
  private _functionTokens;
1714
+ private _providerCosts;
1715
+ private _providerTokens;
1675
1716
  private _tickCosts;
1676
1717
  private _maxTickCostSamples;
1677
1718
  private _lastCostWarningTick;
@@ -1716,6 +1757,21 @@ declare class TokenTracker implements SimulationEngine {
1716
1757
  prompt: number;
1717
1758
  completion: number;
1718
1759
  }>;
1760
+ /**
1761
+ * Cost broken down by provider ('anthropic' | 'glm' | 'moonshot' | …), plus
1762
+ * an `unattributed` bucket for usage recorded without one.
1763
+ *
1764
+ * This is the axis a host reconciles against vendor invoices. Calls whose
1765
+ * model went unpriced contribute 0 here, so compare against
1766
+ * `getUsageLog()`'s `priced` flag before treating a small number as a small
1767
+ * bill.
1768
+ */
1769
+ get providerBreakdown(): ReadonlyMap<string, number>;
1770
+ /** Token counts (prompt + completion) broken down by provider. */
1771
+ get providerTokenBreakdown(): ReadonlyMap<string, {
1772
+ prompt: number;
1773
+ completion: number;
1774
+ }>;
1719
1775
  /** Cost per call average */
1720
1776
  get averageCostPerCall(): number;
1721
1777
  /** Cost per tick average */
@@ -1739,6 +1795,8 @@ declare class TokenTracker implements SimulationEngine {
1739
1795
  * - Mock embedder for testing/deterministic replay
1740
1796
  */
1741
1797
 
1798
+ /** Embedding is only ever a read or a write. */
1799
+ type EmbedFunction = Extract<LLMCallFunction, 'recall' | 'index'>;
1742
1800
  interface EmbeddingProvider {
1743
1801
  readonly modelName: string;
1744
1802
  readonly dimensions: number;
@@ -1775,12 +1833,12 @@ declare class OpenAICompatibleEmbedder implements EmbeddingProvider {
1775
1833
  /**
1776
1834
  * Per-Will token tracker. When provided, each embedding call records its
1777
1835
  * input-token usage under the 'embedding' category so memory-vector spend is
1778
- * visible alongside LLM spend instead of being a silent COGS leak.
1836
+ * visible alongside LLM spend instead of being a silent cost leak.
1779
1837
  */
1780
1838
  tokenTracker?: TokenTracker | null;
1781
1839
  });
1782
- embed(content: unknown, fn?: string): Promise<number[]>;
1783
- embedBatch(contents: unknown[], fn?: string): Promise<number[][]>;
1840
+ embed(content: unknown, fn?: EmbedFunction): Promise<number[]>;
1841
+ embedBatch(contents: unknown[], fn?: EmbedFunction): Promise<number[][]>;
1784
1842
  areEquivalent(embedding1: number[], embedding2: number[], tolerance?: number): boolean;
1785
1843
  }
1786
1844
  /**
@@ -1792,8 +1850,8 @@ declare class MockEmbedder implements EmbeddingProvider {
1792
1850
  readonly dimensions = 128;
1793
1851
  private _seed;
1794
1852
  constructor(seed?: number);
1795
- embed(content: unknown, _fn?: string): Promise<number[]>;
1796
- embedBatch(contents: unknown[], fn?: string): Promise<number[][]>;
1853
+ embed(content: unknown, _fn?: EmbedFunction): Promise<number[]>;
1854
+ embedBatch(contents: unknown[], fn?: EmbedFunction): Promise<number[][]>;
1797
1855
  areEquivalent(embedding1: number[], embedding2: number[], tolerance?: number): boolean;
1798
1856
  private _hashString;
1799
1857
  private _next;
@@ -2567,7 +2625,150 @@ declare class CompletionInbox {
2567
2625
  clear(): number;
2568
2626
  }
2569
2627
 
2570
- type LLMProvider = 'anthropic' | 'glm' | 'deepseek' | 'openai' | 'google';
2628
+ /**
2629
+ * Where a single call should go. Every field except `model` falls back to the
2630
+ * Will's default when omitted.
2631
+ */
2632
+ interface ModelRoute {
2633
+ /**
2634
+ * Omit to keep the Will's default provider and change only the model — the
2635
+ * common "same vendor, different model for this kind of work" route, and what
2636
+ * the per-role model map compiles to (a role has never had a provider of its
2637
+ * own). Name a provider to cross vendors; it must appear in `llm.providers`
2638
+ * or the route falls back to the default.
2639
+ */
2640
+ provider?: LLMProvider;
2641
+ model: string;
2642
+ /** Override the provider's API base (self-hosted / OpenAI-compatible servers). */
2643
+ baseUrl?: string;
2644
+ /** Override the output-token ceiling for this call. */
2645
+ maxOutputTokens?: number;
2646
+ }
2647
+ /**
2648
+ * Chooses a model for a call.
2649
+ *
2650
+ * Returning `null` means "no opinion" — the Will's default model is used. A
2651
+ * router should return `null` rather than guess when it does not recognise a
2652
+ * call: falling back is always safe, and a wrong route is not.
2653
+ */
2654
+ interface ModelRouter {
2655
+ /** Stable identifier, recorded alongside routing telemetry. */
2656
+ readonly name: string;
2657
+ route(meta: LLMCallMeta): ModelRoute | null;
2658
+ }
2659
+ /**
2660
+ * The default. Has no opinion about anything, allocates nothing.
2661
+ *
2662
+ * A Will running this must be byte-identical to one built before the routing
2663
+ * seam existed — that property is asserted by test, and it is what lets this
2664
+ * ship dark.
2665
+ */
2666
+ declare const NULL_ROUTER: ModelRouter;
2667
+ /** True when the router is the no-op default (used to skip the seam entirely). */
2668
+ declare function isNullRouter(router: ModelRouter | null | undefined): boolean;
2669
+ /**
2670
+ * One entry in a {@link TableRouter}'s table. All present conditions must match
2671
+ * (logical AND); an absent condition matches anything.
2672
+ */
2673
+ interface RoutingRule {
2674
+ /**
2675
+ * Match `LLMCallMeta.category` exactly (e.g. 'executive', 'summarizer').
2676
+ *
2677
+ * The axes are typed rather than free strings so a rule that names a bucket
2678
+ * the engine never emits fails to compile instead of silently never matching
2679
+ * — a routing table's worst failure is the rule that looks right and is dead.
2680
+ */
2681
+ category?: LLMCallMeta['category'];
2682
+ /** Match `LLMCallMeta.attribute` exactly (e.g. 'master', 'facet', 'guard'). */
2683
+ attribute?: LLMCallMeta['attribute'];
2684
+ /** Match `LLMCallMeta.function` exactly (e.g. 'decision', 'consolidation'). */
2685
+ function?: LLMCallMeta['function'];
2686
+ /**
2687
+ * Inclusive lower bound on `LLMCallMeta.demand`. A call with no demand
2688
+ * reported never matches a rule that sets this — absent means unknown, and
2689
+ * unknown must not be treated as zero.
2690
+ */
2691
+ minDemand?: number;
2692
+ /** Exclusive upper bound on `LLMCallMeta.demand`. Same absence rule. */
2693
+ maxDemand?: number;
2694
+ /** Where a matching call goes. */
2695
+ route: ModelRoute;
2696
+ }
2697
+ /**
2698
+ * A worked example of the seam: first matching rule wins, otherwise no opinion.
2699
+ *
2700
+ * This ships so that the interface has a reference implementation and so that
2701
+ * hosts have something to copy — it is deliberately dumb. It is not a routing
2702
+ * strategy, and the engine ships no table of its own: what belongs where is the
2703
+ * host's decision, expressed as configuration.
2704
+ *
2705
+ * Rules are evaluated in order, so put specific rules before general ones.
2706
+ */
2707
+ declare class TableRouter implements ModelRouter {
2708
+ readonly name: string;
2709
+ private readonly _rules;
2710
+ constructor(rules: readonly RoutingRule[], name?: string);
2711
+ route(meta: LLMCallMeta): ModelRoute | null;
2712
+ }
2713
+ /**
2714
+ * Ask each router in turn; the first with an opinion wins.
2715
+ *
2716
+ * This exists because a Will can have two sources of routing at once: the
2717
+ * host's own router, and the one compiled from its per-role model map. Order
2718
+ * expresses precedence — an explicit router is consulted before the role map,
2719
+ * which is the precedence those two mechanisms already had when roles were
2720
+ * served by separate directors.
2721
+ *
2722
+ * A throwing link is skipped, not propagated. The links are independent
2723
+ * decisions, and one broken router must not take a working one down with it —
2724
+ * that would silently demote every role-mapped call to the default model.
2725
+ */
2726
+ declare function chainRouters(...routers: (ModelRouter | null | undefined)[]): ModelRouter;
2727
+
2728
+ /**
2729
+ * The request/response dialect an endpoint speaks. This — not the provider's
2730
+ * name — is what the transport actually branches on.
2731
+ */
2732
+ type LLMWire = 'anthropic' | 'openai' | 'google';
2733
+ /** Providers with built-in defaults. Any other string is equally valid. */
2734
+ type KnownProvider = 'anthropic' | 'glm' | 'openai' | 'google' | 'deepseek' | 'moonshot' | 'qwen' | 'xai' | 'minimax' | 'mistral' | 'ollama' | 'vllm';
2735
+ /**
2736
+ * A provider name. Deliberately open: the field of providers changes monthly,
2737
+ * and a closed union meant a host reaching Kimi or Qwen had to masquerade as
2738
+ * `openai`, which then lied on the completion tape and in cost attribution.
2739
+ *
2740
+ * `(string & {})` keeps editor autocomplete for the known names while accepting
2741
+ * anything. A provider outside {@link KNOWN_PROVIDERS} simply has to declare its
2742
+ * `wire` and `baseUrl` — see `WillLLMConfig.providers`.
2743
+ */
2744
+ type LLMProvider = KnownProvider | (string & {});
2745
+ /**
2746
+ * Built-in wire + base URL per provider. This is *data*, not support: it saves
2747
+ * a host from looking up an endpoint, and nothing more. Any provider absent
2748
+ * from this table works identically once the host declares `wire` + `baseUrl`
2749
+ * on its `llm.providers` entry.
2750
+ *
2751
+ * WHY THIS TABLE SURVIVES WHEN THE PRICE TABLE DID NOT. A stale price is
2752
+ * invisible: it produces a confident wrong number nobody doubts. A stale base
2753
+ * URL fails on the first call, loudly, with the endpoint in the message. They
2754
+ * also move on completely different clocks — vendors reprice quarterly, and
2755
+ * change an API host about once a decade. Convenience is worth it when being
2756
+ * wrong is self-announcing.
2757
+ *
2758
+ * REGIONAL ENDPOINTS. `moonshot`, `qwen` and `minimax` all run separate
2759
+ * mainland-China hosts (`api.moonshot.cn`, `dashscope.aliyuncs.com`,
2760
+ * `api.minimaxi.com`). The international host is the default here; a key issued
2761
+ * on the other one authenticates nowhere, so a host on a China account must set
2762
+ * `baseUrl` explicitly.
2763
+ */
2764
+ declare const KNOWN_PROVIDERS: Record<string, {
2765
+ wire: LLMWire;
2766
+ baseUrl: string;
2767
+ }>;
2768
+ /** Built-in wire for a known provider, or undefined — the host must declare it. */
2769
+ declare function knownWireFor(provider: LLMProvider): LLMWire | undefined;
2770
+ /** Built-in base URL for a known provider, or undefined — the host must declare it. */
2771
+ declare function defaultBaseFor(provider: LLMProvider): string | undefined;
2571
2772
  interface LLMDirectorConfig {
2572
2773
  willId: string;
2573
2774
  model: string;
@@ -2597,6 +2798,38 @@ interface LLMDirectorConfig {
2597
2798
  * replay runs). This replaces the former process-global getTokenTracker().
2598
2799
  */
2599
2800
  tokenTracker?: TokenTracker | null;
2801
+ /**
2802
+ * MODEL_ROUTING W3 — per-call model selection. Absent (or NULL_ROUTER) means
2803
+ * every call uses the default model below, exactly as before the seam existed.
2804
+ * A router that throws, or names a provider with no usable credential, falls
2805
+ * back to the default: a routing problem must never kill a running mind.
2806
+ */
2807
+ router?: ModelRouter | null;
2808
+ /**
2809
+ * Per-provider credentials for routed calls. The top-level `apiKey`/`baseUrl`
2810
+ * remain the default entry; a route to a provider absent from this map falls
2811
+ * back to the default endpoint.
2812
+ */
2813
+ credentials?: Partial<Record<string, ProviderCredential>>;
2814
+ /**
2815
+ * Dialect for the default provider. Required when the provider is not one of
2816
+ * {@link KNOWN_PROVIDERS} — the engine will not guess how to talk to an
2817
+ * endpoint it has never heard of.
2818
+ */
2819
+ wire?: LLMWire;
2820
+ }
2821
+ /**
2822
+ * Everything a single call needs to reach a model. Resolved once per call and
2823
+ * threaded through the provider methods — never stored on the instance, because
2824
+ * the concurrency gate lets several calls be in flight on one director at once
2825
+ * and per-call state on `this` would race between them.
2826
+ */
2827
+ /** What a host supplies so a routed provider can be reached. */
2828
+ interface ProviderCredential {
2829
+ apiKey: string;
2830
+ baseUrl?: string;
2831
+ /** Required for providers outside {@link KNOWN_PROVIDERS}. */
2832
+ wire?: LLMWire;
2600
2833
  }
2601
2834
  interface LLMCallResult {
2602
2835
  text: string;
@@ -2614,17 +2847,44 @@ interface LLMCallResult {
2614
2847
  * here, letting the TokenTracker break spend down per category for transparency.
2615
2848
  */
2616
2849
  interface LLMCallMeta {
2617
- /** Top-level cost bucket: 'executive' | 'summarizer' | 'embedding' | 'identity-guard' | … */
2618
- category: string;
2619
- /** The actor/subsystem doing the work: 'master' | 'facet' | 'memory' | 'guard' | … */
2620
- attribute: string;
2621
- /** The specific cognitive function: 'decision' | 'ideation' | 'conversation' | 'planning' | 'deliberation' | 'outreach' | 'consolidation' | 'recall' | 'index' | 'identity-coherence' | … */
2622
- function: string;
2850
+ /** Top-level cost bucket. */
2851
+ category: LLMCallCategory;
2852
+ /** The actor/subsystem doing the work. */
2853
+ attribute: LLMCallAttribute;
2854
+ /** The specific cognitive function. */
2855
+ function: LLMCallFunction;
2623
2856
  /** Optional specific id or namespace: facet id, entity id, model name. */
2624
2857
  scope?: string;
2625
2858
  /** Free-form human-readable label. Auto-composed from the axes when omitted. */
2626
2859
  label?: string;
2860
+ /**
2861
+ * How much this call demands, 0..1 — MODEL_ROUTING W0.
2862
+ *
2863
+ * A *cognitive* measure, never a commercial one: it says how consequential or
2864
+ * uncertain this moment is, never who is paying for it. Two faculties already
2865
+ * compute it and simply forward what they have — the master and its facets
2866
+ * pass `effortScore` (the a-priori effort gate: uncertainty, prior
2867
+ * confidence, novelty, a pending reply, stress load), and deliberation passes
2868
+ * the agency stakes of the choice under consideration. Structurally
2869
+ * background work (summarising, guarding, embedding, delivery) reports a low
2870
+ * constant, because it is background whether the mind is calm or in crisis.
2871
+ *
2872
+ * Absent means UNKNOWN, not zero: a consumer must fall back to its default
2873
+ * rather than treat a missing value as "cheapest possible".
2874
+ *
2875
+ * This field is inert with respect to cognition. It rides along to whoever
2876
+ * resolves the model for a call; no engine may read it back and behave
2877
+ * differently, or the routing layer becomes a hidden input to the mind.
2878
+ */
2879
+ demand?: number;
2627
2880
  }
2881
+ /** Structurally background work — see `LLMCallMeta.demand`. */
2882
+ declare const BACKGROUND_DEMAND = 0.1;
2883
+ /**
2884
+ * Escalation is elevated by construction: the buffer only fires once something
2885
+ * has already failed to resolve on its own.
2886
+ */
2887
+ declare const ESCALATION_DEMAND = 0.7;
2628
2888
  declare class LLMDirector {
2629
2889
  private _willId;
2630
2890
  private _model;
@@ -2636,7 +2896,20 @@ declare class LLMDirector {
2636
2896
  private _baseUrl;
2637
2897
  private _timeoutMs;
2638
2898
  private _tokenTracker;
2899
+ private _router;
2900
+ private _credentials;
2901
+ /** Default endpoint — what every call used before the routing seam existed. */
2902
+ private _defaultEndpoint;
2903
+ /** Routes already warned about (missing credential / bad provider) — log once. */
2904
+ private _routeWarned;
2639
2905
  constructor(config: LLMDirectorConfig);
2906
+ /**
2907
+ * Resolve which model serves this call. Falls back to the default endpoint
2908
+ * whenever the router has no opinion, throws, or names a provider we hold no
2909
+ * credential for — degrade, never crash.
2910
+ */
2911
+ private _resolveEndpoint;
2912
+ private _warnRouteOnce;
2640
2913
  /**
2641
2914
  * Returns a structurally valid executive output with zero API cost.
2642
2915
  * Used when `mock: true` — e.g. for `bw_test_` key holders and the Playground.
@@ -2705,8 +2978,6 @@ declare class LLMDirector {
2705
2978
  /** Cost-attribution tag for this call. Defaults to the master executive. */
2706
2979
  meta?: LLMCallMeta): Promise<LLMCallResult>;
2707
2980
  private _callProvider;
2708
- /** Default API base URL (including version segment) for a provider. */
2709
- private _baseFor;
2710
2981
  /** Resolved API base: explicit override wins, else the provider default. */
2711
2982
  private _resolvedBase;
2712
2983
  /**
@@ -2996,7 +3267,7 @@ interface FocusSection {
2996
3267
  * into the facet's LLM calls as `LLMCallMeta.function` so the TokenTracker can
2997
3268
  * break spend down per facet type. Defaults to 'facet' when unset.
2998
3269
  */
2999
- function?: string;
3270
+ function?: LLMCallFunction;
3000
3271
  /**
3001
3272
  * Optional: Custom output format to append instead of the standard executive format.
3002
3273
  * Pass via PromptBuildOptions.outputFormat when building the user message.
@@ -3115,13 +3386,14 @@ declare class ExecutiveEngine extends AsyncEngine implements CognitiveEngine {
3115
3386
  private _lastExecutiveOutput;
3116
3387
  private _lastExecutiveTick;
3117
3388
  private _willId;
3118
- /** Per-Will, per-role model ids (config.model, resolved in mind.ts). */
3119
- private _models;
3389
+ /**
3390
+ * The Will's default model (config.model's `executive` role, resolved in
3391
+ * mind.ts). Every other role reaches its model through the router — see
3392
+ * `compileRoleRouter`.
3393
+ */
3394
+ private _modelId;
3120
3395
  /** Per-Will LLM transport overrides (config.llm) — env fallbacks apply per field. */
3121
3396
  private _llm;
3122
- /** One director per distinct model — same config, different model. Shared
3123
- * tracker/recorder/willId, so ledger attribution and replay hold per role. */
3124
- private _directorCache;
3125
3397
  private _workingMemory;
3126
3398
  private _goalManager;
3127
3399
  private _episodicConsolidator;
@@ -3164,19 +3436,15 @@ declare class ExecutiveEngine extends AsyncEngine implements CognitiveEngine {
3164
3436
  */
3165
3437
  attachCompletionInbox(inbox: CompletionInbox): void;
3166
3438
  set willId(willId: string);
3167
- /** Per-Will role models (config.model, resolved). Set before the first tick. */
3168
- set models(m: {
3169
- executive: string | null;
3170
- summarizer: string | null;
3171
- deliberation: string | null;
3172
- conversation: string | null;
3173
- });
3174
- get models(): {
3175
- executive: string | null;
3176
- summarizer: string | null;
3177
- deliberation: string | null;
3178
- conversation: string | null;
3179
- };
3439
+ /**
3440
+ * The Will's default model. Set before the first tick.
3441
+ *
3442
+ * This replaced a four-role map (W7): the other roles are routing rules now,
3443
+ * compiled in mind.ts, so the engine holds one model and one router rather
3444
+ * than a model per role plus a router.
3445
+ */
3446
+ set modelId(id: string | null);
3447
+ get modelId(): string | null;
3180
3448
  /** Per-Will LLM transport overrides (config.llm). Set before the first tick. */
3181
3449
  set llm(c: {
3182
3450
  provider?: string;
@@ -3184,9 +3452,10 @@ declare class ExecutiveEngine extends AsyncEngine implements CognitiveEngine {
3184
3452
  baseUrl?: string;
3185
3453
  maxOutputTokens?: number;
3186
3454
  timeoutMs?: number;
3455
+ credentials?: Partial<Record<string, ProviderCredential>>;
3456
+ router?: ModelRouter | null;
3457
+ wire?: LLMWire;
3187
3458
  } | null);
3188
- /** The executive-role model id (back-compat read). */
3189
- get modelId(): string | null;
3190
3459
  get latestOutput(): ExecutiveOutputFull | null;
3191
3460
  isFresh(currentTick: Tick): boolean;
3192
3461
  /**
@@ -3202,7 +3471,40 @@ declare class ExecutiveEngine extends AsyncEngine implements CognitiveEngine {
3202
3471
  * and subscribe() to receive facet decisions.
3203
3472
  */
3204
3473
  /** Get-or-create the director for a model id (shared config, per-Will). */
3205
- private _directorFor;
3474
+ /**
3475
+ * The provider, from config or environment — never guessed.
3476
+ *
3477
+ * This used to default to 'anthropic', which is how a Will configured for one
3478
+ * vendor could quietly talk to another. An unset provider is a configuration
3479
+ * error, and saying so at construction is far cheaper than a 401 mid-tick.
3480
+ */
3481
+ private _requireProvider;
3482
+ /**
3483
+ * True when this Will cannot make a live call, so provider/model are not
3484
+ * required: mock mode, or a replay re-feeding recorded completions.
3485
+ */
3486
+ private _noLiveCalls;
3487
+ /**
3488
+ * Build this Will's one and only director.
3489
+ *
3490
+ * There used to be a cache of them, keyed by model, because the per-role
3491
+ * model map had no other way to make a role use a different model. Routing
3492
+ * gave it one — the role map now compiles to rules (see `compileRoleRouter`)
3493
+ * and a single director resolves every call's endpoint per call. That is also
3494
+ * strictly more faithful: a facet follows the work it is doing rather than
3495
+ * whatever role it happened to be spawned under.
3496
+ */
3497
+ private _buildDirector;
3498
+ /**
3499
+ * Spawn a facet.
3500
+ *
3501
+ * `role` declares the facet's intent at the call site. It no longer selects a
3502
+ * model: that used to happen here, pinning a facet for life to whatever role
3503
+ * it was spawned under, and it now happens per call from the focus function
3504
+ * the caller sets immediately afterwards (W7). The two always agreed — every
3505
+ * spawn site sets a focus whose `function` matches its role — so the routed
3506
+ * answer is the same one, decided later and from the work itself.
3507
+ */
3206
3508
  spawnFacet(role?: 'deliberation' | 'conversation' | 'outreach' | 'supervision'): {
3207
3509
  attention: 'available' | 'full';
3208
3510
  handle?: ExecutiveFacetHandle;
@@ -6012,6 +6314,30 @@ interface LearnedSkill {
6012
6314
  lastEnactedTick: number;
6013
6315
  }
6014
6316
 
6317
+ /**
6318
+ * WHY this denial is final — the distinction that makes a refusal learnable
6319
+ * rather than a wall to re-probe forever. Each value selects a different
6320
+ * cognitive fate; they are not degrees of one severity.
6321
+ *
6322
+ * • 'class' — the ACTION ITSELF is never permitted. Suppress the
6323
+ * affordance hard, erase any learned envelope, and let go of
6324
+ * a commitment currently deliberating toward it.
6325
+ * • 'parameter' — the action is fine; THESE ARGUMENTS were not (bound
6326
+ * exceeded, wrong target). Narrow the envelope the Will
6327
+ * reaches for; the ability stays.
6328
+ * • 'context' — the refusal was NOT ABOUT THE ACTION at all (tainted
6329
+ * context, unavailable dependency). Touch nothing: no
6330
+ * availability delta, no envelope, no competence.
6331
+ *
6332
+ * POLICY_REAFFERENCE P5 widened this from 'class' | 'instance' after the HELM
6333
+ * joint RFC ("Denials That Teach") identified that an instance-scoped refusal
6334
+ * splits in two, and that the two halves demand opposite responses. These are
6335
+ * OUR names for the distinctions, deliberately not HELM's wire spellings — see
6336
+ * the naming-boundary note in .TODO/POLICY_REAFFERENCE.md. A provider adapter
6337
+ * translates; this interface stays vendor-neutral.
6338
+ */
6339
+ type DenialFinality = 'class' | 'parameter' | 'context';
6340
+
6015
6341
  interface OutcomeObservation {
6016
6342
  schema: string;
6017
6343
  success: boolean;
@@ -6055,11 +6381,17 @@ declare class SchemaRepertoire {
6055
6381
  availabilityOf(schema: string): number;
6056
6382
  /**
6057
6383
  * Fold a policy refusal into the availability layer (NOT competence). A
6058
- * `class` refusal cuts availability hard; an `instance` refusal dents it
6384
+ * `class` refusal cuts availability hard; a `parameter` refusal dents it
6059
6385
  * lightly. Multiplicative so repeated refusals compound toward — but never
6060
6386
  * reach — zero, keeping re-probe alive.
6387
+ *
6388
+ * `context` is EXCLUDED FROM THE SIGNATURE, not handled inside: a refusal
6389
+ * that was not about the action must never reach the availability layer at
6390
+ * all, and making that a type error rather than a convention means a future
6391
+ * caller cannot quietly re-introduce the dent. The routing decision lives in
6392
+ * the ReafferenceEngine's refused branch (P5).
6061
6393
  */
6062
- recordRefusal(schema: string, finality: 'class' | 'instance', tick: number): number;
6394
+ recordRefusal(schema: string, finality: Exclude<DenialFinality, 'context'>, tick: number): number;
6063
6395
  /**
6064
6396
  * Fold one outcome into the schema's learned skill. Returns the updated skill
6065
6397
  * and whether it just crossed the proceduralization threshold this update.
@@ -6645,12 +6977,53 @@ interface WillModelConfig {
6645
6977
  * `apiKey` is held in memory only — it is never mirrored into state entities,
6646
6978
  * session logs, or the PMA.
6647
6979
  */
6980
+ interface WillProviderConfig {
6981
+ /** Credential for this provider. Held in memory only — never state/logs/PMA. */
6982
+ apiKey?: string;
6983
+ /** Base URL override — self-hosted or OpenAI-compatible endpoints. */
6984
+ baseUrl?: string;
6985
+ /**
6986
+ * USD per 1M tokens, keyed by model id. Host-owned on purpose: prices change
6987
+ * on a vendor's schedule, differ per account, and are ~0 self-hosted, so they
6988
+ * cannot be tracked from inside an npm release. These win over the engine's
6989
+ * built-in fallback table.
6990
+ *
6991
+ * Cost is telemetry only — it never enters simulation state — so changing a
6992
+ * price can never change what a mind does or break a replay.
6993
+ */
6994
+ prices?: PriceTable;
6995
+ }
6648
6996
  interface WillLLMConfig {
6649
6997
  provider?: LLMProvider;
6650
6998
  apiKey?: string;
6651
6999
  baseUrl?: string;
6652
7000
  maxOutputTokens?: number;
6653
7001
  timeoutMs?: number;
7002
+ /**
7003
+ * Everything the host knows about each provider — credential, endpoint, and
7004
+ * prices — declared once per provider. The single-provider fields above stay
7005
+ * the simple path; this map is for hosts reaching more than one.
7006
+ */
7007
+ providers?: Partial<Record<LLMProvider, WillProviderConfig>>;
7008
+ /**
7009
+ * Per-call model selection. Omitted (or NULL_ROUTER) means every call uses
7010
+ * `model` above, exactly as before the seam existed.
7011
+ *
7012
+ * The router sees only the call's attribution — what kind of work it is and
7013
+ * how much the moment demands — never who is paying or what anything costs.
7014
+ * Routes name providers from the `providers` map above; a route to a provider
7015
+ * with no credential falls back to the default rather than failing the call.
7016
+ */
7017
+ router?: ModelRouter | null;
7018
+ /**
7019
+ * Concrete LLM model id(s) for this Will — a single id for every role, or a
7020
+ * per-role map. An explicit WILL_LLM_MODEL env pins the thinking roles
7021
+ * (operator single-model deployments); unset roles fall back to `executive`,
7022
+ * then the LLMDirector's built-in default. Product-level labels (pricing
7023
+ * tiers, model families) live host-side and resolve to concrete ids BEFORE
7024
+ * reaching the engine.
7025
+ */
7026
+ model?: string | WillModelConfig;
6654
7027
  }
6655
7028
  interface WillIdentity {
6656
7029
  /**
@@ -6693,15 +7066,6 @@ interface WillConfig {
6693
7066
  identity: WillIdentity;
6694
7067
  /** Anatomy — 'mind' (default) or the no-LLM 'reflex' shell. */
6695
7068
  anatomy?: Anatomy;
6696
- /**
6697
- * Concrete LLM model id(s) for this Will — a single id for every role, or a
6698
- * per-role map. An explicit WILL_LLM_MODEL env pins the thinking roles
6699
- * (operator single-model deployments); unset roles fall back to `executive`,
6700
- * then the LLMDirector's built-in default. Product-level labels (pricing
6701
- * tiers, model families) live host-side and resolve to concrete ids BEFORE
6702
- * reaching the engine.
6703
- */
6704
- model?: string | WillModelConfig;
6705
7069
  /**
6706
7070
  * Per-Will LLM transport overrides (provider, BYO apiKey, baseUrl, output
6707
7071
  * cap, timeout). Unset fields fall back to WILL_LLM_* envs. The apiKey never
@@ -7465,7 +7829,7 @@ interface WillSummary {
7465
7829
  createdAt: Date;
7466
7830
  lastTickAt: Date | null;
7467
7831
  anatomy: WillConfig['anatomy'];
7468
- model: WillConfig['model'];
7832
+ model: NonNullable<WillConfig['llm']>['model'];
7469
7833
  }
7470
7834
 
7471
7835
  interface WillInstance {
@@ -7941,20 +8305,42 @@ interface CreateWillOptions {
7941
8305
  anatomy?: Anatomy;
7942
8306
  /** Concrete LLM model id, or a per-role map ({ executive, summarizer?,
7943
8307
  * deliberation?, embedding? } — unset thinking roles fall back to executive).
7944
- * Unset → env / provider default. */
8308
+ * Unset → env / provider default.
8309
+ * @deprecated Pass `llmConfig: { model }` instead — model and transport are
8310
+ * one concern. Still honoured; an explicit `llmConfig.model` wins. */
7945
8311
  model?: string | WillModelConfig;
7946
- /** Per-Will LLM transport overrides (provider, BYO apiKey, baseUrl, caps).
8312
+ /** Per-Will LLM config: provider, model(s), BYO apiKey, baseUrl, caps.
7947
8313
  * Unset fields fall back to WILL_LLM_* envs. apiKey stays in memory only.
7948
- * (Named llmConfig because `llm` is the mock/anthropic MODE switch.) */
8314
+ * (Named llmConfig because `llm` is the provider MODE switch.) */
7949
8315
  llmConfig?: WillLLMConfig;
7950
8316
  /**
7951
- * LLM mode. 'mock' (default when no key is present) runs a deterministic
7952
- * canned executive — zero keys, zero cost. 'anthropic' calls Claude (needs
7953
- * ANTHROPIC_API_KEY / WILL_LLM_* env); 'glm' calls Z.ai's GLM over its
7954
- * Anthropic-compatible endpoint (needs ZAI_API_KEY / WILL_LLM_*). Omit to
7955
- * auto-detect from whichever key is set.
8317
+ * LLM mode which provider the executive speaks to.
8318
+ *
8319
+ * 'mock' (the default when no key is present) runs a deterministic canned
8320
+ * executive: zero keys, zero cost. Every other value names a provider and
8321
+ * needs its key, either the provider's own env below or the
8322
+ * provider-agnostic WILL_LLM_API_KEY:
8323
+ *
8324
+ * anthropic ANTHROPIC_API_KEY Claude, native Messages wire
8325
+ * glm ZAI_API_KEY Z.ai GLM, Anthropic-compatible wire
8326
+ * openai OPENAI_API_KEY OpenAI wire
8327
+ * google GOOGLE_API_KEY | GEMINI_API_KEY native Gemini wire
8328
+ * deepseek DEEPSEEK_API_KEY OpenAI wire
8329
+ * moonshot MOONSHOT_API_KEY Kimi — OpenAI wire
8330
+ * qwen DASHSCOPE_API_KEY Alibaba Model Studio — OpenAI wire
8331
+ * xai XAI_API_KEY Grok — OpenAI wire
8332
+ * minimax MINIMAX_API_KEY OpenAI wire
8333
+ * mistral MISTRAL_API_KEY OpenAI wire
8334
+ * ollama · vllm local; no key, set `llm` explicitly
8335
+ *
8336
+ * Any other string works too — it just has to declare its `wire` and
8337
+ * `baseUrl` on `llmConfig.providers`. Naming the vendor rather than
8338
+ * borrowing `openai` because it speaks that wire is what keeps the
8339
+ * completion tape and the cost breakdown honest.
8340
+ *
8341
+ * Omit to auto-detect from whichever key is set.
7956
8342
  */
7957
- llm?: 'mock' | 'anthropic' | 'glm';
8343
+ llm?: 'mock' | LLMProvider;
7958
8344
  /**
7959
8345
  * Abilities the Will can choose to enact. `name → handler`, or
7960
8346
  * `name → { handler, description?, cost?, valence?, preconditions? }` to seed
@@ -8077,4 +8463,4 @@ declare class Will {
8077
8463
  private _emitError;
8078
8464
  }
8079
8465
 
8080
- export { ConfidenceCalibrator as $, type AckResult as A, type AsyncEngineConfig as B, type ConflictReport as C, AttachmentEvaluator as D, type EffectorHandler as E, type AttachmentEvaluatorConfig as F, AttentionAllocator as G, type AttentionAllocatorConfig as H, type InboundEnvelope as I, AuditionEngine as J, AutobiographicalNarrator as K, type AutobiographicalNarratorConfig as L, type BehavioralProbeResult as M, BiasDetector as N, type OutboundEnvelope as O, type BiasDetectorConfig as P, BunStorageAdapter as Q, type RestoreOptions as R, type SimulationContext as S, type TransportStatus as T, type ChunkEnvelope as U, type CircadianConfig as V, Will as W, CircadianOscillator as X, type ClockConfig as Y, type Cognition as Z, type CognitiveHealth as _, type ExternalTransport as a, type LossEvaluatorConfig as a$, type ConfidenceCalibratorConfig as a0, type Coordinates as a1, type CreateWillOptions as a2, DefaultEventBus as a3, DefaultMetricCollector as a4, DefaultOrchestrator as a5, DefaultReplayRecorder as a6, DefaultReplaySession as a7, DefaultScenario as a8, DefaultSerializer as a9, type EventFilter as aA, type EventHandler as aB, type EventPayload as aC, ExecutiveEngine as aD, type ExecutiveEngineConfig$1 as aE, Exteroception as aF, type ExteroceptionConfig as aG, ForgettingCurve as aH, type ForgettingCurveConfig as aI, FrustrationEvaluator as aJ, type FrustrationEvaluatorConfig as aK, GoalManager as aL, type GoalManagerConfig as aM, GustationEngine as aN, type InboundMessageEnvelope as aO, type InboundPerceptEnvelope as aP, InhibitionController as aQ, type InhibitionControllerConfig as aR, Interoception as aS, type InteroceptionConfig as aT, IntrospectionEngine as aU, type IntrospectionEngineConfig as aV, KnownEntityTracker as aW, type KnownEntityTrackerConfig as aX, type LLMCompletionRecord as aY, type LLMCompletionSink as aZ, LossEvaluator as a_, DefaultSimulation as aa, DefaultSimulationClock as ab, DefaultStateManager as ac, DefaultVectorMemoryAdapter as ad, DeliberationEngine as ae, DeltaEncoder as af, type DeltaSnapshot as ag, DreamSimulator as ah, type DreamSimulatorConfig as ai, type Duration as aj, type EffectorDeclaration as ak, type EffectorEntry as al, type EffectorResult as am, type EffectorSpec as an, type EmbeddingProvider as ao, EmpathySimulator as ap, type EmpathySimulatorConfig as aq, EnergyRegulator as ar, type EnergyRegulatorConfig as as, type EngineRegistry as at, type EngineResult as au, type Envelope as av, EpisodicConsolidator as aw, type EpisodicConsolidatorConfig as ax, type EventBus as ay, type EventBusConfig as az, type SeededPRNG as b, type SimulationEngine as b$, type MessageEnvelope as b0, type MetricCollector as b1, type MetricPoint as b2, type MinimalContext as b3, MockEmbedder as b4, MoralEvaluator as b5, type MoralEvaluatorConfig as b6, MotorSchemaExecutor as b7, NoveltyDetector as b8, type NoveltyDetectorConfig as b9, type ReplayMetadata as bA, type ReplayRecord as bB, type ReplayRecorder as bC, type ReplaySession as bD, type ReplyEnvelope as bE, ReputationTracker as bF, type ReputationTrackerConfig as bG, RewardEvaluator as bH, type RewardEvaluatorConfig as bI, type Scenario as bJ, type ScenarioConfig as bK, type ScenarioValidationResult as bL, type SchemaPrecondition as bM, SelfModelUpdater as bN, type SelfModelUpdaterConfig as bO, SemanticIntegrator as bP, type SemanticIntegratorConfig as bQ, type SensoryInput as bR, type SerializationConfig as bS, type SerializationFormat as bT, type SerializedEntity as bU, type SerializedState as bV, type Serializer as bW, type SessionLogEnvelope as bX, type Simulation as bY, type SimulationClock as bZ, type SimulationConfig as b_, OlfactionEngine as ba, OpenAICompatibleEmbedder as bb, type Orchestrator as bc, type OrchestratorConfig as bd, type OutboxMessage as be, type PMABehavioral as bf, type PMABelief as bg, type PMAEmotionalBaseline as bh, PMAEvalHarness as bi, type PMAGoal as bj, type PMAIdentity as bk, type PMAProbe as bl, type PMASnapshot as bm, type PerceptEnvelope as bn, PersonaConsolidator as bo, type PersonaConsolidatorConfig as bp, PlanningEngine as bq, type PlanningEngineConfig as br, ReafferenceEngine as bs, type ReconstructionFidelityReport as bt, type ReconstructionFidelityScores as bu, type RecordUsageInput as bv, type ReplayComparison as bw, type ReplayConfig as bx, type ReplayDifference as by, ReplayManager as bz, type SimulationEntity as c, type SimulationEventBase as c0, type SimulationEventListener as c1, type SleepPressureConfig as c2, SleepPressureRegulator as c3, SocialPerception as c4, type SocialPerceptionConfig as c5, SomatosensationEngine as c6, SpacedRepetition as c7, type SpacedRepetitionConfig as c8, type StateSnapshot as c9, type WillConfig as cA, type WillEffectorAct as cB, type WillInstance as cC, type WillMessage as cD, type WillStateSummary as cE, type WillStatus as cF, WillStem as cG, type WillSummary as cH, WorkingMemory as cI, type WorkingMemoryConfig as cJ, type WorldEntity as cK, type WorldInterface as cL, assembleMind as cM, clearCompletionRecorder as cN, type effectorInvocation as cO, type effectorInvocationEnvelope as cP, getCompletionRecorder as cQ, resolvePricing as cR, setCompletionRecorder as cS, type Stimulus as ca, type StorageAdapter as cb, StressRegulator as cc, type StressRegulatorConfig as cd, TaskSwitcher as ce, type TaskSwitcherConfig as cf, type TextMessage as cg, TheoryOfMind as ch, type TheoryOfMindConfig as ci, ThreatEvaluator as cj, type ThreatEvaluatorConfig as ck, type TickListener as cl, type TokenLedgerRecord as cm, type TokenReportEnvelope as cn, TokenTracker as co, type TokenTrackerConfig as cp, type TokenUsage as cq, type VectorIndex as cr, type VectorMemoryAdapter as cs, type VectorMemoryConfig as ct, type VectorQueryFilter as cu, type VectorQueryResult as cv, type VectorRecord as cw, VisionEngine as cx, type VoiceChunk as cy, type WillAffect as cz, type Timestamp as d, type SimulationEvent as e, type StateManager as f, type Tick as g, type SimulationState as h, type StateCommands as i, type ReasoningFootprint as j, type ReadonlySimulationState as k, type ConflictStrategy as l, type ConflictResolution as m, type AckEnvelope as n, type ActionRequest as o, type ActionResult as p, ActionSelector as q, type ActivityEnvelope as r, type ActivityEvent as s, type ActivityEventHandler as t, AestheticEvaluator as u, type AestheticEvaluatorConfig as v, AffectiveBlender as w, type AffectiveBlenderConfig as x, AffordanceSynthesizer as y, AsyncEngine as z };
8466
+ export { type CognitiveHealth as $, type AckResult as A, type AsyncEngineConfig as B, type ConflictReport as C, AttachmentEvaluator as D, type EffectorHandler as E, type AttachmentEvaluatorConfig as F, AttentionAllocator as G, type AttentionAllocatorConfig as H, type InboundEnvelope as I, AuditionEngine as J, AutobiographicalNarrator as K, type AutobiographicalNarratorConfig as L, BACKGROUND_DEMAND as M, type BehavioralProbeResult as N, type OutboundEnvelope as O, BiasDetector as P, type BiasDetectorConfig as Q, type RestoreOptions as R, type SimulationContext as S, type TransportStatus as T, BunStorageAdapter as U, type ChunkEnvelope as V, Will as W, type CircadianConfig as X, CircadianOscillator as Y, type ClockConfig as Z, type Cognition as _, type ExternalTransport as a, type KnownProvider as a$, ConfidenceCalibrator as a0, type ConfidenceCalibratorConfig as a1, type Coordinates as a2, type CreateWillOptions as a3, DefaultEventBus as a4, DefaultMetricCollector as a5, DefaultOrchestrator as a6, DefaultReplayRecorder as a7, DefaultReplaySession as a8, DefaultScenario as a9, type EventBus as aA, type EventBusConfig as aB, type EventFilter as aC, type EventHandler as aD, type EventPayload as aE, ExecutiveEngine as aF, type ExecutiveEngineConfig$1 as aG, Exteroception as aH, type ExteroceptionConfig as aI, ForgettingCurve as aJ, type ForgettingCurveConfig as aK, FrustrationEvaluator as aL, type FrustrationEvaluatorConfig as aM, GoalManager as aN, type GoalManagerConfig as aO, GustationEngine as aP, type InboundMessageEnvelope as aQ, type InboundPerceptEnvelope as aR, InhibitionController as aS, type InhibitionControllerConfig as aT, Interoception as aU, type InteroceptionConfig as aV, IntrospectionEngine as aW, type IntrospectionEngineConfig as aX, KNOWN_PROVIDERS as aY, KnownEntityTracker as aZ, type KnownEntityTrackerConfig as a_, DefaultSerializer as aa, DefaultSimulation as ab, DefaultSimulationClock as ac, DefaultStateManager as ad, DefaultVectorMemoryAdapter as ae, DeliberationEngine as af, DeltaEncoder as ag, type DeltaSnapshot as ah, DreamSimulator as ai, type DreamSimulatorConfig as aj, type Duration as ak, ESCALATION_DEMAND as al, type EffectorDeclaration as am, type EffectorEntry as an, type EffectorResult as ao, type EffectorSpec as ap, type EmbeddingProvider as aq, EmpathySimulator as ar, type EmpathySimulatorConfig as as, EnergyRegulator as at, type EnergyRegulatorConfig as au, type EngineRegistry as av, type EngineResult as aw, type Envelope as ax, EpisodicConsolidator as ay, type EpisodicConsolidatorConfig as az, type SeededPRNG as b, SelfModelUpdater as b$, type LLMCallMeta as b0, type LLMCompletionRecord as b1, type LLMCompletionSink as b2, type LLMProvider as b3, type LLMWire as b4, LossEvaluator as b5, type LossEvaluatorConfig as b6, type MessageEnvelope as b7, type MetricCollector as b8, type MetricPoint as b9, type PersonaConsolidatorConfig as bA, PlanningEngine as bB, type PlanningEngineConfig as bC, type PriceTable as bD, type ProviderCredential as bE, ReafferenceEngine as bF, type ReconstructionFidelityReport as bG, type ReconstructionFidelityScores as bH, type RecordUsageInput as bI, type ReplayComparison as bJ, type ReplayConfig as bK, type ReplayDifference as bL, ReplayManager as bM, type ReplayMetadata as bN, type ReplayRecord as bO, type ReplayRecorder as bP, type ReplaySession as bQ, type ReplyEnvelope as bR, ReputationTracker as bS, type ReputationTrackerConfig as bT, RewardEvaluator as bU, type RewardEvaluatorConfig as bV, type RoutingRule as bW, type Scenario as bX, type ScenarioConfig as bY, type ScenarioValidationResult as bZ, type SchemaPrecondition as b_, type MinimalContext as ba, MockEmbedder as bb, type ModelPrice as bc, type ModelRoute as bd, type ModelRouter as be, MoralEvaluator as bf, type MoralEvaluatorConfig as bg, MotorSchemaExecutor as bh, NULL_ROUTER as bi, NoveltyDetector as bj, type NoveltyDetectorConfig as bk, OlfactionEngine as bl, OpenAICompatibleEmbedder as bm, type Orchestrator as bn, type OrchestratorConfig as bo, type OutboxMessage as bp, type PMABehavioral as bq, type PMABelief as br, type PMAEmotionalBaseline as bs, PMAEvalHarness as bt, type PMAGoal as bu, type PMAIdentity as bv, type PMAProbe as bw, type PMASnapshot as bx, type PerceptEnvelope as by, PersonaConsolidator as bz, type SimulationEntity as c, assembleMind as c$, type SelfModelUpdaterConfig as c0, SemanticIntegrator as c1, type SemanticIntegratorConfig as c2, type SensoryInput as c3, type SerializationConfig as c4, type SerializationFormat as c5, type SerializedEntity as c6, type SerializedState as c7, type Serializer as c8, type SessionLogEnvelope as c9, type TickListener as cA, type TokenLedgerRecord as cB, type TokenReportEnvelope as cC, TokenTracker as cD, type TokenTrackerConfig as cE, type TokenUsage as cF, type VectorIndex as cG, type VectorMemoryAdapter as cH, type VectorMemoryConfig as cI, type VectorQueryFilter as cJ, type VectorQueryResult as cK, type VectorRecord as cL, VisionEngine as cM, type VoiceChunk as cN, type WillAffect as cO, type WillConfig as cP, type WillEffectorAct as cQ, type WillInstance as cR, type WillMessage as cS, type WillStateSummary as cT, type WillStatus as cU, WillStem as cV, type WillSummary as cW, WorkingMemory as cX, type WorkingMemoryConfig as cY, type WorldEntity as cZ, type WorldInterface as c_, type Simulation as ca, type SimulationClock as cb, type SimulationConfig as cc, type SimulationEngine as cd, type SimulationEventBase as ce, type SimulationEventListener as cf, type SleepPressureConfig as cg, SleepPressureRegulator as ch, SocialPerception as ci, type SocialPerceptionConfig as cj, SomatosensationEngine as ck, SpacedRepetition as cl, type SpacedRepetitionConfig as cm, type StateSnapshot as cn, type Stimulus as co, type StorageAdapter as cp, StressRegulator as cq, type StressRegulatorConfig as cr, TableRouter as cs, TaskSwitcher as ct, type TaskSwitcherConfig as cu, type TextMessage as cv, TheoryOfMind as cw, type TheoryOfMindConfig as cx, ThreatEvaluator as cy, type ThreatEvaluatorConfig as cz, type Timestamp as d, chainRouters as d0, clearCompletionRecorder as d1, defaultBaseFor as d2, type effectorInvocation as d3, type effectorInvocationEnvelope as d4, getCompletionRecorder as d5, isNullRouter as d6, knownWireFor as d7, resolvePricing as d8, setCompletionRecorder as d9, type SimulationEvent as e, type StateManager as f, type Tick as g, type SimulationState as h, type StateCommands as i, type ReasoningFootprint as j, type ReadonlySimulationState as k, type ConflictStrategy as l, type ConflictResolution as m, type AckEnvelope as n, type ActionRequest as o, type ActionResult as p, ActionSelector as q, type ActivityEnvelope as r, type ActivityEvent as s, type ActivityEventHandler as t, AestheticEvaluator as u, type AestheticEvaluatorConfig as v, AffectiveBlender as w, type AffectiveBlenderConfig as x, AffordanceSynthesizer as y, AsyncEngine as z };