akanjs 3.0.0-alpha.5 → 3.0.0-alpha.50

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 (597) hide show
  1. package/README.ko.md +1 -1
  2. package/README.md +1 -1
  3. package/base/baseEnv.ts +7 -4
  4. package/base/primitiveRegistry.ts +14 -10
  5. package/base/symbols.ts +4 -0
  6. package/client/capacitor.ts +34 -0
  7. package/client/clientRuntime.ts +10 -0
  8. package/client/cn.ts +7 -0
  9. package/client/csrTypes.ts +2 -0
  10. package/client/frameDebug.ts +3 -2
  11. package/common/deepObjectify.ts +21 -7
  12. package/common/index.ts +15 -0
  13. package/common/mcpExposure.ts +99 -0
  14. package/common/pathSet.ts +17 -5
  15. package/common/routeConvention.ts +52 -12
  16. package/constant/crystalize.ts +3 -1
  17. package/constant/immerify.ts +1 -1
  18. package/constant/index.ts +2 -0
  19. package/constant/labelOf.ts +17 -0
  20. package/constant/mask.ts +60 -0
  21. package/constant/purify.ts +17 -11
  22. package/constant/types.ts +14 -12
  23. package/constant/via.ts +6 -2
  24. package/dictionary/DictionaryLookup.ts +30 -0
  25. package/dictionary/agent.dictionary.ts +31 -0
  26. package/dictionary/agentTurn.dictionary.ts +29 -0
  27. package/dictionary/base.dictionary.ts +63 -0
  28. package/dictionary/dictInfo.ts +8 -0
  29. package/dictionary/dictionary.ts +9 -3
  30. package/dictionary/index.ts +1 -0
  31. package/document/index.ts +1 -0
  32. package/document/into.ts +2 -0
  33. package/document/noDocumentError.ts +12 -0
  34. package/fetch/agentTurn.ts +19 -0
  35. package/fetch/client/fetchClient.ts +106 -23
  36. package/fetch/client/httpClient.ts +12 -10
  37. package/fetch/client/wsClient.ts +29 -6
  38. package/fetch/fetchType/endpointFetch.type.ts +11 -5
  39. package/fetch/index.ts +1 -0
  40. package/index.ts +1 -1
  41. package/local/apps/serverLifecycle/serverLifecycle-local.db +0 -0
  42. package/local/apps/serverLifecycle/serverLifecycle-local.db-shm +0 -0
  43. package/local/apps/serverLifecycle/serverLifecycle-local.db-wal +0 -0
  44. package/local/apps/serverLifecycle/serverLifecycle-local_solid.db +0 -0
  45. package/local/apps/serverLifecycle/serverLifecycle-local_solid.db-shm +0 -0
  46. package/local/apps/serverLifecycle/serverLifecycle-local_solid.db-wal +0 -0
  47. package/package.json +11 -13
  48. package/server/akanApp.ts +33 -7
  49. package/server/akanOption.ts +63 -8
  50. package/server/akanServer.ts +193 -18
  51. package/server/animatedImage.ts +83 -0
  52. package/server/devtools/signalSerializer.ts +2 -2
  53. package/server/devtools/types.ts +4 -4
  54. package/server/di/diLifecycle.ts +123 -13
  55. package/server/di/predefinedAdaptor.ts +6 -0
  56. package/server/di/utils.ts +40 -0
  57. package/server/imageOptimizer.ts +33 -46
  58. package/server/lifecycle/shutdownManager.ts +1 -1
  59. package/server/mcp/McpAuth.ts +177 -0
  60. package/server/mcp/McpDispatcher.ts +245 -0
  61. package/server/mcp/McpEventStream.ts +76 -0
  62. package/server/mcp/McpExecutionContext.ts +105 -0
  63. package/server/mcp/McpRouter.ts +593 -0
  64. package/server/mcp/index.ts +5 -0
  65. package/server/resolver/CascadeRunner.ts +1 -1
  66. package/server/resolver/database.resolver.ts +8 -4
  67. package/server/resolver/signal.resolver.ts +63 -18
  68. package/server/routeTreeBuilder.ts +2 -44
  69. package/server/routing/appWsData.ts +8 -1
  70. package/server/rscWorker.tsx +6 -2
  71. package/server/subRouteIndexDocument.tsx +61 -0
  72. package/server/systemPageDocument.tsx +3 -3
  73. package/server/systemPages.tsx +49 -16
  74. package/server/vendor/akanjs-fetch.ts +1 -0
  75. package/server/webRouter.ts +132 -2
  76. package/service/adapt.ts +4 -4
  77. package/service/agent.service.ts +78 -0
  78. package/service/base.service.ts +2 -1
  79. package/service/index.ts +1 -0
  80. package/service/injectInfo.ts +8 -3
  81. package/service/predefinedAdaptor/database.adaptor.ts +30 -25
  82. package/service/predefinedAdaptor/deepseekLlm.ts +271 -0
  83. package/service/predefinedAdaptor/index.ts +3 -0
  84. package/service/predefinedAdaptor/insightQuery.ts +183 -0
  85. package/service/predefinedAdaptor/llm.adaptor.ts +116 -0
  86. package/service/predefinedAdaptor/queue.adaptor.ts +5 -2
  87. package/service/predefinedAdaptor/role.adaptor.ts +2 -0
  88. package/service/predefinedAdaptor/schedule.adaptor.ts +12 -5
  89. package/service/predefinedAdaptor/solidPubsub.adaptor.ts +10 -6
  90. package/service/predefinedAdaptor/solidQueue.adaptor.ts +6 -2
  91. package/service/predefinedAdaptor/solidSqlite.ts +11 -9
  92. package/service/predefinedAdaptor/websocket.adaptor.ts +6 -1
  93. package/service/serve.ts +16 -9
  94. package/signal/agent/AgentCatalogue.ts +165 -0
  95. package/signal/agent/index.ts +1 -0
  96. package/signal/agent.signal.ts +38 -0
  97. package/signal/agentTurn.ts +8 -0
  98. package/signal/agentTurnStream.ts +60 -0
  99. package/signal/base.signal.ts +2 -1
  100. package/signal/endpointInfo.ts +38 -2
  101. package/signal/guard.ts +28 -1
  102. package/signal/guards.ts +49 -1
  103. package/signal/index.ts +6 -0
  104. package/signal/intercept.ts +4 -4
  105. package/signal/internalArg.ts +7 -2
  106. package/signal/mcp/McpDocument.ts +286 -0
  107. package/signal/mcp/McpProgress.ts +106 -0
  108. package/signal/mcp/McpUriTemplate.ts +85 -0
  109. package/signal/mcp/Msg.ts +368 -0
  110. package/signal/mcp/index.ts +5 -0
  111. package/signal/mcp/mcpProtocol.ts +120 -0
  112. package/signal/middleware.ts +3 -3
  113. package/signal/openapi/openapi.ts +35 -173
  114. package/signal/schema/JsonSchemaBuilder.ts +211 -0
  115. package/signal/schema/index.ts +1 -0
  116. package/signal/serializer/fetch.serializer.ts +5 -0
  117. package/signal/signalContext.ts +50 -23
  118. package/signal/slice.ts +9 -9
  119. package/signal/types.ts +9 -1
  120. package/store/action.ts +16 -22
  121. package/store/actionTag.ts +33 -0
  122. package/store/agent/AgentBridge.ts +87 -0
  123. package/store/agent/AgentContext.ts +71 -0
  124. package/store/agent/AgentPrompts.ts +111 -0
  125. package/store/agent/ScreenReader.ts +319 -0
  126. package/store/agent/ScreenSettle.ts +45 -0
  127. package/store/agent/ScreenTarget.ts +129 -0
  128. package/store/agent/StoreCatalogue.ts +116 -0
  129. package/store/agent/StoreSurfaceSource.ts +221 -0
  130. package/store/agent/index.ts +13 -0
  131. package/store/agent/storeSurface.ts +28 -0
  132. package/store/agent/types.ts +16 -0
  133. package/store/agentic/StToolBuilder.ts +261 -0
  134. package/store/agentic/attachAgentic.ts +27 -0
  135. package/store/agentic/formFields.ts +194 -0
  136. package/store/agentic/index.ts +9 -0
  137. package/store/agentic/readableValue.ts +17 -0
  138. package/store/agentic/useFieldTool.ts +187 -0
  139. package/store/agentic/useFormTools.ts +79 -0
  140. package/store/agentic/useRelationFieldTool.ts +114 -0
  141. package/store/agentic/useStExpose.ts +18 -0
  142. package/store/agentic/useStState.ts +49 -0
  143. package/store/baseSt.ts +1 -1
  144. package/store/databaseStateNames.ts +31 -0
  145. package/store/formSetterNames.ts +35 -0
  146. package/store/index.ts +8 -0
  147. package/store/rootStore.ts +3 -1
  148. package/store/sliceRole.ts +36 -0
  149. package/store/state.ts +2 -12
  150. package/store/store.ts +9 -0
  151. package/store/storeInstance.ts +185 -20
  152. package/store/storeRegistry.ts +39 -1
  153. package/store/types.ts +12 -0
  154. package/store/withSelector.ts +7 -8
  155. package/test/index.ts +1 -1
  156. package/test/registerDom.ts +4 -0
  157. package/test/signalTestRuntime.ts +5 -5
  158. package/test/testServer.ts +8 -5
  159. package/types/base/baseEnv.d.ts +1 -1
  160. package/types/base/primitiveRegistry.d.ts +6 -6
  161. package/types/base/symbols.d.ts +4 -0
  162. package/types/client/capacitor.d.ts +39 -0
  163. package/types/client/clientRuntime.d.ts +2 -0
  164. package/types/client/cn.d.ts +5 -0
  165. package/types/client/csrTypes.d.ts +2 -0
  166. package/types/common/deepObjectify.d.ts +4 -2
  167. package/types/common/index.d.ts +2 -1
  168. package/types/common/mcpExposure.d.ts +60 -0
  169. package/types/common/routeConvention.d.ts +14 -0
  170. package/types/constant/index.d.ts +2 -0
  171. package/types/constant/labelOf.d.ts +6 -0
  172. package/types/constant/mask.d.ts +34 -0
  173. package/types/constant/purify.d.ts +2 -2
  174. package/types/constant/types.d.ts +2 -2
  175. package/types/dictionary/DictionaryLookup.d.ts +14 -0
  176. package/types/dictionary/agent.dictionary.d.ts +1 -0
  177. package/types/dictionary/agentTurn.dictionary.d.ts +1 -0
  178. package/types/dictionary/base.dictionary.d.ts +1 -1
  179. package/types/dictionary/dictInfo.d.ts +6 -0
  180. package/types/dictionary/dictionary.d.ts +11 -9
  181. package/types/dictionary/index.d.ts +1 -0
  182. package/types/document/index.d.ts +1 -0
  183. package/types/document/into.d.ts +2 -0
  184. package/types/document/noDocumentError.d.ts +12 -0
  185. package/types/fetch/agentTurn.d.ts +593 -0
  186. package/types/fetch/client/fetchClient.d.ts +10 -0
  187. package/types/fetch/client/httpClient.d.ts +2 -1
  188. package/types/fetch/fetchType/endpointFetch.type.d.ts +6 -4
  189. package/types/fetch/index.d.ts +1 -0
  190. package/types/index.d.ts +1 -1
  191. package/types/server/akanApp.d.ts +5 -0
  192. package/types/server/akanOption.d.ts +36 -6
  193. package/types/server/akanServer.d.ts +53 -7
  194. package/types/server/animatedImage.d.ts +7 -0
  195. package/types/server/devtools/types.d.ts +4 -4
  196. package/types/server/di/diLifecycle.d.ts +10 -2
  197. package/types/server/di/predefinedAdaptor.d.ts +4 -1
  198. package/types/server/di/utils.d.ts +16 -0
  199. package/types/server/mcp/McpAuth.d.ts +62 -0
  200. package/types/server/mcp/McpDispatcher.d.ts +54 -0
  201. package/types/server/mcp/McpEventStream.d.ts +18 -0
  202. package/types/server/mcp/McpExecutionContext.d.ts +44 -0
  203. package/types/server/mcp/McpRouter.d.ts +61 -0
  204. package/types/server/mcp/index.d.ts +5 -0
  205. package/types/server/mcp.d.ts +1 -0
  206. package/types/server/resolver/signal.resolver.d.ts +5 -3
  207. package/types/server/routing/appWsData.d.ts +7 -1
  208. package/types/server/subRouteIndexDocument.d.ts +8 -0
  209. package/types/server/systemPageDocument.d.ts +1 -0
  210. package/types/server/systemPages.d.ts +5 -0
  211. package/types/server/vendor/akanjs-fetch.d.ts +1 -0
  212. package/types/service/adapt.d.ts +2 -2
  213. package/types/service/agent.service.d.ts +32 -0
  214. package/types/service/base.service.d.ts +4 -0
  215. package/types/service/index.d.ts +1 -0
  216. package/types/service/injectInfo.d.ts +2 -2
  217. package/types/service/predefinedAdaptor/database.adaptor.d.ts +2 -2
  218. package/types/service/predefinedAdaptor/deepseekLlm.d.ts +76 -0
  219. package/types/service/predefinedAdaptor/index.d.ts +3 -0
  220. package/types/service/predefinedAdaptor/insightQuery.d.ts +50 -0
  221. package/types/service/predefinedAdaptor/llm.adaptor.d.ts +106 -0
  222. package/types/service/predefinedAdaptor/queue.adaptor.d.ts +3 -2
  223. package/types/service/predefinedAdaptor/role.adaptor.d.ts +2 -0
  224. package/types/service/predefinedAdaptor/schedule.adaptor.d.ts +10 -6
  225. package/types/service/predefinedAdaptor/solidQueue.adaptor.d.ts +6 -2
  226. package/types/service/predefinedAdaptor/solidSqlite.d.ts +2 -2
  227. package/types/service/serve.d.ts +3 -3
  228. package/types/signal/agent/AgentCatalogue.d.ts +100 -0
  229. package/types/signal/agent/index.d.ts +1 -0
  230. package/types/signal/agent.d.ts +1 -0
  231. package/types/signal/agent.signal.d.ts +24 -0
  232. package/types/signal/agentTurn.d.ts +9 -0
  233. package/types/signal/agentTurnStream.d.ts +24 -0
  234. package/types/signal/base.signal.d.ts +1 -1
  235. package/types/signal/endpointInfo.d.ts +21 -3
  236. package/types/signal/guard.d.ts +12 -0
  237. package/types/signal/guards.d.ts +23 -1
  238. package/types/signal/index.d.ts +6 -0
  239. package/types/signal/intercept.d.ts +2 -2
  240. package/types/signal/internalArg.d.ts +9 -2
  241. package/types/signal/mcp/McpDocument.d.ts +65 -0
  242. package/types/signal/mcp/McpProgress.d.ts +40 -0
  243. package/types/signal/mcp/McpUriTemplate.d.ts +26 -0
  244. package/types/signal/mcp/Msg.d.ts +143 -0
  245. package/types/signal/mcp/index.d.ts +5 -0
  246. package/types/signal/mcp/mcpProtocol.d.ts +107 -0
  247. package/types/signal/mcp.d.ts +1 -0
  248. package/types/signal/middleware.d.ts +7 -7
  249. package/types/signal/openapi/openapi.d.ts +3 -3
  250. package/types/signal/schema/JsonSchemaBuilder.d.ts +47 -0
  251. package/types/signal/schema/index.d.ts +1 -0
  252. package/types/signal/schema.d.ts +1 -0
  253. package/types/signal/signalContext.d.ts +18 -3
  254. package/types/signal/slice.d.ts +8 -8
  255. package/types/signal/types.d.ts +8 -1
  256. package/types/store/actionTag.d.ts +21 -0
  257. package/types/store/agent/AgentBridge.d.ts +37 -0
  258. package/types/store/agent/AgentContext.d.ts +16 -0
  259. package/types/store/agent/AgentPrompts.d.ts +31 -0
  260. package/types/store/agent/ScreenReader.d.ts +24 -0
  261. package/types/store/agent/ScreenSettle.d.ts +22 -0
  262. package/types/store/agent/ScreenTarget.d.ts +33 -0
  263. package/types/store/agent/StoreCatalogue.d.ts +26 -0
  264. package/types/store/agent/StoreSurfaceSource.d.ts +22 -0
  265. package/types/store/agent/index.d.ts +11 -0
  266. package/types/store/agent/storeSurface.d.ts +14 -0
  267. package/types/store/agent/types.d.ts +15 -0
  268. package/types/store/agent.d.ts +1 -0
  269. package/types/store/agentic/StToolBuilder.d.ts +57 -0
  270. package/types/store/agentic/attachAgentic.d.ts +19 -0
  271. package/types/store/agentic/formFields.d.ts +53 -0
  272. package/types/store/agentic/index.d.ts +9 -0
  273. package/types/store/agentic/readableValue.d.ts +3 -0
  274. package/types/store/agentic/useFieldTool.d.ts +22 -0
  275. package/types/store/agentic/useFormTools.d.ts +19 -0
  276. package/types/store/agentic/useRelationFieldTool.d.ts +27 -0
  277. package/types/store/agentic/useStExpose.d.ts +8 -0
  278. package/types/store/agentic/useStState.d.ts +12 -0
  279. package/types/store/agentic.d.ts +1 -0
  280. package/types/store/baseSt.d.ts +34 -34
  281. package/types/store/databaseStateNames.d.ts +25 -0
  282. package/types/store/formSetterNames.d.ts +30 -0
  283. package/types/store/index.d.ts +7 -0
  284. package/types/store/rootStore.d.ts +5 -1
  285. package/types/store/sliceRole.d.ts +25 -0
  286. package/types/store/store.d.ts +5 -1
  287. package/types/store/storeInstance.d.ts +33 -1
  288. package/types/store/storeRegistry.d.ts +5 -0
  289. package/types/store/types.d.ts +8 -0
  290. package/types/store/withSelector.d.ts +7 -8
  291. package/types/test/index.d.ts +1 -1
  292. package/types/test/registerDom.d.ts +1 -0
  293. package/types/test/signalTestRuntime.d.ts +2 -3
  294. package/types/test/testServer.d.ts +6 -4
  295. package/types/ui/Agent/Approval.d.ts +7 -0
  296. package/types/ui/Agent/Attach.d.ts +16 -0
  297. package/types/ui/Agent/Bubble.d.ts +23 -0
  298. package/types/ui/Agent/Chat.d.ts +49 -0
  299. package/types/ui/Agent/ChatCommands.d.ts +34 -0
  300. package/types/ui/Agent/Composer.d.ts +23 -0
  301. package/types/ui/Agent/Context.d.ts +9 -0
  302. package/types/ui/Agent/Dock.d.ts +17 -0
  303. package/types/ui/Agent/Guide.d.ts +9 -0
  304. package/types/ui/Agent/Launcher.d.ts +16 -0
  305. package/types/ui/Agent/Markdown.d.ts +11 -0
  306. package/types/ui/Agent/Menu.d.ts +17 -0
  307. package/types/ui/Agent/Mic.d.ts +8 -0
  308. package/types/ui/Agent/Question.d.ts +13 -0
  309. package/types/ui/Agent/Section.d.ts +10 -0
  310. package/types/ui/Agent/StateKey.d.ts +16 -0
  311. package/types/ui/Agent/Tool.d.ts +15 -0
  312. package/types/ui/Agent/Transcript.d.ts +13 -0
  313. package/types/ui/Agent/Zone.d.ts +25 -0
  314. package/types/ui/Agent/agentSessionOf.d.ts +18 -0
  315. package/types/ui/Agent/attachment.d.ts +34 -0
  316. package/types/ui/Agent/fetchRunner.d.ts +12 -0
  317. package/types/ui/Agent/index.d.ts +17 -0
  318. package/types/ui/Agent/index_.d.ts +1 -0
  319. package/types/ui/Agent/markdownBlocks.d.ts +34 -0
  320. package/types/ui/Agent/markdownSpans.d.ts +2 -0
  321. package/types/ui/Agent/markdownTable.d.ts +16 -0
  322. package/types/ui/Agent/sessionHistory.d.ts +14 -0
  323. package/types/ui/Agent/tokenCount.d.ts +6 -0
  324. package/types/ui/Agent/useChatAttachments.d.ts +24 -0
  325. package/types/ui/Agent/useChatVoice.d.ts +30 -0
  326. package/types/ui/Agent/useDraftRecall.d.ts +14 -0
  327. package/types/ui/Agent/useSlashMenu.d.ts +24 -0
  328. package/types/ui/Agent/voice.d.ts +71 -0
  329. package/types/ui/Agent.d.ts +1 -0
  330. package/types/ui/Badge.d.ts +1 -1
  331. package/types/ui/Button.d.ts +1 -1
  332. package/types/ui/Constant/Graph.d.ts +10 -0
  333. package/types/ui/Constant/index.d.ts +2 -1
  334. package/types/ui/Constant/schemaGraph.d.ts +39 -0
  335. package/types/ui/CsrImage.d.ts +1 -1
  336. package/types/ui/Data/Dashboard.d.ts +3 -2
  337. package/types/ui/Data/Insight.d.ts +1 -1
  338. package/types/ui/Data/ListContainer.d.ts +3 -3
  339. package/types/ui/Data/dataExport.d.ts +5 -0
  340. package/types/ui/Data/dataText.d.ts +6 -0
  341. package/types/ui/Dialog/LegacyModal.d.ts +13 -0
  342. package/types/ui/Dialog/Provider.d.ts +3 -1
  343. package/types/ui/Dialog/context.d.ts +8 -0
  344. package/types/ui/Dialog/index.d.ts +1 -0
  345. package/types/ui/DraggableList.d.ts +1 -1
  346. package/types/ui/Dropdown.d.ts +7 -1
  347. package/types/ui/Field.d.ts +1 -0
  348. package/types/ui/Image.d.ts +3 -3
  349. package/types/ui/Layout/BottomInset.d.ts +2 -1
  350. package/types/ui/Layout/BottomTab.d.ts +3 -2
  351. package/types/ui/Layout/index.d.ts +1 -1
  352. package/types/ui/LegacyModal.d.ts +24 -0
  353. package/types/ui/Loading/ProgressBar.d.ts +4 -0
  354. package/types/ui/Loading/Spin.d.ts +2 -1
  355. package/types/ui/Model/AdminPanel.d.ts +9 -2
  356. package/types/ui/Model/EditModal.d.ts +1 -1
  357. package/types/ui/Model/New.d.ts +3 -1
  358. package/types/ui/Model/NewWrapper.d.ts +2 -0
  359. package/types/ui/Model/NewWrapper_Client.d.ts +2 -1
  360. package/types/ui/Pagination.d.ts +2 -2
  361. package/types/ui/Radio.d.ts +1 -1
  362. package/types/ui/Reference/Collapse.d.ts +11 -0
  363. package/types/ui/Reference/Panel.d.ts +29 -0
  364. package/types/ui/Reference/Segmented.d.ts +17 -0
  365. package/types/ui/Reference/Summary.d.ts +13 -0
  366. package/types/ui/Reference/Toolbar.d.ts +21 -0
  367. package/types/ui/Reference/dictText.d.ts +6 -0
  368. package/types/ui/Reference/index.d.ts +7 -0
  369. package/types/ui/Reference/style.d.ts +20 -0
  370. package/types/ui/Reference.d.ts +1 -0
  371. package/types/ui/ScreenNavigator.d.ts +3 -1
  372. package/types/ui/Signal/Doc.d.ts +4 -6
  373. package/types/ui/Signal/Object.d.ts +2 -1
  374. package/types/ui/Signal/RestApi.d.ts +2 -1
  375. package/types/ui/Signal/WebSocket.d.ts +2 -1
  376. package/types/ui/Signal/endpointEntries.d.ts +20 -0
  377. package/types/ui/Signal/style.d.ts +9 -8
  378. package/types/ui/System/Messages.d.ts +1 -1
  379. package/types/ui/Tab/Provider.d.ts +3 -1
  380. package/types/ui/Tab/context.d.ts +3 -1
  381. package/types/ui/UiOverride/context.d.ts +14 -2
  382. package/types/ui/agentAttrs.d.ts +14 -0
  383. package/types/ui/index.d.ts +7 -1
  384. package/types/ui/overlayLayer.d.ts +37 -0
  385. package/types/ui/overlayPosition.d.ts +28 -0
  386. package/types/ui/recipe/badgeRecipe.d.ts +7 -3
  387. package/types/ui/recipe/buttonRecipe.d.ts +7 -3
  388. package/types/ui/recipe/inputRecipe.d.ts +5 -1
  389. package/types/vendor/use-agentic/AgentAbort.d.ts +17 -0
  390. package/types/vendor/use-agentic/AgentProgress.d.ts +27 -0
  391. package/types/vendor/use-agentic/AgentProvider.d.ts +18 -0
  392. package/types/vendor/use-agentic/AgentScope.d.ts +9 -0
  393. package/types/vendor/use-agentic/AgentSession.d.ts +123 -0
  394. package/types/vendor/use-agentic/Agentic.d.ts +21 -0
  395. package/types/vendor/use-agentic/AgenticSurface.d.ts +52 -0
  396. package/types/vendor/use-agentic/Compaction.d.ts +48 -0
  397. package/types/vendor/use-agentic/ToolOutput.d.ts +21 -0
  398. package/types/vendor/use-agentic/Transcript.d.ts +18 -0
  399. package/types/vendor/use-agentic/httpRunner.d.ts +15 -0
  400. package/types/vendor/use-agentic/index.d.ts +18 -0
  401. package/types/vendor/use-agentic/surfaceContext.d.ts +5 -0
  402. package/types/vendor/use-agentic/types.d.ts +182 -0
  403. package/types/vendor/use-agentic/useAgent.d.ts +4 -0
  404. package/types/vendor/use-agentic/useAgentGuide.d.ts +6 -0
  405. package/types/vendor/use-agentic/useAgentResource.d.ts +12 -0
  406. package/types/vendor/use-agentic/useAgentState.d.ts +16 -0
  407. package/types/vendor/use-agentic/useAgentTool.d.ts +16 -0
  408. package/types/vendor/use-agentic.d.ts +1 -0
  409. package/types/webkit/index.d.ts +5 -0
  410. package/types/webkit/lazy.d.ts +12 -0
  411. package/types/webkit/useBodyScrollLock.d.ts +2 -0
  412. package/types/webkit/useCsrValues.d.ts +3 -3
  413. package/types/webkit/useEscapeKey.d.ts +5 -0
  414. package/types/webkit/useFrameRuntime.d.ts +6 -1
  415. package/types/webkit/usePageTool.d.ts +19 -0
  416. package/types/webkit/useScreenScope.d.ts +25 -0
  417. package/ui/Agent/Approval.tsx +29 -0
  418. package/ui/Agent/Attach.tsx +77 -0
  419. package/ui/Agent/Bubble.tsx +187 -0
  420. package/ui/Agent/Chat.tsx +434 -0
  421. package/ui/Agent/ChatCommands.ts +141 -0
  422. package/ui/Agent/Composer.tsx +77 -0
  423. package/ui/Agent/Context.tsx +38 -0
  424. package/ui/Agent/Dock.tsx +75 -0
  425. package/ui/Agent/Guide.tsx +16 -0
  426. package/ui/Agent/Launcher.tsx +57 -0
  427. package/ui/Agent/Markdown.tsx +125 -0
  428. package/ui/Agent/Menu.tsx +52 -0
  429. package/ui/Agent/Mic.tsx +27 -0
  430. package/ui/Agent/Question.tsx +60 -0
  431. package/ui/Agent/Section.tsx +24 -0
  432. package/ui/Agent/StateKey.tsx +46 -0
  433. package/ui/Agent/Tool.tsx +73 -0
  434. package/ui/Agent/Transcript.tsx +33 -0
  435. package/ui/Agent/Zone.tsx +80 -0
  436. package/ui/Agent/agentSessionOf.ts +41 -0
  437. package/ui/Agent/attachment.ts +73 -0
  438. package/ui/Agent/fetchRunner.ts +44 -0
  439. package/ui/Agent/index.ts +12 -0
  440. package/ui/Agent/index_.tsx +4 -0
  441. package/ui/Agent/markdownBlocks.ts +135 -0
  442. package/ui/Agent/markdownSpans.tsx +49 -0
  443. package/ui/Agent/markdownTable.ts +54 -0
  444. package/ui/Agent/sessionHistory.ts +55 -0
  445. package/ui/Agent/tokenCount.ts +10 -0
  446. package/ui/Agent/useChatAttachments.ts +84 -0
  447. package/ui/Agent/useChatVoice.ts +129 -0
  448. package/ui/Agent/useDraftRecall.ts +42 -0
  449. package/ui/Agent/useSlashMenu.ts +58 -0
  450. package/ui/Agent/voice.ts +177 -0
  451. package/ui/Badge.tsx +3 -3
  452. package/ui/BottomSheet.tsx +37 -36
  453. package/ui/Button.tsx +6 -2
  454. package/ui/Clipboard.tsx +3 -6
  455. package/ui/Constant/Doc.tsx +265 -254
  456. package/ui/Constant/Graph.tsx +151 -0
  457. package/ui/Constant/index.ts +3 -2
  458. package/ui/Constant/schemaGraph.ts +232 -0
  459. package/ui/CsrImage.tsx +1 -1
  460. package/ui/Data/CardList.tsx +14 -3
  461. package/ui/Data/Dashboard.tsx +34 -50
  462. package/ui/Data/Insight.tsx +18 -12
  463. package/ui/Data/Item.tsx +42 -56
  464. package/ui/Data/ListContainer.tsx +226 -126
  465. package/ui/Data/Pagination.tsx +10 -3
  466. package/ui/Data/TableList.tsx +22 -13
  467. package/ui/Data/dataExport.ts +54 -0
  468. package/ui/Data/dataText.ts +22 -0
  469. package/ui/DatePicker.tsx +5 -4
  470. package/ui/Dialog/Close.tsx +3 -7
  471. package/ui/Dialog/LegacyModal.tsx +241 -0
  472. package/ui/Dialog/Modal.tsx +66 -202
  473. package/ui/Dialog/Provider.tsx +46 -3
  474. package/ui/Dialog/Trigger.tsx +3 -7
  475. package/ui/Dialog/context.ts +11 -0
  476. package/ui/Dialog/index.tsx +2 -0
  477. package/ui/DraggableList.tsx +9 -3
  478. package/ui/Dropdown.tsx +110 -24
  479. package/ui/Empty.tsx +6 -4
  480. package/ui/Field.tsx +101 -32
  481. package/ui/Image.tsx +3 -3
  482. package/ui/Input.tsx +34 -10
  483. package/ui/KeyboardAvoiding.tsx +2 -2
  484. package/ui/Layout/BottomInset.tsx +6 -1
  485. package/ui/Layout/BottomTab.tsx +32 -37
  486. package/ui/Layout/Sider.tsx +31 -14
  487. package/ui/LegacyModal.tsx +53 -0
  488. package/ui/Link/CsrLink.tsx +1 -1
  489. package/ui/Load/Pagination.tsx +15 -8
  490. package/ui/Load/Units.tsx +27 -6
  491. package/ui/Load/View.tsx +10 -3
  492. package/ui/Loading/Area.tsx +7 -6
  493. package/ui/Loading/Button.tsx +7 -9
  494. package/ui/Loading/Input.tsx +7 -9
  495. package/ui/Loading/ProgressBar.tsx +18 -2
  496. package/ui/Loading/Skeleton.tsx +8 -13
  497. package/ui/Loading/Spin.tsx +20 -14
  498. package/ui/Menu.tsx +8 -9
  499. package/ui/Model/AdminPanel.tsx +41 -11
  500. package/ui/Model/EditModal.tsx +66 -7
  501. package/ui/Model/EditWrapper.tsx +19 -4
  502. package/ui/Model/New.tsx +4 -0
  503. package/ui/Model/NewWrapper.tsx +2 -0
  504. package/ui/Model/NewWrapper_Client.tsx +21 -6
  505. package/ui/Model/Remove.tsx +17 -6
  506. package/ui/Model/RemoveWrapper.tsx +11 -2
  507. package/ui/Model/SureToRemove.tsx +23 -7
  508. package/ui/Model/ViewEditModal.tsx +67 -15
  509. package/ui/Model/ViewModal.tsx +26 -11
  510. package/ui/Model/ViewWrapper.tsx +14 -4
  511. package/ui/Model/index_.tsx +42 -15
  512. package/ui/ObjectId.tsx +3 -4
  513. package/ui/Pagination.tsx +52 -68
  514. package/ui/Popconfirm.tsx +87 -81
  515. package/ui/Radio.tsx +53 -24
  516. package/ui/Reference/Collapse.tsx +26 -0
  517. package/ui/Reference/Panel.tsx +79 -0
  518. package/ui/Reference/Segmented.tsx +41 -0
  519. package/ui/Reference/Summary.tsx +25 -0
  520. package/ui/Reference/Toolbar.tsx +44 -0
  521. package/ui/Reference/dictText.ts +9 -0
  522. package/ui/Reference/index.ts +7 -0
  523. package/ui/Reference/style.ts +45 -0
  524. package/ui/ScreenNavigator.tsx +14 -0
  525. package/ui/Select.tsx +92 -58
  526. package/ui/Signal/Arg.tsx +50 -52
  527. package/ui/Signal/Doc.tsx +163 -129
  528. package/ui/Signal/Listener.tsx +24 -28
  529. package/ui/Signal/Message.tsx +87 -135
  530. package/ui/Signal/Object.tsx +79 -57
  531. package/ui/Signal/PubSub.tsx +72 -113
  532. package/ui/Signal/Request.tsx +2 -22
  533. package/ui/Signal/Response.tsx +19 -45
  534. package/ui/Signal/RestApi.tsx +170 -200
  535. package/ui/Signal/WebSocket.tsx +29 -26
  536. package/ui/Signal/endpointEntries.ts +59 -0
  537. package/ui/Signal/style.ts +34 -29
  538. package/ui/Switch.tsx +4 -0
  539. package/ui/System/CSR.tsx +7 -3
  540. package/ui/System/Client.tsx +5 -5
  541. package/ui/System/DevModeToggle.tsx +1 -1
  542. package/ui/System/Gtag.tsx +2 -2
  543. package/ui/System/Messages.tsx +52 -31
  544. package/ui/System/Reconnect.tsx +22 -56
  545. package/ui/System/SelectLanguage.tsx +23 -15
  546. package/ui/System/ThemeToggle.tsx +12 -10
  547. package/ui/Tab/Menu.tsx +24 -12
  548. package/ui/Tab/Menus.tsx +6 -3
  549. package/ui/Tab/Provider.tsx +31 -3
  550. package/ui/Tab/context.ts +5 -2
  551. package/ui/Table.tsx +66 -60
  552. package/ui/ToggleSelect.tsx +7 -8
  553. package/ui/Tooltip.tsx +17 -2
  554. package/ui/UiOverride/context.ts +14 -2
  555. package/ui/Unauthorized.tsx +6 -4
  556. package/ui/agentAttrs.ts +19 -0
  557. package/ui/index.ts +13 -1
  558. package/ui/overlayLayer.ts +48 -0
  559. package/ui/overlayPosition.ts +104 -0
  560. package/ui/recipe/badgeRecipe.ts +22 -3
  561. package/ui/recipe/buttonRecipe.ts +53 -4
  562. package/ui/recipe/factory.ts +2 -2
  563. package/ui/recipe/inputRecipe.ts +18 -4
  564. package/ui/styles.css +27 -0
  565. package/vendor/use-agentic/AgentAbort.ts +29 -0
  566. package/vendor/use-agentic/AgentProgress.ts +40 -0
  567. package/vendor/use-agentic/AgentProvider.tsx +39 -0
  568. package/vendor/use-agentic/AgentScope.tsx +20 -0
  569. package/vendor/use-agentic/AgentSession.ts +638 -0
  570. package/vendor/use-agentic/Agentic.tsx +44 -0
  571. package/vendor/use-agentic/AgenticSurface.ts +318 -0
  572. package/vendor/use-agentic/Compaction.ts +120 -0
  573. package/vendor/use-agentic/ToolOutput.ts +60 -0
  574. package/vendor/use-agentic/Transcript.ts +50 -0
  575. package/vendor/use-agentic/WIRE.md +87 -0
  576. package/vendor/use-agentic/httpRunner.ts +131 -0
  577. package/vendor/use-agentic/index.ts +19 -0
  578. package/vendor/use-agentic/surfaceContext.ts +9 -0
  579. package/vendor/use-agentic/types.ts +193 -0
  580. package/vendor/use-agentic/useAgent.ts +17 -0
  581. package/vendor/use-agentic/useAgentGuide.ts +16 -0
  582. package/vendor/use-agentic/useAgentResource.ts +36 -0
  583. package/vendor/use-agentic/useAgentState.ts +65 -0
  584. package/vendor/use-agentic/useAgentTool.ts +55 -0
  585. package/webkit/bootCsr.tsx +2 -33
  586. package/webkit/index.ts +5 -0
  587. package/webkit/lazy.tsx +27 -3
  588. package/webkit/useBodyScrollLock.tsx +29 -0
  589. package/webkit/useCsrValues.ts +121 -4
  590. package/webkit/useEscapeKey.tsx +42 -0
  591. package/webkit/useFrameRuntime.ts +66 -33
  592. package/webkit/usePageTool.tsx +39 -0
  593. package/webkit/useScreenScope.tsx +60 -0
  594. package/types/ui/Constant/Mermaid.d.ts +0 -8
  595. package/types/ui/Signal/Collapse.d.ts +0 -12
  596. package/ui/Constant/Mermaid.tsx +0 -149
  597. package/ui/Signal/Collapse.tsx +0 -29
