@genesislcap/ai-assistant 15.109.0 → 15.109.2

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 (2) hide show
  1. package/dist/custom-elements.json +635 -635
  2. package/package.json +17 -17
@@ -13654,564 +13654,701 @@
13654
13654
  },
13655
13655
  {
13656
13656
  "kind": "javascript-module",
13657
- "path": "src/state/ai-assistant-slice.ts",
13657
+ "path": "src/provider/ai-provider-switcher.ts",
13658
13658
  "declarations": [
13659
- {
13660
- "kind": "function",
13661
- "name": "createDefaultSessionState",
13662
- "return": {
13663
- "type": {
13664
- "text": "AiAssistantSessionState"
13665
- }
13666
- },
13667
- "description": "Build a fresh default session state. A factory (not just a shared const) so\neach call returns independent collections — `resetSession` can hand back a\nclean slate without aliasing the initial state's arrays."
13668
- },
13669
- {
13670
- "kind": "variable",
13671
- "name": "defaultSessionState",
13672
- "type": {
13673
- "text": "AiAssistantSessionState"
13674
- }
13675
- },
13676
13659
  {
13677
13660
  "kind": "variable",
13678
- "name": "aiAssistantSlice"
13661
+ "name": "AIProviderSwitcher",
13662
+ "description": "The DI token for the (AIProviderSwitcher:interface). Resolves a noop until the app\nregisters one."
13679
13663
  }
13680
13664
  ],
13681
13665
  "exports": [
13682
13666
  {
13683
13667
  "kind": "js",
13684
- "name": "createDefaultSessionState",
13668
+ "name": "AIProviderSwitcher",
13685
13669
  "declaration": {
13686
- "name": "createDefaultSessionState",
13687
- "module": "src/state/ai-assistant-slice.ts"
13670
+ "name": "AIProviderSwitcher",
13671
+ "module": "src/provider/ai-provider-switcher.ts"
13688
13672
  }
13689
- },
13673
+ }
13674
+ ]
13675
+ },
13676
+ {
13677
+ "kind": "javascript-module",
13678
+ "path": "src/provider/assistant-app-settings.ts",
13679
+ "declarations": [
13690
13680
  {
13691
- "kind": "js",
13692
- "name": "defaultSessionState",
13693
- "declaration": {
13694
- "name": "defaultSessionState",
13695
- "module": "src/state/ai-assistant-slice.ts"
13696
- }
13697
- },
13681
+ "kind": "variable",
13682
+ "name": "AssistantAppSettingsProvider",
13683
+ "description": "The DI token for the (AssistantAppSettingsProvider:interface). Resolves a noop\nuntil the host registers one."
13684
+ }
13685
+ ],
13686
+ "exports": [
13698
13687
  {
13699
13688
  "kind": "js",
13700
- "name": "aiAssistantSlice",
13689
+ "name": "AssistantAppSettingsProvider",
13701
13690
  "declaration": {
13702
- "name": "aiAssistantSlice",
13703
- "module": "src/state/ai-assistant-slice.ts"
13691
+ "name": "AssistantAppSettingsProvider",
13692
+ "module": "src/provider/assistant-app-settings.ts"
13704
13693
  }
13705
13694
  }
13706
13695
  ]
13707
13696
  },
13708
13697
  {
13709
13698
  "kind": "javascript-module",
13710
- "path": "src/state/debug-event-log.ts",
13699
+ "path": "src/provider/tiered-provider-switcher.ts",
13711
13700
  "declarations": [
13712
13701
  {
13713
- "kind": "variable",
13714
- "name": "META_EVENT_IMPORTANCE",
13715
- "type": {
13716
- "text": "Record<MetaEventType, MetaEventImportance>"
13717
- },
13718
- "default": "{\n 'turn.error': 'high',\n 'tool.failed': 'high',\n 'subagent.failed': 'high',\n 'file.read-failed': 'high',\n 'suggestions.failed': 'high',\n 'context.threshold-crossed': 'high',\n 'context.compacted': 'high',\n 'persistence.restore-orphan': 'high',\n // A save that did not land is silent data loss in progress: the transcript on screen\n // is no longer backed by the store, and every later turn widens the gap. GENC-1511.\n 'persistence.save-failed': 'high',\n\n 'assistant.connected': 'normal',\n 'assistant.disconnected': 'normal',\n 'assistant.popout': 'normal',\n 'assistant.popin': 'normal',\n 'driver.created': 'normal',\n 'state.changed': 'normal',\n 'turn.start': 'normal',\n 'turn.end': 'normal',\n 'turn.retry': 'normal',\n 'turn.finish-guard': 'normal',\n 'tool.unresolved': 'normal',\n 'subagent.started': 'normal',\n 'subagent.completed': 'normal',\n // One per routing decision, with what the classifier answered and what the call cost. Same\n // level as the handoff it produces: you read them together to follow how a turn was routed.\n 'routing.decided': 'normal',\n 'agent.handoff': 'normal',\n 'agent.pinned': 'normal',\n 'agent.unpinned': 'normal',\n 'provider.selected': 'normal',\n 'interaction.requested': 'normal',\n 'interaction.resolved': 'normal',\n // Bookkeeping about an already-finished turn; interesting when reconciling a session total.\n 'interaction.external-cost': 'normal',\n // Spend that was billed but could NOT be recorded (the message was trimmed/condensed away, or\n // the value was not real spend). 'high': it is the one way the session total goes quietly\n // wrong, so it must stand out when reconciling.\n 'interaction.external-cost-dropped': 'high',\n // What came of an answer, recorded by the tool that asked (see recordInteractionOutcome).\n 'interaction.outcome': 'normal',\n // An outcome that could not be recorded: the widget goes on showing only the answer.\n 'interaction.outcome-dropped': 'high',\n // A long action's step starting, finishing, or skipped on resume because it was already done.\n 'interaction.step': 'low',\n // A cut checkpoint taken over after a reload, refused (by sameWork, and kept for a later request;\n // or as malformed), or dropped at flow end, as is the live one.\n 'interaction.checkpoint': 'normal',\n // A claimant handing a pending interaction to the person, or taking it back.\n 'interaction.held': 'normal',\n // A claim on a `userOnly` interaction, refused. Expected when an interceptor claims broadly.\n 'interaction.claim-refused': 'low',\n // A claimant ran one of the surface's actions: what it did, and whether that settled it.\n 'interaction.invoked': 'normal',\n 'autopilot.claimed': 'normal',\n // One per interaction the autopilot does not take, so frequent and mostly expected.\n 'autopilot.declined': 'low',\n 'autopilot.decision-sent': 'low',\n 'autopilot.acted': 'normal',\n 'autopilot.handed-back': 'normal',\n 'autopilot.paused': 'normal',\n 'autopilot.resumed': 'normal',\n // The mode went with the task across a hand-off or its hand-back, rather than ending with the flow.\n 'autopilot.carried': 'normal',\n // The wrapper itself failed: the journey stops being automatic without anyone choosing that.\n 'autopilot.error': 'high',\n // A written answer counted against the step's limit; reaching it withdraws `reply`.\n 'autopilot.refinement': 'normal',\n // The autopilot showed its own widget because a working turn ended needing the person.\n 'autopilot.handback-presented': 'normal',\n // The autopilot was given the whole visible transcript: its first decision, a rebuild, or after\n // a compaction removed the last message it saw.\n 'autopilot.catch-up': 'normal',\n // Autopilot spend that reached no message, so it is missing from the session total.\n 'autopilot.cost-dropped': 'high',\n // A headless session attached to the driver: from here a host with no screen is the person.\n 'headless.attached': 'normal',\n // The host settled an interaction raw, without the widget's own actions: its result went to the\n // tool as given, unchecked by anything the widget would have enforced.\n 'headless.raw-resolved': 'normal',\n 'external-diagnostics.folded': 'normal',\n 'session.cleared': 'normal',\n 'session.switched': 'low',\n 'session.switch-deferred': 'low',\n 'persistence.restored': 'normal',\n // Whether a restored flow will be re-activated and resumed (GENC-1662), and how much the trim cut.\n 'persistence.resume-planned': 'normal',\n // A planned resume that did not run, and why (GENC-1662) — the divider was put back to plain.\n 'persistence.resume-withdrawn': 'normal',\n 'persistence.suppressed': 'normal',\n 'persistence.not-resumable': 'normal',\n\n 'driver.wired': 'low',\n 'driver.unwired': 'low',\n 'context.updated': 'low',\n 'context.condensed': 'low',\n 'panel.toggled': 'low',\n 'persistence.toggled': 'low',\n 'persistence.saved': 'low',\n 'attachment.added': 'low',\n}",
13719
- "description": "Importance is intrinsic to the event *type*, not the instance, so it's\ndefined once here and stamped automatically by recordMetaEvent — call\nsites never pass it. The `Record` is exhaustive: adding a `MetaEventType`\nwithout a level here is a compile error.\n\n- `high` — failures and hard limits you almost always want to see.\n- `normal` — meaningful session flow you read to follow what happened.\n- `low` — frequent UI / bookkeeping noise, usually safe to skip."
13720
- },
13721
- {
13722
- "kind": "function",
13723
- "name": "recordMetaEvent",
13724
- "return": {
13725
- "type": {
13726
- "text": "void"
13727
- }
13728
- },
13729
- "parameters": [
13702
+ "kind": "class",
13703
+ "description": "Which cloud vendor backs the tier-shaped provider registry, plus the means to move it at\nruntime (GENC-1610).",
13704
+ "name": "TieredAIProviderSwitcher",
13705
+ "members": [
13730
13706
  {
13731
- "name": "key",
13707
+ "kind": "field",
13708
+ "name": "builtVendors",
13732
13709
  "type": {
13733
- "text": "string"
13734
- }
13710
+ "text": "readonly AITierVendor[]"
13711
+ },
13712
+ "privacy": "private",
13713
+ "readonly": true,
13714
+ "description": "The vendors it was constructed with: TieredAIProviderSwitcher.setAvailableVendors\nchooses among these and never adds one."
13735
13715
  },
13736
13716
  {
13737
- "name": "type",
13717
+ "kind": "field",
13718
+ "name": "_vendors",
13738
13719
  "type": {
13739
- "text": "MetaEventType"
13740
- }
13720
+ "text": "readonly AITierVendor[]"
13721
+ },
13722
+ "privacy": "private"
13741
13723
  },
13742
13724
  {
13743
- "name": "detail",
13744
- "optional": true,
13725
+ "kind": "field",
13726
+ "name": "options",
13745
13727
  "type": {
13746
- "text": "Record<string, unknown>"
13747
- }
13748
- }
13749
- ],
13750
- "description": "Append a meta event to the timeline for `key`. Once the buffer exceeds\nDEFAULT_MAX_META_EVENTS, evicts the oldest *non-`high`* event;\n`high`-importance events are never evicted. An empty `key` is bucketed under\n`''`, matching how drivers/stores handle an absent session identity, so\ncallers never need to guard."
13751
- },
13752
- {
13753
- "kind": "function",
13754
- "name": "recordTurnError",
13755
- "return": {
13756
- "type": {
13757
- "text": "void"
13758
- }
13759
- },
13760
- "parameters": [
13728
+ "text": "TieredAIProviderSwitcherOptions"
13729
+ },
13730
+ "privacy": "private",
13731
+ "readonly": true,
13732
+ "default": "options"
13733
+ },
13761
13734
  {
13762
- "name": "key",
13735
+ "kind": "field",
13736
+ "name": "defaultTier",
13763
13737
  "type": {
13764
- "text": "string"
13765
- }
13738
+ "text": "AITierId"
13739
+ },
13740
+ "privacy": "private",
13741
+ "readonly": true
13766
13742
  },
13767
13743
  {
13768
- "name": "reason",
13744
+ "kind": "field",
13745
+ "name": "registry",
13769
13746
  "type": {
13770
- "text": "TurnFailureReason"
13771
- }
13747
+ "text": "MutableAIProviderRegistry"
13748
+ },
13749
+ "privacy": "private",
13750
+ "readonly": true
13772
13751
  },
13773
13752
  {
13774
- "name": "detail",
13775
- "optional": true,
13776
- "type": {
13777
- "text": "Record<string, unknown>"
13778
- }
13779
- }
13780
- ],
13781
- "description": "Record a turn-ending failure (`turn.error`, importance `high`). The `reason`\nis typed so the high-importance triage surface stays consistent; pass any\ndiagnostic specifics (attempt counts, offending tool names, etc.) in `detail`."
13782
- },
13783
- {
13784
- "kind": "function",
13785
- "name": "recordTurnRetry",
13786
- "return": {
13787
- "type": {
13788
- "text": "void"
13789
- }
13790
- },
13791
- "parameters": [
13753
+ "kind": "field",
13754
+ "name": "listeners",
13755
+ "privacy": "private",
13756
+ "readonly": true,
13757
+ "default": "new Set<(vendor: AITierVendor) => void>()"
13758
+ },
13792
13759
  {
13793
- "name": "key",
13760
+ "kind": "field",
13761
+ "name": "_vendor",
13794
13762
  "type": {
13795
- "text": "string"
13796
- }
13763
+ "text": "AITierVendor"
13764
+ },
13765
+ "privacy": "private"
13797
13766
  },
13798
13767
  {
13799
- "name": "reason",
13768
+ "kind": "field",
13769
+ "name": "vendorChoice",
13800
13770
  "type": {
13801
- "text": "TurnFailureReason"
13802
- }
13771
+ "text": "AIVendorChoice | undefined"
13772
+ },
13773
+ "readonly": true,
13774
+ "description": "Who chooses the vendor, as the options said."
13803
13775
  },
13804
13776
  {
13805
- "name": "detail",
13806
- "optional": true,
13777
+ "kind": "field",
13778
+ "name": "vendor",
13807
13779
  "type": {
13808
- "text": "Record<string, unknown>"
13809
- }
13810
- }
13811
- ],
13812
- "description": "Record a recoverable retry *within* a turn (`turn.retry`, importance `normal`)\n— e.g. one malformed/empty attempt that will be retried, as distinct from the\nfinal attempt that bails out as a `turn.error`. Include `attempt`/`maxAttempts`\nin `detail` so the timeline shows which try this was."
13813
- },
13814
- {
13815
- "kind": "function",
13816
- "name": "getMetaEvents",
13817
- "return": {
13818
- "type": {
13819
- "text": "ReadonlyArray<MetaEvent>"
13820
- }
13821
- },
13822
- "parameters": [
13780
+ "text": "AITierVendor"
13781
+ },
13782
+ "readonly": true
13783
+ },
13823
13784
  {
13824
- "name": "key",
13785
+ "kind": "field",
13786
+ "name": "vendors",
13825
13787
  "type": {
13826
- "text": "string"
13827
- }
13828
- }
13829
- ],
13830
- "description": "Returns the meta-event timeline for `key`, or an empty array if none recorded."
13831
- },
13832
- {
13833
- "kind": "function",
13834
- "name": "mergeMetaEvents",
13835
- "return": {
13836
- "type": {
13837
- "text": "void"
13838
- }
13839
- },
13840
- "parameters": [
13788
+ "text": "readonly AITierVendor[]"
13789
+ },
13790
+ "description": "The vendors it can switch between now: `vendors` as constructed, unless\nTieredAIProviderSwitcher.setAvailableVendors has narrowed them since.",
13791
+ "readonly": true
13792
+ },
13841
13793
  {
13842
- "name": "targetKey",
13843
- "type": {
13844
- "text": "string"
13845
- }
13794
+ "kind": "method",
13795
+ "name": "setAvailableVendors",
13796
+ "return": {
13797
+ "type": {
13798
+ "text": "void"
13799
+ }
13800
+ },
13801
+ "parameters": [
13802
+ {
13803
+ "name": "vendors",
13804
+ "type": {
13805
+ "text": "readonly string[]"
13806
+ }
13807
+ },
13808
+ {
13809
+ "name": "active",
13810
+ "optional": true,
13811
+ "type": {
13812
+ "text": "string"
13813
+ }
13814
+ }
13815
+ ],
13816
+ "description": "Change which vendors are available, within the ones it was constructed with, and optionally\nwhich one is active — in one registry rebuild."
13846
13817
  },
