@genesislcap/ai-assistant 15.41.0 → 15.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/chat-driver.cjs +115 -6
  2. package/dist/chat-driver.cjs.map +3 -3
  3. package/dist/chat-driver.mjs +115 -6
  4. package/dist/chat-driver.mjs.map +3 -3
  5. package/dist/custom-elements.json +761 -713
  6. package/dist/dts/genesis/config.d.ts +51 -6
  7. package/dist/dts/genesis/config.d.ts.map +1 -1
  8. package/dist/dts/genesis/consumes.d.ts +42 -0
  9. package/dist/dts/genesis/consumes.d.ts.map +1 -0
  10. package/dist/dts/genesis/criteria.d.ts.map +1 -1
  11. package/dist/dts/genesis/event-fields.d.ts +4 -1
  12. package/dist/dts/genesis/event-fields.d.ts.map +1 -1
  13. package/dist/dts/genesis/index.d.ts +2 -1
  14. package/dist/dts/genesis/index.d.ts.map +1 -1
  15. package/dist/dts/genesis/register-genesis-assistant.d.ts +29 -4
  16. package/dist/dts/genesis/register-genesis-assistant.d.ts.map +1 -1
  17. package/dist/dts/genesis/resource-tools.d.ts.map +1 -1
  18. package/dist/dts/genesis/review-model.d.ts.map +1 -1
  19. package/dist/dts/genesis/types.d.ts +37 -5
  20. package/dist/dts/genesis/types.d.ts.map +1 -1
  21. package/dist/dts/genesis/write-payload.d.ts.map +1 -1
  22. package/dist/dts/genesis/write-tools.d.ts +26 -5
  23. package/dist/dts/genesis/write-tools.d.ts.map +1 -1
  24. package/dist/esm/genesis/config.js +105 -50
  25. package/dist/esm/genesis/consumes.js +30 -0
  26. package/dist/esm/genesis/criteria.js +28 -0
  27. package/dist/esm/genesis/event-fields.js +20 -3
  28. package/dist/esm/genesis/index.js +1 -0
  29. package/dist/esm/genesis/register-genesis-assistant.js +146 -63
  30. package/dist/esm/genesis/resource-tools.js +20 -12
  31. package/dist/esm/genesis/review-model.js +16 -3
  32. package/dist/esm/genesis/write-payload.js +47 -4
  33. package/dist/esm/genesis/write-tools.js +199 -45
  34. package/dist/genesis-consumes.cjs +35 -0
  35. package/dist/genesis-consumes.cjs.map +7 -0
  36. package/dist/genesis-consumes.mjs +11 -0
  37. package/dist/genesis-consumes.mjs.map +7 -0
  38. package/docs/genesis.md +156 -28
  39. package/package.json +29 -19
  40. package/scripts/build-genesis-consumes-node.mjs +50 -0
  41. package/scripts/smoke-genesis-consumes-node.mjs +70 -0
@@ -1230,211 +1230,6 @@
1230
1230
  "declarations": [],
1231
1231
  "exports": []
1232
1232
  },
1233
- {
1234
- "kind": "javascript-module",
1235
- "path": "src/config/config.ts",
1236
- "declarations": [
1237
- {
1238
- "kind": "function",
1239
- "name": "defineAgent",
1240
- "description": "Identity helper that infers the narrowest possible type for an agent config,\npreserving string literal types (including `name`) without requiring `as const`.\n\nUse this when you need `typeof myAgent` to carry the literal `name` type —\nfor example, when wiring `ChatToolHandlers<typeof myAgent>`.\n\n```ts\nconst myAgent = defineAgent({ name: 'my_agent', ... });\ntype Handlers = ChatToolHandlers<typeof myAgent>;\n// requestSubAgent name param is now typed as 'my_agent'\n```"
1241
- }
1242
- ],
1243
- "exports": [
1244
- {
1245
- "kind": "js",
1246
- "name": "CachePolicy",
1247
- "declaration": {
1248
- "name": "CachePolicy",
1249
- "module": "src/config/config.ts"
1250
- }
1251
- },
1252
- {
1253
- "kind": "js",
1254
- "name": "ChatFallback",
1255
- "declaration": {
1256
- "name": "ChatFallback",
1257
- "module": "src/config/config.ts"
1258
- }
1259
- },
1260
- {
1261
- "kind": "js",
1262
- "name": "ChatInputDuringExecutionMode",
1263
- "declaration": {
1264
- "name": "ChatInputDuringExecutionMode",
1265
- "module": "src/config/config.ts"
1266
- }
1267
- },
1268
- {
1269
- "kind": "js",
1270
- "name": "ChatThinkingPolicy",
1271
- "declaration": {
1272
- "name": "ChatThinkingPolicy",
1273
- "module": "src/config/config.ts"
1274
- }
1275
- },
1276
- {
1277
- "kind": "js",
1278
- "name": "ChatToolChoice",
1279
- "declaration": {
1280
- "name": "ChatToolChoice",
1281
- "module": "src/config/config.ts"
1282
- }
1283
- },
1284
- {
1285
- "kind": "js",
1286
- "name": "defineAgent",
1287
- "declaration": {
1288
- "name": "defineAgent",
1289
- "module": "src/config/config.ts"
1290
- }
1291
- }
1292
- ]
1293
- },
1294
- {
1295
- "kind": "javascript-module",
1296
- "path": "src/config/define-stateful-agent.ts",
1297
- "declarations": [
1298
- {
1299
- "kind": "function",
1300
- "name": "restoreMachine",
1301
- "return": {
1302
- "type": {
1303
- "text": "void"
1304
- }
1305
- },
1306
- "parameters": [
1307
- {
1308
- "name": "machine",
1309
- "type": {
1310
- "text": "{ stop: () => void; start: (options?: { state?: unknown }) => void }"
1311
- },
1312
- "description": "the machine to restore (already constructed/started)."
1313
- },
1314
- {
1315
- "name": "restored",
1316
- "type": {
1317
- "text": "unknown"
1318
- },
1319
- "description": "the agent's serialized image (`ctx.restored` in `init`)."
1320
- },
1321
- {
1322
- "name": "key",
1323
- "default": "'machine'",
1324
- "description": "the property the machine occupies in the snapshot; defaults to\n`'machine'` to match the conventional `{ machine }` state bag."
1325
- }
1326
- ],
1327
- "description": "Restore a foundation-state-machine instance from a snapshot produced by the\ndefault serializer (or `machine.getPersistedSnapshot()`). Call inside a\nstateful agent's `init` to resume the machine in its exact prior place:\n\n```ts\ninit: ({ restored }) => {\n const machine = new MyMachine();\n restoreMachine(machine, restored); // resume, or no-op on a fresh start\n return { machine };\n}\n```\n\nNo-ops when there is nothing to restore (a fresh session), leaving the\nfreshly-constructed machine in its initial state."
1328
- },
1329
- {
1330
- "kind": "function",
1331
- "name": "defineStatefulAgent",
1332
- "return": {
1333
- "type": {
1334
- "text": "AgentConfig"
1335
- }
1336
- },
1337
- "parameters": [
1338
- {
1339
- "name": "opts",
1340
- "type": {
1341
- "text": "StatefulAgentInit<S>"
1342
- }
1343
- }
1344
- ],
1345
- "description": "Build an `AgentConfig` whose `systemPrompt`, `toolDefinitions`, and tool\nhandlers all close over a long-lived state object created on activation.\n\nThe framework wires the lifecycle: `init` on `onActivate`, `dispose` on\n`onDeactivate`. State is held inside the helper's closure — never exposed on\nthe resulting `AgentConfig` — so the redux serializer doesn't see it."
1346
- }
1347
- ],
1348
- "exports": [
1349
- {
1350
- "kind": "js",
1351
- "name": "restoreMachine",
1352
- "declaration": {
1353
- "name": "restoreMachine",
1354
- "module": "src/config/define-stateful-agent.ts"
1355
- }
1356
- },
1357
- {
1358
- "kind": "js",
1359
- "name": "defineStatefulAgent",
1360
- "declaration": {
1361
- "name": "defineStatefulAgent",
1362
- "module": "src/config/define-stateful-agent.ts"
1363
- }
1364
- }
1365
- ]
1366
- },
1367
- {
1368
- "kind": "javascript-module",
1369
- "path": "src/config/fallback-agents.ts",
1370
- "declarations": [
1371
- {
1372
- "kind": "variable",
1373
- "name": "friendlyFallbackAgent",
1374
- "type": {
1375
- "text": "FallbackAgentConfig"
1376
- },
1377
- "default": "{\n name: 'Assistant',\n fallback: true,\n systemPrompt: `You are a warm, friendly assistant. For general conversation like \"Hi\" or \"How are you\", you can have a friendly chat. For anything more complex, you cannot directly help, but you can explain what specialists are available. The available specialists are:\\n\\n{{agents}}\\n\\nPolitely let the user know what you can help with and invite them to rephrase their request if it is outside your scope.`,\n}",
1378
- "description": "A warm, conversational fallback agent. Acknowledges it can't help directly,\nexplains what the available specialists can do, and invites the user to retry.\n\nThe system prompt is generated at runtime by `OrchestratingDriver` from the\nspecialist list — no manual authoring required."
1379
- },
1380
- {
1381
- "kind": "variable",
1382
- "name": "strictFallbackAgent",
1383
- "type": {
1384
- "text": "FallbackAgentConfig"
1385
- },
1386
- "default": "{\n name: 'Assistant',\n fallback: true,\n systemPrompt: `You are a concise assistant. The user's request is outside your scope. The available specialists are: {{agents}}.\n\n{{unroutable}}\n\nAnswer in a single short sentence. Do not elaborate.`,\n}",
1387
- "description": "A brief, professional fallback agent. States what is available without\nelaboration. The `{{agents}}` placeholder is replaced at runtime by\n`OrchestratingDriver` with the generated specialist list.\n\nThe `{{unroutable}}` placeholder positions `UNROUTABLE_INSTRUCTION` — the framework's\ninstruction for a substantive request no specialist covers, which is otherwise APPENDED to a\nstring-form prompt. Positioned rather than appended for one reason: this preset's whole point is\nbrevity, and appended text would be the last thing the model reads. Putting the block above the\nbrevity rule leaves \"a single short sentence\" with the recency, so the two compose instead of\ncompeting. A prompt whose tone rules matter should do the same."
1388
- }
1389
- ],
1390
- "exports": [
1391
- {
1392
- "kind": "js",
1393
- "name": "friendlyFallbackAgent",
1394
- "declaration": {
1395
- "name": "friendlyFallbackAgent",
1396
- "module": "src/config/fallback-agents.ts"
1397
- }
1398
- },
1399
- {
1400
- "kind": "js",
1401
- "name": "strictFallbackAgent",
1402
- "declaration": {
1403
- "name": "strictFallbackAgent",
1404
- "module": "src/config/fallback-agents.ts"
1405
- }
1406
- }
1407
- ]
1408
- },
1409
- {
1410
- "kind": "javascript-module",
1411
- "path": "src/config/index.ts",
1412
- "declarations": [],
1413
- "exports": [
1414
- {
1415
- "kind": "js",
1416
- "name": "*",
1417
- "declaration": {
1418
- "name": "*",
1419
- "package": "./config"
1420
- }
1421
- },
1422
- {
1423
- "kind": "js",
1424
- "name": "*",
1425
- "declaration": {
1426
- "name": "*",
1427
- "package": "./fallback-agents"
1428
- }
1429
- }
1430
- ]
1431
- },
1432
- {
1433
- "kind": "javascript-module",
1434
- "path": "src/config/validate-providers.ts",
1435
- "declarations": [],
1436
- "exports": []
1437
- },
1438
1233
  {
1439
1234
  "kind": "javascript-module",
1440
1235
  "path": "src/components/flowing-waves-indicator.ts",
@@ -1961,239 +1756,484 @@
1961
1756
  },
