@genesislcap/ai-assistant 15.85.0 → 15.86.0-GENC-0.4

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 (67) hide show
  1. package/dist/ai-assistant.api.json +5989 -1729
  2. package/dist/ai-assistant.d.ts +809 -3
  3. package/dist/chat-driver.cjs +1389 -86
  4. package/dist/chat-driver.cjs.map +4 -4
  5. package/dist/chat-driver.mjs +1382 -86
  6. package/dist/chat-driver.mjs.map +4 -4
  7. package/dist/custom-elements.json +2171 -464
  8. package/dist/dts/autopilot/autopilot-driver.d.ts +46 -2
  9. package/dist/dts/autopilot/autopilot-driver.d.ts.map +1 -1
  10. package/dist/dts/autopilot/autopilot-session.d.ts +25 -0
  11. package/dist/dts/autopilot/autopilot-session.d.ts.map +1 -1
  12. package/dist/dts/chat-driver-node.d.ts +2 -0
  13. package/dist/dts/chat-driver-node.d.ts.map +1 -1
  14. package/dist/dts/components/ai-driver/ai-driver.d.ts +15 -0
  15. package/dist/dts/components/ai-driver/ai-driver.d.ts.map +1 -1
  16. package/dist/dts/components/ai-driver/base-driver-decorator.d.ts +6 -0
  17. package/dist/dts/components/ai-driver/base-driver-decorator.d.ts.map +1 -1
  18. package/dist/dts/components/chat-driver/chat-driver.d.ts +7 -0
  19. package/dist/dts/components/chat-driver/chat-driver.d.ts.map +1 -1
  20. package/dist/dts/components/chat-driver/interaction-controller.d.ts +12 -0
  21. package/dist/dts/components/chat-driver/interaction-controller.d.ts.map +1 -1
  22. package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts +7 -1
  23. package/dist/dts/components/orchestrating-driver/orchestrating-driver.d.ts.map +1 -1
  24. package/dist/dts/headless/describe-interaction.d.ts +17 -0
  25. package/dist/dts/headless/describe-interaction.d.ts.map +1 -0
  26. package/dist/dts/headless/headless-debug.d.ts +28 -0
  27. package/dist/dts/headless/headless-debug.d.ts.map +1 -0
  28. package/dist/dts/headless/headless-persistence.d.ts +35 -0
  29. package/dist/dts/headless/headless-persistence.d.ts.map +1 -0
  30. package/dist/dts/headless/headless-session.d.ts +170 -0
  31. package/dist/dts/headless/headless-session.d.ts.map +1 -0
  32. package/dist/dts/headless/headless.types.d.ts +429 -0
  33. package/dist/dts/headless/headless.types.d.ts.map +1 -0
  34. package/dist/dts/headless/index.d.ts +5 -0
  35. package/dist/dts/headless/index.d.ts.map +1 -0
  36. package/dist/dts/index.d.ts +2 -0
  37. package/dist/dts/index.d.ts.map +1 -1
  38. package/dist/dts/main/main.d.ts.map +1 -1
  39. package/dist/dts/state/debug-event-log.d.ts +1 -1
  40. package/dist/dts/state/debug-event-log.d.ts.map +1 -1
  41. package/dist/dts/state/persistence/debug-log-assembly.d.ts +49 -0
  42. package/dist/dts/state/persistence/debug-log-assembly.d.ts.map +1 -0
  43. package/dist/dts/state/persistence/index.d.ts +1 -0
  44. package/dist/dts/state/persistence/index.d.ts.map +1 -1
  45. package/dist/dts/state/persistence/session-persister.d.ts +7 -0
  46. package/dist/dts/state/persistence/session-persister.d.ts.map +1 -1
  47. package/dist/esm/autopilot/autopilot-driver.js +112 -6
  48. package/dist/esm/autopilot/autopilot-session.js +31 -16
  49. package/dist/esm/chat-driver-node.js +8 -0
  50. package/dist/esm/components/ai-driver/base-driver-decorator.js +12 -0
  51. package/dist/esm/components/chat-driver/chat-driver.js +8 -0
  52. package/dist/esm/components/chat-driver/interaction-controller.js +66 -0
  53. package/dist/esm/components/orchestrating-driver/orchestrating-driver.js +11 -2
  54. package/dist/esm/headless/describe-interaction.js +55 -0
  55. package/dist/esm/headless/headless-debug.js +62 -0
  56. package/dist/esm/headless/headless-persistence.js +192 -0
  57. package/dist/esm/headless/headless-session.js +760 -0
  58. package/dist/esm/headless/headless.types.js +1 -0
  59. package/dist/esm/headless/index.js +3 -0
  60. package/dist/esm/index.js +3 -0
  61. package/dist/esm/main/main.js +18 -37
  62. package/dist/esm/state/debug-event-log.js +8 -1
  63. package/dist/esm/state/persistence/debug-log-assembly.js +69 -0
  64. package/dist/esm/state/persistence/index.js +1 -0
  65. package/dist/esm/state/persistence/session-persister.js +16 -0
  66. package/package.json +17 -17
  67. package/scripts/smoke-chat-driver-node.mjs +3 -0
@@ -63,6 +63,14 @@
63
63
  "package": "./config/fallback-agents"
64
64
  }
65
65
  },
66
+ {
67
+ "kind": "js",
68
+ "name": "*",
69
+ "declaration": {
70
+ "name": "*",
71
+ "package": "./headless"
72
+ }
73
+ },
66
74
  {
67
75
  "kind": "js",
68
76
  "name": "AnthropicProvider",
@@ -679,6 +687,22 @@
679
687
  "module": "./state/persistence/diagnostics"
680
688
  }
681
689
  },
690
+ {
691
+ "kind": "js",
692
+ "name": "buildDiagnosticEntries",
693
+ "declaration": {
694
+ "name": "buildDiagnosticEntries",
695
+ "module": "./state/persistence/debug-log-assembly"
696
+ }
697
+ },
698
+ {
699
+ "kind": "js",
700
+ "name": "lifetimeDebugLog",
701
+ "declaration": {
702
+ "name": "lifetimeDebugLog",
703
+ "module": "./state/persistence/debug-log-assembly"
704
+ }
705
+ },
682
706
  {
683
707
  "kind": "js",
684
708
  "name": "DebugLog",
@@ -750,6 +774,38 @@
750
774
  "package": "./autopilot"
751
775
  }
752
776
  },
777
+ {
778
+ "kind": "js",
779
+ "name": "*",
780
+ "declaration": {
781
+ "name": "*",
782
+ "package": "./headless"
783
+ }
784
+ },
785
+ {
786
+ "kind": "js",
787
+ "name": "headlessPersistence",
788
+ "declaration": {
789
+ "name": "headlessPersistence",
790
+ "module": "./headless/headless-persistence"
791
+ }
792
+ },
793
+ {
794
+ "kind": "js",
795
+ "name": "type",
796
+ "declaration": {
797
+ "name": "type",
798
+ "module": "./headless/headless-persistence"
799
+ }
800
+ },
801
+ {
802
+ "kind": "js",
803
+ "name": "HeadlessPersistenceOptions",
804
+ "declaration": {
805
+ "name": "HeadlessPersistenceOptions",
806
+ "module": "./headless/headless-persistence"
807
+ }
808
+ },
753
809
  {
754
810
  "kind": "js",
755
811
  "name": "*",
@@ -1410,429 +1466,148 @@
1410
1466
  },