13847
13818
  {
13848
- "name": "events",
13849
- "type": {
13850
- "text": "readonly MetaEvent[]"
13851
- }
13819
+ "kind": "method",
13820
+ "name": "switchTo",
13821
+ "return": {
13822
+ "type": {
13823
+ "text": "void"
13824
+ }
13825
+ },
13826
+ "parameters": [
13827
+ {
13828
+ "name": "vendor",
13829
+ "type": {
13830
+ "text": "string"
13831
+ }
13832
+ }
13833
+ ],
13834
+ "description": "A user-driven switch: move the registry, then tell the app so it can persist the choice.\nAn unknown vendor is ignored."
13835
+ },
13836
+ {
13837
+ "kind": "method",
13838
+ "name": "adoptPersistedVendor",
13839
+ "return": {
13840
+ "type": {
13841
+ "text": "void"
13842
+ }
13843
+ },
13844
+ "parameters": [
13845
+ {
13846
+ "name": "vendor",
13847
+ "type": {
13848
+ "text": "string"
13849
+ }
13850
+ }
13851
+ ],
13852
+ "description": "Adopt a vendor the app read back from its own store — the same registry move as\nTieredAIProviderSwitcher.switchTo, without the `onSwitch` callback, because this\nvalue came FROM the store and writing it back would be a pointless round-trip on load.\n\nExists because registration has to stay synchronous: an element that connects before the\ntoken is registered caches the platform's no-op fallback, so an app cannot await its\nstored preference before constructing this. It boots on `initialVendor` and adopts the\nstored one a moment later, through a registry that is mutable and held by reference."
13853
+ },
13854
+ {
13855
+ "kind": "method",
13856
+ "name": "subscribe",
13857
+ "return": {
13858
+ "type": {
13859
+ "text": "() => void"
13860
+ }
13861
+ },
13862
+ "parameters": [
13863
+ {
13864
+ "name": "listener",
13865
+ "type": {
13866
+ "text": "(vendor: string) => void"
13867
+ }
13868
+ }
13869
+ ]
13870
+ },
13871
+ {
13872
+ "kind": "method",
13873
+ "name": "apply",
13874
+ "privacy": "private",
13875
+ "return": {
13876
+ "type": {
13877
+ "text": "void"
13878
+ }
13879
+ },
13880
+ "parameters": [
13881
+ {
13882
+ "name": "vendor",
13883
+ "type": {
13884
+ "text": "AITierVendor"
13885
+ }
13886
+ }
13887
+ ],
13888
+ "description": "The registry move both entry points share, and nothing else."
13889
+ },
13890
+ {
13891
+ "kind": "method",
13892
+ "name": "build",
13893
+ "privacy": "private",
13894
+ "return": {
13895
+ "type": {
13896
+ "text": "Record<string, AIProvider>"
13897
+ }
13898
+ },
13899
+ "parameters": [
13900
+ {
13901
+ "name": "vendor",
13902
+ "type": {
13903
+ "text": "AITierVendor"
13904
+ }
13905
+ }
13906
+ ]
13907
+ },
13908
+ {
13909
+ "kind": "method",
13910
+ "name": "isKnownVendor",
13911
+ "privacy": "private",
13912
+ "return": {
13913
+ "type": {
13914
+ "text": "vendor is AITierVendor"
13915
+ }
13916
+ },
13917
+ "parameters": [
13918
+ {
13919
+ "name": "vendor",
13920
+ "type": {
13921
+ "text": "string"
13922
+ }
13923
+ }
13924
+ ]
13852
13925
  }
13853
- ],
13854
- "description": "Merge pre-built meta events into the timeline for `targetKey`, **preserving each\nevent's original `timestamp`** (so it interleaves chronologically on export)\nwhile re-indexing onto the target buffer's monotonic counter. Used to fold a\nsub-agent's harvested events into the parent session — see\n`ChatDriver.invokeSubAgent`. Unlike recordMetaEvent it does not stamp a\nfresh timestamp; the same non-`high` eviction policy is applied once after the\nbatch so the buffer stays bounded."
13926
+ ]
13855
13927
  },
