akanjs 3.0.0-alpha.8 → 3.0.0-alpha.80

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 (832) hide show
  1. package/CHANGELOG.md +103 -0
  2. package/README.ko.md +1 -1
  3. package/README.md +1 -1
  4. package/base/baseEnv.ts +7 -4
  5. package/base/primitiveRegistry.ts +59 -12
  6. package/base/symbols.ts +4 -0
  7. package/client/capacitor.ts +34 -0
  8. package/client/clientRuntime.ts +5 -0
  9. package/client/cookie.ts +21 -34
  10. package/client/csrTypes.ts +4 -15
  11. package/client/frameConfig.ts +13 -0
  12. package/client/index.ts +1 -0
  13. package/client/locale.ts +2 -2
  14. package/client/router.ts +7 -7
  15. package/client/sharedContext.ts +31 -0
  16. package/client/translator.ts +2 -2
  17. package/client/types.ts +3 -3
  18. package/common/Logger.ts +287 -67
  19. package/common/TrustedProxy.ts +134 -0
  20. package/common/clamp.ts +2 -0
  21. package/common/clientAddress.ts +40 -0
  22. package/common/deepObjectify.ts +3 -2
  23. package/common/dynamicRecord.ts +12 -0
  24. package/common/index.ts +47 -2
  25. package/common/isValidDate.ts +1 -1
  26. package/common/logContext.ts +27 -0
  27. package/common/mcpExposure.ts +114 -0
  28. package/common/pathGetLoose.ts +31 -0
  29. package/common/plainFieldsOf.ts +13 -0
  30. package/common/requestOrigin.ts +32 -0
  31. package/common/{httpClient.ts → restClient.ts} +16 -9
  32. package/common/routeConvention.ts +22 -12
  33. package/common/websocketBinaryFrame.ts +46 -0
  34. package/constant/crystalize.ts +92 -28
  35. package/constant/dateSlot.ts +62 -0
  36. package/constant/deserialize.ts +3 -2
  37. package/constant/fieldInfo.ts +43 -3
  38. package/constant/fieldQueryMeta.ts +35 -0
  39. package/constant/getDefault.ts +16 -11
  40. package/constant/hydrationPlan.ts +72 -0
  41. package/constant/immerify.ts +4 -6
  42. package/constant/index.ts +5 -0
  43. package/constant/labelOf.ts +26 -0
  44. package/constant/mask.ts +67 -0
  45. package/constant/purify.ts +17 -11
  46. package/constant/textFieldPaths.ts +13 -7
  47. package/constant/types.ts +41 -13
  48. package/constant/via.ts +24 -17
  49. package/dictionary/DictionaryLookup.ts +30 -0
  50. package/dictionary/agent.dictionary.ts +31 -0
  51. package/dictionary/agentTurn.dictionary.ts +29 -0
  52. package/dictionary/base.dictionary.ts +85 -0
  53. package/dictionary/dictInfo.ts +11 -2
  54. package/dictionary/dictionary.ts +9 -3
  55. package/dictionary/index.ts +1 -0
  56. package/dictionary/trans.ts +26 -7
  57. package/document/dataLoader.ts +0 -4
  58. package/document/documentQuery.ts +1 -0
  59. package/document/filterMeta.ts +79 -14
  60. package/document/index.ts +1 -0
  61. package/document/loaderInfo.ts +4 -1
  62. package/document/noDocumentError.ts +12 -0
  63. package/document/types.ts +0 -1
  64. package/fetch/agentTurn.ts +19 -0
  65. package/fetch/client/fetchClient.ts +166 -89
  66. package/fetch/client/fetchHandle.ts +57 -0
  67. package/fetch/client/httpClient.ts +140 -30
  68. package/fetch/client/sliceInitHandle.ts +101 -0
  69. package/fetch/client/wsClient.ts +27 -12
  70. package/fetch/fetchType/appliedReturn.type.ts +126 -42
  71. package/fetch/fetchType/endpointFetch.type.ts +17 -8
  72. package/fetch/fetchType/sliceFetch.type.ts +30 -53
  73. package/fetch/index.ts +1 -0
  74. package/fetch/requestStorage.ts +19 -5
  75. package/index.ts +132 -8
  76. package/local/apps/akan/akan-local.db +0 -0
  77. package/local/apps/akan/akan-local.db-shm +0 -0
  78. package/local/apps/akan/akan-local.db-wal +0 -0
  79. package/local/apps/akan/akan-local_solid.db +0 -0
  80. package/local/apps/akan/akan-local_solid.db-shm +0 -0
  81. package/local/apps/akan/akan-local_solid.db-wal +0 -0
  82. package/local/apps/serverLifecycle/serverLifecycle-local.db +0 -0
  83. package/local/apps/serverLifecycle/serverLifecycle-local.db-shm +0 -0
  84. package/local/apps/serverLifecycle/serverLifecycle-local.db-wal +0 -0
  85. package/local/apps/serverLifecycle/serverLifecycle-local_solid.db +0 -0
  86. package/local/apps/serverLifecycle/serverLifecycle-local_solid.db-shm +0 -0
  87. package/local/apps/serverLifecycle/serverLifecycle-local_solid.db-wal +0 -0
  88. package/package.json +27 -18
  89. package/server/akanApp.ts +325 -157
  90. package/server/akanAppHeaders.ts +23 -3
  91. package/server/akanOption.ts +76 -8
  92. package/server/akanServer.ts +390 -32
  93. package/server/animatedImage.ts +83 -0
  94. package/server/assetEncoding.ts +4 -24
  95. package/server/binaryPubsub.ts +55 -0
  96. package/server/cachePolicy.ts +2 -11
  97. package/server/console.ts +110 -101
  98. package/server/consoleEvaluator.ts +51 -0
  99. package/server/consolePasteFilter.ts +91 -0
  100. package/server/consoleSession.ts +242 -0
  101. package/server/contentEncoding.ts +83 -0
  102. package/server/decorators.ts +12 -3
  103. package/server/devtools/constantSerializer.ts +8 -1
  104. package/server/devtools/signalSerializer.ts +2 -2
  105. package/server/devtools/types.ts +4 -4
  106. package/server/di/diLifecycle.ts +144 -14
  107. package/server/di/predefinedAdaptor.ts +6 -0
  108. package/server/di/resolveHierarchy.ts +3 -3
  109. package/server/di/utils.ts +40 -0
  110. package/server/hmr/clientScript.ts +1 -1
  111. package/server/imageOptimizer.ts +156 -74
  112. package/server/lifecycle/runtimeDir.ts +14 -0
  113. package/server/lifecycle/shutdownManager.ts +17 -2
  114. package/server/logging/childOutputReader.ts +137 -0
  115. package/server/logging/hubFileSink.ts +39 -0
  116. package/server/logging/logControlSocket.ts +173 -0
  117. package/server/logging/logForwarder.ts +131 -0
  118. package/server/logging/logHub.ts +0 -0
  119. package/server/logging/logQuery.ts +130 -0
  120. package/server/logging/logStdoutWriter.ts +39 -0
  121. package/server/logging/logStreamRoute.ts +87 -0
  122. package/server/logging/logTailClient.ts +161 -0
  123. package/server/mcp/McpAuth.ts +177 -0
  124. package/server/mcp/McpDispatcher.ts +295 -0
  125. package/server/mcp/McpEventStream.ts +24 -0
  126. package/server/mcp/McpExecutionContext.ts +105 -0
  127. package/server/mcp/McpRouter.ts +621 -0
  128. package/server/mcp/index.ts +5 -0
  129. package/server/processMetricsCollector.ts +1 -1
  130. package/server/resolver/database.resolver.ts +18 -12
  131. package/server/resolver/signal.resolver.ts +211 -89
  132. package/server/routeTreeBuilder.ts +11 -23
  133. package/server/routing/apiRouter.ts +45 -16
  134. package/server/routing/appWsData.ts +30 -5
  135. package/server/routing/eventStream.ts +93 -0
  136. package/server/routing/soloAppRoutes.ts +50 -0
  137. package/server/rscWorker.tsx +63 -22
  138. package/server/rscWorkerHost.ts +59 -8
  139. package/server/semaphore.ts +22 -0
  140. package/server/ssrFromRscRenderer.tsx +50 -0
  141. package/server/staticPath.ts +34 -0
  142. package/server/subRouteIndexDocument.tsx +61 -0
  143. package/server/systemPageDocument.tsx +3 -3
  144. package/server/systemPages.tsx +49 -16
  145. package/server/types.tsx +28 -0
  146. package/server/vendor/akanjs-fetch.ts +1 -0
  147. package/server/webRouter.ts +130 -73
  148. package/service/adapt.ts +5 -9
  149. package/service/agent.service.ts +81 -0
  150. package/service/base.service.ts +2 -1
  151. package/service/index.ts +1 -0
  152. package/service/injectInfo.ts +8 -3
  153. package/service/ipcTypes.ts +6 -0
  154. package/service/predefinedAdaptor/cache.adaptor.ts +8 -4
  155. package/service/predefinedAdaptor/compress.adaptor.ts +5 -1
  156. package/service/predefinedAdaptor/database.adaptor.ts +59 -1757
  157. package/service/predefinedAdaptor/deepseekLlm.ts +271 -0
  158. package/service/predefinedAdaptor/index.ts +3 -0
  159. package/service/predefinedAdaptor/insightQuery.ts +183 -0
  160. package/service/predefinedAdaptor/llm.adaptor.ts +115 -0
  161. package/service/predefinedAdaptor/logging.adaptor.ts +1 -1
  162. package/service/predefinedAdaptor/queue.adaptor.ts +5 -2
  163. package/service/predefinedAdaptor/role.adaptor.ts +2 -0
  164. package/service/predefinedAdaptor/schedule.adaptor.ts +12 -5
  165. package/service/predefinedAdaptor/solidPubsub.adaptor.ts +10 -6
  166. package/service/predefinedAdaptor/solidQueue.adaptor.ts +6 -2
  167. package/service/predefinedAdaptor/solidSqlite.ts +11 -9
  168. package/service/predefinedAdaptor/sql/PendingStoreEnsures.ts +22 -0
  169. package/service/predefinedAdaptor/sql/QueryCompiler.ts +225 -0
  170. package/service/predefinedAdaptor/sql/SqlDocumentStore.ts +812 -0
  171. package/service/predefinedAdaptor/sql/UpdateCompiler.ts +67 -0
  172. package/service/predefinedAdaptor/sql/dialect/postgres.ts +151 -0
  173. package/service/predefinedAdaptor/sql/dialect/sqlite.ts +134 -0
  174. package/service/predefinedAdaptor/sql/driver/bunSqlite.ts +29 -0
  175. package/service/predefinedAdaptor/sql/driver/libsql.ts +37 -0
  176. package/service/predefinedAdaptor/sql/driver/postgres.ts +42 -0
  177. package/service/predefinedAdaptor/sql/types.ts +251 -0
  178. package/service/predefinedAdaptor/sql/values.ts +91 -0
  179. package/service/predefinedAdaptor/websocket.adaptor.ts +6 -1
  180. package/service/serve.ts +16 -9
  181. package/service/toolNames.ts +119 -0
  182. package/signal/CrossSiteGuard.ts +71 -0
  183. package/signal/SignalFailure.ts +51 -0
  184. package/signal/agent/AgentCatalogue.ts +165 -0
  185. package/signal/agent/index.ts +1 -0
  186. package/signal/agent.signal.ts +38 -0
  187. package/signal/agentTurn.ts +8 -0
  188. package/signal/agentTurnStream.ts +60 -0
  189. package/signal/base.signal.ts +2 -1
  190. package/signal/endpoint.ts +2 -2
  191. package/signal/endpointInfo.ts +38 -2
  192. package/signal/exception.ts +43 -6
  193. package/signal/guard.ts +28 -1
  194. package/signal/guards.ts +49 -1
  195. package/signal/index.ts +8 -0
  196. package/signal/intercept.ts +9 -6
  197. package/signal/internal.ts +10 -2
  198. package/signal/internalArg.ts +21 -4
  199. package/signal/mcp/McpDocument.ts +326 -0
  200. package/signal/mcp/McpProgress.ts +106 -0
  201. package/signal/mcp/McpUriTemplate.ts +80 -0
  202. package/signal/mcp/Msg.ts +368 -0
  203. package/signal/mcp/index.ts +5 -0
  204. package/signal/mcp/mcpProtocol.ts +120 -0
  205. package/signal/middleware.ts +3 -3
  206. package/signal/openapi/openapi.ts +36 -173
  207. package/signal/schema/JsonSchemaBuilder.ts +221 -0
  208. package/signal/schema/index.ts +1 -0
  209. package/signal/serializer/fetch.serializer.ts +62 -1
  210. package/signal/signalContext.ts +339 -94
  211. package/signal/slice.ts +63 -28
  212. package/signal/trace.ts +268 -9
  213. package/signal/types.ts +55 -4
  214. package/store/SliceRequest.ts +23 -0
  215. package/store/action.ts +210 -154
  216. package/store/actionTag.ts +33 -0
  217. package/store/agent/AgentBridge.ts +89 -0
  218. package/store/agent/AgentContext.ts +71 -0
  219. package/store/agent/AgentPrompts.ts +111 -0
  220. package/store/agent/ScreenReader.ts +349 -0
  221. package/store/agent/ScreenSettle.ts +45 -0
  222. package/store/agent/ScreenTarget.ts +135 -0
  223. package/store/agent/StoreCatalogue.ts +116 -0
  224. package/store/agent/StoreSurfaceSource.ts +225 -0
  225. package/store/agent/index.ts +13 -0
  226. package/store/agent/storeSurface.ts +28 -0
  227. package/store/agent/types.ts +16 -0
  228. package/store/agentic/AgentValue.ts +119 -0
  229. package/store/agentic/StExposeBuilder.ts +50 -0
  230. package/store/agentic/StExposeDraft.ts +24 -0
  231. package/store/agentic/StStateBuilder.ts +90 -0
  232. package/store/agentic/StStateDraft.ts +23 -0
  233. package/store/agentic/StToolBuilder.ts +293 -0
  234. package/store/agentic/StToolDraft.ts +22 -0
  235. package/store/agentic/attachAgentic.ts +33 -0
  236. package/store/agentic/formFields.ts +194 -0
  237. package/store/agentic/index.ts +12 -0
  238. package/store/agentic/useFieldTool.ts +183 -0
  239. package/store/agentic/useFormTools.ts +77 -0
  240. package/store/agentic/useRelationFieldTool.ts +113 -0
  241. package/store/baseSt.ts +1 -1
  242. package/store/databaseStateNames.ts +31 -0
  243. package/store/formSetterNames.ts +35 -0
  244. package/store/index.ts +8 -0
  245. package/store/rootStore.ts +3 -1
  246. package/store/sliceRole.ts +36 -0
  247. package/store/state.ts +2 -12
  248. package/store/store.ts +10 -1
  249. package/store/storeInstance.ts +185 -22
  250. package/store/storeRegistry.ts +40 -2
  251. package/store/types.ts +5 -0
  252. package/store/withSelector.ts +5 -4
  253. package/test/index.ts +1 -1
  254. package/test/registerDom.ts +4 -0
  255. package/test/sampleOf.ts +2 -0
  256. package/test/signalTestRuntime.ts +5 -5
  257. package/test/testServer.ts +14 -11
  258. package/types/base/baseEnv.d.ts +1 -1
  259. package/types/base/primitiveRegistry.d.ts +20 -8
  260. package/types/base/symbols.d.ts +4 -0
  261. package/types/client/capacitor.d.ts +39 -0
  262. package/types/client/clientRuntime.d.ts +7 -0
  263. package/types/client/cookie.d.ts +13 -2
  264. package/types/client/csrTypes.d.ts +0 -1
  265. package/types/client/frameConfig.d.ts +1 -0
  266. package/types/client/index.d.ts +1 -0
  267. package/types/client/sharedContext.d.ts +21 -0
  268. package/types/client/types.d.ts +5 -3
  269. package/types/common/Logger.d.ts +88 -6
  270. package/types/common/TrustedProxy.d.ts +24 -0
  271. package/types/common/clamp.d.ts +2 -0
  272. package/types/common/clientAddress.d.ts +19 -0
  273. package/types/common/dynamicRecord.d.ts +14 -0
  274. package/types/common/index.d.ts +13 -3
  275. package/types/common/logContext.d.ts +17 -0
  276. package/types/common/mcpExposure.d.ts +64 -0
  277. package/types/common/pathGetLoose.d.ts +8 -0
  278. package/types/common/plainFieldsOf.d.ts +6 -0
  279. package/types/common/requestOrigin.d.ts +14 -0
  280. package/types/common/restClient.d.ts +27 -0
  281. package/types/common/routeConvention.d.ts +6 -0
  282. package/types/common/websocketBinaryFrame.d.ts +17 -0
  283. package/types/constant/constantRegistry.d.ts +2 -10
  284. package/types/constant/crystalize.d.ts +5 -0
  285. package/types/constant/dateSlot.d.ts +14 -0
  286. package/types/constant/fieldInfo.d.ts +20 -3
  287. package/types/constant/fieldQueryMeta.d.ts +17 -0
  288. package/types/constant/getDefault.d.ts +8 -0
  289. package/types/constant/hydrationPlan.d.ts +24 -0
  290. package/types/constant/index.d.ts +5 -0
  291. package/types/constant/labelOf.d.ts +7 -0
  292. package/types/constant/mask.d.ts +41 -0
  293. package/types/constant/purify.d.ts +2 -2
  294. package/types/constant/types.d.ts +18 -5
  295. package/types/dictionary/DictionaryLookup.d.ts +14 -0
  296. package/types/dictionary/agent.dictionary.d.ts +1 -0
  297. package/types/dictionary/agentTurn.dictionary.d.ts +1 -0
  298. package/types/dictionary/base.dictionary.d.ts +1 -1
  299. package/types/dictionary/dictInfo.d.ts +7 -1
  300. package/types/dictionary/dictionary.d.ts +11 -9
  301. package/types/dictionary/index.d.ts +1 -0
  302. package/types/document/dataLoader.d.ts +0 -3
  303. package/types/document/filterMeta.d.ts +26 -6
  304. package/types/document/index.d.ts +1 -0
  305. package/types/document/loaderInfo.d.ts +2 -2
  306. package/types/document/noDocumentError.d.ts +12 -0
  307. package/types/document/types.d.ts +0 -1
  308. package/types/fetch/agentTurn.d.ts +475 -0
  309. package/types/fetch/client/fetchClient.d.ts +12 -0
  310. package/types/fetch/client/fetchHandle.d.ts +24 -0
  311. package/types/fetch/client/httpClient.d.ts +10 -4
  312. package/types/fetch/client/sliceInitHandle.d.ts +29 -0
  313. package/types/fetch/fetchType/appliedReturn.type.d.ts +71 -15
  314. package/types/fetch/fetchType/endpointFetch.type.d.ts +8 -5
  315. package/types/fetch/fetchType/sliceFetch.type.d.ts +14 -18
  316. package/types/fetch/index.d.ts +1 -0
  317. package/types/fetch/requestStorage.d.ts +14 -0
  318. package/types/index.d.ts +124 -12
  319. package/types/server/akanApp.d.ts +12 -0
  320. package/types/server/akanAppHeaders.d.ts +7 -1
  321. package/types/server/akanOption.d.ts +43 -6
  322. package/types/server/akanServer.d.ts +67 -9
  323. package/types/server/animatedImage.d.ts +7 -0
  324. package/types/server/assetEncoding.d.ts +1 -1
  325. package/types/server/binaryPubsub.d.ts +18 -0
  326. package/types/server/console.d.ts +11 -1
  327. package/types/server/consoleEvaluator.d.ts +2 -0
  328. package/types/server/consolePasteFilter.d.ts +11 -0
  329. package/types/server/consoleSession.d.ts +22 -0
  330. package/types/server/contentEncoding.d.ts +28 -0
  331. package/types/server/decorators.d.ts +12 -2
  332. package/types/server/devtools/types.d.ts +4 -4
  333. package/types/server/di/diLifecycle.d.ts +19 -3
  334. package/types/server/di/predefinedAdaptor.d.ts +4 -1
  335. package/types/server/di/utils.d.ts +16 -0
  336. package/types/server/lifecycle/runtimeDir.d.ts +5 -0
  337. package/types/server/lifecycle/shutdownManager.d.ts +2 -1
  338. package/types/server/logging/childOutputReader.d.ts +40 -0
  339. package/types/server/logging/hubFileSink.d.ts +18 -0
  340. package/types/server/logging/logControlSocket.d.ts +60 -0
  341. package/types/server/logging/logForwarder.d.ts +37 -0
  342. package/types/server/logging/logHub.d.ts +70 -0
  343. package/types/server/logging/logQuery.d.ts +31 -0
  344. package/types/server/logging/logStdoutWriter.d.ts +35 -0
  345. package/types/server/logging/logStreamRoute.d.ts +20 -0
  346. package/types/server/logging/logTailClient.d.ts +42 -0
  347. package/types/server/mcp/McpAuth.d.ts +62 -0
  348. package/types/server/mcp/McpDispatcher.d.ts +61 -0
  349. package/types/server/mcp/McpEventStream.d.ts +17 -0
  350. package/types/server/mcp/McpExecutionContext.d.ts +44 -0
  351. package/types/server/mcp/McpRouter.d.ts +65 -0
  352. package/types/server/mcp/index.d.ts +5 -0
  353. package/types/server/mcp.d.ts +1 -0
  354. package/types/server/resolver/signal.resolver.d.ts +7 -4
  355. package/types/server/routeTreeBuilder.d.ts +1 -2
  356. package/types/server/routing/apiRouter.d.ts +2 -1
  357. package/types/server/routing/appWsData.d.ts +19 -3
  358. package/types/server/routing/eventStream.d.ts +23 -0
  359. package/types/server/routing/soloAppRoutes.d.ts +17 -0
  360. package/types/server/rscWorkerHost.d.ts +4 -1
  361. package/types/server/semaphore.d.ts +5 -0
  362. package/types/server/ssrFromRscRenderer.d.ts +14 -0
  363. package/types/server/staticPath.d.ts +17 -0
  364. package/types/server/subRouteIndexDocument.d.ts +8 -0
  365. package/types/server/systemPageDocument.d.ts +1 -0
  366. package/types/server/systemPages.d.ts +5 -0
  367. package/types/server/types.d.ts +16 -0
  368. package/types/server/vendor/akanjs-fetch.d.ts +1 -0
  369. package/types/server/webRouter.d.ts +15 -4
  370. package/types/service/adapt.d.ts +3 -3
  371. package/types/service/agent.service.d.ts +32 -0
  372. package/types/service/base.service.d.ts +4 -0
  373. package/types/service/index.d.ts +1 -0
  374. package/types/service/injectInfo.d.ts +2 -2
  375. package/types/service/ipcTypes.d.ts +12 -0
  376. package/types/service/predefinedAdaptor/compress.adaptor.d.ts +1 -1
  377. package/types/service/predefinedAdaptor/database.adaptor.d.ts +16 -402
  378. package/types/service/predefinedAdaptor/deepseekLlm.d.ts +76 -0
  379. package/types/service/predefinedAdaptor/index.d.ts +3 -0
  380. package/types/service/predefinedAdaptor/insightQuery.d.ts +50 -0
  381. package/types/service/predefinedAdaptor/llm.adaptor.d.ts +105 -0
  382. package/types/service/predefinedAdaptor/queue.adaptor.d.ts +3 -2
  383. package/types/service/predefinedAdaptor/role.adaptor.d.ts +2 -0
  384. package/types/service/predefinedAdaptor/schedule.adaptor.d.ts +10 -6
  385. package/types/service/predefinedAdaptor/solidQueue.adaptor.d.ts +6 -2
  386. package/types/service/predefinedAdaptor/solidSqlite.d.ts +2 -2
  387. package/types/service/predefinedAdaptor/sql/PendingStoreEnsures.d.ts +6 -0
  388. package/types/service/predefinedAdaptor/sql/QueryCompiler.d.ts +28 -0
  389. package/types/service/predefinedAdaptor/sql/SqlDocumentStore.d.ts +127 -0
  390. package/types/service/predefinedAdaptor/sql/UpdateCompiler.d.ts +17 -0
  391. package/types/service/predefinedAdaptor/sql/dialect/postgres.d.ts +27 -0
  392. package/types/service/predefinedAdaptor/sql/dialect/sqlite.d.ts +27 -0
  393. package/types/service/predefinedAdaptor/sql/driver/bunSqlite.d.ts +16 -0
  394. package/types/service/predefinedAdaptor/sql/driver/libsql.d.ts +17 -0
  395. package/types/service/predefinedAdaptor/sql/driver/postgres.d.ts +17 -0
  396. package/types/service/predefinedAdaptor/sql/types.d.ts +226 -0
  397. package/types/service/predefinedAdaptor/sql/values.d.ts +13 -0
  398. package/types/service/serve.d.ts +3 -3
  399. package/types/service/toolNames.d.ts +35 -0
  400. package/types/signal/CrossSiteGuard.d.ts +44 -0
  401. package/types/signal/SignalFailure.d.ts +28 -0
  402. package/types/signal/agent/AgentCatalogue.d.ts +100 -0
  403. package/types/signal/agent/index.d.ts +1 -0
  404. package/types/signal/agent.d.ts +1 -0
  405. package/types/signal/agent.signal.d.ts +24 -0
  406. package/types/signal/agentTurn.d.ts +9 -0
  407. package/types/signal/agentTurnStream.d.ts +24 -0
  408. package/types/signal/base.signal.d.ts +1 -1
  409. package/types/signal/endpointInfo.d.ts +21 -3
  410. package/types/signal/exception.d.ts +38 -54774
  411. package/types/signal/guard.d.ts +12 -0
  412. package/types/signal/guards.d.ts +23 -1
  413. package/types/signal/index.d.ts +8 -0
  414. package/types/signal/intercept.d.ts +5 -5
  415. package/types/signal/internal.d.ts +5 -1
  416. package/types/signal/internalArg.d.ts +22 -6
  417. package/types/signal/mcp/McpDocument.d.ts +84 -0
  418. package/types/signal/mcp/McpProgress.d.ts +40 -0
  419. package/types/signal/mcp/McpUriTemplate.d.ts +25 -0
  420. package/types/signal/mcp/Msg.d.ts +143 -0
  421. package/types/signal/mcp/index.d.ts +5 -0
  422. package/types/signal/mcp/mcpProtocol.d.ts +107 -0
  423. package/types/signal/mcp.d.ts +1 -0
  424. package/types/signal/middleware.d.ts +7 -7
  425. package/types/signal/openapi/openapi.d.ts +3 -3
  426. package/types/signal/schema/JsonSchemaBuilder.d.ts +51 -0
  427. package/types/signal/schema/index.d.ts +1 -0
  428. package/types/signal/schema.d.ts +1 -0
  429. package/types/signal/serializer/fetch.serializer.d.ts +7 -1
  430. package/types/signal/signalContext.d.ts +67 -8
  431. package/types/signal/slice.d.ts +42 -15
  432. package/types/signal/trace.d.ts +52 -2
  433. package/types/signal/types.d.ts +53 -4
  434. package/types/store/SliceRequest.d.ts +16 -0
  435. package/types/store/action.d.ts +7 -5
  436. package/types/store/actionTag.d.ts +21 -0
  437. package/types/store/agent/AgentBridge.d.ts +37 -0
  438. package/types/store/agent/AgentContext.d.ts +16 -0
  439. package/types/store/agent/AgentPrompts.d.ts +31 -0
  440. package/types/store/agent/ScreenReader.d.ts +29 -0
  441. package/types/store/agent/ScreenSettle.d.ts +22 -0
  442. package/types/store/agent/ScreenTarget.d.ts +34 -0
  443. package/types/store/agent/StoreCatalogue.d.ts +26 -0
  444. package/types/store/agent/StoreSurfaceSource.d.ts +30 -0
  445. package/types/store/agent/index.d.ts +11 -0
  446. package/types/store/agent/storeSurface.d.ts +14 -0
  447. package/types/store/agent/types.d.ts +15 -0
  448. package/types/store/agent.d.ts +1 -0
  449. package/types/store/agentic/AgentValue.d.ts +43 -0
  450. package/types/store/agentic/StExposeBuilder.d.ts +21 -0
  451. package/types/store/agentic/StExposeDraft.d.ts +13 -0
  452. package/types/store/agentic/StStateBuilder.d.ts +21 -0
  453. package/types/store/agentic/StStateDraft.d.ts +12 -0
  454. package/types/store/agentic/StToolBuilder.d.ts +65 -0
  455. package/types/store/agentic/StToolDraft.d.ts +13 -0
  456. package/types/store/agentic/attachAgentic.d.ts +25 -0
  457. package/types/store/agentic/formFields.d.ts +53 -0
  458. package/types/store/agentic/index.d.ts +12 -0
  459. package/types/store/agentic/useFieldTool.d.ts +22 -0
  460. package/types/store/agentic/useFormTools.d.ts +19 -0
  461. package/types/store/agentic/useRelationFieldTool.d.ts +27 -0
  462. package/types/store/agentic.d.ts +1 -0
  463. package/types/store/baseSt.d.ts +35 -39
  464. package/types/store/databaseStateNames.d.ts +25 -0
  465. package/types/store/formSetterNames.d.ts +30 -0
  466. package/types/store/index.d.ts +7 -0
  467. package/types/store/rootStore.d.ts +5 -1
  468. package/types/store/sliceRole.d.ts +25 -0
  469. package/types/store/store.d.ts +5 -1
  470. package/types/store/storeInstance.d.ts +33 -1
  471. package/types/store/storeRegistry.d.ts +5 -0
  472. package/types/store/types.d.ts +4 -0
  473. package/types/store/withSelector.d.ts +5 -4
  474. package/types/test/index.d.ts +1 -1
  475. package/types/test/registerDom.d.ts +1 -0
  476. package/types/test/signalTestRuntime.d.ts +2 -3
  477. package/types/test/testServer.d.ts +6 -4
  478. package/types/ui/Agent/Approval.d.ts +8 -0
  479. package/types/ui/Agent/Attach.d.ts +16 -0
  480. package/types/ui/Agent/Bubble.d.ts +26 -0
  481. package/types/ui/Agent/Chat.d.ts +91 -0
  482. package/types/ui/Agent/ChatCommands.d.ts +34 -0
  483. package/types/ui/Agent/Composer.d.ts +23 -0
  484. package/types/ui/Agent/Context.d.ts +13 -0
  485. package/types/ui/Agent/Dock.d.ts +17 -0
  486. package/types/ui/Agent/Guide.d.ts +9 -0
  487. package/types/ui/Agent/History.d.ts +26 -0
  488. package/types/ui/Agent/Launcher.d.ts +16 -0
  489. package/types/ui/Agent/Markdown.d.ts +19 -0
  490. package/types/ui/Agent/Menu.d.ts +18 -0
  491. package/types/ui/Agent/Mic.d.ts +8 -0
  492. package/types/ui/Agent/Question.d.ts +14 -0
  493. package/types/ui/Agent/Section.d.ts +10 -0
  494. package/types/ui/Agent/Skip.d.ts +22 -0
  495. package/types/ui/Agent/StateKey.d.ts +16 -0
  496. package/types/ui/Agent/Tool.d.ts +15 -0
  497. package/types/ui/Agent/Transcript.d.ts +13 -0
  498. package/types/ui/Agent/Zone.d.ts +48 -0
  499. package/types/ui/Agent/agentSessionOf.d.ts +27 -0
  500. package/types/ui/Agent/attachment.d.ts +34 -0
  501. package/types/ui/Agent/fetchRunner.d.ts +12 -0
  502. package/types/ui/Agent/index.d.ts +19 -0
  503. package/types/ui/Agent/index_.d.ts +1 -0
  504. package/types/ui/Agent/markdownBlocks.d.ts +35 -0
  505. package/types/ui/Agent/markdownSpans.d.ts +2 -0
  506. package/types/ui/Agent/markdownTable.d.ts +16 -0
  507. package/types/ui/Agent/sessionHistory.d.ts +14 -0
  508. package/types/ui/Agent/sessionView.d.ts +15 -0
  509. package/types/ui/Agent/tokenCount.d.ts +6 -0
  510. package/types/ui/Agent/useChatAttachments.d.ts +24 -0
  511. package/types/ui/Agent/useChatVoice.d.ts +30 -0
  512. package/types/ui/Agent/useDraftRecall.d.ts +14 -0
  513. package/types/ui/Agent/useKeyboardInset.d.ts +8 -0
  514. package/types/ui/Agent/useSlashMenu.d.ts +24 -0
  515. package/types/ui/Agent/voice.d.ts +71 -0
  516. package/types/ui/Agent.d.ts +1 -0
  517. package/types/ui/Badge.d.ts +1 -1
  518. package/types/ui/Button.d.ts +1 -1
  519. package/types/ui/Constant/Graph.d.ts +10 -0
  520. package/types/ui/Constant/index.d.ts +2 -1
  521. package/types/ui/Constant/schemaGraph.d.ts +39 -0
  522. package/types/ui/Data/Dashboard.d.ts +16 -3
  523. package/types/ui/Data/Insight.d.ts +1 -1
  524. package/types/ui/Data/ListContainer.d.ts +15 -7
  525. package/types/ui/Data/QueryMaker.d.ts +45 -3
  526. package/types/ui/Data/RefPicker.d.ts +16 -0
  527. package/types/ui/Data/dataExport.d.ts +5 -0
  528. package/types/ui/Data/dataText.d.ts +6 -0
  529. package/types/ui/Data/index.d.ts +2 -0
  530. package/types/ui/Data/index_.d.ts +1 -0
  531. package/types/ui/DatePicker.d.ts +15 -11
  532. package/types/ui/Dialog/LegacyModal.d.ts +13 -0
  533. package/types/ui/Dialog/Provider.d.ts +3 -1
  534. package/types/ui/Dialog/context.d.ts +9 -1
  535. package/types/ui/Dialog/index.d.ts +1 -0
  536. package/types/ui/DraggableList.d.ts +1 -1
  537. package/types/ui/Dropdown.d.ts +5 -1
  538. package/types/ui/Field/Choice.d.ts +52 -0
  539. package/types/ui/Field/Collection.d.ts +51 -0
  540. package/types/ui/Field/DateField.d.ts +32 -0
  541. package/types/ui/Field/Label.d.ts +9 -0
  542. package/types/ui/Field/NumberField.d.ts +43 -0
  543. package/types/ui/Field/Relation.d.ts +80 -0
  544. package/types/ui/Field/Text.d.ts +101 -0
  545. package/types/ui/Field/index.d.ts +50 -0
  546. package/types/ui/Field.d.ts +1 -411
  547. package/types/ui/Layout/BottomTab.d.ts +3 -2
  548. package/types/ui/LegacyModal.d.ts +24 -0
  549. package/types/ui/Load/Edit_Client.d.ts +3 -1
  550. package/types/ui/Load/Stream.d.ts +22 -0
  551. package/types/ui/Load/index.d.ts +2 -0
  552. package/types/ui/Loading/ProgressBar.d.ts +4 -0
  553. package/types/ui/Loading/Spin.d.ts +2 -1
  554. package/types/ui/Loading/index_.d.ts +13 -0
  555. package/types/ui/Model/AdminPanel.d.ts +15 -3
  556. package/types/ui/Model/EditModal.d.ts +1 -1
  557. package/types/ui/Model/New.d.ts +3 -1
  558. package/types/ui/Model/NewWrapper.d.ts +2 -0
  559. package/types/ui/Model/NewWrapper_Client.d.ts +2 -1
  560. package/types/ui/Pagination.d.ts +2 -2
  561. package/types/ui/Radio.d.ts +1 -1
  562. package/types/ui/RecentTime.d.ts +18 -1
  563. package/types/ui/Reference/Collapse.d.ts +11 -0
  564. package/types/ui/Reference/Panel.d.ts +29 -0
  565. package/types/ui/Reference/Segmented.d.ts +17 -0
  566. package/types/ui/Reference/Summary.d.ts +13 -0
  567. package/types/ui/Reference/Toolbar.d.ts +21 -0
  568. package/types/ui/Reference/dictText.d.ts +6 -0
  569. package/types/ui/Reference/index.d.ts +7 -0
  570. package/types/ui/Reference/style.d.ts +20 -0
  571. package/types/ui/Reference.d.ts +1 -0
  572. package/types/ui/ScreenNavigator.d.ts +3 -1
  573. package/types/ui/Signal/Arg.d.ts +7 -3
  574. package/types/ui/Signal/Doc.d.ts +4 -6
  575. package/types/ui/Signal/Object.d.ts +2 -1
  576. package/types/ui/Signal/RestApi.d.ts +2 -1
  577. package/types/ui/Signal/WebSocket.d.ts +2 -1
  578. package/types/ui/Signal/endpointEntries.d.ts +20 -0
  579. package/types/ui/Signal/style.d.ts +9 -8
  580. package/types/ui/System/Client.d.ts +1 -2
  581. package/types/ui/System/Common.d.ts +3 -4
  582. package/types/ui/System/Messages.d.ts +1 -1
  583. package/types/ui/System/Root.d.ts +4 -0
  584. package/types/ui/Tab/Provider.d.ts +3 -1
  585. package/types/ui/Tab/context.d.ts +4 -2
  586. package/types/ui/ToggleSelect.d.ts +1 -0
  587. package/types/ui/UiOverride/context.d.ts +18 -1
  588. package/types/ui/agentAttrs.d.ts +14 -0
  589. package/types/ui/index.d.ts +22 -1
  590. package/types/ui/overlayLayer.d.ts +13 -0
  591. package/types/ui/overlayPosition.d.ts +28 -0
  592. package/types/ui/recipe/badgeRecipe.d.ts +2 -2
  593. package/types/ui/recipe/buttonRecipe.d.ts +2 -2
  594. package/types/vendor/use-agentic/AgentAbort.d.ts +17 -0
  595. package/types/vendor/use-agentic/AgentProgress.d.ts +27 -0
  596. package/types/vendor/use-agentic/AgentProvider.d.ts +17 -0
  597. package/types/vendor/use-agentic/AgentScope.d.ts +9 -0
  598. package/types/vendor/use-agentic/AgentSession.d.ts +163 -0
  599. package/types/vendor/use-agentic/Agentic.d.ts +21 -0
  600. package/types/vendor/use-agentic/AgenticSurface.d.ts +58 -0
  601. package/types/vendor/use-agentic/Compaction.d.ts +48 -0
  602. package/types/vendor/use-agentic/ToolOutput.d.ts +21 -0
  603. package/types/vendor/use-agentic/Transcript.d.ts +18 -0
  604. package/types/vendor/use-agentic/httpRunner.d.ts +15 -0
  605. package/types/vendor/use-agentic/index.d.ts +19 -0
  606. package/types/vendor/use-agentic/sharedContext.d.ts +15 -0
  607. package/types/vendor/use-agentic/surfaceContext.d.ts +5 -0
  608. package/types/vendor/use-agentic/types.d.ts +182 -0
  609. package/types/vendor/use-agentic/useAgent.d.ts +4 -0
  610. package/types/vendor/use-agentic/useAgentGuide.d.ts +6 -0
  611. package/types/vendor/use-agentic/useAgentResource.d.ts +12 -0
  612. package/types/vendor/use-agentic/useAgentState.d.ts +16 -0
  613. package/types/vendor/use-agentic/useAgentTool.d.ts +16 -0
  614. package/types/vendor/use-agentic.d.ts +1 -0
  615. package/types/webkit/index.d.ts +4 -0
  616. package/types/webkit/useBodyScrollLock.d.ts +2 -0
  617. package/types/webkit/useCamera.d.ts +10 -1
  618. package/types/webkit/usePageTool.d.ts +19 -0
  619. package/types/webkit/usePurchase.d.ts +4 -0
  620. package/types/webkit/useScreenScope.d.ts +25 -0
  621. package/ui/Agent/Approval.tsx +32 -0
  622. package/ui/Agent/Attach.tsx +77 -0
  623. package/ui/Agent/Bubble.tsx +192 -0
  624. package/ui/Agent/Chat.tsx +525 -0
  625. package/ui/Agent/ChatCommands.ts +141 -0
  626. package/ui/Agent/Composer.tsx +94 -0
  627. package/ui/Agent/Context.tsx +49 -0
  628. package/ui/Agent/Dock.tsx +77 -0
  629. package/ui/Agent/Guide.tsx +16 -0
  630. package/ui/Agent/History.tsx +49 -0
  631. package/ui/Agent/Launcher.tsx +60 -0
  632. package/ui/Agent/Markdown.tsx +142 -0
  633. package/ui/Agent/Menu.tsx +55 -0
  634. package/ui/Agent/Mic.tsx +27 -0
  635. package/ui/Agent/Question.tsx +63 -0
  636. package/ui/Agent/Section.tsx +24 -0
  637. package/ui/Agent/Skip.tsx +30 -0
  638. package/ui/Agent/StateKey.tsx +46 -0
  639. package/ui/Agent/Tool.tsx +59 -0
  640. package/ui/Agent/Transcript.tsx +33 -0
  641. package/ui/Agent/Zone.tsx +116 -0
  642. package/ui/Agent/agentSessionOf.ts +60 -0
  643. package/ui/Agent/attachment.ts +73 -0
  644. package/ui/Agent/fetchRunner.ts +44 -0
  645. package/ui/Agent/index.ts +27 -0
  646. package/ui/Agent/index_.tsx +4 -0
  647. package/ui/Agent/markdownBlocks.ts +137 -0
  648. package/ui/Agent/markdownSpans.tsx +49 -0
  649. package/ui/Agent/markdownTable.ts +54 -0
  650. package/ui/Agent/sessionHistory.ts +62 -0
  651. package/ui/Agent/sessionView.ts +38 -0
  652. package/ui/Agent/tokenCount.ts +10 -0
  653. package/ui/Agent/useChatAttachments.ts +84 -0
  654. package/ui/Agent/useChatVoice.ts +129 -0
  655. package/ui/Agent/useDraftRecall.ts +42 -0
  656. package/ui/Agent/useKeyboardInset.ts +26 -0
  657. package/ui/Agent/useSlashMenu.ts +58 -0
  658. package/ui/Agent/voice.ts +177 -0
  659. package/ui/Badge.tsx +1 -1
  660. package/ui/BottomSheet.tsx +32 -36
  661. package/ui/Button.tsx +3 -1
  662. package/ui/Clipboard.tsx +3 -6
  663. package/ui/Constant/Doc.tsx +265 -254
  664. package/ui/Constant/Graph.tsx +151 -0
  665. package/ui/Constant/index.ts +3 -2
  666. package/ui/Constant/schemaGraph.ts +232 -0
  667. package/ui/Data/CardList.tsx +14 -3
  668. package/ui/Data/Dashboard.tsx +70 -52
  669. package/ui/Data/Insight.tsx +18 -12
  670. package/ui/Data/Item.tsx +42 -56
  671. package/ui/Data/ListContainer.tsx +246 -132
  672. package/ui/Data/Pagination.tsx +10 -3
  673. package/ui/Data/QueryMaker.tsx +160 -11
  674. package/ui/Data/RefPicker.tsx +202 -0
  675. package/ui/Data/TableList.tsx +22 -13
  676. package/ui/Data/dataExport.ts +54 -0
  677. package/ui/Data/dataText.ts +22 -0
  678. package/ui/Data/index.ts +13 -1
  679. package/ui/Data/index_.tsx +1 -0
  680. package/ui/DatePicker.tsx +110 -128
  681. package/ui/Dialog/Close.tsx +3 -7
  682. package/ui/Dialog/LegacyModal.tsx +241 -0
  683. package/ui/Dialog/Modal.tsx +62 -195
  684. package/ui/Dialog/Provider.tsx +47 -3
  685. package/ui/Dialog/Trigger.tsx +3 -7
  686. package/ui/Dialog/context.ts +14 -2
  687. package/ui/Dialog/index.tsx +2 -0
  688. package/ui/DragAction.tsx +3 -2
  689. package/ui/DraggableList.tsx +10 -6
  690. package/ui/Dropdown.tsx +89 -27
  691. package/ui/Empty.tsx +6 -4
  692. package/ui/Field/Choice.tsx +172 -0
  693. package/ui/Field/Collection.tsx +293 -0
  694. package/ui/Field/DateField.tsx +138 -0
  695. package/ui/Field/Label.tsx +31 -0
  696. package/ui/Field/NumberField.tsx +169 -0
  697. package/ui/Field/Relation.tsx +387 -0
  698. package/ui/Field/Text.tsx +360 -0
  699. package/ui/Field/index.tsx +70 -0
  700. package/ui/Input.tsx +30 -8
  701. package/ui/KeyboardAvoiding.tsx +2 -2
  702. package/ui/Layout/BottomTab.tsx +32 -37
  703. package/ui/Layout/Sider.tsx +37 -14
  704. package/ui/LegacyModal.tsx +53 -0
  705. package/ui/Link/CsrLink.tsx +1 -1
  706. package/ui/Load/Edit.tsx +2 -2
  707. package/ui/Load/Edit_Client.tsx +11 -3
  708. package/ui/Load/Pagination.tsx +35 -28
  709. package/ui/Load/Stream.tsx +38 -0
  710. package/ui/Load/Units.tsx +76 -40
  711. package/ui/Load/View.tsx +34 -19
  712. package/ui/Load/index.ts +2 -0
  713. package/ui/Loading/Area.tsx +7 -6
  714. package/ui/Loading/Button.tsx +7 -9
  715. package/ui/Loading/Input.tsx +7 -9
  716. package/ui/Loading/ProgressBar.tsx +16 -7
  717. package/ui/Loading/Skeleton.tsx +8 -13
  718. package/ui/Loading/Spin.tsx +20 -14
  719. package/ui/Loading/index.ts +15 -0
  720. package/ui/Loading/index_.tsx +22 -0
  721. package/ui/Menu.tsx +1 -1
  722. package/ui/Model/AdminPanel.tsx +52 -12
  723. package/ui/Model/EditModal.tsx +35 -13
  724. package/ui/Model/EditWrapper.tsx +16 -4
  725. package/ui/Model/New.tsx +4 -0
  726. package/ui/Model/NewWrapper.tsx +2 -0
  727. package/ui/Model/NewWrapper_Client.tsx +20 -6
  728. package/ui/Model/Remove.tsx +18 -6
  729. package/ui/Model/RemoveWrapper.tsx +12 -2
  730. package/ui/Model/SureToRemove.tsx +18 -6
  731. package/ui/Model/ViewEditModal.tsx +64 -15
  732. package/ui/Model/ViewModal.tsx +25 -11
  733. package/ui/Model/ViewWrapper.tsx +15 -4
  734. package/ui/Model/index_.tsx +1 -1
  735. package/ui/Pagination.tsx +51 -66
  736. package/ui/Popconfirm.tsx +88 -78
  737. package/ui/Radio.tsx +53 -24
  738. package/ui/RecentTime.tsx +83 -35
  739. package/ui/Reference/Collapse.tsx +26 -0
  740. package/ui/Reference/Panel.tsx +79 -0
  741. package/ui/Reference/Segmented.tsx +41 -0
  742. package/ui/Reference/Summary.tsx +25 -0
  743. package/ui/Reference/Toolbar.tsx +44 -0
  744. package/ui/Reference/dictText.ts +9 -0
  745. package/ui/Reference/index.ts +7 -0
  746. package/ui/Reference/style.ts +45 -0
  747. package/ui/ScreenNavigator.tsx +17 -2
  748. package/ui/Select.tsx +96 -57
  749. package/ui/Signal/Arg.tsx +83 -68
  750. package/ui/Signal/Doc.tsx +163 -129
  751. package/ui/Signal/Listener.tsx +40 -29
  752. package/ui/Signal/Message.tsx +94 -142
  753. package/ui/Signal/Object.tsx +79 -57
  754. package/ui/Signal/PubSub.tsx +76 -114
  755. package/ui/Signal/Request.tsx +2 -22
  756. package/ui/Signal/Response.tsx +19 -45
  757. package/ui/Signal/RestApi.tsx +170 -200
  758. package/ui/Signal/WebSocket.tsx +29 -26
  759. package/ui/Signal/endpointEntries.ts +59 -0
  760. package/ui/Signal/makeExample.ts +10 -3
  761. package/ui/Signal/style.ts +34 -29
  762. package/ui/Switch.tsx +4 -0
  763. package/ui/System/CSR.tsx +1 -1
  764. package/ui/System/Client.tsx +31 -17
  765. package/ui/System/Common.tsx +3 -4
  766. package/ui/System/DevModeToggle.tsx +1 -1
  767. package/ui/System/Gtag.tsx +3 -3
  768. package/ui/System/Messages.tsx +52 -31
  769. package/ui/System/Reconnect.tsx +22 -56
  770. package/ui/System/Root.tsx +4 -0
  771. package/ui/System/SelectLanguage.tsx +24 -15
  772. package/ui/System/ThemeToggle.tsx +25 -13
  773. package/ui/Tab/Menu.tsx +24 -12
  774. package/ui/Tab/Menus.tsx +6 -3
  775. package/ui/Tab/Provider.tsx +30 -3
  776. package/ui/Tab/context.ts +8 -4
  777. package/ui/Table.tsx +66 -60
  778. package/ui/ToggleSelect.tsx +8 -7
  779. package/ui/Tooltip.tsx +15 -1
  780. package/ui/UiOverride/context.ts +21 -2
  781. package/ui/Unauthorized.tsx +6 -4
  782. package/ui/agentAttrs.ts +19 -0
  783. package/ui/index.ts +49 -1
  784. package/ui/overlayLayer.ts +12 -2
  785. package/ui/overlayPosition.ts +103 -0
  786. package/ui/recipe/buttonRecipe.ts +2 -2
  787. package/ui/styles.css +31 -0
  788. package/vendor/use-agentic/AgentAbort.ts +29 -0
  789. package/vendor/use-agentic/AgentProgress.ts +40 -0
  790. package/vendor/use-agentic/AgentProvider.tsx +39 -0
  791. package/vendor/use-agentic/AgentScope.tsx +20 -0
  792. package/vendor/use-agentic/AgentSession.ts +750 -0
  793. package/vendor/use-agentic/Agentic.tsx +44 -0
  794. package/vendor/use-agentic/AgenticSurface.ts +333 -0
  795. package/vendor/use-agentic/Compaction.ts +120 -0
  796. package/vendor/use-agentic/ToolOutput.ts +60 -0
  797. package/vendor/use-agentic/Transcript.ts +50 -0
  798. package/vendor/use-agentic/WIRE.md +86 -0
  799. package/vendor/use-agentic/httpRunner.ts +131 -0
  800. package/vendor/use-agentic/index.ts +20 -0
  801. package/vendor/use-agentic/sharedContext.ts +25 -0
  802. package/vendor/use-agentic/surfaceContext.ts +10 -0
  803. package/vendor/use-agentic/types.ts +192 -0
  804. package/vendor/use-agentic/useAgent.ts +18 -0
  805. package/vendor/use-agentic/useAgentGuide.ts +16 -0
  806. package/vendor/use-agentic/useAgentResource.ts +36 -0
  807. package/vendor/use-agentic/useAgentState.ts +64 -0
  808. package/vendor/use-agentic/useAgentTool.ts +55 -0
  809. package/webkit/bootCsr.tsx +10 -8
  810. package/webkit/index.ts +4 -0
  811. package/webkit/lazy.tsx +5 -1
  812. package/webkit/useBodyScrollLock.tsx +29 -0
  813. package/webkit/useCamera.tsx +22 -6
  814. package/webkit/useCodepush.tsx +2 -2
  815. package/webkit/useCsrValues.ts +1 -3
  816. package/webkit/useFetch.ts +4 -3
  817. package/webkit/useFrameRuntime.ts +15 -8
  818. package/webkit/usePageTool.tsx +37 -0
  819. package/webkit/usePurchase.tsx +4 -1
  820. package/webkit/useScreenScope.tsx +60 -0
  821. package/fetch/serializer/fetch.serializer.ts +0 -142
  822. package/fetch/serializer/index.ts +0 -1
  823. package/types/common/httpClient.d.ts +0 -20
  824. package/types/fetch/serializer/fetch.serializer.d.ts +0 -14
  825. package/types/fetch/serializer/index.d.ts +0 -1
  826. package/types/fetch/serializer.d.ts +0 -1
  827. package/types/ui/Constant/Mermaid.d.ts +0 -8
  828. package/types/ui/Signal/Collapse.d.ts +0 -12
  829. package/ui/Constant/Mermaid.tsx +0 -149
  830. package/ui/Field.tsx +0 -1569
  831. package/ui/Loading/index.tsx +0 -22
  832. package/ui/Signal/Collapse.tsx +0 -29