1411
1467
  {
1412
1468
  "kind": "javascript-module",
1413
- "path": "src/channel/ai-activity-bus.ts",
1469
+ "path": "src/autopilot/autopilot-driver.ts",
1414
1470
  "declarations": [
1415
1471
  {
1416
1472
  "kind": "variable",
1417
- "name": "NOOP_ACTIVITY_BUS",
1473
+ "name": "AUTOPILOT_CLAIMANT",
1418
1474
  "type": {
1419
- "text": "ActivityBus"
1475
+ "text": "string"
1420
1476
  },
1421
- "default": "{ publish: () => {} }",
1422
- "description": "No-op ActivityBus. The default when no bus is injected (Node, tests, headless\nserver use) — publishing goes nowhere and nothing is left open to tear down."
1477
+ "default": "'autopilot'",
1478
+ "description": "The holder id the autopilot claims interactions as."
1423
1479
  },
1424
1480
  {
1425
1481
  "kind": "class",
1426
- "description": "Typed in-process event bus for AI assistant activity events.\n\nDispatches events synchronously to all local subscribers in the same JS module instance\n(i.e. the same browser tab). Events listed in `crossTabEvents` are additionally forwarded\nvia a shared `BroadcastChannel` so that other tabs on the same origin receive them.",
1427
- "name": "AgenticActivityBus",
1482
+ "description": "Autopilot (GENC-1660): a driver decorator that answers the questions a working agent asks the\nuser, on their behalf, grounded in the agent's autopilot config (for bootstrap, the brief).\n\nNeither side calls the other. The working agent asks as it always does; this driver claims the\ninteractions its policy allows, while it is running for that flow, and answers each in one short\nturn on the flow's `AutopilotSession`. It plugs in only through the generic extension points\n— an interaction interceptor, a handler capability and the flow lifecycle — so the core knows\nnothing about it, and it wraps any `AiDriver`.",
1483
+ "name": "AutopilotDriver",
1428
1484
  "members": [
1429
1485
  {
1430
1486
  "kind": "field",
1431
- "name": "subscribers",
1487
+ "name": "agents",
1488
+ "type": {
1489
+ "text": "readonly AgentConfig[]"
1490
+ },
1432
1491
  "privacy": "private",
1433
- "readonly": true,
1434
- "default": "new Map<string, Set<AnyHandler>>()"
1492
+ "readonly": true
1435
1493
  },
1436
1494
  {
1437
1495
  "kind": "field",
1438
- "name": "crossTabEvents",
1496
+ "name": "providerRegistry",
1439
1497
  "type": {
1440
- "text": "Set<string>"
1498
+ "text": "AIProviderRegistry"
1441
1499
  },
1442
1500
  "privacy": "private",
1443
- "readonly": true,
1444
- "default": "new Set(config?.crossTabEvents ?? [])"
1501
+ "readonly": true
1445
1502
  },
1446
1503
  {
1447
1504
  "kind": "field",
1448
- "name": "channelNameFactory",
1505
+ "name": "sessionKey",
1449
1506
  "type": {
1450
- "text": "() => string | undefined"
1507
+ "text": "string"
1451
1508
  },
1452
1509
  "privacy": "private",
1453
1510
  "readonly": true
1454
1511
  },
1455
1512
  {
1456
1513
  "kind": "field",
1457
- "name": "channel",
1514
+ "name": "activityBus",
1458
1515
  "type": {
1459
- "text": "BroadcastChannel | undefined"
1516
+ "text": "ActivityBus"
1460
1517
  },
1461
- "privacy": "private"
1518
+ "privacy": "private",
1519
+ "readonly": true
1462
1520
  },
1463
1521
  {
1464
1522
  "kind": "field",
1465
- "name": "channelInitialised",
1523
+ "name": "listeners",
1524
+ "privacy": "private",
1525
+ "readonly": true,
1526
+ "default": "new Set<() => void>()"
1527
+ },
1528
+ {
1529
+ "kind": "field",
1530
+ "name": "sessions",
1531
+ "privacy": "private",
1532
+ "readonly": true,
1533
+ "default": "new Map<string, AutopilotSession>()"
1534
+ },
1535
+ {
1536
+ "kind": "field",
1537
+ "name": "onFor",
1466
1538
  "type": {
1467
- "text": "boolean"
1539
+ "text": "string | null"
1468
1540
  },
1469
1541
  "privacy": "private",
1470
- "default": "false"
1542
+ "default": "null",
1543
+ "description": "The flow the mode applies to: set when it is first switched, cleared when that flow ends."
1471
1544
  },
1472
1545
  {
1473
- "kind": "method",
1474
- "name": "ensureChannel",
1546
+ "kind": "field",
1547
+ "name": "mode",
1548
+ "type": {
1549
+ "text": "'paused' | 'running'"
1550
+ },
1475
1551
  "privacy": "private",
1476
- "return": {
1477
- "type": {
1478
- "text": "void"
1479
- }
1552
+ "default": "'paused'"
1553
+ },
1554
+ {
1555
+ "kind": "field",
1556
+ "name": "pauseState",
1557
+ "type": {
1558
+ "text": "AutopilotHostState['pause'] | undefined"
1480
1559
  },
1481
- "description": "Lazily open the cross-tab `BroadcastChannel` on first use. Deferred (rather than\ncreated in the constructor) so that importing this module, or constructing the bus\noff-browser (Node, tests, headless server), never opens a live channel or reads\n`sessionStorage` — both would keep a Node event loop alive and hang the process.\nCross-tab forwarding is inherently browser-only, so channel creation is gated on a\nbrowser environment; elsewhere the bus stays purely in-process."
1560
+ "privacy": "private"
1482
1561
  },
1483
1562
  {
1484
- "kind": "method",
1485
- "name": "subscribe",
1486
- "return": {
1487
- "type": {
1488
- "text": "() => void"
1489
- }
1563
+ "kind": "field",
1564
+ "name": "held",
1565
+ "type": {
1566
+ "text": "Held | undefined"
1490
1567
  },
1491
- "parameters": [
1492
- {
1493
- "name": "type",
1494
- "type": {
1495
- "text": "K"
1496
- }
1497
- },
1498
- {
1499
- "name": "handler",
1500
- "type": {
1501
- "text": "(detail: AgenticActivityEvents[K]) => void"
1502
- }
1503
- }
1504
- ],
1505
- "description": "Subscribe to an event. Returns an unsubscribe function — call it in\n`disconnectedCallback` to avoid memory leaks."
1568
+ "privacy": "private"
1506
1569
  },
1507
1570
  {
1508
- "kind": "method",
1509
- "name": "publish",
1510
- "return": {
1511
- "type": {
1512
- "text": "void"
1513
- }
1571
+ "kind": "field",
1572
+ "name": "open",
1573
+ "type": {
1574
+ "text": "InteractionOpened | undefined"
1514
1575
  },
1515
- "parameters": [
1516
- {
1517
- "name": "type",
1518
- "type": {
1519
- "text": "K"
1520
- }
1521
- },
1522
- {
1523
- "name": "detail",
1524
- "type": {
1525
- "text": "AgenticActivityEvents[K]"
1526
- }
1527
- }
1528
- ],
1529
- "description": "Publish an event to all local subscribers and, if configured, to other tabs\nvia BroadcastChannel."
1576
+ "privacy": "private",
1577
+ "description": "The interaction open right now, whoever holds it: claimed or not, it was offered here first.\n`held` covers only what the autopilot claimed, so this is how the status knows that the working\nagent is parked on a question left with the person (see `waitingOnUser`)."
1530
1578
  },
1531
1579
  {
1532
- "kind": "method",
1533
- "name": "addCrossTabEvent",
1534
- "return": {
1535
- "type": {
1536
- "text": "void"
1537
- }
1580
+ "kind": "field",
1581
+ "name": "declinedWhilePaused",
1582
+ "type": {
1583
+ "text": "InteractionOpened | undefined"
1538
1584
  },
1539
- "parameters": [
1540
- {
1541
- "name": "type",
1542
- "type": {
1543
- "text": "keyof AgenticActivityEvents"
1544
- }
1545
- }
1546
- ],
1547
- "description": "Add an event type to the cross-tab forwarding set at runtime.\nMust be called before the first AgenticActivityBus.publish of that event type."
1585
+ "privacy": "private",
1586
+ "description": "The open interaction, when the autopilot declined it only for being paused as it opened: a live\nResume may still take it (see `takeOpenOnResume`). Cleared when it is taken or settles."
1548
1587
  },
1549
1588
  {
1550
- "kind": "method",
1551
- "name": "close",
1552
- "return": {
1553
- "type": {
1554
- "text": "void"
1555
- }
1589
+ "kind": "field",
1590
+ "name": "refinements",
1591
+ "type": {
1592
+ "text": "{ key: string; count: number } | undefined"
1556
1593
  },
1557
- "description": "Close the underlying BroadcastChannel. Call once on application teardown if needed."
1594
+ "privacy": "private",
1595
+ "description": "Refining actions taken on the current step (written answers among them), for the limit."
1558
1596
  },
1559
1597
  {
1560
- "kind": "method",
1561
- "name": "notifyLocal",
1598
+ "kind": "field",
1599
+ "name": "watchdog",
1600
+ "type": {
1601
+ "text": "ReturnType<typeof setTimeout> | undefined"
1602
+ },
1562
1603
  "privacy": "private",
1563
- "return": {
1564
- "type": {
1565
- "text": "void"
1566
- }
1567
- },
1568
- "parameters": [
1569
- {
1570
- "name": "type",
1571
- "type": {
1572
- "text": "string"
1573
- }
1574
- },
1575
- {
1576
- "name": "detail",
1577
- "type": {
1578
- "text": "unknown"
1579
- }
1580
- }
1581
- ]
1582
- }
1583
- ]
1584
- },
1585
- {
1586
- "kind": "variable",
1587
- "name": "agenticActivityBus",
1588
- "default": "new AgenticActivityBus({\n crossTabEvents: ['halo-start', 'halo-stop', 'tool-loop-start', 'tool-loop-end'],\n // Lazy: the tab-scoped name (and its `sessionStorage` read) is computed on first\n // cross-tab use in a browser, not at module-eval — so importing this module is\n // side-effect-free and Node/test-safe.\n channelNameFactory: () => getTabScopedChannelName('foundation-ai-activity'),\n})",
1589
- "description": "Pre-instantiated singleton event bus for AI assistant activity.\n\n- `halo-start` / `halo-stop` are forwarded via a tab-scoped `BroadcastChannel` so that\n popout windows opened from this tab show halo animations, while remaining isolated from\n unrelated tabs on the same origin (tab-scoped channel name).\n- `tool-loop-start` / `tool-loop-end` are cross-tab for the same reason: they describe the\n assistant's lifecycle (a turn beginning / ending), and the most common subscribers\n (workspace transitions, post-turn deferred recomputation, UI gates tied to the assistant\n being idle) need the event regardless of whether the user is interacting with the chat\n in the main tab or a popout window. Tab-local-only telemetry can subscribe and filter.\n- `chat-popout` / `chat-popin` are in-memory only — they must only affect the tab where the\n user clicked."
1590
- }
1591
- ],
1592
- "exports": [
1593
- {
1594
- "kind": "js",
1595
- "name": "NOOP_ACTIVITY_BUS",
1596
- "declaration": {
1597
- "name": "NOOP_ACTIVITY_BUS",
1598
- "module": "src/channel/ai-activity-bus.ts"
1599
- }
1600
- },
1601
- {
1602
- "kind": "js",
1603
- "name": "AgenticActivityBus",
1604
- "declaration": {
1605
- "name": "AgenticActivityBus",
1606
- "module": "src/channel/ai-activity-bus.ts"
1607
- }
1608
- },
1609
- {
1610
- "kind": "js",
1611
- "name": "agenticActivityBus",
1612
- "declaration": {
1613
- "name": "agenticActivityBus",
1614
- "module": "src/channel/ai-activity-bus.ts"
1615
- }
1616
- }
1617
- ]
1618
- },
1619
- {
1620
- "kind": "javascript-module",
1621
- "path": "src/channel/ai-activity-channel.ts",
1622
- "declarations": [],
1623
- "exports": []
1624
- },
1625
- {
1626
- "kind": "javascript-module",
1627
- "path": "src/channel/autopilot-needs-user.ts",
1628
- "declarations": [
1629
- {
1630
- "kind": "function",
1631
- "name": "setAutopilotNeedsUser",
1632
- "return": {
1633
- "type": {
1634
- "text": "void"
1635
- }
1636
- },
1637
- "parameters": [
1638
- {
1639
- "name": "sessionKey",
1640
- "type": {
1641
- "text": "string"
1642
- }
1643
- },
1644
- {
1645
- "name": "needsUser",
1646
- "type": {
1647
- "text": "boolean"
1648
- }
1649
- }
1650
- ],
1651
- "description": "Set it for one session, announcing `autopilot-needs-user` when it changes."
1652
- },
1653
- {
1654
- "kind": "function",
1655
- "name": "autopilotNeedsUser",
1656
- "return": {
1657
- "type": {
1658
- "text": "boolean"
1659
- }
1660
- },
1661
- "parameters": [
1662
- {
1663
- "name": "sessionKey",
1664
- "optional": true,
1665
- "type": {
1666
- "text": "string"
1667
- }
1668
- }
1669
- ],
1670
- "description": "Whether a session has something waiting on the person — or, without a key (a bubble that cannot\ntell which assistant it holds), whether any session has."
1671
- }
1672
- ],
1673
- "exports": [
1674
- {
1675
- "kind": "js",
1676
- "name": "setAutopilotNeedsUser",
1677
- "declaration": {
1678
- "name": "setAutopilotNeedsUser",
1679
- "module": "src/channel/autopilot-needs-user.ts"
1680
- }
1681
- },
1682
- {
1683
- "kind": "js",
1684
- "name": "autopilotNeedsUser",
1685
- "declaration": {
1686
- "name": "autopilotNeedsUser",
1687
- "module": "src/channel/autopilot-needs-user.ts"
1688
- }
1689
- }
1690
- ]
1691
- },
1692
- {
1693
- "kind": "javascript-module",
1694
- "path": "src/autopilot/autopilot-driver.ts",
1695
- "declarations": [
1696
- {
1697
- "kind": "variable",
1698
- "name": "AUTOPILOT_CLAIMANT",
1699
- "type": {
1700
- "text": "string"
1701
- },
1702
- "default": "'autopilot'",
1703
- "description": "The holder id the autopilot claims interactions as."
1704
- },
1705
- {
1706
- "kind": "class",
1707
- "description": "Autopilot (GENC-1660): a driver decorator that answers the questions a working agent asks the\nuser, on their behalf, grounded in the agent's autopilot config (for bootstrap, the brief).\n\nNeither side calls the other. The working agent asks as it always does; this driver claims the\ninteractions its policy allows, while it is running for that flow, and answers each in one short\nturn on the flow's `AutopilotSession`. It plugs in only through the generic extension points\n— an interaction interceptor, a handler capability and the flow lifecycle — so the core knows\nnothing about it, and it wraps any `AiDriver`.",
1708
- "name": "AutopilotDriver",
1709
- "members": [
1710
- {
1711
- "kind": "field",
1712
- "name": "agents",
1713
- "type": {
1714
- "text": "readonly AgentConfig[]"
1715
- },
1716
- "privacy": "private",
1717
- "readonly": true
1718
- },
1719
- {
1720
- "kind": "field",
1721
- "name": "providerRegistry",
1722
- "type": {
1723
- "text": "AIProviderRegistry"
1724
- },
1725
- "privacy": "private",
1726
- "readonly": true
1727
- },
1728
- {
1729
- "kind": "field",
1730
- "name": "sessionKey",
1731
- "type": {
1732
- "text": "string"
1733
- },
1734
- "privacy": "private",
1735
- "readonly": true
1736
- },
1737
- {
1738
- "kind": "field",
1739
- "name": "activityBus",
1740
- "type": {
1741
- "text": "ActivityBus"
1742
- },
1743
- "privacy": "private",
1744
- "readonly": true
1745
- },
1746
- {
1747
- "kind": "field",
1748
- "name": "listeners",
1749
- "privacy": "private",
1750
- "readonly": true,
1751
- "default": "new Set<() => void>()"
1752
- },
1753
- {
1754
- "kind": "field",
1755
- "name": "sessions",
1756
- "privacy": "private",
1757
- "readonly": true,
1758
- "default": "new Map<string, AutopilotSession>()"
1759
- },
1760
- {
1761
- "kind": "field",
1762
- "name": "onFor",
1763
- "type": {
1764
- "text": "string | null"
1765
- },
1766
- "privacy": "private",
1767
- "default": "null",
1768
- "description": "The flow the mode applies to: set when it is first switched, cleared when that flow ends."
1769
- },
1770
- {
1771
- "kind": "field",
1772
- "name": "mode",
1773
- "type": {
1774
- "text": "'paused' | 'running'"
1775
- },
1776
- "privacy": "private",
1777
- "default": "'paused'"
1778
- },
1779
- {
1780
- "kind": "field",
1781
- "name": "pauseState",
1782
- "type": {
1783
- "text": "AutopilotHostState['pause'] | undefined"
1784
- },
1785
- "privacy": "private"
1786
- },
1787
- {
1788
- "kind": "field",
1789
- "name": "held",
1790
- "type": {
1791
- "text": "Held | undefined"
1792
- },
1793
- "privacy": "private"
1794
- },
1795
- {
1796
- "kind": "field",
1797
- "name": "open",
1798
- "type": {
1799
- "text": "InteractionOpened | undefined"
1800
- },
1801
- "privacy": "private",
1802
- "description": "The interaction open right now, whoever holds it: claimed or not, it was offered here first.\n`held` covers only what the autopilot claimed, so this is how the status knows that the working\nagent is parked on a question left with the person (see `waitingOnUser`)."
1803
- },
1804
- {
1805
- "kind": "field",
1806
- "name": "declinedWhilePaused",
1807
- "type": {
1808
- "text": "InteractionOpened | undefined"
1809
- },
1810
- "privacy": "private",
1811
- "description": "The open interaction, when the autopilot declined it only for being paused as it opened: a live\nResume may still take it (see `takeOpenOnResume`). Cleared when it is taken or settles."
1812
- },
1813
- {
1814
- "kind": "field",
1815
- "name": "refinements",
1816
- "type": {
1817
- "text": "{ key: string; count: number } | undefined"
1818
- },
1819
- "privacy": "private",
1820
- "description": "Refining actions taken on the current step (written answers among them), for the limit."
1821
- },
1822
- {
1823
- "kind": "field",
1824
- "name": "watchdog",
1825
- "type": {
1826
- "text": "ReturnType<typeof setTimeout> | undefined"
1827
- },
1828
- "privacy": "private",
1829
- "description": "The watchdog's next check, while a claimed interaction is pending."
1830
- },
1831
- {
1832
- "kind": "field",
1833
- "name": "endedDiagnostics",
1834
- "type": {
1835
- "text": "DiagnosticEntry[]"
1604
+ "description": "The watchdog's next check, while a claimed interaction is pending."
1605
+ },
1606
+ {
1607
+ "kind": "field",
1608
+ "name": "endedDiagnostics",
1609
+ "type": {
1610
+ "text": "DiagnosticEntry[]"
1836
1611
  },
1837
1612
  "privacy": "private",
1838
1613
  "readonly": true,
@@ -1867,6 +1642,24 @@
1867
1642
  "privacy": "private",
1868
1643
  "description": "A mode restored with the session, waiting for its flow to become the owner again."
1869
1644
  },
1645
+ {
1646
+ "kind": "field",
1647
+ "name": "handingBack",
1648
+ "type": {
1649
+ "text": "Carried | undefined"
1650
+ },
1651
+ "privacy": "private",
1652
+ "description": "The mode of a hand-off's target that has released, kept for its caller, which has not taken the\nlock back yet (GENC-1751): the flow has no owner in between. See `carriedTo`."
1653
+ },
1654
+ {
1655
+ "kind": "field",
1656
+ "name": "switchedFrom",
1657
+ "type": {
1658
+ "text": "Carried | undefined"
1659
+ },
1660
+ "privacy": "private",
1661
+ "description": "The mode of the flow that just ended, should a one-way hand-off with nobody waiting turn out to\nhave ended it: that switch announces itself only after the owner has changed (GENC-1751)."
1662
+ },
1870
1663
  {
1871
1664
  "kind": "field",
1872
1665
  "name": "generation",
@@ -2003,7 +1796,7 @@
2003
1796
  "text": "PersistedAutopilotMode | undefined"
2004
1797
  }
2005
1798
  },
2006
- "description": "The mode to save with the session, while it is set for the current flow."
1799
+ "description": "The mode to save with the session, while it is set for the current flow — or kept for a\nhand-off's caller while its target releases, saved for that target, as the stack saves it."
2007
1800
  },
2008
1801
  {
2009
1802
  "kind": "method",
@@ -2796,16 +2589,115 @@
2796
2589
  },
2797
2590
  {
2798
2591
  "kind": "method",
2799
- "name": "capabilityFor",
2592
+ "name": "onHandOffStarted",
2800
2593
  "privacy": "private",
2801
2594
  "return": {
2802
2595
  "type": {
2803
- "text": "AutopilotCapability | undefined"
2596
+ "text": "void"
2804
2597
  }
2805
2598
  },
2806
2599
  "parameters": [
2807
2600
  {
2808
- "name": "scope",
2601
+ "name": "frame",
2602
+ "type": {
2603
+ "text": "HandOffFrame"
2604
+ }
2605
+ }
2606
+ ],
2607
+ "description": "A one-way hand-off with nobody waiting is a plain switch, the caller deactivated, so nothing on\nthe stack says the owner it changed to took over the same task: its event, raised once the\ntarget is active, does (GENC-1751)."
2608
+ },
2609
+ {
2610
+ "kind": "method",
2611
+ "name": "current",
2612
+ "privacy": "private",
2613
+ "return": {
2614
+ "type": {
2615
+ "text": "Carried | undefined"
2616
+ }
2617
+ },
2618
+ "description": "The mode set for the current flow, or kept for the caller of a hand-back under way."
2619
+ },
2620
+ {
2621
+ "kind": "method",
2622
+ "name": "carriedTo",
2623
+ "privacy": "private",
2624
+ "return": {
2625
+ "type": {
2626
+ "text": "Carried | undefined"
2627
+ }
2628
+ },
2629
+ "parameters": [
2630
+ {
2631
+ "name": "owner",
2632
+ "type": {
2633
+ "text": "string | null"
2634
+ }
2635
+ }
2636
+ ],
2637
+ "description": "The mode that carries to `owner` because the owner changed for a hand-off or its hand-back, as\nthe hand-off stack shows it at that moment (GENC-1751):\n- a hand-off: `owner` is the top frame's target, which has not finished. Its frame is on the\n stack before the target is activated, and so is a waiting caller's passed on by a one-way\n hand-off from a target;\n- a hand-back: the top frame's target, which the mode is set for, has finished, and `owner` is\n its caller, or no one while the target releases. Its frame leaves the stack only after the\n caller is active again.\n\nClear and an agents change empty the stack before the flow ends, so the mode ends with it, as\nit ends with any flow. A turn routed away from the target ends the hand-offs the same way."
2638
+ },
2639
+ {
2640
+ "kind": "method",
2641
+ "name": "handsBack",
2642
+ "privacy": "private",
2643
+ "return": {
2644
+ "type": {
2645
+ "text": "boolean"
2646
+ }
2647
+ },
2648
+ "parameters": [
2649
+ {
2650
+ "name": "target",
2651
+ "type": {
2652
+ "text": "string"
2653
+ }
2654
+ },
2655
+ {
2656
+ "name": "owner",
2657
+ "type": {
2658
+ "text": "string"
2659
+ }
2660
+ }
2661
+ ],
2662
+ "description": "Whether `owner` is the caller the top hand-off hands back to from `target`."
2663
+ },
2664
+ {
2665
+ "kind": "method",
2666
+ "name": "carry",
2667
+ "privacy": "private",
2668
+ "return": {
2669
+ "type": {
2670
+ "text": "void"
2671
+ }
2672
+ },
2673
+ "parameters": [
2674
+ {
2675
+ "name": "carried",
2676
+ "type": {
2677
+ "text": "Carried"
2678
+ }
2679
+ },
2680
+ {
2681
+ "name": "owner",
2682
+ "type": {
2683
+ "text": "string"
2684
+ }
2685
+ }
2686
+ ],
2687
+ "description": "Set `carried`'s mode for `owner`, which took the task over in a hand-off or its hand-back. A\npause the person chose carries with it; the autopilot's own hand-back of an interaction does\nnot, since that interaction settled before the hand-off could start."
2688
+ },
2689
+ {
2690
+ "kind": "method",
2691
+ "name": "capabilityFor",
2692
+ "privacy": "private",
2693
+ "return": {
2694
+ "type": {
2695
+ "text": "AutopilotCapability | undefined"
2696
+ }
2697
+ },
2698
+ "parameters": [
2699
+ {
2700
+ "name": "scope",
2809
2701
  "type": {
2810
2702
  "text": "HandlerCapabilityScope"
2811
2703
  }
@@ -3524,6 +3416,41 @@
3524
3416
  "module": "src/components/ai-driver/base-driver-decorator.ts"
3525
3417
  }
3526
3418
  },
3419
+ {
3420
+ "kind": "method",
3421
+ "name": "invokeAsUser",
3422
+ "return": {
3423
+ "type": {
3424
+ "text": "Promise<InvokeResult>"
3425
+ }
3426
+ },
3427
+ "parameters": [
3428
+ {
3429
+ "name": "interactionId",
3430
+ "type": {
3431
+ "text": "string"
3432
+ }
3433
+ },
3434
+ {
3435
+ "name": "action",
3436
+ "type": {
3437
+ "text": "string"
3438
+ }
3439
+ },
3440
+ {
3441
+ "name": "args",
3442
+ "optional": true,
3443
+ "type": {
3444
+ "text": "unknown"
3445
+ }
3446
+ }
3447
+ ],
3448
+ "description": "Forwarded: the interaction belongs to the driver that opened it. An inner driver that cannot\nrun actions answers as if the interaction had ended.",
3449
+ "inheritedFrom": {
3450
+ "name": "BaseDriverDecorator",
3451
+ "module": "src/components/ai-driver/base-driver-decorator.ts"
3452
+ }
3453
+ },
3527
3454
  {
3528
3455
  "kind": "method",
3529
3456
  "name": "presentInteraction",
@@ -3887,6 +3814,49 @@
3887
3814
  ],
3888
3815
  "description": "`widget_act`'s `fields`, parsed leniently: an object is taken as it is (a model may send one\ndespite the schema's string), and a Markdown code fence around the JSON is stripped."
3889
3816
  },
3817
+ {
3818
+ "kind": "function",
3819
+ "name": "byNumberOf",
3820
+ "parameters": [
3821
+ {
3822
+ "name": "numbering",
3823
+ "type": {
3824
+ "text": "readonly string[]"
3825
+ }
3826
+ }
3827
+ ],
3828
+ "description": "A function reading a number as the action it stands for in the list last shown (`numbering`, as\nrenderActions returns it): `'2'` is `numbering[1]`; anything that is not a whole number,\nor is out of range, stands for nothing. Shared by `widget_act` and the headless driver, so \"2\"\nmeans the same option to both."
3829
+ },
3830
+ {
3831
+ "kind": "function",
3832
+ "name": "invokeArgsFor",
3833
+ "return": {
3834
+ "type": {
3835
+ "text": "{ ok: true; args: unknown } | { ok: false }"
3836
+ }
3837
+ },
3838
+ "parameters": [
3839
+ {
3840
+ "name": "listed",
3841
+ "type": {
3842
+ "text": "SurfaceAction | undefined"
3843
+ }
3844
+ },
3845
+ {
3846
+ "name": "given",
3847
+ "type": {
3848
+ "text": "{ options?: readonly string[]; text?: string; fields?: unknown }"
3849
+ }
3850
+ },
3851
+ {
3852
+ "name": "byNumber",
3853
+ "type": {
3854
+ "text": "(value: string) => string | undefined"
3855
+ }
3856
+ }
3857
+ ],
3858
+ "description": "The arguments `widget_act` hands to `invoke` for `listed`, from what was asked. An action taking\none free-text argument gets `text`, as `reply` does; a form gets its `fields`, parsed leniently\n(parseFields; not ok when they do not parse); anything else its options (a number mapped\nto its name by `byNumber`) and text, as given. Pure, and shared with the headless driver, so\nboth build the same call from the same words."
3859
+ },
3890
3860
  {
3891
3861
  "kind": "function",
3892
3862
  "name": "fieldsExample",
@@ -4272,6 +4242,22 @@
4272
4242
  "module": "src/autopilot/autopilot-session.ts"
4273
4243
  }
4274
4244
  },
4245
+ {
4246
+ "kind": "js",
4247
+ "name": "byNumberOf",
4248
+ "declaration": {
4249
+ "name": "byNumberOf",
4250
+ "module": "src/autopilot/autopilot-session.ts"
4251
+ }
4252
+ },
4253
+ {
4254
+ "kind": "js",
4255
+ "name": "invokeArgsFor",
4256
+ "declaration": {
4257
+ "name": "invokeArgsFor",
4258
+ "module": "src/autopilot/autopilot-session.ts"
4259
+ }
4260
+ },
4275
4261
  {
4276
4262
  "kind": "js",
4277
4263
  "name": "fieldsExample",
@@ -4944,70 +4930,351 @@
4944
4930
  },
4945
4931
  {
4946
4932
  "kind": "javascript-module",
4947
- "path": "src/components/flowing-waves-indicator.ts",
4933
+ "path": "src/channel/ai-activity-bus.ts",
4948
4934
  "declarations": [
4935
+ {
4936
+ "kind": "variable",
4937
+ "name": "NOOP_ACTIVITY_BUS",
4938
+ "type": {
4939
+ "text": "ActivityBus"
4940
+ },
4941
+ "default": "{ publish: () => {} }",
4942
+ "description": "No-op ActivityBus. The default when no bus is injected (Node, tests, headless\nserver use) — publishing goes nowhere and nothing is left open to tear down."
4943
+ },
4949
4944
  {
4950
4945
  "kind": "class",
4951
- "description": "Animated \"flowing waves\" loading indicator — coloured organic waves (in the\nfour brand colours) whose bumps swell, shrink, merge and split across a line,\ntapering to nothing at both ends. Where the colours overlap they blend\nadditively toward white.\n\nVisual sibling of the dots loading indicator; interchangeable with the other\nloading styles for the \"assistant is working\" state.",
4952
- "name": "AiFlowingWavesIndicator",
4946
+ "description": "Typed in-process event bus for AI assistant activity events.\n\nDispatches events synchronously to all local subscribers in the same JS module instance\n(i.e. the same browser tab). Events listed in `crossTabEvents` are additionally forwarded\nvia a shared `BroadcastChannel` so that other tabs on the same origin receive them.",
4947
+ "name": "AgenticActivityBus",
4953
4948
  "members": [
4954
4949
  {
4955
4950
  "kind": "field",
4956
- "name": "startTime",
4951
+ "name": "subscribers",
4952
+ "privacy": "private",
4953
+ "readonly": true,
4954
+ "default": "new Map<string, Set<AnyHandler>>()"
4955
+ },
4956
+ {
4957
+ "kind": "field",
4958
+ "name": "crossTabEvents",
4957
4959
  "type": {
4958
- "text": "number | undefined"
4960
+ "text": "Set<string>"
4959
4961
  },
4960
- "privacy": "private"
4962
+ "privacy": "private",
4963
+ "readonly": true,
4964
+ "default": "new Set(config?.crossTabEvents ?? [])"
4961
4965
  },
4962
4966
  {
4963
4967
  "kind": "field",
4964
- "name": "animFrame",
4968
+ "name": "channelNameFactory",
4965
4969
  "type": {
4966
- "text": "number | undefined"
4970
+ "text": "() => string | undefined"
4967
4971
  },
4968
- "privacy": "private"
4972
+ "privacy": "private",
4973
+ "readonly": true
4969
4974
  },
4970
4975
  {
4971
4976
  "kind": "field",
4972
- "name": "bandPaths",
4977
+ "name": "channel",
4973
4978
  "type": {
4974
- "text": "SVGPathElement[] | undefined"
4979
+ "text": "BroadcastChannel | undefined"
4975
4980
  },
4976
4981
  "privacy": "private"
4977
4982
  },
4983
+ {
4984
+ "kind": "field",
4985
+ "name": "channelInitialised",
4986
+ "type": {
4987
+ "text": "boolean"
4988
+ },
4989
+ "privacy": "private",
4990
+ "default": "false"
4991
+ },
4978
4992
  {
4979
4993
  "kind": "method",
4980
- "name": "tick",
4994
+ "name": "ensureChannel",
4981
4995
  "privacy": "private",
4996
+ "return": {
4997
+ "type": {
4998
+ "text": "void"
4999
+ }
5000
+ },
5001
+ "description": "Lazily open the cross-tab `BroadcastChannel` on first use. Deferred (rather than\ncreated in the constructor) so that importing this module, or constructing the bus\noff-browser (Node, tests, headless server), never opens a live channel or reads\n`sessionStorage` — both would keep a Node event loop alive and hang the process.\nCross-tab forwarding is inherently browser-only, so channel creation is gated on a\nbrowser environment; elsewhere the bus stays purely in-process."
5002
+ },
5003
+ {
5004
+ "kind": "method",
5005
+ "name": "subscribe",
5006
+ "return": {
5007
+ "type": {
5008
+ "text": "() => void"
5009
+ }
5010
+ },
4982
5011
  "parameters": [
4983
5012
  {
4984
- "name": "now",
4985
- "optional": true,
5013
+ "name": "type",
4986
5014
  "type": {
4987
- "text": "number"
5015
+ "text": "K"
5016
+ }
5017
+ },
5018
+ {
5019
+ "name": "handler",
5020
+ "type": {
5021
+ "text": "(detail: AgenticActivityEvents[K]) => void"
4988
5022
  }
4989
5023
  }
4990
- ]
5024
+ ],
5025
+ "description": "Subscribe to an event. Returns an unsubscribe function — call it in\n`disconnectedCallback` to avoid memory leaks."
4991
5026
  },
4992
5027
  {
4993
5028
  "kind": "method",
4994
- "name": "buildBand",
4995
- "privacy": "private",
4996
- "static": true,
5029
+ "name": "publish",
4997
5030
  "return": {
4998
5031
  "type": {
4999
- "text": "string"
5032
+ "text": "void"
5000
5033
  }
5001
5034
  },
5002
5035
  "parameters": [
5003
5036
  {
5004
- "name": "cfg",
5037
+ "name": "type",
5005
5038
  "type": {
5006
- "text": "BandConfig"
5039
+ "text": "K"
5007
5040
  }
5008
5041
  },
5009
5042
  {
5010
- "name": "frame",
5043
+ "name": "detail",
5044
+ "type": {
5045
+ "text": "AgenticActivityEvents[K]"
5046
+ }
5047
+ }
5048
+ ],
5049
+ "description": "Publish an event to all local subscribers and, if configured, to other tabs\nvia BroadcastChannel."
5050
+ },
5051
+ {
5052
+ "kind": "method",
5053
+ "name": "addCrossTabEvent",
5054
+ "return": {
5055
+ "type": {
5056
+ "text": "void"
5057
+ }
5058
+ },
5059
+ "parameters": [
5060
+ {
5061
+ "name": "type",
5062
+ "type": {
5063
+ "text": "keyof AgenticActivityEvents"
5064
+ }
5065
+ }
5066
+ ],
5067
+ "description": "Add an event type to the cross-tab forwarding set at runtime.\nMust be called before the first AgenticActivityBus.publish of that event type."
5068
+ },
5069
+ {
5070
+ "kind": "method",
5071
+ "name": "close",
5072
+ "return": {
5073
+ "type": {
5074
+ "text": "void"
5075
+ }
5076
+ },
5077
+ "description": "Close the underlying BroadcastChannel. Call once on application teardown if needed."
5078
+ },
5079
+ {
5080
+ "kind": "method",
5081
+ "name": "notifyLocal",
5082
+ "privacy": "private",
5083
+ "return": {
5084
+ "type": {
5085
+ "text": "void"
5086
+ }
5087
+ },
5088
+ "parameters": [
5089
+ {
5090
+ "name": "type",
5091
+ "type": {
5092
+ "text": "string"
5093
+ }
5094
+ },
5095
+ {
5096
+ "name": "detail",
5097
+ "type": {
5098
+ "text": "unknown"
5099
+ }
5100
+ }
5101
+ ]
5102
+ }
5103
+ ]
5104
+ },
5105
+ {
5106
+ "kind": "variable",
5107
+ "name": "agenticActivityBus",
5108
+ "default": "new AgenticActivityBus({\n crossTabEvents: ['halo-start', 'halo-stop', 'tool-loop-start', 'tool-loop-end'],\n // Lazy: the tab-scoped name (and its `sessionStorage` read) is computed on first\n // cross-tab use in a browser, not at module-eval — so importing this module is\n // side-effect-free and Node/test-safe.\n channelNameFactory: () => getTabScopedChannelName('foundation-ai-activity'),\n})",
5109
+ "description": "Pre-instantiated singleton event bus for AI assistant activity.\n\n- `halo-start` / `halo-stop` are forwarded via a tab-scoped `BroadcastChannel` so that\n popout windows opened from this tab show halo animations, while remaining isolated from\n unrelated tabs on the same origin (tab-scoped channel name).\n- `tool-loop-start` / `tool-loop-end` are cross-tab for the same reason: they describe the\n assistant's lifecycle (a turn beginning / ending), and the most common subscribers\n (workspace transitions, post-turn deferred recomputation, UI gates tied to the assistant\n being idle) need the event regardless of whether the user is interacting with the chat\n in the main tab or a popout window. Tab-local-only telemetry can subscribe and filter.\n- `chat-popout` / `chat-popin` are in-memory only — they must only affect the tab where the\n user clicked."
5110
+ }
5111
+ ],
5112
+ "exports": [
5113
+ {
5114
+ "kind": "js",
5115
+ "name": "NOOP_ACTIVITY_BUS",
5116
+ "declaration": {
5117
+ "name": "NOOP_ACTIVITY_BUS",
5118
+ "module": "src/channel/ai-activity-bus.ts"
5119
+ }
5120
+ },
5121
+ {
5122
+ "kind": "js",
5123
+ "name": "AgenticActivityBus",
5124
+ "declaration": {
5125
+ "name": "AgenticActivityBus",
5126
+ "module": "src/channel/ai-activity-bus.ts"
5127
+ }
5128
+ },
5129
+ {
5130
+ "kind": "js",
5131
+ "name": "agenticActivityBus",
5132
+ "declaration": {
5133
+ "name": "agenticActivityBus",
5134
+ "module": "src/channel/ai-activity-bus.ts"
5135
+ }
5136
+ }
5137
+ ]
5138
+ },
5139
+ {
5140
+ "kind": "javascript-module",
5141
+ "path": "src/channel/ai-activity-channel.ts",
5142
+ "declarations": [],
5143
+ "exports": []
5144
+ },
5145
+ {
5146
+ "kind": "javascript-module",
5147
+ "path": "src/channel/autopilot-needs-user.ts",
5148
+ "declarations": [
5149
+ {
5150
+ "kind": "function",
5151
+ "name": "setAutopilotNeedsUser",
5152
+ "return": {
5153
+ "type": {
5154
+ "text": "void"
5155
+ }
5156
+ },
5157
+ "parameters": [
5158
+ {
5159
+ "name": "sessionKey",
5160
+ "type": {
5161
+ "text": "string"
5162
+ }
5163
+ },
5164
+ {
5165
+ "name": "needsUser",
5166
+ "type": {
5167
+ "text": "boolean"
5168
+ }
5169
+ }
5170
+ ],
5171
+ "description": "Set it for one session, announcing `autopilot-needs-user` when it changes."
5172
+ },
5173
+ {
5174
+ "kind": "function",
5175
+ "name": "autopilotNeedsUser",
5176
+ "return": {
5177
+ "type": {
5178
+ "text": "boolean"
5179
+ }
5180
+ },
5181
+ "parameters": [
5182
+ {
5183
+ "name": "sessionKey",
5184
+ "optional": true,
5185
+ "type": {
5186
+ "text": "string"
5187
+ }
5188
+ }
5189
+ ],
5190
+ "description": "Whether a session has something waiting on the person — or, without a key (a bubble that cannot\ntell which assistant it holds), whether any session has."
5191
+ }
5192
+ ],
5193
+ "exports": [
5194
+ {
5195
+ "kind": "js",
5196
+ "name": "setAutopilotNeedsUser",
5197
+ "declaration": {
5198
+ "name": "setAutopilotNeedsUser",
5199
+ "module": "src/channel/autopilot-needs-user.ts"
5200
+ }
5201
+ },
5202
+ {
5203
+ "kind": "js",
5204
+ "name": "autopilotNeedsUser",
5205
+ "declaration": {
5206
+ "name": "autopilotNeedsUser",
5207
+ "module": "src/channel/autopilot-needs-user.ts"
5208
+ }
5209
+ }
5210
+ ]
5211
+ },
5212
+ {
5213
+ "kind": "javascript-module",
5214
+ "path": "src/components/flowing-waves-indicator.ts",
5215
+ "declarations": [
5216
+ {
5217
+ "kind": "class",
5218
+ "description": "Animated \"flowing waves\" loading indicator — coloured organic waves (in the\nfour brand colours) whose bumps swell, shrink, merge and split across a line,\ntapering to nothing at both ends. Where the colours overlap they blend\nadditively toward white.\n\nVisual sibling of the dots loading indicator; interchangeable with the other\nloading styles for the \"assistant is working\" state.",
5219
+ "name": "AiFlowingWavesIndicator",
5220
+ "members": [
5221
+ {
5222
+ "kind": "field",
5223
+ "name": "startTime",
5224
+ "type": {
5225
+ "text": "number | undefined"
5226
+ },
5227
+ "privacy": "private"
5228
+ },
5229
+ {
5230
+ "kind": "field",
5231
+ "name": "animFrame",
5232
+ "type": {
5233
+ "text": "number | undefined"
5234
+ },
5235
+ "privacy": "private"
5236
+ },
5237
+ {
5238
+ "kind": "field",
5239
+ "name": "bandPaths",
5240
+ "type": {
5241
+ "text": "SVGPathElement[] | undefined"
5242
+ },
5243
+ "privacy": "private"
5244
+ },
5245
+ {
5246
+ "kind": "method",
5247
+ "name": "tick",
5248
+ "privacy": "private",
5249
+ "parameters": [
5250
+ {
5251
+ "name": "now",
5252
+ "optional": true,
5253
+ "type": {
5254
+ "text": "number"
5255
+ }
5256
+ }
5257
+ ]
5258
+ },
5259
+ {
5260
+ "kind": "method",
5261
+ "name": "buildBand",
5262
+ "privacy": "private",
5263
+ "static": true,
5264
+ "return": {
5265
+ "type": {
5266
+ "text": "string"
5267
+ }
5268
+ },
5269
+ "parameters": [
5270
+ {
5271
+ "name": "cfg",
5272
+ "type": {
5273
+ "text": "BandConfig"
5274
+ }
5275
+ },
5276
+ {
5277
+ "name": "frame",
5011
5278
  "type": {
5012
5279
  "text": "number"
5013
5280
  }
@@ -6800,86 +7067,1322 @@
6800
7067
  "exports": [
6801
7068
  {
6802
7069
  "kind": "js",
6803
- "name": "buildEventPayload",
7070
+ "name": "buildEventPayload",
7071
+ "declaration": {
7072
+ "name": "buildEventPayload",
7073
+ "module": "src/genesis/write-payload.ts"
7074
+ }
7075
+ }
7076
+ ]
7077
+ },
7078
+ {
7079
+ "kind": "javascript-module",
7080
+ "path": "src/genesis/write-plan.ts",
7081
+ "declarations": [
7082
+ {
7083
+ "kind": "variable",
7084
+ "name": "MAX_WRITE_ROWS",
7085
+ "type": {
7086
+ "text": "number"
7087
+ },
7088
+ "default": "25",
7089
+ "description": "A batch a person can actually read before approving it."
7090
+ }
7091
+ ],
7092
+ "exports": [
7093
+ {
7094
+ "kind": "js",
7095
+ "name": "MAX_WRITE_ROWS",
7096
+ "declaration": {
7097
+ "name": "MAX_WRITE_ROWS",
7098
+ "module": "src/genesis/write-plan.ts"
7099
+ }
7100
+ }
7101
+ ]
7102
+ },
7103
+ {
7104
+ "kind": "javascript-module",
7105
+ "path": "src/genesis/write-tools.ts",
7106
+ "declarations": [
7107
+ {
7108
+ "kind": "function",
7109
+ "name": "createGenesisWriteTools",
7110
+ "return": {
7111
+ "type": {
7112
+ "text": "{\n toolDefinitions: () => Promise<ChatToolDefinition[]>;\n toolHandlers: ChatToolHandlers;\n /**\n * The events that can get a write tool, as far as the config can tell: an event refused for its\n * op, its rowSources entry or a malformed references, or a modify or delete with no row source,\n * is not among them. Their metadata, read when the tools are first listed, can still withhold one.\n */\n writableEvents: readonly string[];\n}"
7113
+ }
7114
+ },
7115
+ "parameters": [
7116
+ {
7117
+ "name": "resources",
7118
+ "type": {
7119
+ "text": "readonly GenesisAiResource[]"
7120
+ }
7121
+ },
7122
+ {
7123
+ "name": "options",
7124
+ "default": "{}",
7125
+ "type": {
7126
+ "text": "GenesisWriteToolsOptions"
7127
+ }
7128
+ }
7129
+ ],
7130
+ "description": "Builds the assistant's write tools from an app's event resources."
7131
+ }
7132
+ ],
7133
+ "exports": [
7134
+ {
7135
+ "kind": "js",
7136
+ "name": "createGenesisWriteTools",
7137
+ "declaration": {
7138
+ "name": "createGenesisWriteTools",
7139
+ "module": "src/genesis/write-tools.ts"
7140
+ }
7141
+ }
7142
+ ]
7143
+ },
7144
+ {
7145
+ "kind": "javascript-module",
7146
+ "path": "src/genesis/write-turn.ts",
7147
+ "declarations": [],
7148
+ "exports": []
7149
+ },
7150
+ {
7151
+ "kind": "javascript-module",
7152
+ "path": "src/headless/describe-interaction.ts",
7153
+ "declarations": [
7154
+ {
7155
+ "kind": "function",
7156
+ "name": "describeInteraction",
7157
+ "return": {
7158
+ "type": {
7159
+ "text": "InteractionDescription"
7160
+ }
7161
+ },
7162
+ "parameters": [
7163
+ {
7164
+ "name": "input",
7165
+ "type": {
7166
+ "text": "DescribeInteractionInput"
7167
+ }
7168
+ }
7169
+ ],
7170
+ "description": "What the person is being asked, as a compact JSON-serialisable record a model can read and\nanswer (GENC-1660): the same text the autopilot is sent for the decision (`renderDecision`,\nso there is one rendering of a decision, not two), and its actions as data, numbered as that text\nnumbers them, so \"1\" means the same option here and there.\n\nWith no surface — a widget with no controller, or one that has not exposed anything yet — there\nis nothing to act on: `controller` is `false` (or `true` and not `ready`, while a controller that\nwill expose a surface has not yet), `actions` is empty, and `text` is the widget as text alone.\n\nReads the surface fresh each time, so it describes the widget as it is now."
7171
+ }
7172
+ ],
7173
+ "exports": [
7174
+ {
7175
+ "kind": "js",
7176
+ "name": "describeInteraction",
7177
+ "declaration": {
7178
+ "name": "describeInteraction",
7179
+ "module": "src/headless/describe-interaction.ts"
7180
+ }
7181
+ }
7182
+ ]
7183
+ },
7184
+ {
7185
+ "kind": "javascript-module",
7186
+ "path": "src/headless/headless-debug.ts",
7187
+ "declarations": [
7188
+ {
7189
+ "kind": "function",
7190
+ "name": "headlessMetaSnapshot",
7191
+ "return": {
7192
+ "type": {
7193
+ "text": "DiagnosticEntry"
7194
+ }
7195
+ },
7196
+ "parameters": [
7197
+ {
7198
+ "name": "driver",
7199
+ "type": {
7200
+ "text": "AiDriver"
7201
+ }
7202
+ },
7203
+ {
7204
+ "name": "options",
7205
+ "default": "{}",
7206
+ "type": {
7207
+ "text": "HeadlessDebugOptions"
7208
+ }
7209
+ }
7210
+ ],
7211
+ "description": "The `meta-snapshot` entry for right now, gathered the way the assistant element gathers it\n(`buildMetaSnapshot` does the assembly; this reads what it reports): the live agent comes from\nthe DRIVER, the transcript from its raw history, and the figures from the transcript, so what a\nheadless host logs is what the browser would. The context window and model, which the element\nlearns from its provider registry, are the host's to say."
7212
+ },
7213
+ {
7214
+ "kind": "function",
7215
+ "name": "headlessDiagnosticEntries",
7216
+ "return": {
7217
+ "type": {
7218
+ "text": "DiagnosticEntry[]"
7219
+ }
7220
+ },
7221
+ "parameters": [
7222
+ {
7223
+ "name": "driver",
7224
+ "type": {
7225
+ "text": "AiDriver"
7226
+ }
7227
+ },
7228
+ {
7229
+ "name": "stateKey",
7230
+ "type": {
7231
+ "text": "string"
7232
+ }
7233
+ },
7234
+ {
7235
+ "name": "options",
7236
+ "default": "{}",
7237
+ "type": {
7238
+ "text": "HeadlessDebugOptions"
7239
+ }
7240
+ }
7241
+ ],
7242
+ "description": "The diagnostic entries for the session so far, from the same `buildDiagnosticEntries` the\nbrowser's element and its persister use."
7243
+ },
7244
+ {
7245
+ "kind": "function",
7246
+ "name": "headlessCurrentDebugLog",
7247
+ "return": {
7248
+ "type": {
7249
+ "text": "DebugLog"
7250
+ }
7251
+ },
7252
+ "parameters": [
7253
+ {
7254
+ "name": "driver",
7255
+ "type": {
7256
+ "text": "AiDriver"
7257
+ }
7258
+ },
7259
+ {
7260
+ "name": "stateKey",
7261
+ "type": {
7262
+ "text": "string"
7263
+ }
7264
+ },
7265
+ {
7266
+ "name": "options",
7267
+ "default": "{}",
7268
+ "type": {
7269
+ "text": "HeadlessDebugOptions"
7270
+ }
7271
+ }
7272
+ ],
7273
+ "description": "The current page's debug log: what `HeadlessSession.debugLog()` returns when nothing is\npersisted, and the fallback when the stored stream cannot be read."
7274
+ }
7275
+ ],
7276
+ "exports": [
7277
+ {
7278
+ "kind": "js",
7279
+ "name": "headlessMetaSnapshot",
7280
+ "declaration": {
7281
+ "name": "headlessMetaSnapshot",
7282
+ "module": "src/headless/headless-debug.ts"
7283
+ }
7284
+ },
7285
+ {
7286
+ "kind": "js",
7287
+ "name": "headlessDiagnosticEntries",
7288
+ "declaration": {
7289
+ "name": "headlessDiagnosticEntries",
7290
+ "module": "src/headless/headless-debug.ts"
7291
+ }
7292
+ },
7293
+ {
7294
+ "kind": "js",
7295
+ "name": "headlessCurrentDebugLog",
7296
+ "declaration": {
7297
+ "name": "headlessCurrentDebugLog",
7298
+ "module": "src/headless/headless-debug.ts"
7299
+ }
7300
+ }
7301
+ ]
7302
+ },
7303
+ {
7304
+ "kind": "javascript-module",
7305
+ "path": "src/headless/headless-persistence.ts",
7306
+ "declarations": [
7307
+ {
7308
+ "kind": "function",
7309
+ "name": "headlessPersistence",
7310
+ "return": {
7311
+ "type": {
7312
+ "text": "HeadlessPersistence"
7313
+ }
7314
+ },
7315
+ "parameters": [
7316
+ {
7317
+ "name": "options",
7318
+ "type": {
7319
+ "text": "HeadlessPersistenceOptions"
7320
+ }
7321
+ }
7322
+ ],
7323
+ "description": "Persistence for a `HeadlessSession`: it writes exactly what the browser writes — the\n`sessions/<key>` snapshot and the `diag/<key>` stream — through the platform's\n`SessionPersister` and the host's `SessionPersistenceProvider`, and builds the lifetime debug log\nfrom the same code as the browser's Download.\n\nExported from the package's main entry only, NOT from the Node entry (`./chat-driver`): it\nreaches the session store, and through it `@genesislcap/foundation-redux`, which are not\nNode-clean. The `persister` it makes is the registry's, so a host can restore through\n`getPersister(stateKey)`."
7324
+ }
7325
+ ],
7326
+ "exports": [
7327
+ {
7328
+ "kind": "js",
7329
+ "name": "headlessPersistence",
7330
+ "declaration": {
7331
+ "name": "headlessPersistence",
7332
+ "module": "src/headless/headless-persistence.ts"
7333
+ }
7334
+ }
7335
+ ]
7336
+ },
7337
+ {
7338
+ "kind": "javascript-module",
7339
+ "path": "src/headless/headless-session.ts",
7340
+ "declarations": [
7341
+ {
7342
+ "kind": "class",
7343
+ "description": "A driver with no screen: a way for a host with no browser (a coding agent behind a small HTTP\nserver, a test) to run a whole assistant journey as the person (GENC-1660).\n\nIt watches the driver for interactions and turns the conversation into an append-only log of\nplain-data events (see HeadlessEvent): `decision` when the person has something to\nanswer, `working` when someone else has it, `settled`, the visible `message`s, the end of each\n`turn`, the autopilot's state, and the host's own `probe`. The caller reads the log with\nHeadlessSession.wait, a long poll cursored by `seq`, so nothing is lost between calls.\nIt answers with HeadlessSession.act, which runs a widget's action as a click would, with\nthe same numbered options the autopilot is shown.\n\nIt only observes: its interceptor never claims an interaction, so an autopilot on the same\ndriver works as it always does, and what the session reports as a `decision` is what the autopilot\nhas handed to the person. Plain classes only: no DOM, no FAST.",
7344
+ "name": "HeadlessSession",
7345
+ "members": [
7346
+ {
7347
+ "kind": "field",
7348
+ "name": "sessionKey",
7349
+ "type": {
7350
+ "text": "string"
7351
+ },
7352
+ "privacy": "private",
7353
+ "readonly": true
7354
+ },
7355
+ {
7356
+ "kind": "field",
7357
+ "name": "allowRaw",
7358
+ "type": {
7359
+ "text": "boolean"
7360
+ },
7361
+ "privacy": "private",
7362
+ "readonly": true
7363
+ },
7364
+ {
7365
+ "kind": "field",
7366
+ "name": "clock",
7367
+ "type": {
7368
+ "text": "() => number"
7369
+ },
7370
+ "privacy": "private",
7371
+ "readonly": true
7372
+ },
7373
+ {
7374
+ "kind": "field",
7375
+ "name": "autopilotHost",
7376
+ "type": {
7377
+ "text": "AutopilotLike | undefined"
7378
+ },
7379
+ "privacy": "private",
7380
+ "readonly": true,
7381
+ "default": "autopilot"
7382
+ },
7383
+ {
7384
+ "kind": "field",
7385
+ "name": "events",
7386
+ "type": {
7387
+ "text": "HeadlessEvent[]"
7388
+ },
7389
+ "privacy": "private",
7390
+ "readonly": true,
7391
+ "default": "[]"
7392
+ },
7393
+ {
7394
+ "kind": "field",
7395
+ "name": "seq",
7396
+ "type": {
7397
+ "text": "number"
7398
+ },
7399
+ "privacy": "private",
7400
+ "default": "0"
7401
+ },
7402
+ {
7403
+ "kind": "field",
7404
+ "name": "tracked",
7405
+ "privacy": "private",
7406
+ "readonly": true,
7407
+ "default": "new Map<string, Tracked>()"
7408
+ },
7409
+ {
7410
+ "kind": "field",
7411
+ "name": "origin",
7412
+ "privacy": "private",
7413
+ "readonly": true,
7414
+ "default": "new Map<string, { auto?: boolean; raw?: boolean }>()",
7415
+ "description": "What the session did to an interaction itself, for `settled` to say when the driver reports it."
7416
+ },
7417
+ {
7418
+ "kind": "field",
7419
+ "name": "waiters",
7420
+ "privacy": "private",
7421
+ "readonly": true,
7422
+ "default": "new Set<Waiter>()"
7423
+ },
7424
+ {
7425
+ "kind": "field",
7426
+ "name": "teardown",
7427
+ "type": {
7428
+ "text": "Array<() => void>"
7429
+ },
7430
+ "privacy": "private",
7431
+ "readonly": true,
7432
+ "default": "[]"
7433
+ },
7434
+ {
7435
+ "kind": "field",
7436
+ "name": "seen",
7437
+ "type": {
7438
+ "text": "number"
7439
+ },
7440
+ "privacy": "private",
7441
+ "description": "How much of the driver's history has been reported as messages."
7442
+ },
7443
+ {
7444
+ "kind": "field",
7445
+ "name": "turn",
7446
+ "type": {
7447
+ "text": "Promise<unknown> | undefined"
7448
+ },
7449
+ "privacy": "private",
7450
+ "description": "The `send` in flight, if any."
7451
+ },
7452
+ {
7453
+ "kind": "field",
7454
+ "name": "open",
7455
+ "type": {
7456
+ "text": "{ start: number; reason?: string; failureReason?: string } | undefined"
7457
+ },
7458
+ "privacy": "private",
7459
+ "description": "The turn that is running, whoever started it, until the driver has been idle for a beat:\n`start` is where its messages begin in the history. Its `reason` and `failureReason` are what\nended it, when something said."
7460
+ },
7461
+ {
7462
+ "kind": "field",
7463
+ "name": "base",
7464
+ "type": {
7465
+ "text": "number"
7466
+ },
7467
+ "privacy": "private",
7468
+ "description": "History length when the last turn closed: where a turn the session did not start begins."
7469
+ },
7470
+ {
7471
+ "kind": "field",
7472
+ "name": "quiesceTimer",
7473
+ "type": {
7474
+ "text": "ReturnType<typeof setTimeout> | undefined"
7475
+ },
7476
+ "privacy": "private"
7477
+ },
7478
+ {
7479
+ "kind": "field",
7480
+ "name": "poller",
7481
+ "type": {
7482
+ "text": "ReturnType<typeof setInterval> | undefined"
7483
+ },
7484
+ "privacy": "private"
7485
+ },
7486
+ {
7487
+ "kind": "field",
7488
+ "name": "persistence",
7489
+ "type": {
7490
+ "text": "HeadlessPersistenceBinding | undefined"
7491
+ },
7492
+ "privacy": "private",
7493
+ "readonly": true
7494
+ },
7495
+ {
7496
+ "kind": "field",
7497
+ "name": "lastProbe",
7498
+ "type": {
7499
+ "text": "Record<string, unknown>"
7500
+ },
7501
+ "privacy": "private",
7502
+ "default": "{}"
7503
+ },
7504
+ {
7505
+ "kind": "field",
7506
+ "name": "lastAutopilot",
7507
+ "type": {
7508
+ "text": "string"
7509
+ },
7510
+ "privacy": "private",
7511
+ "default": "''"
7512
+ },
7513
+ {
7514
+ "kind": "field",
7515
+ "name": "disposed",
7516
+ "type": {
7517
+ "text": "boolean"
7518
+ },
7519
+ "privacy": "private",
7520
+ "default": "false"
7521
+ },
7522
+ {
7523
+ "kind": "method",
7524
+ "name": "send",
7525
+ "return": {
7526
+ "type": {
7527
+ "text": "HeadlessResult"
7528
+ }
7529
+ },
7530
+ "parameters": [
7531
+ {
7532
+ "name": "text",
7533
+ "type": {
7534
+ "text": "string"
7535
+ }
7536
+ },
7537
+ {
7538
+ "name": "options",
7539
+ "default": "{}",
7540
+ "type": {
7541
+ "text": "HeadlessSendOptions"
7542
+ }
7543
+ }
7544
+ ],
7545
+ "description": "Send the person's message, and start the turn. Returns as soon as the turn has started, not\nwhen it ends: a turn includes every interaction parked on the person, so it can run as long as\nthe journey. Its end is the `turn` event.\n\nRefused, never thrown, when the message is empty, or a turn is already running."
7546
+ },
7547
+ {
7548
+ "kind": "method",
7549
+ "name": "act",
7550
+ "return": {
7551
+ "type": {
7552
+ "text": "Promise<HeadlessActResult>"
7553
+ }
7554
+ },
7555
+ "parameters": [
7556
+ {
7557
+ "name": "interactionId",
7558
+ "type": {
7559
+ "text": "string"
7560
+ }
7561
+ },
7562
+ {
7563
+ "name": "action",
7564
+ "type": {
7565
+ "text": "string | number"
7566
+ }
7567
+ },
7568
+ {
7569
+ "name": "args",
7570
+ "default": "{}",
7571
+ "type": {
7572
+ "text": "HeadlessActArgs"
7573
+ }
7574
+ }
7575
+ ],
7576
+ "description": "Run one of a pending interaction's actions as the person, as a click would (the answer is\ncredited `answeredBy: 'user'`). `action` is a number from the description's actions, or an\naction's name; `args` carry the text, the options (numbers or labels) or the form's fields it\ntakes. Refused, with the reason and what is enabled, when a claimant holds the interaction,\nthe action is unknown or disabled, or its arguments do not fit: nothing runs then.\n\nThe result is the driver's `InvokeResult`, plus `description` of the interaction when it is\nstill open."
7577
+ },
7578
+ {
7579
+ "kind": "method",
7580
+ "name": "resolve",
7581
+ "return": {
7582
+ "type": {
7583
+ "text": "HeadlessResult"
7584
+ }
7585
+ },
7586
+ "parameters": [
7587
+ {
7588
+ "name": "interactionId",
7589
+ "type": {
7590
+ "text": "string"
7591
+ }
7592
+ },
7593
+ {
7594
+ "name": "result",
7595
+ "type": {
7596
+ "text": "unknown"
7597
+ }
7598
+ }
7599
+ ],
7600
+ "description": "Settle a pending interaction raw, with `result` as the widget would have resolved it,\nbypassing its actions and everything they check: an escape hatch for a widget with no\ncontroller, or one that cannot be acted on. Logs `settled` with `raw: true` and records\n`headless.raw-resolved`. Refused when `allowRaw` is `false` or the interaction is not pending."
7601
+ },
7602
+ {
7603
+ "kind": "method",
7604
+ "name": "read",
7605
+ "return": {
7606
+ "type": {
7607
+ "text": "Promise<HeadlessReadResult>"
7608
+ }
7609
+ },
7610
+ "parameters": [
7611
+ {
7612
+ "name": "interactionId",
7613
+ "type": {
7614
+ "text": "string"
7615
+ }
7616
+ },
7617
+ {
7618
+ "name": "request",
7619
+ "default": "{}",
7620
+ "type": {
7621
+ "text": "HeadlessReadRequest"
7622
+ }
7623
+ }
7624
+ ],
7625
+ "description": "Read from a pending interaction without changing it: one of its views, or (with `tool`) one of\nthe widget tools given to the session. The text is capped. A view the surface does not list is\nrefused, naming those it does, as the autopilot's `widget_read` does."
7626
+ },
7627
+ {
7628
+ "kind": "method",
7629
+ "name": "wait",
7630
+ "return": {
7631
+ "type": {
7632
+ "text": "Promise<HeadlessWaitResult>"
7633
+ }
7634
+ },
7635
+ "parameters": [
7636
+ {
7637
+ "name": "request",
7638
+ "type": {
7639
+ "text": "HeadlessWaitRequest"
7640
+ }
7641
+ }
7642
+ ],
7643
+ "description": "Wait for the log to say something, then return what it said. Resolves as soon as an event in\n`until` is in the log after `since` (immediately, when one already is), or at `maxWaitMs` with\nstatus `'working'`. Either way it returns every event after `since`, and `nextSeq`, the cursor\nfor the next call: poll with it and nothing is lost."
7644
+ },
7645
+ {
7646
+ "kind": "method",
7647
+ "name": "eventsSince",
7648
+ "return": {
7649
+ "type": {
7650
+ "text": "readonly HeadlessEvent[]"
7651
+ }
7652
+ },
7653
+ "parameters": [
7654
+ {
7655
+ "name": "since",
7656
+ "default": "0"
7657
+ }
7658
+ ],
7659
+ "description": "Every event logged after `since` (default: all the log keeps), without waiting."
7660
+ },
7661
+ {
7662
+ "kind": "method",
7663
+ "name": "state",
7664
+ "return": {
7665
+ "type": {
7666
+ "text": "HeadlessState"
7667
+ }
7668
+ },
7669
+ "description": "What is going on now: whether a turn runs, the interaction the person should answer first (and\nthe others open behind it), the autopilot, what it has cost, and the host's probe."
7670
+ },
7671
+ {
7672
+ "kind": "method",
7673
+ "name": "flush",
7674
+ "return": {
7675
+ "type": {
7676
+ "text": "Promise<void>"
7677
+ }
7678
+ },
7679
+ "description": "Save the session now: the snapshot, and the diagnostics appended since the last flush, rather\nthan at the next throttled save. A no-op without `persistence`."
7680
+ },
7681
+ {
7682
+ "kind": "method",
7683
+ "name": "debugLog",
7684
+ "return": {
7685
+ "type": {
7686
+ "text": "Promise<DebugLog>"
7687
+ }
7688
+ },
7689
+ "description": "The debug log, the document the browser's Download gives. With `persistence`, the log of the\nwhole session stitched from the stored stream with a fresh `meta-snapshot` (`lifetimeDebugLog`,\nthe same code); without, the current page's, from `buildDiagnosticEntries`. Never throws."
7690
+ },
7691
+ {
7692
+ "kind": "method",
7693
+ "name": "stop",
7694
+ "return": {
7695
+ "type": {
7696
+ "text": "HeadlessResult"
7697
+ }
7698
+ },
7699
+ "description": "Stop the running turn, when the driver can."
7700
+ },
7701
+ {
7702
+ "kind": "method",
7703
+ "name": "autopilot",
7704
+ "return": {
7705
+ "type": {
7706
+ "text": "HeadlessResult"
7707
+ }
7708
+ },
7709
+ "parameters": [
7710
+ {
7711
+ "name": "mode",
7712
+ "type": {
7713
+ "text": "'pause' | 'resume' | 'stop'"
7714
+ }
7715
+ }
7716
+ ],
7717
+ "description": "Pause, resume or stop the autopilot, when there is one. Pausing hands what it holds to the\nperson, which then appears as a `decision`."
7718
+ },
7719
+ {
7720
+ "kind": "method",
7721
+ "name": "dispose",
7722
+ "return": {
7723
+ "type": {
7724
+ "text": "void"
7725
+ }
7726
+ },
7727
+ "description": "Detach: remove the interceptor and every subscription, and release anyone waiting."
7728
+ },
7729
+ {
7730
+ "kind": "method",
7731
+ "name": "listen",
7732
+ "privacy": "private",
7733
+ "return": {
7734
+ "type": {
7735
+ "text": "void"
7736
+ }
7737
+ },
7738
+ "parameters": [
7739
+ {
7740
+ "name": "type",
7741
+ "type": {
7742
+ "text": "string"
7743
+ }
7744
+ },
7745
+ {
7746
+ "name": "handler",
7747
+ "type": {
7748
+ "text": "(e: Event) => void"
7749
+ }
7750
+ }
7751
+ ]
7752
+ },
7753
+ {
7754
+ "kind": "method",
7755
+ "name": "history",
7756
+ "privacy": "private",
7757
+ "return": {
7758
+ "type": {
7759
+ "text": "readonly ChatMessage[]"
7760
+ }
7761
+ }
7762
+ },
7763
+ {
7764
+ "kind": "method",
7765
+ "name": "onOpened",
7766
+ "privacy": "private",
7767
+ "return": {
7768
+ "type": {
7769
+ "text": "void"
7770
+ }
7771
+ },
7772
+ "parameters": [
7773
+ {
7774
+ "name": "opened",
7775
+ "type": {
7776
+ "text": "InteractionOpened"
7777
+ }
7778
+ }
7779
+ ],
7780
+ "description": "An interaction opened: watch it. Who holds it is not decided yet, so it is reported later."
7781
+ },
7782
+ {
7783
+ "kind": "method",
7784
+ "name": "onSettled",
7785
+ "privacy": "private",
7786
+ "return": {
7787
+ "type": {
7788
+ "text": "void"
7789
+ }
7790
+ },
7791
+ "parameters": [
7792
+ {
7793
+ "name": "detail",
7794
+ "type": {
7795
+ "text": "{\n interactionId: string;\n answeredBy?: string;\n resolvedItself?: boolean;\n }"
7796
+ }
7797
+ }
7798
+ ],
7799
+ "description": "The driver says an interaction settled, by whatever route."
7800
+ },
7801
+ {
7802
+ "kind": "method",
7803
+ "name": "onEnded",
7804
+ "privacy": "private",
7805
+ "return": {
7806
+ "type": {
7807
+ "text": "void"
7808
+ }
7809
+ },
7810
+ "parameters": [
7811
+ {
7812
+ "name": "t",
7813
+ "type": {
7814
+ "text": "Tracked"
7815
+ }
7816
+ }
7817
+ ],
7818
+ "description": "The interaction's context was disposed: if nothing said it settled, say it did."
7819
+ },
7820
+ {
7821
+ "kind": "method",
7822
+ "name": "settle",
7823
+ "privacy": "private",
7824
+ "return": {
7825
+ "type": {
7826
+ "text": "void"
7827
+ }
7828
+ },
7829
+ "parameters": [
7830
+ {
7831
+ "name": "t",
7832
+ "type": {
7833
+ "text": "Tracked"
7834
+ }
7835
+ },
7836
+ {
7837
+ "name": "how",
7838
+ "type": {
7839
+ "text": "{ answeredBy?: string; resolvedItself?: boolean; auto?: boolean; raw?: boolean }"
7840
+ }
7841
+ }
7842
+ ]
7843
+ },
7844
+ {
7845
+ "kind": "method",
7846
+ "name": "release",
7847
+ "privacy": "private",
7848
+ "return": {
7849
+ "type": {
7850
+ "text": "void"
7851
+ }
7852
+ },
7853
+ "parameters": [
7854
+ {
7855
+ "name": "t",
7856
+ "type": {
7857
+ "text": "Tracked"
7858
+ }
7859
+ }
7860
+ ]
7861
+ },
7862
+ {
7863
+ "kind": "method",
7864
+ "name": "onHistory",
7865
+ "privacy": "private",
7866
+ "return": {
7867
+ "type": {
7868
+ "text": "void"
7869
+ }
7870
+ },
7871
+ "description": "New messages in the driver's history: report what the person would see of them."
7872
+ },
7873
+ {
7874
+ "kind": "method",
7875
+ "name": "reportMessages",
7876
+ "privacy": "private",
7877
+ "return": {
7878
+ "type": {
7879
+ "text": "void"
7880
+ }
7881
+ }
7882
+ },
7883
+ {
7884
+ "kind": "method",
7885
+ "name": "onAutopilot",
7886
+ "privacy": "private",
7887
+ "return": {
7888
+ "type": {
7889
+ "text": "void"
7890
+ }
7891
+ }
7892
+ },
7893
+ {
7894
+ "kind": "method",
7895
+ "name": "autopilotSignature",
7896
+ "privacy": "private",
7897
+ "return": {
7898
+ "type": {
7899
+ "text": "string"
7900
+ }
7901
+ }
7902
+ },
7903
+ {
7904
+ "kind": "method",
7905
+ "name": "describe",
7906
+ "privacy": "private",
7907
+ "return": {
7908
+ "type": {
7909
+ "text": "InteractionDescription"
7910
+ }
7911
+ },
7912
+ "parameters": [
7913
+ {
7914
+ "name": "t",
7915
+ "type": {
7916
+ "text": "Tracked"
7917
+ }
7918
+ }
7919
+ ]
7920
+ },
7921
+ {
7922
+ "kind": "method",
7923
+ "name": "evaluate",
7924
+ "privacy": "private",
7925
+ "return": {
7926
+ "type": {
7927
+ "text": "void"
7928
+ }
7929
+ },
7930
+ "parameters": [
7931
+ {
7932
+ "name": "t",
7933
+ "type": {
7934
+ "text": "Tracked"
7935
+ }
7936
+ }
7937
+ ],
7938
+ "description": "Report where an interaction stands, when that has changed. A `decision` when the person holds\nit and can act; `working` when a claimant holds it or it is not ready yet. A `decision` is\nlogged again only when its description changed materially: who holds it, whether it is ready\nor has a controller, or which actions are enabled. The text and facts alone do not count."
7939
+ },
7940
+ {
7941
+ "kind": "method",
7942
+ "name": "autoSettle",
7943
+ "privacy": "private",
7944
+ "return": {
7945
+ "type": {
7946
+ "text": "boolean"
7947
+ }
7948
+ },
7949
+ "parameters": [
7950
+ {
7951
+ "name": "t",
7952
+ "type": {
7953
+ "text": "Tracked"
7954
+ }
7955
+ }
7956
+ ],
7957
+ "description": "Settle a widget that settles itself in a browser, as it would on mounting. Once, and only when\nthe person holds it. Returns whether it settled it."
7958
+ },
7959
+ {
7960
+ "kind": "method",
7961
+ "name": "readTool",
7962
+ "privacy": "private",
7963
+ "return": {
7964
+ "type": {
7965
+ "text": "Promise<HeadlessReadResult>"
7966
+ }
7967
+ },
7968
+ "parameters": [
7969
+ {
7970
+ "name": "t",
7971
+ "type": {
7972
+ "text": "Tracked"
7973
+ }
7974
+ },
7975
+ {
7976
+ "name": "name",
7977
+ "type": {
7978
+ "text": "string"
7979
+ }
7980
+ },
7981
+ {
7982
+ "name": "args",
7983
+ "type": {
7984
+ "text": "Record<string, unknown> | undefined"
7985
+ }
7986
+ }
7987
+ ]
7988
+ },
7989
+ {
7990
+ "kind": "method",
7991
+ "name": "observe",
7992
+ "privacy": "private",
7993
+ "return": {
7994
+ "type": {
7995
+ "text": "void"
7996
+ }
7997
+ },
7998
+ "description": "Notice a turn begin or end, whoever started it. The driver being busy (or a `send` in flight)\nis a turn; once it has been idle for a beat the turn is over and is reported, once. The beat\ncovers the gaps inside one turn, such as a hand-off continuing it, which are a microtask long.\nA turn that begins the instant another ends, with no idle between, is reported as one."
7999
+ },
8000
+ {
8001
+ "kind": "method",
8002
+ "name": "closeTurn",
8003
+ "privacy": "private",
8004
+ "return": {
8005
+ "type": {
8006
+ "text": "void"
8007
+ }
8008
+ },
8009
+ "description": "Report the open turn as ended, unless the driver is busy again."
8010
+ },
8011
+ {
8012
+ "kind": "method",
8013
+ "name": "startPolling",
8014
+ "privacy": "private",
8015
+ "return": {
8016
+ "type": {
8017
+ "text": "void"
8018
+ }
8019
+ },
8020
+ "description": "Without a shared bus nothing says a turn ended, so while one is open the driver is asked."
8021
+ },
8022
+ {
8023
+ "kind": "method",
8024
+ "name": "stopPolling",
8025
+ "privacy": "private",
8026
+ "return": {
8027
+ "type": {
8028
+ "text": "void"
8029
+ }
8030
+ }
8031
+ },
8032
+ {
8033
+ "kind": "method",
8034
+ "name": "logTurn",
8035
+ "privacy": "private",
8036
+ "return": {
8037
+ "type": {
8038
+ "text": "void"
8039
+ }
8040
+ },
8041
+ "parameters": [
8042
+ {
8043
+ "name": "reason",
8044
+ "type": {
8045
+ "text": "string"
8046
+ }
8047
+ },
8048
+ {
8049
+ "name": "failureReason",
8050
+ "type": {
8051
+ "text": "string | undefined"
8052
+ }
8053
+ },
8054
+ {
8055
+ "name": "start",
8056
+ "type": {
8057
+ "text": "number"
8058
+ }
8059
+ }
8060
+ ]
8061
+ },
8062
+ {
8063
+ "kind": "method",
8064
+ "name": "log",
8065
+ "privacy": "private",
8066
+ "return": {
8067
+ "type": {
8068
+ "text": "void"
8069
+ }
8070
+ },
8071
+ "parameters": [
8072
+ {
8073
+ "name": "event",
8074
+ "type": {
8075
+ "text": "NewEvent"
8076
+ }
8077
+ }
8078
+ ]
8079
+ },
8080
+ {
8081
+ "kind": "method",
8082
+ "name": "append",
8083
+ "privacy": "private",
8084
+ "return": {
8085
+ "type": {
8086
+ "text": "void"
8087
+ }
8088
+ },
8089
+ "parameters": [
8090
+ {
8091
+ "name": "event",
8092
+ "type": {
8093
+ "text": "NewEvent"
8094
+ }
8095
+ }
8096
+ ]
8097
+ },
8098
+ {
8099
+ "kind": "method",
8100
+ "name": "readProbe",
8101
+ "privacy": "private",
8102
+ "return": {
8103
+ "type": {
8104
+ "text": "Record<string, unknown>"
8105
+ }
8106
+ }
8107
+ },
8108
+ {
8109
+ "kind": "method",
8110
+ "name": "checkProbe",
8111
+ "privacy": "private",
8112
+ "return": {
8113
+ "type": {
8114
+ "text": "void"
8115
+ }
8116
+ },
8117
+ "description": "Read the probe again; a change in any top-level value is a `probe` event."
8118
+ },
8119
+ {
8120
+ "kind": "method",
8121
+ "name": "waited",
8122
+ "privacy": "private",
8123
+ "return": {
8124
+ "type": {
8125
+ "text": "HeadlessWaitResult"
8126
+ }
8127
+ },
8128
+ "parameters": [
8129
+ {
8130
+ "name": "since",
8131
+ "type": {
8132
+ "text": "number"
8133
+ }
8134
+ },
8135
+ {
8136
+ "name": "status",
8137
+ "type": {
8138
+ "text": "HeadlessWaitResult['status']"
8139
+ }
8140
+ }
8141
+ ]
8142
+ }
8143
+ ]
8144
+ }
8145
+ ],
8146
+ "exports": [
8147
+ {
8148
+ "kind": "js",
8149
+ "name": "HeadlessSession",
8150
+ "declaration": {
8151
+ "name": "HeadlessSession",
8152
+ "module": "src/headless/headless-session.ts"
8153
+ }
8154
+ }
8155
+ ]
8156
+ },
8157
+ {
8158
+ "kind": "javascript-module",
8159
+ "path": "src/headless/headless.types.ts",
8160
+ "declarations": [],
8161
+ "exports": []
8162
+ },
8163
+ {
8164
+ "kind": "javascript-module",
8165
+ "path": "src/headless/index.ts",
8166
+ "declarations": [],
8167
+ "exports": [
8168
+ {
8169
+ "kind": "js",
8170
+ "name": "describeInteraction",
8171
+ "declaration": {
8172
+ "name": "describeInteraction",
8173
+ "module": "./describe-interaction"
8174
+ }
8175
+ },
8176
+ {
8177
+ "kind": "js",
8178
+ "name": "headlessCurrentDebugLog",
8179
+ "declaration": {
8180
+ "name": "headlessCurrentDebugLog",
8181
+ "module": "./headless-debug"
8182
+ }
8183
+ },
8184
+ {
8185
+ "kind": "js",
8186
+ "name": "headlessDiagnosticEntries",
8187
+ "declaration": {
8188
+ "name": "headlessDiagnosticEntries",
8189
+ "module": "./headless-debug"
8190
+ }
8191
+ },
8192
+ {
8193
+ "kind": "js",
8194
+ "name": "headlessMetaSnapshot",
8195
+ "declaration": {
8196
+ "name": "headlessMetaSnapshot",
8197
+ "module": "./headless-debug"
8198
+ }
8199
+ },
8200
+ {
8201
+ "kind": "js",
8202
+ "name": "HeadlessSession",
8203
+ "declaration": {
8204
+ "name": "HeadlessSession",
8205
+ "module": "./headless-session"
8206
+ }
8207
+ },
8208
+ {
8209
+ "kind": "js",
8210
+ "name": "AutopilotLike",
8211
+ "declaration": {
8212
+ "name": "AutopilotLike",
8213
+ "module": "./headless.types"
8214
+ }
8215
+ },
8216
+ {
8217
+ "kind": "js",
8218
+ "name": "DescribedAction",
8219
+ "declaration": {
8220
+ "name": "DescribedAction",
8221
+ "module": "./headless.types"
8222
+ }
8223
+ },
8224
+ {
8225
+ "kind": "js",
8226
+ "name": "DescribeInteractionInput",
8227
+ "declaration": {
8228
+ "name": "DescribeInteractionInput",
8229
+ "module": "./headless.types"
8230
+ }
8231
+ },
8232
+ {
8233
+ "kind": "js",
8234
+ "name": "HeadlessActArgs",
8235
+ "declaration": {
8236
+ "name": "HeadlessActArgs",
8237
+ "module": "./headless.types"
8238
+ }
8239
+ },
8240
+ {
8241
+ "kind": "js",
8242
+ "name": "HeadlessActResult",
8243
+ "declaration": {
8244
+ "name": "HeadlessActResult",
8245
+ "module": "./headless.types"
8246
+ }
8247
+ },
8248
+ {
8249
+ "kind": "js",
8250
+ "name": "HeadlessDebugOptions",
8251
+ "declaration": {
8252
+ "name": "HeadlessDebugOptions",
8253
+ "module": "./headless.types"
8254
+ }
8255
+ },
8256
+ {
8257
+ "kind": "js",
8258
+ "name": "HeadlessEvent",
8259
+ "declaration": {
8260
+ "name": "HeadlessEvent",
8261
+ "module": "./headless.types"
8262
+ }
8263
+ },
8264
+ {
8265
+ "kind": "js",
8266
+ "name": "HeadlessEventBase",
8267
+ "declaration": {
8268
+ "name": "HeadlessEventBase",
8269
+ "module": "./headless.types"
8270
+ }
8271
+ },
8272
+ {
8273
+ "kind": "js",
8274
+ "name": "HeadlessEventType",
8275
+ "declaration": {
8276
+ "name": "HeadlessEventType",
8277
+ "module": "./headless.types"
8278
+ }
8279
+ },
8280
+ {
8281
+ "kind": "js",
8282
+ "name": "HeadlessPersistence",
8283
+ "declaration": {
8284
+ "name": "HeadlessPersistence",
8285
+ "module": "./headless.types"
8286
+ }
8287
+ },
8288
+ {
8289
+ "kind": "js",
8290
+ "name": "HeadlessPersistenceBinding",
8291
+ "declaration": {
8292
+ "name": "HeadlessPersistenceBinding",
8293
+ "module": "./headless.types"
8294
+ }
8295
+ },
8296
+ {
8297
+ "kind": "js",
8298
+ "name": "HeadlessPersistenceHost",
8299
+ "declaration": {
8300
+ "name": "HeadlessPersistenceHost",
8301
+ "module": "./headless.types"
8302
+ }
8303
+ },
8304
+ {
8305
+ "kind": "js",
8306
+ "name": "HeadlessReadRequest",
8307
+ "declaration": {
8308
+ "name": "HeadlessReadRequest",
8309
+ "module": "./headless.types"
8310
+ }
8311
+ },
8312
+ {
8313
+ "kind": "js",
8314
+ "name": "HeadlessReadResult",
8315
+ "declaration": {
8316
+ "name": "HeadlessReadResult",
8317
+ "module": "./headless.types"
8318
+ }
8319
+ },
8320
+ {
8321
+ "kind": "js",
8322
+ "name": "HeadlessResult",
8323
+ "declaration": {
8324
+ "name": "HeadlessResult",
8325
+ "module": "./headless.types"
8326
+ }
8327
+ },
8328
+ {
8329
+ "kind": "js",
8330
+ "name": "HeadlessSendOptions",
8331
+ "declaration": {
8332
+ "name": "HeadlessSendOptions",
8333
+ "module": "./headless.types"
8334
+ }
8335
+ },
8336
+ {
8337
+ "kind": "js",
8338
+ "name": "HeadlessSessionOptions",
6804
8339
  "declaration": {
6805
- "name": "buildEventPayload",
6806
- "module": "src/genesis/write-payload.ts"
8340
+ "name": "HeadlessSessionOptions",
8341
+ "module": "./headless.types"
6807
8342
  }
6808
- }
6809
- ]
6810
- },
6811
- {
6812
- "kind": "javascript-module",
6813
- "path": "src/genesis/write-plan.ts",
6814
- "declarations": [
8343
+ },
6815
8344
  {
6816
- "kind": "variable",
6817
- "name": "MAX_WRITE_ROWS",
6818
- "type": {
6819
- "text": "number"
6820
- },
6821
- "default": "25",
6822
- "description": "A batch a person can actually read before approving it."
6823
- }
6824
- ],
6825
- "exports": [
8345
+ "kind": "js",
8346
+ "name": "HeadlessState",
8347
+ "declaration": {
8348
+ "name": "HeadlessState",
8349
+ "module": "./headless.types"
8350
+ }
8351
+ },
6826
8352
  {
6827
8353
  "kind": "js",
6828
- "name": "MAX_WRITE_ROWS",
8354
+ "name": "HeadlessWaitRequest",
6829
8355
  "declaration": {
6830
- "name": "MAX_WRITE_ROWS",
6831
- "module": "src/genesis/write-plan.ts"
8356
+ "name": "HeadlessWaitRequest",
8357
+ "module": "./headless.types"
6832
8358
  }
6833
- }
6834
- ]
6835
- },
6836
- {
6837
- "kind": "javascript-module",
6838
- "path": "src/genesis/write-tools.ts",
6839
- "declarations": [
8359
+ },
6840
8360
  {
6841
- "kind": "function",
6842
- "name": "createGenesisWriteTools",
6843
- "return": {
6844
- "type": {
6845
- "text": "{\n toolDefinitions: () => Promise<ChatToolDefinition[]>;\n toolHandlers: ChatToolHandlers;\n /**\n * The events that can get a write tool, as far as the config can tell: an event refused for its\n * op, its rowSources entry or a malformed references, or a modify or delete with no row source,\n * is not among them. Their metadata, read when the tools are first listed, can still withhold one.\n */\n writableEvents: readonly string[];\n}"
6846
- }
6847
- },
6848
- "parameters": [
6849
- {
6850
- "name": "resources",
6851
- "type": {
6852
- "text": "readonly GenesisAiResource[]"
6853
- }
6854
- },
6855
- {
6856
- "name": "options",
6857
- "default": "{}",
6858
- "type": {
6859
- "text": "GenesisWriteToolsOptions"
6860
- }
6861
- }
6862
- ],
6863
- "description": "Builds the assistant's write tools from an app's event resources."
6864
- }
6865
- ],
6866
- "exports": [
8361
+ "kind": "js",
8362
+ "name": "HeadlessWaitResult",
8363
+ "declaration": {
8364
+ "name": "HeadlessWaitResult",
8365
+ "module": "./headless.types"
8366
+ }
8367
+ },
6867
8368
  {
6868
8369
  "kind": "js",
6869
- "name": "createGenesisWriteTools",
8370
+ "name": "InteractionDescription",
6870
8371
  "declaration": {
6871
- "name": "createGenesisWriteTools",
6872
- "module": "src/genesis/write-tools.ts"
8372
+ "name": "InteractionDescription",
8373
+ "module": "./headless.types"
8374
+ }
8375
+ },
8376
+ {
8377
+ "kind": "js",
8378
+ "name": "PendingSummary",
8379
+ "declaration": {
8380
+ "name": "PendingSummary",
8381
+ "module": "./headless.types"
6873
8382
  }
6874
8383
  }
6875
8384
  ]
6876
8385
  },
6877
- {
6878
- "kind": "javascript-module",
6879
- "path": "src/genesis/write-turn.ts",
6880
- "declarations": [],
6881
- "exports": []
6882
- },
6883
8386
  {
6884
8387
  "kind": "javascript-module",
6885
8388
  "path": "src/main/attachment-controller.ts",
@@ -11638,7 +13141,7 @@
11638
13141
  "type": {
11639
13142
  "text": "Record<MetaEventType, MetaEventImportance>"
11640
13143
  },
11641
- "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 // 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 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 '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}",
13144
+ "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 // 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}",
11642
13145
  "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."
11643
13146
  },
11644
13147
  {
@@ -11800,7 +13303,7 @@
11800
13303
  "type": {
11801
13304
  "text": "readonly string[]"
11802
13305
  },
11803
- "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.\",\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; 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.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), 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), 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 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]",
13306
+ "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.\",\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; 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 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 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]",
11804
13307
  "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."
11805
13308
  }
11806
13309
  ],
@@ -17091,6 +18594,37 @@
17091
18594
  ],
17092
18595
  "description": "Forwarded, so an interceptor installed on any layer lands on the driver that opens the\ninteractions. A decorator that answers interactions installs its own on `this.inner`."
17093
18596
  },
18597
+ {
18598
+ "kind": "method",
18599
+ "name": "invokeAsUser",
18600
+ "return": {
18601
+ "type": {
18602
+ "text": "Promise<InvokeResult>"
18603
+ }
18604
+ },
18605
+ "parameters": [
18606
+ {
18607
+ "name": "interactionId",
18608
+ "type": {
18609
+ "text": "string"
18610
+ }
18611
+ },
18612
+ {
18613
+ "name": "action",
18614
+ "type": {
18615
+ "text": "string"
18616
+ }
18617
+ },
18618
+ {
18619
+ "name": "args",
18620
+ "optional": true,
18621
+ "type": {
18622
+ "text": "unknown"
18623
+ }
18624
+ }
18625
+ ],
18626
+ "description": "Forwarded: the interaction belongs to the driver that opened it. An inner driver that cannot\nrun actions answers as if the interaction had ended."
18627
+ },
17094
18628
  {
17095
18629
  "kind": "method",
17096
18630
  "name": "presentInteraction",
@@ -20095,6 +21629,37 @@
20095
21629
  ],
20096
21630
  "description": "{@inheritDoc AiDriver.addInteractionInterceptor}\n\nConsulted only on the root driver, where every interaction opens: a sub-agent's request\ntravels up to its root, carrying its owner path, and is offered there once."
20097
21631
  },
21632
+ {
21633
+ "kind": "method",
21634
+ "name": "invokeAsUser",
21635
+ "return": {
21636
+ "type": {
21637
+ "text": "Promise<InvokeResult>"
21638
+ }
21639
+ },
21640
+ "parameters": [
21641
+ {
21642
+ "name": "interactionId",
21643
+ "type": {
21644
+ "text": "string"
21645
+ }
21646
+ },
21647
+ {
21648
+ "name": "action",
21649
+ "type": {
21650
+ "text": "string"
21651
+ }
21652
+ },
21653
+ {
21654
+ "name": "args",
21655
+ "optional": true,
21656
+ "type": {
21657
+ "text": "unknown"
21658
+ }
21659
+ }
21660
+ ],
21661
+ "description": "{@inheritDoc AiDriver.invokeAsUser}"
21662
+ },
20098
21663
  {
20099
21664
  "kind": "method",
20100
21665
  "name": "presentInteraction",
@@ -21351,6 +22916,37 @@
21351
22916
  ],
21352
22917
  "description": "See `ChatDriver.resolveInteraction`. Warns and returns when the id is unknown — a widget can\nreport twice, and the second report has nothing left to settle. `how` is what a controller's\n`ctx.resolve` said about the settle (`resolvedItself`); every other route passes none."
21353
22918
  },
22919
+ {
22920
+ "kind": "method",
22921
+ "name": "invokeAsUser",
22922
+ "return": {
22923
+ "type": {
22924
+ "text": "Promise<InvokeResult>"
22925
+ }
22926
+ },
22927
+ "parameters": [
22928
+ {
22929
+ "name": "interactionId",
22930
+ "type": {
22931
+ "text": "string"
22932
+ }
22933
+ },
22934
+ {
22935
+ "name": "action",
22936
+ "type": {
22937
+ "text": "string"
22938
+ }
22939
+ },
22940
+ {
22941
+ "name": "args",
22942
+ "optional": true,
22943
+ "type": {
22944
+ "text": "unknown"
22945
+ }
22946
+ }
22947
+ ],
22948
+ "description": "See `ChatDriver.invokeAsUser`: `hold.invoke`'s sibling for the person (GENC-1660).\n\nRuns the action the way the widget's own button does, and records nothing against a claimant:\nno `settledBy`, no `decision`. So `whoAnswered` credits a settle to the person\n(`answeredBy: 'user'`), exactly as a click would be. Refused unless the person holds the\ninteraction: a claimant that does is not pushed aside, the person takes it back first. An\nediting action leaves no edit record either — those mark what a claimant changed on the\nperson's behalf, and this is the person's own change."
22949
+ },
21354
22950
  {
21355
22951
  "kind": "method",
21356
22952
  "name": "recordExternalCost",
@@ -23196,7 +24792,7 @@
23196
24792
  }
23197
24793
  }
23198
24794
  ],
23199
- "description": "Act on what the agent call that just ended asked for, and run the next agent in the same user\nturn while there is one (GENC-1737): a `handOff` runs its target with the brief, and a target\nthat releases hands back to its caller. Returns the last call's result.\n\nA failed call ends the turn there, as a Stop does: what it asked for still happens, and the\nnext agent runs on the next message. Running it now would meet the same wall (a budget, a\nrefused account, a full context window), or build on a reply that never came."
24795
+ "description": "Act on what the agent call that just ended asked for, and run the next agent in the same user\nturn while there is one (GENC-1737): a `handOff` runs its target with the brief, and a target\nthat releases hands back to its caller. Returns the last call's result.\n\nA failed call ends the turn there, as a Stop does: what it asked for still happens, and the\nnext agent runs on the next message. Running it now would meet the same wall (a budget, a\nrefused account, a full context window), or build on a reply that never came. The one thing a\nStop takes back is a hand-off that has not started (see `afterAgentCall`)."
23200
24796
  },
