akanjs 3.2.0-rc.9 → 3.2.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 (641) hide show
  1. package/ARCHITECTURE.md +41 -38
  2. package/CHANGELOG.md +0 -680
  3. package/CONTRIBUTING.md +3 -0
  4. package/base/base.ts +2 -1
  5. package/client/clientRuntime.ts +1 -0
  6. package/client/cn.ts +2 -2
  7. package/client/csrTypes.ts +2 -0
  8. package/client/frameConfig.ts +1 -0
  9. package/client/index.ts +249 -26
  10. package/client/locale.ts +1 -0
  11. package/client/makePageProto.tsx +12 -85
  12. package/client/nativeThemeColor.ts +51 -0
  13. package/client/route/PageDefinition.ts +11 -3
  14. package/client/route/RouteDefinition.ts +24 -7
  15. package/client/route/RouteGuards.ts +2 -1
  16. package/client/route/RouteHead.ts +4 -1
  17. package/client/route/routeArgs.ts +8 -0
  18. package/client/router.ts +17 -2
  19. package/client/rscNavigation.ts +1 -0
  20. package/client/viewportMeta.ts +86 -6
  21. package/common/CodeTranscript.ts +1 -1
  22. package/common/Logger.ts +4 -2
  23. package/common/PipelinePlanSchema.ts +2 -2
  24. package/common/clientAddress.ts +14 -0
  25. package/common/err.ts +122 -0
  26. package/common/eventStream.ts +71 -19
  27. package/common/facetBarrel.ts +38 -0
  28. package/common/index.ts +7 -0
  29. package/common/isGuardRefusal.ts +14 -0
  30. package/common/loggedFailure.ts +11 -0
  31. package/common/mcpExposure.ts +17 -4
  32. package/common/pipelinePlan.ts +1 -1
  33. package/common/routeConvention.ts +3 -1
  34. package/common/types.ts +18 -1
  35. package/constant/constantRegistry.ts +4 -8
  36. package/constant/crystalize.ts +1 -2
  37. package/constant/getDefault.ts +1 -1
  38. package/constant/immerify.ts +1 -1
  39. package/constant/index.ts +78 -21
  40. package/constant/purify.ts +4 -9
  41. package/constant/serialize.ts +4 -2
  42. package/constant/types.ts +1 -0
  43. package/constant/via.ts +1 -2
  44. package/dictionary/agent.dictionary.ts +12 -0
  45. package/dictionary/base.dictionary.ts +11 -0
  46. package/dictionary/locale.ts +1 -1
  47. package/dictionary/trans.ts +14 -97
  48. package/document/dataLoader.ts +39 -19
  49. package/document/databaseRegistry.ts +2 -1
  50. package/document/documentSchema.ts +1 -0
  51. package/document/filterMeta.ts +4 -1
  52. package/document/into.ts +2 -1
  53. package/document/loaderInfo.ts +2 -1
  54. package/document/noDocumentError.ts +4 -1
  55. package/document/queryEvaluator.ts +1 -1
  56. package/document/types.ts +1 -1
  57. package/fetch/client/fetchClient.ts +83 -269
  58. package/fetch/client/fetchClientTypes.ts +49 -0
  59. package/fetch/client/httpClient.ts +3 -2
  60. package/fetch/client/remoteError.ts +4 -20
  61. package/fetch/client/requestScope.ts +41 -0
  62. package/fetch/client/signalCatalog.ts +131 -0
  63. package/fetch/client/wsClient.ts +82 -6
  64. package/fetch/requestStorage.ts +1 -0
  65. package/package.json +1 -1
  66. package/server/agentHooks.ts +16 -0
  67. package/server/akanApp.ts +110 -1272
  68. package/server/akanOption.ts +30 -3
  69. package/server/akanServer.ts +179 -674
  70. package/server/artifact/builderRpc.ts +14 -6
  71. package/server/artifact/routeSeedIndexStore.ts +4 -2
  72. package/server/assetHeaders.ts +6 -0
  73. package/server/console.ts +6 -4
  74. package/server/decorators.ts +2 -2
  75. package/server/di/diLifecycle.ts +24 -35
  76. package/server/di/predefinedAdaptor.ts +24 -1
  77. package/server/di/resolveHierarchy.ts +19 -6
  78. package/server/di/stageFailedError.ts +10 -0
  79. package/server/di/utils.ts +8 -3
  80. package/server/ed25519Key.ts +31 -15
  81. package/server/flightRowReader.ts +106 -20
  82. package/server/gateway/childSupervisor.ts +328 -0
  83. package/server/gateway/devHostChannel.ts +47 -0
  84. package/server/gateway/gatewayChildren.ts +161 -0
  85. package/server/gateway/gatewayConfig.ts +182 -0
  86. package/server/gateway/gatewayHttpProxy.ts +231 -0
  87. package/server/gateway/gatewayLogging.ts +111 -0
  88. package/server/gateway/gatewayRooms.ts +141 -0
  89. package/server/gateway/gatewayStatus.ts +122 -0
  90. package/server/gateway/gatewayStatusPage.ts +54 -0
  91. package/server/gateway/gatewayWebSocketRelay.ts +149 -0
  92. package/server/gateway/listeningPort.ts +13 -0
  93. package/server/hmr/devHmrController.ts +10 -1
  94. package/server/htmlResultCache.ts +234 -0
  95. package/server/imageOptimizer.ts +4 -1
  96. package/server/index.ts +281 -17
  97. package/server/lifecycle/parentChannel.ts +79 -0
  98. package/server/lifecycle/shutdownManager.ts +6 -3
  99. package/server/lifecycle/startGuard.ts +90 -0
  100. package/server/logging/hubFileSink.ts +1 -0
  101. package/server/logging/logControlSocket.ts +42 -3
  102. package/server/logging/logHub.ts +0 -0
  103. package/server/logging/logStdoutWriter.ts +3 -1
  104. package/server/logging/logStreamRoute.ts +28 -11
  105. package/server/logging/serverLogging.ts +74 -0
  106. package/server/machine/machineToken.ts +10 -3
  107. package/server/mcp/AgentTools.ts +149 -0
  108. package/server/mcp/AgentToolsAccount.ts +26 -0
  109. package/server/mcp/McpApps.ts +32 -2
  110. package/server/mcp/McpDispatcher.ts +44 -30
  111. package/server/mcp/McpPages.ts +34 -12
  112. package/server/mcp/McpRateLimiter.ts +14 -0
  113. package/server/mcp/McpRouter.ts +4 -2
  114. package/server/mcp/McpUiSession.ts +2 -1
  115. package/server/mcp/index.ts +1 -0
  116. package/server/migration/migrationCommand.ts +31 -2
  117. package/server/migration/migrationRunner.ts +36 -1
  118. package/server/nativeFile.ts +39 -12
  119. package/server/nativeSecret.ts +12 -3
  120. package/server/oauth/OAuthClientIdMetadata.ts +2 -2
  121. package/server/ops/migrateJobs.ts +2 -2
  122. package/server/ops/opsCommand.ts +1 -1
  123. package/server/ops/opsRoute.ts +5 -1
  124. package/server/ops/opsToken.ts +3 -1
  125. package/server/remote/RemoteFetch.ts +161 -0
  126. package/server/remote/RemoteMcp.ts +242 -0
  127. package/server/remote/RemoteOAuth.ts +270 -0
  128. package/server/remote/RemoteSource.ts +214 -0
  129. package/server/remote/index.ts +17 -0
  130. package/server/remote/remoteError.ts +19 -0
  131. package/server/resolver/CascadeRunner.ts +20 -8
  132. package/server/resolver/database.resolver.ts +10 -417
  133. package/server/resolver/databaseModelInstance.ts +209 -0
  134. package/server/resolver/invalidSignal.ts +7 -0
  135. package/server/resolver/livePause.ts +34 -0
  136. package/server/resolver/modelFacade.ts +136 -0
  137. package/server/resolver/modelLoaders.ts +84 -0
  138. package/server/resolver/modelSchema.ts +52 -0
  139. package/server/resolver/roomAdmission.ts +68 -0
  140. package/server/resolver/signal.resolver.ts +45 -111
  141. package/server/resolver/sliceCrud.ts +63 -0
  142. package/server/resolver/timedQuery.ts +16 -0
  143. package/server/resolver/websocketOf.ts +2 -1
  144. package/server/routeElementComposer.tsx +45 -6
  145. package/server/routeTreeBuilder.ts +23 -9
  146. package/server/routing/apiRouter.ts +53 -28
  147. package/server/routing/builtinRoutes.ts +194 -0
  148. package/server/routing/localRooms.ts +34 -0
  149. package/server/routing/roomReplay.ts +2 -2
  150. package/server/routing/serverLimits.ts +4 -1
  151. package/server/routing/serverListener.ts +194 -0
  152. package/server/rscClient.tsx +121 -204
  153. package/server/rscClientCache.ts +165 -0
  154. package/server/rscClientChunks.ts +126 -8
  155. package/server/rscClientFetch.ts +3 -1
  156. package/server/rscClientPatch.ts +78 -15
  157. package/server/rscDocumentHead.tsx +177 -0
  158. package/server/rscFlightRenderer.ts +83 -0
  159. package/server/rscFlightStream.ts +259 -0
  160. package/server/rscHostReloads.ts +238 -0
  161. package/server/rscHostRenderStream.ts +297 -0
  162. package/server/rscHostRequests.ts +158 -0
  163. package/server/rscHttp.ts +18 -6
  164. package/server/rscNavigationState.ts +24 -1
  165. package/server/rscPagePrompts.ts +65 -14
  166. package/server/rscPrefetchCache.ts +5 -1
  167. package/server/rscRenderControl.ts +33 -0
  168. package/server/rscRenderFallbacks.ts +299 -0
  169. package/server/rscRenderHandler.ts +439 -0
  170. package/server/rscRenderStats.ts +49 -0
  171. package/server/rscResultCaches.ts +74 -0
  172. package/server/rscRouteDocument.tsx +316 -0
  173. package/server/rscSegmentOutletReference.ts +5 -1
  174. package/server/rscStaticApp.tsx +73 -0
  175. package/server/rscWorker.tsx +112 -1341
  176. package/server/rscWorkerHost.ts +175 -803
  177. package/server/rscWorkerProcess.ts +155 -0
  178. package/server/rscWorkerRecycler.ts +128 -0
  179. package/server/serverConfig.ts +128 -0
  180. package/server/serverMetrics.ts +52 -0
  181. package/server/sitemap.ts +1 -0
  182. package/server/ssrFromRscRenderer.tsx +20 -20
  183. package/server/ssrStaticApp.tsx +243 -0
  184. package/server/webArtifact.ts +86 -0
  185. package/server/webAssetRoutes.ts +84 -0
  186. package/server/webCsrSurface.ts +172 -0
  187. package/server/webDocumentRoute.ts +180 -0
  188. package/server/webRouteContext.ts +232 -0
  189. package/server/webRouter.ts +129 -1165
  190. package/server/webRscRoute.ts +155 -0
  191. package/server/webSiteFiles.ts +139 -0
  192. package/server/webStaticApp.ts +62 -0
  193. package/server/wellKnownRoutes.ts +73 -0
  194. package/service/agent.service.ts +14 -2
  195. package/service/agentAccounts.ts +19 -0
  196. package/service/agentLoop/agentLoop.ts +550 -0
  197. package/service/agentLoop/agentLoopTypes.ts +220 -0
  198. package/service/agentLoop/deltaStream.ts +40 -0
  199. package/service/agentLoop/loopAnswer.ts +67 -0
  200. package/service/agentLoop/loopAsk.ts +44 -0
  201. package/service/agentLoop/loopCompaction.ts +146 -0
  202. package/service/agentLoop/loopRemotes.ts +181 -0
  203. package/service/agentLoop/loopRequest.ts +120 -0
  204. package/service/agentLoop/loopStored.ts +24 -0
  205. package/service/agentLoop/loopToolOutput.ts +54 -0
  206. package/service/agentLoop/loopToolkits.ts +155 -0
  207. package/service/agentLoop/loopTranscript.ts +138 -0
  208. package/{signal → service}/agentMeter.ts +2 -1
  209. package/{signal → service}/agentRelayPolicy.ts +43 -8
  210. package/service/endpointCacheKeys.ts +14 -2
  211. package/service/index.ts +6 -0
  212. package/service/injectInfo.ts +2 -1
  213. package/service/ipcTypes.ts +8 -2
  214. package/service/liveRoomLimit.ts +68 -0
  215. package/service/liveRoomLimitError.ts +16 -0
  216. package/service/liveSyncHub.ts +24 -2
  217. package/service/predefinedAdaptor/agentTools.adaptor.ts +34 -0
  218. package/service/predefinedAdaptor/anthropicLlm.ts +33 -14
  219. package/service/predefinedAdaptor/compress.adaptor.ts +2 -2
  220. package/service/predefinedAdaptor/database.adaptor.ts +62 -19
  221. package/service/predefinedAdaptor/index.ts +1 -0
  222. package/service/predefinedAdaptor/llm.adaptor.ts +24 -1
  223. package/service/predefinedAdaptor/openaiDialect.ts +72 -23
  224. package/service/predefinedAdaptor/openaiLlm.ts +1 -1
  225. package/service/predefinedAdaptor/role.adaptor.ts +2 -0
  226. package/service/predefinedAdaptor/solidPubsub.adaptor.ts +35 -2
  227. package/service/predefinedAdaptor/solidQueue.adaptor.ts +2 -2
  228. package/service/predefinedAdaptor/solidSqlite.ts +6 -3
  229. package/service/predefinedAdaptor/sql/DocumentHydrator.ts +95 -0
  230. package/service/predefinedAdaptor/sql/DocumentRowCodec.ts +192 -0
  231. package/service/predefinedAdaptor/sql/DocumentWriter.ts +298 -0
  232. package/service/predefinedAdaptor/sql/QueryScope.ts +70 -0
  233. package/service/predefinedAdaptor/sql/QueryWriter.ts +200 -0
  234. package/service/predefinedAdaptor/sql/SqlDocumentStore.ts +127 -1069
  235. package/service/predefinedAdaptor/sql/SqlTableSchema.ts +357 -0
  236. package/service/predefinedAdaptor/sql/StoredRows.ts +95 -0
  237. package/service/predefinedAdaptor/sql/TransactionScope.ts +14 -7
  238. package/service/predefinedAdaptor/sql/dialect/postgres.ts +1 -1
  239. package/service/predefinedAdaptor/sql/dialect/sqlite.ts +1 -1
  240. package/service/predefinedAdaptor/sql/driver/bunSqlite.ts +20 -9
  241. package/service/predefinedAdaptor/sql/driver/postgres.ts +1 -1
  242. package/service/predefinedAdaptor/sql/types.ts +28 -4
  243. package/service/predefinedAdaptor/sseData.ts +88 -0
  244. package/service/predefinedAdaptor/storage.adaptor.ts +2 -1
  245. package/service/predefinedAdaptor/websocket.adaptor.ts +74 -44
  246. package/service/serviceRegistry.ts +1 -0
  247. package/signal/SignalFailure.ts +35 -0
  248. package/signal/agent.signal.ts +15 -9
  249. package/signal/agentTurnStream.ts +23 -9
  250. package/signal/byIdRead.ts +18 -0
  251. package/signal/carriedClientIps.ts +1 -0
  252. package/signal/endpointCache.ts +61 -6
  253. package/signal/endpointErrorContract.ts +1 -1
  254. package/signal/endpointRateLimit.ts +84 -3
  255. package/signal/index.ts +322 -32
  256. package/signal/mcp/McpDocument.ts +8 -1
  257. package/signal/mcp/mcpProtocol.ts +6 -1
  258. package/signal/mcp/pagePrompt.ts +15 -0
  259. package/signal/middleware.ts +10 -3
  260. package/signal/openapi/openapi.ts +10 -1
  261. package/signal/resolveFieldContext.ts +34 -0
  262. package/signal/serializer/fetch.serializer.ts +22 -15
  263. package/signal/signalContext.ts +15 -42
  264. package/signal/slice.ts +22 -19
  265. package/signal/trace.ts +44 -5
  266. package/signal/types.ts +46 -8
  267. package/store/action.ts +32 -1057
  268. package/store/actionErrorMessage.ts +20 -0
  269. package/store/actionOption.ts +22 -0
  270. package/store/baseSt.ts +1 -0
  271. package/store/formFieldSetters.ts +229 -0
  272. package/store/index.ts +125 -17
  273. package/store/modelActionContext.ts +65 -0
  274. package/store/modelOpenActions.ts +158 -0
  275. package/store/modelWriteActions.ts +240 -0
  276. package/store/modelWriteGuard.ts +3 -12
  277. package/store/openSeq.ts +34 -0
  278. package/store/sliceListActions.ts +370 -0
  279. package/store/sliceLiveActions.ts +140 -0
  280. package/store/stateBuilder.ts +2 -0
  281. package/store/storeInstance.ts +4 -18
  282. package/store/storeRegistry.ts +1 -1
  283. package/test/conformance.ts +25 -5
  284. package/types/base/base.d.ts +2 -1
  285. package/types/client/clientRuntime.d.ts +1 -0
  286. package/types/client/cn.d.ts +2 -2
  287. package/types/client/csrTypes.d.ts +2 -0
  288. package/types/client/frameConfig.d.ts +1 -0
  289. package/types/client/index.d.ts +25 -26
  290. package/types/client/locale.d.ts +1 -0
  291. package/types/client/makePageProto.d.ts +5 -13
  292. package/types/client/nativeThemeColor.d.ts +6 -0
  293. package/types/client/route/PageDefinition.d.ts +5 -2
  294. package/types/client/route/RouteDefinition.d.ts +2 -2
  295. package/types/client/route/routeArgs.d.ts +7 -0
  296. package/types/client/router.d.ts +3 -1
  297. package/types/client/rscNavigation.d.ts +1 -0
  298. package/types/client/viewportMeta.d.ts +5 -2
  299. package/types/common/CodeTranscript.d.ts +1 -1
  300. package/types/common/clientAddress.d.ts +5 -0
  301. package/types/common/err.d.ts +48 -0
  302. package/types/common/eventStream.d.ts +5 -1
  303. package/types/common/facetBarrel.d.ts +4 -0
  304. package/types/common/index.d.ts +6 -3
  305. package/types/common/isGuardRefusal.d.ts +3 -0
  306. package/types/common/loggedFailure.d.ts +2 -0
  307. package/types/common/mcpExposure.d.ts +9 -2
  308. package/types/common/routeConvention.d.ts +2 -0
  309. package/types/common/types.d.ts +18 -1
  310. package/types/constant/constantRegistry.d.ts +3 -1
  311. package/types/constant/crystalize.d.ts +1 -1
  312. package/types/constant/getDefault.d.ts +1 -1
  313. package/types/constant/immerify.d.ts +1 -1
  314. package/types/constant/index.d.ts +21 -21
  315. package/types/constant/purify.d.ts +2 -1
  316. package/types/constant/serialize.d.ts +1 -1
  317. package/types/constant/types.d.ts +1 -0
  318. package/types/dictionary/agent.dictionary.d.ts +1 -1
  319. package/types/dictionary/base.dictionary.d.ts +1 -1
  320. package/types/dictionary/dictionary.d.ts +9 -9
  321. package/types/dictionary/locale.d.ts +1 -1
  322. package/types/dictionary/trans.d.ts +3 -26
  323. package/types/document/dataLoader.d.ts +5 -0
  324. package/types/document/databaseRegistry.d.ts +2 -1
  325. package/types/document/documentSchema.d.ts +1 -0
  326. package/types/document/filterMeta.d.ts +4 -1
  327. package/types/document/into.d.ts +1 -1
  328. package/types/document/loaderInfo.d.ts +2 -1
  329. package/types/document/noDocumentError.d.ts +8 -1
  330. package/types/document/queryEvaluator.d.ts +1 -1
  331. package/types/document/types.d.ts +1 -1
  332. package/types/fetch/client/fetchClient.d.ts +6 -36
  333. package/types/fetch/client/fetchClientTypes.d.ts +40 -0
  334. package/types/fetch/client/httpClient.d.ts +2 -0
  335. package/types/fetch/client/remoteError.d.ts +0 -4
  336. package/types/fetch/client/requestScope.d.ts +11 -0
  337. package/types/fetch/client/signalCatalog.d.ts +25 -0
  338. package/types/fetch/client/wsClient.d.ts +2 -0
  339. package/types/fetch/requestStorage.d.ts +1 -0
  340. package/types/server/agentHooks.d.ts +4 -0
  341. package/types/server/akanApp.d.ts +2 -20
  342. package/types/server/akanOption.d.ts +16 -2
  343. package/types/server/akanServer.d.ts +2 -2
  344. package/types/server/assetHeaders.d.ts +1 -0
  345. package/types/server/console.d.ts +4 -3
  346. package/types/server/di/predefinedAdaptor.d.ts +1 -0
  347. package/types/server/di/stageFailedError.d.ts +5 -0
  348. package/types/server/ed25519Key.d.ts +1 -0
  349. package/types/server/flightRowReader.d.ts +8 -2
  350. package/types/server/gateway/childSupervisor.d.ts +35 -0
  351. package/types/server/gateway/devHostChannel.d.ts +14 -0
  352. package/types/server/gateway/gatewayChildren.d.ts +50 -0
  353. package/types/server/gateway/gatewayConfig.d.ts +82 -0
  354. package/types/server/gateway/gatewayHttpProxy.d.ts +22 -0
  355. package/types/server/gateway/gatewayLogging.d.ts +16 -0
  356. package/types/server/gateway/gatewayRooms.d.ts +25 -0
  357. package/types/server/gateway/gatewayStatus.d.ts +63 -0
  358. package/types/server/gateway/gatewayStatusPage.d.ts +9 -0
  359. package/types/server/gateway/gatewayWebSocketRelay.d.ts +17 -0
  360. package/types/server/gateway/listeningPort.d.ts +5 -0
  361. package/types/server/htmlResultCache.d.ts +51 -0
  362. package/types/server/index.d.ts +19 -17
  363. package/types/server/lifecycle/parentChannel.d.ts +13 -0
  364. package/types/server/lifecycle/startGuard.d.ts +10 -0
  365. package/types/server/logging/logHub.d.ts +5 -1
  366. package/types/server/logging/logStreamRoute.d.ts +2 -0
  367. package/types/server/logging/rotatingLogWriter.d.ts +1 -1
  368. package/types/server/logging/serverLogging.d.ts +12 -0
  369. package/types/server/mcp/AgentTools.d.ts +31 -0
  370. package/types/server/mcp/AgentToolsAccount.d.ts +7 -0
  371. package/types/server/mcp/McpApps.d.ts +6 -2
  372. package/types/server/mcp/McpDispatcher.d.ts +10 -1
  373. package/types/server/mcp/McpPages.d.ts +2 -1
  374. package/types/server/mcp/McpRateLimiter.d.ts +3 -0
  375. package/types/server/mcp/index.d.ts +1 -0
  376. package/types/server/migration/migrationCommand.d.ts +1 -1
  377. package/types/server/migration/migrationRunner.d.ts +9 -1
  378. package/types/server/remote/RemoteFetch.d.ts +42 -0
  379. package/types/server/remote/RemoteMcp.d.ts +52 -0
  380. package/types/server/remote/RemoteOAuth.d.ts +58 -0
  381. package/types/server/remote/RemoteSource.d.ts +51 -0
  382. package/types/server/remote/index.d.ts +5 -0
  383. package/types/server/remote/remoteError.d.ts +12 -0
  384. package/types/server/remote.d.ts +1 -0
  385. package/types/server/resolver/CascadeRunner.d.ts +2 -2
  386. package/types/server/resolver/database.resolver.d.ts +2 -2
  387. package/types/server/resolver/databaseModelInstance.d.ts +4 -0
  388. package/types/server/resolver/invalidSignal.d.ts +2 -0
  389. package/types/server/resolver/livePause.d.ts +5 -0
  390. package/types/server/resolver/modelFacade.d.ts +5 -0
  391. package/types/server/resolver/modelLoaders.d.ts +15 -0
  392. package/types/server/resolver/modelSchema.d.ts +6 -0
  393. package/types/server/resolver/roomAdmission.d.ts +7 -0
  394. package/types/server/resolver/signal.resolver.d.ts +1 -1
  395. package/types/server/resolver/sliceCrud.d.ts +8 -0
  396. package/types/server/resolver/timedQuery.d.ts +8 -0
  397. package/types/server/routeElementComposer.d.ts +21 -5
  398. package/types/server/routing/builtinRoutes.d.ts +24 -0
  399. package/types/server/routing/localRooms.d.ts +14 -0
  400. package/types/server/routing/roomReplay.d.ts +2 -2
  401. package/types/server/routing/serverListener.d.ts +31 -0
  402. package/types/server/rscClientCache.d.ts +34 -0
  403. package/types/server/rscClientChunks.d.ts +3 -1
  404. package/types/server/rscClientPatch.d.ts +12 -1
  405. package/types/server/rscDocumentHead.d.ts +33 -0
  406. package/types/server/rscFlightRenderer.d.ts +14 -0
  407. package/types/server/rscFlightStream.d.ts +53 -0
  408. package/types/server/rscHostReloads.d.ts +54 -0
  409. package/types/server/rscHostRenderStream.d.ts +53 -0
  410. package/types/server/rscHostRequests.d.ts +29 -0
  411. package/types/server/rscHttp.d.ts +4 -2
  412. package/types/server/rscNavigationState.d.ts +5 -1
  413. package/types/server/rscPagePrompts.d.ts +13 -0
  414. package/types/server/rscRenderControl.d.ts +12 -0
  415. package/types/server/rscRenderFallbacks.d.ts +41 -0
  416. package/types/server/rscRenderHandler.d.ts +29 -0
  417. package/types/server/rscRenderStats.d.ts +32 -0
  418. package/types/server/rscResultCaches.d.ts +18 -0
  419. package/types/server/rscRouteDocument.d.ts +52 -0
  420. package/types/server/rscStaticApp.d.ts +28 -0
  421. package/types/server/rscWorker.d.ts +1 -3
  422. package/types/server/rscWorkerHost.d.ts +10 -70
  423. package/types/server/rscWorkerProcess.d.ts +31 -0
  424. package/types/server/rscWorkerRecycler.d.ts +22 -0
  425. package/types/server/serverConfig.d.ts +30 -0
  426. package/types/server/serverMetrics.d.ts +11 -0
  427. package/types/server/sitemap.d.ts +1 -0
  428. package/types/server/ssrFromRscRenderer.d.ts +2 -2
  429. package/types/server/ssrStaticApp.d.ts +20 -0
  430. package/types/server/webArtifact.d.ts +7 -0
  431. package/types/server/webAssetRoutes.d.ts +11 -0
  432. package/types/server/webCsrSurface.d.ts +18 -0
  433. package/types/server/webDocumentRoute.d.ts +19 -0
  434. package/types/server/webRouteContext.d.ts +45 -0
  435. package/types/server/webRouter.d.ts +3 -28
  436. package/types/server/webRscRoute.d.ts +24 -0
  437. package/types/server/webSiteFiles.d.ts +12 -0
  438. package/types/server/webStaticApp.d.ts +8 -0
  439. package/types/server/wellKnownRoutes.d.ts +5 -0
  440. package/types/service/agent.service.d.ts +3 -0
  441. package/types/service/agentAccounts.d.ts +8 -0
  442. package/types/service/agentLoop/agentLoop.d.ts +33 -0
  443. package/types/service/agentLoop/agentLoopTypes.d.ts +235 -0
  444. package/types/service/agentLoop/deltaStream.d.ts +3 -0
  445. package/types/service/agentLoop/loopAnswer.d.ts +13 -0
  446. package/types/service/agentLoop/loopAsk.d.ts +12 -0
  447. package/types/service/agentLoop/loopCompaction.d.ts +12 -0
  448. package/types/service/agentLoop/loopRemotes.d.ts +40 -0
  449. package/types/service/agentLoop/loopRequest.d.ts +9 -0
  450. package/types/service/agentLoop/loopStored.d.ts +6 -0
  451. package/types/service/agentLoop/loopToolOutput.d.ts +8 -0
  452. package/types/service/agentLoop/loopToolkits.d.ts +17 -0
  453. package/types/service/agentLoop/loopTranscript.d.ts +13 -0
  454. package/types/{signal → service}/agentMeter.d.ts +1 -1
  455. package/types/{signal → service}/agentRelayPolicy.d.ts +18 -3
  456. package/types/service/index.d.ts +6 -0
  457. package/types/service/injectInfo.d.ts +2 -1
  458. package/types/service/ipcTypes.d.ts +10 -0
  459. package/types/service/liveRoomLimit.d.ts +26 -0
  460. package/types/service/liveRoomLimitError.d.ts +9 -0
  461. package/types/service/predefinedAdaptor/agentTools.adaptor.d.ts +31 -0
  462. package/types/service/predefinedAdaptor/anthropicLlm.d.ts +2 -2
  463. package/types/service/predefinedAdaptor/database.adaptor.d.ts +9 -7
  464. package/types/service/predefinedAdaptor/index.d.ts +1 -0
  465. package/types/service/predefinedAdaptor/llm.adaptor.d.ts +12 -0
  466. package/types/service/predefinedAdaptor/openaiDialect.d.ts +3 -2
  467. package/types/service/predefinedAdaptor/role.adaptor.d.ts +2 -0
  468. package/types/service/predefinedAdaptor/solidPubsub.adaptor.d.ts +3 -0
  469. package/types/service/predefinedAdaptor/solidSqlite.d.ts +1 -1
  470. package/types/service/predefinedAdaptor/sql/DocumentHydrator.d.ts +11 -0
  471. package/types/service/predefinedAdaptor/sql/DocumentRowCodec.d.ts +26 -0
  472. package/types/service/predefinedAdaptor/sql/DocumentWriter.d.ts +25 -0
  473. package/types/service/predefinedAdaptor/sql/QueryScope.d.ts +16 -0
  474. package/types/service/predefinedAdaptor/sql/QueryWriter.d.ts +20 -0
  475. package/types/service/predefinedAdaptor/sql/SqlDocumentStore.d.ts +5 -28
  476. package/types/service/predefinedAdaptor/sql/SqlTableSchema.d.ts +22 -0
  477. package/types/service/predefinedAdaptor/sql/StoredRows.d.ts +27 -0
  478. package/types/service/predefinedAdaptor/sql/TransactionScope.d.ts +3 -1
  479. package/types/service/predefinedAdaptor/sql/driver/bunSqlite.d.ts +3 -15
  480. package/types/service/predefinedAdaptor/sql/driver/postgres.d.ts +0 -8
  481. package/types/service/predefinedAdaptor/sql/types.d.ts +27 -4
  482. package/types/service/predefinedAdaptor/sseData.d.ts +13 -0
  483. package/types/service/predefinedAdaptor/websocket.adaptor.d.ts +7 -3
  484. package/types/service/serviceRegistry.d.ts +1 -0
  485. package/types/signal/SignalFailure.d.ts +4 -0
  486. package/types/signal/agentTurnStream.d.ts +3 -0
  487. package/types/signal/byIdRead.d.ts +7 -0
  488. package/types/signal/carriedClientIps.d.ts +4 -0
  489. package/types/signal/endpointRateLimit.d.ts +12 -0
  490. package/types/signal/index.d.ts +32 -32
  491. package/types/signal/mcp/McpDocument.d.ts +2 -0
  492. package/types/signal/mcp/mcpProtocol.d.ts +5 -0
  493. package/types/signal/mcp/pagePrompt.d.ts +13 -0
  494. package/types/signal/resolveFieldContext.d.ts +15 -0
  495. package/types/signal/serializer/fetch.serializer.d.ts +3 -1
  496. package/types/signal/signalContext.d.ts +2 -14
  497. package/types/signal/slice.d.ts +15 -13
  498. package/types/signal/trace.d.ts +12 -1
  499. package/types/signal/types.d.ts +38 -7
  500. package/types/store/action.d.ts +4 -27
  501. package/types/store/actionErrorMessage.d.ts +1 -0
  502. package/types/store/actionOption.d.ts +24 -0
  503. package/types/store/baseSt.d.ts +1 -0
  504. package/types/store/formFieldSetters.d.ts +80 -0
  505. package/types/store/index.d.ts +17 -16
  506. package/types/store/modelActionContext.d.ts +189 -0
  507. package/types/store/modelOpenActions.d.ts +12 -0
  508. package/types/store/modelWriteActions.d.ts +16 -0
  509. package/types/store/modelWriteGuard.d.ts +2 -5
  510. package/types/store/openSeq.d.ts +17 -0
  511. package/types/store/sliceListActions.d.ts +295 -0
  512. package/types/store/sliceLiveActions.d.ts +6 -0
  513. package/types/store/stateBuilder.d.ts +2 -0
  514. package/types/test/conformance.d.ts +3 -1
  515. package/types/ui/Agent/Chat.d.ts +5 -2
  516. package/types/ui/Agent/ChatHeader.d.ts +13 -0
  517. package/types/ui/Agent/ChatPendingCards.d.ts +23 -0
  518. package/types/ui/Agent/ToolRow.d.ts +13 -0
  519. package/types/ui/Field/Choice.d.ts +2 -1
  520. package/types/ui/Field/index.d.ts +1 -1
  521. package/types/ui/Reference/origin.d.ts +1 -0
  522. package/types/ui/UiOverride/UiOverride.d.ts +2 -0
  523. package/types/ui/index.d.ts +2 -1
  524. package/types/ui/overlayLayer.d.ts +8 -2
  525. package/types/ui/recipe/badgeRecipe.d.ts +3 -3
  526. package/types/ui/recipe/buttonRecipe.d.ts +3 -3
  527. package/types/ui/recipe/inputRecipe.d.ts +1 -1
  528. package/types/vendor/@akanjs/native/packages/cli/src/lib/project.d.ts +4 -0
  529. package/types/vendor/@akanjs/native/packages/desktop/src/relaunch.d.ts +1 -0
  530. package/types/vendor/@akanjs/native/plugins/appearance/src/index.d.ts +9 -0
  531. package/types/vendor/@akanjs/native/plugins/external-view/src/index.d.ts +22 -13
  532. package/types/vendor/@akanjs/native/plugins/single-instance/src/socket.d.ts +15 -2
  533. package/types/vendor/use-agentic/AgentClientTools.d.ts +19 -0
  534. package/types/vendor/use-agentic/Compaction.d.ts +3 -1
  535. package/types/vendor/use-agentic/SessionQuestion.d.ts +26 -0
  536. package/types/vendor/use-agentic/Transcript.d.ts +1 -1
  537. package/types/vendor/use-agentic/failureCode.d.ts +4 -0
  538. package/types/vendor/use-agentic/index.d.ts +1 -0
  539. package/types/vendor/use-agentic/types.d.ts +12 -3
  540. package/types/webkit/CsrGuards.d.ts +3 -0
  541. package/types/webkit/McpAppHost.d.ts +24 -0
  542. package/types/webkit/RouteLevelBoundary.d.ts +17 -0
  543. package/types/webkit/csrRefresh.d.ts +13 -0
  544. package/types/webkit/index.d.ts +3 -0
  545. package/types/webkit/needsBrowser.d.ts +5 -0
  546. package/types/webkit/useCamera.d.ts +1 -1
  547. package/types/webkit/useCsrKeyboard.d.ts +19 -0
  548. package/types/webkit/useCsrLocationState.d.ts +21 -0
  549. package/types/webkit/useCsrNavigation.d.ts +25 -0
  550. package/types/webkit/useCsrRefs.d.ts +33 -0
  551. package/types/webkit/useCsrRenderTrace.d.ts +13 -0
  552. package/types/webkit/useCsrStackLifecycle.d.ts +12 -0
  553. package/types/webkit/useCsrTransitions.d.ts +2 -0
  554. package/types/webkit/useGeoLocation.d.ts +1 -1
  555. package/types/webkit/useHistory.d.ts +2 -3
  556. package/types/webkit/useResolvedFrame.d.ts +38 -0
  557. package/types/webkit/useSyncNavigation.d.ts +22 -0
  558. package/ui/Agent/Bubble.tsx +4 -118
  559. package/ui/Agent/Chat.tsx +402 -235
  560. package/ui/Agent/ChatHeader.tsx +59 -0
  561. package/ui/Agent/ChatPendingCards.tsx +49 -0
  562. package/ui/Agent/ToolRow.tsx +117 -0
  563. package/ui/Agent/fetchRunner.ts +8 -1
  564. package/ui/BottomSheet.tsx +1 -1
  565. package/ui/Data/Item.tsx +2 -2
  566. package/ui/Data/ListContainer.tsx +348 -181
  567. package/ui/Data/useViewModal.ts +10 -4
  568. package/ui/Dialog/LegacyModal.tsx +1 -1
  569. package/ui/Dialog/Modal.tsx +1 -1
  570. package/ui/Field/Choice.tsx +3 -1
  571. package/ui/Load/StreamBoundary.tsx +1 -6
  572. package/ui/Load/View.tsx +2 -1
  573. package/ui/Model/EditModal.tsx +2 -1
  574. package/ui/Popconfirm.tsx +1 -1
  575. package/ui/Reference/origin.ts +1 -0
  576. package/ui/Select.tsx +43 -51
  577. package/ui/Signal/RestApi.tsx +3 -2
  578. package/ui/System/Client.tsx +4 -1
  579. package/ui/UiOverride/UiOverride.tsx +2 -0
  580. package/ui/index.ts +5 -0
  581. package/ui/overlayLayer.ts +25 -2
  582. package/vendor/@akanjs/native/native/android/src/com/akanjs/runtime/AkanNativeActivity.kt +31 -13
  583. package/vendor/@akanjs/native/native/android/src/com/akanjs/runtime/AkanNativePlugin.kt +4 -0
  584. package/vendor/@akanjs/native/native/desktop/Cargo.lock +1 -0
  585. package/vendor/@akanjs/native/native/desktop/Cargo.toml +2 -0
  586. package/vendor/@akanjs/native/native/desktop/src/external.rs +240 -114
  587. package/vendor/@akanjs/native/native/desktop/src/json.rs +14 -1
  588. package/vendor/@akanjs/native/native/desktop/src/lib.rs +12 -4
  589. package/vendor/@akanjs/native/native/desktop/src/linux/external.rs +696 -0
  590. package/vendor/@akanjs/native/native/desktop/src/linux/mod.rs +1 -0
  591. package/vendor/@akanjs/native/native/ios/Sources/AkanNativeViewController.swift +6 -1
  592. package/vendor/@akanjs/native/packages/cli/src/lib/native-plugins.ts +5 -3
  593. package/vendor/@akanjs/native/packages/cli/src/lib/project.ts +25 -1
  594. package/vendor/@akanjs/native/packages/desktop/src/deeplinks.ts +2 -2
  595. package/vendor/@akanjs/native/packages/desktop/src/host.ts +2 -2
  596. package/vendor/@akanjs/native/packages/desktop/src/relaunch.ts +8 -3
  597. package/vendor/@akanjs/native/plugins/app/src/desktop.ts +2 -2
  598. package/vendor/@akanjs/native/plugins/appearance/android/AppearancePlugin.kt +13 -0
  599. package/vendor/@akanjs/native/plugins/appearance/ios/AppearancePlugin.swift +27 -0
  600. package/vendor/@akanjs/native/plugins/appearance/native-plugin.json +2 -2
  601. package/vendor/@akanjs/native/plugins/appearance/src/index.ts +8 -1
  602. package/vendor/@akanjs/native/plugins/autostart/src/desktop.ts +2 -1
  603. package/vendor/@akanjs/native/plugins/external-view/native-plugin.json +4 -1
  604. package/vendor/@akanjs/native/plugins/external-view/src/index.ts +22 -13
  605. package/vendor/@akanjs/native/plugins/single-instance/src/socket.ts +113 -24
  606. package/vendor/use-agentic/AgentClientTools.ts +33 -0
  607. package/vendor/use-agentic/AgentSession.ts +35 -73
  608. package/vendor/use-agentic/CHANGELOG.md +0 -43
  609. package/vendor/use-agentic/Compaction.ts +12 -2
  610. package/vendor/use-agentic/SessionQuestion.ts +99 -0
  611. package/vendor/use-agentic/ToolRunner.ts +3 -15
  612. package/vendor/use-agentic/Transcript.ts +8 -5
  613. package/vendor/use-agentic/WIRE.md +28 -9
  614. package/vendor/use-agentic/failureCode.ts +44 -0
  615. package/vendor/use-agentic/httpRunner.ts +22 -8
  616. package/vendor/use-agentic/index.ts +1 -0
  617. package/vendor/use-agentic/types.ts +13 -1
  618. package/webkit/CsrGuards.ts +11 -2
  619. package/webkit/McpAppFetchBridge.ts +3 -1
  620. package/webkit/McpAppHost.ts +122 -0
  621. package/webkit/RenderLayer.tsx +48 -14
  622. package/webkit/RouteLevelBoundary.tsx +37 -0
  623. package/webkit/csrRefresh.ts +33 -0
  624. package/webkit/index.ts +3 -0
  625. package/webkit/lazy.tsx +5 -1
  626. package/webkit/needsBrowser.ts +10 -0
  627. package/webkit/useCamera.tsx +18 -7
  628. package/webkit/useCsrKeyboard.ts +155 -0
  629. package/webkit/useCsrLocationState.ts +58 -0
  630. package/webkit/useCsrNavigation.ts +302 -0
  631. package/webkit/useCsrRefs.ts +52 -0
  632. package/webkit/useCsrRenderTrace.ts +68 -0
  633. package/webkit/useCsrStackLifecycle.ts +120 -0
  634. package/webkit/useCsrTransitions.ts +552 -0
  635. package/webkit/useCsrValues.ts +73 -1235
  636. package/webkit/useGeoLocation.tsx +1 -3
  637. package/webkit/useHistory.ts +2 -2
  638. package/webkit/useLocation.ts +3 -2
  639. package/webkit/useResolvedFrame.ts +116 -0
  640. package/webkit/useSyncNavigation.ts +109 -0
  641. package/vendor/@akanjs/native/CHANGELOG.md +0 -21