1962
1757
  {
1963
1758
  "kind": "javascript-module",
1964
- "path": "src/genesis/calendar.ts",
1965
- "declarations": [],
1966
- "exports": []
1967
- },
1968
- {
1969
- "kind": "javascript-module",
1970
- "path": "src/genesis/config.ts",
1759
+ "path": "src/config/config.ts",
1971
1760
  "declarations": [
1972
- {
1973
- "kind": "variable",
1974
- "name": "DEFAULT_MAX_ROWS",
1975
- "type": {
1976
- "text": "number"
1977
- },
1978
- "default": "50",
1979
- "description": "The default read cap, and the ceiling the config may raise it to."
1980
- },
1981
- {
1982
- "kind": "variable",
1983
- "name": "MAX_ROWS_CEILING",
1984
- "type": {
1985
- "text": "number"
1986
- },
1987
- "default": "1000"
1988
- },
1989
1761
  {
1990
1762
  "kind": "function",
1991
- "name": "toolNameOf",
1992
- "return": {
1993
- "type": {
1994
- "text": "string"
1995
- }
1996
- },
1997
- "parameters": [
1998
- {
1999
- "name": "resourceName",
2000
- "type": {
2001
- "text": "string"
2002
- }
2003
- }
2004
- ],
2005
- "description": "The model-facing tool name for a resource. Deterministic and collision-free (resource names\nare unique), and trivially mapped back to the resource in a debug log. What the tool is FOR\nreaches the model through its description, not its name."
1763
+ "name": "defineAgent",
1764
+ "description": "Identity helper that infers the narrowest possible type for an agent config,\npreserving string literal types (including `name`) without requiring `as const`.\n\nUse this when you need `typeof myAgent` to carry the literal `name` type —\nfor example, when wiring `ChatToolHandlers<typeof myAgent>`.\n\n```ts\nconst myAgent = defineAgent({ name: 'my_agent', ... });\ntype Handlers = ChatToolHandlers<typeof myAgent>;\n// requestSubAgent name param is now typed as 'my_agent'\n```"
2006
1765
  }
2007
1766
  ],
2008
1767
  "exports": [
2009
1768
  {
2010
1769
  "kind": "js",
2011
- "name": "DEFAULT_MAX_ROWS",
1770
+ "name": "CachePolicy",
2012
1771
  "declaration": {
2013
- "name": "DEFAULT_MAX_ROWS",
2014
- "module": "src/genesis/config.ts"
1772
+ "name": "CachePolicy",
1773
+ "module": "src/config/config.ts"
2015
1774
  }
2016
1775
  },
2017
1776
  {
2018
1777
  "kind": "js",
2019
- "name": "MAX_ROWS_CEILING",
1778
+ "name": "ChatFallback",
2020
1779
  "declaration": {
2021
- "name": "MAX_ROWS_CEILING",
2022
- "module": "src/genesis/config.ts"
1780
+ "name": "ChatFallback",
1781
+ "module": "src/config/config.ts"
2023
1782
  }
2024
1783
  },
2025
1784
  {
2026
1785
  "kind": "js",
2027
- "name": "toolNameOf",
1786
+ "name": "ChatInputDuringExecutionMode",
2028
1787
  "declaration": {
2029
- "name": "toolNameOf",
2030
- "module": "src/genesis/config.ts"
1788
+ "name": "ChatInputDuringExecutionMode",
1789
+ "module": "src/config/config.ts"
1790
+ }
1791
+ },
1792
+ {
1793
+ "kind": "js",
1794
+ "name": "ChatThinkingPolicy",
1795
+ "declaration": {
1796
+ "name": "ChatThinkingPolicy",
1797
+ "module": "src/config/config.ts"
1798
+ }
1799
+ },
1800
+ {
1801
+ "kind": "js",
1802
+ "name": "ChatToolChoice",
1803
+ "declaration": {
1804
+ "name": "ChatToolChoice",
1805
+ "module": "src/config/config.ts"
1806
+ }
1807
+ },
1808
+ {
1809
+ "kind": "js",
1810
+ "name": "defineAgent",
1811
+ "declaration": {
1812
+ "name": "defineAgent",
1813
+ "module": "src/config/config.ts"
2031
1814
  }
2032
1815
  }
2033
1816
  ]
2034
1817
  },