23201
24797
  {
23202
24798
  "kind": "method",
@@ -23207,7 +24803,7 @@
23207
24803
  "text": "Promise<string | undefined>"
23208
24804
  }
23209
24805
  },
23210
- "description": "After one agent call: start the hand-off it asked for, or release it and, when it was a\nhand-off's target, hand back. Returns the tail note for the agent to run next, or `undefined`\nwhen the turn ends here.\n\nA plain target hands back when its call ends, released or not, as a plain agent is done once\nit has answered. A stateful one holds the hand-off until it releases, as it holds its flow."
24806
+ "description": "After one agent call: start the hand-off it asked for, or release it and, when it was a\nhand-off's target, hand back. Returns the tail note for the agent to run next, or `undefined`\nwhen the turn ends here.\n\nA plain target hands back when its call ends, released or not, as a plain agent is done once\nit has answered. A stateful one holds the hand-off until it releases, as it holds its flow.\n\nA Stop cancels a hand-off that has not started: the user stopped the turn the caller asked for\nit in, often during the caller's closing call, so the target is not activated, and the call\nends as if it had never asked (a plain caller's turn ends as usual below). A hand-back is not\ntaken back: the target finished the work it was given."
23211
24807
  },
23212
24808
  {
23213
24809
  "kind": "method",
@@ -24304,6 +25900,41 @@
24304
25900
  "module": "src/components/ai-driver/base-driver-decorator.ts"
24305
25901
  }
