akanjs 3.1.0-rc.2 → 3.1.0-rc.21

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 (392) hide show
  1. package/base/baseEnv.ts +5 -2
  2. package/client/device.ts +1 -1
  3. package/client/frameConfig.ts +2 -2
  4. package/client/href.ts +35 -0
  5. package/client/index.ts +1 -0
  6. package/client/makePageProto.tsx +3 -2
  7. package/client/router.ts +6 -4
  8. package/client/rscNavigation.ts +1 -1
  9. package/client/transitionTypes.ts +0 -4
  10. package/client/translator.ts +16 -0
  11. package/client/types.ts +3 -2
  12. package/client/viewportMeta.ts +23 -8
  13. package/client/webManifest.ts +5 -3
  14. package/common/TrustedProxy.ts +14 -0
  15. package/common/codeAgentWire.ts +8 -1
  16. package/common/index.ts +1 -0
  17. package/common/interpolateTranslation.ts +17 -3
  18. package/common/isEmail.ts +1 -1
  19. package/common/localeConfig.ts +10 -4
  20. package/common/markdownSpans.ts +1 -1
  21. package/common/restClient.ts +3 -1
  22. package/common/routeConvention.ts +4 -4
  23. package/common/trimSlashes.ts +11 -0
  24. package/common/types.ts +1 -1
  25. package/constant/fieldInfo.ts +2 -2
  26. package/constant/fieldPlan.ts +80 -0
  27. package/constant/index.ts +3 -0
  28. package/constant/inputParser.ts +148 -0
  29. package/constant/invalidInputError.ts +13 -0
  30. package/constant/serialize.ts +36 -20
  31. package/constant/types.ts +1 -1
  32. package/constant/via.ts +2 -0
  33. package/dictionary/base.dictionary.ts +4 -0
  34. package/dictionary/trans.ts +8 -0
  35. package/document/database.ts +3 -6
  36. package/document/documentSchema.ts +1 -1
  37. package/document/noDocumentError.ts +6 -1
  38. package/fetch/client/fetchClient.ts +2 -1
  39. package/fetch/client/sliceInitHandle.ts +2 -3
  40. package/fetch/fetchType/appliedReturn.type.ts +3 -1
  41. package/fetch/types.ts +4 -2
  42. package/index.ts +2 -0
  43. package/package.json +31 -21
  44. package/server/akanApp.ts +15 -3
  45. package/server/akanServer.ts +34 -14
  46. package/server/artifact/routeClientCache.ts +4 -5
  47. package/server/artifact/routeSeedIndexStore.ts +3 -20
  48. package/server/artifact/routeSeedMatcher.ts +70 -0
  49. package/server/console.ts +1 -1
  50. package/server/di/diLifecycle.ts +16 -7
  51. package/server/imageOptimizer.ts +1 -1
  52. package/server/index.ts +1 -0
  53. package/server/machine/machineAccount.ts +28 -3
  54. package/server/machine/machineToken.ts +27 -3
  55. package/server/mcp/McpDispatcher.ts +2 -3
  56. package/server/mcp/McpExecutionContext.ts +9 -3
  57. package/server/migration/docPath.ts +121 -0
  58. package/server/migration/index.ts +15 -0
  59. package/server/migration/migrationChangeLog.ts +86 -0
  60. package/server/migration/migrationChanges.ts +70 -0
  61. package/server/migration/migrationCommand.ts +179 -0
  62. package/server/migration/migrationContext.ts +53 -0
  63. package/server/migration/migrationDefinition.ts +87 -0
  64. package/server/migration/migrationError.ts +45 -0
  65. package/server/migration/migrationLedger.ts +172 -0
  66. package/server/migration/migrationLock.ts +103 -0
  67. package/server/migration/migrationParams.ts +122 -0
  68. package/server/migration/migrationPulse.ts +39 -0
  69. package/server/migration/migrationRunner.ts +525 -0
  70. package/server/migration/migrationScope.ts +93 -0
  71. package/server/migration/migrationTable.ts +258 -0
  72. package/server/migration/migrations.ts +57 -0
  73. package/server/ops/opsCommand.ts +30 -1
  74. package/server/resolver/CascadeRunner.ts +15 -2
  75. package/server/resolver/signal.resolver.ts +35 -55
  76. package/server/routeState.ts +0 -6
  77. package/server/rscClient.tsx +22 -37
  78. package/server/rscNavigationState.ts +3 -5
  79. package/server/rscScrollRestoration.ts +116 -0
  80. package/server/rscWorker.tsx +12 -19
  81. package/server/sitemap.ts +4 -4
  82. package/server/tunnel/TunnelAgent.ts +9 -1
  83. package/server/webRouter.ts +17 -2
  84. package/service/agent.service.ts +21 -1
  85. package/service/endpointCacheKeys.ts +35 -0
  86. package/service/index.ts +1 -0
  87. package/service/injectInfo.ts +2 -2
  88. package/service/predefinedAdaptor/anthropicLlm.ts +37 -17
  89. package/service/predefinedAdaptor/database.adaptor.ts +15 -0
  90. package/service/predefinedAdaptor/documentTransfer.ts +50 -0
  91. package/service/predefinedAdaptor/endpointCacheControl.adaptor.ts +19 -0
  92. package/service/predefinedAdaptor/index.ts +1 -0
  93. package/service/predefinedAdaptor/llm.adaptor.ts +7 -0
  94. package/service/predefinedAdaptor/openaiDialect.ts +53 -17
  95. package/service/predefinedAdaptor/openaiLlm.ts +1 -1
  96. package/service/predefinedAdaptor/sql/MigrationTables.ts +90 -0
  97. package/service/predefinedAdaptor/sql/RawDocumentTable.ts +200 -0
  98. package/service/predefinedAdaptor/sql/SqlDocumentStore.ts +6 -2
  99. package/service/predefinedAdaptor/sql/SqliteInsightSession.ts +4 -1
  100. package/service/predefinedAdaptor/sql/dialect/postgres.ts +0 -1
  101. package/service/predefinedAdaptor/sql/dialect/sqlite.ts +0 -1
  102. package/service/predefinedAdaptor/sql/types.ts +3 -1
  103. package/service/predefinedAdaptor/storage.adaptor.ts +19 -0
  104. package/signal/endpointCache.ts +23 -7
  105. package/signal/endpointErrorContract.ts +37 -0
  106. package/signal/endpointIdempotency.ts +5 -3
  107. package/signal/endpointInfo.ts +4 -1
  108. package/signal/endpointRateLimit.ts +6 -2
  109. package/signal/exception.ts +4 -1
  110. package/signal/index.ts +1 -0
  111. package/signal/mcp/McpDocument.ts +16 -1
  112. package/signal/mcp/McpUriTemplate.ts +1 -1
  113. package/signal/middlewareChain.ts +105 -0
  114. package/signal/openapi/openapi.ts +46 -2
  115. package/signal/serializer/fetch.serializer.ts +1 -0
  116. package/signal/signalContext.ts +110 -82
  117. package/signal/slice.ts +2 -2
  118. package/signal/trace.ts +8 -2
  119. package/signal/types.ts +13 -0
  120. package/store/action.ts +102 -42
  121. package/store/agent/ScreenImage.ts +166 -0
  122. package/store/agent/ScreenReader.ts +2 -1
  123. package/store/agent/StoreSurfaceSource.ts +41 -2
  124. package/store/agent/index.ts +2 -1
  125. package/store/databaseStateNames.ts +1 -0
  126. package/store/formUploadOf.ts +41 -0
  127. package/store/index.ts +1 -0
  128. package/store/liveInsert.ts +2 -2
  129. package/store/state.ts +9 -1
  130. package/store/stateBuilder.ts +8 -2
  131. package/store/storeInstance.ts +12 -3
  132. package/store/withSelector.ts +2 -2
  133. package/types/client/href.d.ts +11 -0
  134. package/types/client/index.d.ts +1 -0
  135. package/types/client/rscNavigation.d.ts +1 -1
  136. package/types/client/transitionTypes.d.ts +0 -2
  137. package/types/client/translator.d.ts +2 -0
  138. package/types/common/codeAgentWire.d.ts +7 -0
  139. package/types/common/index.d.ts +1 -0
  140. package/types/common/trimSlashes.d.ts +2 -0
  141. package/types/common/types.d.ts +1 -1
  142. package/types/constant/fieldInfo.d.ts +2 -2
  143. package/types/constant/fieldPlan.d.ts +33 -0
  144. package/types/constant/index.d.ts +3 -0
  145. package/types/constant/inputParser.d.ts +11 -0
  146. package/types/constant/invalidInputError.d.ts +8 -0
  147. package/types/constant/types.d.ts +1 -1
  148. package/types/dictionary/base.dictionary.d.ts +1 -1
  149. package/types/dictionary/dictionary.d.ts +3 -3
  150. package/types/dictionary/trans.d.ts +3 -0
  151. package/types/document/database.d.ts +2 -3
  152. package/types/document/documentSchema.d.ts +1 -1
  153. package/types/document/noDocumentError.d.ts +6 -1
  154. package/types/fetch/fetchType/appliedReturn.type.d.ts +3 -1
  155. package/types/fetch/types.d.ts +2 -2
  156. package/types/index.d.ts +5 -0
  157. package/types/server/akanServer.d.ts +1 -1
  158. package/types/server/artifact/routeSeedMatcher.d.ts +8 -0
  159. package/types/server/di/diLifecycle.d.ts +1 -0
  160. package/types/server/index.d.ts +1 -0
  161. package/types/server/machine/machineAccount.d.ts +1 -0
  162. package/types/server/machine/machineToken.d.ts +9 -0
  163. package/types/server/migration/docPath.d.ts +20 -0
  164. package/types/server/migration/index.d.ts +15 -0
  165. package/types/server/migration/migrationChangeLog.d.ts +27 -0
  166. package/types/server/migration/migrationChanges.d.ts +27 -0
  167. package/types/server/migration/migrationCommand.d.ts +33 -0
  168. package/types/server/migration/migrationContext.d.ts +28 -0
  169. package/types/server/migration/migrationDefinition.d.ts +42 -0
  170. package/types/server/migration/migrationError.d.ts +15 -0
  171. package/types/server/migration/migrationLedger.d.ts +51 -0
  172. package/types/server/migration/migrationLock.d.ts +34 -0
  173. package/types/server/migration/migrationParams.d.ts +41 -0
  174. package/types/server/migration/migrationPulse.d.ts +15 -0
  175. package/types/server/migration/migrationRunner.d.ts +93 -0
  176. package/types/server/migration/migrationScope.d.ts +42 -0
  177. package/types/server/migration/migrationTable.d.ts +52 -0
  178. package/types/server/migration/migrations.d.ts +12 -0
  179. package/types/server/migration.d.ts +1 -0
  180. package/types/server/ops/opsCommand.d.ts +10 -1
  181. package/types/server/routeState.d.ts +1 -4
  182. package/types/server/rscNavigationState.d.ts +2 -3
  183. package/types/server/rscScrollRestoration.d.ts +14 -0
  184. package/types/server/sitemap.d.ts +1 -1
  185. package/types/service/agent.service.d.ts +2 -0
  186. package/types/service/endpointCacheKeys.d.ts +8 -0
  187. package/types/service/index.d.ts +1 -0
  188. package/types/service/injectInfo.d.ts +2 -2
  189. package/types/service/predefinedAdaptor/anthropicLlm.d.ts +9 -4
  190. package/types/service/predefinedAdaptor/database.adaptor.d.ts +8 -1
  191. package/types/service/predefinedAdaptor/documentTransfer.d.ts +1 -0
  192. package/types/service/predefinedAdaptor/endpointCacheControl.adaptor.d.ts +9 -0
  193. package/types/service/predefinedAdaptor/index.d.ts +1 -0
  194. package/types/service/predefinedAdaptor/llm.adaptor.d.ts +7 -0
  195. package/types/service/predefinedAdaptor/openaiDialect.d.ts +20 -5
  196. package/types/service/predefinedAdaptor/sql/MigrationTables.d.ts +17 -0
  197. package/types/service/predefinedAdaptor/sql/RawDocumentTable.d.ts +38 -0
  198. package/types/service/predefinedAdaptor/sql/types.d.ts +1 -0
  199. package/types/service/predefinedAdaptor/storage.adaptor.d.ts +8 -0
  200. package/types/signal/endpointCache.d.ts +2 -0
  201. package/types/signal/endpointErrorContract.d.ts +10 -0
  202. package/types/signal/endpointIdempotency.d.ts +1 -0
  203. package/types/signal/endpointRateLimit.d.ts +1 -1
  204. package/types/signal/exception.d.ts +4 -1
  205. package/types/signal/index.d.ts +1 -0
  206. package/types/signal/middlewareChain.d.ts +11 -0
  207. package/types/signal/signalContext.d.ts +2 -6
  208. package/types/signal/slice.d.ts +1 -1
  209. package/types/signal/trace.d.ts +1 -1
  210. package/types/signal/types.d.ts +12 -0
  211. package/types/store/action.d.ts +2 -0
  212. package/types/store/agent/ScreenImage.d.ts +27 -0
  213. package/types/store/agent/StoreSurfaceSource.d.ts +1 -1
  214. package/types/store/agent/index.d.ts +2 -1
  215. package/types/store/databaseStateNames.d.ts +1 -0
  216. package/types/store/formUploadOf.d.ts +9 -0
  217. package/types/store/index.d.ts +1 -0
  218. package/types/store/state.d.ts +7 -1
  219. package/types/store/stateBuilder.d.ts +2 -1
  220. package/types/store/storeInstance.d.ts +2 -2
  221. package/types/store/withSelector.d.ts +1 -1
  222. package/types/ui/Agent/Composer.d.ts +2 -0
  223. package/types/ui/Agent/Menu.d.ts +2 -0
  224. package/types/ui/CsrImage.d.ts +2 -0
  225. package/types/ui/Data/CardList.d.ts +1 -1
  226. package/types/ui/Data/Dashboard.d.ts +1 -1
  227. package/types/ui/Data/Insight.d.ts +1 -1
  228. package/types/ui/Data/Item.d.ts +2 -2
  229. package/types/ui/Data/ListContainer.d.ts +1 -1
  230. package/types/ui/Data/Pagination.d.ts +1 -1
  231. package/types/ui/Data/TableList.d.ts +1 -1
  232. package/types/ui/Field/Relation.d.ts +13 -10
  233. package/types/ui/Field/index.d.ts +4 -4
  234. package/types/ui/Field/useRelationOptions.d.ts +3 -1
  235. package/types/ui/Field/useRelationWindow.d.ts +14 -0
  236. package/types/ui/Image.d.ts +3 -1
  237. package/types/ui/Load/View.d.ts +1 -1
  238. package/types/ui/Pagination.d.ts +1 -1
  239. package/types/ui/Signal/Arg.d.ts +1 -1
  240. package/types/ui/System/CSR.d.ts +1 -1
  241. package/types/ui/System/Client.d.ts +1 -1
  242. package/types/ui/System/SSR.d.ts +1 -1
  243. package/types/vendor/@akanjs/native/packages/core/src/plugin.d.ts +3 -3
  244. package/types/vendor/@akanjs/native/packages/desktop/src/page-veto.d.ts +1 -1
  245. package/types/vendor/@akanjs/native/packages/desktop/src/plugin.d.ts +1 -1
  246. package/types/vendor/@akanjs/native/plugins/auth-session/src/desktop.d.ts +2 -2
  247. package/types/vendor/@akanjs/native/plugins/auth-session/src/index.d.ts +1 -1
  248. package/types/vendor/@akanjs/native/plugins/autostart/src/desktop.d.ts +2 -2
  249. package/types/vendor/@akanjs/native/plugins/autostart/src/index.d.ts +1 -1
  250. package/types/vendor/@akanjs/native/plugins/badge/src/desktop.d.ts +1 -1
  251. package/types/vendor/@akanjs/native/plugins/badge/src/index.d.ts +1 -1
  252. package/types/vendor/@akanjs/native/plugins/badge/src/web.d.ts +1 -1
  253. package/types/vendor/@akanjs/native/plugins/biometric/src/index.d.ts +1 -1
  254. package/types/vendor/@akanjs/native/plugins/camera/src/desktop.d.ts +1 -1
  255. package/types/vendor/@akanjs/native/plugins/camera/src/index.d.ts +1 -1
  256. package/types/vendor/@akanjs/native/plugins/camera/src/web.d.ts +1 -1
  257. package/types/vendor/@akanjs/native/plugins/clipboard/src/desktop.d.ts +2 -2
  258. package/types/vendor/@akanjs/native/plugins/clipboard/src/index.d.ts +1 -1
  259. package/types/vendor/@akanjs/native/plugins/clipboard/src/web.d.ts +1 -1
  260. package/types/vendor/@akanjs/native/plugins/contacts/src/index.d.ts +1 -1
  261. package/types/vendor/@akanjs/native/plugins/device/src/desktop.d.ts +2 -2
  262. package/types/vendor/@akanjs/native/plugins/device/src/index.d.ts +1 -1
  263. package/types/vendor/@akanjs/native/plugins/device/src/web.d.ts +1 -1
  264. package/types/vendor/@akanjs/native/plugins/dialog/src/desktop.d.ts +1 -1
  265. package/types/vendor/@akanjs/native/plugins/dialog/src/index.d.ts +1 -1
  266. package/types/vendor/@akanjs/native/plugins/dialog/src/web.d.ts +1 -1
  267. package/types/vendor/@akanjs/native/plugins/dock/src/desktop.d.ts +1 -1
  268. package/types/vendor/@akanjs/native/plugins/dock/src/index.d.ts +1 -1
  269. package/types/vendor/@akanjs/native/plugins/file-picker/src/desktop.d.ts +2 -2
  270. package/types/vendor/@akanjs/native/plugins/file-picker/src/web.d.ts +1 -1
  271. package/types/vendor/@akanjs/native/plugins/filesystem/src/desktop.d.ts +2 -2
  272. package/types/vendor/@akanjs/native/plugins/filesystem/src/web.d.ts +1 -1
  273. package/types/vendor/@akanjs/native/plugins/haptics/src/index.d.ts +1 -1
  274. package/types/vendor/@akanjs/native/plugins/haptics/src/web.d.ts +1 -1
  275. package/types/vendor/@akanjs/native/plugins/http/src/desktop.d.ts +2 -2
  276. package/types/vendor/@akanjs/native/plugins/http/src/web.d.ts +1 -1
  277. package/types/vendor/@akanjs/native/plugins/keep-awake/src/desktop.d.ts +2 -2
  278. package/types/vendor/@akanjs/native/plugins/keep-awake/src/index.d.ts +1 -1
  279. package/types/vendor/@akanjs/native/plugins/keep-awake/src/web.d.ts +1 -1
  280. package/types/vendor/@akanjs/native/plugins/opener/src/desktop.d.ts +2 -2
  281. package/types/vendor/@akanjs/native/plugins/opener/src/index.d.ts +1 -1
  282. package/types/vendor/@akanjs/native/plugins/opener/src/web.d.ts +1 -1
  283. package/types/vendor/@akanjs/native/plugins/preferences/src/desktop.d.ts +1 -1
  284. package/types/vendor/@akanjs/native/plugins/preferences/src/index.d.ts +1 -1
  285. package/types/vendor/@akanjs/native/plugins/preferences/src/web.d.ts +1 -1
  286. package/types/vendor/@akanjs/native/plugins/secure-storage/src/desktop.d.ts +2 -2
  287. package/types/vendor/@akanjs/native/plugins/secure-storage/src/index.d.ts +1 -1
  288. package/types/vendor/@akanjs/native/plugins/share/src/index.d.ts +1 -1
  289. package/types/vendor/@akanjs/native/plugins/share/src/web.d.ts +1 -1
  290. package/types/vendor/@akanjs/native/plugins/single-instance/src/desktop.d.ts +2 -2
  291. package/types/vendor/@akanjs/native/plugins/splash-screen/src/index.d.ts +1 -1
  292. package/types/vendor/@akanjs/native/plugins/splash-screen/src/web.d.ts +1 -1
  293. package/types/vendor/@akanjs/native/plugins/sqlite/src/desktop.d.ts +2 -2
  294. package/types/vendor/@akanjs/native/plugins/toast/src/index.d.ts +1 -1
  295. package/types/vendor/@akanjs/native/plugins/toast/src/web.d.ts +1 -1
  296. package/types/vendor/@akanjs/native/plugins/window/src/index.d.ts +2 -2
  297. package/types/vendor/@akanjs/native/plugins/window-state/src/desktop.d.ts +2 -2
  298. package/types/vendor/@akanjs/native/plugins/window-state/src/index.d.ts +1 -1
  299. package/types/vendor/use-agentic/Compaction.d.ts +3 -1
  300. package/types/vendor/use-agentic/Reference.d.ts +9 -1
  301. package/types/vendor/use-agentic/ToolOutput.d.ts +6 -1
  302. package/types/vendor/use-agentic/ToolReturn.d.ts +18 -0
  303. package/types/vendor/use-agentic/Transcript.d.ts +7 -0
  304. package/types/vendor/use-agentic/index.d.ts +1 -0
  305. package/types/vendor/use-agentic/types.d.ts +6 -0
  306. package/types/webkit/useDebounce.d.ts +1 -1
  307. package/ui/Agent/Chat.tsx +1 -0
  308. package/ui/Agent/Composer.tsx +2 -0
  309. package/ui/Agent/Menu.tsx +5 -1
  310. package/ui/Agent/agentSessionOf.ts +15 -8
  311. package/ui/Agent/mentionDraft.ts +2 -3
  312. package/ui/Agent/useReferenceMenu.ts +1 -0
  313. package/ui/Agent/useSlashMenu.ts +1 -0
  314. package/ui/Clipboard.tsx +1 -0
  315. package/ui/CsrImage.tsx +3 -1
  316. package/ui/Data/CardList.tsx +1 -1
  317. package/ui/Data/Dashboard.tsx +1 -1
  318. package/ui/Data/Insight.tsx +1 -1
  319. package/ui/Data/Item.tsx +5 -2
  320. package/ui/Data/ListContainer.tsx +2 -2
  321. package/ui/Data/Pagination.tsx +1 -1
  322. package/ui/Data/TableList.tsx +1 -1
  323. package/ui/DraggableList.tsx +1 -0
  324. package/ui/Field/Collection.tsx +4 -0
  325. package/ui/Field/Relation.tsx +33 -14
  326. package/ui/Field/useRelationOptions.ts +33 -5
  327. package/ui/Field/useRelationWindow.ts +50 -0
  328. package/ui/Image.tsx +4 -4
  329. package/ui/Input.tsx +1 -0
  330. package/ui/Layout/Sider.tsx +1 -1
  331. package/ui/Link/Anchor.tsx +7 -5
  332. package/ui/Load/Units.tsx +17 -7
  333. package/ui/Load/View.tsx +2 -2
  334. package/ui/Model/Edit.tsx +1 -1
  335. package/ui/Model/EditModal.tsx +11 -5
  336. package/ui/Model/New.tsx +1 -1
  337. package/ui/Model/SureToRemove.tsx +1 -0
  338. package/ui/Model/ViewEditModal.tsx +17 -5
  339. package/ui/Model/ViewModal.tsx +2 -2
  340. package/ui/ObjectId.tsx +5 -1
  341. package/ui/Pagination.tsx +1 -1
  342. package/ui/Signal/Arg.tsx +1 -3
  343. package/ui/Signal/Doc.tsx +5 -1
  344. package/ui/System/CSR.tsx +1 -1
  345. package/ui/System/Client.tsx +1 -1
  346. package/ui/System/Reconnect.tsx +1 -1
  347. package/ui/System/SSR.tsx +3 -36
  348. package/ui/ToggleSelect.tsx +2 -0
  349. package/ui/styles.css +10 -103
  350. package/vendor/@akanjs/native/native/ios/Sources/AkanNativeBridge.swift +3 -2
  351. package/vendor/@akanjs/native/packages/cli/src/lib/addons.ts +4 -1
  352. package/vendor/@akanjs/native/packages/cli/src/lib/apk.ts +2 -2
  353. package/vendor/@akanjs/native/packages/cli/src/lib/codegen.ts +1 -1
  354. package/vendor/@akanjs/native/packages/cli/src/lib/csp.ts +4 -3
  355. package/vendor/@akanjs/native/packages/cli/src/lib/googleservices.ts +7 -1
  356. package/vendor/@akanjs/native/packages/cli/src/lib/hmr.ts +8 -5
  357. package/vendor/@akanjs/native/packages/cli/src/lib/html.ts +18 -3
  358. package/vendor/@akanjs/native/packages/cli/src/lib/manifestmerge.ts +1 -1
  359. package/vendor/@akanjs/native/packages/cli/src/lib/plist.ts +2 -4
  360. package/vendor/@akanjs/native/packages/cli/src/lib/toolchains.ts +1 -1
  361. package/vendor/@akanjs/native/packages/cli/src/lib/updates.ts +10 -4
  362. package/vendor/@akanjs/native/packages/cli/src/lib/xml.ts +4 -3
  363. package/vendor/@akanjs/native/packages/cli/src/platforms/android.ts +3 -3
  364. package/vendor/@akanjs/native/packages/core/src/kernel.ts +3 -3
  365. package/vendor/@akanjs/native/packages/core/src/live.ts +1 -0
  366. package/vendor/@akanjs/native/packages/core/src/plugin.ts +5 -3
  367. package/vendor/@akanjs/native/packages/desktop/src/host.ts +13 -5
  368. package/vendor/@akanjs/native/packages/desktop/src/lifecycle.ts +1 -0
  369. package/vendor/@akanjs/native/packages/desktop/src/page-veto.ts +1 -1
  370. package/vendor/@akanjs/native/packages/desktop/src/plugin.ts +4 -1
  371. package/vendor/@akanjs/native/plugins/camera/src/web.ts +3 -3
  372. package/vendor/@akanjs/native/plugins/file-picker/src/index.ts +4 -1
  373. package/vendor/@akanjs/native/plugins/local-notifications/src/web.ts +1 -1
  374. package/vendor/@akanjs/native/plugins/secure-storage/src/desktop.ts +1 -1
  375. package/vendor/@akanjs/native/plugins/share/src/options.ts +1 -1
  376. package/vendor/@akanjs/native/plugins/single-instance/src/desktop.ts +3 -2
  377. package/vendor/@akanjs/native/plugins/updates/src/desktop.ts +4 -1
  378. package/vendor/@akanjs/native/plugins/window/src/index.ts +2 -2
  379. package/vendor/use-agentic/Compaction.ts +38 -7
  380. package/vendor/use-agentic/Reference.ts +16 -9
  381. package/vendor/use-agentic/ToolOutput.ts +25 -3
  382. package/vendor/use-agentic/ToolReturn.ts +32 -0
  383. package/vendor/use-agentic/ToolRunner.ts +15 -13
  384. package/vendor/use-agentic/Transcript.ts +38 -2
  385. package/vendor/use-agentic/WIRE.md +20 -0
  386. package/vendor/use-agentic/index.ts +1 -0
  387. package/vendor/use-agentic/types.ts +6 -0
  388. package/webkit/McpAppAgent.ts +12 -2
  389. package/webkit/RenderLayer.tsx +23 -4
  390. package/webkit/useDebounce.ts +23 -14
  391. package/client/viewTransition.ts +0 -10
  392. package/types/client/viewTransition.d.ts +0 -3