13856
13928
  {
13857
13929
  "kind": "function",
13858
- "name": "clearSession",
13930
+ "name": "registerTieredAIProviders",
13859
13931
  "return": {
13860
13932
  "type": {
13861
- "text": "void"
13933
+ "text": "TieredAIProviderSwitcher"
13862
13934
  }
13863
13935
  },
13864
13936
  "parameters": [
13865
13937
  {
13866
- "name": "key",
13938
+ "name": "container",
13867
13939
  "type": {
13868
- "text": "string"
13940
+ "text": "Container"
13941
+ }
13942
+ },
13943
+ {
13944
+ "name": "options",
13945
+ "type": {
13946
+ "text": "Omit<TieredAIProviderSwitcherOptions, 'container'>"
13869
13947
  }
13870
13948
  }
13871
13949
  ],
13872
- "description": "Drop the entire timeline for `key`. Used to discard a sub-agent's transient\nper-invocation session once its events have been harvested into the parent, so\nthe module registry doesn't accumulate one orphaned bucket per sub-agent run."
13873
- },
13874
- {
13875
- "kind": "variable",
13876
- "name": "DEBUG_LOG_README",
13877
- "type": {
13878
- "text": "readonly string[]"
13879
- },
13880
- "default": "[\n 'This is an exported debug log for the Genesis AI assistant. Read it top-to-bottom.',\n \"`sessionUsage` is what this session spent: `costUsd` (USD, provider-reported per request and summed, cache discounts already applied) plus the four TOKEN BUCKETS — `uncachedInputTokens`, `cacheReadTokens`, `cacheWriteTokens`, `outputTokens`. Those four are disjoint and safe to add up for a total-tokens figure; the per-message fields further down are NOT (see kind:'message'). Each bucket bills at a different rate — cache reads a fraction of uncached input, cache writes a premium, output highest — so a big token count against a small cost means the prompt was mostly cache hits, not a missing charge. It covers sub-agent turns and spend a compaction banked, so for the CONVERSATION it is the authoritative total: prefer it over re-summing the timeline, which can be short by whatever the ring buffers evicted. The same figures appear under `meta.context`. It is as current as the snapshot it came from: the assistant's own download stamps a fresh one, but a log stitched by another tool can carry an older one — compare `meta.timestamp` with the last timeline entry, and if it is well behind, read these totals as historical and fall back to summing the timeline. One scope caveat: it is derived from the transcript, so it excludes billed calls that produced no message (a blank or refused attempt that was retried — see kind:'turn'.`usage`). Summing the turns can therefore come out HIGHER than this, and the difference is exactly that discarded spend, not a double-count.\",\n \"What 'session' means for those figures: the CURRENT conversation under this session key (a host-supplied per-project id, or the element id + header title when the host supplies none) — which is not necessarily everything in `timeline`. It is re-derived from the live transcript, so it spans page loads only when the chat is being remembered, and a Clear resets it to zero. `timeline` is append-only regardless: it keeps every page load and the pre-Clear conversation, with the session.cleared event as the boundary. So on a long-lived log, read these totals as the latest conversation's and the earlier sections as history — not as a total of the whole file.\",\n '`timeline` is the entire session as one array, already sorted chronologically by `timestamp` (ISO 8601). Every entry has a `kind`.',\n 'Timestamps are millisecond-resolution; entries that share the same millisecond are ordered by a fixed kind rank (event, then turn, then message), which is a heuristic and may not reflect exact causal order within that millisecond — e.g. a user message and the turn it triggered, or a final assistant message and its turn.end event, can appear in either order depending on whether they landed in the same millisecond. Read the logical structure of a turn rather than over-interpreting the micro-ordering of co-timestamped entries of different kinds.',\n \"kind:'message' — the conversation. `role` is user/assistant/tool/system-event/synthetic-user; `agentName` says which agent produced it; `toolCalls`/`toolResult`/`interaction` carry tool and widget activity; `inputTokens`/`outputTokens`/`cost` are per-message LLM usage, where `inputTokens` is the WHOLE prompt for that request and `cacheReadTokens`/`cacheWriteTokens` BREAK IT DOWN rather than add to it — uncached input is `inputTokens` minus those two, and adding the cache fields to `inputTokens` counts the prompt twice. The cache fields are absent on providers that report no cache split (Gemini reports reads only, since implicit caching bills no write) and on messages persisted before they existed, so read them as 0 when missing. Each bucket bills at a different rate — cache reads a fraction of uncached input, cache writes a premium, output highest — so a large token count at a small cost means the prompt was mostly cache hits. `externalCostUsd` is any non-LLM cost a widget reported for its own external service calls (folded into the session cost total alongside `cost`). On model-produced assistant messages, `model` is the concrete model id that generated it (e.g. 'gemini-2.5-flash-lite') and `providerName` is the registry slot it resolved under (e.g. a tier name like 'high'/'low', or the default); together they attribute the message — and any tool calls it carries — to an exact model even across a mid-session vendor/tier switch, where one slot name can map to different models before and after the switch. Both are undefined on any entry that is NOT an LLM response: non-assistant roles (user/tool/system-event) and 'synthetic-user' echoes; assistant interaction/widget entries (empty content carrying an `interaction` — a rendered widget, not a model turn); driver-authored assistant fallbacks (the timeout, repeated-malformed-call, and empty-response apology messages); and messages restored from a session persisted before these fields existed. One partial case: on a genuine model turn whose provider exposes no `getStatus` (or reports no model), `providerName` is still set but `model` alone is undefined. A 'synthetic-user' message is a display-only echo of an interaction outcome (e.g. the answer a widget reported): it renders on the user's side of the chat and `agentName` is the agent that created it, but it is never sent to the LLM — so it has no matching 'turn' and the model learns the outcome only from the corresponding tool result. An echo of an answer an interceptor (such as an autopilot) gave is NOT synthetic-user: see the delegated-messages paragraph.\",\n 'The autopilot (GENC-1660) runs on a driver of its own, and everything it did is harvested into this log: entries with delegate: autopilot and an agentName ending in › Autopilot are its turns (the decision message it was sent is the user message of its turn, so what it was shown is there verbatim; its systemPrompt is its grounding, such as the brief), its tool calls (widget_read, widget_act, hand_back, any read-only tools of its own, and its widget tools — reads with parameters that a widget type declares, routed to the interaction of that type being decided and refused with a reason when none is, offered on every decision so its tool list never changes; while one is open its tail starts with a line naming them) and their results (a read, view or widget tool, is capped at about 20,000 characters, cut with a note asking for less, and leaves its history at the end of the decision as a one-line note), and its own events. Its cost is already in the session total: it is booked as externalCostUsd on the interaction each decision answered, or, for a written question it answered, on the user message it sent on the user behalf (delegate: autopilot), so do not add its turns to that total. Spend that reached no message is recorded as autopilot.cost-dropped instead.',\n \"Delegated messages (GENC-1660): a message with a `delegate` field was written or sent ON THE USER'S BEHALF by a driver decorator, and `delegate` names it (e.g. autopilot). The platform stamps it; nothing else can. It renders as the assistant whatever its role. A delegated `user` message was NOT typed by the user: it is an answer given on their behalf, and the model read it with `delegateFraming` in brackets in front of the content (the stored `content` is the bare text). A delegated `assistant` message is display-only (`excludeFromProvider`): the decorator's narration note, or, when its answer carried no note, the widget's own echo of the answer (its `userMessage`), shown as the assistant and never as the person. A widget answer a decorator gave with a note is not echoed at all: the note already says what was chosen. To tell what the person decided from what was decided for them, read `interaction.answeredBy` and these fields, never the role alone. Driver notes: a `user` message with a `driverNote` field was written by the driver for the model, never by the user, and is hidden from the transcript; `driverNote: 'finish-guard'` is the agent's finishGuard holding the turn open after a prose reply, its content the guard's note in a `<system-reminder>`, and it follows a turn.finish-guard event; `driverNote: 'completion-nudge'` is the driver asking a sub-agent that replied in prose to call its completion tool; `driverNote: 'forced-tool-nudge'` is the driver asking a parent agent for the tool call its forced turn required, after a model that rejects forcing (responseMeta.toolChoiceDowngraded) replied in prose.\",\n \"Sub-agent messages appear inline. When a tool delegates to a sub-agent (via `requestSubAgent`), the sub-agent's whole conversation — its own assistant/tool messages, each with their own `content`/`thinking`/`toolCalls`/`toolResult` and per-message `model`/`providerName`/`inputTokens`/`outputTokens`/`cacheReadTokens`/`cacheWriteTokens`/`cost` — is hoisted into the timeline as ordinary kind:'message' entries, interleaved by timestamp right after the tool call that spawned them (so you read the delegation top-to-bottom). A hoisted entry is marked: `subAgentDepth` is its delegation depth (1 for a sub-agent, 2 for a sub-agent's sub-agent, …), `subAgentOf` is the id of the parent tool call that spawned it (correlates it back even when two sub-agents run in one parent turn), `subAgentName` is the sub-agent's own name, and `agentName` is rewritten to a `\\\"<parent> › <sub-agent>\\\"` breadcrumb (composing when nested, e.g. `\\\"UI Builder › Planner › Grounding\\\"`). The sub-agent's per-LLM-call snapshots also surface as kind:'turn' entries with a `<parentTurn>-<subAgentNo>.<childTurn>` `turnIndex` (see the kind:'turn' paragraph), and subagent.started/completed (or subagent.failed) events bracket the run. Per-message `cost` on hoisted entries is already part of the session total (it is summed from the un-flattened history), so summing the top-level timeline does NOT double-count.\",\n \"kind:'turn' — one LLM call. `turnIndex` is a string: a top-level turn is the bare counter ('0', '1', …); a sub-agent's turns are labelled '<parentTurn>-<subAgentNo>.<childTurn>': the parent turn that activated it, the sub-agent's number (1-based, in the order the sub-agents started within that parent turn, so it matches the order of the subagent.started events; two sub-agents in one parent turn never share a number, even when they run in parallel or share a name), and the sub-agent's own turn position (1-based) — e.g. '3-2.1', '3-2.2' are the first two turns of the second sub-agent started in parent turn 3, and a sub-agent nested under its turn '3-2.2' contributes '3-2.2-1.1', … ('.' joins the parts of one level, '-' separates levels). The `<parentTurn>-<subAgentNo>` part is the sub-agent's `turnPrefix`: the same value is stamped on its subagent.started/completed/failed events and on its harvested events as `detail.turnPrefix`, so match events to turns by value (a turn belongs to the sub-agent whose `turnPrefix` its `turnIndex` begins with) — and `agentName` names the agent that ran the turn. `systemPrompt` and `toolNames` are what the model saw. A systemPrompt of '<repeated — identical to turn N>' was byte-identical to turn N and de-duplicated; the full prompt is shown whenever it changes (often because a stateful agent advanced), so prompt evolution is visible.\",\n \"kind:'turn'.`model`/`providerName`/`provider` — which model ran that call: the concrete model id, the registry slot it resolved under (a tier name like 'high'/'low', or the default), and the vendor. Recorded per CALL, so an agent whose `provider` selector varies by state — a flow that plans on a high tier and executes on a low one — has every step attributed, including calls that produced no message. `model` is the SERVING model where the provider reports one, so a turn answered by a server-side fallback names the model that answered rather than the one requested; it always matches the `model` on the message that call produced. Absent when the provider exposes no `getStatus` and the transport stamped nothing.\",\n \"kind:'turn'.`usage` — what that ONE call cost, in the same four-bucket + `costUsd` shape as `sessionUsage`. Absent while a call is in flight and on providers that report no usage. This is the SAME money as the message the call produced, not extra money: never add turn usage to message usage, and read a turn plus its message as one charge. Its distinct value is the calls that produced NO message — a blank or refused response is billed and then discarded before the retry, so the turn entry is the only record of that spend, and a turn with `usage` but no message after it is exactly that. `costUsd: 0` alongside a nonzero token count means the provider reported no price, not that the call was free.\",\n \"kind:'turn'.`agentSnapshot` — the active agent's own view of its internal state, captured at that turn. An agent opts into this by exposing a `getDebugSnapshot()` that returns JSON-serializable per-state info; stateful/flow agents wire it automatically, so you can watch a flow advance turn-by-turn (e.g. current step, cursor, collected fields, pending changes). Absent for agents that don't expose one.\",\n \"kind:'event' — a meta/lifecycle event. `type` names it (see below); `detail` carries structured data. `detail.placement` is the emitting UI instance: 'bubble' (collapsed), 'panel' (popped-out), or 'standalone'.\",\n \"Each 'event' also has an `importance`: 'high' (failures/limits — turn.error, tool.failed, subagent.failed, file.read-failed, suggestions.failed, context.threshold-crossed), 'normal' (session flow — connects, turns, retries, handoffs, agent/provider changes, interactions, sub-agent start/complete), or 'low' (skippable UI/bookkeeping noise — panel.toggled, attachment.added, driver.wired/unwired, context.updated, context.condensed). To skim, ignore importance:'low'; to triage a failure, filter to importance:'high' then read the nearby messages and turns. A 'high' turn.error is often preceded by one or more 'normal' turn.retry events for the same reason — read them together to see how many attempts were made before bailing. 'message' and 'turn' entries carry no importance — they are the substance, always read them.\",\n \"Event types: assistant.connected/disconnected (mount + placement + whether the session was created or restored), assistant.popout/popin (window placement), driver.created/wired/unwired (which driver is live and why it stops/starts responding across a popout), state.changed (idle↔loading), turn.start/turn.end (turn boundary; turn.end carries durationMs), turn.retry (a recoverable in-turn retry — detail.reason plus attempt/maxAttempts; for malformed calls also finishMessage; for empty responses also the provider finishReason + thoughtsTokens + parts breakdown), turn.finish-guard (the model replied with no tool call and the agent's finishGuard hook answered — detail.action is continue (the turn was held open: detail.continuation counts the holds this turn and detail.note is the note stored as a hidden user message with driverNote finish-guard, the next message in the log; detail.source: 'completion-nudge' is instead the driver holding a SUB-AGENT's turn open because it replied in prose without calling its completion tool — detail.nudge of detail.maxNudges, the note stored with driverNote completion-nudge — and a sub-agent that still answers in prose after the last nudge fails as before; detail.source: 'forced-tool-nudge' is the driver holding a PARENT agent's forced turn open after a model that rejects forcing answered in prose, the note stored with driverNote forced-tool-nudge, naming the tool when the turn was pinned to one) or end with detail.release: true (the agent was released on a prose answer); a plain end records nothing), turn.error (a turn failed or hit a guardrail — detail.reason is one of exception/malformed-function-call/empty-response/unknown-tool-limit/max-iterations/response-truncated/refusal/budget-exhausted/provider-refused/context-exhausted/ai-service-error, plus reason-specific diagnostics: attempts (for empty-response also finishReason + thoughtsTokens + a parts breakdown, distinguishing a thinking-only STOP from a truly empty turn), finishMessage, for response-truncated the model + maxTokens + outputTokens + tools, unknownTools (split into staleTools — real earlier this activation but retired by the current state or hidden behind an open exclusive fold — and hallucinatedTools — never advertised) + availableTools, iterations + limit, for budget-exhausted the budgetUsd + spentUsd figures reported by the proxy plus the resolved vendor, for provider-refused the kind (spend|auth) plus the upstream status and error type — the vendor refusing the ACCOUNT rather than us refusing to spend, so the remedy is a top-up or a key rotation rather than a raised cap, and the kind is the only place that distinction survives because the user-facing copy is deliberately cause-free, for context-exhausted the estimated contextTokens against the guard that stopped the turn plus the iterations reached — the driver ending a runaway tool loop at the edge of the context window rather than issuing a request the provider would reject, so the transcript survives intact and can still be compacted, for ai-service-error the code (one of AI_SERVICE_ERROR_CODES, e.g. NO_API_KEY) and the status the AI service answered with — its own text goes to the browser console only, or name + message for exceptions), tool.failed (a tool threw), tool.unresolved (the model called a tool that could not be dispatched — detail.kind is folded/fold-hidden/stale/unknown, plus tool + agent and, for the counted kinds, the consecutive streak; or kind pinned-elsewhere, a turn pinned to detail.pinned (toolChoice { tool }) that went out unforced because the model rejects forcing, and whose reply called only detail.tools: none of them was run, each was answered with a refusal naming the pinned tool, detail.nudge of detail.maxNudges, counted against the forced-tool nudge on a parent agent and the completion nudge on a sub-agent; the recurring lead-up to an unknown-tool-limit turn.error), subagent.started/completed/failed (the lifecycle of a `requestSubAgent` delegation — detail.agent names the sub-agent; these bracket the sub-agent turns that appear as kind:turn entries with a `<parentTurn>-<subAgentNo>.<childTurn>` `turnIndex`, where the sub-agent number is the order the sub-agent started in within its parent turn, so it matches the order of the subagent.started events; all three carry detail.turnPrefix, that `<parentTurn>-<subAgentNo>` which the sub-agent's turns' `turnIndex` begins with, so an event and its turns are matched by value; subagent.failed also carries detail.reason, one of max_iterations/malformed_tool_call/empty_response/unknown_tool_limit/timeout/response_truncated/refusal/budget_exhausted/provider_refused/context_exhausted/ai_service_error, and for timeout detail.cause: 'idle' when it was the sub-agent making no progress for `idleTimeoutMs` rather than the overall `timeoutMs` (absent for the latter); budget_exhausted and provider_refused are terminal for the PARENT turn too, and so is ai_service_error when the refusal is about the service rather than the request and came from the vendor the parent calls — the parent stops rather than calling the model again into the same wall; after context_exhausted the parent goes on, but its own next call is likely to stop on the same guard), agent.handoff (routing; from=null is the initial activation), agent.pinned/unpinned (forced routing), routing.decided (ONE PER ROUTING DECISION — see its own paragraph below), provider.selected (the resolved provider for the upcoming turns — detail.provider is the registry SLOT/tier name, detail.model the concrete model behind it and detail.vendor its vendor; emitted only when the slot CHANGES, so read the per-turn `model` for the model of any given call rather than assuming the nearest event still applies), interaction.requested/resolved (blocking user widgets — explain quiet gaps; note that when a sub-agent opens a widget, detail.agent — and the agentName on the interaction message — is the HOST agent that owns the widget, NOT the sub-agent that asked, because widgets render and resolve on the host driver; detail.ownerPath names the agents that actually asked, outermost first, the last being the one whose tool requested it, and detail.heldBy says who held it when it opened: user, or the id of the interceptor that claimed it, such as autopilot; on interaction.resolved, detail.answeredBy is who answered — the claimant id when it settled through its own hold, user for any other answer (a click counts as the person even on a widget a claimant held) — absent when it closed unanswered (a timeout or a stop), and absent too when it settled by itself other than through the hold of a claimant — a widget registered resolvesItself (one that does its work and settles on its own, asking the person nothing, such as a generation run), or one outcome its controller said settled itself (ctx.resolve with resolvedItself, such as a generation phase that failed outright before its review gate ever asked anything) — which then carries detail.resolvedItself: true instead, as the interaction message does — nobody answered it, and the platform cannot tell it finishing from the person interrupting it (a Skip), so only the result of the widget itself can say which; the same value is stamped on the interaction message as answeredBy and on the result the asking tool handler receives (absent there in the same cases), and when it is not user the tool result that interaction returned carries a decidedOnUsersBehalf record, so the model was told the choice was not made by the person; detail.edits, present only when non-zero, counts the editing actions a claimant ran on the widget before it was settled, whoever settled it, and those edits are stamped on the interaction message as edits, each with by, action, choice and args when it had some, in the order they ran, while a decidedOnUsersBehalf record carries their choice texts as edits, and when the person settled it after such edits the tool result carries an editedOnUsersBehalf record instead — the framing and those choice texts — so the model knows the widget was changed on the user behalf before the user answered, and that the user then confirmed it by finishing it), interaction.held (a claimant moved a pending interaction to the person or back to itself — detail.heldBy is the new holder, detail.claimant the interceptor; detail.late: true is an interceptor that declined it when it opened claiming it afterwards, such as the autopilot resumed while it was open; a widget held by anything but user was not answered by the person), interaction.claim-refused (a claim on a userOnly interaction, which stays with the person — detail.claimant + reason), autopilot.* (the autopilot, a decorator that answers interactions on behalf of the user — autopilot.claimed / autopilot.declined say whether it took each interaction and, for a decline, detail.reason: paused, other-flow, no-autopilot, unavailable, userOnly, policy or no-controller; one declined as paused that is still open when the person resumes the autopilot is looked at again, and the autopilot.claimed or autopilot.declined recorded for it then carries detail.onResume: true (a decline then can also be claimed-elsewhere, another interceptor having claimed it first); a restored mode looks at nothing; autopilot.decision-sent is what it was sent (detail.chars; detail.nothingEnabled: true when every action on the widget was unavailable — a gate whose controller said it was asking, such as a failed build the autopilot may not cancel — so it could only hand it back, which it may then do even after the person asked it to decide it itself; a widget whose controller says it is working (ctx.setWorking) is never sent a decision until it says it is asking, even when an action is enabled or the person resumes the autopilot); autopilot.acted is what it did (detail.action, detail.note, detail.finished); autopilot.handed-back is a decision it gave to the person (detail.reason and detail.trigger: model, no-decision or error); autopilot.paused / autopilot.resumed are mode changes (detail.scope, detail.trigger, detail.decideYourself when the person resumed during a hand-back; detail.trigger is restored when the mode came back with the session after a reload, applied once its flow re-activated, which starts nothing by itself); autopilot.carried is the mode, running or paused, going with the task to the agent that took it over, rather than ending with the flow as on any other change of flow owner: to the target of a hand-off, or back to its caller on the hand-back (detail.from, detail.to, detail.mode); a pause the person chose goes with it, and Stop and Clear still end it; a mode restored for the target of a hand-off applies to its caller when the reload hands back; autopilot.error is the wrapper itself failing; autopilot.refinement counts a refining action against its step — a written answer (reply) or a widget action declared refines, such as a regenerate with instructions, counted together (detail.action, detail.stepKey, detail.count, detail.limitReached, after which every refining action is withdrawn for that step: not listed, and refused; the decision and every relisting of its actions say how many are left at the step, as a line Refinements left at this step: N, wherever the widget has a refining action); autopilot.handback-presented is the turn-level hand-back, shown when a working turn ended needing the person with no widget to hand over (detail.why: max-iterations, context-exhausted, failure or question; detail.options; detail.choice once answered); autopilot.catch-up is the autopilot being given the whole visible transcript at once (detail.why: first, for its first decision in a flow or after a reload; size, when its own history passed its budget and was rebuilt short — detail.ownChars; or compacted, when a compaction removed the last message it had seen, so it reads the summary and everything since, short; in each, what it had sent on the user behalf is included and labelled as its own, since its own history does not hold it); autopilot.cost-dropped is autopilot spend that no message carries, so it is NOT in the session total (detail.costUsd and detail.why: handed-back, aborted or stale for a written question it answered that no reply was sent for — stale when a pause, a resume, a new turn or the end of its flow came before the answer landed, which then went nowhere — or no-recorder when the driver had no way to book a decision to its interaction); a hand-back trigger can also be budget (the decision passed its spend cap), watchdog (its work went quiet: no ready surface and no heartbeat, or its own decision stalled with no model call landing, which stops that decision) or detached (the autopilot was removed while it held the interaction, which went to the person with no reason shown). To debug one autopilot decision, follow its interactionId: interaction.requested (heldBy), autopilot.claimed, autopilot.decision-sent, autopilot.acted or autopilot.handed-back, interaction.invoked, interaction.resolved (answeredBy), then the next turn of the working agent), interaction.invoked (a claimant ran one of the actions the widget itself exposes, through its hold, the same code the button runs — detail.claimant, detail.action (an option id, select or reply) and detail.finished, whether that settled the interaction, and when it did not, the run is recorded as an edit; the choice and narration it recorded reach the result of the tool that asked as decidedOnUsersBehalf; the person's own programmatic action, from a host with no DOM to click, carries detail.by: user in place of detail.claimant, and is not recorded as an edit nor as a decision on their behalf, so what it settles is answered by user), interaction.step (a long action run as named steps through runSteps, which survive a reload — detail.step and detail.outcome: started, done, skipped when the step was already done before a reload, or resumed when it started before a reload and runs again with what it saved part-way, such as a job id it re-attaches to), interaction.checkpoint (the checkpoints a conversation keeps for its long actions: the one in flight, and each one a reload cut, held apart until a request of its own widget type takes it over, so a resumed flow that opens other long widgets first, which save their own, loses nothing — detail.action: resumed when a reload cut the work and a request of the same widget type that the registration sameWork agrees is the same work took it over, refused when sameWork said a new request is different work (detail.saved is the identity it kept; detail.kept: true, since it stays for a later request of that type, and is offered to every one until one agrees) or when runSteps found the handed-over checkpoint malformed and started fresh (detail.reason, detail.saved), or cleared when its flow ended, once per checkpoint, with detail.cut: true for one a reload cut that nothing took over), context.updated/threshold-crossed (token + cost), headless.attached (a HeadlessSession attached, for a host that drives the assistant with no screen — detail.label, what the host called itself, when it gave one) and headless.raw-resolved (that host settled an interaction raw, bypassing the widget's own actions: detail.interactionId and detail.component; the result went to the tool as given, so check what the widget would have enforced), context.condensed (a stale tool payload was collapsed out of the model-bound history by a `condenseWhen` declaration on the tool — detail.tool + toolCallId, target args|response, trigger (superseded:<key> or age:<n>), stubLen, and an estimated tokensSaved; stored history and this log keep the FULL payload, so the model-visible slice at any point is the full history minus the condensations recorded up to then), panel.toggled, attachment.added, file.read-failed, suggestions.failed.\",\n 'Sub-agent meta events: a sub-agent\\'s own turn.retry/turn.error/tool.failed/tool.unresolved/turn.finish-guard events are merged into this same timeline, tagged with `detail.subAgent` — a `\"<parent> › <sub-agent>\"` breadcrumb that composes when nested (e.g. `\"UI Builder › Planner › Grounding\"`) — and interleaved by their original timestamps within the subagent.started→completed/failed bracket; each also carries `detail.turnPrefix`, the `<parentTurn>-<subAgentNo>` that the `turnIndex` of its own sub-agent turns begins with (an event of a nested sub-agent gets the composed prefix, e.g. 3-2.2-1), so a retry or failure is matched to the turns it happened in by value. These are the per-attempt/per-failure signals that do NOT appear among the sub-agent\\'s (hoisted) messages: a malformed/empty attempt that gets retried produces no message, and the stale-vs-hallucinated split and streak counts live only on the event. A sub-agent\\'s high-volume, message-derivable events (turn.start/turn.end, provider.selected, context.updated) are intentionally NOT merged — read its hoisted messages for model/tokens/cost and turn-by-turn activity, and the bracketing subagent.* events for the run\\'s span.',\n \"`meta` holds context captured at export time: agentSummary (full agent configs), context (active model, contextTokens/contextLimit/contextUsagePercent for the last call, and the session totals — sessionCostUsd, sessionTokensConsumed, and the four-bucket sessionUsage lifted to the top of this log), activeDebugSnapshot (the active agent's `getDebugSnapshot()` taken fresh at export — reflects state NOW, which may have advanced beyond the last turn's agentSnapshot), debug (optional host-supplied debug state), host, and the export timestamp.\",\n 'Note the two different scopes in `meta.context`: `contextTokens` is the prompt size of the LAST call (against `contextLimit`, the model context window), while `sessionUsage`/`sessionTokensConsumed` are cumulative BILLED throughput. Every turn resends the conversation, so the cumulative figure counts each turn’s prompt again in the next turn’s and is expected to dwarf the context size — that is not double-counting.',\n \"kind:'event' type 'routing.decided' — how ONE user turn was routed, emitted by the orchestrating driver before the agent runs. Only a user turn is routed: a hand-off names its target, so the agents a hand-off runs show up as agent.handoff events, not as more routing.decided. `decision` is why that agent was chosen: 'classified' (the classifier ran and picked one), 'no-match' (it ran and answered -1 — nothing listed covers the request), 'pinned' (a user pin, an agent named for that one message by the send's `agent` option, or an active stateful flow owned the turn, so no call was made), 'single-candidate'/'no-specialists' (configuration left nothing to decide), 'provider-unavailable' (the registry default exposes no chat()), 'classifier-failed' (every attempt threw — `error` carries the last one). `to` names the agent and `fallback` says whether that agent is the fallback. `candidates` is what was ON THE BALLOT — every classifier-eligible specialist — in ballot order, so `index` — the classifier's own answer — indexes it directly. `candidates` is absent on the three decisions that put nothing to a vote — 'pinned', 'single-candidate', 'no-specialists'. It IS present on 'provider-unavailable', which is not an exception worth removing: the ballot was built there, it simply never got sent. `attempts` covers the retry ladder. `durationMs` is on EVERY routing.decided, and is the field to read when a decision looks wrong: the decisions that can reach the fallback ('no-match', 'no-specialists', 'provider-unavailable', 'classifier-failed') are told apart by the clock as much as by their name, because a fallback routing that resolved in tens of milliseconds made no network call at all whatever its `decision` says.\",\n \"kind:'event' type 'routing.decided'.`usage` — what that classifier call cost, in the same four-bucket + costUsd shape as `sessionUsage`, plus `model`. Absent on the decisions that make no call (see 'pinned' and the configuration ones). THIS SPEND IS NOT IN `sessionUsage`: a classifier call never enters the transcript and `sessionUsage` is derived from the transcript, so classifier cost is missing from the session total by construction, not by accident. Sum these events to close that gap — it is the one component of a session's real spend that the totals cannot see.\",\n 'To debug a failure: find the last turn.error or tool.failed, then read upward for the user message, the turn(s), and the agent/provider/state events that led into it. For a turn that went to the wrong agent, read its routing.decided first — `decision` says whether anything was actually asked.',\n]",
13881
- "description": "Human/agent-facing guide emitted as the first key of the exported debug log,\nso whoever opens the JSON (often an AI agent) knows how to read it without\nreverse-engineering the shape. Kept here next to the event catalogue it\ndescribes — but proximity alone demonstrably did NOT keep the two in sync\n(`refusal` was missing from both reason lists for a whole release), so\n`debug-event-log.test.ts` now asserts that every `TurnFailureReason` and every\n`SubAgentFailureReason` is named here, and fails the build when one is added\nwithout a matching sentence. Enumerations below read as exhaustive and WILL be\ntrusted by an agent reading the JSON — keep them so."
13950
+ "description": "Build a TieredAIProviderSwitcher — which registers the tier-shaped provider\nregistry — and put it on the (AIProviderSwitcher:variable) token. Call once at app\nbootstrap."
13882
13951
  }