@@ -31,9 +31,10 @@ export const deepObjectify = <T = unknown>(obj: T | null | undefined, option: De
31
31
  } else if (obj && typeof obj === "object") {
32
32
  const val: Record<string, unknown> = {};
33
33
  const objRecord = obj as Record<string, unknown>;
34
- Object.keys(obj).forEach((key) => {
34
+
35
+ for (const key in objRecord) {
35
36
  if (typeof objRecord[key] !== "function") val[key] = objectifyChild(objRecord[key], option);
36
- });
37
+ }
37
38
  return val as T;
38
39
  } else {
39
40
  return obj as unknown as T;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * A generated surface read by a name computed at runtime.
3
+ *
4
+ * The framework's glue layers dispatch by name: a store action reaches `fetch[key]`, a resolver reaches
5
+ * `service[method]`, a `Load.*` component reads `init[names.pageOfModel]`. None of those keys exist in a type,
6
+ * because the type is generated from the model — so every one of them used to be spelled `as any`, which the
7
+ * guide bans and which also silences the *value* type on the way out.
8
+ *
9
+ * This says the same thing about the index and nothing about the value: `as DynamicRecord` to index, then the
10
+ * read carries its own `as T`. One alias so a reader can tell name-based dispatch from an untyped object.
11
+ */
12
+ export type DynamicRecord<Value = unknown> = { [key: string]: Value };
package/common/index.ts CHANGED
@@ -1,6 +1,14 @@
1
1
  export { applyMixins } from "./applyMixins";
2
2
  export { capitalize } from "./capitalize";
3
+ export { clamp } from "./clamp";
4
+ export {
5
+ clientAddressFromHeaders,
6
+ clientPortFromHeaders,
7
+ forwardedHeaders,
8
+ normalizeIpAddress,
9
+ } from "./clientAddress";
3
10
  export { deepObjectify } from "./deepObjectify";
11
+ export type { DynamicRecord } from "./dynamicRecord";
4
12
  export {
5
13
  type FileUploadCapability,
6
14
  fileUploadContract,
@@ -10,7 +18,6 @@ export { formatNumber } from "./formatNumber";
10
18
  export { formatPhone } from "./formatPhone";
11
19
  export { getAllPropertyDescriptors } from "./getAllPropertyDescriptors";
12
20
  export { type AkanHmrPhase, getAkanHmrPhase, isAkanHmrApplying } from "./hmrPhase";
13
- export { HttpClient } from "./httpClient";
14
21
  export { isDayjs } from "./isDayjs";
15
22
  export { isEmail } from "./isEmail";
16
23
  export { isPhoneNumber } from "./isPhoneNumber";
@@ -18,7 +25,22 @@ export { isQueryEqual } from "./isQueryEqual";
18
25
  export { isThenable } from "./isThenable";
19
26
  export { isValidDate } from "./isValidDate";
20
27
  export { decodeJwtPayload } from "./jwtDecode";
21
- export { Logger, type LoggerSink, type LoggerSinkEntry, type LogLevel } from "./Logger";
28
+ export {
29
+ type LogAttrs,
30
+ type LogAttrValue,
31
+ type LogFormat,
32
+ Logger,
33
+ type LoggerEmitInput,
34
+ type LoggerSink,
35
+ type LoggerSinkEntry,
36
+ type LoggerSinkOptions,
37
+ type LogLevel,
38
+ type LogLevelInput,
39
+ type LogRecord,
40
+ logFormats,
41
+ logLevels,
42
+ logSeverity,
43
+ } from "./Logger";
22
44
  export {
23
45
  type AkanI18nConfig,
24
46
  type AkanI18nConfigInput,
@@ -26,16 +48,37 @@ export {
26
48
  parseAkanI18nEnv,
27
49
  resolveAkanI18nConfig,
28
50
  } from "./localeConfig";
51
+ export {
52
+ type LogContextReader,
53
+ type LogContextSnapshot,
54
+ type LogFlightRecorder,
55
+ readLogContext,
56
+ registerLogContextReader,
57
+ } from "./logContext";
29
58
  export { lowerlize } from "./lowerlize";
59
+ export {
60
+ isMcpDescribableArg,
61
+ type McpExposureEndpoint,
62
+ type McpExposureOption,
63
+ mcpBaseVerbOf,
64
+ mcpHintsOf,
65
+ mcpPromptRefusalOf,
66
+ mcpRefusalOf,
67
+ } from "./mcpExposure";
30
68
  export { mergeVersion } from "./mergeVersion";
31
69
  export { objectify } from "./objectify";
32
70
  export { pathGet } from "./pathGet";
71
+ export { pathGetLoose } from "./pathGetLoose";
33
72
  export { pathSet } from "./pathSet";
73
+ export { plainFieldsOf } from "./plainFieldsOf";
34
74
  export { randomPick } from "./randomPick";
35
75
  export { randomPicks } from "./randomPicks";
76
+ export { isJsonContentType, originFromRequest } from "./requestOrigin";
77
+ export { RestClient, type RestClientOptions, type RestRequestOptions } from "./restClient";
36
78
  export {
37
79
  assertUniqueRoutePatterns,
38
80
  compareRouteSpecificity,
81
+ getPageSourceFileViolation,
39
82
  getRouteExports,
40
83
  isRouteSourceFile,
41
84
  isSpecialRouteLeaf,
@@ -59,9 +102,11 @@ export {
59
102
  export { sleep } from "./sleep";
60
103
  export { splitVersion } from "./splitVersion";
61
104
  export { getBasePathFromPathname, parseBasePaths, parseSubRouteHosts, resolveSubRouteHosts } from "./subRoute";
105
+ export { TrustedProxy } from "./TrustedProxy";
62
106
  export type * from "./types";
63
107
  export {
64
108
  type WebsocketAuthAckData,
65
109
  type WebsocketAuthRequest,
66
110
  websocketAuthContract,
67
111
  } from "./websocketAuth";
112
+ export { type WebsocketBinaryFrame, websocketBinaryFrameContract } from "./websocketBinaryFrame";
@@ -10,5 +10,5 @@ export const isValidDate = (d: string | Date | Dayjs) => {
10
10
  if (typeof d === "string") {
11
11
  return dayjs(d, format).isValid();
12
12
  } else if (isDayjs(d)) return d.isValid();
13
- else return d instanceof Date && !isNaN(d.getTime());
13
+ else return d instanceof Date && !Number.isNaN(d.getTime());
14
14
  };
@@ -0,0 +1,27 @@
1
+ import type { LogRecord } from "./Logger";
2
+
3
+ /** A per-request ring the Logger hands every record to; the trace decides at its end whether any of it is shown. */
4
+ export interface LogFlightRecorder {
5
+ minSev: number;
6
+ capture(record: LogRecord, written: boolean): void;
7
+ }
8
+
9
+ export interface LogContextSnapshot {
10
+ traceId: string | null;
11
+ endpoint: string | null;
12
+ origin: string | null;
13
+ flight?: LogFlightRecorder | null;
14
+ /** A per-request floor below the process level (`x-akan-debug`); `null` when the request asked for nothing. */
15
+ debugSev?: number | null;
16
+ }
17
+
18
+ export type LogContextReader = () => LogContextSnapshot | undefined;
19
+
20
+ const slot: { __akanLogContextReader?: LogContextReader | null } =
21
+ typeof process === "undefined" ? {} : (process as unknown as { __akanLogContextReader?: LogContextReader | null });
22
+
23
+ export const registerLogContextReader = (reader: LogContextReader | null) => {
24
+ slot.__akanLogContextReader = reader;
25
+ };
26
+
27
+ export const readLogContext = () => slot.__akanLogContextReader?.();
@@ -0,0 +1,114 @@
1
+ import { capitalize } from "./capitalize";
2
+
3
+ /**
4
+ * What MCP says about one endpoint: whether it is published, why it is not, and the hints it carries.
5
+ *
6
+ * Structurally typed like the rest of `common/` so the same rules answer on both sides — the server builds its
7
+ * catalogue from them and the browser API explorer badges an endpoint from them. A second implementation would
8
+ * eventually disagree, and an audit surface that disagrees with the catalogue is worse than none.
9
+ *
10
+ * Every rejection returns the sentence an author reads, at boot in the server log and in the explorer. Fail-closed
11
+ * with no reason leaves an author whose endpoint is missing from the catalogue nowhere to look but the source.
12
+ */
13
+ export interface McpExposureEndpoint {
14
+ type: string;
15
+ returns: { refName: string };
16
+ args: { name: string; refName: string; type: string; arrDepth?: number; nullable?: boolean }[];
17
+ guards?: string[];
18
+ fileUpload?: boolean;
19
+ mcp?: boolean;
20
+ }
21
+
22
+ export interface McpExposureOption {
23
+ /** The model the endpoint belongs to and the name it is published under: one rule reads the key, not the shape. */
24
+ refName: string;
25
+ key: string;
26
+ /**
27
+ * The read-only deployment valve, which is server configuration. The browser explorer cannot know it and so
28
+ * badges what the code decided; the boot log is where a read-only deployment says what it dropped.
29
+ */
30
+ readOnly?: boolean;
31
+ }
32
+
33
+ /** `Any` publishes as the empty schema, which tells a model nothing — so it is left out rather than described. */
34
+ export const isMcpDescribableArg = (arg: { refName: string }) => arg.refName !== "Any";
35
+
36
+ /** Which CRUD verb a generated endpoint key is, or `null` when the key is not one of the five. */
37
+ export const mcpBaseVerbOf = (refName: string, key: string) => {
38
+ const cap = capitalize(refName);
39
+ if (key === refName || key === `light${cap}`) return "get" as const;
40
+ if (key === `create${cap}`) return "create" as const;
41
+ if (key === `update${cap}`) return "update" as const;
42
+ if (key === `remove${cap}`) return "remove" as const;
43
+ return null;
44
+ };
45
+
46
+ /**
47
+ * The hints a client renders beside a tool. Hints only — clients are told to distrust them, so they inform a UI
48
+ * and never stand in for a guard. `openWorldHint` is always false: every endpoint reaches this app's own
49
+ * database, not the wider internet.
50
+ */
51
+ export const mcpHintsOf = (key: string, endpoint: { type: string }) => {
52
+ const readOnly = endpoint.type === "query";
53
+ const destructive = !readOnly && /^(remove|delete)/.test(key);
54
+ return {
55
+ readOnlyHint: readOnly,
56
+ destructiveHint: destructive,
57
+ idempotentHint: readOnly || /^(set|update)/.test(key),
58
+ openWorldHint: false,
59
+ };
60
+ };
61
+
62
+ /** The sentence explaining why this endpoint is not in the catalogue, or `null` when it is. */
63
+ export const mcpRefusalOf = (
64
+ endpoint: McpExposureEndpoint,
65
+ { refName, key, readOnly }: McpExposureOption,
66
+ ): string | null => {
67
+
68
+ if (endpoint.mcp === false)
69
+ return "it declares `mcp: false`, so it is deliberately off the agent shelf. HTTP still serves it.";
70
+
71
+ if (!endpoint.guards?.length)
72
+ return "it declares no guards, and exposure follows them — write `guards: [Public]` if anonymous access is the intent.";
73
+
74
+ if (key === `light${capitalize(refName)}`)
75
+ return `it reads the same document as \`${refName}\` in a smaller shape — call \`${refName}\` instead.`;
76
+ if (endpoint.type === "prompt") return mcpPromptRefusalOf(endpoint);
77
+ if (endpoint.type === "pubsub" || endpoint.type === "message")
78
+ return `\`${endpoint.type}\` rides the websocket, and its internal arguments read a socket an MCP request does not have.`;
79
+ if (readOnly && endpoint.type !== "query")
80
+ return "this deployment is read-only, which drops every endpoint that is not a query.";
81
+ if (endpoint.returns.refName === "Any" || endpoint.returns.refName === "Upload")
82
+ return `a return typed \`${endpoint.returns.refName}\` cannot be described to a model.`;
83
+ if (endpoint.returns.refName === "Binary")
84
+ return "a return typed `Binary` is raw bytes, which cost a model its window and tell it nothing.";
85
+ if (endpoint.fileUpload || endpoint.args.some((arg) => arg.refName === "Upload"))
86
+ return "a file upload has no MCP representation.";
87
+ if (endpoint.type === "mutation" && !endpoint.guards.some((name) => name !== "Public"))
88
+ return "a mutation needs a real guard — `[Public]` is having none, spelled out.";
89
+ const opaque = endpoint.args.find((arg) => !isMcpDescribableArg(arg) && arg.type !== "search" && !arg.nullable);
90
+ if (opaque)
91
+ return `its required argument \`${opaque.name}\` is typed \`Any\`, which is left out of the published schema — expose a named filter slice instead.`;
92
+ return null;
93
+ };
94
+
95
+ /**
96
+ * A prompt is a read exposed on the same terms as a query, so every rejection here is one thing: an argument
97
+ * `prompts/get` cannot carry. Its `arguments` is a flat string map — one string per name, and no schema beside it
98
+ * — which rules out the argument *kinds* the builder already refuses and, just as surely, two argument *types* it
99
+ * accepts. A tool escapes both because it publishes a real JSON Schema.
100
+ */
101
+ export const mcpPromptRefusalOf = (endpoint: McpExposureEndpoint): string | null => {
102
+ const carried = endpoint.args.find((arg) => arg.type === "body" || arg.type === "msg" || arg.type === "room");
103
+ if (carried)
104
+ return `a prompt's arguments travel as a flat string map, so its \`${carried.type}\` argument \`${carried.name}\` cannot be carried.`;
105
+
106
+ const list = endpoint.args.find((arg) => arg.arrDepth);
107
+ if (list)
108
+ return `a prompt argument is one string, so its list argument \`${list.name}\` could never carry more than one value.`;
109
+
110
+ const opaque = endpoint.args.find((arg) => !isMcpDescribableArg(arg));
111
+ if (opaque)
112
+ return `its argument \`${opaque.name}\` is typed \`Any\`, and a prompt has no schema in which to describe one.`;
113
+ return null;
114
+ };
@@ -0,0 +1,31 @@
1
+ type Indexable = Record<string, unknown>;
2
+
3
+ const isIndexable = (value: unknown): value is Indexable => Object(value) === value;
4
+
5
+ /**
6
+ * Reads a dotted path whose segments may themselves contain the separator.
7
+ *
8
+ * Dictionary keys are built as `<refName>.<value>` and an enum value is a real-world identifier — `gpt-5.6-terra`,
9
+ * `v1.2` — so the key is not a clean dotted path and `pathGet` splits it into segments that were never nodes.
10
+ * The tree stores such a key literally, so resolution has to try joined prefixes too.
11
+ */
12
+ export const pathGetLoose = (
13
+ path: string | readonly string[],
14
+ obj: unknown,
15
+ separator = ".",
16
+ fallback: unknown = null,
17
+ ): unknown => {
18
+ const walk = (node: unknown, rest: readonly string[]): unknown => {
19
+ if (!rest.length) return node;
20
+ if (!isIndexable(node)) return undefined;
21
+
22
+ for (let take = 1; take <= rest.length; take += 1) {
23
+ const child = node[rest.slice(0, take).join(separator)];
24
+ if (child === undefined) continue;
25
+ const found = walk(child, rest.slice(take));
26
+ if (found !== undefined) return found;
27
+ }
28
+ return undefined;
29
+ };
30
+ return walk(obj, Array.isArray(path) ? [...path] : (path as string).split(separator)) ?? fallback;
31
+ };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Own and inherited enumerable data of an object as a plain record. An Akan model keeps its Date fields as
3
+ * enumerable prototype accessors, which `Object.keys` and a spread never reach; methods are non-enumerable and stay
4
+ * out either way.
5
+ */
6
+ export const plainFieldsOf = (source: object): Record<string, unknown> => {
7
+ const out: Record<string, unknown> = {};
8
+ for (const key in source) {
9
+ const value = (source as Record<string, unknown>)[key];
10
+ if (typeof value !== "function") out[key] = value;
11
+ }
12
+ return out;
13
+ };
@@ -0,0 +1,32 @@
1
+ /**
2
+ * The origin a caller actually saw, and whether a body claims to be JSON. Both read only headers and a URL, so
3
+ * they answer the same way for the cache layer, the CSRF gate, and anything else that has to compare origins.
4
+ */
5
+ export const originFromRequest = (headers: Headers, url: URL): string => {
6
+
7
+ const forwardedProto = headers.get("x-forwarded-proto")?.split(",")[0]?.trim();
8
+ const forwardedHost = headers.get("x-forwarded-host")?.split(",")[0]?.trim();
9
+ const host = forwardedHost ?? headers.get("host")?.split(",")[0]?.trim();
10
+ const proto = forwardedProto ?? url.protocol.slice(0, -1);
11
+ if (host && proto) {
12
+ try {
13
+ return new URL(`${proto}://${host}`).origin;
14
+ } catch {
15
+ }
16
+ }
17
+ return url.origin;
18
+ };
19
+
20
+ /**
21
+ * Whether a request body may be read as JSON.
22
+ *
23
+ * `Request.json()` parses whatever bytes it holds regardless of this header, and the three content types a
24
+ * cross-site form can send — `text/plain`, `application/x-www-form-urlencoded`, `multipart/form-data` — are
25
+ * exactly the ones a browser sends with **no preflight**. Requiring the JSON type is therefore what puts a
26
+ * preflight in front of every mutation that carries a body.
27
+ */
28
+ export const isJsonContentType = (contentType: string | null): boolean => {
29
+ if (!contentType) return false;
30
+ const essence = contentType.split(";")[0]?.trim().toLowerCase() ?? "";
31
+ return essence === "application/json" || essence.endsWith("+json");
32
+ };
@@ -1,39 +1,46 @@
1
- export interface HttpClientOptions {
1
+ /**
2
+ * A plain REST client for a service that is not an Akan API: base url, headers, timeout, JSON in and out.
3
+ *
4
+ * Not `akanjs/fetch`'s `HttpClient`, which builds an Akan endpoint's path from its serialized args and restores
5
+ * an `Err` from the response. Two classes of the same name in one package meant an app importing both barrels
6
+ * got a collision, so this one is named for what it is.
7
+ */
8
+ export interface RestClientOptions {
2
9
  baseUrl?: string;
3
10
  headers?: HeadersInit;
4
11
  timeout?: number;
5
12
  }
6
13
 
7
- export interface HttpRequestOptions extends Omit<RequestInit, "body" | "headers" | "method"> {
14
+ export interface RestRequestOptions extends Omit<RequestInit, "body" | "headers" | "method"> {
8
15
  headers?: HeadersInit;
9
16
  timeout?: number;
10
17
  }
11
18
 
12
- export class HttpClient {
19
+ export class RestClient {
13
20
  readonly baseUrl: string;
14
21
  readonly headers: Headers;
15
22
  readonly timeout: number | undefined;
16
23
 
17
- constructor(options: string | HttpClientOptions = {}) {
24
+ constructor(options: string | RestClientOptions = {}) {
18
25
  const normalized = typeof options === "string" ? { baseUrl: options } : options;
19
26
  this.baseUrl = normalized.baseUrl?.replace(/\/+$/, "") ?? "";
20
27
  this.headers = new Headers(normalized.headers);
21
28
  this.timeout = normalized.timeout;
22
29
  }
23
30
 
24
- async get<Returns>(url: string, options?: HttpRequestOptions): Promise<Returns> {
31
+ async get<Returns>(url: string, options?: RestRequestOptions): Promise<Returns> {
25
32
  return await this.#request<Returns>("GET", url, undefined, options);
26
33
  }
27
34
 
28
- async post<Returns>(url: string, data?: unknown, options?: HttpRequestOptions): Promise<Returns> {
35
+ async post<Returns>(url: string, data?: unknown, options?: RestRequestOptions): Promise<Returns> {
29
36
  return await this.#request<Returns>("POST", url, data, options);
30
37
  }
31
38
 
32
- async put<Returns>(url: string, data?: unknown, options?: HttpRequestOptions): Promise<Returns> {
39
+ async put<Returns>(url: string, data?: unknown, options?: RestRequestOptions): Promise<Returns> {
33
40
  return await this.#request<Returns>("PUT", url, data, options);
34
41
  }
35
42
 
36
- async delete<Returns>(url: string, options?: HttpRequestOptions): Promise<Returns> {
43
+ async delete<Returns>(url: string, options?: RestRequestOptions): Promise<Returns> {
37
44
  return await this.#request<Returns>("DELETE", url, undefined, options);
38
45
  }
39
46
 
@@ -41,7 +48,7 @@ export class HttpClient {
41
48
  method: string,
42
49
  url: string,
43
50
  data?: unknown,
44
- options: HttpRequestOptions = {},
51
+ options: RestRequestOptions = {},
45
52
  ): Promise<Returns> {
46
53
  const { body, headers } = this.#makeBody(data);
47
54
  const timeout = options.timeout ?? this.timeout;
@@ -67,27 +67,37 @@ export function isRouteSourceFile(filePath: string): boolean {
67
67
  return tryParseRouteModuleKey(key) !== null;
68
68
  }
69
69
 
70
- export function validatePageSourceFile(filePath: string, options: ValidatePageSourceFileOptions = {}): boolean {
71
- if (!SOURCE_EXT_RE.test(filePath)) return false;
70
+ /**
71
+ * Why a `page/` file breaks the route convention, or null when it is fine. Null also covers a non-source
72
+ * asset, which `page/` tolerates. `akan sync <lib>` reports these alongside its other layout violations,
73
+ * so the rule stays in one place instead of being restated where it cannot afford to throw.
74
+ */
75
+ export function getPageSourceFileViolation(filePath: string): string | null {
76
+ if (!SOURCE_EXT_RE.test(filePath)) return null;
72
77
 
73
78
  const key = filePath.startsWith("./") ? filePath : `./${filePath.split(/[\\/]/).join("/")}`;
74
79
  const match = ROUTE_SOURCE_RE.exec(key);
75
- const displayPath = options.filePath ?? key;
76
- if (!match) throw new Error(`[route-convention] invalid page source file: ${displayPath}`);
80
+ if (!match) return "invalid page source file";
77
81
 
78
82
  const file = match[1] as string;
79
83
  const ext = match[2] as string;
80
84
  const leaf = file.split("/").filter(Boolean).at(-1);
81
- if (!leaf) throw new Error(`[route-convention] invalid page source file: ${displayPath}`);
85
+ if (!leaf) return "invalid page source file";
82
86
 
83
- if (ext !== "tsx") throw new Error(`[route-convention] route source files under page/ must use .tsx: ${displayPath}`);
87
+ if (ext !== "tsx") return "route source files under page/ must use .tsx";
84
88
  if (leaf.startsWith("_") && !RESERVED_ROUTE_FILES.has(leaf) && leaf !== INTERNAL_ROOT_LAYOUT_LEAF)
85
- throw new Error(
86
- `[route-convention] only _index.tsx, _layout.tsx and _overrides.tsx are allowed as reserved route files under page/: ${displayPath}`,
87
- );
88
- if (/^[A-Z]/.test(leaf))
89
- throw new Error(`[route-convention] route page filenames must not start with an uppercase letter: ${displayPath}`);
90
- return true;
89
+ return "only _index.tsx, _layout.tsx and _overrides.tsx are allowed as reserved route files under page/";
90
+ if (/^[A-Z]/.test(leaf)) return "route page filenames must not start with an uppercase letter";
91
+ return null;
92
+ }
93
+
94
+ export function validatePageSourceFile(filePath: string, options: ValidatePageSourceFileOptions = {}): boolean {
95
+ if (!SOURCE_EXT_RE.test(filePath)) return false;
96
+
97
+ const violation = getPageSourceFileViolation(filePath);
98
+ if (!violation) return true;
99
+ const key = filePath.startsWith("./") ? filePath : `./${filePath.split(/[\\/]/).join("/")}`;
100
+ throw new Error(`[route-convention] ${violation}: ${options.filePath ?? key}`);
91
101
  }
92
102
 
93
103
  export function validateSubRoutePageKey(
@@ -0,0 +1,46 @@
1
+ export interface WebsocketBinaryFrame {
2
+ roomId: string;
3
+ payload: Uint8Array;
4
+ }
5
+
6
+ const MAGIC = 0xab;
7
+ const KIND_PUB = 0x01;
8
+ const HEADER_BYTES = 4;
9
+ const MAX_ROOM_BYTES = 0xffff;
10
+
11
+ const encoder = new TextEncoder();
12
+ const decoder = new TextDecoder();
13
+
14
+ /**
15
+ * Framework-owned binary pubsub frame, shared by the publisher and the client dispatcher. A room whose whole
16
+ * return is `Binary` sends its bytes in a websocket binary frame instead of the JSON `{ type: "pub" }` envelope,
17
+ * because `Buffer.toJSON()` turns bytes into `{ type: "Buffer", data: number[] }` — 3.6x the wire and ~300x the
18
+ * encode cost on a 64 KB payload, and a shape `JSON.parse` never restores.
19
+ *
20
+ * Text and binary frames coexist on one socket, so this is additive: every JSON endpoint is untouched, and a
21
+ * federation gateway relays a binary frame unchanged with no code of its own.
22
+ */
23
+ export const websocketBinaryFrameContract = {
24
+ encode: ({ roomId, payload }: WebsocketBinaryFrame): Uint8Array => {
25
+ const room = encoder.encode(roomId);
26
+ if (room.length > MAX_ROOM_BYTES) throw new Error(`Room id is too long to frame: ${roomId}`);
27
+ const frame = new Uint8Array(HEADER_BYTES + room.length + payload.length);
28
+ frame[0] = MAGIC;
29
+ frame[1] = KIND_PUB;
30
+ frame[2] = room.length >> 8;
31
+ frame[3] = room.length & 0xff;
32
+ frame.set(room, HEADER_BYTES);
33
+ frame.set(payload, HEADER_BYTES + room.length);
34
+ return frame;
35
+ },
36
+ decode: (data: ArrayBuffer | Uint8Array): WebsocketBinaryFrame | null => {
37
+ const bytes = data instanceof Uint8Array ? data : new Uint8Array(data);
38
+ if (bytes.length < HEADER_BYTES || bytes[0] !== MAGIC || bytes[1] !== KIND_PUB) return null;
39
+ const roomBytes = (bytes[2] << 8) | bytes[3];
40
+ if (bytes.length < HEADER_BYTES + roomBytes) return null;
41
+ return {
42
+ roomId: decoder.decode(bytes.subarray(HEADER_BYTES, HEADER_BYTES + roomBytes)),
43
+ payload: bytes.subarray(HEADER_BYTES + roomBytes),
44
+ };
45
+ },
46
+ } as const;
@@ -8,40 +8,104 @@ import {
8
8
  } from "akanjs/base";
9
9
 
10
10
  import type { FieldProps } from ".";
11
+ import { ConstantRegistry } from "./constantRegistry";
11
12
 
12
13
  export type CrystalizeFunc<Model> = (self: GetStateObject<Model>, isChild?: boolean) => Model;
14
+ export type Converter = (value: unknown) => unknown;
13
15
 
14
- export const crystalize = (field: FieldProps, value: unknown): unknown => {
15
- if (value === undefined || value === null) return value as undefined | null;
16
- if (field.isArray && Array.isArray(value))
17
- return value.map((v: unknown) =>
18
- crystalize({ ...field, isArray: field.arrDepth > 1, arrDepth: field.arrDepth - 1 }, v),
19
- );
20
- const crystalizeValue = PrimitiveRegistry.has(field.modelRef)
21
- ? (value: unknown) => (field.modelRef as unknown as typeof PrimitiveScalar)._parse(value as never)
22
- : (value: unknown) => value as object;
23
- if (field.isMap) {
24
- const mapValueField = {
25
- ...field,
26
- modelRef: field.of ?? field.modelRef,
27
- isMap: false,
28
- isClass: !!field.of && !PrimitiveRegistry.has(field.of),
29
- isScalar: !!field.of && PrimitiveRegistry.has(field.of),
30
- isArray: false,
31
- arrDepth: 0,
32
- };
16
+ /**
17
+ * The relation instances one hydration pass has already built, by model class and then document id.
18
+ *
19
+ * A listing hands the same relation to every row that references it — twenty users wearing one avatar — and
20
+ * each row would otherwise build its own copy of it, re-parsing every `Date` on the way. Sharing is safe
21
+ * because a constant model is `[immerable]`: a store write copies before it mutates.
22
+ *
23
+ * Module-scoped rather than passed down, because `crystalize` is reached through a model's own constructor,
24
+ * which has nowhere to carry it. A pass is wholly synchronous, so no other one can observe this mid-flight.
25
+ */
26
+ let sharedInstances: Map<Cls, Map<string, object>> | null = null;
27
+
28
+ /** Runs one hydration pass, sharing a relation instance across every value in it that names the same id. */
29
+ export const withSharedInstances = <T>(hydrate: () => T): T => {
30
+ if (sharedInstances) return hydrate();
31
+ sharedInstances = new Map();
32
+ try {
33
+ return hydrate();
34
+ } finally {
35
+ sharedInstances = null;
36
+ }
37
+ };
38
+
39
+ type ModelCls = new (obj?: object) => object;
40
+
41
+ const relationIdOf = (value: object): string | null => {
42
+ const id = (value as { id?: unknown }).id;
43
+ return typeof id === "string" && id ? id : null;
44
+ };
45
+
46
+ const modelConverterOf = (props: FieldProps): Converter => {
47
+ const modelRef = props.modelRef as unknown as ModelCls;
48
+
49
+ if (props.isScalar) return (value) => (value instanceof modelRef ? value : new modelRef(value as object));
50
+ return (value) => {
51
+ if (value instanceof modelRef) return value;
52
+
53
+ const id = relationIdOf(value as object);
54
+ if (!sharedInstances || !id) return new modelRef(value as object);
55
+ const byId = sharedInstances.get(modelRef as unknown as Cls) ?? new Map<string, object>();
56
+ if (!sharedInstances.has(modelRef as unknown as Cls)) sharedInstances.set(modelRef as unknown as Cls, byId);
57
+ const shared = byId.get(id) ?? new modelRef(value as object);
58
+ byId.set(id, shared);
59
+ return shared;
60
+ };
61
+ };
62
+
63
+ const mapConverterOf = (props: FieldProps): Converter => {
64
+ const of = props.of as Cls | undefined;
65
+ const valueConverter: Converter = of
66
+ ? singleConverterOf({
67
+ ...props,
68
+ modelRef: of as FieldProps["modelRef"],
69
+ isMap: false,
70
+ isClass: !PrimitiveRegistry.has(of),
71
+ isScalar: PrimitiveRegistry.has(of) || ConstantRegistry.isScalar(of),
72
+ isArray: false,
73
+ arrDepth: 0,
74
+ })
75
+ : (value) => value;
76
+ return (value) => {
33
77
 
34
78
  const entries = value instanceof Map ? [...value.entries()] : Object.entries(value as Record<string, unknown>);
35
79
  return new Map(
36
- entries.map(([key, val]: [string, unknown]) => [
37
- key,
38
- field.of
39
- ? applyFnToArrayObjects(val, (v: never) => crystalize(mapValueField, v))
40
- : applyFnToArrayObjects(val, crystalizeValue),
41
- ]),
80
+ entries.map(([key, val]: [string, unknown]) => [key, applyFnToArrayObjects(val, valueConverter as never)]),
42
81
  );
82
+ };
83
+ };
84
+
85
+ const singleConverterOf = (props: FieldProps): Converter => {
86
+ if (props.isMap) return mapConverterOf(props);
87
+ if (props.isClass) return modelConverterOf(props);
88
+
89
+ if ((props.modelRef as unknown) === Date) return (value) => dayjs(value as Date);
90
+ if (PrimitiveRegistry.has(props.modelRef as Cls))
91
+ return (value) => (props.modelRef as unknown as typeof PrimitiveScalar)._parse(value as never);
92
+ return (value) => value;
93
+ };
94
+
95
+ const converters = new WeakMap<FieldProps, Converter>();
96
+
97
+ /** The converter for one field, compiled once per `FieldProps` — which `getProps()` freezes and shares per field. */
98
+ export const converterOf = (props: FieldProps): Converter => {
99
+ const cached = converters.get(props);
100
+ if (cached) return cached;
101
+ const single = singleConverterOf(props);
102
+ let convert: Converter = (value) => (value === null || value === undefined ? value : single(value));
103
+ for (let depth = props.arrDepth; depth > 0; depth--) {
104
+ const inner: Converter = convert;
105
+ convert = (value: unknown): unknown => (Array.isArray(value) ? value.map(inner) : inner(value));
43
106
  }
44
- if (field.isClass) return new (field.modelRef as Cls<{ set: (obj: object) => object }>)().set(value as object);
45
- if (field.modelRef === Date) return dayjs(value as Date);
46
- return crystalizeValue(value);
107
+ converters.set(props, convert);
108
+ return convert;
47
109
  };
110
+
111
+ export const crystalize = (field: FieldProps, value: unknown): unknown => converterOf(field)(value);