24306
25902
  },
25903
+ {
25904
+ "kind": "method",
25905
+ "name": "invokeAsUser",
25906
+ "return": {
25907
+ "type": {
25908
+ "text": "Promise<InvokeResult>"
25909
+ }
25910
+ },
25911
+ "parameters": [
25912
+ {
25913
+ "name": "interactionId",
25914
+ "type": {
25915
+ "text": "string"
25916
+ }
25917
+ },
25918
+ {
25919
+ "name": "action",
25920
+ "type": {
25921
+ "text": "string"
25922
+ }
25923
+ },
25924
+ {
25925
+ "name": "args",
25926
+ "optional": true,
25927
+ "type": {
25928
+ "text": "unknown"
25929
+ }
25930
+ }
25931
+ ],
25932
+ "description": "Forwarded: the interaction belongs to the driver that opened it. An inner driver that cannot\nrun actions answers as if the interaction had ended.",
25933
+ "inheritedFrom": {
25934
+ "name": "BaseDriverDecorator",
25935
+ "module": "src/components/ai-driver/base-driver-decorator.ts"
25936
+ }
25937
+ },
24307
25938
  {
24308
25939
  "kind": "method",
24309
25940
  "name": "presentInteraction",
@@ -25597,6 +27228,66 @@
25597
27228
  }