13883
13952
  ],
13884
13953
  "exports": [
13885
13954
  {
13886
13955
  "kind": "js",
13887
- "name": "META_EVENT_IMPORTANCE",
13888
- "declaration": {
13889
- "name": "META_EVENT_IMPORTANCE",
13890
- "module": "src/state/debug-event-log.ts"
13891
- }
13892
- },
13893
- {
13894
- "kind": "js",
13895
- "name": "recordMetaEvent",
13956
+ "name": "TieredAIProviderSwitcher",
13896
13957
  "declaration": {
13897
- "name": "recordMetaEvent",
13898
- "module": "src/state/debug-event-log.ts"
13958
+ "name": "TieredAIProviderSwitcher",
13959
+ "module": "src/provider/tiered-provider-switcher.ts"
13899
13960
  }
13900
13961
  },
13901
13962
  {
13902
13963
  "kind": "js",
13903
- "name": "TurnFailureReason",
13964
+ "name": "registerTieredAIProviders",
13904
13965
  "declaration": {
13905
- "name": "TurnFailureReason",
13906
- "module": "src/state/debug-event-log.ts"
13966
+ "name": "registerTieredAIProviders",
13967
+ "module": "src/provider/tiered-provider-switcher.ts"
13907
13968
  }
13908
- },
13969
+ }
13970
+ ]
13971
+ },
13972
+ {
13973
+ "kind": "javascript-module",
13974
+ "path": "src/state/ai-assistant-slice.ts",
13975
+ "declarations": [
13909
13976
  {
13910
- "kind": "js",
13911
- "name": "recordTurnError",
13912
- "declaration": {
13913
- "name": "recordTurnError",
13914
- "module": "src/state/debug-event-log.ts"
13915
- }
13977
+ "kind": "function",
13978
+ "name": "createDefaultSessionState",
13979
+ "return": {
13980
+ "type": {
13981
+ "text": "AiAssistantSessionState"
13982
+ }
13983
+ },
13984
+ "description": "Build a fresh default session state. A factory (not just a shared const) so\neach call returns independent collections — `resetSession` can hand back a\nclean slate without aliasing the initial state's arrays."
13916
13985
  },
13917
13986
  {
13918
- "kind": "js",
13919
- "name": "recordTurnRetry",
13920
- "declaration": {
13921
- "name": "recordTurnRetry",
13922
- "module": "src/state/debug-event-log.ts"
13987
+ "kind": "variable",
13988
+ "name": "defaultSessionState",
13989
+ "type": {
13990
+ "text": "AiAssistantSessionState"
13923
13991
  }
13924
13992
  },
13925
13993
  {
13926
- "kind": "js",
13927
- "name": "getMetaEvents",
13928
- "declaration": {
13929
- "name": "getMetaEvents",
13930
- "module": "src/state/debug-event-log.ts"
13931
- }
13932
- },
13994
+ "kind": "variable",
13995
+ "name": "aiAssistantSlice"
13996
+ }
13997
+ ],
13998
+ "exports": [
13933
13999
  {
13934
14000
  "kind": "js",
13935
- "name": "mergeMetaEvents",
14001
+ "name": "createDefaultSessionState",
13936
14002
  "declaration": {
13937
- "name": "mergeMetaEvents",
13938
- "module": "src/state/debug-event-log.ts"
14003
+ "name": "createDefaultSessionState",
14004
+ "module": "src/state/ai-assistant-slice.ts"
13939
14005
  }
13940
14006
  },
13941
14007
  {
13942
14008
  "kind": "js",
13943
- "name": "clearSession",
14009
+ "name": "defaultSessionState",
13944
14010
  "declaration": {
13945
- "name": "clearSession",
13946
- "module": "src/state/debug-event-log.ts"
14011
+ "name": "defaultSessionState",
14012
+ "module": "src/state/ai-assistant-slice.ts"
13947
14013
  }
13948
14014
  },
13949
14015
  {
13950
14016
  "kind": "js",
13951
- "name": "DEBUG_LOG_README",
14017
+ "name": "aiAssistantSlice",
13952
14018
  "declaration": {
13953
- "name": "DEBUG_LOG_README",
13954
- "module": "src/state/debug-event-log.ts"
14019
+ "name": "aiAssistantSlice",
14020
+ "module": "src/state/ai-assistant-slice.ts"
13955
14021
  }
13956
14022
  }
13957
14023
  ]
13958
14024
  },