@@ -0,0 +1,148 @@
1
+ import {
2
+ Any,
3
+ type Cls,
4
+ dayjs,
5
+ type EnumInstance,
6
+ FIELD_META,
7
+ Float,
8
+ getNonArrayModel,
9
+ ID,
10
+ Int,
11
+ PrimitiveRegistry,
12
+ type PrimitiveScalar,
13
+ } from "akanjs/base";
14
+
15
+ import { ConstantRegistry } from "./constantRegistry";
16
+ import type { ConstantField, FieldObject } from "./fieldInfo";
17
+ import { FieldPlan, type FieldPlanEntry } from "./fieldPlan";
18
+ import { defaultPlanOf } from "./getDefault";
19
+ import { InvalidInputError } from "./invalidInputError";
20
+ import { deserialize } from "./serialize";
21
+
22
+ type ModelCls = Cls & { [FIELD_META]: FieldObject };
23
+ type Parse = (value: unknown, path: string) => unknown;
24
+
25
+ interface ParseOption {
26
+ key: string;
27
+ nullable?: boolean;
28
+ enum?: EnumInstance;
29
+ }
30
+
31
+ const isString = (value: unknown) => typeof value === "string";
32
+ const isNumber = (value: unknown) => typeof value === "number";
33
+ const isRecord = (value: unknown): value is Record<string, unknown> =>
34
+ typeof value === "object" && value !== null && !Array.isArray(value);
35
+
36
+ export class InputParser {
37
+
38
+ static readonly #wireTypes = new Map<unknown, (value: unknown) => boolean>([
39
+ [String, isString],
40
+ [ID, isString],
41
+ [Int, isNumber],
42
+ [Float, isNumber],
43
+ [Boolean, (value) => typeof value === "boolean"],
44
+ [Date, (value) => isString(value) || isNumber(value) || value instanceof Date || dayjs.isDayjs(value)],
45
+ ]);
46
+
47
+ static parse(argRef: Cls, arrDepth: number, value: unknown, option: ParseOption) {
48
+ if (PrimitiveRegistry.has(argRef)) return deserialize(argRef, arrDepth, value, option);
49
+ const { key, nullable = false } = option;
50
+ if (value === null || value === undefined) {
51
+ if (nullable) return null;
52
+ throw new InvalidInputError(key, null);
53
+ }
54
+ return InputParser.#walk(value, arrDepth, key, (item, path) => InputParser.#value(argRef, item, path));
55
+ }
56
+
57
+ static #walk(value: unknown, arrDepth: number, path: string, parse: Parse): unknown {
58
+ if (!arrDepth) return parse(value, path);
59
+ if (!Array.isArray(value)) throw new InvalidInputError(path, "array");
60
+ return value.map((item, idx) => InputParser.#walk(item, arrDepth - 1, `${path}.${idx}`, parse));
61
+ }
62
+
63
+ static #value(ref: Cls, value: unknown, path: string, enumRef?: EnumInstance): unknown {
64
+ if (value === null || value === undefined) {
65
+ if (ref === Any) return value ?? null;
66
+ throw new InvalidInputError(path, null);
67
+ }
68
+ if (PrimitiveRegistry.has(ref)) return InputParser.#primitive(ref as typeof PrimitiveScalar, value, path, enumRef);
69
+ if (ConstantRegistry.isScalar(ref)) return InputParser.#scalar(ref as ModelCls, value, path);
70
+ return InputParser.#model(ref as ModelCls, value, path);
71
+ }
72
+
73
+ static #primitive(primitive: typeof PrimitiveScalar, value: unknown, path: string, enumRef?: EnumInstance) {
74
+ const hasWireType = InputParser.#wireTypes.get(primitive);
75
+ if (hasWireType && !hasWireType(value)) throw new InvalidInputError(path, primitive.refName);
76
+ let parsed: unknown;
77
+ try {
78
+ parsed = primitive._parse(value as never);
79
+ } catch {
80
+ throw new InvalidInputError(path, primitive.refName);
81
+ }
82
+ if (enumRef && !enumRef.has(parsed as never))
83
+ throw new InvalidInputError(path, `one of ${enumRef.values.join(", ")}`);
84
+ return parsed;
85
+ }
86
+
87
+ static #scalar(ref: ModelCls, value: unknown, path: string) {
88
+ if (!isRecord(value)) throw new InvalidInputError(path, "object");
89
+ const defaults = defaultPlanOf(ref[FIELD_META]);
90
+ const parsed: Record<string, unknown> = {};
91
+ for (const entry of FieldPlan.of(ref).entries) {
92
+ if (entry.kind === "computed") continue;
93
+ const fieldPath = `${path}.${entry.key}`;
94
+ const raw = value[entry.key];
95
+ if (raw !== undefined) parsed[entry.key] = InputParser.#field(entry, raw, fieldPath);
96
+ else if (InputParser.#isRequired(entry.field)) throw new InvalidInputError(fieldPath, null);
97
+ else {
98
+ const make = defaults.perCall.get(entry.key);
99
+ parsed[entry.key] = make ? make() : defaults.shared[entry.key];
100
+ }
101
+ }
102
+ return parsed;
103
+ }
104
+
105
+ static #model(ref: ModelCls, value: unknown, path: string) {
106
+ if (!isRecord(value)) throw new InvalidInputError(path, "object");
107
+ const parsed: Record<string, unknown> = {};
108
+ for (const entry of FieldPlan.of(ref).entries) {
109
+ if (entry.kind === "computed") continue;
110
+ const fieldPath = `${path}.${entry.key}`;
111
+ const raw = value[entry.key];
112
+ if (raw !== undefined) parsed[entry.key] = InputParser.#field(entry, raw, fieldPath);
113
+ else if (InputParser.#isRequired(entry.field)) throw new InvalidInputError(fieldPath, null);
114
+ }
115
+ return parsed;
116
+ }
117
+
118
+ static #field({ field, isRelationRef }: FieldPlanEntry, value: unknown, path: string): unknown {
119
+ if (value === null) {
120
+ if (field.nullable || (field.modelRef as Cls) === Any) return null;
121
+ throw new InvalidInputError(path, null);
122
+ }
123
+ return InputParser.#walk(value, field.arrDepth, path, (item, itemPath) => {
124
+ if (field.isMap) return InputParser.#map(field.of as Cls | Cls[], item, itemPath);
125
+ if (isRelationRef) return InputParser.#value(ID, item, itemPath);
126
+ return InputParser.#value(field.modelRef, item, itemPath, field.enum);
127
+ });
128
+ }
129
+
130
+ static #map(of: Cls | Cls[], value: unknown, path: string) {
131
+ if (!isRecord(value)) throw new InvalidInputError(path, "object");
132
+ const [valueRef, valueArrDepth] = getNonArrayModel(of);
133
+ return Object.fromEntries(
134
+ Object.entries(value).map(([key, item]) => [
135
+ key,
136
+ InputParser.#walk(item, valueArrDepth, `${path}.${key}`, (entry, entryPath) =>
137
+ InputParser.#value(valueRef as Cls, entry, entryPath),
138
+ ),
139
+ ]),
140
+ );
141
+ }
142
+
143
+ static #isRequired(field: ConstantField) {
144
+ if (field.nullable || (field.modelRef as Cls) === Any) return false;
145
+ if (field.default !== null && field.default !== undefined) return false;
146
+ return !(field.isClass && field.isScalar);
147
+ }
148
+ }
@@ -0,0 +1,13 @@
1
+ /** A body value the request schema refuses: `path` names it from the argument down (`data.items.2.price`). */
2
+ export class InvalidInputError extends Error {
3
+ readonly path: string;
4
+ readonly reason: "missing" | "invalid";
5
+ /** What the field takes — a type name, `object`, `array`, or the enum's values; `null` when it is missing. */
6
+ readonly expected: string | null;
7
+ constructor(path: string, expected: string | null) {
8
+ super(expected ? `Invalid input at ${path}: expected ${expected}` : `Missing input at ${path}`);
9
+ this.path = path;
10
+ this.reason = expected ? "invalid" : "missing";
11
+ this.expected = expected;
12
+ }
13
+ }
@@ -12,6 +12,7 @@ import {
12
12
  } from "akanjs/base";