@@ -0,0 +1,140 @@
1
+ import { DataList } from "akanjs/base";
2
+ import type { DynamicRecord } from "akanjs/common";
3
+ import type { BaseInsight, BaseObject } from "akanjs/constant";
4
+ import type { LiveEventPayload } from "akanjs/signal";
5
+ import { expandQueryArgs, normalizeQueryArgs } from "../fetch/client/sliceQueryArgs";
6
+ import { actionErrorMessageOf } from "./actionErrorMessage";
7
+ import { type LiveSortableRow, livePlacementIndex } from "./liveInsert";
8
+ import type { SliceListContext } from "./sliceListActions";
9
+ import type { SetGet } from "./types";
10
+
11
+ type Light = BaseObject;
12
+ interface Insight {
13
+ count: number;
14
+ }
15
+
16
+ export const sliceLiveActionsOf = (list: SliceListContext) => {
17
+ const { refName, fetch, cnst, keys, slice, namesOfSlice, lastPageFrom } = list;
18
+
19
+ let liveWatch: { signature: string; dispose: () => void } | null = null;
20
+ let liveWatchers = 0;
21
+ let liveClosed: { signature: string; at: Date } | null = null;
22
+ const closeLiveWatch = () => {
23
+ if (!liveWatch) return;
24
+ liveWatch.dispose();
25
+ liveClosed = { signature: liveWatch.signature, at: new Date() };
26
+ liveWatch = null;
27
+ };
28
+ const livePauseIdxs = (slice.live?.pauseOn ?? [])
29
+ .map((name) => slice.args.findIndex((arg) => arg.name === name))
30
+ .filter((idx) => idx >= 0);
31
+ return {
32
+
33
+ [namesOfSlice.applyLiveModel]: function (this: SetGet, event: LiveEventPayload) {
34
+ const currentState = this.get() as { [key: string]: any };
35
+ const modelList = currentState[namesOfSlice.modelList] as DataList<Light>;
36
+ const staleAt = { [namesOfSlice.modelStaleAt]: new Date() };
37
+
38
+ if (event.op === "invalidate" || (currentState[namesOfSlice.modelListLoading] as boolean)) {
39
+ this.set(staleAt);
40
+ return;
41
+ }
42
+ const modelInsight = currentState[namesOfSlice.modelInsight] as Insight & BaseInsight;
43
+ const limit = currentState[namesOfSlice.limitOfModel] as number;
44
+ const isCumulative = currentState[namesOfSlice.isCumulativeOfModel] as boolean;
45
+ const countedTo = (count: number) => ({
46
+ [namesOfSlice.modelInsight]: new cnst.insight().set({ ...modelInsight, count }),
47
+ ...lastPageFrom(count, limit),
48
+ });
49
+ if (event.op === "leave") {
50
+ if (!modelList.has(event.id)) return;
51
+ this.set({
52
+ [namesOfSlice.modelList]: new DataList(modelList).delete(event.id).save(),
53
+ ...countedTo(Math.max(modelInsight.count - 1, 0)),
54
+ ...staleAt,
55
+ });
56
+ return;
57
+ }
58
+ const light = event.light ? (new cnst.light().set(event.light) as unknown as Light) : null;
59
+ if (event.op === "update") {
60
+
61
+ if (!light || !modelList.has(event.id)) return;
62
+ this.set({ [namesOfSlice.modelList]: new DataList(modelList).set(light).save() });
63
+ return;
64
+ }
65
+
66
+ const placement =
67
+ light && !modelList.has(event.id)
68
+ ? livePlacementIndex({
69
+ list: modelList as unknown as LiveSortableRow[],
70
+ row: light as unknown as LiveSortableRow,
71
+ page: currentState[namesOfSlice.pageOfModel] as number,
72
+ limit,
73
+ count: modelInsight.count,
74
+ cumulative: isCumulative,
75
+ hasMore: currentState[namesOfSlice.hasMoreOfModel] as boolean,
76
+ sortKey: String(currentState[namesOfSlice.sortOfModel]),
77
+ allowedSorts: slice.live?.sort ?? [],
78
+ sorts: fetch.sortValueMap?.get(refName),
79
+ })
80
+ : null;
81
+ if (!light || placement === null) {
82
+ this.set({ ...(modelList.has(event.id) ? {} : countedTo(modelInsight.count + 1)), ...staleAt });
83
+ return;
84
+ }
85
+
86
+ const inserted = [...modelList.slice(0, placement), light, ...modelList.slice(placement)];
87
+ const placed = isCumulative || !limit ? inserted : inserted.slice(0, limit);
88
+ this.set({
89
+ [namesOfSlice.modelList]: new DataList(placed as Light[]),
90
+ ...countedTo(modelInsight.count + 1),
91
+ ...staleAt,
92
+ });
93
+ },
94
+
95
+ [namesOfSlice.watchLiveModel]: function (this: SetGet, queryArgs: unknown[] | null) {
96
+ if (!slice.live) return;
97
+ if (!queryArgs) {
98
+ liveWatchers = Math.max(liveWatchers - 1, 0);
99
+
100
+ if (!liveWatchers)
101
+ queueMicrotask(() => {
102
+ if (!liveWatchers) closeLiveWatch();
103
+ });
104
+ return;
105
+ }
106
+ liveWatchers += 1;
107
+ const args = expandQueryArgs(normalizeQueryArgs(queryArgs, slice.args), slice.args);
108
+
109
+ const paused = livePauseIdxs.some((idx) => args[idx] != null);
110
+ const signature = paused ? null : JSON.stringify(args);
111
+ if (liveWatch && signature !== liveWatch.signature) closeLiveWatch();
112
+ if (!signature || liveWatch) return;
113
+ const self = this as unknown as DynamicRecord;
114
+ const apply = self[namesOfSlice.applyLiveModel] as (event: unknown) => void;
115
+ const refresh = self[namesOfSlice.refreshModel] as (form: object) => Promise<void>;
116
+
117
+ const subscribe = fetch[keys.endpoint.subscribeLive] as ((...args: unknown[]) => () => void) | undefined;
118
+ if (!subscribe) return;
119
+ const dispose = subscribe(...args, (event: unknown) => apply(event), {
120
+ crystalize: false,
121
+
122
+ onResync: () => void refresh({ invalidate: true }),
123
+
124
+ onRefused: (error: unknown) => {
125
+ if (liveWatch?.signature === signature) liveWatch = null;
126
+ liveClosed = { signature, at: new Date() };
127
+ this.set({ [namesOfSlice.modelStaleAt]: new Date() });
128
+ const content = actionErrorMessageOf(error);
129
+ const store = this as unknown as { showMessage?: (message: object) => void };
130
+ store.showMessage?.({ type: "error", key: namesOfSlice.watchLiveModel, duration: 5, content });
131
+ },
132
+ });
133
+ liveWatch = { signature, dispose };
134
+
135
+ const modelInitAt = (this.get() as { [key: string]: any })[namesOfSlice.modelInitAt] as Date;
136
+ if (liveClosed?.signature === signature && modelInitAt < liveClosed.at)
137
+ this.set({ [namesOfSlice.modelStaleAt]: new Date() });
138
+ },
139
+ };
140
+ };
@@ -211,6 +211,7 @@ export const createDerivedStateBuilder = <WritableState>(): DerivedStateBuilder<
211
211
  ({ [STATE_BUILDER_MARK]: true, kind: "computed", deps, selector, options: options ?? {} }) as any,