2035
1818
  {
2036
1819
  "kind": "javascript-module",
2037
- "path": "src/genesis/criteria.ts",
1820
+ "path": "src/config/define-stateful-agent.ts",
2038
1821
  "declarations": [
2039
1822
  {
2040
1823
  "kind": "function",
2041
- "name": "dateFragment",
1824
+ "name": "restoreMachine",
2042
1825
  "return": {
2043
1826
  "type": {
2044
- "text": "string | undefined"
1827
+ "text": "void"
2045
1828
  }
2046
1829
  },
2047
1830
  "parameters": [
2048
1831
  {
2049
- "name": "field",
1832
+ "name": "machine",
2050
1833
  "type": {
2051
- "text": "string"
2052
- }
1834
+ "text": "{ stop: () => void; start: (options?: { state?: unknown }) => void }"
1835
+ },
1836
+ "description": "the machine to restore (already constructed/started)."
2053
1837
  },
2054
1838
  {
2055
- "name": "op",
1839
+ "name": "restored",
2056
1840
  "type": {
2057
- "text": "GenesisFilterOp"
2058
- }
1841
+ "text": "unknown"
1842
+ },
1843
+ "description": "the agent's serialized image (`ctx.restored` in `init`)."
2059
1844
  },
2060
1845
  {
2061
- "name": "date",
2062
- "type": {
2063
- "text": "string"
2064
- }
1846
+ "name": "key",
1847
+ "default": "'machine'",
1848
+ "description": "the property the machine occupies in the snapshot; defaults to\n`'machine'` to match the conventional `{ machine }` state bag."
2065
1849
  }
2066
- ]
1850
+ ],
1851
+ "description": "Restore a foundation-state-machine instance from a snapshot produced by the\ndefault serializer (or `machine.getPersistedSnapshot()`). Call inside a\nstateful agent's `init` to resume the machine in its exact prior place:\n\n```ts\ninit: ({ restored }) => {\n const machine = new MyMachine();\n restoreMachine(machine, restored); // resume, or no-op on a fresh start\n return { machine };\n}\n```\n\nNo-ops when there is nothing to restore (a fresh session), leaving the\nfreshly-constructed machine in its initial state."
2067
1852
  },
2068
1853
  {
2069
1854
  "kind": "function",
2070
- "name": "dateTimeFragment",
1855
+ "name": "defineStatefulAgent",
2071
1856
  "return": {
2072
1857
  "type": {
2073
- "text": "string | undefined"
1858
+ "text": "AgentConfig"
2074
1859
  }
2075
1860
  },
2076
1861
  "parameters": [
2077
1862
  {
2078
- "name": "field",
2079
- "type": {
2080
- "text": "string"
2081
- }
2082
- },
2083
- {
2084
- "name": "op",
2085
- "type": {
2086
- "text": "GenesisFilterOp"
2087
- }
2088
- },
2089
- {
2090
- "name": "bound",
1863
+ "name": "opts",
2091
1864
  "type": {
2092
- "text": "string"
1865
+ "text": "StatefulAgentInit<S>"
2093
1866
  }
2094
1867
  }
2095
1868
  ],
2096
- "description": "Timestamp columns get the dateTime helpers, which take a `yyyyMMdd-HH:mm:ss` bound."
1869
+ "description": "Build an `AgentConfig` whose `systemPrompt`, `toolDefinitions`, and tool\nhandlers all close over a long-lived state object created on activation.\n\nThe framework wires the lifecycle: `init` on `onActivate`, `dispose` on\n`onDeactivate`. State is held inside the helper's closure — never exposed on\nthe resulting `AgentConfig` — so the redux serializer doesn't see it."
2097
1870
  }
2098
1871
  ],
2099
1872
  "exports": [
2100
1873
  {
2101
1874
  "kind": "js",
2102
- "name": "dateFragment",
1875
+ "name": "restoreMachine",
2103
1876
  "declaration": {
2104
- "name": "dateFragment",
2105
- "module": "src/genesis/criteria.ts"
1877
+ "name": "restoreMachine",
1878
+ "module": "src/config/define-stateful-agent.ts"
2106
1879
  }
2107
1880
  },
2108
1881
  {
2109
1882
  "kind": "js",
2110
- "name": "dateTimeFragment",
1883
+ "name": "defineStatefulAgent",
2111
1884
  "declaration": {
2112
- "name": "dateTimeFragment",
2113
- "module": "src/genesis/criteria.ts"
1885
+ "name": "defineStatefulAgent",
1886
+ "module": "src/config/define-stateful-agent.ts"
2114
1887
  }
2115
1888
  }
2116
1889
  ]
2117
1890
  },