13
13
 
14
14
  import { type ConstantCls, type ConstantModelRef, ConstantRegistry, type FieldProps, withSharedInstances } from ".";
15
+ import { FieldPlan } from "./fieldPlan";
15
16
 
16
17
  export type Serialized<O> = O extends (infer V)[]
17
18
  ? Serialized<V>[]
@@ -27,12 +28,14 @@ const getSerializeFn = (inputRef: Cls, { optional = false }: { optional?: boolea
27
28
  PrimitiveRegistry.has(inputRef)
28
29
  ? (value: unknown) => (inputRef as typeof PrimitiveScalar)._serialize(value as never, { optional })
29
30
  : (value: unknown) => value as object;
31
+ const optionalSerialize = { optional: true } as const;
32
+ const requiredSerialize = { optional: false } as const;
30
33
  const serializeInput = <Input = unknown>(
31
34
  value: Input | Input[],
32
35
  inputRef: ConstantModelRef<Input> | PrimitiveScalar,
33
36
  arrDepth: number,
34
37
  serializeType: "input" | "object" = "object",
35
- { optional = false }: { optional?: boolean } = {},
38
+ optional = false,
36
39
  ): Input | Input[] => {
37
40
  if (arrDepth && Array.isArray(value))
38
41
  return value.map((v) => serializeInput(v, inputRef, arrDepth - 1, serializeType) as Input) as unknown as Input[];
@@ -46,24 +49,23 @@ const serializeInput = <Input = unknown>(
46
49
  ]),
47
50
  ) as unknown as Input;
48
51
  } else if (PrimitiveRegistry.has(inputRef as Cls)) {
49
- const serializeFn = getSerializeFn(inputRef as Cls, { optional });
50
- return serializeFn(value) as Input;
52
+ return (inputRef as typeof PrimitiveScalar)._serialize(
53
+ value as never,
54
+ optional ? optionalSerialize : requiredSerialize,
55
+ ) as Input;
51
56
  } else {
52
- const modelRef = inputRef as ConstantCls;
53
- return Object.fromEntries(
54
- Object.entries(modelRef[FIELD_META]).map(([key, field]) => [
55
- key,
56
- serializeType === "input" && field.isClass && !field.isScalar
57
- ? serialize(ID, field.arrDepth, getRelationId((value as Record<string, unknown>)?.[key]), serializeType, {
58
- nullable: field.nullable,
59
- key,
60
- })
61
- : serialize(field.modelRef, field.arrDepth, (value as Record<string, unknown>)?.[key], serializeType, {
62
- nullable: field.nullable,
63
- key,
64
- }),
65
- ]),
66
- ) as unknown as Input;
57
+ const serialized: Record<string, unknown> = {};
58
+ for (const { key, field, isRelationRef, primitive, serializeOption } of FieldPlan.of(inputRef as ConstantCls)
59
+ .entries) {
60
+ const fieldValue = (value as Record<string, unknown> | null | undefined)?.[key];
61
+ serialized[key] =
62
+ primitive && !field.arrDepth
63
+ ? serializePrimitive(primitive, fieldValue, serializeOption)
64
+ : serializeType === "input" && isRelationRef
65
+ ? serialize(ID, field.arrDepth, getRelationId(fieldValue), serializeType, serializeOption)
66
+ : serialize(field.modelRef, field.arrDepth, fieldValue, serializeType, serializeOption);
67
+ }
68
+ return serialized as unknown as Input;
67
69
  }