package/README.ko.md CHANGED
@@ -26,7 +26,7 @@ generated reference가 같은 의도에서 이어집니다.
26
26
 
27
27
  ## 요구사항
28
28
 
29
- - [Bun](https://bun.sh) `>=1.3.13`
29
+ - [Bun](https://bun.sh) `>=1.4.0`
30
30
  - TypeScript 중심의 애플리케이션 코드
31
31
  - React 기반 UI surface
32
32
 
package/README.md CHANGED
@@ -25,7 +25,7 @@ server, app packaging, deployment artifacts, and generated references.
25
25
 
26
26
  ## Requirements
27
27
 
28
- - [Bun](https://bun.sh) `>=1.3.13`
28
+ - [Bun](https://bun.sh) `>=1.4.0`
29
29
  - TypeScript-first application code
30
30
  - React-based UI surfaces
31
31
 
package/base/baseEnv.ts CHANGED
@@ -15,7 +15,7 @@ export interface BaseEnv {
15
15
  operationMode: "local" | "edge" | "cloud" | "module";
16
16
  databaseMode?: DatabaseMode;
17
17
  }
18
- export type BackendEnv = BaseEnv & {
18
+ export type BackendEnv = {
19
19
  hostname?: string | null;
20
20
  port?: number;
21
21
  database?: {
@@ -73,15 +73,18 @@ export type ClientEnv = BaseEnv & {
73
73
 
74
74
  let cachedEnv: ClientEnv | undefined;
75
75
 
76
+ const missingPublicEnv = (key: string) =>
77
+ `getEnv() cannot run at build time: akan build does not inject ${key}. Call it from a runtime function instead of at module scope (e.g. env(() => getEnv()) in adapt(), a method body, or a default thunk).`;
78
+
76
79
  /** Reads and caches Akan runtime environment values from process/browser environment settings. */
77
80
  export const getEnv = (): ClientEnv => {
78
81
  if (cachedEnv) return cachedEnv;
79
82
  const appName = process.env.AKAN_PUBLIC_APP_NAME ?? "unknown";
80
83
  const repoName = process.env.AKAN_PUBLIC_REPO_NAME ?? "unknown";
81
84
  const serveDomain = process.env.AKAN_PUBLIC_SERVE_DOMAIN ?? "unknown";
82
- if (appName === "unknown") throw new Error("environment variable AKAN_PUBLIC_APP_NAME is required");
83
- if (repoName === "unknown") throw new Error("environment variable AKAN_PUBLIC_REPO_NAME is required");
84
- if (serveDomain === "unknown") throw new Error("environment variable AKAN_PUBLIC_SERVE_DOMAIN is required");
85
+ if (appName === "unknown") throw new Error(missingPublicEnv("AKAN_PUBLIC_APP_NAME"));
86
+ if (repoName === "unknown") throw new Error(missingPublicEnv("AKAN_PUBLIC_REPO_NAME"));
87
+ if (serveDomain === "unknown") throw new Error(missingPublicEnv("AKAN_PUBLIC_SERVE_DOMAIN"));
85
88
  const environment = (process.env.AKAN_PUBLIC_ENV ?? "debug") as BaseEnv["environment"];
86
89
  const operationMode = (process.env.AKAN_PUBLIC_OPERATION_MODE ??
87
90
  (environment === "local" ? "local" : "cloud")) as BaseEnv["operationMode"];
@@ -209,12 +209,12 @@ declare global {
209
209
  [DEFAULT_VALUE]: boolean;
210
210
  [PURIFIED_VALUE]: boolean;
211
211
  [EXAMPLE_VALUE]: boolean;
212
- validate(value: boolean | number): boolean;
213
- parseValue(input: boolean | number): boolean | number;
214
- serializeValue(value: boolean | number): boolean | number;
215
- _parse(input: boolean | number): boolean;
216
- _serialize(value: boolean | number): boolean;
217
- _checkValue(value: boolean | number): void;
212
+ validate(value: boolean | number | string): boolean;
213
+ parseValue(input: boolean | number | string): boolean | number | string;
214
+ serializeValue(value: boolean | number | string): boolean | number | string;
215
+ _parse(input: boolean | number | string): boolean;
216
+ _serialize(value: boolean | number | string): boolean;
217
+ _checkValue(value: boolean | number | string): void;
218
218
  }
219
219
  interface DateConstructor {
220
220
  refName: "Date";
@@ -305,10 +305,14 @@ Object.assign(String, scalarPrimitiveStatics, {
305
305
  });
306
306
  PrimitiveRegistry.register(String);
307
307
 
308
- const normalizeBooleanPrimitiveValue = (value: boolean | number): boolean | null => {
308
+ const normalizeBooleanPrimitiveValue = (value: boolean | number | string): boolean | null => {
309
309
  if (typeof value === "boolean") return value;
310
310
  if (value === 1) return true;
311
311
  if (value === 0) return false;
312
+ if (typeof value !== "string") return null;
313
+ const text = value.trim().toLowerCase();
314
+ if (text === "true" || text === "1") return true;
315
+ if (text === "false" || text === "0") return false;
312
316
  return null;
313
317
  };
314
318
 
@@ -317,13 +321,13 @@ Object.assign(Boolean, {
317
321
  refName: "Boolean",
318
322
  [DEFAULT_VALUE]: false,
319
323
  [EXAMPLE_VALUE]: true,
320
- validate(value: boolean | number) {
324
+ validate(value: boolean | number | string) {
321
325
  return normalizeBooleanPrimitiveValue(value) !== null;
322
326
  },
323
- parseValue(input: boolean | number) {
327
+ parseValue(input: boolean | number | string) {
324
328
  return normalizeBooleanPrimitiveValue(input) ?? input;
325
329
  },
326
- serializeValue(value: boolean | number) {
330
+ serializeValue(value: boolean | number | string) {
327
331
  return normalizeBooleanPrimitiveValue(value) ?? value;
328
332
  },
329
333
  });
package/base/symbols.ts CHANGED
@@ -13,6 +13,10 @@ export const STATE_META = Symbol.for("akan.state");
13
13
  export const STATE_INIT_META = Symbol.for("akan.state.init");
14
14
  export const STATE_DERIVED_META = Symbol.for("akan.state.derived");
15
15
  export const ACTION_META = Symbol.for("akan.action");
16
+ /** Which module declared each action. See `ActionOwner`. */
17
+ export const ACTION_OWNER_META = Symbol.for("akan.action.owner");
18
+ /** What a dispatcher does, carried on the function so a component handed one can annotate the DOM with it. */
19
+ export const ACTION_TAG = Symbol.for("akan.action.tag");
16
20
  export const SERVER_VALUE = Symbol.for("akan.value.server");
17
21
  export const CLIENT_VALUE = Symbol.for("akan.value.client");
18
22
  export const DEFAULT_VALUE = Symbol.for("akan.value.default");
@@ -46,6 +46,28 @@ export type CapacitorContactsModule = {
46
46
  };
47
47
  };
48
48
 
49
+ export type CapacitorSpeechRecognitionModule = {
50
+ SpeechRecognition: {
51
+ available: () => Promise<{ available: boolean }>;
52
+ checkPermissions: () => Promise<{ speechRecognition: CapacitorPermissionState }>;
53
+ requestPermissions: () => Promise<{ speechRecognition: CapacitorPermissionState }>;
54
+ start: (options: Record<string, unknown>) => Promise<{ matches?: string[] }>;
55
+ stop: () => Promise<void>;
56
+ removeAllListeners: () => Promise<void> | void;
57
+ addListener: (
58
+ eventName: string,
59
+ listenerFunc: (data: { matches?: string[] }) => void,
60
+ ) => Promise<{ remove: () => Promise<void> | void }> | { remove: () => Promise<void> | void };
61
+ };
62
+ };
63
+
64
+ export type CapacitorTextToSpeechModule = {
65
+ TextToSpeech: {
66
+ speak: (options: { text: string; lang?: string; rate?: number }) => Promise<void>;
67
+ stop: () => Promise<void>;
68
+ };
69
+ };
70
+
49
71
  export type CapacitorCoreModule = {
50
72
  CapacitorCookies: {
51
73
  setCookie: (options: { key: string; value: string; path?: string }) => Promise<void> | void;
@@ -155,6 +177,8 @@ type CapacitorModuleMap = {
155
177
  preferences: CapacitorPreferencesModule;
156
178
  pushNotifications: CapacitorPushNotificationsModule;
157
179
  safeArea: CapacitorSafeAreaModule;
180
+ speechRecognition: CapacitorSpeechRecognitionModule;
181
+ textToSpeech: CapacitorTextToSpeechModule;
158
182
  updater: CapacitorUpdaterModule;
159
183
  };
160
184
 
@@ -257,6 +281,16 @@ export const loadCapacitorSafeArea = () =>
257
281
  SafeArea: getCapacitorPlugin<CapacitorSafeAreaModule["SafeArea"]>("SafeArea"),
258
282
  }));
259
283
 
284
+ export const loadCapacitorSpeechRecognition = () =>
285
+ loadCapacitorModule("speechRecognition", async () => ({
286
+ SpeechRecognition: getCapacitorPlugin<CapacitorSpeechRecognitionModule["SpeechRecognition"]>("SpeechRecognition"),
287
+ }));
288
+
289
+ export const loadCapacitorTextToSpeech = () =>
290
+ loadCapacitorModule("textToSpeech", async () => ({
291
+ TextToSpeech: getCapacitorPlugin<CapacitorTextToSpeechModule["TextToSpeech"]>("TextToSpeech"),
292
+ }));
293
+
260
294
  export const loadCapacitorUpdater = () =>
261
295
  loadCapacitorModule("updater", async () => ({
262
296
  CapacitorUpdater: getCapacitorPlugin<CapacitorUpdaterModule["CapacitorUpdater"]>("CapacitorUpdater"),
@@ -47,6 +47,8 @@ type RuntimeFetch = typeof globalThis.fetch & {
47
47
  serializedSignal: Record<string, unknown>;
48
48
  setJwt: (jwt: string | null) => void;
49
49
  slice: Record<string, SliceMeta>;
50
+ /** Sort keys per model refName, registered from each serialized signal's filter. */
51
+ sortKeyMap?: Map<string, string[]>;
50
52
  ws: RuntimeWs;
51
53
  [key: string]: unknown;
52
54
  };
@@ -75,6 +77,13 @@ globalWithRuntime[CLIENT_RUNTIME_KEY] = state;
75
77
  const missingRuntimeError = () =>
76
78
  new Error("Akan client runtime is not registered. Import the generated app client first.");
77
79
 
80
+ const applyRuntimeErrorConstructor = (runtime: ClientRuntime) => {
81
+ const instance = (runtime.fetch as RuntimeFetch | undefined)?.instance as
82
+ | { setErrorConstructor?: (Err: unknown) => void }
83
+ | undefined;
84
+ if (typeof instance?.setErrorConstructor === "function") instance.setErrorConstructor(runtime.Err);
85
+ };
86
+
78
87
  export const registerClientRuntime = <Runtime>(
79
88
  runtime: Runtime,
80
89
  { scope = "app" }: { scope?: RuntimeScope } = {},
@@ -82,6 +91,7 @@ export const registerClientRuntime = <Runtime>(
82
91
  if (state.scope === "app" && scope === "lib") return runtime;
83
92
  state.runtime = runtime as ClientRuntime;
84
93
  state.scope = scope;
94
+ applyRuntimeErrorConstructor(state.runtime);
85
95
  return runtime;
86
96
  };
87
97
 
package/client/cn.ts CHANGED
@@ -38,10 +38,17 @@ export const colorTokens = [
38
38
  "ring",
39
39
  ];
40
40
 
41
+ /**
42
+ * Akan's semantic radius tokens (`--radius-box` / `--radius-field` in ui/styles.css). Without them
43
+ * `cn("rounded-field", "rounded-full")` keeps both classes and stylesheet order decides the winner.
44
+ */
45
+ export const radiusTokens = ["box", "field"];
46
+
41
47
  const twMerge = extendTailwindMerge({
42
48
  extend: {
43
49
  theme: {
44
50
  color: colorTokens,
51
+ radius: radiusTokens,
45
52
  },
46
53
  },
47
54
  });
@@ -455,6 +455,7 @@ export interface FrameLayoutState {
455
455
  keyboard: KeyboardFrameState;
456
456
  contentViewport: FrameContentViewportState;
457
457
  keyboardAccessory: KeyboardAccessoryFrameState;
458
+ contentAnchor?: "bottom";
458
459
  platformProfile: FramePlatformProfile;
459
460
  zIndex: FrameLayerZIndex;
460
461
  pageStateByPath: Map<string, PageState>;
@@ -463,6 +464,7 @@ export interface FrameSlotRegistration {
463
464
  scope?: FrameSlotScope;
464
465
  type: FrameSlotType;
465
466
  role?: FrameSlotRole;
467
+ contentAnchor?: "bottom";
466
468
  height?: number;
467
469
  estimatedHeight?: number;
468
470
  source?: "navbar" | "topInset" | "bottomInset" | "bottomTab" | (string & {});
@@ -20,9 +20,10 @@ const isFrameDebugEnabled = () => {
20
20
  export function debugFrame(event: string, payload: DebugPayload = {}) {
21
21
  if (!isFrameDebugEnabled()) return;
22
22
  debugSeq += 1;
23
- console.info(`[akan:frame:${debugSessionId}:${debugSeq}] ${event}`, {
23
+ const details = {
24
24
  href: window.location.href,
25
25
  now: Math.round(performance.now()),
26
26
  ...payload,
27
- });
27
+ };
28
+ console.info(`[akan:frame:${debugSessionId}:${debugSeq}] ${event}`, details, JSON.stringify(details));
28
29
  }
@@ -1,9 +1,16 @@
1
1
  import { isDayjs } from "./isDayjs";
2
2
 
3
- export const deepObjectify = <T = unknown>(
4
- obj: T | null | undefined,
5
- option: { serializable?: boolean; convertDate?: "string" | "number" } = {},
6
- ): T => {
3
+ interface DeepObjectifyOption {
4
+ serializable?: boolean;
5
+ convertDate?: "string" | "number";
6
+ }
7
+
8
+ const objectifyChild = (value: unknown, option: DeepObjectifyOption): unknown => {
9
+ const modelValue = value as { __ModelType__?: string } | null | undefined;
10
+ return modelValue?.__ModelType__ && !option.serializable ? value : deepObjectify(value, option);
11
+ };
12
+
13
+ export const deepObjectify = <T = unknown>(obj: T | null | undefined, option: DeepObjectifyOption = {}): T => {
7
14
  if (isDayjs(obj) || obj?.constructor === Date) {
8
15
  if (!option.serializable && !option.convertDate) return obj as T;
9
16
  if (option.convertDate === "string") return obj.toISOString() as T;
@@ -12,13 +19,20 @@ export const deepObjectify = <T = unknown>(
12
19
  else return (isDayjs(obj) ? obj.toDate() : obj) as T;
13
20
  } else if (Array.isArray(obj)) {
14
21
  return obj.map((o: unknown) => deepObjectify(o, option)) as T;
22
+ } else if (obj instanceof Map) {
23
+
24
+ const entries = [...obj.entries()].map(
25
+ ([key, value]: [string, unknown]) => [key, objectifyChild(value, option)] as const,
26
+ );
27
+ return (option.serializable ? Object.fromEntries(entries) : new Map(entries)) as T;
28
+ } else if (obj instanceof Set) {
29
+ const values = [...obj.values()].map((value: unknown) => objectifyChild(value, option));
30
+ return (option.serializable ? values : new Set(values)) as T;
15
31
  } else if (obj && typeof obj === "object") {
16
32
  const val: Record<string, unknown> = {};
17
33
  const objRecord = obj as Record<string, unknown>;
18
34
  Object.keys(obj).forEach((key) => {
19
- const fieldValue = objRecord[key] as { __ModelType__: string } | null | undefined;
20
- if (fieldValue?.__ModelType__ && !option.serializable) val[key] = fieldValue;
21
- else if (typeof objRecord[key] !== "function") val[key] = deepObjectify(fieldValue, option);
35
+ if (typeof objRecord[key] !== "function") val[key] = objectifyChild(objRecord[key], option);
22
36
  });
23
37
  return val as T;
24
38
  } else {
package/common/index.ts CHANGED
@@ -27,6 +27,15 @@ export {
27
27
  resolveAkanI18nConfig,
28
28
  } from "./localeConfig";
29
29
  export { lowerlize } from "./lowerlize";
30
+ export {
31
+ isMcpDescribableArg,
32
+ type McpExposureEndpoint,
33
+ type McpExposureOption,
34
+ mcpBaseVerbOf,
35
+ mcpHintsOf,
36
+ mcpPromptRefusalOf,
37
+ mcpRefusalOf,
38
+ } from "./mcpExposure";
30
39
  export { mergeVersion } from "./mergeVersion";
31
40
  export { objectify } from "./objectify";
32
41
  export { pathGet } from "./pathGet";
@@ -36,12 +45,18 @@ export { randomPicks } from "./randomPicks";
36
45
  export {
37
46
  assertUniqueRoutePatterns,
38
47
  compareRouteSpecificity,
48
+ getPageSourceFileViolation,
49
+ getRouteExports,
39
50
  isRouteSourceFile,
40
51
  isSpecialRouteLeaf,
52
+ LAYOUT_ROUTE_EXPORTS,
41
53
  matchRoutePattern,
42
54
  normalizeRoutePattern,
55
+ PAGE_ROUTE_EXPORTS,
43
56
  type ParsedRouteModuleKey,
44
57
  parseRouteModuleKey,
58
+ RESERVED_ROUTE_CONFIG_EXPORTS,
59
+ ROOT_LAYOUT_ROUTE_EXPORTS,
45
60
  type RouteModuleKind,
46
61
  routeSegmentToPatternPart,
47
62
  routeSegmentToTreePath,
@@ -0,0 +1,99 @@
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
+ }
20
+
21
+ export interface McpExposureOption {
22
+ /**
23
+ * The read-only deployment valve, which is server configuration. The browser explorer cannot know it and so
24
+ * badges what the code decided; the boot log is where a read-only deployment says what it dropped.
25
+ */
26
+ readOnly?: boolean;
27
+ }
28
+
29
+ /** `Any` publishes as the empty schema, which tells a model nothing — so it is left out rather than described. */
30
+ export const isMcpDescribableArg = (arg: { refName: string }) => arg.refName !== "Any";
31
+
32
+ /** Which CRUD verb a generated endpoint key is, or `null` when the key is not one of the five. */
33
+ export const mcpBaseVerbOf = (refName: string, key: string) => {
34
+ const cap = capitalize(refName);
35
+ if (key === refName || key === `light${cap}`) return "get" as const;
36
+ if (key === `create${cap}`) return "create" as const;
37
+ if (key === `update${cap}`) return "update" as const;
38
+ if (key === `remove${cap}`) return "remove" as const;
39
+ return null;
40
+ };
41
+
42
+ /**
43
+ * The hints a client renders beside a tool. Hints only — clients are told to distrust them, so they inform a UI
44
+ * and never stand in for a guard. `openWorldHint` is always false: every endpoint reaches this app's own
45
+ * database, not the wider internet.
46
+ */
47
+ export const mcpHintsOf = (key: string, endpoint: { type: string }) => {
48
+ const readOnly = endpoint.type === "query";
49
+ const destructive = !readOnly && /^(remove|delete)/.test(key);
50
+ return {
51
+ readOnlyHint: readOnly,
52
+ destructiveHint: destructive,
53
+ idempotentHint: readOnly || /^(set|update)/.test(key),
54
+ openWorldHint: false,
55
+ };
56
+ };
57
+
58
+ /** The sentence explaining why this endpoint is not in the catalogue, or `null` when it is. */
59
+ export const mcpRefusalOf = (endpoint: McpExposureEndpoint, { readOnly }: McpExposureOption = {}): string | null => {
60
+
61
+ if (!endpoint.guards?.length)
62
+ return "it declares no guards, and exposure follows them — write `guards: [Public]` if anonymous access is the intent.";
63
+ if (endpoint.type === "prompt") return mcpPromptRefusalOf(endpoint);
64
+ if (endpoint.type === "pubsub" || endpoint.type === "message")
65
+ return `\`${endpoint.type}\` rides the websocket, and its internal arguments read a socket an MCP request does not have.`;
66
+ if (readOnly && endpoint.type !== "query")
67
+ return "this deployment is read-only, which drops every endpoint that is not a query.";
68
+ if (endpoint.returns.refName === "Any" || endpoint.returns.refName === "Upload")
69
+ return `a return typed \`${endpoint.returns.refName}\` cannot be described to a model.`;
70
+ if (endpoint.fileUpload || endpoint.args.some((arg) => arg.refName === "Upload"))
71
+ return "a file upload has no MCP representation.";
72
+ if (endpoint.type === "mutation" && !endpoint.guards.some((name) => name !== "Public"))
73
+ return "a mutation needs a real guard — `[Public]` is having none, spelled out.";
74
+ const opaque = endpoint.args.find((arg) => !isMcpDescribableArg(arg) && arg.type !== "search" && !arg.nullable);
75
+ if (opaque)
76
+ return `its required argument \`${opaque.name}\` is typed \`Any\`, which is left out of the published schema — expose a named filter slice instead.`;
77
+ return null;
78
+ };
79
+
80
+ /**
81
+ * A prompt is a read exposed on the same terms as a query, so every rejection here is one thing: an argument
82
+ * `prompts/get` cannot carry. Its `arguments` is a flat string map — one string per name, and no schema beside it
83
+ * — which rules out the argument *kinds* the builder already refuses and, just as surely, two argument *types* it
84
+ * accepts. A tool escapes both because it publishes a real JSON Schema.
85
+ */
86
+ export const mcpPromptRefusalOf = (endpoint: McpExposureEndpoint): string | null => {
87
+ const carried = endpoint.args.find((arg) => arg.type === "body" || arg.type === "msg" || arg.type === "room");
88
+ if (carried)
89
+ return `a prompt's arguments travel as a flat string map, so its \`${carried.type}\` argument \`${carried.name}\` cannot be carried.`;
90
+
91
+ const list = endpoint.args.find((arg) => arg.arrDepth);
92
+ if (list)
93
+ return `a prompt argument is one string, so its list argument \`${list.name}\` could never carry more than one value.`;
94
+
95
+ const opaque = endpoint.args.find((arg) => !isMcpDescribableArg(arg));
96
+ if (opaque)
97
+ return `its argument \`${opaque.name}\` is typed \`Any\`, and a prompt has no schema in which to describe one.`;
98
+ return null;
99
+ };
package/common/pathSet.ts CHANGED
@@ -1,16 +1,28 @@
1
1
  type MutableIndexable = Record<string | number, unknown>;
2
2
  type PathSegment = string | number;
3
+ type Container = MutableIndexable | Map<PathSegment, unknown>;
3
4
 
4
5
  const toPathSegments = (path: string | readonly PathSegment[]) =>
5
6
  Array.isArray(path) ? [...path] : path.toString().match(/[^.[\]]+/g) || [];
6
7
 
8
+ const readChild = (container: Container, key: PathSegment) =>
9
+ container instanceof Map ? container.get(key) : container[key];
10
+
11
+ const writeChild = (container: Container, key: PathSegment, value: unknown) => {
12
+ if (container instanceof Map) container.set(key, value);
13
+ else container[key] = value;
14
+ };
15
+
7
16
  export const pathSet = <T>(obj: T, path: string | readonly PathSegment[], value: unknown): T => {
8
17
  if (Object(obj) !== obj) return obj;
9
18
  const pathSegments = toPathSegments(path);
10
- pathSegments.slice(0, -1).reduce<MutableIndexable>((a, c, i) => {
11
- if (Object(a[c]) === a[c]) return a[c] as MutableIndexable;
12
- a[c] = Math.abs(Number(pathSegments[i + 1])) >> 0 === +pathSegments[i + 1] ? [] : {};
13
- return a[c] as MutableIndexable;
14
- }, obj as MutableIndexable)[pathSegments[pathSegments.length - 1]] = value;
19
+ const parent = pathSegments.slice(0, -1).reduce<Container>((a, c, i) => {
20
+ const child = readChild(a, c);
21
+ if (Object(child) === child) return child as Container;
22
+ const created = Math.abs(Number(pathSegments[i + 1])) >> 0 === +pathSegments[i + 1] ? [] : {};
23
+ writeChild(a, c, created);
24
+ return created as unknown as Container;
25
+ }, obj as Container);
26
+ writeChild(parent, pathSegments[pathSegments.length - 1], value);
15
27
  return obj;
16
28
  };
@@ -9,6 +9,36 @@ const DIRECTORY_SCOPED_LEAVES = new Set(["_layout", "_index", "_overrides"]);
9
9
 
10
10
  export type RouteModuleKind = "page" | "layout" | "overrides";
11
11
 
12
+ export const PAGE_ROUTE_EXPORTS: ReadonlySet<string> = new Set([
13
+ "default",
14
+ "pageConfig",
15
+ "head",
16
+ "metadata",
17
+ "generateHead",
18
+ "generateMetadata",
19
+ "Loading",
20
+ ]);
21
+ export const LAYOUT_ROUTE_EXPORTS: ReadonlySet<string> = new Set([...PAGE_ROUTE_EXPORTS, "NotFound", "Error"]);
22
+ export const ROOT_LAYOUT_ROUTE_EXPORTS: ReadonlySet<string> = new Set([
23
+ ...LAYOUT_ROUTE_EXPORTS,
24
+ "fonts",
25
+ "manifest",
26
+ "theme",
27
+ "reconnect",
28
+ "wsConnect",
29
+ "layoutStyle",
30
+ "gaTrackingId",
31
+ ]);
32
+ /** Root-layout exports that are plain config rather than components, so a PascalCase check cannot allow them. */
33
+ export const RESERVED_ROUTE_CONFIG_EXPORTS: ReadonlySet<string> = new Set(
34
+ [...ROOT_LAYOUT_ROUTE_EXPORTS].filter((name) => name !== "default" && !/^[A-Z]/.test(name)),
35
+ );
36
+
37
+ export function getRouteExports(kind: "page" | "layout", { rootLayout = false } = {}): ReadonlySet<string> {
38
+ if (kind === "page") return PAGE_ROUTE_EXPORTS;
39
+ return rootLayout ? ROOT_LAYOUT_ROUTE_EXPORTS : LAYOUT_ROUTE_EXPORTS;
40
+ }
41
+
12
42
  export interface ParsedRouteModuleKey {
13
43
  key: string;
14
44
  kind: RouteModuleKind;
@@ -37,27 +67,37 @@ export function isRouteSourceFile(filePath: string): boolean {
37
67
  return tryParseRouteModuleKey(key) !== null;
38
68
  }
39
69
 
40
- export function validatePageSourceFile(filePath: string, options: ValidatePageSourceFileOptions = {}): boolean {
41
- 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;
42
77
 
43
78
  const key = filePath.startsWith("./") ? filePath : `./${filePath.split(/[\\/]/).join("/")}`;
44
79
  const match = ROUTE_SOURCE_RE.exec(key);
45
- const displayPath = options.filePath ?? key;
46
- if (!match) throw new Error(`[route-convention] invalid page source file: ${displayPath}`);
80
+ if (!match) return "invalid page source file";
47
81
 
48
82
  const file = match[1] as string;
49
83
  const ext = match[2] as string;
50
84
  const leaf = file.split("/").filter(Boolean).at(-1);
51
- if (!leaf) throw new Error(`[route-convention] invalid page source file: ${displayPath}`);
85
+ if (!leaf) return "invalid page source file";
52
86
 
53
- 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";
54
88
  if (leaf.startsWith("_") && !RESERVED_ROUTE_FILES.has(leaf) && leaf !== INTERNAL_ROOT_LAYOUT_LEAF)
55
- throw new Error(
56
- `[route-convention] only _index.tsx, _layout.tsx and _overrides.tsx are allowed as reserved route files under page/: ${displayPath}`,
57
- );
58
- if (/^[A-Z]/.test(leaf))
59
- throw new Error(`[route-convention] route page filenames must not start with an uppercase letter: ${displayPath}`);
60
- 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}`);
61
101
  }
62
102
 
63
103
  export function validateSubRoutePageKey(
@@ -30,8 +30,10 @@ export const crystalize = (field: FieldProps, value: unknown): unknown => {
30
30
  isArray: false,
31
31
  arrDepth: 0,
32
32
  };
33
+
34
+ const entries = value instanceof Map ? [...value.entries()] : Object.entries(value as Record<string, unknown>);
33
35
  return new Map(
34
- Object.entries(value as Record<string, unknown>).map(([key, val]) => [
36
+ entries.map(([key, val]: [string, unknown]) => [
35
37
  key,
36
38
  field.of
37
39
  ? applyFnToArrayObjects(val, (v: never) => crystalize(mapValueField, v))
@@ -9,7 +9,7 @@ export const immerify = <T extends object>(modelRef: ConstantModelRef, objOrArr:
9
9
  }) as Record<string, unknown>;
10
10
  const objRecord = objOrArr as Record<string, unknown>;
11
11
  Object.entries(modelRef[FIELD_META]).forEach(([key, field]) => {
12
- if (field.isScalar && field.isClass && !!objRecord[key])
12
+ if (field.isScalar && field.isClass && objRecord[key])
13
13
  immeredObj[key] = immerify(field.modelRef, objRecord[key] as object);
14
14
  });
15
15
  return immeredObj as T;
package/constant/index.ts CHANGED
@@ -5,6 +5,8 @@ export * from "./deserialize";
5
5
  export * from "./fieldInfo";
6
6
  export * from "./getDefault";
7
7
  export * from "./immerify";
8
+ export * from "./labelOf";
9
+ export * from "./mask";
8
10
  export * from "./purify";
9
11
  export * from "./serialize";
10
12
  export * from "./textFieldPathSet";
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The one line a human scans for, derived from what the model already declared: the `text: "title"` search role
3
+ * names exactly that field, so an agent-facing label costs no new declaration. Falls back to the conventional
4
+ * `title`/`name` keys; the id is the caller's floor.
5
+ */
6
+ export const labelOf = (model: unknown, value: unknown): string | undefined => {
7
+ if (!value || typeof value !== "object") return undefined;
8
+ const source = value as Record<string, unknown>;
9
+ const paths = (model as { text?: { title?: Iterable<string> } } | null)?.text?.title;
10
+ const titlePath = [...(paths ?? [])].find((path) => !path.includes(".") && !path.includes("["));
11
+ for (const key of [titlePath, "title", "name"]) {
12
+ if (!key) continue;
13
+ const candidate = source[key];
14
+ if (typeof candidate === "string" && candidate) return candidate;
15
+ }
16
+ return undefined;
17
+ };