2118
1891
  {
2119
1892
  "kind": "javascript-module",
2120
- "path": "src/genesis/event-fields.ts",
2121
- "declarations": [],
2122
- "exports": []
2123
- },
2124
- {
2125
- "kind": "javascript-module",
2126
- "path": "src/genesis/filter-fields.ts",
2127
- "declarations": [],
2128
- "exports": []
2129
- },
2130
- {
2131
- "kind": "javascript-module",
2132
- "path": "src/genesis/index.ts",
2133
- "declarations": [],
1893
+ "path": "src/config/fallback-agents.ts",
1894
+ "declarations": [
1895
+ {
1896
+ "kind": "variable",
1897
+ "name": "friendlyFallbackAgent",
1898
+ "type": {
1899
+ "text": "FallbackAgentConfig"
1900
+ },
1901
+ "default": "{\n name: 'Assistant',\n fallback: true,\n systemPrompt: `You are a warm, friendly assistant. For general conversation like \"Hi\" or \"How are you\", you can have a friendly chat. For anything more complex, you cannot directly help, but you can explain what specialists are available. The available specialists are:\\n\\n{{agents}}\\n\\nPolitely let the user know what you can help with and invite them to rephrase their request if it is outside your scope.`,\n}",
1902
+ "description": "A warm, conversational fallback agent. Acknowledges it can't help directly,\nexplains what the available specialists can do, and invites the user to retry.\n\nThe system prompt is generated at runtime by `OrchestratingDriver` from the\nspecialist list — no manual authoring required."
1903
+ },
1904
+ {
1905
+ "kind": "variable",
1906
+ "name": "strictFallbackAgent",
1907
+ "type": {
1908
+ "text": "FallbackAgentConfig"
1909
+ },
1910
+ "default": "{\n name: 'Assistant',\n fallback: true,\n systemPrompt: `You are a concise assistant. The user's request is outside your scope. The available specialists are: {{agents}}.\n\n{{unroutable}}\n\nAnswer in a single short sentence. Do not elaborate.`,\n}",
1911
+ "description": "A brief, professional fallback agent. States what is available without\nelaboration. The `{{agents}}` placeholder is replaced at runtime by\n`OrchestratingDriver` with the generated specialist list.\n\nThe `{{unroutable}}` placeholder positions `UNROUTABLE_INSTRUCTION` — the framework's\ninstruction for a substantive request no specialist covers, which is otherwise APPENDED to a\nstring-form prompt. Positioned rather than appended for one reason: this preset's whole point is\nbrevity, and appended text would be the last thing the model reads. Putting the block above the\nbrevity rule leaves \"a single short sentence\" with the recency, so the two compose instead of\ncompeting. A prompt whose tone rules matter should do the same."
1912
+ }
1913
+ ],
2134
1914
  "exports": [
2135
1915
  {
2136
1916
  "kind": "js",
2137
- "name": "GENESIS_AGENT_NAME",
1917
+ "name": "friendlyFallbackAgent",
2138
1918
  "declaration": {
2139
- "name": "GENESIS_AGENT_NAME",
2140
- "module": "./register-genesis-assistant"
1919
+ "name": "friendlyFallbackAgent",
1920
+ "module": "src/config/fallback-agents.ts"
2141
1921
  }
2142
1922
  },
2143
1923
  {
2144
1924
  "kind": "js",
2145
- "name": "registerGenesisAssistant",
1925
+ "name": "strictFallbackAgent",
2146
1926
  "declaration": {
2147
- "name": "registerGenesisAssistant",
2148
- "module": "./register-genesis-assistant"
1927
+ "name": "strictFallbackAgent",
1928
+ "module": "src/config/fallback-agents.ts"
2149
1929
  }
2150
- },
1930
+ }
1931
+ ]
1932
+ },
1933
+ {
1934
+ "kind": "javascript-module",
1935
+ "path": "src/config/index.ts",
1936
+ "declarations": [],
1937
+ "exports": [
2151
1938
  {
2152
1939
  "kind": "js",
2153
- "name": "GenesisFilter",
1940
+ "name": "*",
2154
1941
  "declaration": {
2155
- "name": "GenesisFilter",
2156
- "module": "./criteria"
1942
+ "name": "*",
1943
+ "package": "./config"
2157
1944
  }
2158
1945
  },
2159
1946
  {
2160
1947
  "kind": "js",
2161
- "name": "GenesisFilterField",
1948
+ "name": "*",
2162
1949
  "declaration": {
2163
- "name": "GenesisFilterField",
2164
- "module": "./criteria"
1950
+ "name": "*",
1951
+ "package": "./fallback-agents"
2165
1952
  }
1953
+ }
1954
+ ]
1955
+ },
1956
+ {
1957
+ "kind": "javascript-module",
1958
+ "path": "src/config/validate-providers.ts",
1959
+ "declarations": [],
1960
+ "exports": []
1961
+ },
1962
+ {
1963
+ "kind": "javascript-module",
1964
+ "path": "src/genesis/calendar.ts",
1965
+ "declarations": [],
1966
+ "exports": []
1967
+ },
1968
+ {
1969
+ "kind": "javascript-module",
1970
+ "path": "src/genesis/config.ts",
1971
+ "declarations": [
1972
+ {
1973
+ "kind": "variable",
1974
+ "name": "DEFAULT_MAX_ROWS",
1975
+ "type": {
1976
+ "text": "number"
1977
+ },
1978
+ "default": "50",
1979
+ "description": "The default read cap, and the ceiling the config may raise it to."
2166
1980
  },
1981
+ {
1982
+ "kind": "variable",
1983
+ "name": "MAX_ROWS_CEILING",
1984
+ "type": {
1985
+ "text": "number"
1986
+ },
1987
+ "default": "1000"
1988
+ },
1989
+ {
1990
+ "kind": "function",
1991
+ "name": "toolNameOf",
1992
+ "return": {
1993
+ "type": {
1994
+ "text": "string"
1995
+ }
1996
+ },
1997
+ "parameters": [
1998
+ {
1999
+ "name": "resourceName",
2000
+ "type": {
2001
+ "text": "string"
2002
+ }
2003
+ }
2004
+ ],
2005
+ "description": "The model-facing tool name for a resource. Deterministic and collision-free (resource names\nare unique), and trivially mapped back to the resource in a debug log. What the tool is FOR\nreaches the model through its description, not its name."
2006
+ }
2007
+ ],
2008
+ "exports": [
2167
2009
  {
2168
2010
  "kind": "js",
2169
- "name": "GenesisFilterOp",
2011
+ "name": "DEFAULT_MAX_ROWS",
2170
2012
  "declaration": {
2171
- "name": "GenesisFilterOp",
2172
- "module": "./criteria"
2013
+ "name": "DEFAULT_MAX_ROWS",
2014
+ "module": "src/genesis/config.ts"
2173
2015
  }
2174
2016
  },
2175
2017
  {
2176
2018
  "kind": "js",
2177
- "name": "createGenesisResourceTools",
2019
+ "name": "MAX_ROWS_CEILING",
2178
2020
  "declaration": {
2179
- "name": "createGenesisResourceTools",
2180
- "module": "./resource-tools"
2021
+ "name": "MAX_ROWS_CEILING",
2022
+ "module": "src/genesis/config.ts"
2181
2023
  }
2182
2024
  },
2183
2025
  {
2184
2026
  "kind": "js",
2185
- "name": "GENESIS_DATA_SOURCE",
2027
+ "name": "toolNameOf",
2186
2028
  "declaration": {
2187
- "name": "GENESIS_DATA_SOURCE",
2188
- "module": "./resource-tools"
2029
+ "name": "toolNameOf",
2030
+ "module": "src/genesis/config.ts"
2189
2031
  }
2190
- },
2032
+ }
2033
+ ]
2034
+ },
2035
+ {
2036
+ "kind": "javascript-module",
2037
+ "path": "src/genesis/consumes.ts",
2038
+ "declarations": [
2039
+ {
2040
+ "kind": "variable",
2041
+ "name": "GENESIS_AI_CONSUMES",
2042
+ "type": {
2043
+ "text": "GenesisAiConsumes"
2044
+ },
2045
+ "description": "What this version of the assistant reads from a generated AI config: the resource kinds it\naccepts, the resource fields its validator or a tool reads, and the `vendor` and `tier` values\nit accepts."
2046
+ }
2047
+ ],
2048
+ "exports": [
2191
2049
  {
2192
2050
  "kind": "js",
2193
- "name": "createGenesisWriteTools",
2051
+ "name": "GenesisAiConsumes",
2194
2052
  "declaration": {
2195
- "name": "createGenesisWriteTools",
2196
- "module": "./write-tools"
2053
+ "name": "GenesisAiConsumes",
2054
+ "module": "./types"
2055
+ }
2056
+ },
2057
+ {
2058
+ "kind": "js",
2059
+ "name": "GENESIS_AI_CONSUMES",
2060
+ "declaration": {
2061
+ "name": "GENESIS_AI_CONSUMES",
2062
+ "module": "src/genesis/consumes.ts"
2063
+ }
2064
+ }
2065
+ ]
2066
+ },
2067
+ {
2068
+ "kind": "javascript-module",
2069
+ "path": "src/genesis/criteria.ts",
2070
+ "declarations": [
2071
+ {
2072
+ "kind": "function",
2073
+ "name": "dateFragment",
2074
+ "return": {
2075
+ "type": {
2076
+ "text": "string | undefined"
2077
+ }
2078
+ },
2079
+ "parameters": [
2080
+ {
2081
+ "name": "field",
2082
+ "type": {
2083
+ "text": "string"
2084
+ }
2085
+ },
2086
+ {
2087
+ "name": "op",
2088
+ "type": {
2089
+ "text": "GenesisFilterOp"
2090
+ }
2091
+ },
2092
+ {
2093
+ "name": "date",
2094
+ "type": {
2095
+ "text": "string"
2096
+ }
2097
+ }
2098
+ ]
2099
+ },
2100
+ {
2101
+ "kind": "function",
2102
+ "name": "dateTimeFragment",
2103
+ "return": {
2104
+ "type": {
2105
+ "text": "string | undefined"
2106
+ }
2107
+ },
2108
+ "parameters": [
2109
+ {
2110
+ "name": "field",
2111
+ "type": {
2112
+ "text": "string"
2113
+ }
2114
+ },
2115
+ {
2116
+ "name": "op",
2117
+ "type": {
2118
+ "text": "GenesisFilterOp"
2119
+ }
2120
+ },
2121
+ {
2122
+ "name": "bound",
2123
+ "type": {
2124
+ "text": "string"
2125
+ }
2126
+ }
2127
+ ],
2128
+ "description": "Timestamp columns get the dateTime helpers, which take a `yyyyMMdd-HH:mm:ss` bound."
2129
+ }
2130
+ ],
2131
+ "exports": [
2132
+ {
2133
+ "kind": "js",
2134
+ "name": "dateFragment",
2135
+ "declaration": {
2136
+ "name": "dateFragment",
2137
+ "module": "src/genesis/criteria.ts"
2138
+ }
2139
+ },
2140
+ {
2141
+ "kind": "js",
2142
+ "name": "dateTimeFragment",
2143
+ "declaration": {
2144
+ "name": "dateTimeFragment",
2145
+ "module": "src/genesis/criteria.ts"
2146
+ }
2147
+ }
2148
+ ]
2149
+ },
2150
+ {
2151
+ "kind": "javascript-module",
2152
+ "path": "src/genesis/event-fields.ts",
2153
+ "declarations": [],
2154
+ "exports": []
2155
+ },
2156
+ {
2157
+ "kind": "javascript-module",
2158
+ "path": "src/genesis/filter-fields.ts",
2159
+ "declarations": [],
2160
+ "exports": []
2161
+ },
2162
+ {
2163
+ "kind": "javascript-module",
2164
+ "path": "src/genesis/index.ts",
2165
+ "declarations": [],
2166
+ "exports": [
2167
+ {
2168
+ "kind": "js",
2169
+ "name": "GENESIS_AGENT_NAME",
2170
+ "declaration": {
2171
+ "name": "GENESIS_AGENT_NAME",
2172
+ "module": "./register-genesis-assistant"
2173
+ }
2174
+ },
2175
+ {
2176
+ "kind": "js",
2177
+ "name": "registerGenesisAssistant",
2178
+ "declaration": {
2179
+ "name": "registerGenesisAssistant",
2180
+ "module": "./register-genesis-assistant"
2181
+ }
2182
+ },
2183
+ {
2184
+ "kind": "js",
2185
+ "name": "GENESIS_AI_CONSUMES",
2186
+ "declaration": {
2187
+ "name": "GENESIS_AI_CONSUMES",
2188
+ "module": "./consumes"
2189
+ }
2190
+ },
2191
+ {
2192
+ "kind": "js",
2193
+ "name": "GenesisFilter",
2194
+ "declaration": {
2195
+ "name": "GenesisFilter",
2196
+ "module": "./criteria"
2197
+ }
2198
+ },
2199
+ {
2200
+ "kind": "js",
2201
+ "name": "GenesisFilterField",
2202
+ "declaration": {
2203
+ "name": "GenesisFilterField",
2204
+ "module": "./criteria"
2205
+ }
2206
+ },
2207
+ {
2208
+ "kind": "js",
2209
+ "name": "GenesisFilterOp",
2210
+ "declaration": {
2211
+ "name": "GenesisFilterOp",
2212
+ "module": "./criteria"
2213
+ }
2214
+ },
2215
+ {
2216
+ "kind": "js",
2217
+ "name": "createGenesisResourceTools",
2218
+ "declaration": {
2219
+ "name": "createGenesisResourceTools",
2220
+ "module": "./resource-tools"
2221
+ }
2222
+ },
2223
+ {
2224
+ "kind": "js",
2225
+ "name": "GENESIS_DATA_SOURCE",
2226
+ "declaration": {
2227
+ "name": "GENESIS_DATA_SOURCE",
2228
+ "module": "./resource-tools"
2229
+ }
2230
+ },
2231
+ {
2232
+ "kind": "js",
2233
+ "name": "createGenesisWriteTools",
2234
+ "declaration": {
2235
+ "name": "createGenesisWriteTools",
2236
+ "module": "./write-tools"
2197
2237
  }
2198
2238
  },
2199
2239
  {
@@ -2316,6 +2356,14 @@
2316
2356
  "module": "./types"
2317
2357
  }
2318
2358
  },
2359
+ {
2360
+ "kind": "js",
2361
+ "name": "GenesisAiConsumes",
2362
+ "declaration": {
2363
+ "name": "GenesisAiConsumes",
2364
+ "module": "./types"
2365
+ }
2366
+ },
2319
2367
  {
2320
2368
  "kind": "js",
2321
2369
  "name": "GenesisAiResource",
@@ -2723,7 +2771,7 @@
2723
2771
  "name": "createGenesisWriteTools",
2724
2772
  "return": {
2725
2773
  "type": {
2726
- "text": "{ toolDefinitions: () => Promise<ChatToolDefinition[]>; toolHandlers: ChatToolHandlers }"
2774
+ "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 or its rowSources entry, or a modify or delete with no row source, is not among them. Their\n * metadata, read when the tools are first listed, can still withhold one.\n */\n writableEvents: readonly string[];\n}"
2727
2775
  }
2728
2776
  },
2729
2777
  "parameters": [
@@ -6312,189 +6360,453 @@
6312
6360
  },
6313
6361
  {
6314
6362
  "kind": "javascript-module",
6315
- "path": "src/state/ai-assistant-slice.ts",
6363
+ "path": "src/provider/ai-provider-switcher.ts",
6316
6364
  "declarations": [
6317
- {
6318
- "kind": "function",
6319
- "name": "createDefaultSessionState",
6320
- "return": {
6321
- "type": {
6322
- "text": "AiAssistantSessionState"
6323
- }
6324
- },
6325
- "description": "Build a fresh default session state. A factory (not just a shared const) so\neach call returns independent collections — `resetSession` can hand back a\nclean slate without aliasing the initial state's arrays."
6326
- },
6327
- {
6328
- "kind": "variable",
6329
- "name": "defaultSessionState",
6330
- "type": {
6331
- "text": "AiAssistantSessionState"
6332
- }
6333
- },
6334
6365
  {
6335
6366
  "kind": "variable",
6336
- "name": "aiAssistantSlice"
6367
+ "name": "AIProviderSwitcher",
6368
+ "description": "The DI token for the (AIProviderSwitcher:interface). Resolves a noop until the app\nregisters one."
6337
6369
  }
6338
6370
  ],
6339
6371
  "exports": [
6340
6372
  {
6341
6373
  "kind": "js",
6342
- "name": "createDefaultSessionState",
6374
+ "name": "AIProviderSwitcher",
6343
6375
  "declaration": {
6344
- "name": "createDefaultSessionState",
6345
- "module": "src/state/ai-assistant-slice.ts"
6376
+ "name": "AIProviderSwitcher",
6377
+ "module": "src/provider/ai-provider-switcher.ts"
6346
6378
  }
6347
- },
6379
+ }
6380
+ ]
6381
+ },
6382
+ {
6383
+ "kind": "javascript-module",
6384
+ "path": "src/provider/assistant-app-settings.ts",
6385
+ "declarations": [
6348
6386
  {
6349
- "kind": "js",
6350
- "name": "defaultSessionState",
6351
- "declaration": {
6352
- "name": "defaultSessionState",
6353
- "module": "src/state/ai-assistant-slice.ts"
6354
- }
6355
- },
6387
+ "kind": "variable",
6388
+ "name": "AssistantAppSettingsProvider",
6389
+ "description": "The DI token for the (AssistantAppSettingsProvider:interface). Resolves a noop\nuntil the host registers one."
6390
+ }
6391
+ ],
6392
+ "exports": [
6356
6393
  {
6357
6394
  "kind": "js",
6358
- "name": "aiAssistantSlice",
6395
+ "name": "AssistantAppSettingsProvider",
6359
6396
  "declaration": {
6360
- "name": "aiAssistantSlice",
6361
- "module": "src/state/ai-assistant-slice.ts"
6397
+ "name": "AssistantAppSettingsProvider",
6398
+ "module": "src/provider/assistant-app-settings.ts"
6362
6399
  }
6363
6400
  }
6364
6401
  ]
6365
6402
  },
