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,172 @@
1
+ import { type AkanSqlClient, MigrationTables } from "akanjs/service";
2
+ import { MigrationChangeLog } from "./migrationChangeLog";
3
+ import { MigrationError } from "./migrationError";
4
+
5
+ export type MigrationRunKind = "plan" | "apply" | "verify" | "rollback";
6
+ /** `aborted` is a refusal before any write: the plan no longer hashed to what was approved. */
7
+ export type MigrationRunStatus = "running" | "done" | "failed" | "aborted";
8
+
9
+ export interface MigrationRun {
10
+ id: string;
11
+ migrationId: string;
12
+ kind: MigrationRunKind;
13
+ status: MigrationRunStatus;
14
+ /** The apply run a rollback undoes. */
15
+ target: string | null;
16
+ checksum: string;
17
+ buildId: string | null;
18
+ params: Record<string, unknown> | null;
19
+ planHash: string | null;
20
+ summary: Record<string, unknown> | null;
21
+ actor: string | null;
22
+ checkpoint: Record<string, string> | null;
23
+ startedAt: number;
24
+ finishedAt: number | null;
25
+ error: string | null;
26
+ }
27
+
28
+ export interface MigrationState {
29
+ /** The last apply that finished and was not rolled back. */
30
+ applied: MigrationRun | null;
31
+ /** Applies that failed after committing some of their writes, newest first; a rollback undoes them too. */
32
+ partial: MigrationRun[];
33
+ }
34
+
35
+ type MigrationRunRow = Omit<MigrationRun, "params" | "summary" | "checkpoint" | "startedAt" | "finishedAt"> & {
36
+ params: string | null;
37
+ summary: string | null;
38
+ checkpoint: string | null;
39
+ startedAt: number | string;
40
+ finishedAt: number | string | null;
41
+ };
42
+
43
+ export class MigrationLedger {
44
+ static readonly #columns = MigrationTables.ledger[0]?.columns ?? [];
45
+ readonly #connection: () => AkanSqlClient;
46
+
47
+ constructor(connection: () => AkanSqlClient) {
48
+ this.#connection = connection;
49
+ }
50
+
51
+ async insert(run: MigrationRun) {
52
+ const values = MigrationLedger.#toRow(run);
53
+ await this.#connection()
54
+ .prepare(
55
+ `INSERT INTO "${MigrationTables.run}" (${MigrationLedger.#columns.map((column) => `"${column}"`).join(", ")}) VALUES (${MigrationLedger.#columns.map(() => "?").join(", ")})`,
56
+ )
57
+ .run(...MigrationLedger.#columns.map((column) => values[column as keyof MigrationRunRow] ?? null));
58
+ return run;
59
+ }
60
+
61
+ async finish(
62
+ id: string,
63
+ {
64
+ status,
65
+ planHash = null,
66
+ summary = null,
67
+ error = null,
68
+ }: {
69
+ status: MigrationRunStatus;
70
+ planHash?: string | null;
71
+ summary?: Record<string, unknown> | null;
72
+ error?: string | null;
73
+ },
74
+ ) {
75
+ await this.#connection()
76
+ .prepare(
77
+ `UPDATE "${MigrationTables.run}" SET "status" = ?, "planHash" = COALESCE(?, "planHash"), "summary" = ?, "error" = ?, "finishedAt" = ? WHERE "id" = ?`,
78
+ )
79
+ .run(status, planHash, summary ? JSON.stringify(summary) : null, error, Date.now(), id);
80
+ }
81
+
82
+ /** Only while the run is still `running`: one another holder interrupted is never recorded done after all. */
83
+ async complete(
84
+ id: string,
85
+ { planHash = null, summary }: { planHash?: string | null; summary: Record<string, unknown> },
86
+ ) {
87
+ const completed = await this.#connection()
88
+ .prepare(
89
+ `UPDATE "${MigrationTables.run}" SET "status" = 'done', "planHash" = COALESCE(?, "planHash"), "summary" = ?, "finishedAt" = ? WHERE "id" = ? AND "status" = 'running' RETURNING "id"`,
90
+ )
91
+ .get<{ id: string }>(planHash, JSON.stringify(summary), Date.now(), id);
92
+ if (!completed)
93
+ throw new MigrationError("locked", `Another migration run interrupted run ${id}, so it is not recorded done`);
94
+ }
95
+
96
+ async saveCheckpoint(id: string, checkpoint: Record<string, string>) {
97
+ await this.#connection()
98
+ .prepare(`UPDATE "${MigrationTables.run}" SET "checkpoint" = ? WHERE "id" = ?`)
99
+ .run(JSON.stringify(checkpoint), id);
100
+ }
101
+
102
+ async get(id: string) {
103
+ const row = await this.#connection()
104
+ .prepare(`SELECT * FROM "${MigrationTables.run}" WHERE "id" = ?`)
105
+ .get<MigrationRunRow>(id);
106
+ return row ? MigrationLedger.#fromRow(row) : null;
107
+ }
108
+
109
+ /** Oldest first. */
110
+ async runsOf(migrationId?: string) {
111
+ const rows = await this.#connection()
112
+ .prepare(
113
+ `SELECT * FROM "${MigrationTables.run}"${migrationId ? ` WHERE "migrationId" = ?` : ""} ORDER BY "startedAt", "id"`,
114
+ )
115
+ .all<MigrationRunRow>(...(migrationId ? [migrationId] : []));
116
+ return rows.map(MigrationLedger.#fromRow);
117
+ }
118
+
119
+ /** Only the lock holder calls this, so a run still `running` belongs to a process that died holding the lock. */
120
+ async interruptRunning() {
121
+ await this.#connection()
122
+ .prepare(
123
+ `UPDATE "${MigrationTables.run}" SET "status" = 'failed', "error" = 'interrupted', "finishedAt" = ? WHERE "status" = 'running'`,
124
+ )
125
+ .run(Date.now());
126
+ }
127
+
128
+ async state(runs: MigrationRun[]): Promise<MigrationState> {
129
+ const reverted = new Set(
130
+ runs.filter((run) => run.kind === "rollback" && run.status === "done").map((run) => run.target),
131
+ );
132
+ const live = runs.filter((run) => run.kind === "apply" && !reverted.has(run.id)).reverse();
133
+ const failed = live.filter((run) => run.status === "failed");
134
+ const changed = await Promise.all(
135
+ failed.map(async (run) => (await MigrationChangeLog.count(this.#connection(), run.id)) > 0),
136
+ );
137
+ return {
138
+ applied: live.find((run) => run.status === "done") ?? null,
139
+ partial: failed.filter((_, idx) => changed[idx]),
140
+ };
141
+ }
142
+
143
+ static #toRow(run: MigrationRun): Partial<MigrationRunRow> {
144
+ return {
145
+ ...run,
146
+ params: run.params ? JSON.stringify(run.params) : null,
147
+ summary: run.summary ? JSON.stringify(run.summary) : null,
148
+ checkpoint: run.checkpoint ? JSON.stringify(run.checkpoint) : null,
149
+ };
150
+ }
151
+
152
+ static #fromRow(row: MigrationRunRow): MigrationRun {
153
+ const json = <T>(text: string | null) => (text ? (JSON.parse(text) as T) : null);
154
+ return {
155
+ id: row.id,
156
+ migrationId: row.migrationId,
157
+ kind: row.kind,
158
+ status: row.status,
159
+ target: row.target ?? null,
160
+ checksum: row.checksum,
161
+ buildId: row.buildId ?? null,
162
+ params: json<Record<string, unknown>>(row.params),
163
+ planHash: row.planHash ?? null,
164
+ summary: json<Record<string, unknown>>(row.summary),
165
+ actor: row.actor ?? null,
166
+ checkpoint: json<Record<string, string>>(row.checkpoint),
167
+ startedAt: Number(row.startedAt),
168
+ finishedAt: row.finishedAt === null ? null : Number(row.finishedAt),
169
+ error: row.error ?? null,
170
+ };
171
+ }
172
+ }
@@ -0,0 +1,103 @@
1
+ import type { AkanSqlClient } from "akanjs/service";
2
+ import { MigrationError } from "./migrationError";
3
+
4
+ /**
5
+ * One run at a time across every replica and channel: a lease in `_akan_meta` holding its holder's token, `updatedAt`
6
+ * the epoch ms it was last renewed at. A holder that dies is replaced once the lease is `ttlMs` old; a live one renews
7
+ * well inside that, and every renewal names its token, so a holder that was replaced finds out on its next one.
8
+ */
9
+ export class MigrationLock {
10
+ static readonly key = "migration:lock";
11
+ static readonly ttlMs = 60_000;
12
+ static readonly renewMs = 15_000;
13
+ readonly #connection: () => AkanSqlClient;
14
+ readonly #inBand: boolean;
15
+ #token: string | null = null;
16
+ #autocommit: AkanSqlClient | null = null;
17
+ #renewedAt = 0;
18
+ #lost: boolean = false;
19
+ #timer: ReturnType<typeof setInterval> | null = null;
20
+ #renewing: Promise<void> = Promise.resolve();
21
+
22
+ /**
23
+ * `inBand` for SQLite: bun:sqlite runs each statement synchronously, so a run never lets the renewal timer fire, and
24
+ * a renewal inside the run's transaction is safe, as that transaction keeps every other process off the lease.
25
+ */
26
+ constructor(connection: () => AkanSqlClient, { inBand = false }: { inBand?: boolean } = {}) {
27
+ this.#connection = connection;
28
+ this.#inBand = inBand;
29
+ }
30
+
31
+ /**
32
+ * Call outside any transaction: the renewal timer keeps the context it was created in, and a beat renews only on the
33
+ * connection this acquires on.
34
+ */
35
+ async acquire() {
36
+ const now = Date.now();
37
+ const token = crypto.randomUUID();
38
+ const connection = this.#connection();
39
+ let claimed: { value: string } | null;
40
+ try {
41
+ claimed = await connection
42
+ .prepare(
43
+ `INSERT INTO "_akan_meta" ("key", "value", "updatedAt") VALUES (?, ?, ?)
44
+ ON CONFLICT("key") DO UPDATE SET "value" = ?, "updatedAt" = ?
45
+ WHERE "_akan_meta"."updatedAt" < ?
46
+ RETURNING "value"`,
47
+ )
48
+ .get<{ value: string }>(MigrationLock.key, token, now, token, now, now - MigrationLock.ttlMs);
49
+ } catch (error) {
50
+
51
+ if (/^SQLITE_BUSY/.test(String((error as { code?: unknown } | null)?.code ?? ""))) return false;
52
+ throw error;
53
+ }
54
+ if (!claimed) return false;
55
+ this.#token = token;
56
+ this.#autocommit = connection;
57
+ this.#renewedAt = now;
58
+ this.#timer = setInterval(() => {
59
+ this.#renewing = this.#renewing.then(async () => await this.#renew());
60
+ }, MigrationLock.renewMs);
61
+ this.#timer.unref?.();
62
+ return true;
63
+ }
64
+
65
+ /**
66
+ * Throws once another run has taken the lease over. Renews when due, or at once with `force`, so a run that stalled
67
+ * past the TTL finds out before its next write. Off SQLite it leaves renewing to the timer inside any transaction,
68
+ * whose connection is not the one it acquired on: a renewal there publishes nothing until that commits, holds the
69
+ * row the timer renews, and under repeatable read fails the whole transaction once the timer has renewed.
70
+ */
71
+ async heartbeat({ force = false }: { force?: boolean } = {}) {
72
+ const due = force || Date.now() - this.#renewedAt >= MigrationLock.renewMs;
73
+ if (due && (this.#inBand || this.#connection() === this.#autocommit)) await this.#renew();
74
+ if (this.#lost)
75
+ throw new MigrationError("locked", "Another migration run took the lock over while this one ran, so it stopped");
76
+ }
77
+
78
+ async release() {
79
+ if (this.#timer) clearInterval(this.#timer);
80
+ this.#timer = null;
81
+ await this.#renewing;
82
+ const held = this.#token;
83
+ this.#token = null;
84
+ if (!held) return;
85
+ await this.#connection()
86
+ .prepare(`DELETE FROM "_akan_meta" WHERE "key" = ? AND "value" = ?`)
87
+ .run(MigrationLock.key, held);
88
+ }
89
+
90
+ async #renew() {
91
+ const held = this.#token;
92
+ if (!held || this.#lost) return;
93
+ const now = Date.now();
94
+ try {
95
+ const renewed = await this.#connection()
96
+ .prepare(`UPDATE "_akan_meta" SET "updatedAt" = ? WHERE "key" = ? AND "value" = ? RETURNING "value"`)
97
+ .get<{ value: string }>(now, MigrationLock.key, held);
98
+ if (renewed) this.#renewedAt = now;
99
+ else this.#lost = true;
100
+ } catch {
101
+ }
102
+ }
103
+ }
@@ -0,0 +1,122 @@
1
+ import { type Cls, type EnumInstance, isEnum, PrimitiveRegistry, type PrimitiveScalar } from "akanjs/base";
2
+ import { deserialize, type FieldToValue, type ParamFieldType } from "akanjs/constant";
3
+ import { MigrationError } from "./migrationError";
4
+
5
+ export interface MigrationParamOption<Value = unknown> {
6
+ /** What the value means, shown beside its input on the approval form — so English. */
7
+ desc?: string;
8
+ /** For a `String`, the values it may take. */
9
+ enum?: readonly string[];
10
+ default?: Value;
11
+ /** Left out, the value is `null` rather than a refusal. */
12
+ nullable?: boolean;
13
+ }
14
+
15
+ export type MigrationParamValue<Type, Option> = Option extends { default: unknown }
16
+ ? MigrationParamBase<Type, Option>
17
+ : Option extends { nullable: true }
18
+ ? MigrationParamBase<Type, Option> | null
19
+ : MigrationParamBase<Type, Option>;
20
+
21
+ type MigrationParamBase<Type, Option> = Option extends { enum: readonly (infer Value)[] } ? Value : FieldToValue<Type>;
22
+
23
+ export interface MigrationParamInfo extends MigrationParamOption {
24
+ name: string;
25
+ type: ParamFieldType;
26
+ }
27
+
28
+ /** One declared param as `list` reports it, enough to build its input. */
29
+ export interface MigrationParamSpec {
30
+ name: string;
31
+ type: string;
32
+ required: boolean;
33
+ enum?: readonly (string | number)[];
34
+ default?: unknown;
35
+ desc?: string;
36
+ }
37
+
38
+ export class MigrationParams {
39
+ readonly list: MigrationParamInfo[] = [];
40
+
41
+ declare(info: MigrationParamInfo) {
42
+ if (!/^[A-Za-z][A-Za-z0-9_]*$/.test(info.name))
43
+ throw new Error(`Migration param "${info.name}" must start with a letter and hold letters, digits and _`);
44
+ if (this.list.some((existing) => existing.name === info.name))
45
+ throw new Error(`Migration param "${info.name}" is declared twice`);
46
+ this.list.push(info);
47
+ }
48
+
49
+ parse(raw: Record<string, string>): Record<string, unknown> {
50
+ const unknown = Object.keys(raw).find((name) => !this.list.some((info) => info.name === name));
51
+ if (unknown)
52
+ throw new MigrationError(
53
+ "invalidParam",
54
+ `Unknown param "${unknown}"; this migration takes ${this.list.map(({ name }) => name).join(", ") || "none"}`,
55
+ );
56
+ return Object.fromEntries(this.list.map((info) => [info.name, MigrationParams.#value(info, raw[info.name])]));
57
+ }
58
+
59
+ /** Params a run recorded as JSON, as their declared types again: what a rollback hands the script. */
60
+ revive(stored: Record<string, unknown>): Record<string, unknown> {
61
+ return Object.fromEntries(
62
+ this.list.map((info) => {
63
+ const value = stored[info.name];
64
+ if (value === undefined || value === null) return [info.name, value ?? info.default ?? null];
65
+ try {
66
+ return [info.name, MigrationParams.#deserialize(info, value)];
67
+ } catch {
68
+ return [info.name, value];
69
+ }
70
+ }),
71
+ );
72
+ }
73
+
74
+ specs(): MigrationParamSpec[] {
75
+ return this.list.map((info) => ({
76
+ name: info.name,
77
+ type: MigrationParams.#typeName(info),
78
+ required: !("default" in info) && !info.nullable,
79
+ ...(MigrationParams.#choices(info) ? { enum: MigrationParams.#choices(info) } : {}),
80
+ ...("default" in info ? { default: info.default } : {}),
81
+ ...(info.desc ? { desc: info.desc } : {}),
82
+ }));
83
+ }
84
+
85
+ static #value(info: MigrationParamInfo, raw: string | undefined) {
86
+ if (raw === undefined || raw === "") {
87
+ if ("default" in info) return info.default;
88
+ if (info.nullable) return null;
89
+ throw new MigrationError("invalidParam", `Param "${info.name}" is required`);
90
+ }
91
+
92
+ const input = (info.type as unknown) === Date && /^\d{4}-\d{2}-\d{2}$/.test(raw) ? `${raw}T00:00:00.000Z` : raw;
93
+ let value: unknown;
94
+ try {
95
+ value = MigrationParams.#deserialize(info, input);
96
+ } catch {
97
+ throw new MigrationError("invalidParam", `Param "${info.name}" expects ${MigrationParams.#typeName(info)}`);
98
+ }
99
+ if (info.enum && !info.enum.includes(value as string))
100
+ throw new MigrationError("invalidParam", `Param "${info.name}" expects one of ${info.enum.join(", ")}`);
101
+ return value;
102
+ }
103
+
104
+ static #deserialize(info: MigrationParamInfo, value: unknown) {
105
+ const enumRef = isEnum(info.type as Cls) ? (info.type as EnumInstance) : undefined;
106
+ const scalar = (enumRef ? enumRef.type : info.type) as typeof PrimitiveScalar;
107
+ return deserialize(scalar as never, 0, value, { key: info.name, enum: enumRef });
108
+ }
109
+
110
+ static #choices(info: MigrationParamInfo): readonly (string | number)[] | undefined {
111
+ if (isEnum(info.type as Cls)) return (info.type as EnumInstance).values as readonly (string | number)[];
112
+ return info.enum;
113
+ }
114
+
115
+ static #typeName(info: MigrationParamInfo) {
116
+ const choices = MigrationParams.#choices(info);
117
+ if (choices) return `one of ${choices.join(", ")}`;
118
+ return PrimitiveRegistry.has(info.type as Cls)
119
+ ? PrimitiveRegistry.getName(info.type as typeof PrimitiveScalar)
120
+ : "a value";
121
+ }
122
+ }
@@ -0,0 +1,39 @@
1
+ import type { MigrationLock } from "./migrationLock";
2
+
3
+ /** What every table call of a run beats: its lease, and a warning once its own transaction has held SQLite long. */
4
+ export class MigrationPulse {
5
+
6
+ static readonly holdWarnMs = 5_000;
7
+ readonly lock: MigrationLock;
8
+ #onLongHold: ((heldMs: number) => void) | null;
9
+ #heldSince: number | null = null;
10
+
11
+ constructor(lock: MigrationLock, onLongHold: ((heldMs: number) => void) | null = null) {
12
+ this.lock = lock;
13
+ this.#onLongHold = onLongHold;
14
+ }
15
+
16
+ /** A writer stops once its lease is lost; a reader reads on, as nothing it does clashes with whoever took over. */
17
+ async beat({ strict, force = false }: { strict: boolean; force?: boolean }) {
18
+ try {
19
+ await this.lock.heartbeat({ force });
20
+ } catch (error) {
21
+ if (strict) throw error;
22
+ }
23
+ if (this.#heldSince === null || !this.#onLongHold) return;
24
+ const heldMs = Date.now() - this.#heldSince;
25
+ if (heldMs < MigrationPulse.holdWarnMs) return;
26
+ this.#onLongHold(heldMs);
27
+ this.#onLongHold = null;
28
+ }
29
+
30
+ /** Runs `fn` as the span the warning measures: the run's own transaction. */
31
+ async hold<T>(fn: () => Promise<T>) {
32
+ this.#heldSince = Date.now();
33
+ try {
34
+ return await fn();
35
+ } finally {
36
+ this.#heldSince = null;
37
+ }
38
+ }
39
+ }