@genesislcap/ai-assistant 15.85.0 → 15.86.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1410,75 +1410,283 @@
1410
1410
  },
1411
1411
  {
1412
1412
  "kind": "javascript-module",
1413
- "path": "src/channel/ai-activity-bus.ts",
1413
+ "path": "src/autopilot/autopilot-driver.ts",
1414
1414
  "declarations": [
1415
1415
  {
1416
1416
  "kind": "variable",
1417
- "name": "NOOP_ACTIVITY_BUS",
1417
+ "name": "AUTOPILOT_CLAIMANT",
1418
1418
  "type": {
1419
- "text": "ActivityBus"
1419
+ "text": "string"
1420
1420
  },
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."
1421
+ "default": "'autopilot'",
1422
+ "description": "The holder id the autopilot claims interactions as."
1423
1423
  },
1424
1424
  {
1425
1425
  "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",
1426
+ "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`.",
1427
+ "name": "AutopilotDriver",
1428
1428
  "members": [
1429
1429
  {
1430
1430
  "kind": "field",
1431
- "name": "subscribers",
1431
+ "name": "agents",
1432
+ "type": {
1433
+ "text": "readonly AgentConfig[]"
1434
+ },
1432
1435
  "privacy": "private",
1433
- "readonly": true,
1434
- "default": "new Map<string, Set<AnyHandler>>()"
1436
+ "readonly": true
1435
1437
  },
1436
1438
  {
1437
1439
  "kind": "field",
1438
- "name": "crossTabEvents",
1440
+ "name": "providerRegistry",
1439
1441
  "type": {
1440
- "text": "Set<string>"
1442
+ "text": "AIProviderRegistry"
1441
1443
  },
1442
1444
  "privacy": "private",
1443
- "readonly": true,
1444
- "default": "new Set(config?.crossTabEvents ?? [])"
1445
+ "readonly": true
1445
1446
  },
1446
1447
  {
1447
1448
  "kind": "field",
1448
- "name": "channelNameFactory",
1449
+ "name": "sessionKey",
1449
1450
  "type": {
1450
- "text": "() => string | undefined"
1451
+ "text": "string"
1451
1452
  },
1452
1453
  "privacy": "private",
1453
1454
  "readonly": true
1454
1455
  },
1455
1456
  {
1456
1457
  "kind": "field",
1457
- "name": "channel",
1458
+ "name": "activityBus",
1458
1459
  "type": {
1459
- "text": "BroadcastChannel | undefined"
1460
+ "text": "ActivityBus"
1461
+ },
1462
+ "privacy": "private",
1463
+ "readonly": true
1464
+ },
1465
+ {
1466
+ "kind": "field",
1467
+ "name": "listeners",
1468
+ "privacy": "private",
1469
+ "readonly": true,
1470
+ "default": "new Set<() => void>()"
1471
+ },
1472
+ {
1473
+ "kind": "field",
1474
+ "name": "sessions",
1475
+ "privacy": "private",
1476
+ "readonly": true,
1477
+ "default": "new Map<string, AutopilotSession>()"
1478
+ },
1479
+ {
1480
+ "kind": "field",
1481
+ "name": "onFor",
1482
+ "type": {
1483
+ "text": "string | null"
1484
+ },
1485
+ "privacy": "private",
1486
+ "default": "null",
1487
+ "description": "The flow the mode applies to: set when it is first switched, cleared when that flow ends."
1488
+ },
1489
+ {
1490
+ "kind": "field",
1491
+ "name": "mode",
1492
+ "type": {
1493
+ "text": "'paused' | 'running'"
1494
+ },
1495
+ "privacy": "private",
1496
+ "default": "'paused'"
1497
+ },
1498
+ {
1499
+ "kind": "field",
1500
+ "name": "pauseState",
1501
+ "type": {
1502
+ "text": "AutopilotHostState['pause'] | undefined"
1460
1503
  },
1461
1504
  "privacy": "private"
1462
1505
  },
1463
1506
  {
1464
1507
  "kind": "field",
1465
- "name": "channelInitialised",
1508
+ "name": "held",
1509
+ "type": {
1510
+ "text": "Held | undefined"
1511
+ },
1512
+ "privacy": "private"
1513
+ },
1514
+ {
1515
+ "kind": "field",
1516
+ "name": "open",
1517
+ "type": {
1518
+ "text": "InteractionOpened | undefined"
1519
+ },
1520
+ "privacy": "private",
1521
+ "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`)."
1522
+ },
1523
+ {
1524
+ "kind": "field",
1525
+ "name": "declinedWhilePaused",
1526
+ "type": {
1527
+ "text": "InteractionOpened | undefined"
1528
+ },
1529
+ "privacy": "private",
1530
+ "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."
1531
+ },
1532
+ {
1533
+ "kind": "field",
1534
+ "name": "refinements",
1535
+ "type": {
1536
+ "text": "{ key: string; count: number } | undefined"
1537
+ },
1538
+ "privacy": "private",
1539
+ "description": "Refining actions taken on the current step (written answers among them), for the limit."
1540
+ },
1541
+ {
1542
+ "kind": "field",
1543
+ "name": "watchdog",
1544
+ "type": {
1545
+ "text": "ReturnType<typeof setTimeout> | undefined"
1546
+ },
1547
+ "privacy": "private",
1548
+ "description": "The watchdog's next check, while a claimed interaction is pending."
1549
+ },
1550
+ {
1551
+ "kind": "field",
1552
+ "name": "endedDiagnostics",
1553
+ "type": {
1554
+ "text": "DiagnosticEntry[]"
1555
+ },
1556
+ "privacy": "private",
1557
+ "readonly": true,
1558
+ "default": "[]",
1559
+ "description": "What sessions that have ended did, kept for the debug log."
1560
+ },
1561
+ {
1562
+ "kind": "field",
1563
+ "name": "consecutiveReplies",
1564
+ "type": {
1565
+ "text": "number"
1566
+ },
1567
+ "privacy": "private",
1568
+ "default": "0",
1569
+ "description": "Written answers sent in a row; see `MAX_CONSECUTIVE_REPLIES`."
1570
+ },
1571
+ {
1572
+ "kind": "field",
1573
+ "name": "turnHandBack",
1574
+ "type": {
1575
+ "text": "{ why: string } | undefined"
1576
+ },
1577
+ "privacy": "private",
1578
+ "description": "Set while the turn-level hand-back waits on the person."
1579
+ },
1580
+ {
1581
+ "kind": "field",
1582
+ "name": "restored",
1583
+ "type": {
1584
+ "text": "PersistedAutopilotMode | undefined"
1585
+ },
1586
+ "privacy": "private",
1587
+ "description": "A mode restored with the session, waiting for its flow to become the owner again."
1588
+ },
1589
+ {
1590
+ "kind": "field",
1591
+ "name": "handingBack",
1592
+ "type": {
1593
+ "text": "Carried | undefined"
1594
+ },
1595
+ "privacy": "private",
1596
+ "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`."
1597
+ },
1598
+ {
1599
+ "kind": "field",
1600
+ "name": "switchedFrom",
1601
+ "type": {
1602
+ "text": "Carried | undefined"
1603
+ },
1604
+ "privacy": "private",
1605
+ "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)."
1606
+ },
1607
+ {
1608
+ "kind": "field",
1609
+ "name": "generation",
1610
+ "type": {
1611
+ "text": "number"
1612
+ },
1613
+ "privacy": "private",
1614
+ "default": "0",
1615
+ "description": "Bumped on every pause and resume, and when its sessions end. A written answer is sent only if\nnone came between asking for it and its landing: one started before a pause is stale after it,\neven once resumed."
1616
+ },
1617
+ {
1618
+ "kind": "field",
1619
+ "name": "turnsInFlight",
1620
+ "type": {
1621
+ "text": "number"
1622
+ },
1623
+ "privacy": "private",
1624
+ "default": "0",
1625
+ "description": "Working turns this driver has started that have not ended yet; see `working`."
1626
+ },
1627
+ {
1628
+ "kind": "field",
1629
+ "name": "answersInFlight",
1630
+ "type": {
1631
+ "text": "number"
1632
+ },
1633
+ "privacy": "private",
1634
+ "default": "0",
1635
+ "description": "Written questions being answered right now; see `working`."
1636
+ },
1637
+ {
1638
+ "kind": "field",
1639
+ "name": "ranSinceStop",
1466
1640
  "type": {
1467
1641
  "text": "boolean"
1468
1642
  },
1469
1643
  "privacy": "private",
1470
- "default": "false"
1644
+ "default": "false",
1645
+ "description": "Whether the autopilot has been running, and working, since it last stopped or was paused: so\ngoing idle now is a stop to report. Outlives its flow ending, so a turn still running then is\nwaited out. See `watchForStop`."
1646
+ },
1647
+ {
1648
+ "kind": "field",
1649
+ "name": "stopCheck",
1650
+ "type": {
1651
+ "text": "ReturnType<typeof setTimeout> | undefined"
1652
+ },
1653
+ "privacy": "private",
1654
+ "description": "The check that confirms the autopilot stopped, once it looked like it had."
1655
+ },
1656
+ {
1657
+ "kind": "field",
1658
+ "name": "handBackWaits",
1659
+ "privacy": "private",
1660
+ "readonly": true,
1661
+ "default": "new Set<() => void>()",
1662
+ "description": "Stops each wait for a widget left with the person to ask them; see `reportHandBackWhenAsking`."
1663
+ },
1664
+ {
1665
+ "kind": "field",
1666
+ "name": "state",
1667
+ "type": {
1668
+ "text": "AutopilotHostState"
1669
+ },
1670
+ "readonly": true
1471
1671
  },
1472
1672
  {
1473
1673
  "kind": "method",
1474
- "name": "ensureChannel",
1674
+ "name": "waitingOnUser",
1475
1675
  "privacy": "private",
1476
1676
  "return": {
1477
1677
  "type": {
1478
- "text": "void"
1678
+ "text": "boolean"
1479
1679
  }
1480
1680
  },
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."
1681
+ "description": "Whether the working agent is parked on a question the person holds, with the autopilot deciding\nnothing: one it never took — its policy keeps it for the person, it is `userOnly` (the turn-level\nhand-back among them), it has no controller, or it opened while paused and no Resume has taken\nit since (a restored mode takes nothing) — or one another interceptor took and then gave to the\nperson. One the autopilot handed back reads `selfPaused`, and one a pause handed over reads\n`paused`; `state` settles both before asking this.\n\nNever one that asks them nothing (see `asksThePerson`): the person holds it, but it is work\nrunning, which settles by itself, so \"waiting for your answer\" would be untrue. A hand-back is\nreported by the same rule (see `reportHandBackWhenAsking`)."
1682
+ },
1683
+ {
1684
+ "kind": "field",
1685
+ "name": "copy",
1686
+ "type": {
1687
+ "text": "AutopilotCopy"
1688
+ },
1689
+ "readonly": true
1482
1690
  },
1483
1691
  {
1484
1692
  "kind": "method",
@@ -1490,23 +1698,72 @@
1490
1698
  },
1491
1699
  "parameters": [
1492
1700
  {
1493
- "name": "type",
1701
+ "name": "listener",
1494
1702
  "type": {
1495
- "text": "K"
1703
+ "text": "() => void"
1496
1704
  }
1497
- },
1498
- {
1499
- "name": "handler",
1500
- "type": {
1501
- "text": "(detail: AgenticActivityEvents[K]) => void"
1705
+ }
1706
+ ]
1707
+ },
1708
+ {
1709
+ "kind": "method",
1710
+ "name": "pause",
1711
+ "return": {
1712
+ "type": {
1713
+ "text": "void"
1714
+ }
1715
+ }
1716
+ },
1717
+ {
1718
+ "kind": "method",
1719
+ "name": "resume",
1720
+ "return": {
1721
+ "type": {
1722
+ "text": "void"
1723
+ }
1724
+ }
1725
+ },
1726
+ {
1727
+ "kind": "method",
1728
+ "name": "stop",
1729
+ "return": {
1730
+ "type": {
1731
+ "text": "void"
1732
+ }
1733
+ }
1734
+ },
1735
+ {
1736
+ "kind": "method",
1737
+ "name": "getPersistedMode",
1738
+ "return": {
1739
+ "type": {
1740
+ "text": "PersistedAutopilotMode | undefined"
1741
+ }
1742
+ },
1743
+ "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."
1744
+ },
1745
+ {
1746
+ "kind": "method",
1747
+ "name": "restorePersistedMode",
1748
+ "return": {
1749
+ "type": {
1750
+ "text": "void"
1751
+ }
1752
+ },
1753
+ "parameters": [
1754
+ {
1755
+ "name": "saved",
1756
+ "type": {
1757
+ "text": "PersistedAutopilotMode | undefined"
1502
1758
  }
1503
1759
  }
1504
1760
  ],
1505
- "description": "Subscribe to an event. Returns an unsubscribe function — call it in\n`disconnectedCallback` to avoid memory leaks."
1761
+ "description": "Bring back a saved mode. It applies once its flow is the owner again — at once if it already\nis, otherwise when the restored flow re-activates. Restoring starts nothing: the autopilot acts\nonly on live events, such as the working agent's own resume asking a question (§4.10, S3)."
1506
1762
  },
1507
1763
  {
1508
1764
  "kind": "method",
1509
- "name": "publish",
1765
+ "name": "adoptRestored",
1766
+ "privacy": "private",
1510
1767
  "return": {
1511
1768
  "type": {
1512
1769
  "text": "void"
@@ -1514,51 +1771,182 @@
1514
1771
  },
1515
1772
  "parameters": [
1516
1773
  {
1517
- "name": "type",
1774
+ "name": "owner",
1518
1775
  "type": {
1519
- "text": "K"
1776
+ "text": "string"
1777
+ }
1778
+ }
1779
+ ]
1780
+ },
1781
+ {
1782
+ "kind": "method",
1783
+ "name": "keepPaused",
1784
+ "return": {
1785
+ "type": {
1786
+ "text": "void"
1787
+ }
1788
+ },
1789
+ "parameters": [
1790
+ {
1791
+ "name": "interactionId",
1792
+ "type": {
1793
+ "text": "string"
1794
+ }
1795
+ }
1796
+ ]
1797
+ },
1798
+ {
1799
+ "kind": "method",
1800
+ "name": "sendMessage",
1801
+ "return": {
1802
+ "type": {
1803
+ "text": "Promise<ChatDriverResult>"
1804
+ }
1805
+ },
1806
+ "parameters": [
1807
+ {
1808
+ "name": "input",
1809
+ "type": {
1810
+ "text": "string"
1520
1811
  }
1521
1812
  },
1522
1813
  {
1523
- "name": "detail",
1814
+ "name": "attachments",
1815
+ "optional": true,
1524
1816
  "type": {
1525
- "text": "AgenticActivityEvents[K]"
1817
+ "text": "ChatAttachment[]"
1818
+ }
1819
+ },
1820
+ {
1821
+ "name": "options",
1822
+ "optional": true,
1823
+ "type": {
1824
+ "text": "SendMessageOptions"
1526
1825
  }
1527
1826
  }
1528
1827
  ],
1529
- "description": "Publish an event to all local subscribers and, if configured, to other tabs\nvia BroadcastChannel."
1828
+ "inheritedFrom": {
1829
+ "name": "BaseDriverDecorator",
1830
+ "module": "src/components/ai-driver/base-driver-decorator.ts"
1831
+ }
1530
1832
  },
1531
1833
  {
1532
1834
  "kind": "method",
1533
- "name": "addCrossTabEvent",
1835
+ "name": "continueFromHistory",
1534
1836
  "return": {
1535
1837
  "type": {
1536
- "text": "void"
1838
+ "text": "Promise<ChatDriverResult>"
1537
1839
  }
1538
1840
  },
1539
1841
  "parameters": [
1540
1842
  {
1541
- "name": "type",
1843
+ "name": "transientPrimer",
1844
+ "optional": true,
1542
1845
  "type": {
1543
- "text": "keyof AgenticActivityEvents"
1846
+ "text": "ChatMessage[]"
1847
+ }
1848
+ },
1849
+ {
1850
+ "name": "options",
1851
+ "optional": true,
1852
+ "type": {
1853
+ "text": "ContinueFromHistoryOptions"
1544
1854
  }
1545
1855
  }
1546
1856
  ],
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."
1857
+ "inheritedFrom": {
1858
+ "name": "BaseDriverDecorator",
1859
+ "module": "src/components/ai-driver/base-driver-decorator.ts"
1860
+ }
1548
1861
  },
1549
1862
  {
1550
1863
  "kind": "method",
1551
- "name": "close",
1864
+ "name": "resumeRestoredFlow",
1865
+ "return": {
1866
+ "type": {
1867
+ "text": "Promise<ChatDriverResult | undefined>"
1868
+ }
1869
+ },
1870
+ "parameters": [
1871
+ {
1872
+ "name": "resumeNote",
1873
+ "optional": true,
1874
+ "type": {
1875
+ "text": "string"
1876
+ }
1877
+ },
1878
+ {
1879
+ "name": "agent",
1880
+ "optional": true,
1881
+ "type": {
1882
+ "text": "AgentConfig"
1883
+ }
1884
+ }
1885
+ ],
1886
+ "inheritedFrom": {
1887
+ "name": "BaseDriverDecorator",
1888
+ "module": "src/components/ai-driver/base-driver-decorator.ts"
1889
+ }
1890
+ },
1891
+ {
1892
+ "kind": "method",
1893
+ "name": "whileWorking",
1894
+ "privacy": "private",
1895
+ "return": {
1896
+ "type": {
1897
+ "text": "Promise<T>"
1898
+ }
1899
+ },
1900
+ "parameters": [
1901
+ {
1902
+ "name": "run",
1903
+ "type": {
1904
+ "text": "() => Promise<T>"
1905
+ }
1906
+ }
1907
+ ],
1908
+ "description": "Run a working turn, counted for `working` from the moment it is asked for: the wrapped driver\nmay not say it is busy until some way in. The caller notifies once it has acted on the end."
1909
+ },
1910
+ {
1911
+ "kind": "method",
1912
+ "name": "afterTurn",
1913
+ "privacy": "private",
1552
1914
  "return": {
1553
1915
  "type": {
1554
1916
  "text": "void"
1555
1917
  }
1556
1918
  },
1557
- "description": "Close the underlying BroadcastChannel. Call once on application teardown if needed."
1919
+ "parameters": [
1920
+ {
1921
+ "name": "result",
1922
+ "type": {
1923
+ "text": "ChatDriverResult"
1924
+ }
1925
+ }
1926
+ ],
1927
+ "description": "Act on how a working turn ended, without holding up whoever awaited it, then notify: idle\nunless that started something (an answer, a hand-back), which it does before this returns."
1558
1928
  },
1559
1929
  {
1560
1930
  "kind": "method",
1561
- "name": "notifyLocal",
1931
+ "name": "onTurnEnded",
1932
+ "privacy": "private",
1933
+ "return": {
1934
+ "type": {
1935
+ "text": "Promise<void>"
1936
+ }
1937
+ },
1938
+ "parameters": [
1939
+ {
1940
+ "name": "result",
1941
+ "type": {
1942
+ "text": "ChatDriverResult"
1943
+ }
1944
+ }
1945
+ ]
1946
+ },
1947
+ {
1948
+ "kind": "method",
1949
+ "name": "answerInBackground",
1562
1950
  "privacy": "private",
1563
1951
  "return": {
1564
1952
  "type": {
@@ -1567,666 +1955,15 @@
1567
1955
  },
1568
1956
  "parameters": [
1569
1957
  {
1570
- "name": "type",
1958
+ "name": "owner",
1571
1959
  "type": {
1572
1960
  "text": "string"
1573
1961
  }
1574
1962
  },
1575
1963
  {
1576
- "name": "detail",
1964
+ "name": "question",
1577
1965
  "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[]"
1836
- },
1837
- "privacy": "private",
1838
- "readonly": true,
1839
- "default": "[]",
1840
- "description": "What sessions that have ended did, kept for the debug log."
1841
- },
1842
- {
1843
- "kind": "field",
1844
- "name": "consecutiveReplies",
1845
- "type": {
1846
- "text": "number"
1847
- },
1848
- "privacy": "private",
1849
- "default": "0",
1850
- "description": "Written answers sent in a row; see `MAX_CONSECUTIVE_REPLIES`."
1851
- },
1852
- {
1853
- "kind": "field",
1854
- "name": "turnHandBack",
1855
- "type": {
1856
- "text": "{ why: string } | undefined"
1857
- },
1858
- "privacy": "private",
1859
- "description": "Set while the turn-level hand-back waits on the person."
1860
- },
1861
- {
1862
- "kind": "field",
1863
- "name": "restored",
1864
- "type": {
1865
- "text": "PersistedAutopilotMode | undefined"
1866
- },
1867
- "privacy": "private",
1868
- "description": "A mode restored with the session, waiting for its flow to become the owner again."
1869
- },
1870
- {
1871
- "kind": "field",
1872
- "name": "generation",
1873
- "type": {
1874
- "text": "number"
1875
- },
1876
- "privacy": "private",
1877
- "default": "0",
1878
- "description": "Bumped on every pause and resume, and when its sessions end. A written answer is sent only if\nnone came between asking for it and its landing: one started before a pause is stale after it,\neven once resumed."
1879
- },
1880
- {
1881
- "kind": "field",
1882
- "name": "turnsInFlight",
1883
- "type": {
1884
- "text": "number"
1885
- },
1886
- "privacy": "private",
1887
- "default": "0",
1888
- "description": "Working turns this driver has started that have not ended yet; see `working`."
1889
- },
1890
- {
1891
- "kind": "field",
1892
- "name": "answersInFlight",
1893
- "type": {
1894
- "text": "number"
1895
- },
1896
- "privacy": "private",
1897
- "default": "0",
1898
- "description": "Written questions being answered right now; see `working`."
1899
- },
1900
- {
1901
- "kind": "field",
1902
- "name": "ranSinceStop",
1903
- "type": {
1904
- "text": "boolean"
1905
- },
1906
- "privacy": "private",
1907
- "default": "false",
1908
- "description": "Whether the autopilot has been running, and working, since it last stopped or was paused: so\ngoing idle now is a stop to report. Outlives its flow ending, so a turn still running then is\nwaited out. See `watchForStop`."
1909
- },
1910
- {
1911
- "kind": "field",
1912
- "name": "stopCheck",
1913
- "type": {
1914
- "text": "ReturnType<typeof setTimeout> | undefined"
1915
- },
1916
- "privacy": "private",
1917
- "description": "The check that confirms the autopilot stopped, once it looked like it had."
1918
- },
1919
- {
1920
- "kind": "field",
1921
- "name": "handBackWaits",
1922
- "privacy": "private",
1923
- "readonly": true,
1924
- "default": "new Set<() => void>()",
1925
- "description": "Stops each wait for a widget left with the person to ask them; see `reportHandBackWhenAsking`."
1926
- },
1927
- {
1928
- "kind": "field",
1929
- "name": "state",
1930
- "type": {
1931
- "text": "AutopilotHostState"
1932
- },
1933
- "readonly": true
1934
- },
1935
- {
1936
- "kind": "method",
1937
- "name": "waitingOnUser",
1938
- "privacy": "private",
1939
- "return": {
1940
- "type": {
1941
- "text": "boolean"
1942
- }
1943
- },
1944
- "description": "Whether the working agent is parked on a question the person holds, with the autopilot deciding\nnothing: one it never took — its policy keeps it for the person, it is `userOnly` (the turn-level\nhand-back among them), it has no controller, or it opened while paused and no Resume has taken\nit since (a restored mode takes nothing) — or one another interceptor took and then gave to the\nperson. One the autopilot handed back reads `selfPaused`, and one a pause handed over reads\n`paused`; `state` settles both before asking this.\n\nNever one that asks them nothing (see `asksThePerson`): the person holds it, but it is work\nrunning, which settles by itself, so \"waiting for your answer\" would be untrue. A hand-back is\nreported by the same rule (see `reportHandBackWhenAsking`)."
1945
- },
1946
- {
1947
- "kind": "field",
1948
- "name": "copy",
1949
- "type": {
1950
- "text": "AutopilotCopy"
1951
- },
1952
- "readonly": true
1953
- },
1954
- {
1955
- "kind": "method",
1956
- "name": "subscribe",
1957
- "return": {
1958
- "type": {
1959
- "text": "() => void"
1960
- }
1961
- },
1962
- "parameters": [
1963
- {
1964
- "name": "listener",
1965
- "type": {
1966
- "text": "() => void"
1967
- }
1968
- }
1969
- ]
1970
- },
1971
- {
1972
- "kind": "method",
1973
- "name": "pause",
1974
- "return": {
1975
- "type": {
1976
- "text": "void"
1977
- }
1978
- }
1979
- },
1980
- {
1981
- "kind": "method",
1982
- "name": "resume",
1983
- "return": {
1984
- "type": {
1985
- "text": "void"
1986
- }
1987
- }
1988
- },
1989
- {
1990
- "kind": "method",
1991
- "name": "stop",
1992
- "return": {
1993
- "type": {
1994
- "text": "void"
1995
- }
1996
- }
1997
- },
1998
- {
1999
- "kind": "method",
2000
- "name": "getPersistedMode",
2001
- "return": {
2002
- "type": {
2003
- "text": "PersistedAutopilotMode | undefined"
2004
- }
2005
- },
2006
- "description": "The mode to save with the session, while it is set for the current flow."
2007
- },
2008
- {
2009
- "kind": "method",
2010
- "name": "restorePersistedMode",
2011
- "return": {
2012
- "type": {
2013
- "text": "void"
2014
- }
2015
- },
2016
- "parameters": [
2017
- {
2018
- "name": "saved",
2019
- "type": {
2020
- "text": "PersistedAutopilotMode | undefined"
2021
- }
2022
- }
2023
- ],
2024
- "description": "Bring back a saved mode. It applies once its flow is the owner again — at once if it already\nis, otherwise when the restored flow re-activates. Restoring starts nothing: the autopilot acts\nonly on live events, such as the working agent's own resume asking a question (§4.10, S3)."
2025
- },
2026
- {
2027
- "kind": "method",
2028
- "name": "adoptRestored",
2029
- "privacy": "private",
2030
- "return": {
2031
- "type": {
2032
- "text": "void"
2033
- }
2034
- },
2035
- "parameters": [
2036
- {
2037
- "name": "owner",
2038
- "type": {
2039
- "text": "string"
2040
- }
2041
- }
2042
- ]
2043
- },
2044
- {
2045
- "kind": "method",
2046
- "name": "keepPaused",
2047
- "return": {
2048
- "type": {
2049
- "text": "void"
2050
- }
2051
- },
2052
- "parameters": [
2053
- {
2054
- "name": "interactionId",
2055
- "type": {
2056
- "text": "string"
2057
- }
2058
- }
2059
- ]
2060
- },
2061
- {
2062
- "kind": "method",
2063
- "name": "sendMessage",
2064
- "return": {
2065
- "type": {
2066
- "text": "Promise<ChatDriverResult>"
2067
- }
2068
- },
2069
- "parameters": [
2070
- {
2071
- "name": "input",
2072
- "type": {
2073
- "text": "string"
2074
- }
2075
- },
2076
- {
2077
- "name": "attachments",
2078
- "optional": true,
2079
- "type": {
2080
- "text": "ChatAttachment[]"
2081
- }
2082
- },
2083
- {
2084
- "name": "options",
2085
- "optional": true,
2086
- "type": {
2087
- "text": "SendMessageOptions"
2088
- }
2089
- }
2090
- ],
2091
- "inheritedFrom": {
2092
- "name": "BaseDriverDecorator",
2093
- "module": "src/components/ai-driver/base-driver-decorator.ts"
2094
- }
2095
- },
2096
- {
2097
- "kind": "method",
2098
- "name": "continueFromHistory",
2099
- "return": {
2100
- "type": {
2101
- "text": "Promise<ChatDriverResult>"
2102
- }
2103
- },
2104
- "parameters": [
2105
- {
2106
- "name": "transientPrimer",
2107
- "optional": true,
2108
- "type": {
2109
- "text": "ChatMessage[]"
2110
- }
2111
- },
2112
- {
2113
- "name": "options",
2114
- "optional": true,
2115
- "type": {
2116
- "text": "ContinueFromHistoryOptions"
2117
- }
2118
- }
2119
- ],
2120
- "inheritedFrom": {
2121
- "name": "BaseDriverDecorator",
2122
- "module": "src/components/ai-driver/base-driver-decorator.ts"
2123
- }
2124
- },
2125
- {
2126
- "kind": "method",
2127
- "name": "resumeRestoredFlow",
2128
- "return": {
2129
- "type": {
2130
- "text": "Promise<ChatDriverResult | undefined>"
2131
- }
2132
- },
2133
- "parameters": [
2134
- {
2135
- "name": "resumeNote",
2136
- "optional": true,
2137
- "type": {
2138
- "text": "string"
2139
- }
2140
- },
2141
- {
2142
- "name": "agent",
2143
- "optional": true,
2144
- "type": {
2145
- "text": "AgentConfig"
2146
- }
2147
- }
2148
- ],
2149
- "inheritedFrom": {
2150
- "name": "BaseDriverDecorator",
2151
- "module": "src/components/ai-driver/base-driver-decorator.ts"
2152
- }
2153
- },
2154
- {
2155
- "kind": "method",
2156
- "name": "whileWorking",
2157
- "privacy": "private",
2158
- "return": {
2159
- "type": {
2160
- "text": "Promise<T>"
2161
- }
2162
- },
2163
- "parameters": [
2164
- {
2165
- "name": "run",
2166
- "type": {
2167
- "text": "() => Promise<T>"
2168
- }
2169
- }
2170
- ],
2171
- "description": "Run a working turn, counted for `working` from the moment it is asked for: the wrapped driver\nmay not say it is busy until some way in. The caller notifies once it has acted on the end."
2172
- },
2173
- {
2174
- "kind": "method",
2175
- "name": "afterTurn",
2176
- "privacy": "private",
2177
- "return": {
2178
- "type": {
2179
- "text": "void"
2180
- }
2181
- },
2182
- "parameters": [
2183
- {
2184
- "name": "result",
2185
- "type": {
2186
- "text": "ChatDriverResult"
2187
- }
2188
- }
2189
- ],
2190
- "description": "Act on how a working turn ended, without holding up whoever awaited it, then notify: idle\nunless that started something (an answer, a hand-back), which it does before this returns."
2191
- },
2192
- {
2193
- "kind": "method",
2194
- "name": "onTurnEnded",
2195
- "privacy": "private",
2196
- "return": {
2197
- "type": {
2198
- "text": "Promise<void>"
2199
- }
2200
- },
2201
- "parameters": [
2202
- {
2203
- "name": "result",
2204
- "type": {
2205
- "text": "ChatDriverResult"
2206
- }
2207
- }
2208
- ]
2209
- },
2210
- {
2211
- "kind": "method",
2212
- "name": "answerInBackground",
2213
- "privacy": "private",
2214
- "return": {
2215
- "type": {
2216
- "text": "void"
2217
- }
2218
- },
2219
- "parameters": [
2220
- {
2221
- "name": "owner",
2222
- "type": {
2223
- "text": "string"
2224
- }
2225
- },
2226
- {
2227
- "name": "question",
2228
- "type": {
2229
- "text": "string"
1966
+ "text": "string"
2230
1967
  }
2231
1968
  }
2232
1969
  ],
@@ -2794,6 +2531,105 @@
2794
2531
  }
2795
2532
  ]
2796
2533
  },
2534
+ {
2535
+ "kind": "method",
2536
+ "name": "onHandOffStarted",
2537
+ "privacy": "private",
2538
+ "return": {
2539
+ "type": {
2540
+ "text": "void"
2541
+ }
2542
+ },
2543
+ "parameters": [
2544
+ {
2545
+ "name": "frame",
2546
+ "type": {
2547
+ "text": "HandOffFrame"
2548
+ }
2549
+ }
2550
+ ],
2551
+ "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)."
2552
+ },
2553
+ {
2554
+ "kind": "method",
2555
+ "name": "current",
2556
+ "privacy": "private",
2557
+ "return": {
2558
+ "type": {
2559
+ "text": "Carried | undefined"
2560
+ }
2561
+ },
2562
+ "description": "The mode set for the current flow, or kept for the caller of a hand-back under way."
2563
+ },
2564
+ {
2565
+ "kind": "method",
2566
+ "name": "carriedTo",
2567
+ "privacy": "private",
2568
+ "return": {
2569
+ "type": {
2570
+ "text": "Carried | undefined"
2571
+ }
2572
+ },
2573
+ "parameters": [
2574
+ {
2575
+ "name": "owner",
2576
+ "type": {
2577
+ "text": "string | null"
2578
+ }
2579
+ }
2580
+ ],
2581
+ "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."
2582
+ },
2583
+ {
2584
+ "kind": "method",
2585
+ "name": "handsBack",
2586
+ "privacy": "private",
2587
+ "return": {
2588
+ "type": {
2589
+ "text": "boolean"
2590
+ }
2591
+ },
2592
+ "parameters": [
2593
+ {
2594
+ "name": "target",
2595
+ "type": {
2596
+ "text": "string"
2597
+ }
2598
+ },
2599
+ {
2600
+ "name": "owner",
2601
+ "type": {
2602
+ "text": "string"
2603
+ }
2604
+ }
2605
+ ],
2606
+ "description": "Whether `owner` is the caller the top hand-off hands back to from `target`."
2607
+ },
2608
+ {
2609
+ "kind": "method",
2610
+ "name": "carry",
2611
+ "privacy": "private",
2612
+ "return": {
2613
+ "type": {
2614
+ "text": "void"
2615
+ }
2616
+ },
2617
+ "parameters": [
2618
+ {
2619
+ "name": "carried",
2620
+ "type": {
2621
+ "text": "Carried"
2622
+ }
2623
+ },
2624
+ {
2625
+ "name": "owner",
2626
+ "type": {
2627
+ "text": "string"
2628
+ }
2629
+ }
2630
+ ],
2631
+ "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."
2632
+ },
2797
2633
  {
2798
2634
  "kind": "method",
2799
2635
  "name": "capabilityFor",
@@ -4857,87 +4693,368 @@
4857
4693
  "name": "widgetTools",
4858
4694
  "declaration": {
4859
4695
  "name": "widgetTools",
4860
- "module": "./widget-tools"
4696
+ "module": "./widget-tools"
4697
+ }
4698
+ },
4699
+ {
4700
+ "kind": "js",
4701
+ "name": "type",
4702
+ "declaration": {
4703
+ "name": "type",
4704
+ "module": "./widget-tools"
4705
+ }
4706
+ },
4707
+ {
4708
+ "kind": "js",
4709
+ "name": "WidgetTools",
4710
+ "declaration": {
4711
+ "name": "WidgetTools",
4712
+ "module": "./widget-tools"
4713
+ }
4714
+ },
4715
+ {
4716
+ "kind": "js",
4717
+ "name": "type",
4718
+ "declaration": {
4719
+ "name": "type",
4720
+ "module": "./widget-tools"
4721
+ }
4722
+ },
4723
+ {
4724
+ "kind": "js",
4725
+ "name": "WidgetToolSpec",
4726
+ "declaration": {
4727
+ "name": "WidgetToolSpec",
4728
+ "module": "./widget-tools"
4729
+ }
4730
+ },
4731
+ {
4732
+ "kind": "js",
4733
+ "name": "AutopilotHandBack",
4734
+ "declaration": {
4735
+ "name": "AutopilotHandBack",
4736
+ "module": "./hand-back/hand-back"
4737
+ }
4738
+ }
4739
+ ]
4740
+ },
4741
+ {
4742
+ "kind": "javascript-module",
4743
+ "path": "src/autopilot/widget-tools.ts",
4744
+ "declarations": [
4745
+ {
4746
+ "kind": "function",
4747
+ "name": "widgetTools",
4748
+ "return": {
4749
+ "type": {
4750
+ "text": "WidgetTools"
4751
+ }
4752
+ },
4753
+ "parameters": [
4754
+ {
4755
+ "name": "componentName",
4756
+ "type": {
4757
+ "text": "string"
4758
+ }
4759
+ },
4760
+ {
4761
+ "name": "tools",
4762
+ "type": {
4763
+ "text": "{ [K in keyof TArgs]: WidgetToolSpec<TController, TArgs[K]> }"
4764
+ }
4765
+ }
4766
+ ],
4767
+ "description": "Declare tools that read from one widget type (GENC-1660): parameterised reads that a view cannot\nexpress, such as one table's rows, or a page of them.\n\nPut them on the autopilot (`defineAutopilot({ widgetTools: [...] })`), never discovered from the\nregistration. Its tool list is fixed when its session starts, sorted by name, and identical for\nevery decision, so the cache never breaks. Each call is routed to the interaction of\n`componentName` the autopilot is deciding, and `run` gets its controller; with none open, it is\nrefused with a reason. While one is open, the autopilot's tail says which tools are usable now.\n\nReads only. Their results leave the autopilot's history at the end of the decision, as\n`widget_read`'s do."
4768
+ }
4769
+ ],
4770
+ "exports": [
4771
+ {
4772
+ "kind": "js",
4773
+ "name": "widgetTools",
4774
+ "declaration": {
4775
+ "name": "widgetTools",
4776
+ "module": "src/autopilot/widget-tools.ts"
4861
4777
  }
4862
- },
4778
+ }
4779
+ ]
4780
+ },
4781
+ {
4782
+ "kind": "javascript-module",
4783
+ "path": "src/channel/ai-activity-bus.ts",
4784
+ "declarations": [
4863
4785
  {
4864
- "kind": "js",
4865
- "name": "type",
4866
- "declaration": {
4867
- "name": "type",
4868
- "module": "./widget-tools"
4869
- }
4786
+ "kind": "variable",
4787
+ "name": "NOOP_ACTIVITY_BUS",
4788
+ "type": {
4789
+ "text": "ActivityBus"
4790
+ },
4791
+ "default": "{ publish: () => {} }",
4792
+ "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."
4870
4793
  },
4871
4794
  {
4872
- "kind": "js",
4873
- "name": "WidgetTools",
4874
- "declaration": {
4875
- "name": "WidgetTools",
4876
- "module": "./widget-tools"
4877
- }
4795
+ "kind": "class",
4796
+ "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.",
4797
+ "name": "AgenticActivityBus",
4798
+ "members": [
4799
+ {
4800
+ "kind": "field",
4801
+ "name": "subscribers",
4802
+ "privacy": "private",
4803
+ "readonly": true,
4804
+ "default": "new Map<string, Set<AnyHandler>>()"
4805
+ },
4806
+ {
4807
+ "kind": "field",
4808
+ "name": "crossTabEvents",
4809
+ "type": {
4810
+ "text": "Set<string>"
4811
+ },
4812
+ "privacy": "private",
4813
+ "readonly": true,
4814
+ "default": "new Set(config?.crossTabEvents ?? [])"
4815
+ },
4816
+ {
4817
+ "kind": "field",
4818
+ "name": "channelNameFactory",
4819
+ "type": {
4820
+ "text": "() => string | undefined"
4821
+ },
4822
+ "privacy": "private",
4823
+ "readonly": true
4824
+ },
4825
+ {
4826
+ "kind": "field",
4827
+ "name": "channel",
4828
+ "type": {
4829
+ "text": "BroadcastChannel | undefined"
4830
+ },
4831
+ "privacy": "private"
4832
+ },
4833
+ {
4834
+ "kind": "field",
4835
+ "name": "channelInitialised",
4836
+ "type": {
4837
+ "text": "boolean"
4838
+ },
4839
+ "privacy": "private",
4840
+ "default": "false"
4841
+ },
4842
+ {
4843
+ "kind": "method",
4844
+ "name": "ensureChannel",
4845
+ "privacy": "private",
4846
+ "return": {
4847
+ "type": {
4848
+ "text": "void"
4849
+ }
4850
+ },
4851
+ "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."
4852
+ },
4853
+ {
4854
+ "kind": "method",
4855
+ "name": "subscribe",
4856
+ "return": {
4857
+ "type": {
4858
+ "text": "() => void"
4859
+ }
4860
+ },
4861
+ "parameters": [
4862
+ {
4863
+ "name": "type",
4864
+ "type": {
4865
+ "text": "K"
4866
+ }
4867
+ },
4868
+ {
4869
+ "name": "handler",
4870
+ "type": {
4871
+ "text": "(detail: AgenticActivityEvents[K]) => void"
4872
+ }
4873
+ }
4874
+ ],
4875
+ "description": "Subscribe to an event. Returns an unsubscribe function — call it in\n`disconnectedCallback` to avoid memory leaks."
4876
+ },
4877
+ {
4878
+ "kind": "method",
4879
+ "name": "publish",
4880
+ "return": {
4881
+ "type": {
4882
+ "text": "void"
4883
+ }
4884
+ },
4885
+ "parameters": [
4886
+ {
4887
+ "name": "type",
4888
+ "type": {
4889
+ "text": "K"
4890
+ }
4891
+ },
4892
+ {
4893
+ "name": "detail",
4894
+ "type": {
4895
+ "text": "AgenticActivityEvents[K]"
4896
+ }
4897
+ }
4898
+ ],
4899
+ "description": "Publish an event to all local subscribers and, if configured, to other tabs\nvia BroadcastChannel."
4900
+ },
4901
+ {
4902
+ "kind": "method",
4903
+ "name": "addCrossTabEvent",
4904
+ "return": {
4905
+ "type": {
4906
+ "text": "void"
4907
+ }
4908
+ },
4909
+ "parameters": [
4910
+ {
4911
+ "name": "type",
4912
+ "type": {
4913
+ "text": "keyof AgenticActivityEvents"
4914
+ }
4915
+ }
4916
+ ],
4917
+ "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."
4918
+ },
4919
+ {
4920
+ "kind": "method",
4921
+ "name": "close",
4922
+ "return": {
4923
+ "type": {
4924
+ "text": "void"
4925
+ }
4926
+ },
4927
+ "description": "Close the underlying BroadcastChannel. Call once on application teardown if needed."
4928
+ },
4929
+ {
4930
+ "kind": "method",
4931
+ "name": "notifyLocal",
4932
+ "privacy": "private",
4933
+ "return": {
4934
+ "type": {
4935
+ "text": "void"
4936
+ }
4937
+ },
4938
+ "parameters": [
4939
+ {
4940
+ "name": "type",
4941
+ "type": {
4942
+ "text": "string"
4943
+ }
4944
+ },
4945
+ {
4946
+ "name": "detail",
4947
+ "type": {
4948
+ "text": "unknown"
4949
+ }
4950
+ }
4951
+ ]
4952
+ }
4953
+ ]
4878
4954
  },
4955
+ {
4956
+ "kind": "variable",
4957
+ "name": "agenticActivityBus",
4958
+ "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})",
4959
+ "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."
4960
+ }
4961
+ ],
4962
+ "exports": [
4879
4963
  {
4880
4964
  "kind": "js",
4881
- "name": "type",
4965
+ "name": "NOOP_ACTIVITY_BUS",
4882
4966
  "declaration": {
4883
- "name": "type",
4884
- "module": "./widget-tools"
4967
+ "name": "NOOP_ACTIVITY_BUS",
4968
+ "module": "src/channel/ai-activity-bus.ts"
4885
4969
  }
4886
4970
  },
4887
4971
  {
4888
4972
  "kind": "js",
4889
- "name": "WidgetToolSpec",
4973
+ "name": "AgenticActivityBus",
4890
4974
  "declaration": {
4891
- "name": "WidgetToolSpec",
4892
- "module": "./widget-tools"
4975
+ "name": "AgenticActivityBus",
4976
+ "module": "src/channel/ai-activity-bus.ts"
4893
4977
  }
4894
4978
  },
4895
4979
  {
4896
4980
  "kind": "js",
4897
- "name": "AutopilotHandBack",
4981
+ "name": "agenticActivityBus",
4898
4982
  "declaration": {
4899
- "name": "AutopilotHandBack",
4900
- "module": "./hand-back/hand-back"
4983
+ "name": "agenticActivityBus",
4984
+ "module": "src/channel/ai-activity-bus.ts"
4901
4985
  }
4902
4986
  }
4903
4987
  ]
4904
4988
  },
4905
4989
  {
4906
4990
  "kind": "javascript-module",
4907
- "path": "src/autopilot/widget-tools.ts",
4991
+ "path": "src/channel/ai-activity-channel.ts",
4992
+ "declarations": [],
4993
+ "exports": []
4994
+ },
4995
+ {
4996
+ "kind": "javascript-module",
4997
+ "path": "src/channel/autopilot-needs-user.ts",
4908
4998
  "declarations": [
4909
4999
  {
4910
5000
  "kind": "function",
4911
- "name": "widgetTools",
5001
+ "name": "setAutopilotNeedsUser",
5002
+ "return": {
5003
+ "type": {
5004
+ "text": "void"
5005
+ }
5006
+ },
5007
+ "parameters": [
5008
+ {
5009
+ "name": "sessionKey",
5010
+ "type": {
5011
+ "text": "string"
5012
+ }
5013
+ },
5014
+ {
5015
+ "name": "needsUser",
5016
+ "type": {
5017
+ "text": "boolean"
5018
+ }
5019
+ }
5020
+ ],
5021
+ "description": "Set it for one session, announcing `autopilot-needs-user` when it changes."
5022
+ },
5023
+ {
5024
+ "kind": "function",
5025
+ "name": "autopilotNeedsUser",
4912
5026
  "return": {
4913
5027
  "type": {
4914
- "text": "WidgetTools"
5028
+ "text": "boolean"
4915
5029
  }
4916
5030
  },
4917
5031
  "parameters": [
4918
5032
  {
4919
- "name": "componentName",
5033
+ "name": "sessionKey",
5034
+ "optional": true,
4920
5035
  "type": {
4921
5036
  "text": "string"
4922
5037
  }
4923
- },
4924
- {
4925
- "name": "tools",
4926
- "type": {
4927
- "text": "{ [K in keyof TArgs]: WidgetToolSpec<TController, TArgs[K]> }"
4928
- }
4929
5038
  }
4930
5039
  ],
4931
- "description": "Declare tools that read from one widget type (GENC-1660): parameterised reads that a view cannot\nexpress, such as one table's rows, or a page of them.\n\nPut them on the autopilot (`defineAutopilot({ widgetTools: [...] })`), never discovered from the\nregistration. Its tool list is fixed when its session starts, sorted by name, and identical for\nevery decision, so the cache never breaks. Each call is routed to the interaction of\n`componentName` the autopilot is deciding, and `run` gets its controller; with none open, it is\nrefused with a reason. While one is open, the autopilot's tail says which tools are usable now.\n\nReads only. Their results leave the autopilot's history at the end of the decision, as\n`widget_read`'s do."
5040
+ "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."
4932
5041
  }
4933
5042
  ],
4934
5043
  "exports": [
4935
5044
  {
4936
5045
  "kind": "js",
4937
- "name": "widgetTools",
5046
+ "name": "setAutopilotNeedsUser",
4938
5047
  "declaration": {
4939
- "name": "widgetTools",
4940
- "module": "src/autopilot/widget-tools.ts"
5048
+ "name": "setAutopilotNeedsUser",
5049
+ "module": "src/channel/autopilot-needs-user.ts"
5050
+ }
5051
+ },
5052
+ {
5053
+ "kind": "js",
5054
+ "name": "autopilotNeedsUser",
5055
+ "declaration": {
5056
+ "name": "autopilotNeedsUser",
5057
+ "module": "src/channel/autopilot-needs-user.ts"
4941
5058
  }
4942
5059
  }
4943
5060
  ]
@@ -6800,83 +6917,257 @@
6800
6917
  "exports": [
6801
6918
  {
6802
6919
  "kind": "js",
6803
- "name": "buildEventPayload",
6920
+ "name": "buildEventPayload",
6921
+ "declaration": {
6922
+ "name": "buildEventPayload",
6923
+ "module": "src/genesis/write-payload.ts"
6924
+ }
6925
+ }
6926
+ ]
6927
+ },
6928
+ {
6929
+ "kind": "javascript-module",
6930
+ "path": "src/genesis/write-plan.ts",
6931
+ "declarations": [
6932
+ {
6933
+ "kind": "variable",
6934
+ "name": "MAX_WRITE_ROWS",
6935
+ "type": {
6936
+ "text": "number"
6937
+ },
6938
+ "default": "25",
6939
+ "description": "A batch a person can actually read before approving it."
6940
+ }
6941
+ ],
6942
+ "exports": [
6943
+ {
6944
+ "kind": "js",
6945
+ "name": "MAX_WRITE_ROWS",
6946
+ "declaration": {
6947
+ "name": "MAX_WRITE_ROWS",
6948
+ "module": "src/genesis/write-plan.ts"
6949
+ }
6950
+ }
6951
+ ]
6952
+ },
6953
+ {
6954
+ "kind": "javascript-module",
6955
+ "path": "src/genesis/write-tools.ts",
6956
+ "declarations": [
6957
+ {
6958
+ "kind": "function",
6959
+ "name": "createGenesisWriteTools",
6960
+ "return": {
6961
+ "type": {
6962
+ "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}"
6963
+ }
6964
+ },
6965
+ "parameters": [
6966
+ {
6967
+ "name": "resources",
6968
+ "type": {
6969
+ "text": "readonly GenesisAiResource[]"
6970
+ }
6971
+ },
6972
+ {
6973
+ "name": "options",
6974
+ "default": "{}",
6975
+ "type": {
6976
+ "text": "GenesisWriteToolsOptions"
6977
+ }
6978
+ }
6979
+ ],
6980
+ "description": "Builds the assistant's write tools from an app's event resources."
6981
+ }
6982
+ ],
6983
+ "exports": [
6984
+ {
6985
+ "kind": "js",
6986
+ "name": "createGenesisWriteTools",
6987
+ "declaration": {
6988
+ "name": "createGenesisWriteTools",
6989
+ "module": "src/genesis/write-tools.ts"
6990
+ }
6991
+ }
6992
+ ]
6993
+ },
6994
+ {
6995
+ "kind": "javascript-module",
6996
+ "path": "src/genesis/write-turn.ts",
6997
+ "declarations": [],
6998
+ "exports": []
6999
+ },
7000
+ {
7001
+ "kind": "javascript-module",
7002
+ "path": "src/notifications/agent-notifications.ts",
7003
+ "declarations": [
7004
+ {
7005
+ "kind": "variable",
7006
+ "name": "DEFAULT_AGENT_NOTIFICATION_MESSAGE",
7007
+ "type": {
7008
+ "text": "string"
7009
+ },
7010
+ "default": "'The assistant is ready for your next input'",
7011
+ "description": "The notification's text when neither the app nor the widget gives one."
7012
+ },
7013
+ {
7014
+ "kind": "function",
7015
+ "name": "agentNotificationPermission",
7016
+ "return": {
7017
+ "type": {
7018
+ "text": "AgentNotificationPermission"
7019
+ }
7020
+ },
7021
+ "description": "Whether this page may show notifications. Safe to call anywhere, including Node."
7022
+ },
7023
+ {
7024
+ "kind": "function",
7025
+ "name": "requestAgentNotificationPermission",
7026
+ "return": {
7027
+ "type": {
7028
+ "text": "Promise<AgentNotificationPermission>"
7029
+ }
7030
+ },
7031
+ "description": "Ask the person for permission to show notifications, and resolve to the result. Call it from a\nclick or key handler: browsers ignore or refuse a request that does not come from the person.\nResolves straight away when permission is already decided or unsupported, since a browser only\never asks once."
7032
+ }
7033
+ ],
7034
+ "exports": [
7035
+ {
7036
+ "kind": "js",
7037
+ "name": "DEFAULT_AGENT_NOTIFICATION_MESSAGE",
7038
+ "declaration": {
7039
+ "name": "DEFAULT_AGENT_NOTIFICATION_MESSAGE",
7040
+ "module": "src/notifications/agent-notifications.ts"
7041
+ }
7042
+ },
7043
+ {
7044
+ "kind": "js",
7045
+ "name": "agentNotificationPermission",
7046
+ "declaration": {
7047
+ "name": "agentNotificationPermission",
7048
+ "module": "src/notifications/agent-notifications.ts"
7049
+ }
7050
+ },
7051
+ {
7052
+ "kind": "js",
7053
+ "name": "requestAgentNotificationPermission",
7054
+ "declaration": {
7055
+ "name": "requestAgentNotificationPermission",
7056
+ "module": "src/notifications/agent-notifications.ts"
7057
+ }
7058
+ }
7059
+ ]
7060
+ },
7061
+ {
7062
+ "kind": "javascript-module",
7063
+ "path": "src/notifications/agent-notifier.ts",
7064
+ "declarations": [],
7065
+ "exports": []
7066
+ },
7067
+ {
7068
+ "kind": "javascript-module",
7069
+ "path": "src/notifications/index.ts",
7070
+ "declarations": [],
7071
+ "exports": [
7072
+ {
7073
+ "kind": "js",
7074
+ "name": "agentNotificationPermission",
7075
+ "declaration": {
7076
+ "name": "agentNotificationPermission",
7077
+ "module": "./agent-notifications"
7078
+ }
7079
+ },
7080
+ {
7081
+ "kind": "js",
7082
+ "name": "DEFAULT_AGENT_NOTIFICATION_MESSAGE",
7083
+ "declaration": {
7084
+ "name": "DEFAULT_AGENT_NOTIFICATION_MESSAGE",
7085
+ "module": "./agent-notifications"
7086
+ }
7087
+ },
7088
+ {
7089
+ "kind": "js",
7090
+ "name": "requestAgentNotificationPermission",
7091
+ "declaration": {
7092
+ "name": "requestAgentNotificationPermission",
7093
+ "module": "./agent-notifications"
7094
+ }
7095
+ },
7096
+ {
7097
+ "kind": "js",
7098
+ "name": "type",
7099
+ "declaration": {
7100
+ "name": "type",
7101
+ "module": "./agent-notifications"
7102
+ }
7103
+ },
7104
+ {
7105
+ "kind": "js",
7106
+ "name": "AgentAttentionDetail",
7107
+ "declaration": {
7108
+ "name": "AgentAttentionDetail",
7109
+ "module": "./agent-notifications"
7110
+ }
7111
+ },
7112
+ {
7113
+ "kind": "js",
7114
+ "name": "type",
7115
+ "declaration": {
7116
+ "name": "type",
7117
+ "module": "./agent-notifications"
7118
+ }
7119
+ },
7120
+ {
7121
+ "kind": "js",
7122
+ "name": "AgentAttentionKind",
7123
+ "declaration": {
7124
+ "name": "AgentAttentionKind",
7125
+ "module": "./agent-notifications"
7126
+ }
7127
+ },
7128
+ {
7129
+ "kind": "js",
7130
+ "name": "type",
7131
+ "declaration": {
7132
+ "name": "type",
7133
+ "module": "./agent-notifications"
7134
+ }
7135
+ },
7136
+ {
7137
+ "kind": "js",
7138
+ "name": "AgentNotificationLevel",
6804
7139
  "declaration": {
6805
- "name": "buildEventPayload",
6806
- "module": "src/genesis/write-payload.ts"
7140
+ "name": "AgentNotificationLevel",
7141
+ "module": "./agent-notifications"
6807
7142
  }
6808
- }
6809
- ]
6810
- },
6811
- {
6812
- "kind": "javascript-module",
6813
- "path": "src/genesis/write-plan.ts",
6814
- "declarations": [
6815
- {
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": [
7143
+ },
6826
7144
  {
6827
7145
  "kind": "js",
6828
- "name": "MAX_WRITE_ROWS",
7146
+ "name": "type",
6829
7147
  "declaration": {
6830
- "name": "MAX_WRITE_ROWS",
6831
- "module": "src/genesis/write-plan.ts"
7148
+ "name": "type",
7149
+ "module": "./agent-notifications"
6832
7150
  }
6833
- }
6834
- ]
6835
- },
6836
- {
6837
- "kind": "javascript-module",
6838
- "path": "src/genesis/write-tools.ts",
6839
- "declarations": [
6840
- {
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": [
7151
+ },
6867
7152
  {
6868
7153
  "kind": "js",
6869
- "name": "createGenesisWriteTools",
7154
+ "name": "AgentNotificationPermission",
6870
7155
  "declaration": {
6871
- "name": "createGenesisWriteTools",
6872
- "module": "src/genesis/write-tools.ts"
7156
+ "name": "AgentNotificationPermission",
7157
+ "module": "./agent-notifications"
6873
7158
  }
6874
7159
  }
6875
7160
  ]
6876
7161
  },
6877
7162
  {
6878
7163
  "kind": "javascript-module",
6879
- "path": "src/genesis/write-turn.ts",
7164
+ "path": "src/notifications/notification-level-picker.template.ts",
7165
+ "declarations": [],
7166
+ "exports": []
7167
+ },
7168
+ {
7169
+ "kind": "javascript-module",
7170
+ "path": "src/notifications/notification-settings.ts",
6880
7171
  "declarations": [],
6881
7172
  "exports": []
6882
7173
  },
@@ -11137,180 +11428,6 @@
11137
11428
  "declarations": [],
11138
11429
  "exports": []
11139
11430
  },
11140
- {
11141
- "kind": "javascript-module",
11142
- "path": "src/notifications/agent-notifications.ts",
11143
- "declarations": [
11144
- {
11145
- "kind": "variable",
11146
- "name": "DEFAULT_AGENT_NOTIFICATION_MESSAGE",
11147
- "type": {
11148
- "text": "string"
11149
- },
11150
- "default": "'The assistant is ready for your next input'",
11151
- "description": "The notification's text when neither the app nor the widget gives one."
11152
- },
11153
- {
11154
- "kind": "function",
11155
- "name": "agentNotificationPermission",
11156
- "return": {
11157
- "type": {
11158
- "text": "AgentNotificationPermission"
11159
- }
11160
- },
11161
- "description": "Whether this page may show notifications. Safe to call anywhere, including Node."
11162
- },
11163
- {
11164
- "kind": "function",
11165
- "name": "requestAgentNotificationPermission",
11166
- "return": {
11167
- "type": {
11168
- "text": "Promise<AgentNotificationPermission>"
11169
- }
11170
- },
11171
- "description": "Ask the person for permission to show notifications, and resolve to the result. Call it from a\nclick or key handler: browsers ignore or refuse a request that does not come from the person.\nResolves straight away when permission is already decided or unsupported, since a browser only\never asks once."
11172
- }
11173
- ],
11174
- "exports": [
11175
- {
11176
- "kind": "js",
11177
- "name": "DEFAULT_AGENT_NOTIFICATION_MESSAGE",
11178
- "declaration": {
11179
- "name": "DEFAULT_AGENT_NOTIFICATION_MESSAGE",
11180
- "module": "src/notifications/agent-notifications.ts"
11181
- }
11182
- },
11183
- {
11184
- "kind": "js",
11185
- "name": "agentNotificationPermission",
11186
- "declaration": {
11187
- "name": "agentNotificationPermission",
11188
- "module": "src/notifications/agent-notifications.ts"
11189
- }
11190
- },
11191
- {
11192
- "kind": "js",
11193
- "name": "requestAgentNotificationPermission",
11194
- "declaration": {
11195
- "name": "requestAgentNotificationPermission",
11196
- "module": "src/notifications/agent-notifications.ts"
11197
- }
11198
- }
11199
- ]
11200
- },
11201
- {
11202
- "kind": "javascript-module",
11203
- "path": "src/notifications/agent-notifier.ts",
11204
- "declarations": [],
11205
- "exports": []
11206
- },
11207
- {
11208
- "kind": "javascript-module",
11209
- "path": "src/notifications/index.ts",
11210
- "declarations": [],
11211
- "exports": [
11212
- {
11213
- "kind": "js",
11214
- "name": "agentNotificationPermission",
11215
- "declaration": {
11216
- "name": "agentNotificationPermission",
11217
- "module": "./agent-notifications"
11218
- }
11219
- },
11220
- {
11221
- "kind": "js",
11222
- "name": "DEFAULT_AGENT_NOTIFICATION_MESSAGE",
11223
- "declaration": {
11224
- "name": "DEFAULT_AGENT_NOTIFICATION_MESSAGE",
11225
- "module": "./agent-notifications"
11226
- }
11227
- },
11228
- {
11229
- "kind": "js",
11230
- "name": "requestAgentNotificationPermission",
11231
- "declaration": {
11232
- "name": "requestAgentNotificationPermission",
11233
- "module": "./agent-notifications"
11234
- }
11235
- },
11236
- {
11237
- "kind": "js",
11238
- "name": "type",
11239
- "declaration": {
11240
- "name": "type",
11241
- "module": "./agent-notifications"
11242
- }
11243
- },
11244
- {
11245
- "kind": "js",
11246
- "name": "AgentAttentionDetail",
11247
- "declaration": {
11248
- "name": "AgentAttentionDetail",
11249
- "module": "./agent-notifications"
11250
- }
11251
- },
11252
- {
11253
- "kind": "js",
11254
- "name": "type",
11255
- "declaration": {
11256
- "name": "type",
11257
- "module": "./agent-notifications"
11258
- }
11259
- },
11260
- {
11261
- "kind": "js",
11262
- "name": "AgentAttentionKind",
11263
- "declaration": {
11264
- "name": "AgentAttentionKind",
11265
- "module": "./agent-notifications"
11266
- }
11267
- },
11268
- {
11269
- "kind": "js",
11270
- "name": "type",
11271
- "declaration": {
11272
- "name": "type",
11273
- "module": "./agent-notifications"
11274
- }
11275
- },
11276
- {
11277
- "kind": "js",
11278
- "name": "AgentNotificationLevel",
11279
- "declaration": {
11280
- "name": "AgentNotificationLevel",
11281
- "module": "./agent-notifications"
11282
- }
11283
- },
11284
- {
11285
- "kind": "js",
11286
- "name": "type",
11287
- "declaration": {
11288
- "name": "type",
11289
- "module": "./agent-notifications"
11290
- }
11291
- },
11292
- {
11293
- "kind": "js",
11294
- "name": "AgentNotificationPermission",
11295
- "declaration": {
11296
- "name": "AgentNotificationPermission",
11297
- "module": "./agent-notifications"
11298
- }
11299
- }
11300
- ]
11301
- },
11302
- {
11303
- "kind": "javascript-module",
11304
- "path": "src/notifications/notification-level-picker.template.ts",
11305
- "declarations": [],
11306
- "exports": []
11307
- },
11308
- {
11309
- "kind": "javascript-module",
11310
- "path": "src/notifications/notification-settings.ts",
11311
- "declarations": [],
11312
- "exports": []
11313
- },
11314
11431
  {
11315
11432
  "kind": "javascript-module",
11316
11433
  "path": "src/provider/ai-provider-switcher.ts",
@@ -11638,7 +11755,7 @@
11638
11755
  "type": {
11639
11756
  "text": "Record<MetaEventType, MetaEventImportance>"
11640
11757
  },
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}",
11758
+ "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 '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
11759
  "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
11760
  },
11644
11761
  {
@@ -11800,7 +11917,7 @@
11800
11917
  "type": {
11801
11918
  "text": "readonly string[]"
11802
11919
  },
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]",
11920
+ "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), 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]",
11804
11921
  "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
11922
  }
11806
11923
  ],
@@ -23196,7 +23313,7 @@
23196
23313
  }
23197
23314
  }
23198
23315
  ],
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."
23316
+ "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
23317
  },
23201
23318
  {
23202
23319
  "kind": "method",
@@ -23207,7 +23324,7 @@
23207
23324
  "text": "Promise<string | undefined>"
23208
23325
  }
23209
23326
  },
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."
23327
+ "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
23328
  },
23212
23329
  {
23213
23330
  "kind": "method",