68
70
  };
69
71
 
@@ -82,9 +84,23 @@ export const serialize = (
82
84
  ) => {
83
85
  if (nullable && (value === null || value === undefined)) return null;
84
86
  else if (!nullable && (value === null || value === undefined) && argRef !== Any)
85
- throw new Error(`Invalid Value (Nullable) in ${argRef} for value ${value}${key ? ` in ${key}` : ""}`);
86
- return serializeInput(value, argRef, arrDepth, serializeType, { optional: nullable }) as object[];
87
+ throw missingValueError(argRef, value, key);
88
+ return serializeInput(value, argRef, arrDepth, serializeType, nullable) as object[];
89
+ };
90
+
91
+ const serializePrimitive = (
92
+ primitive: typeof PrimitiveScalar,
93
+ value: unknown,
94
+ { nullable, key }: { nullable: boolean; key: string },
95
+ ) => {
96
+ if (value === null || value === undefined) {
97
+ if (nullable) return null;
98
+ if ((primitive as unknown) !== Any) throw missingValueError(primitive, value, key);
99
+ }
100
+ return primitive._serialize(value as never, nullable ? optionalSerialize : requiredSerialize);
87
101
  };
102
+ const missingValueError = (argRef: unknown, value: unknown, key?: string) =>
103
+ new Error(`Invalid Value (Nullable) in ${argRef} for value ${value}${key ? ` in ${key}` : ""}`);
88
104
 