13959
14025
  {
13960
14026
  "kind": "javascript-module",
13961
- "path": "src/state/decision-surface.ts",
14027
+ "path": "src/state/debug-event-log.ts",
13962
14028
  "declarations": [
13963
14029
  {
13964
14030
  "kind": "variable",
13965
- "name": "SELECT_ACTION",
13966
- "type": {
13967
- "text": "string"
13968
- },
13969
- "default": "'select'",
13970
- "description": "The `select` action a multi-select adds. Platform-owned, so never an option's id."
13971
- },
13972
- {
13973
- "kind": "variable",
13974
- "name": "REPLY_ACTION",
13975
- "type": {
13976
- "text": "string"
13977
- },
13978
- "default": "'reply'",
13979
- "description": "The `reply` action `freeText` adds. Platform-owned, so never an option's id."
13980
- },
13981
- {
13982
- "kind": "variable",
13983
- "name": "GENERIC_UNAVAILABLE",
14031
+ "name": "META_EVENT_IMPORTANCE",
13984
14032
  "type": {
13985
- "text": "string"
14033
+ "text": "Record<MetaEventType, MetaEventImportance>"
13986
14034
  },
13987
- "default": "'not available in this state'",
13988
- "description": "What an unavailable thing says when its guard gives no reason (an empty one, or a throw)."
14035
+ "default": "{\n 'turn.error': 'high',\n 'tool.failed': 'high',\n 'subagent.failed': 'high',\n 'file.read-failed': 'high',\n 'suggestions.failed': 'high',\n 'context.threshold-crossed': 'high',\n 'context.compacted': 'high',\n 'persistence.restore-orphan': 'high',\n // A save that did not land is silent data loss in progress: the transcript on screen\n // is no longer backed by the store, and every later turn widens the gap. GENC-1511.\n 'persistence.save-failed': 'high',\n\n 'assistant.connected': 'normal',\n 'assistant.disconnected': 'normal',\n 'assistant.popout': 'normal',\n 'assistant.popin': 'normal',\n 'driver.created': 'normal',\n 'state.changed': 'normal',\n 'turn.start': 'normal',\n 'turn.end': 'normal',\n 'turn.retry': 'normal',\n 'turn.finish-guard': 'normal',\n 'tool.unresolved': 'normal',\n 'subagent.started': 'normal',\n 'subagent.completed': 'normal',\n // One per routing decision, with what the classifier answered and what the call cost. Same\n // level as the handoff it produces: you read them together to follow how a turn was routed.\n 'routing.decided': 'normal',\n 'agent.handoff': 'normal',\n 'agent.pinned': 'normal',\n 'agent.unpinned': 'normal',\n 'provider.selected': 'normal',\n 'interaction.requested': 'normal',\n 'interaction.resolved': 'normal',\n // Bookkeeping about an already-finished turn; interesting when reconciling a session total.\n 'interaction.external-cost': 'normal',\n // Spend that was billed but could NOT be recorded (the message was trimmed/condensed away, or\n // the value was not real spend). 'high': it is the one way the session total goes quietly\n // wrong, so it must stand out when reconciling.\n 'interaction.external-cost-dropped': 'high',\n // What came of an answer, recorded by the tool that asked (see recordInteractionOutcome).\n 'interaction.outcome': 'normal',\n // An outcome that could not be recorded: the widget goes on showing only the answer.\n 'interaction.outcome-dropped': 'high',\n // A long action's step starting, finishing, or skipped on resume because it was already done.\n 'interaction.step': 'low',\n // A cut checkpoint taken over after a reload, refused (by sameWork, and kept for a later request;\n // or as malformed), or dropped at flow end, as is the live one.\n 'interaction.checkpoint': 'normal',\n // A claimant handing a pending interaction to the person, or taking it back.\n 'interaction.held': 'normal',\n // A claim on a `userOnly` interaction, refused. Expected when an interceptor claims broadly.\n 'interaction.claim-refused': 'low',\n // A claimant ran one of the surface's actions: what it did, and whether that settled it.\n 'interaction.invoked': 'normal',\n 'autopilot.claimed': 'normal',\n // One per interaction the autopilot does not take, so frequent and mostly expected.\n 'autopilot.declined': 'low',\n 'autopilot.decision-sent': 'low',\n 'autopilot.acted': 'normal',\n 'autopilot.handed-back': 'normal',\n 'autopilot.paused': 'normal',\n 'autopilot.resumed': 'normal',\n // The mode went with the task across a hand-off or its hand-back, rather than ending with the flow.\n 'autopilot.carried': 'normal',\n // The wrapper itself failed: the journey stops being automatic without anyone choosing that.\n 'autopilot.error': 'high',\n // A written answer counted against the step's limit; reaching it withdraws `reply`.\n 'autopilot.refinement': 'normal',\n // The autopilot showed its own widget because a working turn ended needing the person.\n 'autopilot.handback-presented': 'normal',\n // The autopilot was given the whole visible transcript: its first decision, a rebuild, or after\n // a compaction removed the last message it saw.\n 'autopilot.catch-up': 'normal',\n // Autopilot spend that reached no message, so it is missing from the session total.\n 'autopilot.cost-dropped': 'high',\n // A headless session attached to the driver: from here a host with no screen is the person.\n 'headless.attached': 'normal',\n // The host settled an interaction raw, without the widget's own actions: its result went to the\n // tool as given, unchecked by anything the widget would have enforced.\n 'headless.raw-resolved': 'normal',\n 'external-diagnostics.folded': 'normal',\n 'session.cleared': 'normal',\n 'session.switched': 'low',\n 'session.switch-deferred': 'low',\n 'persistence.restored': 'normal',\n // Whether a restored flow will be re-activated and resumed (GENC-1662), and how much the trim cut.\n 'persistence.resume-planned': 'normal',\n // A planned resume that did not run, and why (GENC-1662) — the divider was put back to plain.\n 'persistence.resume-withdrawn': 'normal',\n 'persistence.suppressed': 'normal',\n 'persistence.not-resumable': 'normal',\n\n 'driver.wired': 'low',\n 'driver.unwired': 'low',\n 'context.updated': 'low',\n 'context.condensed': 'low',\n 'panel.toggled': 'low',\n 'persistence.toggled': 'low',\n 'persistence.saved': 'low',\n 'attachment.added': 'low',\n}",
14036
+ "description": "Importance is intrinsic to the event *type*, not the instance, so it's\ndefined once here and stamped automatically by recordMetaEvent — call\nsites never pass it. The `Record` is exhaustive: adding a `MetaEventType`\nwithout a level here is a compile error.\n\n- `high` — failures and hard limits you almost always want to see.\n- `normal` — meaningful session flow you read to follow what happened.\n- `low` — frequent UI / bookkeeping noise, usually safe to skip."
13989
14037
  },
13990
14038
  {
13991
14039
  "kind": "function",
13992
- "name": "unavailableReason",
14040
+ "name": "recordMetaEvent",
13993
14041
  "return": {
13994
14042
  "type": {
13995
- "text": "string | undefined"
14043
+ "text": "void"
13996
14044
  }
13997
14045
  },
13998
14046
  "parameters": [
13999
14047
  {
14000
- "name": "guard",
14048
+ "name": "key",
14001
14049
  "type": {
14002
- "text": "((...args: A) => string | undefined) | undefined"
14050
+ "text": "string"
14003
14051
  }
14004
14052
  },
14005
14053
  {
14006
- "name": "args",
14054
+ "name": "type",
14007
14055
  "type": {
14008
- "text": "A"
14056
+ "text": "MetaEventType"
14057
+ }
14058
+ },
14059
+ {
14060
+ "name": "detail",
14061
+ "optional": true,
14062
+ "type": {
14063
+ "text": "Record<string, unknown>"
14009
14064
  }
14010
14065
  }
14011
14066
  ],
14012
- "description": "Why something cannot be used right now, from its `unavailable` guard, or `undefined` when it can\n(GENC-1660). One rule for options, actions and widget tools: absent means available; an empty\nreason, or a guard that throws, counts as unavailable with a generic reason, since a guard that\ncannot say why cannot vouch for its button either."
14067
+ "description": "Append a meta event to the timeline for `key`. Once the buffer exceeds\nDEFAULT_MAX_META_EVENTS, evicts the oldest *non-`high`* event;\n`high`-importance events are never evicted. An empty `key` is bucketed under\n`''`, matching how drivers/stores handle an absent session identity, so\ncallers never need to guard."
14013
14068
  },
14014
14069
  {
14015
14070
  "kind": "function",
14016
- "name": "buildDecisionSurface",
14071
+ "name": "recordTurnError",
14017
14072
  "return": {
14018
14073
  "type": {
14019
- "text": "DecisionSurface"
14074
+ "text": "void"
14020
14075
  }
14021
14076
  },
14022
14077
  "parameters": [
14023
14078
  {
14024
- "name": "spec",
14079
+ "name": "key",
14025
14080
  "type": {
14026
- "text": "DecisionSpec"
14081
+ "text": "string"
14082
+ }
14083
+ },
14084
+ {
14085
+ "name": "reason",
14086
+ "type": {
14087
+ "text": "TurnFailureReason"
14088
+ }
14089
+ },
14090
+ {
14091
+ "name": "detail",
14092
+ "optional": true,
14093
+ "type": {
14094
+ "text": "Record<string, unknown>"
14027
14095
  }
14028
14096
  }
14029
14097
  ],
14030
- "description": "Build the surface for a short-form decision (GENC-1660). Its actions are its options (by id),\nplus `select` for a multi-select and `reply` for a written answer; all of them finish. A spec's\nown `actions` follow them, run as a full-form surface's are (and editing unless they say\notherwise); they do not count towards readiness. Its views, if it has any, are read by name. Every read — facts, views, actions, enabled-ness — is taken\nfresh, so the surface always describes the widget as it is now.\n\nThrows if an option's id collides with another or with a platform-owned name, or an extra action\ndoes, which is a bug in the widget rather than something to recover from."
14098
+ "description": "Record a turn-ending failure (`turn.error`, importance `high`). The `reason`\nis typed so the high-importance triage surface stays consistent; pass any\ndiagnostic specifics (attempt counts, offending tool names, etc.) in `detail`."
14031
14099
  },
14032
14100
  {
14033
14101
  "kind": "function",
14034
- "name": "checkArgs",
14102
+ "name": "recordTurnRetry",
14035
14103
  "return": {
14036
14104
  "type": {
14037
- "text": "string | undefined"
14105
+ "text": "void"
14038
14106
  }
14039
14107
  },
14040
14108
  "parameters": [
14041
14109
  {
14042
- "name": "args",
14110
+ "name": "key",
14043
14111
  "type": {
14044
- "text": "unknown"
14112
+ "text": "string"
14045
14113
  }
14046
14114
  },
14047
14115
  {
14048
- "name": "schema",
14116
+ "name": "reason",
14049
14117
  "type": {
14050
- "text": "Readonly<Record<string, unknown>> | undefined"
14118
+ "text": "TurnFailureReason"
14119
+ }
14120
+ },
14121
+ {
14122
+ "name": "detail",
14123
+ "optional": true,
14124
+ "type": {
14125
+ "text": "Record<string, unknown>"
14051
14126
  }
14052
14127
  }
14053
14128
  ],
14054
- "description": "Check `args` against an action's schema: an object, with its `required` properties present and\neach listed property of its declared top-level `type`. Deliberately shallow — enough to refuse a\nmalformed call with a reason the model can act on, without a schema library in the browser."
14129
+ "description": "Record a recoverable retry *within* a turn (`turn.retry`, importance `normal`)\n— e.g. one malformed/empty attempt that will be retried, as distinct from the\nfinal attempt that bails out as a `turn.error`. Include `attempt`/`maxAttempts`\nin `detail` so the timeline shows which try this was."
14055
14130
  },
14056
14131
  {
14057
14132
  "kind": "function",
14058
- "name": "exampleArgs",
14133
+ "name": "getMetaEvents",
14059
14134
  "return": {
14060
14135
  "type": {
14061
- "text": "Record<string, unknown>"
14136
+ "text": "ReadonlyArray<MetaEvent>"
14062
14137
  }
14063
14138
  },
14064
14139
  "parameters": [
14065
14140
  {
14066
- "name": "schema",
14141
+ "name": "key",
14067
14142
  "type": {
14068
- "text": "Readonly<Record<string, unknown>>"
14143
+ "text": "string"
14069
14144
  }
14070
14145
  }
14071
14146
  ],
14072
- "description": "An example of arguments that fit `schema`, for a refusal to show the model: each property with a\nplaceholder of its declared type, required ones first. Shallow, like checkArgs."
14147
+ "description": "Returns the meta-event timeline for `key`, or an empty array if none recorded."
14073
14148
  },
14074
14149
  {
14075
14150
  "kind": "function",
14076
- "name": "buildFullSurface",
14151
+ "name": "mergeMetaEvents",
14077
14152
  "return": {
14078
14153
  "type": {
14079
- "text": "DecisionSurface"
14154
+ "text": "void"
14080
14155
  }
14081
14156
  },
14082
14157
  "parameters": [
14083
14158
  {
14084
- "name": "spec",
14159
+ "name": "targetKey",
14085
14160
  "type": {
14086
- "text": "SurfaceSpec"
14161
+ "text": "string"
14162
+ }
14163
+ },
14164
+ {
14165
+ "name": "events",
14166
+ "type": {
14167
+ "text": "readonly MetaEvent[]"
14087
14168
  }
14088
14169
  }
14089
14170
  ],
14090
- "description": "Build the surface for a full-form spec (GENC-1660 §4.2): named actions, some editing and some\nfinishing, each guarded and checked (a text action's text, a form's fields against its schema); a\ndescription; described views to read, one of them the preview. Every read is fresh.\n\nThrows if an action declares both `text` and `argsSchema`, or the preview is not one of the\nviews: a bug in the widget rather than something to recover from."
14171
+ "description": "Merge pre-built meta events into the timeline for `targetKey`, **preserving each\nevent's original `timestamp`** (so it interleaves chronologically on export)\nwhile re-indexing onto the target buffer's monotonic counter. Used to fold a\nsub-agent's harvested events into the parent session — see\n`ChatDriver.invokeSubAgent`. Unlike recordMetaEvent it does not stamp a\nfresh timestamp; the same non-`high` eviction policy is applied once after the\nbatch so the buffer stays bounded."
14172
+ },
14173
+ {
14174
+ "kind": "function",
14175
+ "name": "clearSession",
14176
+ "return": {
14177
+ "type": {
14178
+ "text": "void"
14179
+ }
14180
+ },
14181
+ "parameters": [
14182
+ {
14183
+ "name": "key",
14184
+ "type": {
14185
+ "text": "string"
14186
+ }
14187
+ }
14188
+ ],
14189
+ "description": "Drop the entire timeline for `key`. Used to discard a sub-agent's transient\nper-invocation session once its events have been harvested into the parent, so\nthe module registry doesn't accumulate one orphaned bucket per sub-agent run."
14190
+ },
14191
+ {
14192
+ "kind": "variable",
14193
+ "name": "DEBUG_LOG_README",
14194
+ "type": {
14195
+ "text": "readonly string[]"
14196
+ },
14197
+ "default": "[\n 'This is an exported debug log for the Genesis AI assistant. Read it top-to-bottom.',\n \"`sessionUsage` is what this session spent: `costUsd` (USD, provider-reported per request and summed, cache discounts already applied) plus the four TOKEN BUCKETS — `uncachedInputTokens`, `cacheReadTokens`, `cacheWriteTokens`, `outputTokens`. Those four are disjoint and safe to add up for a total-tokens figure; the per-message fields further down are NOT (see kind:'message'). Each bucket bills at a different rate — cache reads a fraction of uncached input, cache writes a premium, output highest — so a big token count against a small cost means the prompt was mostly cache hits, not a missing charge. It covers sub-agent turns and spend a compaction banked, so for the CONVERSATION it is the authoritative total: prefer it over re-summing the timeline, which can be short by whatever the ring buffers evicted. The same figures appear under `meta.context`. It is as current as the snapshot it came from: the assistant's own download stamps a fresh one, but a log stitched by another tool can carry an older one — compare `meta.timestamp` with the last timeline entry, and if it is well behind, read these totals as historical and fall back to summing the timeline. One scope caveat: it is derived from the transcript, so it excludes billed calls that produced no message (a blank or refused attempt that was retried — see kind:'turn'.`usage`). Summing the turns can therefore come out HIGHER than this, and the difference is exactly that discarded spend, not a double-count.\",\n \"What 'session' means for those figures: the CURRENT conversation under this session key (a host-supplied per-project id, or the element id + header title when the host supplies none) — which is not necessarily everything in `timeline`. It is re-derived from the live transcript, so it spans page loads only when the chat is being remembered, and a Clear resets it to zero. `timeline` is append-only regardless: it keeps every page load and the pre-Clear conversation, with the session.cleared event as the boundary. So on a long-lived log, read these totals as the latest conversation's and the earlier sections as history — not as a total of the whole file.\",\n '`timeline` is the entire session as one array, already sorted chronologically by `timestamp` (ISO 8601). Every entry has a `kind`.',\n 'Timestamps are millisecond-resolution; entries that share the same millisecond are ordered by a fixed kind rank (event, then turn, then message), which is a heuristic and may not reflect exact causal order within that millisecond — e.g. a user message and the turn it triggered, or a final assistant message and its turn.end event, can appear in either order depending on whether they landed in the same millisecond. Read the logical structure of a turn rather than over-interpreting the micro-ordering of co-timestamped entries of different kinds.',\n \"kind:'message' — the conversation. `role` is user/assistant/tool/system-event/synthetic-user; `agentName` says which agent produced it; `toolCalls`/`toolResult`/`interaction` carry tool and widget activity; `inputTokens`/`outputTokens`/`cost` are per-message LLM usage, where `inputTokens` is the WHOLE prompt for that request and `cacheReadTokens`/`cacheWriteTokens` BREAK IT DOWN rather than add to it — uncached input is `inputTokens` minus those two, and adding the cache fields to `inputTokens` counts the prompt twice. The cache fields are absent on providers that report no cache split (Gemini reports reads only, since implicit caching bills no write) and on messages persisted before they existed, so read them as 0 when missing. Each bucket bills at a different rate — cache reads a fraction of uncached input, cache writes a premium, output highest — so a large token count at a small cost means the prompt was mostly cache hits. `externalCostUsd` is any non-LLM cost a widget reported for its own external service calls (folded into the session cost total alongside `cost`). On model-produced assistant messages, `model` is the concrete model id that generated it (e.g. 'gemini-2.5-flash-lite') and `providerName` is the registry slot it resolved under (e.g. a tier name like 'high'/'low', or the default); together they attribute the message — and any tool calls it carries — to an exact model even across a mid-session vendor/tier switch, where one slot name can map to different models before and after the switch. Both are undefined on any entry that is NOT an LLM response: non-assistant roles (user/tool/system-event) and 'synthetic-user' echoes; assistant interaction/widget entries (empty content carrying an `interaction` — a rendered widget, not a model turn); driver-authored assistant fallbacks (the timeout, repeated-malformed-call, and empty-response apology messages); and messages restored from a session persisted before these fields existed. One partial case: on a genuine model turn whose provider exposes no `getStatus` (or reports no model), `providerName` is still set but `model` alone is undefined. A 'synthetic-user' message is a display-only echo of an interaction outcome (e.g. the answer a widget reported): it renders on the user's side of the chat and `agentName` is the agent that created it, but it is never sent to the LLM — so it has no matching 'turn' and the model learns the outcome only from the corresponding tool result. An echo of an answer an interceptor (such as an autopilot) gave is NOT synthetic-user: see the delegated-messages paragraph.\",\n 'The autopilot (GENC-1660) runs on a driver of its own, and everything it did is harvested into this log: entries with delegate: autopilot and an agentName ending in › Autopilot are its turns (the decision message it was sent is the user message of its turn, so what it was shown is there verbatim; its systemPrompt is its grounding, such as the brief), its tool calls (widget_read, widget_act, hand_back, any read-only tools of its own, and its widget tools — reads with parameters that a widget type declares, routed to the interaction of that type being decided and refused with a reason when none is, offered on every decision so its tool list never changes; while one is open its tail starts with a line naming them) and their results (a read, view or widget tool, is capped at about 20,000 characters, cut with a note asking for less, and leaves its history at the end of the decision as a one-line note), and its own events. Its cost is already in the session total: it is booked as externalCostUsd on the interaction each decision answered, or, for a written question it answered, on the user message it sent on the user behalf (delegate: autopilot), so do not add its turns to that total. Spend that reached no message is recorded as autopilot.cost-dropped instead.',\n \"Delegated messages (GENC-1660): a message with a `delegate` field was written or sent ON THE USER'S BEHALF by a driver decorator, and `delegate` names it (e.g. autopilot). The platform stamps it; nothing else can. It renders as the assistant whatever its role. A delegated `user` message was NOT typed by the user: it is an answer given on their behalf, and the model read it with `delegateFraming` in brackets in front of the content (the stored `content` is the bare text). A delegated `assistant` message is display-only (`excludeFromProvider`): the decorator's narration note, or, when its answer carried no note, the widget's own echo of the answer (its `userMessage`), shown as the assistant and never as the person. A widget answer a decorator gave with a note is not echoed at all: the note already says what was chosen. To tell what the person decided from what was decided for them, read `interaction.answeredBy` and these fields, never the role alone. Driver notes: a `user` message with a `driverNote` field was written by the driver for the model, never by the user, and is hidden from the transcript; `driverNote: 'finish-guard'` is the agent's finishGuard holding the turn open after a prose reply, its content the guard's note in a `<system-reminder>`, and it follows a turn.finish-guard event; `driverNote: 'completion-nudge'` is the driver asking a sub-agent that replied in prose to call its completion tool; `driverNote: 'forced-tool-nudge'` is the driver asking a parent agent for the tool call its forced turn required, after a model that rejects forcing (responseMeta.toolChoiceDowngraded) replied in prose.\",\n \"Sub-agent messages appear inline. When a tool delegates to a sub-agent (via `requestSubAgent`), the sub-agent's whole conversation — its own assistant/tool messages, each with their own `content`/`thinking`/`toolCalls`/`toolResult` and per-message `model`/`providerName`/`inputTokens`/`outputTokens`/`cacheReadTokens`/`cacheWriteTokens`/`cost` — is hoisted into the timeline as ordinary kind:'message' entries, interleaved by timestamp right after the tool call that spawned them (so you read the delegation top-to-bottom). A hoisted entry is marked: `subAgentDepth` is its delegation depth (1 for a sub-agent, 2 for a sub-agent's sub-agent, …), `subAgentOf` is the id of the parent tool call that spawned it (correlates it back even when two sub-agents run in one parent turn), `subAgentName` is the sub-agent's own name, and `agentName` is rewritten to a `\\\"<parent> › <sub-agent>\\\"` breadcrumb (composing when nested, e.g. `\\\"UI Builder › Planner › Grounding\\\"`). The sub-agent's per-LLM-call snapshots also surface as kind:'turn' entries with a `<parentTurn>-<subAgentNo>.<childTurn>` `turnIndex` (see the kind:'turn' paragraph), and subagent.started/completed (or subagent.failed) events bracket the run. Per-message `cost` on hoisted entries is already part of the session total (it is summed from the un-flattened history), so summing the top-level timeline does NOT double-count.\",\n \"kind:'turn' — one LLM call. `turnIndex` is a string: a top-level turn is the bare counter ('0', '1', …); a sub-agent's turns are labelled '<parentTurn>-<subAgentNo>.<childTurn>': the parent turn that activated it, the sub-agent's number (1-based, in the order the sub-agents started within that parent turn, so it matches the order of the subagent.started events; two sub-agents in one parent turn never share a number, even when they run in parallel or share a name), and the sub-agent's own turn position (1-based) — e.g. '3-2.1', '3-2.2' are the first two turns of the second sub-agent started in parent turn 3, and a sub-agent nested under its turn '3-2.2' contributes '3-2.2-1.1', … ('.' joins the parts of one level, '-' separates levels). The `<parentTurn>-<subAgentNo>` part is the sub-agent's `turnPrefix`: the same value is stamped on its subagent.started/completed/failed events and on its harvested events as `detail.turnPrefix`, so match events to turns by value (a turn belongs to the sub-agent whose `turnPrefix` its `turnIndex` begins with) — and `agentName` names the agent that ran the turn. `systemPrompt` and `toolNames` are what the model saw. A systemPrompt of '<repeated — identical to turn N>' was byte-identical to turn N and de-duplicated; the full prompt is shown whenever it changes (often because a stateful agent advanced), so prompt evolution is visible.\",\n \"kind:'turn'.`model`/`providerName`/`provider` — which model ran that call: the concrete model id, the registry slot it resolved under (a tier name like 'high'/'low', or the default), and the vendor. Recorded per CALL, so an agent whose `provider` selector varies by state — a flow that plans on a high tier and executes on a low one — has every step attributed, including calls that produced no message. `model` is the SERVING model where the provider reports one, so a turn answered by a server-side fallback names the model that answered rather than the one requested; it always matches the `model` on the message that call produced. Absent when the provider exposes no `getStatus` and the transport stamped nothing.\",\n \"kind:'turn'.`usage` — what that ONE call cost, in the same four-bucket + `costUsd` shape as `sessionUsage`. Absent while a call is in flight and on providers that report no usage. This is the SAME money as the message the call produced, not extra money: never add turn usage to message usage, and read a turn plus its message as one charge. Its distinct value is the calls that produced NO message — a blank or refused response is billed and then discarded before the retry, so the turn entry is the only record of that spend, and a turn with `usage` but no message after it is exactly that. `costUsd: 0` alongside a nonzero token count means the provider reported no price, not that the call was free.\",\n \"kind:'turn'.`agentSnapshot` — the active agent's own view of its internal state, captured at that turn. An agent opts into this by exposing a `getDebugSnapshot()` that returns JSON-serializable per-state info; stateful/flow agents wire it automatically, so you can watch a flow advance turn-by-turn (e.g. current step, cursor, collected fields, pending changes). Absent for agents that don't expose one.\",\n \"kind:'event' — a meta/lifecycle event. `type` names it (see below); `detail` carries structured data. `detail.placement` is the emitting UI instance: 'bubble' (collapsed), 'panel' (popped-out), or 'standalone'.\",\n \"Each 'event' also has an `importance`: 'high' (failures/limits — turn.error, tool.failed, subagent.failed, file.read-failed, suggestions.failed, context.threshold-crossed), 'normal' (session flow — connects, turns, retries, handoffs, agent/provider changes, interactions, sub-agent start/complete), or 'low' (skippable UI/bookkeeping noise — panel.toggled, attachment.added, driver.wired/unwired, context.updated, context.condensed). To skim, ignore importance:'low'; to triage a failure, filter to importance:'high' then read the nearby messages and turns. A 'high' turn.error is often preceded by one or more 'normal' turn.retry events for the same reason — read them together to see how many attempts were made before bailing. 'message' and 'turn' entries carry no importance — they are the substance, always read them.\",\n \"Event types: assistant.connected/disconnected (mount + placement + whether the session was created or restored), assistant.popout/popin (window placement), driver.created/wired/unwired (which driver is live and why it stops/starts responding across a popout), state.changed (idle↔loading), turn.start/turn.end (turn boundary; turn.end carries durationMs), turn.retry (a recoverable in-turn retry — detail.reason plus attempt/maxAttempts; for malformed calls also finishMessage; for empty responses also the provider finishReason + thoughtsTokens + parts breakdown), turn.finish-guard (the model replied with no tool call and the agent's finishGuard hook answered — detail.action is continue (the turn was held open: detail.continuation counts the holds this turn and detail.note is the note stored as a hidden user message with driverNote finish-guard, the next message in the log; detail.source: 'completion-nudge' is instead the driver holding a SUB-AGENT's turn open because it replied in prose without calling its completion tool — detail.nudge of detail.maxNudges, the note stored with driverNote completion-nudge — and a sub-agent that still answers in prose after the last nudge fails as before; detail.source: 'forced-tool-nudge' is the driver holding a PARENT agent's forced turn open after a model that rejects forcing answered in prose, the note stored with driverNote forced-tool-nudge, naming the tool when the turn was pinned to one) or end with detail.release: true (the agent was released on a prose answer); a plain end records nothing), turn.error (a turn failed or hit a guardrail — detail.reason is one of exception/malformed-function-call/empty-response/unknown-tool-limit/max-iterations/response-truncated/refusal/budget-exhausted/provider-refused/context-exhausted/ai-service-error, plus reason-specific diagnostics: attempts (for empty-response also finishReason + thoughtsTokens + a parts breakdown, distinguishing a thinking-only STOP from a truly empty turn), finishMessage, for response-truncated the model + maxTokens + outputTokens + tools, unknownTools (split into staleTools — real earlier this activation but retired by the current state or hidden behind an open exclusive fold — and hallucinatedTools — never advertised) + availableTools, iterations + limit, for budget-exhausted the budgetUsd + spentUsd figures reported by the proxy plus the resolved vendor, for provider-refused the kind (spend|auth) plus the upstream status and error type — the vendor refusing the ACCOUNT rather than us refusing to spend, so the remedy is a top-up or a key rotation rather than a raised cap, and the kind is the only place that distinction survives because the user-facing copy is deliberately cause-free, for context-exhausted the estimated contextTokens against the guard that stopped the turn plus the iterations reached — the driver ending a runaway tool loop at the edge of the context window rather than issuing a request the provider would reject, so the transcript survives intact and can still be compacted, for ai-service-error the code (one of AI_SERVICE_ERROR_CODES, e.g. NO_API_KEY) and the status the AI service answered with — its own text goes to the browser console only, or name + message for exceptions), tool.failed (a tool threw), tool.unresolved (the model called a tool that could not be dispatched — detail.kind is folded/fold-hidden/stale/unknown, plus tool + agent and, for the counted kinds, the consecutive streak; or kind pinned-elsewhere, a turn pinned to detail.pinned (toolChoice { tool }) that went out unforced because the model rejects forcing, and whose reply called only detail.tools: none of them was run, each was answered with a refusal naming the pinned tool, detail.nudge of detail.maxNudges, counted against the forced-tool nudge on a parent agent and the completion nudge on a sub-agent; the recurring lead-up to an unknown-tool-limit turn.error), subagent.started/completed/failed (the lifecycle of a `requestSubAgent` delegation — detail.agent names the sub-agent; these bracket the sub-agent turns that appear as kind:turn entries with a `<parentTurn>-<subAgentNo>.<childTurn>` `turnIndex`, where the sub-agent number is the order the sub-agent started in within its parent turn, so it matches the order of the subagent.started events; all three carry detail.turnPrefix, that `<parentTurn>-<subAgentNo>` which the sub-agent's turns' `turnIndex` begins with, so an event and its turns are matched by value; subagent.failed also carries detail.reason, one of max_iterations/malformed_tool_call/empty_response/unknown_tool_limit/timeout/response_truncated/refusal/budget_exhausted/provider_refused/context_exhausted/ai_service_error, and for timeout detail.cause: 'idle' when it was the sub-agent making no progress for `idleTimeoutMs` rather than the overall `timeoutMs` (absent for the latter); budget_exhausted and provider_refused are terminal for the PARENT turn too, and so is ai_service_error when the refusal is about the service rather than the request and came from the vendor the parent calls — the parent stops rather than calling the model again into the same wall; after context_exhausted the parent goes on, but its own next call is likely to stop on the same guard), agent.handoff (routing; from=null is the initial activation), agent.pinned/unpinned (forced routing), routing.decided (ONE PER ROUTING DECISION — see its own paragraph below), provider.selected (the resolved provider for the upcoming turns — detail.provider is the registry SLOT/tier name, detail.model the concrete model behind it and detail.vendor its vendor; emitted only when the slot CHANGES, so read the per-turn `model` for the model of any given call rather than assuming the nearest event still applies), interaction.requested/resolved (blocking user widgets — explain quiet gaps; note that when a sub-agent opens a widget, detail.agent — and the agentName on the interaction message — is the HOST agent that owns the widget, NOT the sub-agent that asked, because widgets render and resolve on the host driver; detail.ownerPath names the agents that actually asked, outermost first, the last being the one whose tool requested it, and detail.heldBy says who held it when it opened: user, or the id of the interceptor that claimed it, such as autopilot; on interaction.resolved, detail.answeredBy is who answered — the claimant id when it settled through its own hold, user for any other answer (a click counts as the person even on a widget a claimant held) — absent when it closed unanswered (a timeout or a stop), and absent too when it settled by itself other than through the hold of a claimant — a widget registered resolvesItself (one that does its work and settles on its own, asking the person nothing, such as a generation run), or one outcome its controller said settled itself (ctx.resolve with resolvedItself, such as a generation phase that failed outright before its review gate ever asked anything) — which then carries detail.resolvedItself: true instead, as the interaction message does — nobody answered it, and the platform cannot tell it finishing from the person interrupting it (a Skip), so only the result of the widget itself can say which; the same value is stamped on the interaction message as answeredBy and on the result the asking tool handler receives (absent there in the same cases), and when it is not user the tool result that interaction returned carries a decidedOnUsersBehalf record, so the model was told the choice was not made by the person; detail.edits, present only when non-zero, counts the editing actions a claimant ran on the widget before it was settled, whoever settled it, and those edits are stamped on the interaction message as edits, each with by, action, choice and args when it had some, in the order they ran, while a decidedOnUsersBehalf record carries their choice texts as edits, and when the person settled it after such edits the tool result carries an editedOnUsersBehalf record instead — the framing and those choice texts — so the model knows the widget was changed on the user behalf before the user answered, and that the user then confirmed it by finishing it), interaction.held (a claimant moved a pending interaction to the person or back to itself — detail.heldBy is the new holder, detail.claimant the interceptor; detail.late: true is an interceptor that declined it when it opened claiming it afterwards, such as the autopilot resumed while it was open; a widget held by anything but user was not answered by the person), interaction.claim-refused (a claim on a userOnly interaction, which stays with the person — detail.claimant + reason), autopilot.* (the autopilot, a decorator that answers interactions on behalf of the user — autopilot.claimed / autopilot.declined say whether it took each interaction and, for a decline, detail.reason: paused, other-flow, no-autopilot, unavailable, userOnly, policy or no-controller; one declined as paused that is still open when the person resumes the autopilot is looked at again, and the autopilot.claimed or autopilot.declined recorded for it then carries detail.onResume: true (a decline then can also be claimed-elsewhere, another interceptor having claimed it first); a restored mode looks at nothing; autopilot.decision-sent is what it was sent (detail.chars; detail.nothingEnabled: true when every action on the widget was unavailable — a gate whose controller said it was asking, such as a failed build the autopilot may not cancel — so it could only hand it back, which it may then do even after the person asked it to decide it itself; a widget whose controller says it is working (ctx.setWorking) is never sent a decision until it says it is asking, even when an action is enabled or the person resumes the autopilot); autopilot.acted is what it did (detail.action, detail.note, detail.finished); autopilot.handed-back is a decision it gave to the person (detail.reason and detail.trigger: model, no-decision or error); autopilot.paused / autopilot.resumed are mode changes (detail.scope, detail.trigger, detail.decideYourself when the person resumed during a hand-back; detail.trigger is restored when the mode came back with the session after a reload, applied once its flow re-activated, which starts nothing by itself); autopilot.carried is the mode, running or paused, going with the task to the agent that took it over, rather than ending with the flow as on any other change of flow owner: to the target of a hand-off, or back to its caller on the hand-back (detail.from, detail.to, detail.mode); a pause the person chose goes with it, and Stop and Clear still end it; a mode restored for the target of a hand-off applies to its caller when the reload hands back; autopilot.error is the wrapper itself failing; autopilot.refinement counts a refining action against its step — a written answer (reply) or a widget action declared refines, such as a regenerate with instructions, counted together (detail.action, detail.stepKey, detail.count, detail.limitReached, after which every refining action is withdrawn for that step: not listed, and refused; the decision and every relisting of its actions say how many are left at the step, as a line Refinements left at this step: N, wherever the widget has a refining action); autopilot.handback-presented is the turn-level hand-back, shown when a working turn ended needing the person with no widget to hand over (detail.why: max-iterations, context-exhausted, failure or question; detail.options; detail.choice once answered); autopilot.catch-up is the autopilot being given the whole visible transcript at once (detail.why: first, for its first decision in a flow or after a reload; size, when its own history passed its budget and was rebuilt short — detail.ownChars; or compacted, when a compaction removed the last message it had seen, so it reads the summary and everything since, short; in each, what it had sent on the user behalf is included and labelled as its own, since its own history does not hold it); autopilot.cost-dropped is autopilot spend that no message carries, so it is NOT in the session total (detail.costUsd and detail.why: handed-back, aborted or stale for a written question it answered that no reply was sent for — stale when a pause, a resume, a new turn or the end of its flow came before the answer landed, which then went nowhere — or no-recorder when the driver had no way to book a decision to its interaction); a hand-back trigger can also be budget (the decision passed its spend cap), watchdog (its work went quiet: no ready surface and no heartbeat, or its own decision stalled with no model call landing, which stops that decision) or detached (the autopilot was removed while it held the interaction, which went to the person with no reason shown). To debug one autopilot decision, follow its interactionId: interaction.requested (heldBy), autopilot.claimed, autopilot.decision-sent, autopilot.acted or autopilot.handed-back, interaction.invoked, interaction.resolved (answeredBy), then the next turn of the working agent), interaction.invoked (a claimant ran one of the actions the widget itself exposes, through its hold, the same code the button runs — detail.claimant, detail.action (an option id, select or reply) and detail.finished, whether that settled the interaction, and when it did not, the run is recorded as an edit; the choice and narration it recorded reach the result of the tool that asked as decidedOnUsersBehalf; the person's own programmatic action, from a host with no DOM to click, carries detail.by: user in place of detail.claimant, and is not recorded as an edit nor as a decision on their behalf, so what it settles is answered by user), interaction.step (a long action run as named steps through runSteps, which survive a reload — detail.step and detail.outcome: started, done, skipped when the step was already done before a reload, or resumed when it started before a reload and runs again with what it saved part-way, such as a job id it re-attaches to), interaction.checkpoint (the checkpoints a conversation keeps for its long actions: the one in flight, and each one a reload cut, held apart until a request of its own widget type takes it over, so a resumed flow that opens other long widgets first, which save their own, loses nothing — detail.action: resumed when a reload cut the work and a request of the same widget type that the registration sameWork agrees is the same work took it over, refused when sameWork said a new request is different work (detail.saved is the identity it kept; detail.kept: true, since it stays for a later request of that type, and is offered to every one until one agrees) or when runSteps found the handed-over checkpoint malformed and started fresh (detail.reason, detail.saved), or cleared when its flow ended, once per checkpoint, with detail.cut: true for one a reload cut that nothing took over), context.updated/threshold-crossed (token + cost), headless.attached (a HeadlessSession attached, for a host that drives the assistant with no screen — detail.label, what the host called itself, when it gave one) and headless.raw-resolved (that host settled an interaction raw, bypassing the widget's own actions: detail.interactionId and detail.component; the result went to the tool as given, so check what the widget would have enforced), context.condensed (a stale tool payload was collapsed out of the model-bound history by a `condenseWhen` declaration on the tool — detail.tool + toolCallId, target args|response, trigger (superseded:<key> or age:<n>), stubLen, and an estimated tokensSaved; stored history and this log keep the FULL payload, so the model-visible slice at any point is the full history minus the condensations recorded up to then), panel.toggled, attachment.added, file.read-failed, suggestions.failed.\",\n 'Sub-agent meta events: a sub-agent\\'s own turn.retry/turn.error/tool.failed/tool.unresolved/turn.finish-guard events are merged into this same timeline, tagged with `detail.subAgent` — a `\"<parent> › <sub-agent>\"` breadcrumb that composes when nested (e.g. `\"UI Builder › Planner › Grounding\"`) — and interleaved by their original timestamps within the subagent.started→completed/failed bracket; each also carries `detail.turnPrefix`, the `<parentTurn>-<subAgentNo>` that the `turnIndex` of its own sub-agent turns begins with (an event of a nested sub-agent gets the composed prefix, e.g. 3-2.2-1), so a retry or failure is matched to the turns it happened in by value. These are the per-attempt/per-failure signals that do NOT appear among the sub-agent\\'s (hoisted) messages: a malformed/empty attempt that gets retried produces no message, and the stale-vs-hallucinated split and streak counts live only on the event. A sub-agent\\'s high-volume, message-derivable events (turn.start/turn.end, provider.selected, context.updated) are intentionally NOT merged — read its hoisted messages for model/tokens/cost and turn-by-turn activity, and the bracketing subagent.* events for the run\\'s span.',\n \"`meta` holds context captured at export time: agentSummary (full agent configs), context (active model, contextTokens/contextLimit/contextUsagePercent for the last call, and the session totals — sessionCostUsd, sessionTokensConsumed, and the four-bucket sessionUsage lifted to the top of this log), activeDebugSnapshot (the active agent's `getDebugSnapshot()` taken fresh at export — reflects state NOW, which may have advanced beyond the last turn's agentSnapshot), debug (optional host-supplied debug state), host, and the export timestamp.\",\n 'Note the two different scopes in `meta.context`: `contextTokens` is the prompt size of the LAST call (against `contextLimit`, the model context window), while `sessionUsage`/`sessionTokensConsumed` are cumulative BILLED throughput. Every turn resends the conversation, so the cumulative figure counts each turn’s prompt again in the next turn’s and is expected to dwarf the context size — that is not double-counting.',\n \"kind:'event' type 'routing.decided' — how ONE user turn was routed, emitted by the orchestrating driver before the agent runs. Only a user turn is routed: a hand-off names its target, so the agents a hand-off runs show up as agent.handoff events, not as more routing.decided. `decision` is why that agent was chosen: 'classified' (the classifier ran and picked one), 'no-match' (it ran and answered -1 — nothing listed covers the request), 'pinned' (a user pin, an agent named for that one message by the send's `agent` option, or an active stateful flow owned the turn, so no call was made), 'single-candidate'/'no-specialists' (configuration left nothing to decide), 'provider-unavailable' (the registry default exposes no chat()), 'classifier-failed' (every attempt threw — `error` carries the last one). `to` names the agent and `fallback` says whether that agent is the fallback. `candidates` is what was ON THE BALLOT — every classifier-eligible specialist — in ballot order, so `index` — the classifier's own answer — indexes it directly. `candidates` is absent on the three decisions that put nothing to a vote — 'pinned', 'single-candidate', 'no-specialists'. It IS present on 'provider-unavailable', which is not an exception worth removing: the ballot was built there, it simply never got sent. `attempts` covers the retry ladder. `durationMs` is on EVERY routing.decided, and is the field to read when a decision looks wrong: the decisions that can reach the fallback ('no-match', 'no-specialists', 'provider-unavailable', 'classifier-failed') are told apart by the clock as much as by their name, because a fallback routing that resolved in tens of milliseconds made no network call at all whatever its `decision` says.\",\n \"kind:'event' type 'routing.decided'.`usage` — what that classifier call cost, in the same four-bucket + costUsd shape as `sessionUsage`, plus `model`. Absent on the decisions that make no call (see 'pinned' and the configuration ones). THIS SPEND IS NOT IN `sessionUsage`: a classifier call never enters the transcript and `sessionUsage` is derived from the transcript, so classifier cost is missing from the session total by construction, not by accident. Sum these events to close that gap — it is the one component of a session's real spend that the totals cannot see.\",\n 'To debug a failure: find the last turn.error or tool.failed, then read upward for the user message, the turn(s), and the agent/provider/state events that led into it. For a turn that went to the wrong agent, read its routing.decided first — `decision` says whether anything was actually asked.',\n]",
14198
+ "description": "Human/agent-facing guide emitted as the first key of the exported debug log,\nso whoever opens the JSON (often an AI agent) knows how to read it without\nreverse-engineering the shape. Kept here next to the event catalogue it\ndescribes — but proximity alone demonstrably did NOT keep the two in sync\n(`refusal` was missing from both reason lists for a whole release), so\n`debug-event-log.test.ts` now asserts that every `TurnFailureReason` and every\n`SubAgentFailureReason` is named here, and fails the build when one is added\nwithout a matching sentence. Enumerations below read as exhaustive and WILL be\ntrusted by an agent reading the JSON — keep them so."
14091
14199
  }
14092
14200
  ],
14093
14201
  "exports": [
14094
14202
  {
14095
14203
  "kind": "js",
14096
- "name": "SELECT_ACTION",
14204
+ "name": "META_EVENT_IMPORTANCE",
14097
14205
  "declaration": {
14098
- "name": "SELECT_ACTION",
14099
- "module": "src/state/decision-surface.ts"
14206
+ "name": "META_EVENT_IMPORTANCE",
14207
+ "module": "src/state/debug-event-log.ts"
14100
14208
  }
14101
14209
  },
14102
14210
  {
14103
14211
  "kind": "js",
14104
- "name": "REPLY_ACTION",
14212
+ "name": "recordMetaEvent",
14105
14213
  "declaration": {
14106
- "name": "REPLY_ACTION",
14107
- "module": "src/state/decision-surface.ts"
14214
+ "name": "recordMetaEvent",
14215
+ "module": "src/state/debug-event-log.ts"
14108
14216
  }
14109
14217
  },
14110
14218
  {
14111
14219
  "kind": "js",
14112
- "name": "GENERIC_UNAVAILABLE",
14220
+ "name": "TurnFailureReason",
14113
14221
  "declaration": {
14114
- "name": "GENERIC_UNAVAILABLE",
14115
- "module": "src/state/decision-surface.ts"
14222
+ "name": "TurnFailureReason",
14223
+ "module": "src/state/debug-event-log.ts"
14116
14224
  }
14117
14225
  },
14118
14226
  {
14119
14227
  "kind": "js",
14120
- "name": "unavailableReason",
14228
+ "name": "recordTurnError",
14121
14229
  "declaration": {
14122
- "name": "unavailableReason",
14123
- "module": "src/state/decision-surface.ts"
14230
+ "name": "recordTurnError",
14231
+ "module": "src/state/debug-event-log.ts"
14124
14232
  }
14125
14233
  },
14126
14234
  {
14127
14235
  "kind": "js",
14128
- "name": "buildDecisionSurface",
14236
+ "name": "recordTurnRetry",
14129
14237
  "declaration": {
14130
- "name": "buildDecisionSurface",
14131
- "module": "src/state/decision-surface.ts"
14238
+ "name": "recordTurnRetry",
14239
+ "module": "src/state/debug-event-log.ts"
14132
14240
  }
14133
14241
  },
14134
14242
  {
14135
14243
  "kind": "js",
14136
- "name": "checkArgs",
14244
+ "name": "getMetaEvents",
14137
14245
  "declaration": {
14138
- "name": "checkArgs",
14139
- "module": "src/state/decision-surface.ts"
14246
+ "name": "getMetaEvents",
14247
+ "module": "src/state/debug-event-log.ts"
14140
14248
  }
14141
14249
  },
14142
14250
  {
14143
14251
  "kind": "js",
14144
- "name": "exampleArgs",
14252
+ "name": "mergeMetaEvents",
14145
14253
  "declaration": {
14146
- "name": "exampleArgs",
14147
- "module": "src/state/decision-surface.ts"
14254
+ "name": "mergeMetaEvents",
14255
+ "module": "src/state/debug-event-log.ts"
14148
14256
  }
14149
14257
  },
14150
14258
  {
14151
14259
  "kind": "js",
14152
- "name": "buildFullSurface",
14260
+ "name": "clearSession",
14153
14261
  "declaration": {
14154
- "name": "buildFullSurface",
14155
- "module": "src/state/decision-surface.ts"
14262
+ "name": "clearSession",
14263
+ "module": "src/state/debug-event-log.ts"
14264
+ }
14265
+ },
14266
+ {
14267
+ "kind": "js",
14268
+ "name": "DEBUG_LOG_README",
14269
+ "declaration": {
14270
+ "name": "DEBUG_LOG_README",
14271
+ "module": "src/state/debug-event-log.ts"
14156
14272
  }
14157
14273
  }
14158
14274
  ]
14159
14275
  },