212
212
  });
213
213
 
214
+ /** @internal */
214
215
  export const isStateBuilderMarker = (value: unknown): value is Marker =>
215
216
  Boolean(value && typeof value === "object" && (value as { [STATE_BUILDER_MARK]?: boolean })[STATE_BUILDER_MARK]);
216
217
 
@@ -425,6 +426,7 @@ const tryParseSearchArray = (raw: string): string[] => {
425
426
  }
426
427
  };
427
428
 
429
+ /** @deprecated Unused by akanjs; read `searchParams[key]`, taking the first value of an array. */
428
430
  export const getSearchParam = (searchParams: SearchParamsState, key: string): string | undefined =>
429
431
  firstSearchParam(searchParams[key]);
430
432
 
@@ -1,12 +1,12 @@
1
1
  import { ACTION_META, ACTION_OWNER_META, STATE_DERIVED_META, STATE_INIT_META } from "akanjs/base";
2
- import { isNativeApp, Translator } from "akanjs/client";
3
- import { AbortSignals, type DynamicRecord, isRecord, Logger, parseAkanI18nEnv, stateSetterName } from "akanjs/common";
2
+ import { isNativeApp } from "akanjs/client";
3
+ import { AbortSignals, type DynamicRecord, Logger, stateSetterName } from "akanjs/common";
4
4
  import { ConstantRegistry } from "akanjs/constant";
