@genesislcap/ai-assistant 15.46.3-FUI-0-form-export.1 → 15.46.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/custom-elements.json +497 -497
- package/package.json +17 -17
|
@@ -6410,318 +6410,340 @@
|
|
|
6410
6410
|
},
|
|
6411
6411
|
{
|
|
6412
6412
|
"kind": "javascript-module",
|
|
6413
|
-
"path": "src/
|
|
6413
|
+
"path": "src/provider/ai-provider-switcher.ts",
|
|
6414
6414
|
"declarations": [
|
|
6415
|
-
{
|
|
6416
|
-
"kind": "function",
|
|
6417
|
-
"name": "createDefaultSessionState",
|
|
6418
|
-
"return": {
|
|
6419
|
-
"type": {
|
|
6420
|
-
"text": "AiAssistantSessionState"
|
|
6421
|
-
}
|
|
6422
|
-
},
|
|
6423
|
-
"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."
|
|
6424
|
-
},
|
|
6425
|
-
{
|
|
6426
|
-
"kind": "variable",
|
|
6427
|
-
"name": "defaultSessionState",
|
|
6428
|
-
"type": {
|
|
6429
|
-
"text": "AiAssistantSessionState"
|
|
6430
|
-
}
|
|
6431
|
-
},
|
|
6432
6415
|
{
|
|
6433
6416
|
"kind": "variable",
|
|
6434
|
-
"name": "
|
|
6417
|
+
"name": "AIProviderSwitcher",
|
|
6418
|
+
"description": "The DI token for the (AIProviderSwitcher:interface). Resolves a noop until the app\nregisters one."
|
|
6435
6419
|
}
|
|
6436
6420
|
],
|
|
6437
6421
|
"exports": [
|
|
6438
6422
|
{
|
|
6439
6423
|
"kind": "js",
|
|
6440
|
-
"name": "
|
|
6424
|
+
"name": "AIProviderSwitcher",
|
|
6441
6425
|
"declaration": {
|
|
6442
|
-
"name": "
|
|
6443
|
-
"module": "src/
|
|
6426
|
+
"name": "AIProviderSwitcher",
|
|
6427
|
+
"module": "src/provider/ai-provider-switcher.ts"
|
|
6444
6428
|
}
|
|
6445
|
-
}
|
|
6429
|
+
}
|
|
6430
|
+
]
|
|
6431
|
+
},
|
|
6432
|
+
{
|
|
6433
|
+
"kind": "javascript-module",
|
|
6434
|
+
"path": "src/provider/assistant-app-settings.ts",
|
|
6435
|
+
"declarations": [
|
|
6446
6436
|
{
|
|
6447
|
-
"kind": "
|
|
6448
|
-
"name": "
|
|
6449
|
-
"
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
},
|
|
6437
|
+
"kind": "variable",
|
|
6438
|
+
"name": "AssistantAppSettingsProvider",
|
|
6439
|
+
"description": "The DI token for the (AssistantAppSettingsProvider:interface). Resolves a noop\nuntil the host registers one."
|
|
6440
|
+
}
|
|
6441
|
+
],
|
|
6442
|
+
"exports": [
|
|
6454
6443
|
{
|
|
6455
6444
|
"kind": "js",
|
|
6456
|
-
"name": "
|
|
6445
|
+
"name": "AssistantAppSettingsProvider",
|
|
6457
6446
|
"declaration": {
|
|
6458
|
-
"name": "
|
|
6459
|
-
"module": "src/
|
|
6447
|
+
"name": "AssistantAppSettingsProvider",
|
|
6448
|
+
"module": "src/provider/assistant-app-settings.ts"
|
|
6460
6449
|
}
|
|
6461
6450
|
}
|
|
6462
6451
|
]
|
|
6463
6452
|
},
|
|
6464
6453
|
{
|
|
6465
6454
|
"kind": "javascript-module",
|
|
6466
|
-
"path": "src/
|
|
6455
|
+
"path": "src/provider/tiered-provider-switcher.ts",
|
|
6467
6456
|
"declarations": [
|
|
6468
6457
|
{
|
|
6469
|
-
"kind": "
|
|
6470
|
-
"
|
|
6471
|
-
"
|
|
6472
|
-
|
|
6473
|
-
},
|
|
6474
|
-
"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 '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 'external-diagnostics.folded': 'normal',\n 'session.cleared': 'normal',\n 'session.switched': 'low',\n 'session.switch-deferred': 'low',\n 'persistence.restored': '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}",
|
|
6475
|
-
"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."
|
|
6476
|
-
},
|
|
6477
|
-
{
|
|
6478
|
-
"kind": "function",
|
|
6479
|
-
"name": "recordMetaEvent",
|
|
6480
|
-
"return": {
|
|
6481
|
-
"type": {
|
|
6482
|
-
"text": "void"
|
|
6483
|
-
}
|
|
6484
|
-
},
|
|
6485
|
-
"parameters": [
|
|
6458
|
+
"kind": "class",
|
|
6459
|
+
"description": "Which cloud vendor backs the tier-shaped provider registry, plus the means to move it at\nruntime (GENC-1610).",
|
|
6460
|
+
"name": "TieredAIProviderSwitcher",
|
|
6461
|
+
"members": [
|
|
6486
6462
|
{
|
|
6487
|
-
"
|
|
6463
|
+
"kind": "field",
|
|
6464
|
+
"name": "vendors",
|
|
6488
6465
|
"type": {
|
|
6489
|
-
"text": "
|
|
6490
|
-
}
|
|
6466
|
+
"text": "readonly AITierVendor[]"
|
|
6467
|
+
},
|
|
6468
|
+
"readonly": true
|
|
6491
6469
|
},
|
|
6492
6470
|
{
|
|
6493
|
-
"
|
|
6471
|
+
"kind": "field",
|
|
6472
|
+
"name": "options",
|
|
6494
6473
|
"type": {
|
|
6495
|
-
"text": "
|
|
6496
|
-
}
|
|
6474
|
+
"text": "TieredAIProviderSwitcherOptions"
|
|
6475
|
+
},
|
|
6476
|
+
"privacy": "private",
|
|
6477
|
+
"readonly": true,
|
|
6478
|
+
"default": "options"
|
|
6497
6479
|
},
|
|
6498
6480
|
{
|
|
6499
|
-
"
|
|
6500
|
-
"
|
|
6501
|
-
"type": {
|
|
6502
|
-
"text": "Record<string, unknown>"
|
|
6503
|
-
}
|
|
6504
|
-
}
|
|
6505
|
-
],
|
|
6506
|
-
"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."
|
|
6507
|
-
},
|
|
6508
|
-
{
|
|
6509
|
-
"kind": "function",
|
|
6510
|
-
"name": "recordTurnError",
|
|
6511
|
-
"return": {
|
|
6512
|
-
"type": {
|
|
6513
|
-
"text": "void"
|
|
6514
|
-
}
|
|
6515
|
-
},
|
|
6516
|
-
"parameters": [
|
|
6517
|
-
{
|
|
6518
|
-
"name": "key",
|
|
6481
|
+
"kind": "field",
|
|
6482
|
+
"name": "defaultTier",
|
|
6519
6483
|
"type": {
|
|
6520
|
-
"text": "
|
|
6521
|
-
}
|
|
6484
|
+
"text": "AITierId"
|
|
6485
|
+
},
|
|
6486
|
+
"privacy": "private",
|
|
6487
|
+
"readonly": true
|
|
6522
6488
|
},
|
|
6523
6489
|
{
|
|
6524
|
-
"
|
|
6490
|
+
"kind": "field",
|
|
6491
|
+
"name": "registry",
|
|
6525
6492
|
"type": {
|
|
6526
|
-
"text": "
|
|
6527
|
-
}
|
|
6493
|
+
"text": "MutableAIProviderRegistry"
|
|
6494
|
+
},
|
|
6495
|
+
"privacy": "private",
|
|
6496
|
+
"readonly": true
|
|
6528
6497
|
},
|
|
6529
6498
|
{
|
|
6530
|
-
"
|
|
6531
|
-
"
|
|
6532
|
-
"
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
}
|
|
6536
|
-
],
|
|
6537
|
-
"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`."
|
|
6538
|
-
},
|
|
6539
|
-
{
|
|
6540
|
-
"kind": "function",
|
|
6541
|
-
"name": "recordTurnRetry",
|
|
6542
|
-
"return": {
|
|
6543
|
-
"type": {
|
|
6544
|
-
"text": "void"
|
|
6545
|
-
}
|
|
6546
|
-
},
|
|
6547
|
-
"parameters": [
|
|
6548
|
-
{
|
|
6549
|
-
"name": "key",
|
|
6550
|
-
"type": {
|
|
6551
|
-
"text": "string"
|
|
6552
|
-
}
|
|
6499
|
+
"kind": "field",
|
|
6500
|
+
"name": "listeners",
|
|
6501
|
+
"privacy": "private",
|
|
6502
|
+
"readonly": true,
|
|
6503
|
+
"default": "new Set<(vendor: AITierVendor) => void>()"
|
|
6553
6504
|
},
|
|
6554
6505
|
{
|
|
6555
|
-
"
|
|
6506
|
+
"kind": "field",
|
|
6507
|
+
"name": "_vendor",
|
|
6556
6508
|
"type": {
|
|
6557
|
-
"text": "
|
|
6558
|
-
}
|
|
6509
|
+
"text": "AITierVendor"
|
|
6510
|
+
},
|
|
6511
|
+
"privacy": "private"
|
|
6559
6512
|
},
|
|
6560
6513
|
{
|
|
6561
|
-
"
|
|
6562
|
-
"
|
|
6514
|
+
"kind": "field",
|
|
6515
|
+
"name": "vendor",
|
|
6563
6516
|
"type": {
|
|
6564
|
-
"text": "
|
|
6565
|
-
}
|
|
6566
|
-
|
|
6567
|
-
|
|
6568
|
-
"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."
|
|
6569
|
-
},
|
|
6570
|
-
{
|
|
6571
|
-
"kind": "function",
|
|
6572
|
-
"name": "getMetaEvents",
|
|
6573
|
-
"return": {
|
|
6574
|
-
"type": {
|
|
6575
|
-
"text": "ReadonlyArray<MetaEvent>"
|
|
6576
|
-
}
|
|
6577
|
-
},
|
|
6578
|
-
"parameters": [
|
|
6517
|
+
"text": "AITierVendor"
|
|
6518
|
+
},
|
|
6519
|
+
"readonly": true
|
|
6520
|
+
},
|
|
6579
6521
|
{
|
|
6580
|
-
"
|
|
6581
|
-
"
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
|
|
6596
|
-
|
|
6522
|
+
"kind": "method",
|
|
6523
|
+
"name": "switchTo",
|
|
6524
|
+
"return": {
|
|
6525
|
+
"type": {
|
|
6526
|
+
"text": "void"
|
|
6527
|
+
}
|
|
6528
|
+
},
|
|
6529
|
+
"parameters": [
|
|
6530
|
+
{
|
|
6531
|
+
"name": "vendor",
|
|
6532
|
+
"type": {
|
|
6533
|
+
"text": "string"
|
|
6534
|
+
}
|
|
6535
|
+
}
|
|
6536
|
+
],
|
|
6537
|
+
"description": "A user-driven switch: move the registry, then tell the app so it can persist the choice.\nAn unknown vendor is ignored."
|
|
6538
|
+
},
|
|
6597
6539
|
{
|
|
6598
|
-
"
|
|
6599
|
-
"
|
|
6600
|
-
|
|
6601
|
-
|
|
6540
|
+
"kind": "method",
|
|
6541
|
+
"name": "adoptPersistedVendor",
|
|
6542
|
+
"return": {
|
|
6543
|
+
"type": {
|
|
6544
|
+
"text": "void"
|
|
6545
|
+
}
|
|
6546
|
+
},
|
|
6547
|
+
"parameters": [
|
|
6548
|
+
{
|
|
6549
|
+
"name": "vendor",
|
|
6550
|
+
"type": {
|
|
6551
|
+
"text": "string"
|
|
6552
|
+
}
|
|
6553
|
+
}
|
|
6554
|
+
],
|
|
6555
|
+
"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."
|
|
6602
6556
|
},
|
|
6603
6557
|
{
|
|
6604
|
-
"
|
|
6605
|
-
"
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6558
|
+
"kind": "method",
|
|
6559
|
+
"name": "subscribe",
|
|
6560
|
+
"return": {
|
|
6561
|
+
"type": {
|
|
6562
|
+
"text": "() => void"
|
|
6563
|
+
}
|
|
6564
|
+
},
|
|
6565
|
+
"parameters": [
|
|
6566
|
+
{
|
|
6567
|
+
"name": "listener",
|
|
6568
|
+
"type": {
|
|
6569
|
+
"text": "(vendor: string) => void"
|
|
6570
|
+
}
|
|
6571
|
+
}
|
|
6572
|
+
]
|
|
6573
|
+
},
|
|
6574
|
+
{
|
|
6575
|
+
"kind": "method",
|
|
6576
|
+
"name": "apply",
|
|
6577
|
+
"privacy": "private",
|
|
6578
|
+
"return": {
|
|
6579
|
+
"type": {
|
|
6580
|
+
"text": "void"
|
|
6581
|
+
}
|
|
6582
|
+
},
|
|
6583
|
+
"parameters": [
|
|
6584
|
+
{
|
|
6585
|
+
"name": "vendor",
|
|
6586
|
+
"type": {
|
|
6587
|
+
"text": "AITierVendor"
|
|
6588
|
+
}
|
|
6589
|
+
}
|
|
6590
|
+
],
|
|
6591
|
+
"description": "The registry move both entry points share, and nothing else."
|
|
6592
|
+
},
|
|
6593
|
+
{
|
|
6594
|
+
"kind": "method",
|
|
6595
|
+
"name": "build",
|
|
6596
|
+
"privacy": "private",
|
|
6597
|
+
"return": {
|
|
6598
|
+
"type": {
|
|
6599
|
+
"text": "Record<string, AIProvider>"
|
|
6600
|
+
}
|
|
6601
|
+
},
|
|
6602
|
+
"parameters": [
|
|
6603
|
+
{
|
|
6604
|
+
"name": "vendor",
|
|
6605
|
+
"type": {
|
|
6606
|
+
"text": "AITierVendor"
|
|
6607
|
+
}
|
|
6608
|
+
}
|
|
6609
|
+
]
|
|
6610
|
+
},
|
|
6611
|
+
{
|
|
6612
|
+
"kind": "method",
|
|
6613
|
+
"name": "isKnownVendor",
|
|
6614
|
+
"privacy": "private",
|
|
6615
|
+
"return": {
|
|
6616
|
+
"type": {
|
|
6617
|
+
"text": "vendor is AITierVendor"
|
|
6618
|
+
}
|
|
6619
|
+
},
|
|
6620
|
+
"parameters": [
|
|
6621
|
+
{
|
|
6622
|
+
"name": "vendor",
|
|
6623
|
+
"type": {
|
|
6624
|
+
"text": "string"
|
|
6625
|
+
}
|
|
6626
|
+
}
|
|
6627
|
+
]
|
|
6628
|
+
}
|
|
6629
|
+
]
|
|
6630
|
+
},
|
|
6631
|
+
{
|
|
6632
|
+
"kind": "function",
|
|
6633
|
+
"name": "registerTieredAIProviders",
|
|
6615
6634
|
"return": {
|
|
6616
6635
|
"type": {
|
|
6617
|
-
"text": "
|
|
6636
|
+
"text": "TieredAIProviderSwitcher"
|
|
6618
6637
|
}
|
|
6619
6638
|
},
|
|
6620
6639
|
"parameters": [
|
|
6621
6640
|
{
|
|
6622
|
-
"name": "
|
|
6641
|
+
"name": "container",
|
|
6623
6642
|
"type": {
|
|
6624
|
-
"text": "
|
|
6643
|
+
"text": "Container"
|
|
6644
|
+
}
|
|
6645
|
+
},
|
|
6646
|
+
{
|
|
6647
|
+
"name": "options",
|
|
6648
|
+
"type": {
|
|
6649
|
+
"text": "Omit<TieredAIProviderSwitcherOptions, 'container'>"
|
|
6625
6650
|
}
|
|
6626
6651
|
}
|
|
6627
6652
|
],
|
|
6628
|
-
"description": "
|
|
6629
|
-
},
|
|
6630
|
-
{
|
|
6631
|
-
"kind": "variable",
|
|
6632
|
-
"name": "DEBUG_LOG_README",
|
|
6633
|
-
"type": {
|
|
6634
|
-
"text": "readonly string[]"
|
|
6635
|
-
},
|
|
6636
|
-
"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.\",\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 an N-M `turnIndex`, 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 numbered under the parent turn that activated them ('3-1', '3-2', …, and a nested sub-agent contributes '3-2-1', …), 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.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; 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 an N-M `turnIndex`; 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; 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), context.updated/threshold-crossed (token + cost), 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 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. 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 turn was routed, emitted by the orchestrating driver before the agent runs (and again after every handoff). `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), 'ballot-exhausted' (every eligible specialist had already handed off this turn, so the ballot was empty and NO call was made — distinct from 'no-match', where one ran and declined), 'pinned' (a user pin 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 actually ON THE BALLOT, in ballot order, so `index` — the classifier's own answer — indexes it directly; `excluded` names the specialists left off because they already handed off this turn, so the full eligible set is `candidates` ∪ `excluded`. `candidates` is absent on the four decisions that put nothing to a vote — 'pinned', 'single-candidate', 'no-specialists', 'ballot-exhausted'. 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 four decisions that can reach the fallback 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]",
|
|
6637
|
-
"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."
|
|
6653
|
+
"description": "Build a TieredAIProviderSwitcher — which registers the tier-shaped provider\nregistry — and put it on the (AIProviderSwitcher:variable) token. Call once at app\nbootstrap."
|
|
6638
6654
|
}
|
|
6639
6655
|
],
|
|
6640
6656
|
"exports": [
|
|
6641
6657
|
{
|
|
6642
6658
|
"kind": "js",
|
|
6643
|
-
"name": "
|
|
6644
|
-
"declaration": {
|
|
6645
|
-
"name": "META_EVENT_IMPORTANCE",
|
|
6646
|
-
"module": "src/state/debug-event-log.ts"
|
|
6647
|
-
}
|
|
6648
|
-
},
|
|
6649
|
-
{
|
|
6650
|
-
"kind": "js",
|
|
6651
|
-
"name": "recordMetaEvent",
|
|
6659
|
+
"name": "TieredAIProviderSwitcher",
|
|
6652
6660
|
"declaration": {
|
|
6653
|
-
"name": "
|
|
6654
|
-
"module": "src/
|
|
6661
|
+
"name": "TieredAIProviderSwitcher",
|
|
6662
|
+
"module": "src/provider/tiered-provider-switcher.ts"
|
|
6655
6663
|
}
|
|
6656
6664
|
},
|
|
6657
6665
|
{
|
|
6658
6666
|
"kind": "js",
|
|
6659
|
-
"name": "
|
|
6667
|
+
"name": "registerTieredAIProviders",
|
|
6660
6668
|
"declaration": {
|
|
6661
|
-
"name": "
|
|
6662
|
-
"module": "src/
|
|
6669
|
+
"name": "registerTieredAIProviders",
|
|
6670
|
+
"module": "src/provider/tiered-provider-switcher.ts"
|
|
6663
6671
|
}
|
|
6664
|
-
}
|
|
6672
|
+
}
|
|
6673
|
+
]
|
|
6674
|
+
},
|
|
6675
|
+
{
|
|
6676
|
+
"kind": "javascript-module",
|
|
6677
|
+
"path": "src/state/ai-assistant-slice.ts",
|
|
6678
|
+
"declarations": [
|
|
6665
6679
|
{
|
|
6666
|
-
"kind": "
|
|
6667
|
-
"name": "
|
|
6668
|
-
"
|
|
6669
|
-
"
|
|
6670
|
-
|
|
6671
|
-
|
|
6680
|
+
"kind": "function",
|
|
6681
|
+
"name": "createDefaultSessionState",
|
|
6682
|
+
"return": {
|
|
6683
|
+
"type": {
|
|
6684
|
+
"text": "AiAssistantSessionState"
|
|
6685
|
+
}
|
|
6686
|
+
},
|
|
6687
|
+
"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."
|
|
6672
6688
|
},
|
|
6673
6689
|
{
|
|
6674
|
-
"kind": "
|
|
6675
|
-
"name": "
|
|
6676
|
-
"
|
|
6677
|
-
"
|
|
6678
|
-
"module": "src/state/debug-event-log.ts"
|
|
6690
|
+
"kind": "variable",
|
|
6691
|
+
"name": "defaultSessionState",
|
|
6692
|
+
"type": {
|
|
6693
|
+
"text": "AiAssistantSessionState"
|
|
6679
6694
|
}
|
|
6680
6695
|
},
|
|
6681
6696
|
{
|
|
6682
|
-
"kind": "
|
|
6683
|
-
"name": "
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
}
|
|
6688
|
-
},
|
|
6697
|
+
"kind": "variable",
|
|
6698
|
+
"name": "aiAssistantSlice"
|
|
6699
|
+
}
|
|
6700
|
+
],
|
|
6701
|
+
"exports": [
|
|
6689
6702
|
{
|
|
6690
6703
|
"kind": "js",
|
|
6691
|
-
"name": "
|
|
6704
|
+
"name": "createDefaultSessionState",
|
|
6692
6705
|
"declaration": {
|
|
6693
|
-
"name": "
|
|
6694
|
-
"module": "src/state/
|
|
6706
|
+
"name": "createDefaultSessionState",
|
|
6707
|
+
"module": "src/state/ai-assistant-slice.ts"
|
|
6695
6708
|
}
|
|
6696
6709
|
},
|
|
6697
6710
|
{
|
|
6698
6711
|
"kind": "js",
|
|
6699
|
-
"name": "
|
|
6712
|
+
"name": "defaultSessionState",
|
|
6700
6713
|
"declaration": {
|
|
6701
|
-
"name": "
|
|
6702
|
-
"module": "src/state/
|
|
6714
|
+
"name": "defaultSessionState",
|
|
6715
|
+
"module": "src/state/ai-assistant-slice.ts"
|
|
6703
6716
|
}
|
|
6704
6717
|
},
|
|
6705
6718
|
{
|
|
6706
6719
|
"kind": "js",
|
|
6707
|
-
"name": "
|
|
6720
|
+
"name": "aiAssistantSlice",
|
|
6708
6721
|
"declaration": {
|
|
6709
|
-
"name": "
|
|
6710
|
-
"module": "src/state/
|
|
6722
|
+
"name": "aiAssistantSlice",
|
|
6723
|
+
"module": "src/state/ai-assistant-slice.ts"
|
|
6711
6724
|
}
|
|
6712
6725
|
}
|
|
6713
6726
|
]
|
|
6714
6727
|
},
|
|
6715
6728
|
{
|
|
6716
6729
|
"kind": "javascript-module",
|
|
6717
|
-
"path": "src/state/
|
|
6730
|
+
"path": "src/state/debug-event-log.ts",
|
|
6718
6731
|
"declarations": [
|
|
6732
|
+
{
|
|
6733
|
+
"kind": "variable",
|
|
6734
|
+
"name": "META_EVENT_IMPORTANCE",
|
|
6735
|
+
"type": {
|
|
6736
|
+
"text": "Record<MetaEventType, MetaEventImportance>"
|
|
6737
|
+
},
|
|
6738
|
+
"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 '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 'external-diagnostics.folded': 'normal',\n 'session.cleared': 'normal',\n 'session.switched': 'low',\n 'session.switch-deferred': 'low',\n 'persistence.restored': '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}",
|
|
6739
|
+
"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."
|
|
6740
|
+
},
|
|
6719
6741
|
{
|
|
6720
6742
|
"kind": "function",
|
|
6721
|
-
"name": "
|
|
6743
|
+
"name": "recordMetaEvent",
|
|
6722
6744
|
"return": {
|
|
6723
6745
|
"type": {
|
|
6724
|
-
"text": "
|
|
6746
|
+
"text": "void"
|
|
6725
6747
|
}
|
|
6726
6748
|
},
|
|
6727
6749
|
"parameters": [
|
|
@@ -6732,26 +6754,27 @@
|
|
|
6732
6754
|
}
|
|
6733
6755
|
},
|
|
6734
6756
|
{
|
|
6735
|
-
"name": "
|
|
6757
|
+
"name": "type",
|
|
6736
6758
|
"type": {
|
|
6737
|
-
"text": "
|
|
6759
|
+
"text": "MetaEventType"
|
|
6738
6760
|
}
|
|
6739
6761
|
},
|
|
6740
6762
|
{
|
|
6741
|
-
"name": "
|
|
6763
|
+
"name": "detail",
|
|
6764
|
+
"optional": true,
|
|
6742
6765
|
"type": {
|
|
6743
|
-
"text": "
|
|
6766
|
+
"text": "Record<string, unknown>"
|
|
6744
6767
|
}
|
|
6745
6768
|
}
|
|
6746
6769
|
],
|
|
6747
|
-
"description": "
|
|
6770
|
+
"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."
|
|
6748
6771
|
},
|
|
6749
6772
|
{
|
|
6750
6773
|
"kind": "function",
|
|
6751
|
-
"name": "
|
|
6774
|
+
"name": "recordTurnError",
|
|
6752
6775
|
"return": {
|
|
6753
6776
|
"type": {
|
|
6754
|
-
"text": "
|
|
6777
|
+
"text": "void"
|
|
6755
6778
|
}
|
|
6756
6779
|
},
|
|
6757
6780
|
"parameters": [
|
|
@@ -6760,16 +6783,29 @@
|
|
|
6760
6783
|
"type": {
|
|
6761
6784
|
"text": "string"
|
|
6762
6785
|
}
|
|
6786
|
+
},
|
|
6787
|
+
{
|
|
6788
|
+
"name": "reason",
|
|
6789
|
+
"type": {
|
|
6790
|
+
"text": "TurnFailureReason"
|
|
6791
|
+
}
|
|
6792
|
+
},
|
|
6793
|
+
{
|
|
6794
|
+
"name": "detail",
|
|
6795
|
+
"optional": true,
|
|
6796
|
+
"type": {
|
|
6797
|
+
"text": "Record<string, unknown>"
|
|
6798
|
+
}
|
|
6763
6799
|
}
|
|
6764
6800
|
],
|
|
6765
|
-
"description": "
|
|
6801
|
+
"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`."
|
|
6766
6802
|
},
|
|
6767
6803
|
{
|
|
6768
6804
|
"kind": "function",
|
|
6769
|
-
"name": "
|
|
6805
|
+
"name": "recordTurnRetry",
|
|
6770
6806
|
"return": {
|
|
6771
6807
|
"type": {
|
|
6772
|
-
"text": "
|
|
6808
|
+
"text": "void"
|
|
6773
6809
|
}
|
|
6774
6810
|
},
|
|
6775
6811
|
"parameters": [
|
|
@@ -6778,16 +6814,29 @@
|
|
|
6778
6814
|
"type": {
|
|
6779
6815
|
"text": "string"
|
|
6780
6816
|
}
|
|
6817
|
+
},
|
|
6818
|
+
{
|
|
6819
|
+
"name": "reason",
|
|
6820
|
+
"type": {
|
|
6821
|
+
"text": "TurnFailureReason"
|
|
6822
|
+
}
|
|
6823
|
+
},
|
|
6824
|
+
{
|
|
6825
|
+
"name": "detail",
|
|
6826
|
+
"optional": true,
|
|
6827
|
+
"type": {
|
|
6828
|
+
"text": "Record<string, unknown>"
|
|
6829
|
+
}
|
|
6781
6830
|
}
|
|
6782
6831
|
],
|
|
6783
|
-
"description": "
|
|
6832
|
+
"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."
|
|
6784
6833
|
},
|
|
6785
6834
|
{
|
|
6786
6835
|
"kind": "function",
|
|
6787
|
-
"name": "
|
|
6836
|
+
"name": "getMetaEvents",
|
|
6788
6837
|
"return": {
|
|
6789
6838
|
"type": {
|
|
6790
|
-
"text": "
|
|
6839
|
+
"text": "ReadonlyArray<MetaEvent>"
|
|
6791
6840
|
}
|
|
6792
6841
|
},
|
|
6793
6842
|
"parameters": [
|
|
@@ -6798,12 +6847,227 @@
|
|
|
6798
6847
|
}
|
|
6799
6848
|
}
|
|
6800
6849
|
],
|
|
6801
|
-
"description": "
|
|
6802
|
-
}
|
|
6803
|
-
],
|
|
6804
|
-
"exports": [
|
|
6850
|
+
"description": "Returns the meta-event timeline for `key`, or an empty array if none recorded."
|
|
6851
|
+
},
|
|
6805
6852
|
{
|
|
6806
|
-
"kind": "
|
|
6853
|
+
"kind": "function",
|
|
6854
|
+
"name": "mergeMetaEvents",
|
|
6855
|
+
"return": {
|
|
6856
|
+
"type": {
|
|
6857
|
+
"text": "void"
|
|
6858
|
+
}
|
|
6859
|
+
},
|
|
6860
|
+
"parameters": [
|
|
6861
|
+
{
|
|
6862
|
+
"name": "targetKey",
|
|
6863
|
+
"type": {
|
|
6864
|
+
"text": "string"
|
|
6865
|
+
}
|
|
6866
|
+
},
|
|
6867
|
+
{
|
|
6868
|
+
"name": "events",
|
|
6869
|
+
"type": {
|
|
6870
|
+
"text": "readonly MetaEvent[]"
|
|
6871
|
+
}
|
|
6872
|
+
}
|
|
6873
|
+
],
|
|
6874
|
+
"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."
|
|
6875
|
+
},
|
|
6876
|
+
{
|
|
6877
|
+
"kind": "function",
|
|
6878
|
+
"name": "clearSession",
|
|
6879
|
+
"return": {
|
|
6880
|
+
"type": {
|
|
6881
|
+
"text": "void"
|
|
6882
|
+
}
|
|
6883
|
+
},
|
|
6884
|
+
"parameters": [
|
|
6885
|
+
{
|
|
6886
|
+
"name": "key",
|
|
6887
|
+
"type": {
|
|
6888
|
+
"text": "string"
|
|
6889
|
+
}
|
|
6890
|
+
}
|
|
6891
|
+
],
|
|
6892
|
+
"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."
|
|
6893
|
+
},
|
|
6894
|
+
{
|
|
6895
|
+
"kind": "variable",
|
|
6896
|
+
"name": "DEBUG_LOG_README",
|
|
6897
|
+
"type": {
|
|
6898
|
+
"text": "readonly string[]"
|
|
6899
|
+
},
|
|
6900
|
+
"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.\",\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 an N-M `turnIndex`, 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 numbered under the parent turn that activated them ('3-1', '3-2', …, and a nested sub-agent contributes '3-2-1', …), 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.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; 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 an N-M `turnIndex`; 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; 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), context.updated/threshold-crossed (token + cost), 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 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. 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 turn was routed, emitted by the orchestrating driver before the agent runs (and again after every handoff). `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), 'ballot-exhausted' (every eligible specialist had already handed off this turn, so the ballot was empty and NO call was made — distinct from 'no-match', where one ran and declined), 'pinned' (a user pin 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 actually ON THE BALLOT, in ballot order, so `index` — the classifier's own answer — indexes it directly; `excluded` names the specialists left off because they already handed off this turn, so the full eligible set is `candidates` ∪ `excluded`. `candidates` is absent on the four decisions that put nothing to a vote — 'pinned', 'single-candidate', 'no-specialists', 'ballot-exhausted'. 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 four decisions that can reach the fallback 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]",
|
|
6901
|
+
"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."
|
|
6902
|
+
}
|
|
6903
|
+
],
|
|
6904
|
+
"exports": [
|
|
6905
|
+
{
|
|
6906
|
+
"kind": "js",
|
|
6907
|
+
"name": "META_EVENT_IMPORTANCE",
|
|
6908
|
+
"declaration": {
|
|
6909
|
+
"name": "META_EVENT_IMPORTANCE",
|
|
6910
|
+
"module": "src/state/debug-event-log.ts"
|
|
6911
|
+
}
|
|
6912
|
+
},
|
|
6913
|
+
{
|
|
6914
|
+
"kind": "js",
|
|
6915
|
+
"name": "recordMetaEvent",
|
|
6916
|
+
"declaration": {
|
|
6917
|
+
"name": "recordMetaEvent",
|
|
6918
|
+
"module": "src/state/debug-event-log.ts"
|
|
6919
|
+
}
|
|
6920
|
+
},
|
|
6921
|
+
{
|
|
6922
|
+
"kind": "js",
|
|
6923
|
+
"name": "TurnFailureReason",
|
|
6924
|
+
"declaration": {
|
|
6925
|
+
"name": "TurnFailureReason",
|
|
6926
|
+
"module": "src/state/debug-event-log.ts"
|
|
6927
|
+
}
|
|
6928
|
+
},
|
|
6929
|
+
{
|
|
6930
|
+
"kind": "js",
|
|
6931
|
+
"name": "recordTurnError",
|
|
6932
|
+
"declaration": {
|
|
6933
|
+
"name": "recordTurnError",
|
|
6934
|
+
"module": "src/state/debug-event-log.ts"
|
|
6935
|
+
}
|
|
6936
|
+
},
|
|
6937
|
+
{
|
|
6938
|
+
"kind": "js",
|
|
6939
|
+
"name": "recordTurnRetry",
|
|
6940
|
+
"declaration": {
|
|
6941
|
+
"name": "recordTurnRetry",
|
|
6942
|
+
"module": "src/state/debug-event-log.ts"
|
|
6943
|
+
}
|
|
6944
|
+
},
|
|
6945
|
+
{
|
|
6946
|
+
"kind": "js",
|
|
6947
|
+
"name": "getMetaEvents",
|
|
6948
|
+
"declaration": {
|
|
6949
|
+
"name": "getMetaEvents",
|
|
6950
|
+
"module": "src/state/debug-event-log.ts"
|
|
6951
|
+
}
|
|
6952
|
+
},
|
|
6953
|
+
{
|
|
6954
|
+
"kind": "js",
|
|
6955
|
+
"name": "mergeMetaEvents",
|
|
6956
|
+
"declaration": {
|
|
6957
|
+
"name": "mergeMetaEvents",
|
|
6958
|
+
"module": "src/state/debug-event-log.ts"
|
|
6959
|
+
}
|
|
6960
|
+
},
|
|
6961
|
+
{
|
|
6962
|
+
"kind": "js",
|
|
6963
|
+
"name": "clearSession",
|
|
6964
|
+
"declaration": {
|
|
6965
|
+
"name": "clearSession",
|
|
6966
|
+
"module": "src/state/debug-event-log.ts"
|
|
6967
|
+
}
|
|
6968
|
+
},
|
|
6969
|
+
{
|
|
6970
|
+
"kind": "js",
|
|
6971
|
+
"name": "DEBUG_LOG_README",
|
|
6972
|
+
"declaration": {
|
|
6973
|
+
"name": "DEBUG_LOG_README",
|
|
6974
|
+
"module": "src/state/debug-event-log.ts"
|
|
6975
|
+
}
|
|
6976
|
+
}
|
|
6977
|
+
]
|
|
6978
|
+
},
|
|
6979
|
+
{
|
|
6980
|
+
"kind": "javascript-module",
|
|
6981
|
+
"path": "src/state/driver-registry.ts",
|
|
6982
|
+
"declarations": [
|
|
6983
|
+
{
|
|
6984
|
+
"kind": "function",
|
|
6985
|
+
"name": "getOrCreateDriver",
|
|
6986
|
+
"return": {
|
|
6987
|
+
"type": {
|
|
6988
|
+
"text": "AiDriver"
|
|
6989
|
+
}
|
|
6990
|
+
},
|
|
6991
|
+
"parameters": [
|
|
6992
|
+
{
|
|
6993
|
+
"name": "key",
|
|
6994
|
+
"type": {
|
|
6995
|
+
"text": "string"
|
|
6996
|
+
}
|
|
6997
|
+
},
|
|
6998
|
+
{
|
|
6999
|
+
"name": "agentsKey",
|
|
7000
|
+
"type": {
|
|
7001
|
+
"text": "string"
|
|
7002
|
+
}
|
|
7003
|
+
},
|
|
7004
|
+
{
|
|
7005
|
+
"name": "factory",
|
|
7006
|
+
"type": {
|
|
7007
|
+
"text": "() => AiDriver"
|
|
7008
|
+
}
|
|
7009
|
+
}
|
|
7010
|
+
],
|
|
7011
|
+
"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)."
|
|
7012
|
+
},
|
|
7013
|
+
{
|
|
7014
|
+
"kind": "function",
|
|
7015
|
+
"name": "getDriver",
|
|
7016
|
+
"return": {
|
|
7017
|
+
"type": {
|
|
7018
|
+
"text": "AiDriver | undefined"
|
|
7019
|
+
}
|
|
7020
|
+
},
|
|
7021
|
+
"parameters": [
|
|
7022
|
+
{
|
|
7023
|
+
"name": "key",
|
|
7024
|
+
"type": {
|
|
7025
|
+
"text": "string"
|
|
7026
|
+
}
|
|
7027
|
+
}
|
|
7028
|
+
],
|
|
7029
|
+
"description": "Returns the existing driver for the given key, or `undefined`."
|
|
7030
|
+
},
|
|
7031
|
+
{
|
|
7032
|
+
"kind": "function",
|
|
7033
|
+
"name": "getDriverAgentsKey",
|
|
7034
|
+
"return": {
|
|
7035
|
+
"type": {
|
|
7036
|
+
"text": "string | undefined"
|
|
7037
|
+
}
|
|
7038
|
+
},
|
|
7039
|
+
"parameters": [
|
|
7040
|
+
{
|
|
7041
|
+
"name": "key",
|
|
7042
|
+
"type": {
|
|
7043
|
+
"text": "string"
|
|
7044
|
+
}
|
|
7045
|
+
}
|
|
7046
|
+
],
|
|
7047
|
+
"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."
|
|
7048
|
+
},
|
|
7049
|
+
{
|
|
7050
|
+
"kind": "function",
|
|
7051
|
+
"name": "deleteDriver",
|
|
7052
|
+
"return": {
|
|
7053
|
+
"type": {
|
|
7054
|
+
"text": "AiDriver | undefined"
|
|
7055
|
+
}
|
|
7056
|
+
},
|
|
7057
|
+
"parameters": [
|
|
7058
|
+
{
|
|
7059
|
+
"name": "key",
|
|
7060
|
+
"type": {
|
|
7061
|
+
"text": "string"
|
|
7062
|
+
}
|
|
7063
|
+
}
|
|
7064
|
+
],
|
|
7065
|
+
"description": "Removes and returns the driver for the given key.\nUsed when agents change (driver must be rebuilt) or on explicit session teardown."
|
|
7066
|
+
}
|
|
7067
|
+
],
|
|
7068
|
+
"exports": [
|
|
7069
|
+
{
|
|
7070
|
+
"kind": "js",
|
|
6807
7071
|
"name": "getOrCreateDriver",
|
|
6808
7072
|
"declaration": {
|
|
6809
7073
|
"name": "getOrCreateDriver",
|
|
@@ -6951,270 +7215,6 @@
|
|
|
6951
7215
|
}
|
|
6952
7216
|
]
|
|
6953
7217
|
},
|
|
6954
|
-
{
|
|
6955
|
-
"kind": "javascript-module",
|
|
6956
|
-
"path": "src/provider/ai-provider-switcher.ts",
|
|
6957
|
-
"declarations": [
|
|
6958
|
-
{
|
|
6959
|
-
"kind": "variable",
|
|
6960
|
-
"name": "AIProviderSwitcher",
|
|
6961
|
-
"description": "The DI token for the (AIProviderSwitcher:interface). Resolves a noop until the app\nregisters one."
|
|
6962
|
-
}
|
|
6963
|
-
],
|
|
6964
|
-
"exports": [
|
|
6965
|
-
{
|
|
6966
|
-
"kind": "js",
|
|
6967
|
-
"name": "AIProviderSwitcher",
|
|
6968
|
-
"declaration": {
|
|
6969
|
-
"name": "AIProviderSwitcher",
|
|
6970
|
-
"module": "src/provider/ai-provider-switcher.ts"
|
|
6971
|
-
}
|
|
6972
|
-
}
|
|
6973
|
-
]
|
|
6974
|
-
},
|
|
6975
|
-
{
|
|
6976
|
-
"kind": "javascript-module",
|
|
6977
|
-
"path": "src/provider/assistant-app-settings.ts",
|
|
6978
|
-
"declarations": [
|
|
6979
|
-
{
|
|
6980
|
-
"kind": "variable",
|
|
6981
|
-
"name": "AssistantAppSettingsProvider",
|
|
6982
|
-
"description": "The DI token for the (AssistantAppSettingsProvider:interface). Resolves a noop\nuntil the host registers one."
|
|
6983
|
-
}
|
|
6984
|
-
],
|
|
6985
|
-
"exports": [
|
|
6986
|
-
{
|
|
6987
|
-
"kind": "js",
|
|
6988
|
-
"name": "AssistantAppSettingsProvider",
|
|
6989
|
-
"declaration": {
|
|
6990
|
-
"name": "AssistantAppSettingsProvider",
|
|
6991
|
-
"module": "src/provider/assistant-app-settings.ts"
|
|
6992
|
-
}
|
|
6993
|
-
}
|
|
6994
|
-
]
|
|
6995
|
-
},
|
|
6996
|
-
{
|
|
6997
|
-
"kind": "javascript-module",
|
|
6998
|
-
"path": "src/provider/tiered-provider-switcher.ts",
|
|
6999
|
-
"declarations": [
|
|
7000
|
-
{
|
|
7001
|
-
"kind": "class",
|
|
7002
|
-
"description": "Which cloud vendor backs the tier-shaped provider registry, plus the means to move it at\nruntime (GENC-1610).",
|
|
7003
|
-
"name": "TieredAIProviderSwitcher",
|
|
7004
|
-
"members": [
|
|
7005
|
-
{
|
|
7006
|
-
"kind": "field",
|
|
7007
|
-
"name": "vendors",
|
|
7008
|
-
"type": {
|
|
7009
|
-
"text": "readonly AITierVendor[]"
|
|
7010
|
-
},
|
|
7011
|
-
"readonly": true
|
|
7012
|
-
},
|
|
7013
|
-
{
|
|
7014
|
-
"kind": "field",
|
|
7015
|
-
"name": "options",
|
|
7016
|
-
"type": {
|
|
7017
|
-
"text": "TieredAIProviderSwitcherOptions"
|
|
7018
|
-
},
|
|
7019
|
-
"privacy": "private",
|
|
7020
|
-
"readonly": true,
|
|
7021
|
-
"default": "options"
|
|
7022
|
-
},
|
|
7023
|
-
{
|
|
7024
|
-
"kind": "field",
|
|
7025
|
-
"name": "defaultTier",
|
|
7026
|
-
"type": {
|
|
7027
|
-
"text": "AITierId"
|
|
7028
|
-
},
|
|
7029
|
-
"privacy": "private",
|
|
7030
|
-
"readonly": true
|
|
7031
|
-
},
|
|
7032
|
-
{
|
|
7033
|
-
"kind": "field",
|
|
7034
|
-
"name": "registry",
|
|
7035
|
-
"type": {
|
|
7036
|
-
"text": "MutableAIProviderRegistry"
|
|
7037
|
-
},
|
|
7038
|
-
"privacy": "private",
|
|
7039
|
-
"readonly": true
|
|
7040
|
-
},
|
|
7041
|
-
{
|
|
7042
|
-
"kind": "field",
|
|
7043
|
-
"name": "listeners",
|
|
7044
|
-
"privacy": "private",
|
|
7045
|
-
"readonly": true,
|
|
7046
|
-
"default": "new Set<(vendor: AITierVendor) => void>()"
|
|
7047
|
-
},
|
|
7048
|
-
{
|
|
7049
|
-
"kind": "field",
|
|
7050
|
-
"name": "_vendor",
|
|
7051
|
-
"type": {
|
|
7052
|
-
"text": "AITierVendor"
|
|
7053
|
-
},
|
|
7054
|
-
"privacy": "private"
|
|
7055
|
-
},
|
|
7056
|
-
{
|
|
7057
|
-
"kind": "field",
|
|
7058
|
-
"name": "vendor",
|
|
7059
|
-
"type": {
|
|
7060
|
-
"text": "AITierVendor"
|
|
7061
|
-
},
|
|
7062
|
-
"readonly": true
|
|
7063
|
-
},
|
|
7064
|
-
{
|
|
7065
|
-
"kind": "method",
|
|
7066
|
-
"name": "switchTo",
|
|
7067
|
-
"return": {
|
|
7068
|
-
"type": {
|
|
7069
|
-
"text": "void"
|
|
7070
|
-
}
|
|
7071
|
-
},
|
|
7072
|
-
"parameters": [
|
|
7073
|
-
{
|
|
7074
|
-
"name": "vendor",
|
|
7075
|
-
"type": {
|
|
7076
|
-
"text": "string"
|
|
7077
|
-
}
|
|
7078
|
-
}
|
|
7079
|
-
],
|
|
7080
|
-
"description": "A user-driven switch: move the registry, then tell the app so it can persist the choice.\nAn unknown vendor is ignored."
|
|
7081
|
-
},
|
|
7082
|
-
{
|
|
7083
|
-
"kind": "method",
|
|
7084
|
-
"name": "adoptPersistedVendor",
|
|
7085
|
-
"return": {
|
|
7086
|
-
"type": {
|
|
7087
|
-
"text": "void"
|
|
7088
|
-
}
|
|
7089
|
-
},
|
|
7090
|
-
"parameters": [
|
|
7091
|
-
{
|
|
7092
|
-
"name": "vendor",
|
|
7093
|
-
"type": {
|
|
7094
|
-
"text": "string"
|
|
7095
|
-
}
|
|
7096
|
-
}
|
|
7097
|
-
],
|
|
7098
|
-
"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."
|
|
7099
|
-
},
|
|
7100
|
-
{
|
|
7101
|
-
"kind": "method",
|
|
7102
|
-
"name": "subscribe",
|
|
7103
|
-
"return": {
|
|
7104
|
-
"type": {
|
|
7105
|
-
"text": "() => void"
|
|
7106
|
-
}
|
|
7107
|
-
},
|
|
7108
|
-
"parameters": [
|
|
7109
|
-
{
|
|
7110
|
-
"name": "listener",
|
|
7111
|
-
"type": {
|
|
7112
|
-
"text": "(vendor: string) => void"
|
|
7113
|
-
}
|
|
7114
|
-
}
|
|
7115
|
-
]
|
|
7116
|
-
},
|
|
7117
|
-
{
|
|
7118
|
-
"kind": "method",
|
|
7119
|
-
"name": "apply",
|
|
7120
|
-
"privacy": "private",
|
|
7121
|
-
"return": {
|
|
7122
|
-
"type": {
|
|
7123
|
-
"text": "void"
|
|
7124
|
-
}
|
|
7125
|
-
},
|
|
7126
|
-
"parameters": [
|
|
7127
|
-
{
|
|
7128
|
-
"name": "vendor",
|
|
7129
|
-
"type": {
|
|
7130
|
-
"text": "AITierVendor"
|
|
7131
|
-
}
|
|
7132
|
-
}
|
|
7133
|
-
],
|
|
7134
|
-
"description": "The registry move both entry points share, and nothing else."
|
|
7135
|
-
},
|
|
7136
|
-
{
|
|
7137
|
-
"kind": "method",
|
|
7138
|
-
"name": "build",
|
|
7139
|
-
"privacy": "private",
|
|
7140
|
-
"return": {
|
|
7141
|
-
"type": {
|
|
7142
|
-
"text": "Record<string, AIProvider>"
|
|
7143
|
-
}
|
|
7144
|
-
},
|
|
7145
|
-
"parameters": [
|
|
7146
|
-
{
|
|
7147
|
-
"name": "vendor",
|
|
7148
|
-
"type": {
|
|
7149
|
-
"text": "AITierVendor"
|
|
7150
|
-
}
|
|
7151
|
-
}
|
|
7152
|
-
]
|
|
7153
|
-
},
|
|
7154
|
-
{
|
|
7155
|
-
"kind": "method",
|
|
7156
|
-
"name": "isKnownVendor",
|
|
7157
|
-
"privacy": "private",
|
|
7158
|
-
"return": {
|
|
7159
|
-
"type": {
|
|
7160
|
-
"text": "vendor is AITierVendor"
|
|
7161
|
-
}
|
|
7162
|
-
},
|
|
7163
|
-
"parameters": [
|
|
7164
|
-
{
|
|
7165
|
-
"name": "vendor",
|
|
7166
|
-
"type": {
|
|
7167
|
-
"text": "string"
|
|
7168
|
-
}
|
|
7169
|
-
}
|
|
7170
|
-
]
|
|
7171
|
-
}
|
|
7172
|
-
]
|
|
7173
|
-
},
|
|
7174
|
-
{
|
|
7175
|
-
"kind": "function",
|
|
7176
|
-
"name": "registerTieredAIProviders",
|
|
7177
|
-
"return": {
|
|
7178
|
-
"type": {
|
|
7179
|
-
"text": "TieredAIProviderSwitcher"
|
|
7180
|
-
}
|
|
7181
|
-
},
|
|
7182
|
-
"parameters": [
|
|
7183
|
-
{
|
|
7184
|
-
"name": "container",
|
|
7185
|
-
"type": {
|
|
7186
|
-
"text": "Container"
|
|
7187
|
-
}
|
|
7188
|
-
},
|
|
7189
|
-
{
|
|
7190
|
-
"name": "options",
|
|
7191
|
-
"type": {
|
|
7192
|
-
"text": "Omit<TieredAIProviderSwitcherOptions, 'container'>"
|
|
7193
|
-
}
|
|
7194
|
-
}
|
|
7195
|
-
],
|
|
7196
|
-
"description": "Build a TieredAIProviderSwitcher — which registers the tier-shaped provider\nregistry — and put it on the (AIProviderSwitcher:variable) token. Call once at app\nbootstrap."
|
|
7197
|
-
}
|
|
7198
|
-
],
|
|
7199
|
-
"exports": [
|
|
7200
|
-
{
|
|
7201
|
-
"kind": "js",
|
|
7202
|
-
"name": "TieredAIProviderSwitcher",
|
|
7203
|
-
"declaration": {
|
|
7204
|
-
"name": "TieredAIProviderSwitcher",
|
|
7205
|
-
"module": "src/provider/tiered-provider-switcher.ts"
|
|
7206
|
-
}
|
|
7207
|
-
},
|
|
7208
|
-
{
|
|
7209
|
-
"kind": "js",
|
|
7210
|
-
"name": "registerTieredAIProviders",
|
|
7211
|
-
"declaration": {
|
|
7212
|
-
"name": "registerTieredAIProviders",
|
|
7213
|
-
"module": "src/provider/tiered-provider-switcher.ts"
|
|
7214
|
-
}
|
|
7215
|
-
}
|
|
7216
|
-
]
|
|
7217
|
-
},
|
|
7218
7218
|
{
|
|
7219
7219
|
"kind": "javascript-module",
|
|
7220
7220
|
"path": "src/styles/ai-colours.ts",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/ai-assistant",
|
|
3
3
|
"description": "Genesis AI Assistant micro-frontend",
|
|
4
|
-
"version": "15.46.3
|
|
4
|
+
"version": "15.46.3",
|
|
5
5
|
"license": "SEE LICENSE IN license.txt",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/ai-assistant.d.ts",
|
|
@@ -92,31 +92,31 @@
|
|
|
92
92
|
}
|
|
93
93
|
},
|
|
94
94
|
"devDependencies": {
|
|
95
|
-
"@genesislcap/foundation-comms": "15.46.3
|
|
96
|
-
"@genesislcap/foundation-testing": "15.46.3
|
|
97
|
-
"@genesislcap/genx": "15.46.3
|
|
98
|
-
"@genesislcap/ts-builder": "15.46.3
|
|
99
|
-
"@genesislcap/uvu-playwright-builder": "15.46.3
|
|
100
|
-
"@genesislcap/vite-builder": "15.46.3
|
|
101
|
-
"@genesislcap/webpack-builder": "15.46.3
|
|
95
|
+
"@genesislcap/foundation-comms": "15.46.3",
|
|
96
|
+
"@genesislcap/foundation-testing": "15.46.3",
|
|
97
|
+
"@genesislcap/genx": "15.46.3",
|
|
98
|
+
"@genesislcap/ts-builder": "15.46.3",
|
|
99
|
+
"@genesislcap/uvu-playwright-builder": "15.46.3",
|
|
100
|
+
"@genesislcap/vite-builder": "15.46.3",
|
|
101
|
+
"@genesislcap/webpack-builder": "15.46.3",
|
|
102
102
|
"@types/dompurify": "^3.0.5",
|
|
103
103
|
"@types/marked": "^5.0.2",
|
|
104
104
|
"esbuild": "0.25.12"
|
|
105
105
|
},
|
|
106
106
|
"dependencies": {
|
|
107
|
-
"@genesislcap/foundation-ai": "15.46.3
|
|
108
|
-
"@genesislcap/foundation-logger": "15.46.3
|
|
109
|
-
"@genesislcap/foundation-notifications": "15.46.3
|
|
110
|
-
"@genesislcap/foundation-redux": "15.46.3
|
|
111
|
-
"@genesislcap/foundation-ui": "15.46.3
|
|
112
|
-
"@genesislcap/foundation-utils": "15.46.3
|
|
113
|
-
"@genesislcap/rapid-design-system": "15.46.3
|
|
114
|
-
"@genesislcap/web-core": "15.46.3
|
|
107
|
+
"@genesislcap/foundation-ai": "15.46.3",
|
|
108
|
+
"@genesislcap/foundation-logger": "15.46.3",
|
|
109
|
+
"@genesislcap/foundation-notifications": "15.46.3",
|
|
110
|
+
"@genesislcap/foundation-redux": "15.46.3",
|
|
111
|
+
"@genesislcap/foundation-ui": "15.46.3",
|
|
112
|
+
"@genesislcap/foundation-utils": "15.46.3",
|
|
113
|
+
"@genesislcap/rapid-design-system": "15.46.3",
|
|
114
|
+
"@genesislcap/web-core": "15.46.3",
|
|
115
115
|
"dompurify": "^3.3.1",
|
|
116
116
|
"marked": "^17.0.3"
|
|
117
117
|
},
|
|
118
118
|
"peerDependencies": {
|
|
119
|
-
"@genesislcap/foundation-comms": "^15.46.3
|
|
119
|
+
"@genesislcap/foundation-comms": "^15.46.3"
|
|
120
120
|
},
|
|
121
121
|
"peerDependenciesMeta": {
|
|
122
122
|
"@genesislcap/foundation-comms": {
|