89
105
  const getDeserializeFn = (inputRef: ConstantModelRef | PrimitiveScalar) =>
90
106
  PrimitiveRegistry.has(inputRef as Cls)
package/constant/types.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { type Dayjs, dayjs, enumOf, type GetStateObject } from "akanjs/base";
2
2
 
3
- export type QueryOf<T = any> = any;
3
+ export type QueryOf<_T = any> = any;
4
4
 
5
5
  export type ConstantType = "input" | "object" | "full" | "light" | "insight" | "scalar";
6
6
 
package/constant/via.ts CHANGED
@@ -29,6 +29,7 @@ import {
29
29
  field,
30
30
  resolve,
31
31
  } from "./fieldInfo";
32
+ import { FieldPlan } from "./fieldPlan";
32
33
  import { HydrationPlan } from "./hydrationPlan";
33
34
  import { makePurify, type PurifiedModel, type PurifyFunc } from "./purify";
34
35
  import { TextFieldPaths } from "./textFieldPaths";
@@ -422,6 +423,7 @@ const applyConstantStatics = <Model>(model: ConstantCls<Model>, fieldMap: FieldO
422
423
  for (const [key, field] of Object.entries(model[FIELD_META]))
423
424
  if (isDateSlotField(field.getProps())) Object.defineProperty(model.prototype, key, dateAccessorOf(key));
424
425
  HydrationPlan.reset(model);
426
+ FieldPlan.reset(model);
425
427
  return model as unknown as ConstantCls<Model>;
426
428
  };