5
5
  import type { SerializedArg } from "akanjs/signal";
6
6
  import { enableMapSet, produce } from "immer";
7
7
  import type { EffectCallback, RefObject } from "react";
8
8
  import { type AgentGate, useAgentGate, useScopePath } from "../vendor/use-agentic";
9
- import { actionErrorKey } from "./actionErrorKey";
9
+ import { actionErrorMessageOf } from "./actionErrorMessage";
10
10
  import { type ActionOwner, actionTagOf, tagAction } from "./actionTag";
11
11
  import { useFormTools } from "./agentic/useFormTools";
12
12
  import { type DraftFlushing, flushDraftsKey } from "./draftFlush";
@@ -25,17 +25,6 @@ type StoreStateRecord = Record<string, unknown>;
25
25
 
26
26
  const DRAFT_DEBOUNCE_MS = 400;
27
27
  type StoreAction = (...args: unknown[]) => unknown;
28
- type TranslationParam = Record<string, string | number>;
29
-
30
- const getActionErrorData = (error: unknown): TranslationParam | undefined => {
31
- if (!isRecord(error) || !isRecord(error.data)) return undefined;
32
- const data = Object.fromEntries(
33
- Object.entries(error.data).filter((entry): entry is [string, string | number] =>
34
- ["string", "number"].includes(typeof entry[1]),
35
- ),
36
- );
37
- return Object.keys(data).length ? data : undefined;
38
- };
39
28
 