6366
6403
  {
6367
6404
  "kind": "javascript-module",
6368
- "path": "src/state/debug-event-log.ts",
6405
+ "path": "src/provider/tiered-provider-switcher.ts",
6369
6406
  "declarations": [
6370
6407
  {
6371
- "kind": "variable",
6372
- "name": "META_EVENT_IMPORTANCE",
6373
- "type": {
6374
- "text": "Record<MetaEventType, MetaEventImportance>"
6375
- },
6376
- "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 'external-diagnostics.folded': 'normal',\n 'session.cleared': 'normal',\n 'session.switched': 'low',\n 'session.switch-deferred': 'low',\n 'persistence.restored': 'normal',\n 'persistence.suppressed': 'normal',\n 'persistence.not-resumable': 'normal',\n\n 'driver.wired': 'low',\n 'driver.unwired': 'low',\n 'context.updated': 'low',\n 'context.condensed': 'low',\n 'panel.toggled': 'low',\n 'persistence.toggled': 'low',\n 'persistence.saved': 'low',\n 'attachment.added': 'low',\n}",
6377
- "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."
6378
- },
6379
- {
6380
- "kind": "function",
6381
- "name": "recordMetaEvent",
6382
- "return": {
6383
- "type": {
6384
- "text": "void"
6385
- }
6386
- },
6387
- "parameters": [
6408
+ "kind": "class",
6409
+ "description": "Which cloud vendor backs the tier-shaped provider registry, plus the means to move it at\nruntime (GENC-1610).",
6410
+ "name": "TieredAIProviderSwitcher",
6411
+ "members": [
6388
6412
  {
6389
- "name": "key",
6413
+ "kind": "field",
6414
+ "name": "vendors",
6390
6415
  "type": {
6391
- "text": "string"
6392
- }
6416
+ "text": "readonly AITierVendor[]"
6417
+ },
6418
+ "readonly": true
6393
6419
  },
6394
6420
  {
6395
- "name": "type",
6421
+ "kind": "field",
6422
+ "name": "options",
6396
6423
  "type": {
6397
- "text": "MetaEventType"
6398
- }
6424
+ "text": "TieredAIProviderSwitcherOptions"
6425
+ },
6426
+ "privacy": "private",
6427
+ "readonly": true,
6428
+ "default": "options"
6399
6429
  },
6400
6430
  {
6401
- "name": "detail",
6402
- "optional": true,
6431
+ "kind": "field",
6432
+ "name": "defaultTier",
6403
6433
  "type": {
6404
- "text": "Record<string, unknown>"
6405
- }
6406
- }
6407
- ],
6408
- "description": "Append a meta event to the timeline for `key`. Once the buffer exceeds\nDEFAULT_MAX_META_EVENTS, evicts the oldest *non-`high`* event;\n`high`-importance events are never evicted. An empty `key` is bucketed under\n`''`, matching how drivers/stores handle an absent session identity, so\ncallers never need to guard."
6409
- },
6410
- {
6411
- "kind": "function",
6412
- "name": "recordTurnError",
6413
- "return": {
6414
- "type": {
6415
- "text": "void"
6416
- }
6417
- },
6418
- "parameters": [
6434
+ "text": "AITierId"
6435
+ },
6436
+ "privacy": "private",
6437
+ "readonly": true
6438
+ },
6419
6439
  {
6420
- "name": "key",
6440
+ "kind": "field",
6441
+ "name": "registry",
6421
6442
  "type": {
6422
- "text": "string"
6423
- }
6443
+ "text": "MutableAIProviderRegistry"
6444
+ },
6445
+ "privacy": "private",
6446
+ "readonly": true
6424
6447
  },