14160
14276
  {
14161
14277
  "kind": "javascript-module",
14162
- "path": "src/state/driver-registry.ts",
14278
+ "path": "src/state/decision-surface.ts",
14163
14279
  "declarations": [
14280
+ {
14281
+ "kind": "variable",
14282
+ "name": "SELECT_ACTION",
14283
+ "type": {
14284
+ "text": "string"
14285
+ },
14286
+ "default": "'select'",
14287
+ "description": "The `select` action a multi-select adds. Platform-owned, so never an option's id."
14288
+ },
14289
+ {
14290
+ "kind": "variable",
14291
+ "name": "REPLY_ACTION",
14292
+ "type": {
14293
+ "text": "string"
14294
+ },
14295
+ "default": "'reply'",
14296
+ "description": "The `reply` action `freeText` adds. Platform-owned, so never an option's id."
14297
+ },
14298
+ {
14299
+ "kind": "variable",
14300
+ "name": "GENERIC_UNAVAILABLE",
14301
+ "type": {
14302
+ "text": "string"
14303
+ },
14304
+ "default": "'not available in this state'",
14305
+ "description": "What an unavailable thing says when its guard gives no reason (an empty one, or a throw)."
14306
+ },
14164
14307
  {
14165
14308
  "kind": "function",
14166
- "name": "getOrCreateDriver",
14309
+ "name": "unavailableReason",
14167
14310
  "return": {
14168
14311
  "type": {
14169
- "text": "AiDriver"
14312
+ "text": "string | undefined"
14170
14313
  }
14171
14314
  },
14172
14315
  "parameters": [
14173
14316
  {
14174
- "name": "key",
14175
- "type": {
14176
- "text": "string"
14177
- }
14178
- },
14179
- {
14180
- "name": "agentsKey",
14317
+ "name": "guard",
14181
14318
  "type": {
14182
- "text": "string"
14319
+ "text": "((...args: A) => string | undefined) | undefined"
14183
14320
  }
14184
14321
  },
14185
14322
  {
14186
- "name": "factory",
14323
+ "name": "args",
14187
14324
  "type": {
14188
- "text": "() => AiDriver"
14325
+ "text": "A"
14189
14326
  }
14190
14327
  }
14191
14328
  ],
14192
- "description": "Returns the existing driver for the given key, or calls the factory to create\nand register a new one. `agentsKey` is the fingerprint of the agents the\ndriver is being built for; it is recorded only when a driver is created (a\nreused driver keeps the fingerprint it was originally built with)."
14329
+ "description": "Why something cannot be used right now, from its `unavailable` guard, or `undefined` when it can\n(GENC-1660). One rule for options, actions and widget tools: absent means available; an empty\nreason, or a guard that throws, counts as unavailable with a generic reason, since a guard that\ncannot say why cannot vouch for its button either."
14193
14330
  },
14194
14331
  {
14195
14332
  "kind": "function",
14196
- "name": "getDriver",
14333
+ "name": "buildDecisionSurface",
14197
14334
  "return": {
14198
14335
  "type": {
14199
- "text": "AiDriver | undefined"
14336
+ "text": "DecisionSurface"
14200
14337
  }
14201
14338
  },
14202
14339
  "parameters": [
14203
14340
  {
14204
- "name": "key",
14341
+ "name": "spec",
14205
14342
  "type": {
14206
- "text": "string"
14343
+ "text": "DecisionSpec"
14207
14344
  }
14208
14345
  }
14209
14346
  ],
14210
- "description": "Returns the existing driver for the given key, or `undefined`."
14347
+ "description": "Build the surface for a short-form decision (GENC-1660). Its actions are its options (by id),\nplus `select` for a multi-select and `reply` for a written answer; all of them finish. A spec's\nown `actions` follow them, run as a full-form surface's are (and editing unless they say\notherwise); they do not count towards readiness. Its views, if it has any, are read by name. Every read — facts, views, actions, enabled-ness — is taken\nfresh, so the surface always describes the widget as it is now.\n\nThrows if an option's id collides with another or with a platform-owned name, or an extra action\ndoes, which is a bug in the widget rather than something to recover from."
14211
14348
  },
14212
14349
  {
14213
14350
  "kind": "function",
14214
- "name": "getDriverAgentsKey",
14351
+ "name": "checkArgs",
14215
14352
  "return": {
14216
14353
  "type": {
14217
14354
  "text": "string | undefined"
@@ -14219,44 +14356,224 @@
14219
14356
  },
14220
14357
  "parameters": [
14221
14358
  {
14222
- "name": "key",
14359
+ "name": "args",
14223
14360
  "type": {
14224
- "text": "string"
14361
+ "text": "unknown"
14362
+ }
14363
+ },
14364
+ {
14365
+ "name": "schema",
14366
+ "type": {
14367
+ "text": "Readonly<Record<string, unknown>> | undefined"
14225
14368
  }
14226
14369
  }
14227
14370
  ],
14228
- "description": "The agents fingerprint the registry driver for `key` was built with, or\n`undefined` if no driver is registered. Used by `agentsChanged` to decide\nwhether a sibling has already rebuilt the shared driver to the desired agents."
14371
+ "description": "Check `args` against an action's schema: an object, with its `required` properties present and\neach listed property of its declared top-level `type`. Deliberately shallow — enough to refuse a\nmalformed call with a reason the model can act on, without a schema library in the browser."
14229
14372
  },
14230
14373
  {
14231
14374
  "kind": "function",
14232
- "name": "deleteDriver",
14375
+ "name": "exampleArgs",
14233
14376
  "return": {
14234
14377
  "type": {
14235
- "text": "AiDriver | undefined"
14378
+ "text": "Record<string, unknown>"
14236
14379
  }
14237
14380
  },
14238
14381
  "parameters": [
14239
14382
  {
14240
- "name": "key",
14383
+ "name": "schema",
14241
14384
  "type": {
14242
- "text": "string"
14385
+ "text": "Readonly<Record<string, unknown>>"
14243
14386
  }
14244
14387
  }
14245
14388
  ],
14246
- "description": "Removes and returns the driver for the given key.\nUsed when agents change (driver must be rebuilt) or on explicit session teardown."
14247
- }
14248
- ],
14249
- "exports": [
14250
- {
14251
- "kind": "js",
14252
- "name": "getOrCreateDriver",
14253
- "declaration": {
14254
- "name": "getOrCreateDriver",
14255
- "module": "src/state/driver-registry.ts"
14256
- }
14389
+ "description": "An example of arguments that fit `schema`, for a refusal to show the model: each property with a\nplaceholder of its declared type, required ones first. Shallow, like checkArgs."
14257
14390
  },
14258
14391
  {
14259
- "kind": "js",
14392
+ "kind": "function",
14393
+ "name": "buildFullSurface",
14394
+ "return": {
14395
+ "type": {
14396
+ "text": "DecisionSurface"
14397
+ }
14398
+ },
14399
+ "parameters": [
14400
+ {
14401
+ "name": "spec",
14402
+ "type": {
14403
+ "text": "SurfaceSpec"
14404
+ }
14405
+ }
14406
+ ],
14407
+ "description": "Build the surface for a full-form spec (GENC-1660 §4.2): named actions, some editing and some\nfinishing, each guarded and checked (a text action's text, a form's fields against its schema); a\ndescription; described views to read, one of them the preview. Every read is fresh.\n\nThrows if an action declares both `text` and `argsSchema`, or the preview is not one of the\nviews: a bug in the widget rather than something to recover from."
14408
+ }
14409
+ ],
14410
+ "exports": [
14411
+ {
14412
+ "kind": "js",
14413
+ "name": "SELECT_ACTION",
14414
+ "declaration": {
14415
+ "name": "SELECT_ACTION",
14416
+ "module": "src/state/decision-surface.ts"
14417
+ }
14418
+ },
14419
+ {
14420
+ "kind": "js",
14421
+ "name": "REPLY_ACTION",
14422
+ "declaration": {
14423
+ "name": "REPLY_ACTION",
14424
+ "module": "src/state/decision-surface.ts"
14425
+ }
14426
+ },
14427
+ {
14428
+ "kind": "js",
14429
+ "name": "GENERIC_UNAVAILABLE",
14430
+ "declaration": {
14431
+ "name": "GENERIC_UNAVAILABLE",
14432
+ "module": "src/state/decision-surface.ts"
14433
+ }
14434
+ },
14435
+ {
14436
+ "kind": "js",
14437
+ "name": "unavailableReason",
14438
+ "declaration": {
14439
+ "name": "unavailableReason",
14440
+ "module": "src/state/decision-surface.ts"
14441
+ }
14442
+ },
14443
+ {
14444
+ "kind": "js",
14445
+ "name": "buildDecisionSurface",
14446
+ "declaration": {
14447
+ "name": "buildDecisionSurface",
14448
+ "module": "src/state/decision-surface.ts"
14449
+ }
14450
+ },
14451
+ {
14452
+ "kind": "js",
14453
+ "name": "checkArgs",
14454
+ "declaration": {
14455
+ "name": "checkArgs",
14456
+ "module": "src/state/decision-surface.ts"
14457
+ }
14458
+ },
14459
+ {
14460
+ "kind": "js",
14461
+ "name": "exampleArgs",
14462
+ "declaration": {
14463
+ "name": "exampleArgs",
14464
+ "module": "src/state/decision-surface.ts"
14465
+ }
14466
+ },
14467
+ {
14468
+ "kind": "js",
14469
+ "name": "buildFullSurface",
14470
+ "declaration": {
14471
+ "name": "buildFullSurface",
14472
+ "module": "src/state/decision-surface.ts"
14473
+ }
14474
+ }
14475
+ ]
14476
+ },
14477
+ {
14478
+ "kind": "javascript-module",
14479
+ "path": "src/state/driver-registry.ts",
14480
+ "declarations": [
14481
+ {
14482
+ "kind": "function",
14483
+ "name": "getOrCreateDriver",
14484
+ "return": {
14485
+ "type": {
14486
+ "text": "AiDriver"
14487
+ }
14488
+ },
14489
+ "parameters": [
14490
+ {
14491
+ "name": "key",
14492
+ "type": {
14493
+ "text": "string"
14494
+ }
14495
+ },
14496
+ {
14497
+ "name": "agentsKey",
14498
+ "type": {
14499
+ "text": "string"
14500
+ }
14501
+ },
14502
+ {
14503
+ "name": "factory",
14504
+ "type": {
14505
+ "text": "() => AiDriver"
14506
+ }
14507
+ }
14508
+ ],
14509
+ "description": "Returns the existing driver for the given key, or calls the factory to create\nand register a new one. `agentsKey` is the fingerprint of the agents the\ndriver is being built for; it is recorded only when a driver is created (a\nreused driver keeps the fingerprint it was originally built with)."
14510
+ },
14511
+ {
14512
+ "kind": "function",
14513
+ "name": "getDriver",
14514
+ "return": {
14515
+ "type": {
14516
+ "text": "AiDriver | undefined"
14517
+ }
14518
+ },
14519
+ "parameters": [
14520
+ {
14521
+ "name": "key",
14522
+ "type": {
14523
+ "text": "string"
14524
+ }
14525
+ }
14526
+ ],
14527
+ "description": "Returns the existing driver for the given key, or `undefined`."
14528
+ },
14529
+ {
14530
+ "kind": "function",
14531
+ "name": "getDriverAgentsKey",
14532
+ "return": {
14533
+ "type": {
14534
+ "text": "string | undefined"
14535
+ }
14536
+ },
14537
+ "parameters": [
14538
+ {
14539
+ "name": "key",
14540
+ "type": {
14541
+ "text": "string"
14542
+ }
14543
+ }
14544
+ ],
14545
+ "description": "The agents fingerprint the registry driver for `key` was built with, or\n`undefined` if no driver is registered. Used by `agentsChanged` to decide\nwhether a sibling has already rebuilt the shared driver to the desired agents."
14546
+ },
14547
+ {
14548
+ "kind": "function",
14549
+ "name": "deleteDriver",
14550
+ "return": {
14551
+ "type": {
14552
+ "text": "AiDriver | undefined"
14553
+ }
14554
+ },
14555
+ "parameters": [
14556
+ {
14557
+ "name": "key",
14558
+ "type": {
14559
+ "text": "string"
14560
+ }
14561
+ }
14562
+ ],
14563
+ "description": "Removes and returns the driver for the given key.\nUsed when agents change (driver must be rebuilt) or on explicit session teardown."
14564
+ }
14565
+ ],
14566
+ "exports": [
14567
+ {
14568
+ "kind": "js",
14569
+ "name": "getOrCreateDriver",
14570
+ "declaration": {
14571
+ "name": "getOrCreateDriver",
14572
+ "module": "src/state/driver-registry.ts"
14573
+ }
14574
+ },
14575
+ {
14576
+ "kind": "js",
14260
14577
  "name": "getDriver",
14261
14578
  "declaration": {
14262
14579
  "name": "getDriver",
@@ -14731,323 +15048,6 @@
14731
15048
  }
14732
15049
  ]
14733
15050
  },
14734
- {
14735
- "kind": "javascript-module",
14736
- "path": "src/provider/ai-provider-switcher.ts",
14737
- "declarations": [
14738
- {
14739
- "kind": "variable",
14740
- "name": "AIProviderSwitcher",
14741
- "description": "The DI token for the (AIProviderSwitcher:interface). Resolves a noop until the app\nregisters one."
14742
- }
14743
- ],
14744
- "exports": [
14745
- {
14746
- "kind": "js",
14747
- "name": "AIProviderSwitcher",
14748
- "declaration": {
14749
- "name": "AIProviderSwitcher",
14750
- "module": "src/provider/ai-provider-switcher.ts"
14751
- }
14752
- }
14753
- ]
14754
- },
14755
- {
14756
- "kind": "javascript-module",
14757
- "path": "src/provider/assistant-app-settings.ts",
14758
- "declarations": [
14759
- {
14760
- "kind": "variable",
14761
- "name": "AssistantAppSettingsProvider",
14762
- "description": "The DI token for the (AssistantAppSettingsProvider:interface). Resolves a noop\nuntil the host registers one."
14763
- }
14764
- ],
14765
- "exports": [
14766
- {
14767
- "kind": "js",
14768
- "name": "AssistantAppSettingsProvider",
14769
- "declaration": {
14770
- "name": "AssistantAppSettingsProvider",
14771
- "module": "src/provider/assistant-app-settings.ts"
14772
- }
14773
- }
14774
- ]
14775
- },
14776
- {
14777
- "kind": "javascript-module",
14778
- "path": "src/provider/tiered-provider-switcher.ts",
14779
- "declarations": [
14780
- {
14781
- "kind": "class",
14782
- "description": "Which cloud vendor backs the tier-shaped provider registry, plus the means to move it at\nruntime (GENC-1610).",
14783
- "name": "TieredAIProviderSwitcher",
14784
- "members": [
14785
- {
14786
- "kind": "field",
14787
- "name": "builtVendors",
14788
- "type": {
14789
- "text": "readonly AITierVendor[]"
14790
- },
14791
- "privacy": "private",
14792
- "readonly": true,
14793
- "description": "The vendors it was constructed with: TieredAIProviderSwitcher.setAvailableVendors\nchooses among these and never adds one."
14794
- },
14795
- {
14796
- "kind": "field",
14797
- "name": "_vendors",
14798
- "type": {
14799
- "text": "readonly AITierVendor[]"
14800
- },
14801
- "privacy": "private"
14802
- },
14803
- {
14804
- "kind": "field",
14805
- "name": "options",
14806
- "type": {
14807
- "text": "TieredAIProviderSwitcherOptions"
14808
- },
14809
- "privacy": "private",
14810
- "readonly": true,
14811
- "default": "options"
14812
- },
14813
- {
14814
- "kind": "field",
14815
- "name": "defaultTier",
14816
- "type": {
14817
- "text": "AITierId"
14818
- },
14819
- "privacy": "private",
14820
- "readonly": true
14821
- },
14822
- {
14823
- "kind": "field",
14824
- "name": "registry",
14825
- "type": {
14826
- "text": "MutableAIProviderRegistry"
14827
- },
14828
- "privacy": "private",
14829
- "readonly": true
14830
- },
14831
- {
14832
- "kind": "field",
14833
- "name": "listeners",
14834
- "privacy": "private",
14835
- "readonly": true,
14836
- "default": "new Set<(vendor: AITierVendor) => void>()"
14837
- },
14838
- {
14839
- "kind": "field",
14840
- "name": "_vendor",
14841
- "type": {
14842
- "text": "AITierVendor"
14843
- },
14844
- "privacy": "private"
14845
- },
14846
- {
14847
- "kind": "field",
14848
- "name": "vendorChoice",
14849
- "type": {
14850
- "text": "AIVendorChoice | undefined"
14851
- },
14852
- "readonly": true,
14853
- "description": "Who chooses the vendor, as the options said."
14854
- },
14855
- {
14856
- "kind": "field",
14857
- "name": "vendor",
14858
- "type": {
14859
- "text": "AITierVendor"
14860
- },
14861
- "readonly": true
14862
- },
14863
- {
14864
- "kind": "field",
14865
- "name": "vendors",
14866
- "type": {
14867
- "text": "readonly AITierVendor[]"
14868
- },
14869
- "description": "The vendors it can switch between now: `vendors` as constructed, unless\nTieredAIProviderSwitcher.setAvailableVendors has narrowed them since.",
14870
- "readonly": true
14871
- },
14872
- {
14873
- "kind": "method",
14874
- "name": "setAvailableVendors",
14875
- "return": {
14876
- "type": {
14877
- "text": "void"
14878
- }
14879
- },
14880
- "parameters": [
14881
- {
14882
- "name": "vendors",
14883
- "type": {
14884
- "text": "readonly string[]"
14885
- }
14886
- },
14887
- {
14888
- "name": "active",
14889
- "optional": true,
14890
- "type": {
14891
- "text": "string"
14892
- }
14893
- }
14894
- ],
14895
- "description": "Change which vendors are available, within the ones it was constructed with, and optionally\nwhich one is active — in one registry rebuild."
14896
- },
14897
- {
14898
- "kind": "method",
14899
- "name": "switchTo",
14900
- "return": {
14901
- "type": {
14902
- "text": "void"
14903
- }
14904
- },
14905
- "parameters": [
14906
- {
14907
- "name": "vendor",
14908
- "type": {
14909
- "text": "string"
14910
- }
14911
- }
14912
- ],
14913
- "description": "A user-driven switch: move the registry, then tell the app so it can persist the choice.\nAn unknown vendor is ignored."
14914
- },
14915
- {
14916
- "kind": "method",
14917
- "name": "adoptPersistedVendor",
14918
- "return": {
14919
- "type": {
14920
- "text": "void"
14921
- }
14922
- },
14923
- "parameters": [
14924
- {
14925
- "name": "vendor",
14926
- "type": {
14927
- "text": "string"
14928
- }
14929
- }
14930
- ],
14931
- "description": "Adopt a vendor the app read back from its own store — the same registry move as\nTieredAIProviderSwitcher.switchTo, without the `onSwitch` callback, because this\nvalue came FROM the store and writing it back would be a pointless round-trip on load.\n\nExists because registration has to stay synchronous: an element that connects before the\ntoken is registered caches the platform's no-op fallback, so an app cannot await its\nstored preference before constructing this. It boots on `initialVendor` and adopts the\nstored one a moment later, through a registry that is mutable and held by reference."
14932
- },
14933
- {
14934
- "kind": "method",
14935
- "name": "subscribe",
14936
- "return": {
14937
- "type": {
14938
- "text": "() => void"
14939
- }
14940
- },
14941
- "parameters": [
14942
- {
14943
- "name": "listener",
14944
- "type": {
14945
- "text": "(vendor: string) => void"
14946
- }
14947
- }
14948
- ]
14949
- },
14950
- {
14951
- "kind": "method",
14952
- "name": "apply",
14953
- "privacy": "private",
14954
- "return": {
14955
- "type": {
14956
- "text": "void"
14957
- }
14958
- },
14959
- "parameters": [
14960
- {
14961
- "name": "vendor",
14962
- "type": {
14963
- "text": "AITierVendor"
14964
- }
14965
- }
14966
- ],
14967
- "description": "The registry move both entry points share, and nothing else."
14968
- },
14969
- {
14970
- "kind": "method",
14971
- "name": "build",
14972
- "privacy": "private",
14973
- "return": {
14974
- "type": {
14975
- "text": "Record<string, AIProvider>"
14976
- }
14977
- },
14978
- "parameters": [
14979
- {
14980
- "name": "vendor",
14981
- "type": {
14982
- "text": "AITierVendor"
14983
- }
14984
- }
14985
- ]
14986
- },
14987
- {
14988
- "kind": "method",
14989
- "name": "isKnownVendor",
14990
- "privacy": "private",
14991
- "return": {
14992
- "type": {
14993
- "text": "vendor is AITierVendor"
14994
- }
14995
- },
14996
- "parameters": [
14997
- {
14998
- "name": "vendor",
14999
- "type": {
15000
- "text": "string"
15001
- }
15002
- }
15003
- ]
15004
- }
15005
- ]
15006
- },
15007
- {
15008
- "kind": "function",
15009
- "name": "registerTieredAIProviders",
15010
- "return": {
15011
- "type": {
15012
- "text": "TieredAIProviderSwitcher"
15013
- }
15014
- },
15015
- "parameters": [
15016
- {
15017
- "name": "container",
15018
- "type": {
15019
- "text": "Container"
15020
- }
15021
- },
15022
- {
15023
- "name": "options",
15024
- "type": {
15025
- "text": "Omit<TieredAIProviderSwitcherOptions, 'container'>"
15026
- }
15027
- }
15028
- ],
15029
- "description": "Build a TieredAIProviderSwitcher — which registers the tier-shaped provider\nregistry — and put it on the (AIProviderSwitcher:variable) token. Call once at app\nbootstrap."
15030
- }
15031
- ],
15032
- "exports": [
15033
- {
15034
- "kind": "js",
15035
- "name": "TieredAIProviderSwitcher",
15036
- "declaration": {
15037
- "name": "TieredAIProviderSwitcher",
15038
- "module": "src/provider/tiered-provider-switcher.ts"
15039
- }
15040
- },
15041
- {
15042
- "kind": "js",
15043
- "name": "registerTieredAIProviders",
15044
- "declaration": {
15045
- "name": "registerTieredAIProviders",
15046
- "module": "src/provider/tiered-provider-switcher.ts"
15047
- }
15048
- }
15049
- ]
15050
- },
15051
15051
  {
15052
15052
  "kind": "javascript-module",
15053
15053
  "path": "src/suggestions/chat-suggestions.ts",