40
29
  export type ReactAPI = {
41
30
  useSyncExternalStore: <T>(
@@ -421,10 +410,7 @@ export class StoreInstance {
421
410
  const showMessage = this.#ctx.showMessage;
422
411
  if (typeof showMessage !== "function") return;
423
412
  try {
424
- const lang = Translator.getActiveLocale() ?? parseAkanI18nEnv().defaultLocale;
425
- const errorKey = actionErrorKey(error);
426
- const content = Translator.translateByLocale(lang, errorKey, getActionErrorData(error));
427
- showMessage({ type: "error", key: actionKey, duration: 3, content });
413
+ showMessage({ type: "error", key: actionKey, duration: 3, content: actionErrorMessageOf(error) });
428
414
  } catch (messageError) {
429
415
  Logger.warn(
430
416
  `Failed to show ${actionKey} action error message: ${
@@ -11,7 +11,7 @@ import {
11
11
  } from "akanjs/base";
12
12
  import { applyMixins, formSetterNames } from "akanjs/common";
13
13
  import { ConstantRegistry } from "akanjs/constant";
14
- import { attachAgentic } from "./agentic";
14
+ import { attachAgentic } from "./agentic/attachAgentic";
15
15
  import type { RootStoreCls } from "./rootStore";
16
16
  import type { StoreCls } from "./store";
17
17
  import { StoreInstance } from "./storeInstance";
@@ -1,3 +1,4 @@
1
+ import { test } from "bun:test";
1
2
  import { mkdtemp, rm } from "node:fs/promises";
2
3
  import { tmpdir } from "node:os";
3
4
  import path from "node:path";
@@ -12,6 +13,7 @@ import {
12
13
  SolidCache,
13
14
  type SqlDialect,
14
15
  SqliteDatabase,
16
+ type SqliteDatabaseConfig,
15
17
  SqliteDialect,
16
18
  } from "akanjs/service";
17
19
 
@@ -24,6 +26,7 @@ export type SqlDriverKind = "sqlite" | "postgres";
24
26
  export interface SqlDriverOptions {
25
27
  insight?: boolean;
26
28
  memory?: boolean;
29
+ sqlite?: SqliteDatabaseConfig;
27
30
  search?: SearchConfig;
28
31
  }
29
32
 
@@ -75,15 +78,24 @@ export class ConformanceEnv {
75
78
  return process.env[backendEnvNames[backend]]?.trim() || null;
76
79
  }
77
80
 
81
+ static get requireBackends() {
82
+ return process.env.AKAN_TEST_REQUIRE_BACKENDS?.trim() === "1";
83
+ }
84
+
78
85
  /** Says once per suite and backend when it is missing: a skipped suite must never read as a passing one. */
79
86
  static has(suite: string, backend: ConformanceBackend): boolean {
80
87
  if (ConformanceEnv.url(backend)) return true;
81
88
  const key = `${suite}:${backend}`;
82
89
  if (!ConformanceEnv.#announced.has(key)) {
83
90
  ConformanceEnv.#announced.add(key);
84
- console.info(
85
- `[conformance] ${suite}: ${backend} cases skipped — set ${backendEnvNames[backend]}, or run \`bun run testConformance\``,
86
- );
91
+ if (ConformanceEnv.requireBackends)
92
+ test(`${suite}: ${backend} backend is required`, () => {
93
+ throw new Error(`${suite}: ${backendEnvNames[backend]} is not set while AKAN_TEST_REQUIRE_BACKENDS=1`);
94
+ });
95
+ else
96
+ console.info(
97
+ `[conformance] ${suite}: ${backend} cases skipped — set ${backendEnvNames[backend]}, or run \`bun run testConformance\``,
98
+ );
87
99
  }
88
100
  return false;
89
101
  }
@@ -209,7 +221,7 @@ export class ConformanceEnv {
209
221
 
210
222
  static async #sqlStorage(
211
223
  kind: SqlDriverKind,
212
- { insight = false, memory = false, search: searchConfig }: SqlDriverOptions,
224
+ { insight = false, memory = false, sqlite, search: searchConfig }: SqlDriverOptions,
213
225
  ): Promise<{ config: object; remove: () => Promise<void> }> {
214
226
  const search = { enabled: true, tokenizer: DEFAULT_TOKENIZER, ...searchConfig };
215
227
  if (kind === "postgres") {
@@ -224,7 +236,15 @@ export class ConformanceEnv {
224
236
  const { dir, remove } = await ConformanceEnv.tempDir(`akan-${kind}`);
225
237
  const filePath = path.join(dir, "conformance.db");
226
238
  return {
227
- config: { filePath, journalMode: "WAL", busyTimeoutMs: 5000, synchronous: "NORMAL", foreignKeys: true, search },
239
+ config: {
240
+ filePath,
241
+ journalMode: "WAL",
242
+ busyTimeoutMs: 5000,
243
+ synchronous: "NORMAL",
244
+ foreignKeys: true,
245
+ ...sqlite,
246
+ search,
247
+ },
228
248
  remove,
229
249
  };
230
250
  }
@@ -1,5 +1,6 @@
1
- import type { CLIENT_VALUE, Cls, DEFAULT_VALUE, PURIFIED_VALUE, SERVER_VALUE } from ".";
2
1
  import { Float, Int } from "./primitiveRegistry.d.ts";
2
+ import type { CLIENT_VALUE, DEFAULT_VALUE, PURIFIED_VALUE, SERVER_VALUE } from "./symbols.d.ts";
3
+ import type { Cls } from "./types.d.ts";
3
4
  export type EnumInstance<RefName extends string = string, T = string | number> = Cls<{
4
5
  refName: RefName;
5
6
  value: T;
@@ -60,6 +60,7 @@ type RuntimeScope = "app" | "lib";
60
60
  export declare const registerClientRuntime: <Runtime>(runtime: Runtime, { scope }?: {
61
61
  scope?: RuntimeScope;
62
62
  }) => Runtime;
63
+ /** @internal */
63
64
  export declare const getClientRuntime: () => ClientRuntime;
64
65
  export declare const isClientRuntimeRegistered: () => boolean;
65
66
  export declare const msg: RuntimeMsg;
@@ -1,7 +1,7 @@
1
1
  import { type ClassNameValue } from "tailwind-merge";
2
- /** Registered with tailwind-merge so `cn("bg-primary", "bg-open")` resolves to `"bg-open"` instead of keeping both. */
2
+ /** @internal Registered with tailwind-merge so `cn("bg-primary", "bg-open")` resolves to `"bg-open"` instead of keeping both. */
3
3
  export declare const colorTokens: string[];
4
- /** `--radius-box` / `--radius-field`; unregistered, `cn("rounded-field", "rounded-full")` would keep both. */
4
+ /** @internal `--radius-box` / `--radius-field`; unregistered, `cn("rounded-field", "rounded-full")` would keep both. */
5
5
  export declare const radiusTokens: string[];
6
6
  /** Joins class parts and resolves Tailwind conflicts; object syntax (`{ x: cond }`) is unsupported — write `cond && "x"`. */
7
7
  export declare const cn: (...inputs: ClassNameValue[]) => string;
@@ -126,6 +126,8 @@ export interface RouteGuardProps {
126
126
  searchParams: Record<string, string | string[]>;
127
127
  /** MCP is listing the screen, so no argument is known: a guard reading one throws `RouteArgPending`. */
128
128
  listing?: boolean;
129
+ /** The CSR target's in-app path; a server request's own URL gives it when this is left off. */
130
+ path?: string;
129
131
  }
130
132
  export type RouteGuard = (props: RouteGuardProps) => Promise<void>;
131
133
  export interface RouteRender {
@@ -23,6 +23,7 @@ export declare const breakpointQuery: (name: TailwindBreakpoint, { below }?: {
23
23
  below?: boolean;
24
24
  }) => string;
25
25
  export declare const validatePageConfig: (routeKey: string, config?: PageConfig) => void;
26
+ /** @internal */
26
27
  export declare const isResponsiveInset: (inset: PageConfig["topInset"]) => inset is ResponsiveInset;
27
28
  /** The inset at each breakpoint, each one the nearest declared value at or below it. */
28
29
  export declare const insetsByBreakpoint: (inset: PageConfig["topInset"]) => { [bp in InsetBreakpoint]: number; };
@@ -1,27 +1,26 @@
1
- export * from "./clientRuntime.d.ts";
2
- export * from "./cn.d.ts";
3
- export * from "./cookie.d.ts";
4
- export * from "./createFont.d.ts";
5
- export * from "./csrLocation.d.ts";
6
- export * from "./csrTypes.d.ts";
7
- export * from "./decorators.d.ts";
8
- export * from "./device.d.ts";
9
- export * from "./frameConfig.d.ts";
10
- export * from "./href.d.ts";
11
- export * from "./locale.d.ts";
12
- export * from "./makePageProto.d.ts";
13
- export * from "./mcpView.d.ts";
14
- export * from "./nativeHost.d.ts";
1
+ export { type ClientRuntime, Err, fetch, getClientRuntime, isClientRuntimeRegistered, msg, registerClientRuntime, sig, usePage, } from "./clientRuntime.d.ts";
2
+ export { cn, colorTokens, radiusTokens } from "./cn.d.ts";
3
+ export { authTokenKey, cookieJar, cookies, type GetOption, getAccount, getAuthToken, getCookie, getHeader, getSessionClaims, getStoredAuthToken, headers, initAuth, removeCookie, resetAuth, setAuth, setCookie, } from "./cookie.d.ts";
4
+ export { createFont, Inter, Nanum_Gothic_Coding, Noto_Sans_KR, Roboto } from "./createFont.d.ts";
5
+ export { CsrLocation, csrLocation } from "./csrLocation.d.ts";
6
+ export { type AkanHeadSnapshotNode, type AkanHeadSnapshotV1, type AnimatedDivProps, type ContainerTransition, type CsrContextType, type CsrNavigationKind, type CsrNavigationPhase, type CsrPageType, type CsrStackAccount, type CsrStackEntry, type CsrState, type CsrTransitionStyles, csrContext, DEFAULT_BOTTOM_INSET, DEFAULT_TOP_INSET, type FrameContentViewportState, type FrameLayer, type FrameLayerZIndex, type FrameLayoutState, type FramePlatformProfile, type FrameSlotBucket, type FrameSlotRegistration, type FrameSlotRole, type FrameSlotScope, type FrameSlotType, type FrameSnapshot, type FrameViewportState, type GenerateHead, type Head, type HeadProps, type History, type KeyboardAccessoryFrameState, type KeyboardFrameState, type LayoutErrorProps, type LayoutErrorRender, type LayoutFallbackRoute, type LayoutLoadingProps, type LayoutLoadingRender, type LayoutModule, type LayoutNotFoundProps, type LayoutNotFoundRender, type LayoutProps, type LayoutRender, type Location, type LocationState, type NavigationIntent, type PageActivity, type PageActivityState, type PageConfig, type PageLoadingProps, type PageLoadingRender, type PageModule, type PageProps, type PageRender, type PageSafeAreaConfig, type PageState, type PageTransition, type PathContextType, type PathRoute, pageActivityContext, pathContext, type ResolvedHead, type ResolveHead, type ResolveHeadResult, type ResponsiveInset, type Route, type RouteGuard, type RouteGuardProps, type RouteGuide, type RouteModule, type RouteRender, type RouterProps, type RouteState, type RouteViewport, type SafeAreaTransition, type SsrRenderMode, type TransitionAction, type TransitionActionContext, type TransitionPlan, type TransitionStyle, type UseCsrTransition, useCsr, usePathCtx, type WebAppManifest, type WebAppManifestIcon, } from "./csrTypes.d.ts";
7
+ export { Toast } from "./decorators.d.ts";
8
+ export { Device, debugFrame, isMobileDevice, isNativeTarget } from "./device.d.ts";
9
+ export { breakpointQuery, type DevicePlatform, defaultPageState, getExplicitPageConfigKeys, type InsetBreakpoint, insetAt, insetBreakpoints, insetsByBreakpoint, isResponsiveInset, mergePageConfigs, type ResolvePageStateOptions, readCssSafeAreaInsets, resolvePageState, type SafeAreaInsets, type TailwindBreakpoint, validatePageConfig, } from "./frameConfig.d.ts";
10
+ export { Href } from "./href.d.ts";
11
+ export { dictionaryContext } from "./locale.d.ts";
12
+ export { type ErrPayload, makePageProto, type PageErrConstructor, type PageErrInstance, type TransMessageOption, } from "./makePageProto.d.ts";
13
+ export { isMcpView } from "./mcpView.d.ts";
14
+ export { desktopPlatform, isNativeApp, isNativeShell, nativePlatform, openExternalUrl } from "./nativeHost.d.ts";
15
15
  export { type NavigationAttempt, type NavigationGuard, type NavigationKind, NavigationRefused, } from "./navigationGuards.d.ts";
16
- export * from "./resolveServerUrl.d.ts";
17
- export * from "./route.d.ts";
18
- export * from "./router.d.ts";
19
- export * from "./rscNavigation.d.ts";
20
- export * from "./sharedContext.d.ts";
21
- export * from "./storage.d.ts";
22
- export * from "./transitionTypes.d.ts";
23
- export * from "./translator.d.ts";
24
- export * from "./types.d.ts";
25
- export * from "./useClient.d.ts";
26
- export * from "./viewportMeta.d.ts";
27
- export * from "./webManifest.d.ts";
16
+ export { resolveServerUrl } from "./resolveServerUrl.d.ts";
17
+ export { assertGuardOnChain, isRouteDefinition, LayoutDefinition, type LayoutExtra, layout, PageDefinition, page, type ResolvedRouteModule, type ResolveRouteModuleOption, RootLayoutDefinition, RouteArgError, type RouteArgInfo, type RouteArgInput, type RouteArgOption, RouteArgPending, type RouteArgResolveOption, type RouteArgsShape, type RouteArgType, type RouteArgValue, type RouteBaseArgs, RouteDefinition, type RouteGuardRequest, RouteGuards, RouteHead, type RouteKind, type RouteModuleSource, type RoutePromptArgument, type RoutePromptMeta, type RouteSearchType, resolveRouteModule, rootLayout, routeArgsMarker, routeDefinitionMarker, } from "./route.d.ts";
18
+ export { AkanNotFoundError, AkanRedirectError, type DeepLinkOptions, getPathInfo, isRouteControl, normalizeDeepLinkHref, type RedirectMethod, type RedirectOptions, type RedirectStatus, type RouteManifest, type RouteOptions, type RouterInstance, router, } from "./router.d.ts";
19
+ export { clearRscNavigationCache, isRscNavigationFromCache, navigateRsc, type PrefetchPriority, prefetchRsc, refreshRsc, useRscNavigation, } from "./rscNavigation.d.ts";
20
+ export { sharedContext } from "./sharedContext.d.ts";
21
+ export { secretStorage, storage } from "./storage.d.ts";
22
+ export { type TransitionType, transitionTypes } from "./transitionTypes.d.ts";
23
+ export { type AllDictionary, type Dictionary, Translator } from "./translator.d.ts";
24
+ export { type DataAction, type DataColumn, type DataMenu, type DataMenuItem, type DataTool, type Font, getFontFaces, getFontFallbackName, getFontStyles, getFontVariableName, getOptimizedFontSrc, isFontOptimizationEnabled, isFontPreloadEnabled, loadFonts, type MenuItem, type ModelDashboardProps, type ModelEditProps, type ModelInsightProps, type ModelProps, type ModelsProps, type ModelViewProps, type ReactFont, type ReactFontCategory, type ReactFontDeclaration, type ReactFontDisplay, type ReactFontFace, type ReactFontPath, type ReactFontStyle, type ReactFontSubset, type RootLayoutProps, type UserMenuItem, } from "./types.d.ts";
25
+ export { type ThemeColorTag, ViewportMeta } from "./viewportMeta.d.ts";
26
+ export { getWebManifestBasePath, toManifestJson, webManifestHref } from "./webManifest.d.ts";
@@ -1,3 +1,4 @@
1
+ /** @deprecated Nothing in akanjs provides or reads it; removed in a later minor. */
1
2
  export declare const dictionaryContext: import("react").Context<{
2
3
  [key: string]: {
3
4
  [key: string]: string;
@@ -1,15 +1,7 @@
1
+ import { type ErrConstructor, type ErrPayload, type ErrRestoreOption } from "akanjs/common";
1
2
  import type { ReactNode } from "react";
2
- interface ErrRestoreOption {
3
- statusCode?: number;
4
- code?: string;
5
- details?: unknown;
6
- path?: string;
7
- timestamp?: string;
8
- }
9
- export interface ErrPayload extends ErrRestoreOption {
10
- error: string;
11
- data?: Record<string, unknown>;
12
- }
3
+ export type { ErrPayload } from "akanjs/common";
4
+ /** @deprecated `Err` from `akanjs/common`, the class `makePageProto`'s `Err` is. */
13
5
  export interface PageErrInstance extends Error {
14
6
  readonly error: string;
15
7
  readonly statusCode: number;
@@ -22,6 +14,7 @@ export interface PageErrInstance extends Error {
22
14
  statusCode: number;
23
15
  };
24
16
  }
17
+ /** @deprecated `ErrConstructor` from `akanjs/common`, the type `makePageProto` returns its `Err` as. */
25
18
  export interface PageErrConstructor<ErrorKey extends string> {
26
19
  new (key: ErrorKey, data?: Record<string, unknown>, option?: ErrRestoreOption): PageErrInstance;
27
20
  prototype: PageErrInstance;
@@ -48,7 +41,7 @@ export declare const makePageProto: <Dict extends {
48
41
  [key: string]: Record<string, unknown>;
49
42
  };
50
43
  }) => {
51
- Err: PageErrConstructor<ErrorKey>;
44
+ Err: ErrConstructor<ErrorKey>;
52
45
  msg: {
53
46
  info: (key: DictKey, option?: TransMessageOption) => void;
54
47
  success: (key: DictKey, option?: TransMessageOption) => void;
@@ -73,4 +66,3 @@ export declare const makePageProto: <Dict extends {
73
66
  lang: string;
74
67
  };
75
68
  };
76
- export {};
@@ -0,0 +1,6 @@
1
+ export declare class NativeThemeColor {
2
+ #private;
3
+ static follow(color: string | null): void;
4
+ static hex(color: string): string | null;
5
+ static pixelHex([red, green, blue, alpha]: Iterable<number>): string | null;
6
+ }
@@ -18,9 +18,12 @@ export declare class PageDefinition<Args extends RouteArgsShape = Record<never,
18
18
  /**
19
19
  * Publishes one component of this screen as an MCP App: a read-only tool whose arguments are the page's `.param()`
20
20
  * and `.search()`, and whose result a host draws with `load`'s element. `load` may only query. On the web the
21
- * element arrives as the render argument `name`. English description.
21
+ * element arrives as the render argument `name`. English description. `static: true` lets a host that runs no
22
+ * script ask the call for the element as HTML, drawn once on the server.
22
23
  */
23
- app<Name extends string>(name: Name & FreeName<Name, Args & Apps>, description: string, load: (args: RouteBaseArgs & Args) => PromiseOrObject<ReactNode>): PageDefinition<Args, Apps & { [Key in Name]: ReactNode; }>;
24
+ app<Name extends string>(name: Name & FreeName<Name, Args & Apps>, description: string, load: (args: RouteBaseArgs & Args) => PromiseOrObject<ReactNode>, option?: {
25
+ static?: boolean;
26
+ }): PageDefinition<Args, Apps & { [Key in Name]: ReactNode; }>;
24
27
  render(render: (args: RouteBaseArgs & Args & Apps) => PromiseOrObject<ReactNode>): this;
25
28
  get promptMeta(): RoutePromptMeta | undefined;
26
29
  get appMetas(): RoutePromptMeta[];
@@ -1,7 +1,7 @@
1
1
  import { type PromiseOrObject } from "akanjs/base";
2
2
  import type { ReactNode } from "react";
3
3
  import type { Head, LayoutModule, PageConfig, PageModule } from "../csrTypes.d.ts";
4
- import { type RouteArgInfo, type RouteArgInput, type RouteBaseArgs } from "./routeArgs.d.ts";
4
+ import { type RouteArgInfo, type RouteArgInput, type RouteBaseArgs, type RouteGuardRequest } from "./routeArgs.d.ts";
5
5
  export type RouteArgsShape = Record<string, unknown>;
6
6
  export type RouteKind = "page" | "layout" | "rootLayout";
7
7
  /** Interned: a definition built inside the pages bundle must be recognised by a loader bundled apart from it. */
@@ -22,7 +22,7 @@ export declare abstract class RouteDefinition<Args extends RouteArgsShape = Reco
22
22
  config(config: PageConfig): this;
23
23
  head(head: HeadStage<RouteBaseArgs & Args>): this;
24
24
  /** Runs before any layout body; refuses with `router.redirect()` or `router.notFound()`. */
25
- guard(guard: (args: RouteBaseArgs & Args) => void | Promise<void>): this;
25
+ guard(guard: (args: RouteBaseArgs & Args, request: RouteGuardRequest) => void | Promise<void>): this;
26
26
  loading(render: (args: RouteBaseArgs & Args & Extra) => PromiseOrObject<ReactNode>): this;
27
27
  render(render: (args: RouteBaseArgs & Args & Extra) => PromiseOrObject<ReactNode>): this;
28
28
  get pageConfig(): PageConfig | undefined;
@@ -12,6 +12,12 @@ export interface RouteArgOption {
12
12
  export interface RouteBaseArgs {
13
13
  lang: string;
14
14
  }
15
+ /** A guard's second argument. `path` is a target to send the visitor back to, never a reason to let them in: CSR asks
16
+ * a guard again only when the route or an arg it declared moves, so a query it did not declare can move on. */
17
+ export interface RouteGuardRequest {
18
+ /** The requested in-app path with its search, as `router.push` takes it; `undefined` while MCP lists the screen. */
19
+ path?: string;
20
+ }
15
21
  export interface RouteArgInfo {
16
22
  kind: "param" | "search";
17
23
  name: string;
@@ -33,6 +39,7 @@ export interface RoutePromptMeta {
33
39
  name: string;
34
40
  description: string;
35
41
  arguments: RoutePromptArgument[];
42
+ static?: boolean;
36
43
  }
37
44
  export declare class RouteArgError extends Error {
38
45
  readonly arg: RouteArgInfo;
@@ -67,6 +67,8 @@ export declare class AkanNotFoundError extends Error {
67
67
  readonly digest = "AKAN_NOT_FOUND";
68
68
  constructor();
69
69
  }
70
+ export declare const isRouteControl: (error: unknown) => boolean;
71
+ export declare const getRequestRoutePath: (lang: string) => string | undefined;
70
72
  export declare const normalizeDeepLinkHref: (href: string, origin?: string) => string;
71
73
  declare global {
72
74
  var __AKAN_ROUTER__: Router | undefined;
@@ -125,7 +127,7 @@ declare class Router {
125
127
  notFound(): never;
126
128
  setLang(lang: string): never;
127
129
  /** A pathname without its locale and base-path segments; unlike `getPath`, it needs no browser. */
128
- routeOf(pathname: string): string;
130
+ routeOf(pathname: string, lang?: string): string;
129
131
  getPath(pathname?: string): string;
130
132
  getFullPath(withLang?: boolean): string;
131
133
  getPrefix(): string;
@@ -27,6 +27,7 @@ export declare const navigateRsc: (href: string, options?: {
27
27
  }) => Promise<void> | undefined;
28
28
  export declare const prefetchRsc: (href: string, priority?: PrefetchPriority) => (() => void) | undefined;
29
29
  export declare const refreshRsc: () => Promise<void> | undefined;
30
+ /** @deprecated Not a hook; import `navigateRsc`, `clearRscNavigationCache` and `isRscNavigationFromCache`. */
30
31
  export declare const useRscNavigation: () => {
31
32
  clearCache: () => void;
32
33
  isFromCache: () => boolean;
@@ -1,4 +1,4 @@
1
- import type { RouteViewport } from "./csrTypes.d.ts";
1
+ import type { AkanHeadSnapshotNode, RouteViewport } from "./csrTypes.d.ts";
2
2
  export interface ThemeColorTag {
3
3
  content: string;
4
4
  media?: string;
@@ -11,8 +11,11 @@ export declare class ViewportMeta {
11
11
  }): string;
12
12
  /** The request's theme when it is known; otherwise `light`/`dark` follow the OS until the client names the theme. */
13
13
  static themeColors(viewport: RouteViewport | undefined, theme?: string): ThemeColorTag[];
14
+ static themeColorNodes(viewport: RouteViewport | undefined, theme?: string): AkanHeadSnapshotNode[];
14
15
  static applyContent(viewport: RouteViewport | undefined, { native }?: {
15
16
  native?: boolean;
16
17
  }): void;
17
- static applyThemeColor(viewport: RouteViewport | undefined, theme?: string): void;
18
+ static runtimeThemeColor(): string | null;
19
+ static applyThemeColor(viewport: RouteViewport | undefined, theme?: string): string | null;
20
+ static watchThemeColor(apply: () => void): () => void;
18
21
  }
@@ -1,4 +1,4 @@
1
- import type { CodeAgentApprovalRequest, CodeAgentEvent, CodeAgentQuestion, CodeAgentSessionInfo, CodeAgentStopReason, CodeAgentSubagent, CodeAgentToolOutcome, CodeAgentToolSummary } from "akanjs/common";
1
+ import type { CodeAgentApprovalRequest, CodeAgentEvent, CodeAgentQuestion, CodeAgentSessionInfo, CodeAgentStopReason, CodeAgentSubagent, CodeAgentToolOutcome, CodeAgentToolSummary } from "./codeAgentWire.d.ts";
2
2
  export type CodeTranscriptPart = {
3
3
  kind: "user";
4
4
  id: string;
@@ -1,5 +1,10 @@
1
1
  export declare const forwardedHeaders: readonly ["x-real-ip", "x-forwarded-for", "x-forwarded-port", "x-forwarded-host", "x-forwarded-proto"];
2
2
  export declare const normalizeIpAddress: (address: string) => string;
3
+ /**
4
+ * An IPv6 address as its /64 (`2001:db8:1:2::/64`), since one host is handed a whole /64 and may use any address in
5
+ * it; an IPv4 address, also when mapped into IPv6, as itself.
6
+ */
7
+ export declare const addressBlockOf: (address: string) => string;
3
8
  /**
4
9
  * Without `isTrusted`: `x-real-ip`, else the leftmost `x-forwarded-for` entry. With it: `x-forwarded-for` walked from
5
10
  * the nearest hop past every address it vouches for, and `x-real-ip` only when there is none. `null`, never a
@@ -0,0 +1,48 @@
1
+ import { AkanError } from "akanjs/base";
2
+ export interface ErrRestoreOption {
3
+ statusCode?: number;
4
+ /** A generalized failure's `AkanError` code, which a restored copy keeps so its caller can branch on it. */
5
+ code?: string;
6
+ details?: unknown;
7
+ path?: string;
8
+ timestamp?: string;
9
+ }
10
+ export interface ErrPayload extends ErrRestoreOption {
11
+ error: string;
12
+ data?: Record<string, unknown>;
13
+ }
14
+ export type ErrConstructor<ErrorKey extends string> = (new (key: ErrorKey, data?: Record<string, unknown>, option?: ErrRestoreOption) => Err) & {
15
+ prototype: Err;
16
+ fromJSON(payload: ErrPayload): Err;
17
+ is<Key extends ErrorKey>(error: unknown, ...keys: Key[]): error is Err & {
18
+ readonly error: Key;
19
+ };
20
+ BadRequest: ErrConstructor<ErrorKey>;
21
+ Unauthorized: ErrConstructor<ErrorKey>;
22
+ Forbidden: ErrConstructor<ErrorKey>;
23
+ NotFound: ErrConstructor<ErrorKey>;
24
+ Conflict: ErrConstructor<ErrorKey>;
25
+ };
26
+ export declare class Err extends AkanError<string, Record<string, unknown>> {
27
+ static status?: number;
28
+ readonly error: string;
29
+ readonly details?: unknown;
30
+ readonly path?: string;
31
+ readonly timestamp?: string;
32
+ constructor(key: string, data?: Record<string, unknown>, option?: ErrRestoreOption);
33
+ get forwarded(): boolean;
34
+ toString(): string;
35
+ toJSON(): ErrPayload & {
36
+ statusCode: number;
37
+ };
38
+ static fromJSON(this: unknown, payload: ErrPayload): Err;
39
+ static is<Key extends string>(error: unknown, ...keys: Key[]): error is Err & {
40
+ readonly error: Key;
41
+ };
42
+ static is<E extends AkanError>(this: abstract new (...args: never[]) => E, error: unknown, ...codes: E["code"][]): error is E;
43
+ static BadRequest: typeof Err;
44
+ static Unauthorized: typeof Err;
45
+ static Forbidden: typeof Err;
46
+ static NotFound: typeof Err;
47
+ static Conflict: typeof Err;
48
+ }
@@ -2,11 +2,15 @@ export interface EventStreamOptions {
2
2
  keepAliveMs?: number;
3
3
  /** What the keep-alive sends; a line starting with `:` is a comment every SSE client discards. */
4
4
  keepAliveChunk?: string;
5
+ /** Past this many queued bytes `write` drops and counts; the reader gets `{ type: "dropped", count }` on resuming. */
6
+ maxQueuedBytes?: number;
7
+ /** Drops in one stall past which the stream is errored and `onCancel` runs. */
8
+ maxDropped?: number;
5
9
  }
6
10
  export declare class EventStream {
7
11
  #private;
8
12
  static readonly defaultKeepAliveMs = 15000;
9
- constructor(onCancel: () => void, { keepAliveMs, keepAliveChunk }?: EventStreamOptions);
13
+ constructor(onCancel: () => void, { keepAliveMs, keepAliveChunk, maxQueuedBytes, maxDropped, }?: EventStreamOptions);
10
14
  get open(): boolean;
11
15
  response(headers?: {
12
16
  [key: string]: string;