6425
6448
  {
6426
- "name": "reason",
6449
+ "kind": "field",
6450
+ "name": "listeners",
6451
+ "privacy": "private",
6452
+ "readonly": true,
6453
+ "default": "new Set<(vendor: AITierVendor) => void>()"
6454
+ },
6455
+ {
6456
+ "kind": "field",
6457
+ "name": "_vendor",
6427
6458
  "type": {
6428
- "text": "TurnFailureReason"
6429
- }
6459
+ "text": "AITierVendor"
6460
+ },
6461
+ "privacy": "private"
6430
6462
  },
6431
6463
  {
6432
- "name": "detail",
6433
- "optional": true,
6464
+ "kind": "field",
6465
+ "name": "vendor",
6434
6466
  "type": {
6435
- "text": "Record<string, unknown>"
6436
- }
6467
+ "text": "AITierVendor"
6468
+ },
6469
+ "readonly": true
6470
+ },
6471
+ {
6472
+ "kind": "method",
6473
+ "name": "switchTo",
6474
+ "return": {
6475
+ "type": {
6476
+ "text": "void"
6477
+ }
6478
+ },
6479
+ "parameters": [
6480
+ {
6481
+ "name": "vendor",
6482
+ "type": {
6483
+ "text": "string"
6484
+ }
6485
+ }
6486
+ ],
6487
+ "description": "A user-driven switch: move the registry, then tell the app so it can persist the choice.\nAn unknown vendor is ignored."
6488
+ },
6489
+ {
6490
+ "kind": "method",
6491
+ "name": "adoptPersistedVendor",
6492
+ "return": {
6493
+ "type": {
6494
+ "text": "void"
6495
+ }
6496
+ },
6497
+ "parameters": [
6498
+ {
6499
+ "name": "vendor",
6500
+ "type": {
6501
+ "text": "string"
6502
+ }
6503
+ }
6504
+ ],
6505
+ "description": "Adopt a vendor the app read back from its own store — the same registry move as\nTieredAIProviderSwitcher.switchTo, without the `onSwitch` callback, because this\nvalue came FROM the store and writing it back would be a pointless round-trip on load.\n\nExists because registration has to stay synchronous: an element that connects before the\ntoken is registered caches the platform's no-op fallback, so an app cannot await its\nstored preference before constructing this. It boots on `initialVendor` and adopts the\nstored one a moment later, through a registry that is mutable and held by reference."
6506
+ },
6507
+ {
6508
+ "kind": "method",
6509
+ "name": "subscribe",
6510
+ "return": {
6511
+ "type": {
6512
+ "text": "() => void"
6513
+ }
6514
+ },
6515
+ "parameters": [
6516
+ {
6517
+ "name": "listener",
6518
+ "type": {
6519
+ "text": "(vendor: string) => void"
6520
+ }
6521
+ }
6522
+ ]
6523
+ },
6524
+ {
6525
+ "kind": "method",
6526
+ "name": "apply",
6527
+ "privacy": "private",
6528
+ "return": {
6529
+ "type": {
6530
+ "text": "void"
6531
+ }
6532
+ },
6533
+ "parameters": [
6534
+ {
6535
+ "name": "vendor",
6536
+ "type": {
6537
+ "text": "AITierVendor"
6538
+ }
6539
+ }
6540
+ ],
6541
+ "description": "The registry move both entry points share, and nothing else."
6542
+ },
6543
+ {
6544
+ "kind": "method",
6545
+ "name": "build",
6546
+ "privacy": "private",
6547
+ "return": {
6548
+ "type": {
6549
+ "text": "Record<string, AIProvider>"
6550
+ }
6551
+ },
6552
+ "parameters": [
6553
+ {
6554
+ "name": "vendor",
6555
+ "type": {
6556
+ "text": "AITierVendor"
6557
+ }
6558
+ }
6559
+ ]
6560
+ },
6561
+ {
6562
+ "kind": "method",
6563
+ "name": "isKnownVendor",
6564
+ "privacy": "private",
6565
+ "return": {
6566
+ "type": {
6567
+ "text": "vendor is AITierVendor"
6568
+ }
6569
+ },
6570
+ "parameters": [
6571
+ {
6572
+ "name": "vendor",
6573
+ "type": {
6574
+ "text": "string"
6575
+ }
6576
+ }
6577
+ ]
6437
6578
  }
6438
- ],
6439
- "description": "Record a turn-ending failure (`turn.error`, importance `high`). The `reason`\nis typed so the high-importance triage surface stays consistent; pass any\ndiagnostic specifics (attempt counts, offending tool names, etc.) in `detail`."
6579
+ ]
6440
6580
  },