427
429
 
@@ -49,6 +49,10 @@ export const baseDictionary = serviceDictionary(["en", "ko"])
49
49
  "서버가 예상하지 못한 응답을 보냈습니다. ({status})",
50
50
  ],
51
51
  immutableField: ["{field} cannot be changed after creation.", "{field}은(는) 생성 후에는 바꿀 수 없습니다."],
52
+ invalidArgument: ["{name} has an invalid value.", "{name} 값이 올바르지 않습니다."],
53
+ requiredArgument: ["{name} is required.", "{name}은(는) 필수 값입니다."],
54
+ invalidField: ["{field} has an invalid value.", "{field} 값이 올바르지 않습니다."],
55
+ documentNotFound: ["The requested item does not exist.", "요청한 항목을 찾을 수 없습니다."],
52
56
  relationNotFound: [
53
57
  "The {model} that {field} refers to no longer exists.",
54
58
  "{field}이(가) 가리키는 {model}을(를) 찾을 수 없습니다.",
@@ -65,6 +65,7 @@ export type ErrConstructor<ErrorKey extends string> = {
65
65
  new (key: ErrorKey, data?: TranslationData, option?: ErrRestoreOption): ErrInstance;
66
66
  prototype: ErrInstance;
67
67
  fromJSON(payload: ErrPayload): ErrInstance;
68
+ is<Key extends ErrorKey>(error: unknown, ...keys: Key[]): error is ErrInstance & { readonly error: Key };
68
69
  BadRequest: new (key: ErrorKey, data?: TranslationData, option?: ErrRestoreOption) => ErrInstance;
69
70
  Unauthorized: new (key: ErrorKey, data?: TranslationData, option?: ErrRestoreOption) => ErrInstance;
70
71
  Forbidden: new (key: ErrorKey, data?: TranslationData, option?: ErrRestoreOption) => ErrInstance;
@@ -150,6 +151,13 @@ export const makeTrans = <
150
151
  return new Err(payload.error as _ErrorKey, payload.data, payload);
151
152
  }
152
153
 
154
+ /** An Akan error, and one of `keys` when any are named; read off `error`, so a restored remote one passes too. */
155
+ static is<Key extends _ErrorKey>(error: unknown, ...keys: Key[]): error is ErrInstance & { readonly error: Key } {
156
+ if (typeof error !== "object" || error === null) return false;
157
+ const key = (error as { error?: unknown }).error;
158
+ return typeof key === "string" && (!keys.length || (keys as string[]).includes(key));
159
+ }
160
+
153
161
  static BadRequest = class BadRequestErr extends Err {
154
162
  static override status = 400;
155
163
  };
@@ -1,5 +1,5 @@
1
1
  import type { MergedValues } from "akanjs/base";
2
- import { Logger } from "akanjs/common";
2
+ import type { Logger } from "akanjs/common";
3
3
  import type { DocumentModel, QueryOf } from "akanjs/constant";
4
4
  import type { CacheAdaptor, CacheSetOptions, CacheValue } from "akanjs/service";
5
5
  import type { DataLoader } from "./dataLoader";
@@ -8,14 +8,11 @@ import type { ExtractQuery, ExtractSort, FilterInstance } from "./filterMeta";
8
8
  import type { Mdl, SaveEventListener, SaveEventType, UpdateResult } from "./into";
9
9
  import type { DataInputOf, FindQueryOption, ListQueryOption } from "./types";
10
10
 
11
- export class CacheDatabase<T = unknown> {
12
- private logger: Logger;
11
+ export class CacheDatabase<_T = unknown> {
13
12
  constructor(
14
13
  private readonly refName: string,
15
14
  private readonly cache: CacheAdaptor,
16
- ) {
17
- this.logger = new Logger(`${refName}Cache`);
18
- }
15
+ ) {}
19
16
  async set(topic: string, key: string, value: CacheValue, option: CacheSetOptions = {}) {
20
17
  await this.cache.set(this.refName, `${topic}:${key}`, value, option);
21
18
  }
@@ -105,4 +105,4 @@ export class DocumentSchema<Doc = unknown> {
105
105
 
106
106
  export type SchemaOf<Mdl = unknown, Doc = unknown> = DocumentSchema<Doc> & { readonly __model?: Mdl };
107
107
 
108
- export const getDefaultSchemaOptions = <TSchema, TDocument>() => new DocumentSchema<TDocument>();
108
+ export const getDefaultSchemaOptions = <_TSchema, TDocument>() => new DocumentSchema<TDocument>();
@@ -1,7 +1,12 @@
1
1
  /**
2
2
  * A `pick` or `get` that matched nothing, so a caller can tell a missing document from a failure. Callers match on
3
- * the message; `statusCode` does not reach HTTP (`isExceptionLike` also wants a `toJSON`), where it stays a 500.
3
+ * the message, which names the table and the id or query; the wire carries only the dictionary key, as a 404.
4
4
  */
5
5
  export class NoDocumentError extends Error {
6
6
  readonly statusCode = 404;
7
+ readonly error = "base.error.documentNotFound";
8
+
9
+ toJSON() {
10
+ return { error: this.error, statusCode: this.statusCode };
11
+ }
7
12
  }
@@ -7,6 +7,7 @@ import {
7
7
  type RetryPolicy,
8
8
  readAuthToken,
9
9
  resolveFileUploadCapability,
10
+ trimTrailingSlashes,
10
11
  } from "akanjs/common";
11
12
  import { type BaseInsight, type BaseObject, ConstantRegistry, deserialize, serialize } from "akanjs/constant";
12
13
  import type {
@@ -377,7 +378,7 @@ export class FetchClient {
377
378
  }
378
379
  }
379
380
  static #normalizeOrigin(origin: string) {
380
- return origin.replace(/\/+$/, "");
381
+ return trimTrailingSlashes(origin);
381
382
  }
382
383
  static #sameOrigin(a: string, b: string) {
383
384
  return FetchClient.#normalizeOrigin(a) === FetchClient.#normalizeOrigin(b);
@@ -63,9 +63,8 @@ export class SliceInitHandle {
63
63
 
64
64
  #serverInitOf(modelObjList: BaseObject[], modelObjInsight: BaseInsight | null) {
65
65
  const { refName, capRefName, sliceName, argLength, queryArgs, page, limit, sort } = this.#input;
66
- const lastPage = modelObjInsight?.count
67
- ? Math.max(Math.floor((modelObjInsight.count - 1) / (limit || 20)) + 1, 1)
68
- : 1;
66
+ const lastPage =
67
+ modelObjInsight?.count && limit > 0 ? Math.max(Math.floor((modelObjInsight.count - 1) / limit) + 1, 1) : 1;
69
68
  this.#serverInit ??= {
70
69
  refName,
71
70
  sliceName,
@@ -1,10 +1,12 @@
1
1
  import type { DataList, GetStateObject, PromiseOrObject } from "akanjs/base";
2
2
  import type { ExtractSort, FilterInstance } from "akanjs/document";
3
3
 
4
- export type SliceMeta = {
4
+ export type SliceMeta<Sort = unknown> = {
5
5
  refName: string;
6
6
  sliceName: string;
7
7
  argLength: number;
8
+ /** Type-only, never set: the slice filter's sort keys, which a `sort` passed beside this meta narrows to. */
9
+ _Sort?: Sort;
8
10
  };
9
11
 
10
12
  /** What the root slice takes: one of the model's declared filter queries, and the args that filter asks for. */
package/fetch/types.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { type Environment, getEnv, type SLICE_META } from "akanjs/base";
2
- import type { DatabaseSignal } from "akanjs/signal";
2
+ import type { DatabaseSignal, SlceDbSort } from "akanjs/signal";
3
3
  import type { SliceMeta } from "./fetchType/appliedReturn.type";
4
4
 
5
5
  export type Account<AddData = unknown> = {
@@ -17,7 +17,9 @@ type GetSliceMetaObjFromSignal<Signal> = Signal extends {
17
17
  ? SliceMetaObj
18
18
  : Signal extends DatabaseSignal
19
19
  ? {
20
- [K in `${Signal["slice"]["baseName"]}${Capitalize<keyof Signal["slice"][typeof SLICE_META] & string>}`]: SliceMeta;
20
+ [K in `${Signal["slice"]["baseName"]}${Capitalize<keyof Signal["slice"][typeof SLICE_META] & string>}`]: SliceMeta<
21
+ SlceDbSort<Signal["slice"]>
22
+ >;
21
23
  }
22
24
  : Record<never, never>;
23
25
  export type GetSliceMetaObjFromDatabaseSignals<
package/index.ts CHANGED
@@ -601,6 +601,8 @@ export interface AppInfo {
601
601
  readonly service: Map<string, Set<string>>;
602
602
  readonly scalar: Map<string, Set<string>>;
603
603
  readonly file: FileConventionScanSets;
604
+ /** `script/migration/*.ts` by id, each with its source's sha256. */
605
+ readonly migrations: readonly { id: string; checksum: string }[];
604
606
  getLibs(): string[];
605
607
  getLibInfos(): Map<string, LibInfo>;
606
608
  getDatabaseModules(): string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "akanjs",
3
- "version": "3.1.0-rc.2",
3
+ "version": "3.1.0-rc.21",
4
4
  "sourceType": "module",
5
5
  "type": "module",
6
6
  "publishConfig": {
@@ -225,34 +225,44 @@
225
225
  "types": "./types/server/hmr/runtimeMetadataFile.d.ts",
226
226
  "import": "./server/hmr/runtimeMetadataFile.ts",
227
227
  "default": "./server/hmr/runtimeMetadataFile.ts"
228
+ },
229
+ "./server/migration/migrationCommand": {
230
+ "types": "./types/server/migration/migrationCommand.d.ts",
231
+ "import": "./server/migration/migrationCommand.ts",
232
+ "default": "./server/migration/migrationCommand.ts"
233
+ },
234
+ "./server/migration/migrationError": {
235
+ "types": "./types/server/migration/migrationError.d.ts",
236
+ "import": "./server/migration/migrationError.ts",
237
+ "default": "./server/migration/migrationError.ts"
228
238
  }
229
239
  },
230
240
  "dependencies": {
231
- "@lexical/plain-text": "^0.51.0",
241
+ "@lexical/plain-text": "^0.52.0",
232
242
  "@noble/ciphers": "^2.4.0",
233
- "dayjs": "^1.11.20",
234
- "immer": "^11.1.8",
235
- "lexical": "^0.51.0",
236
- "tailwind-merge": "^3.3.1",
237
- "tailwind-variants": "^3.3.0"
243
+ "dayjs": "^1.11.23",
244
+ "immer": "^11.1.21",
245
+ "lexical": "^0.52.0",
246
+ "tailwind-merge": "^3.7.0",
247
+ "tailwind-variants": "^3.3.1"
238
248
  },
239
249
  "peerDependencies": {
240
- "@happy-dom/global-registrator": "^20.11.2",
241
- "@playwright/test": "^1.60.0",
242
- "@react-spring/web": "^10.1.0",
250
+ "@happy-dom/global-registrator": "^21.0.3",
251
+ "@playwright/test": "^1.64.1",
252
+ "@react-spring/web": "^10.1.2",
243
253
  "@use-gesture/react": "^10.3.1",
244
- "bullmq": "^5.76.10",
254
+ "bullmq": "^5.81.5",
245
255
  "chance": "^1.1.13",
246
- "firebase": "^12.13.0",
247
- "happy-dom": "^20.11.2",
248
- "ioredis": "^5.10.1",
256
+ "firebase": "^13.0.0",
257
+ "happy-dom": "^21.0.3",
258
+ "ioredis": "^5.11.1",
249
259
  "postgres": "^3.4.9",
250
- "protobufjs": "^8.4.0",
251
- "react": "19.3.0",
252
- "react-dom": "19.3.0",
253
- "react-icons": "^5.6.0",
260
+ "protobufjs": "^8.8.1",
261
+ "react": "19.3.1",
262
+ "react-dom": "19.3.1",
263
+ "react-icons": "^5.7.0",
254
264
  "react-refresh": "^0.19.0",
255
- "react-server-dom-webpack": "^19.3.0",
265
+ "react-server-dom-webpack": "^19.3.1",
256
266
  "react-spring": "^10.0.4",
257
267
  "scheduler": "^0.28.0",
258
268
  "tailwind-scrollbar": "^4.0.2",
@@ -321,8 +331,8 @@
321
331
  }
322
332
  },
323
333
  "devDependencies": {
324
- "@biomejs/biome": "2.5.12",
325
- "@types/bun": "^1.4.2"
334
+ "@biomejs/biome": "2.5.14",
335
+ "@types/bun": "^1.4.3"
326
336
  },
327
337
  "bun": {
328
338
  "platform": "bun"
package/server/akanApp.ts CHANGED
@@ -19,6 +19,7 @@ import { LogHub } from "./logging/logHub";
19
19
  import { LogStreamRoute } from "./logging/logStreamRoute";
20
20
  import { RotatingLogWriter } from "./logging/rotatingLogWriter";
21
21
  import { AppInfo } from "./ops/appInfo";
22
+ import type { OpsHost } from "./ops/opsCommand";
22
23
  import type { OpsRoute } from "./ops/opsRoute";
23
24
  import { ProcessMetricsCollector } from "./processMetricsCollector";
24
25
  import { HostAllowlist } from "./routing/hostAllowlist";
@@ -238,7 +239,9 @@ export class AkanApp {
238
239
  async start() {
239
240
  if (process.argv[2] === "ops") {
240
241
  const { OpsCommand } = await import("./ops/opsCommand");
241
- process.exit(await OpsCommand.run(process.argv.slice(3)));
242
+ process.exit(
243
+ await OpsCommand.run(process.argv.slice(3), { importServer: async () => await this.#importServer() }),
244
+ );
242
245
  }
243
246
  if (this.#solo) return await this.#startSolo();
244
247
  if (SelfExec.carried)
@@ -274,6 +277,12 @@ export class AkanApp {
274
277
  });
275
278
  }
276
279
 
280
+ async #importServer() {
281
+ Object.assign(process.env, this.#childEnv(0, this.#getRole(0)), { AKAN_COMMAND_TYPE: "script" });
282
+ resetEnvCache();
283
+ return (await import(this.#serverPath)) as Awaited<ReturnType<OpsHost["importServer"]>>;
284
+ }
285
+
277
286
  async #startSolo() {
278
287
  const role = this.#getRole(0);
279
288
 
@@ -760,7 +769,7 @@ export class AkanApp {
760
769
 
761
770
  async #proxyHttp(req: Request, server: Bun.Server<GatewayWsData>): Promise<Response> {
762
771
  const child = await this.#pickReadyFederationChild(req);
763
- if (!child?.upstream || child.upstream.type !== "unix") return this.#respondWithUnavailable(req);
772
+ if (child?.upstream?.type !== "unix") return this.#respondWithUnavailable(req);
764
773
 
765
774
  const { socketPath } = child.upstream;
766
775
  const url = new URL(req.url);
@@ -800,10 +809,13 @@ export class AkanApp {
800
809
  }
801
810
  }
802
811
 
812
+ static readonly #upstreamOpenFailureCodes = new Set(["FailedToOpenSocket", "ENOENT", "ECONNREFUSED", "ENOTSOCK"]);
813
+
803
814
  static #isUpstreamOpenFailure(error: unknown): boolean {
804
815
  if (!error || typeof error !== "object") return false;
805
816
  const candidate = error as { code?: unknown; message?: unknown };
806
- return candidate.code === "FailedToOpenSocket" || String(candidate.message ?? "").includes("FailedToOpenSocket");
817
+ if (typeof candidate.code === "string" && AkanApp.#upstreamOpenFailureCodes.has(candidate.code)) return true;
818
+ return String(candidate.message ?? "").includes("FailedToOpenSocket");
807
819
  }
808
820
 
809
821
  static #isUpstreamMidFlightClose(error: unknown): boolean {