25598
27229
  ]
25599
27230
  },
27231
+ {
27232
+ "kind": "javascript-module",
27233
+ "path": "src/state/persistence/debug-log-assembly.ts",
27234
+ "declarations": [
27235
+ {
27236
+ "kind": "function",
27237
+ "name": "buildDiagnosticEntries",
27238
+ "return": {
27239
+ "type": {
27240
+ "text": "DiagnosticEntry[]"
27241
+ }
27242
+ },
27243
+ "parameters": [
27244
+ {
27245
+ "name": "input",
27246
+ "type": {
27247
+ "text": "{\n driver: AiDriver | undefined;\n /** The debug-log key the meta events are kept under; none, no events. */\n stateKey: string | undefined;\n /** The `meta-snapshot` entry for right now (see `buildMetaSnapshot`). */\n metaSnapshot: () => DiagnosticEntry;\n /** The transcript to use when the driver has no raw history: the host's own copy. */\n messages?: readonly ChatMessage[];\n}"
27248
+ }
27249
+ }
27250
+ ],
27251
+ "description": "The current page's diagnostic entries (GENC-1351 §5.8): the debug-log timeline entries\n(`message`/`turn`/`event`), the driver's external diagnostics, and one `meta-snapshot` carrying\nthe export-time `meta` block. The assistant element reassembles these into the live log, and the\npersister's forward-capture path diffs them against what has already been appended to the stored\nstream. Extracted from the element so a host with no element (the headless session) derives its\nlog from the same code, not a second copy that could drift.\n\nDOM-free and framework-free."
27252
+ },
27253
+ {
27254
+ "kind": "function",
27255
+ "name": "lifetimeDebugLog",
27256
+ "return": {
27257
+ "type": {
27258
+ "text": "Promise<DebugLog>"
27259
+ }
27260
+ },
27261
+ "parameters": [
27262
+ {
27263
+ "name": "input",
27264
+ "type": {
27265
+ "text": "{\n provider: SessionPersistenceProvider | undefined;\n stateKey: string | undefined;\n /** Land the current page's unflushed diagnostics delta, so the log includes it. */\n flush: () => Promise<void> | void;\n /** The `meta-snapshot` entry for right now. */\n metaSnapshot: () => DiagnosticEntry;\n /** The current-page log, for when there is no stored stream to stitch. */\n fallback: () => DebugLog;\n}"
27266
+ }
27267
+ }
27268
+ ],
27269
+ "description": "The debug log for the WHOLE session (GENC-1351 §5.8 / §5.10), not just this page's activity:\nthe persisted diagnostics stream with its stored `meta-snapshot`s replaced by a fresh one\n(`withFreshMetaSnapshot`), so its context and cost figures are current. When the provider\nstores no diagnostics, there is no key, the stream is empty or loading it fails, it is\n`fallback()` — the current-page log. Never throws.\n\nThe one derivation of the lifetime log: the assistant element's `getLifetimeDebugLog` and the\nheadless session both call it, because a second one drifts, and for this log that means silently\nunderstating spend."
27270
+ }
27271
+ ],
27272
+ "exports": [
27273
+ {
27274
+ "kind": "js",
27275
+ "name": "buildDiagnosticEntries",
27276
+ "declaration": {
27277
+ "name": "buildDiagnosticEntries",
27278
+ "module": "src/state/persistence/debug-log-assembly.ts"
27279
+ }
27280
+ },
27281
+ {
27282
+ "kind": "js",
27283
+ "name": "lifetimeDebugLog",
27284
+ "declaration": {
27285
+ "name": "lifetimeDebugLog",
27286
+ "module": "src/state/persistence/debug-log-assembly.ts"
27287
+ }
27288
+ }
27289
+ ]
27290
+ },
25600
27291
  {
25601
27292
  "kind": "javascript-module",
25602
27293
  "path": "src/state/persistence/diagnostics-cursors.ts",
@@ -25813,6 +27504,22 @@
25813
27504
  "name": "DebugLog",
25814
27505
  "module": "./diagnostics"
25815
27506
  }
27507
+ },
27508
+ {
27509
+ "kind": "js",
27510
+ "name": "buildDiagnosticEntries",
27511
+ "declaration": {
27512
+ "name": "buildDiagnosticEntries",
27513
+ "module": "./debug-log-assembly"
27514
+ }
27515
+ },
27516
+ {
27517
+ "kind": "js",
27518
+ "name": "lifetimeDebugLog",
27519
+ "declaration": {
27520
+ "name": "lifetimeDebugLog",
27521
+ "module": "./debug-log-assembly"
27522
+ }
25816
27523
  }
25817
27524
  ]
25818
27525
  },