6441
6581
  {
6442
6582
  "kind": "function",
6443
- "name": "recordTurnRetry",
6583
+ "name": "registerTieredAIProviders",
6444
6584
  "return": {
6445
6585
  "type": {
6446
- "text": "void"
6586
+ "text": "TieredAIProviderSwitcher"
6447
6587
  }
6448
6588
  },
6449
6589
  "parameters": [
6450
6590
  {
6451
- "name": "key",
6452
- "type": {
6453
- "text": "string"
6454
- }
6455
- },
6456
- {
6457
- "name": "reason",
6591
+ "name": "container",
6458
6592
  "type": {
6459
- "text": "TurnFailureReason"
6593
+ "text": "Container"
6460
6594
  }
6461
6595
  },
6462
6596
  {
6463
- "name": "detail",
6464
- "optional": true,
6597
+ "name": "options",
6465
6598
  "type": {
6466
- "text": "Record<string, unknown>"
6599
+ "text": "Omit<TieredAIProviderSwitcherOptions, 'container'>"
6467
6600
  }
6468
6601
  }
6469
6602
  ],
6470
- "description": "Record a recoverable retry *within* a turn (`turn.retry`, importance `normal`)\n— e.g. one malformed/empty attempt that will be retried, as distinct from the\nfinal attempt that bails out as a `turn.error`. Include `attempt`/`maxAttempts`\nin `detail` so the timeline shows which try this was."
6603
+ "description": "Build a TieredAIProviderSwitcher — which registers the tier-shaped provider\nregistry — and put it on the (AIProviderSwitcher:variable) token. Call once at app\nbootstrap."
6604
+ }
6605
+ ],
6606
+ "exports": [
6607
+ {
6608
+ "kind": "js",
6609
+ "name": "TieredAIProviderSwitcher",
6610
+ "declaration": {
6611
+ "name": "TieredAIProviderSwitcher",
6612
+ "module": "src/provider/tiered-provider-switcher.ts"
6613
+ }
6471
6614
  },
6615
+ {
6616
+ "kind": "js",
6617
+ "name": "registerTieredAIProviders",
6618
+ "declaration": {
6619
+ "name": "registerTieredAIProviders",
6620
+ "module": "src/provider/tiered-provider-switcher.ts"
6621
+ }
6622
+ }
6623
+ ]
6624
+ },
6625
+ {
6626
+ "kind": "javascript-module",
6627
+ "path": "src/state/ai-assistant-slice.ts",
6628
+ "declarations": [
6472
6629
  {
6473
6630
  "kind": "function",
6474
- "name": "getMetaEvents",
6631
+ "name": "createDefaultSessionState",
6475
6632
  "return": {
6476
6633
  "type": {
6477
- "text": "ReadonlyArray<MetaEvent>"
6634
+ "text": "AiAssistantSessionState"
6478
6635
  }
6479
6636
  },
6480
- "parameters": [
6481
- {
6482
- "name": "key",
6483
- "type": {
6484
- "text": "string"
6485
- }
6486
- }
6487
- ],
6488
- "description": "Returns the meta-event timeline for `key`, or an empty array if none recorded."
6637
+ "description": "Build a fresh default session state. A factory (not just a shared const) so\neach call returns independent collections — `resetSession` can hand back a\nclean slate without aliasing the initial state's arrays."
6489
6638
  },
6490
6639
  {
6491
- "kind": "function",
6492
- "name": "mergeMetaEvents",
6493
- "return": {
6494
- "type": {
6495
- "text": "void"
6496
- }
6497
- },
6640
+ "kind": "variable",
6641
+ "name": "defaultSessionState",
6642
+ "type": {
6643
+ "text": "AiAssistantSessionState"
6644
+ }
6645
+ },
6646
+ {
6647
+ "kind": "variable",
6648
+ "name": "aiAssistantSlice"
6649
+ }
6650
+ ],
6651
+ "exports": [
6652
+ {
6653
+ "kind": "js",
6654
+ "name": "createDefaultSessionState",
6655
+ "declaration": {
6656
+ "name": "createDefaultSessionState",
6657
+ "module": "src/state/ai-assistant-slice.ts"
6658
+ }
6659
+ },
6660
+ {
6661
+ "kind": "js",
6662
+ "name": "defaultSessionState",
6663
+ "declaration": {
6664
+ "name": "defaultSessionState",
6665
+ "module": "src/state/ai-assistant-slice.ts"
6666
+ }
6667
+ },
6668
+ {
6669
+ "kind": "js",
6670
+ "name": "aiAssistantSlice",
6671
+ "declaration": {
6672
+ "name": "aiAssistantSlice",
6673
+ "module": "src/state/ai-assistant-slice.ts"
6674
+ }
6675
+ }
6676
+ ]
6677
+ },
6678
+ {
6679
+ "kind": "javascript-module",
6680
+ "path": "src/state/debug-event-log.ts",
6681
+ "declarations": [
6682
+ {
6683
+ "kind": "variable",
6684
+ "name": "META_EVENT_IMPORTANCE",
6685
+ "type": {
6686
+ "text": "Record<MetaEventType, MetaEventImportance>"
6687
+ },
6688
+ "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 'external-diagnostics.folded': 'normal',\n 'session.cleared': 'normal',\n 'session.switched': 'low',\n 'session.switch-deferred': 'low',\n 'persistence.restored': 'normal',\n 'persistence.suppressed': 'normal',\n 'persistence.not-resumable': 'normal',\n\n 'driver.wired': 'low',\n 'driver.unwired': 'low',\n 'context.updated': 'low',\n 'context.condensed': 'low',\n 'panel.toggled': 'low',\n 'persistence.toggled': 'low',\n 'persistence.saved': 'low',\n 'attachment.added': 'low',\n}",
6689
+ "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."
6690
+ },
6691
+ {
6692
+ "kind": "function",
6693
+ "name": "recordMetaEvent",
6694
+ "return": {
6695
+ "type": {
6696
+ "text": "void"
6697
+ }
6698
+ },
6699
+ "parameters": [
6700
+ {
6701
+ "name": "key",
6702
+ "type": {
6703
+ "text": "string"
6704
+ }
6705
+ },
6706
+ {
6707
+ "name": "type",
6708
+ "type": {
6709
+ "text": "MetaEventType"
6710
+ }
6711
+ },
6712
+ {
6713
+ "name": "detail",
6714
+ "optional": true,
6715
+ "type": {
6716
+ "text": "Record<string, unknown>"
6717
+ }
6718
+ }
6719
+ ],
6720
+ "description": "Append a meta event to the timeline for `key`. Once the buffer exceeds\nDEFAULT_MAX_META_EVENTS, evicts the oldest *non-`high`* event;\n`high`-importance events are never evicted. An empty `key` is bucketed under\n`''`, matching how drivers/stores handle an absent session identity, so\ncallers never need to guard."
6721
+ },
6722
+ {
6723
+ "kind": "function",
6724
+ "name": "recordTurnError",
6725
+ "return": {
6726
+ "type": {
6727
+ "text": "void"
6728
+ }
6729
+ },
6730
+ "parameters": [
6731
+ {
6732
+ "name": "key",
6733
+ "type": {
6734
+ "text": "string"
6735
+ }
6736
+ },
6737
+ {
6738
+ "name": "reason",
6739
+ "type": {
6740
+ "text": "TurnFailureReason"
6741
+ }
6742
+ },
6743
+ {
6744
+ "name": "detail",
6745
+ "optional": true,
6746
+ "type": {
6747
+ "text": "Record<string, unknown>"
6748
+ }
6749
+ }
6750
+ ],
6751
+ "description": "Record a turn-ending failure (`turn.error`, importance `high`). The `reason`\nis typed so the high-importance triage surface stays consistent; pass any\ndiagnostic specifics (attempt counts, offending tool names, etc.) in `detail`."
6752
+ },
6753
+ {
6754
+ "kind": "function",
6755
+ "name": "recordTurnRetry",
6756
+ "return": {
6757
+ "type": {
6758
+ "text": "void"
6759
+ }
6760
+ },
6761
+ "parameters": [
6762
+ {
6763
+ "name": "key",
6764
+ "type": {
6765
+ "text": "string"
6766
+ }
6767
+ },
6768
+ {
6769
+ "name": "reason",
6770
+ "type": {
6771
+ "text": "TurnFailureReason"
6772
+ }
6773
+ },
6774
+ {
6775
+ "name": "detail",
6776
+ "optional": true,
6777
+ "type": {
6778
+ "text": "Record<string, unknown>"
6779
+ }
6780
+ }
6781
+ ],
6782
+ "description": "Record a recoverable retry *within* a turn (`turn.retry`, importance `normal`)\n— e.g. one malformed/empty attempt that will be retried, as distinct from the\nfinal attempt that bails out as a `turn.error`. Include `attempt`/`maxAttempts`\nin `detail` so the timeline shows which try this was."
6783
+ },
6784
+ {
6785
+ "kind": "function",
6786
+ "name": "getMetaEvents",
6787
+ "return": {
6788
+ "type": {
6789
+ "text": "ReadonlyArray<MetaEvent>"
6790
+ }
6791
+ },
6792
+ "parameters": [
6793
+ {
6794
+ "name": "key",
6795
+ "type": {
6796
+ "text": "string"
6797
+ }
6798
+ }
6799
+ ],
6800
+ "description": "Returns the meta-event timeline for `key`, or an empty array if none recorded."
6801
+ },
6802
+ {
6803
+ "kind": "function",
6804
+ "name": "mergeMetaEvents",
6805
+ "return": {
6806
+ "type": {
6807
+ "text": "void"
6808
+ }
6809
+ },
6498
6810
  "parameters": [
6499
6811
  {
6500
6812
  "name": "targetKey",
@@ -6853,270 +7165,6 @@
6853
7165
  }
6854
7166
  ]
6855
7167
  },
6856
- {
6857
- "kind": "javascript-module",
6858
- "path": "src/provider/ai-provider-switcher.ts",
6859
- "declarations": [
6860
- {
6861
- "kind": "variable",
6862
- "name": "AIProviderSwitcher",
6863
- "description": "The DI token for the (AIProviderSwitcher:interface). Resolves a noop until the app\nregisters one."
6864
- }
6865
- ],
6866
- "exports": [
6867
- {
6868
- "kind": "js",
6869
- "name": "AIProviderSwitcher",
6870
- "declaration": {
6871
- "name": "AIProviderSwitcher",
6872
- "module": "src/provider/ai-provider-switcher.ts"
6873
- }
6874
- }
6875
- ]
6876
- },
6877
- {
6878
- "kind": "javascript-module",
6879
- "path": "src/provider/assistant-app-settings.ts",
6880
- "declarations": [
6881
- {
6882
- "kind": "variable",
6883
- "name": "AssistantAppSettingsProvider",
6884
- "description": "The DI token for the (AssistantAppSettingsProvider:interface). Resolves a noop\nuntil the host registers one."
6885
- }
6886
- ],
6887
- "exports": [
6888
- {
6889
- "kind": "js",
6890
- "name": "AssistantAppSettingsProvider",
6891
- "declaration": {
6892
- "name": "AssistantAppSettingsProvider",
6893
- "module": "src/provider/assistant-app-settings.ts"
6894
- }
6895
- }
6896
- ]
6897
- },
6898
- {
6899
- "kind": "javascript-module",
6900
- "path": "src/provider/tiered-provider-switcher.ts",
6901
- "declarations": [
6902
- {
6903
- "kind": "class",
6904
- "description": "Which cloud vendor backs the tier-shaped provider registry, plus the means to move it at\nruntime (GENC-1610).",
6905
- "name": "TieredAIProviderSwitcher",
6906
- "members": [
6907
- {
6908
- "kind": "field",
6909
- "name": "vendors",
6910
- "type": {
6911
- "text": "readonly AITierVendor[]"
6912
- },
6913
- "readonly": true
6914
- },
6915
- {
6916
- "kind": "field",
6917
- "name": "options",
6918
- "type": {
6919
- "text": "TieredAIProviderSwitcherOptions"
6920
- },
6921
- "privacy": "private",
6922
- "readonly": true,
6923
- "default": "options"
6924
- },
6925
- {
6926
- "kind": "field",
6927
- "name": "defaultTier",
6928
- "type": {
6929
- "text": "AITierId"
6930
- },
6931
- "privacy": "private",
6932
- "readonly": true
6933
- },
6934
- {
6935
- "kind": "field",
6936
- "name": "registry",
6937
- "type": {
6938
- "text": "MutableAIProviderRegistry"
6939
- },
6940
- "privacy": "private",
6941
- "readonly": true
6942
- },
6943
- {
6944
- "kind": "field",
6945
- "name": "listeners",
6946
- "privacy": "private",
6947
- "readonly": true,
6948
- "default": "new Set<(vendor: AITierVendor) => void>()"
6949
- },
6950
- {
6951
- "kind": "field",
6952
- "name": "_vendor",
6953
- "type": {
6954
- "text": "AITierVendor"
6955
- },
6956
- "privacy": "private"
6957
- },
6958
- {
6959
- "kind": "field",
6960
- "name": "vendor",
6961
- "type": {
6962
- "text": "AITierVendor"
6963
- },
6964
- "readonly": true
6965
- },
6966
- {
6967
- "kind": "method",
6968
- "name": "switchTo",
6969
- "return": {
6970
- "type": {
6971
- "text": "void"
6972
- }
6973
- },
6974
- "parameters": [
6975
- {
6976
- "name": "vendor",
6977
- "type": {
6978
- "text": "string"
6979
- }
6980
- }
6981
- ],
6982
- "description": "A user-driven switch: move the registry, then tell the app so it can persist the choice.\nAn unknown vendor is ignored."
6983
- },
6984
- {
6985
- "kind": "method",
6986
- "name": "adoptPersistedVendor",
6987
- "return": {
6988
- "type": {
6989
- "text": "void"
6990
- }
6991
- },
6992
- "parameters": [
6993
- {
6994
- "name": "vendor",
6995
- "type": {
6996
- "text": "string"
6997
- }
6998
- }
6999
- ],
7000
- "description": "Adopt a vendor the app read back from its own store — the same registry move as\nTieredAIProviderSwitcher.switchTo, without the `onSwitch` callback, because this\nvalue came FROM the store and writing it back would be a pointless round-trip on load.\n\nExists because registration has to stay synchronous: an element that connects before the\ntoken is registered caches the platform's no-op fallback, so an app cannot await its\nstored preference before constructing this. It boots on `initialVendor` and adopts the\nstored one a moment later, through a registry that is mutable and held by reference."
7001
- },
7002
- {
7003
- "kind": "method",
7004
- "name": "subscribe",
7005
- "return": {
7006
- "type": {
7007
- "text": "() => void"
7008
- }
7009
- },
7010
- "parameters": [
7011
- {
7012
- "name": "listener",
7013
- "type": {
7014
- "text": "(vendor: string) => void"
7015
- }
7016
- }
7017
- ]
7018
- },
7019
- {
7020
- "kind": "method",
7021
- "name": "apply",
7022
- "privacy": "private",
7023
- "return": {
7024
- "type": {
7025
- "text": "void"
7026
- }
7027
- },
7028
- "parameters": [
7029
- {
7030
- "name": "vendor",
7031
- "type": {
7032
- "text": "AITierVendor"
7033
- }
7034
- }
7035
- ],
7036
- "description": "The registry move both entry points share, and nothing else."
7037
- },
7038
- {
7039
- "kind": "method",
7040
- "name": "build",
7041
- "privacy": "private",
7042
- "return": {
7043
- "type": {
7044
- "text": "Record<string, AIProvider>"
7045
- }
7046
- },
7047
- "parameters": [
7048
- {
7049
- "name": "vendor",
7050
- "type": {
7051
- "text": "AITierVendor"
7052
- }
7053
- }
7054
- ]
7055
- },
7056
- {
7057
- "kind": "method",
7058
- "name": "isKnownVendor",
7059
- "privacy": "private",
7060
- "return": {
7061
- "type": {
7062
- "text": "vendor is AITierVendor"
7063
- }
7064
- },
7065
- "parameters": [
7066
- {
7067
- "name": "vendor",
7068
- "type": {
7069
- "text": "string"
7070
- }
7071
- }
7072
- ]
7073
- }
7074
- ]
7075
- },
7076
- {
7077
- "kind": "function",
7078
- "name": "registerTieredAIProviders",
7079
- "return": {
7080
- "type": {
7081
- "text": "TieredAIProviderSwitcher"
7082
- }
7083
- },
7084
- "parameters": [
7085
- {
7086
- "name": "container",
7087
- "type": {
7088
- "text": "Container"
7089
- }
7090
- },
7091
- {
7092
- "name": "options",
7093
- "type": {
7094
- "text": "Omit<TieredAIProviderSwitcherOptions, 'container'>"
7095
- }
7096
- }
7097
- ],
7098
- "description": "Build a TieredAIProviderSwitcher — which registers the tier-shaped provider\nregistry — and put it on the (AIProviderSwitcher:variable) token. Call once at app\nbootstrap."
7099
- }
7100
- ],
7101
- "exports": [
7102
- {
7103
- "kind": "js",
7104
- "name": "TieredAIProviderSwitcher",
7105
- "declaration": {
7106
- "name": "TieredAIProviderSwitcher",
7107
- "module": "src/provider/tiered-provider-switcher.ts"
7108
- }
7109
- },
7110
- {
7111
- "kind": "js",
7112
- "name": "registerTieredAIProviders",
7113
- "declaration": {
7114
- "name": "registerTieredAIProviders",
7115
- "module": "src/provider/tiered-provider-switcher.ts"
7116
- }
7117
- }
7118
- ]
7119
- },
7120
7168
  {
7121
7169
  "kind": "javascript-module",
7122
7170
  "path": "src/styles/ai-colours.ts",