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
@@ -10,14 +10,22 @@ export interface MachineTokenIssueOptions {
10
10
  export type MachineTokenVerdict = {
11
11
  ok: true;
12
12
  identity: MachineIdentity;
13
+ expiresAt?: number;
13
14
  } | {
14
15
  ok: false;
15
16
  reason: string;
16
17
  };
18
+ /** What a bearer machine token proves, and the second it lapses at when it was issued with an expiry. */
19
+ export interface MachineProof {
20
+ identity: MachineIdentity;
21
+ expiresAt?: number;
22
+ }
17
23
  export declare class MachineToken {
18
24
  #private;
19
25
  static readonly type = "akan-machine+jwt";
20
26
  static audience(): string;
27
+ /** Moves whenever the keys read from the env change, so a verdict kept from before is known to be stale. */
28
+ static keyEpoch(): number;
21
29
  static canIssue(): boolean;
22
30
  static canVerify(): boolean;
23
31
  static issue(identity: MachineIdentity, { expiresAt, audience }?: MachineTokenIssueOptions): string;
@@ -26,4 +34,5 @@ export declare class MachineToken {
26
34
  static verify(token: string, nowSec?: number): MachineTokenVerdict;
27
35
  /** The identity a bearer machine token proves, or `null`: absent, another kind of token, or one that fails. */
28
36
  static fromAuthorization(authorization: string | null | undefined): MachineIdentity | null;
37
+ static proofOf(authorization: string | null | undefined): MachineProof | null;
29
38
  }
@@ -0,0 +1,20 @@
1
+ /** What a path holds: `[value]`, or `[]` when it holds nothing — a stored `null` is a value. */
2
+ export type DocSlot = [unknown] | [];
3
+ /** Dot paths over a parsed `_doc`; a numeric segment indexes an array. */
4
+ export declare class DocPath {
5
+ #private;
6
+ static segments(path: string): string[];
7
+ static read(doc: Record<string, unknown>, path: string): DocSlot;
8
+ /** Whether every container above `path` is still there, so that writing it would change nothing else. */
9
+ static hasParent(doc: Record<string, unknown>, path: string): boolean;
10
+ /**
11
+ * The paths a write of `paths` changes as whole values: each path, or the nearest one above it that the write
12
+ * creates, replaces a `null` at, or appends to as an array, so the logged slot holds everything to put back.
13
+ */
14
+ static anchors(doc: Record<string, unknown>, paths: string[]): string[];
15
+ static write(doc: Record<string, unknown>, path: string, value: unknown): void;
16
+ static remove(doc: Record<string, unknown>, path: string): void;
17
+ static same(a: DocSlot, b: DocSlot): boolean;
18
+ /** Two paths of one write where one sits inside the other would log a value the other already changed. */
19
+ static assertDisjoint(paths: string[]): void;
20
+ }
@@ -0,0 +1,15 @@
1
+ export * from "./docPath.d.ts";
2
+ export * from "./migrationChangeLog.d.ts";
3
+ export * from "./migrationChanges.d.ts";
4
+ export * from "./migrationCommand.d.ts";
5
+ export * from "./migrationContext.d.ts";
6
+ export * from "./migrationDefinition.d.ts";
7
+ export * from "./migrationError.d.ts";
8
+ export * from "./migrationLedger.d.ts";
9
+ export * from "./migrationLock.d.ts";
10
+ export * from "./migrationParams.d.ts";
11
+ export * from "./migrationPulse.d.ts";
12
+ export * from "./migrationRunner.d.ts";
13
+ export * from "./migrationScope.d.ts";
14
+ export * from "./migrations.d.ts";
15
+ export * from "./migrationTable.d.ts";
@@ -0,0 +1,27 @@
1
+ import { type AkanSqlClient } from "akanjs/service";
2
+ import type { DocSlot } from "./docPath.d.ts";
3
+ /** `delete` is written by a rollback alone, removing a row an apply inserted. */
4
+ export type MigrationChangeOp = "update" | "insert" | "delete";
5
+ /**
6
+ * One row write. `before` and `after` map each changed `_doc` path to its slot; `$removedAt` is the row's removal time
7
+ * and `$doc` a whole `_doc` an insert or delete wrote or took away.
8
+ */
9
+ export interface MigrationChange {
10
+ runId: string;
11
+ seq: number;
12
+ table: string;
13
+ id: string;
14
+ op: MigrationChangeOp;
15
+ before: Record<string, DocSlot>;
16
+ after: Record<string, DocSlot>;
17
+ }
18
+ export declare class MigrationChangeLog {
19
+ #private;
20
+ readonly runId: string;
21
+ constructor(runId: string, connection: () => AkanSqlClient);
22
+ /** Written on the caller's connection, so inside its transaction the entry commits or rolls back with the row. */
23
+ append(change: Omit<MigrationChange, "runId" | "seq">): Promise<void>;
24
+ static count(connection: AkanSqlClient, runId: string): Promise<number>;
25
+ /** Newest first, the order a rollback undoes them in: up to `limit` changes, from the newest or under seq `below`. */
26
+ static page(connection: AkanSqlClient, runId: string, below: number | null, limit: number): Promise<MigrationChange[]>;
27
+ }
@@ -0,0 +1,27 @@
1
+ import type { MigrationChange } from "./migrationChangeLog.d.ts";
2
+ import type { MigrationRevertOutcome, MigrationTable } from "./migrationTable.d.ts";
3
+ export interface MigrationSkip {
4
+ table: string;
5
+ id: string;
6
+ seq: number;
7
+ reason: string;
8
+ }
9
+ /**
10
+ * What a rollback walks with `for await`: the run's changes newest first, read a page at a time, each reverted or
11
+ * skipped with a reason the report shows.
12
+ */
13
+ export declare class MigrationChanges implements AsyncIterable<MigrationChange> {
14
+ #private;
15
+ static readonly pageSize = 500;
16
+ readonly skipped: MigrationSkip[];
17
+ reverted: number;
18
+ /** `from`: a seq a rollback cut short got down to, so walking resumes under it. */
19
+ constructor(page: (below: number | null, limit: number) => Promise<MigrationChange[]>, table: (name: string) => MigrationTable, from?: number | null);
20
+ [Symbol.asyncIterator](): AsyncGenerator<MigrationChange, void, unknown>;
21
+ /** The oldest change `revertAll` has finished with; every newer one is reverted or skipped. */
22
+ get reached(): number | null;
23
+ /** Undone only if the row still holds what the change wrote; a row edited since is skipped and reported. */
24
+ revert(change: MigrationChange): Promise<MigrationRevertOutcome>;
25
+ skip(change: MigrationChange, reason: string): void;
26
+ revertAll(): Promise<void>;
27
+ }
@@ -0,0 +1,33 @@
1
+ import { type MigrationErrorCode } from "./migrationError.d.ts";
2
+ import type { MigrationRunner } from "./migrationRunner.d.ts";
3
+ export declare const migrationActions: readonly ["list", "plan", "apply", "verify", "rollback"];
4
+ export type MigrationAction = (typeof migrationActions)[number];
5
+ export interface MigrationArgs {
6
+ action: MigrationAction;
7
+ target: string;
8
+ params: Record<string, string>;
9
+ expect: string | null;
10
+ actor: string | null;
11
+ items: number | undefined;
12
+ json: boolean;
13
+ }
14
+ /** The last line `ops migrate --json` prints: what akasys records, keyed by `ok` and `code`. */
15
+ export interface MigrationCommandResult {
16
+ ok: boolean;
17
+ action: MigrationAction | null;
18
+ code?: MigrationErrorCode;
19
+ error?: string;
20
+ runId?: string | null;
21
+ [key: string]: unknown;
22
+ }
23
+ export declare class MigrationCommand {
24
+ #private;
25
+ static usageOf(invokedAs?: string): string;
26
+ static jsonOf(argv: string[]): boolean;
27
+ static parse(argv: string[], invokedAs?: string): MigrationArgs;
28
+ static run(runner: MigrationRunner, args: MigrationArgs): Promise<MigrationCommandResult>;
29
+ static failure(action: MigrationAction | null, error: unknown): MigrationCommandResult;
30
+ static exitCode(result: MigrationCommandResult): 0 | 1 | 2 | 3;
31
+ static print(result: MigrationCommandResult, json: boolean): Promise<0 | 1 | 2 | 3>;
32
+ static render(result: MigrationCommandResult, json: boolean): string;
33
+ }
@@ -0,0 +1,28 @@
1
+ import type { Logger } from "akanjs/common";
2
+ import type { AkanSqlClient, SqlDialect } from "akanjs/service";
3
+ import type { AkanServer } from "../akanServer.d.ts";
4
+ import type { MigrationScope } from "./migrationScope.d.ts";
5
+ import { MigrationTable } from "./migrationTable.d.ts";
6
+ export type MigrationGet = AkanServer["get"];
7
+ export interface MigrationContextOption<Params> {
8
+ id: string;
9
+ params: Params;
10
+ logger: Logger;
11
+ get: MigrationGet;
12
+ scope: MigrationScope;
13
+ }
14
+ export declare class MigrationContext<Params = Record<string, unknown>> {
15
+ #private;
16
+ readonly id: string;
17
+ readonly params: Params;
18
+ readonly logger: Logger;
19
+ /** A service, signal or adaptor of the booted server, as `server.get` resolves it. */
20
+ readonly get: MigrationGet;
21
+ constructor({ id, params, logger, get, scope }: MigrationContextOption<Params>);
22
+ /** Rows of the model table `refName` as stored, whatever its model declares now. */
23
+ readonly table: (refName: string) => MigrationTable;
24
+ readonly createId: () => string;
25
+ /** The connection the run writes through, inside its transaction when it has one. */
26
+ get sql(): AkanSqlClient;
27
+ get dialect(): SqlDialect;
28
+ }
@@ -0,0 +1,42 @@
1
+ import type { PromiseOrObject } from "akanjs/base";
2
+ import type { FieldToValue, ParamFieldType } from "akanjs/constant";
3
+ import type { MigrationChanges } from "./migrationChanges.d.ts";
4
+ import type { MigrationContext } from "./migrationContext.d.ts";
5
+ import { type MigrationParamOption, MigrationParams, type MigrationParamValue } from "./migrationParams.d.ts";
6
+ export interface MigrationPlan<Item = unknown> {
7
+ /** What a person approving the run reads before it writes anything. */
8
+ summary: Record<string, unknown>;
9
+ /** The decisions `apply` carries out; hashed with the params, so a changed one refuses an approved apply. */
10
+ items?: Item[];
11
+ }
12
+ export interface MigrationSettings {
13
+ /** `false` commits as it goes, each `rewrite` batch with where it got to: for runs too long for one transaction. */
14
+ transaction: boolean;
15
+ batchSize: number;
16
+ }
17
+ type MigrationStage<Params, Result> = (ctx: MigrationContext<Params>) => PromiseOrObject<Result>;
18
+ export declare class MigrationDefinition<Params = Record<never, never>, Plan extends MigrationPlan = MigrationPlan> {
19
+ #private;
20
+ static readonly defaultSettings: MigrationSettings;
21
+ readonly title: string;
22
+ readonly params: MigrationParams;
23
+ settings: MigrationSettings;
24
+ planStage: MigrationStage<Params, Plan> | null;
25
+ applyStage: ((ctx: MigrationContext<Params>, plan: Plan) => PromiseOrObject<void>) | null;
26
+ verifyStage: MigrationStage<Params, string[]> | null;
27
+ rollbackStage: ((ctx: MigrationContext<Params>, changes: MigrationChanges) => PromiseOrObject<void>) | null;
28
+ constructor(title: string);
29
+ static is(value: unknown): value is MigrationDefinition<Record<string, unknown>>;
30
+ param<Name extends string, Type extends ParamFieldType, const Option extends MigrationParamOption<FieldToValue<Type>> = Record<never, never>>(name: Name, type: Type, option?: Option): MigrationDefinition<Params & { [K in Name]: MigrationParamValue<Type, Option>; }, Plan>;
31
+ /** Reads only, and returns the report a person approves; `apply` recomputes it inside its own transaction. */
32
+ plan<NextPlan extends MigrationPlan>(fn: MigrationStage<Params, NextPlan>): MigrationDefinition<Params, NextPlan>;
33
+ apply(fn: (ctx: MigrationContext<Params>, plan: Plan) => PromiseOrObject<void>): this;
34
+ /** Runs right after apply commits; each string is one problem, and none means the data is as intended. */
35
+ verify(fn: MigrationStage<Params, string[]>): this;
36
+ /** Replaces the default rollback, which reverts every logged change whose row still holds what it wrote. */
37
+ rollback(fn: (ctx: MigrationContext<Params>, changes: MigrationChanges) => PromiseOrObject<void>): this;
38
+ config(settings: Partial<MigrationSettings>): this;
39
+ }
40
+ /** A data migration in `script/migration/<yyyyMMddHHmm>_<name>.ts`, exported as the file's default. */
41
+ export declare const migration: (title: string) => MigrationDefinition<Record<never, never>, MigrationPlan<unknown>>;
42
+ export {};
@@ -0,0 +1,15 @@
1
+ export type MigrationErrorCode = "usage" | "notFound" | "invalidParam" | "locked" | "alreadyApplied" | "notApplied" | "planChanged" | "verifyFailed" | "failed";
2
+ /** A refusal or failure whose `code` the JSON result carries, so a caller decides by it rather than by the message. */
3
+ export declare class MigrationError extends Error {
4
+ readonly code: MigrationErrorCode;
5
+ /** The ledger run the failure was recorded on, when it got that far. */
6
+ runId: string | null;
7
+ constructor(code: MigrationErrorCode, message: string, options?: {
8
+ cause?: unknown;
9
+ });
10
+ static codeOf(error: unknown): MigrationErrorCode;
11
+ static messageOf(error: unknown): string;
12
+ /** What a verify that found `problemNum` problems reports. */
13
+ static remaining(problemNum: number): string;
14
+ static recorded(error: unknown, runId: string): MigrationError;
15
+ }
@@ -0,0 +1,51 @@
1
+ import { type AkanSqlClient } from "akanjs/service";
2
+ export type MigrationRunKind = "plan" | "apply" | "verify" | "rollback";
3
+ /** `aborted` is a refusal before any write: the plan no longer hashed to what was approved. */
4
+ export type MigrationRunStatus = "running" | "done" | "failed" | "aborted";
5
+ export interface MigrationRun {
6
+ id: string;
7
+ migrationId: string;
8
+ kind: MigrationRunKind;
9
+ status: MigrationRunStatus;
10
+ /** The apply run a rollback undoes. */
11
+ target: string | null;
12
+ checksum: string;
13
+ buildId: string | null;
14
+ params: Record<string, unknown> | null;
15
+ planHash: string | null;
16
+ summary: Record<string, unknown> | null;
17
+ actor: string | null;
18
+ checkpoint: Record<string, string> | null;
19
+ startedAt: number;
20
+ finishedAt: number | null;
21
+ error: string | null;
22
+ }
23
+ export interface MigrationState {
24
+ /** The last apply that finished and was not rolled back. */
25
+ applied: MigrationRun | null;
26
+ /** Applies that failed after committing some of their writes, newest first; a rollback undoes them too. */
27
+ partial: MigrationRun[];
28
+ }
29
+ export declare class MigrationLedger {
30
+ #private;
31
+ constructor(connection: () => AkanSqlClient);
32
+ insert(run: MigrationRun): Promise<MigrationRun>;
33
+ finish(id: string, { status, planHash, summary, error, }: {
34
+ status: MigrationRunStatus;
35
+ planHash?: string | null;
36
+ summary?: Record<string, unknown> | null;
37
+ error?: string | null;
38
+ }): Promise<void>;
39
+ /** Only while the run is still `running`: one another holder interrupted is never recorded done after all. */
40
+ complete(id: string, { planHash, summary }: {
41
+ planHash?: string | null;
42
+ summary: Record<string, unknown>;
43
+ }): Promise<void>;
44
+ saveCheckpoint(id: string, checkpoint: Record<string, string>): Promise<void>;
45
+ get(id: string): Promise<MigrationRun | null>;
46
+ /** Oldest first. */
47
+ runsOf(migrationId?: string): Promise<MigrationRun[]>;
48
+ /** Only the lock holder calls this, so a run still `running` belongs to a process that died holding the lock. */
49
+ interruptRunning(): Promise<void>;
50
+ state(runs: MigrationRun[]): Promise<MigrationState>;
51
+ }
@@ -0,0 +1,34 @@
1
+ import type { AkanSqlClient } from "akanjs/service";
2
+ /**
3
+ * One run at a time across every replica and channel: a lease in `_akan_meta` holding its holder's token, `updatedAt`
4
+ * the epoch ms it was last renewed at. A holder that dies is replaced once the lease is `ttlMs` old; a live one renews
5
+ * well inside that, and every renewal names its token, so a holder that was replaced finds out on its next one.
6
+ */
7
+ export declare class MigrationLock {
8
+ #private;
9
+ static readonly key = "migration:lock";
10
+ static readonly ttlMs = 60000;
11
+ static readonly renewMs = 15000;
12
+ /**
13
+ * `inBand` for SQLite: bun:sqlite runs each statement synchronously, so a run never lets the renewal timer fire, and
14
+ * a renewal inside the run's transaction is safe, as that transaction keeps every other process off the lease.
15
+ */
16
+ constructor(connection: () => AkanSqlClient, { inBand }?: {
17
+ inBand?: boolean;
18
+ });
19
+ /**
20
+ * Call outside any transaction: the renewal timer keeps the context it was created in, and a beat renews only on the
21
+ * connection this acquires on.
22
+ */
23
+ acquire(): Promise<boolean>;
24
+ /**
25
+ * Throws once another run has taken the lease over. Renews when due, or at once with `force`, so a run that stalled
26
+ * past the TTL finds out before its next write. Off SQLite it leaves renewing to the timer inside any transaction,
27
+ * whose connection is not the one it acquired on: a renewal there publishes nothing until that commits, holds the
28
+ * row the timer renews, and under repeatable read fails the whole transaction once the timer has renewed.
29
+ */
30
+ heartbeat({ force }?: {
31
+ force?: boolean;
32
+ }): Promise<void>;
33
+ release(): Promise<void>;
34
+ }
@@ -0,0 +1,41 @@
1
+ import { type FieldToValue, type ParamFieldType } from "akanjs/constant";
2
+ export interface MigrationParamOption<Value = unknown> {
3
+ /** What the value means, shown beside its input on the approval form — so English. */
4
+ desc?: string;
5
+ /** For a `String`, the values it may take. */
6
+ enum?: readonly string[];
7
+ default?: Value;
8
+ /** Left out, the value is `null` rather than a refusal. */
9
+ nullable?: boolean;
10
+ }
11
+ export type MigrationParamValue<Type, Option> = Option extends {
12
+ default: unknown;
13
+ } ? MigrationParamBase<Type, Option> : Option extends {
14
+ nullable: true;
15
+ } ? MigrationParamBase<Type, Option> | null : MigrationParamBase<Type, Option>;
16
+ type MigrationParamBase<Type, Option> = Option extends {
17
+ enum: readonly (infer Value)[];
18
+ } ? Value : FieldToValue<Type>;
19
+ export interface MigrationParamInfo extends MigrationParamOption {
20
+ name: string;
21
+ type: ParamFieldType;
22
+ }
23
+ /** One declared param as `list` reports it, enough to build its input. */
24
+ export interface MigrationParamSpec {
25
+ name: string;
26
+ type: string;
27
+ required: boolean;
28
+ enum?: readonly (string | number)[];
29
+ default?: unknown;
30
+ desc?: string;
31
+ }
32
+ export declare class MigrationParams {
33
+ #private;
34
+ readonly list: MigrationParamInfo[];
35
+ declare(info: MigrationParamInfo): void;
36
+ parse(raw: Record<string, string>): Record<string, unknown>;
37
+ /** Params a run recorded as JSON, as their declared types again: what a rollback hands the script. */
38
+ revive(stored: Record<string, unknown>): Record<string, unknown>;
39
+ specs(): MigrationParamSpec[];
40
+ }
41
+ export {};
@@ -0,0 +1,15 @@
1
+ import type { MigrationLock } from "./migrationLock.d.ts";
2
+ /** What every table call of a run beats: its lease, and a warning once its own transaction has held SQLite long. */
3
+ export declare class MigrationPulse {
4
+ #private;
5
+ static readonly holdWarnMs = 5000;
6
+ readonly lock: MigrationLock;
7
+ constructor(lock: MigrationLock, onLongHold?: ((heldMs: number) => void) | null);
8
+ /** A writer stops once its lease is lost; a reader reads on, as nothing it does clashes with whoever took over. */
9
+ beat({ strict, force }: {
10
+ strict: boolean;
11
+ force?: boolean;
12
+ }): Promise<void>;
13
+ /** Runs `fn` as the span the warning measures: the run's own transaction. */
14
+ hold<T>(fn: () => Promise<T>): Promise<T>;
15
+ }
@@ -0,0 +1,93 @@
1
+ import { Logger } from "akanjs/common";
2
+ import { type DatabaseAdaptor } from "akanjs/service";
3
+ import { type MigrationSkip } from "./migrationChanges.d.ts";
4
+ import { type MigrationGet } from "./migrationContext.d.ts";
5
+ import type { MigrationParamSpec } from "./migrationParams.d.ts";
6
+ export interface MigrationEntry {
7
+ id: string;
8
+ /** sha256 of the script's source: the ledger keeps which version of a script ran. */
9
+ checksum: string;
10
+ load: () => Promise<{
11
+ default?: unknown;
12
+ }>;
13
+ }
14
+ export interface MigrationRunnerOption {
15
+ database: DatabaseAdaptor;
16
+ get?: MigrationGet;
17
+ buildId?: string | null;
18
+ logger?: Logger;
19
+ }
20
+ export type MigrationStatus = "pending" | "applied" | "partial";
21
+ export interface MigrationListItem {
22
+ id: string;
23
+ title: string | null;
24
+ checksum: string;
25
+ /** `partial`: an apply outside one transaction failed after committing some of its batches. */
26
+ status: MigrationStatus;
27
+ appliedRunId: string | null;
28
+ appliedAt: number | null;
29
+ /** The applied run ran another version of the script than this build carries. */
30
+ checksumMismatch: boolean;
31
+ params: MigrationParamSpec[];
32
+ error?: string;
33
+ }
34
+ export interface MigrationPlanResult {
35
+ id: string;
36
+ runId: string;
37
+ planHash: string;
38
+ params: Record<string, unknown>;
39
+ summary: unknown;
40
+ items: unknown[];
41
+ itemCount: number;
42
+ }
43
+ export interface MigrationApplyResult {
44
+ id: string;
45
+ runId: string;
46
+ planHash: string;
47
+ summary: unknown;
48
+ changes: number;
49
+ problems: string[];
50
+ }
51
+ export interface MigrationVerifyResult {
52
+ id: string;
53
+ runId: string;
54
+ problems: string[];
55
+ }
56
+ export interface MigrationRollbackRun {
57
+ runId: string;
58
+ target: string;
59
+ reverted: number;
60
+ skipped: MigrationSkip[];
61
+ }
62
+ export interface MigrationRollbackResult {
63
+ id: string;
64
+ runs: MigrationRollbackRun[];
65
+ }
66
+ export declare class MigrationRunner {
67
+ #private;
68
+ static readonly defaultItemNum = 100;
69
+ constructor(entries: MigrationEntry[], { database, get, buildId, logger }: MigrationRunnerOption);
70
+ list(): Promise<MigrationListItem[]>;
71
+ plan(id: string, raw?: Record<string, string>, { actor, items }?: {
72
+ actor?: string | null;
73
+ items?: number;
74
+ }): Promise<MigrationPlanResult>;
75
+ /**
76
+ * Recomputes the plan inside the run's own transaction and refuses when it no longer hashes to `expect`, the plan a
77
+ * person approved. Verify runs once the writes commit; its problems leave the run applied but the result not ok.
78
+ */
79
+ apply(id: string, raw?: Record<string, string>, { expect, actor }?: {
80
+ expect?: string | null;
81
+ actor?: string | null;
82
+ }): Promise<MigrationApplyResult>;
83
+ verify(id: string, raw?: Record<string, string>, { actor }?: {
84
+ actor?: string | null;
85
+ }): Promise<MigrationVerifyResult>;
86
+ /**
87
+ * `target` is the newest apply run, or a migration id for every run of it not yet rolled back, newest first. Works
88
+ * for a script this build no longer carries: the change log and the settings the apply ran with are enough.
89
+ */
90
+ rollback(target: string, { actor }?: {
91
+ actor?: string | null;
92
+ }): Promise<MigrationRollbackResult>;
93
+ }
@@ -0,0 +1,42 @@
1
+ import type { AkanSqlClient, DatabaseAdaptor, SqlDialect } from "akanjs/service";
2
+ import type { MigrationChangeLog } from "./migrationChangeLog.d.ts";
3
+ import type { MigrationLedger } from "./migrationLedger.d.ts";
4
+ export interface MigrationScopeOption {
5
+ database: DatabaseAdaptor;
6
+ readOnly: boolean;
7
+ batchSize: number;
8
+ log?: MigrationChangeLog | null;
9
+ /** Set for a run outside one transaction: each `rewrite` batch commits with where it got to. */
10
+ checkpoints?: {
11
+ runId: string;
12
+ ledger: MigrationLedger;
13
+ resumed: Record<string, string>;
14
+ } | null;
15
+ /** Called at every table call, so a run keeps its lease however long it holds the event loop. */
16
+ beat?: () => Promise<void>;
17
+ }
18
+ export declare class MigrationScope {
19
+ #private;
20
+ readonly database: DatabaseAdaptor;
21
+ readonly dialect: SqlDialect;
22
+ readonly readOnly: boolean;
23
+ readonly batchSize: number;
24
+ readonly log: MigrationChangeLog | null;
25
+ constructor({ database, readOnly, batchSize, log, checkpoints, beat, }: MigrationScopeOption);
26
+ static assertBatchSize(batchSize: number): void;
27
+ connection(): AkanSqlClient;
28
+ now(): number;
29
+ createId(): string;
30
+ beat(): Promise<void>;
31
+ /** Joins the transaction already open in this context, or opens one around `fn`. */
32
+ transaction<T>(fn: () => Promise<T>): Promise<T>;
33
+ /**
34
+ * A rewrite is told apart by its table and `signature`, so a resumed run finds each one's place again even when it
35
+ * skips a rewrite the first attempt made; only identical rewrites fall back on the order they are called in.
36
+ */
37
+ nextRewrite(table: string, signature: string): {
38
+ key: string;
39
+ after: string | undefined;
40
+ };
41
+ reach(key: string, id: string): Promise<void>;
42
+ }
@@ -0,0 +1,52 @@
1
+ import type { PromiseOrObject } from "akanjs/base";
2
+ import { type RawFilter, type RawFindOptions, type TransferRow } from "akanjs/service";
3
+ import type { MigrationChange } from "./migrationChangeLog.d.ts";
4
+ import { MigrationScope } from "./migrationScope.d.ts";
5
+ /** A path to its new value; `undefined` removes the path. */
6
+ export type MigrationPatch = Record<string, unknown>;
7
+ export interface MigrationRewriteOption {
8
+ where?: RawFilter;
9
+ /** Removed rows are rewritten too unless this is `false`. */
10
+ withRemoved?: boolean;
11
+ batchSize?: number;
12
+ }
13
+ /** Why a logged change was left as it is; `reverted` means it was undone. */
14
+ export type MigrationRevertOutcome = "reverted" | "changed" | "missing";
15
+ /**
16
+ * A model's rows as stored, whatever the model declares now. Every write records what it changed in the run's change
17
+ * log, in the same transaction, and leaves `updatedAt` alone: a migration reshapes data, it does not edit it.
18
+ */
19
+ export declare class MigrationTable {
20
+ #private;
21
+ readonly name: string;
22
+ constructor(name: string, scope: MigrationScope);
23
+ find(where?: RawFilter, options?: RawFindOptions): Promise<TransferRow[]>;
24
+ get(id: string): Promise<TransferRow | null>;
25
+ count(where?: RawFilter, options?: Omit<RawFindOptions, "limit">): Promise<number>;
26
+ /** Returns whether anything changed: a value equal to the stored one is no change and is not logged. */
27
+ set(id: string, patch: MigrationPatch): Promise<boolean>;
28
+ unset(id: string, paths: string[]): Promise<boolean>;
29
+ /** A soft removal, as the model's own `remove` makes. */
30
+ remove(id: string): Promise<boolean>;
31
+ restore(id: string): Promise<boolean>;
32
+ /** A new row; `doc` is its `_doc`, so `id` and the timestamps are not fields of it. */
33
+ insert(doc: Record<string, unknown>, { id, removedAt }?: {
34
+ id?: string;
35
+ removedAt?: number | null;
36
+ }): Promise<string>;
37
+ /** A new row holding the source's `_doc` with `patch` applied, removed if the source is. */
38
+ copy(id: string, patch?: MigrationPatch): Promise<string>;
39
+ /**
40
+ * `fn` sees each row in id order and returns a patch, or nothing to leave the row be. Outside a transaction every
41
+ * batch commits with where it got to, so a run cut short resumes there; `fn` must still skip rows it already fixed.
42
+ */
43
+ rewrite(fn: (row: TransferRow) => PromiseOrObject<MigrationPatch | null | undefined | false>, { where, withRemoved, batchSize }?: MigrationRewriteOption): Promise<{
44
+ scanned: number;
45
+ changed: number;
46
+ }>;
47
+ /**
48
+ * Undoes one logged change if the row still holds what the change wrote; a row already back where the change found
49
+ * it counts as undone, so a rollback cut short can run again.
50
+ */
51
+ revert(change: MigrationChange): Promise<MigrationRevertOutcome>;
52
+ }
@@ -0,0 +1,12 @@
1
+ import type { AkanServer } from "../akanServer.d.ts";
2
+ import { type MigrationEntry, MigrationRunner } from "./migrationRunner.d.ts";
3
+ /** The migrations one build carries, as the generated `server.ts` lists them. */
4
+ export declare class Migrations {
5
+ #private;
6
+ readonly entries: MigrationEntry[];
7
+ constructor(entries: MigrationEntry[]);
8
+ /** On a started server: the runner writes through its database adaptor. */
9
+ runner(server: AkanServer): MigrationRunner;
10
+ /** Boots `server` with no listener or schedule, runs one action, and prints its result last. Returns the exit code. */
11
+ command(server: AkanServer, argv: string[], invokedAs?: string): Promise<0 | 1 | 2 | 3>;
12
+ }
@@ -0,0 +1 @@
1
+ export * from "./migration/index.d.ts";
@@ -1,5 +1,14 @@
1
+ import type { AkanServer } from "../akanServer.d.ts";
2
+ import type { Migrations } from "../migration/migrations.d.ts";
3
+ /** What `main.js` lends a command that needs the app itself: its server module, imported with a replica's env. */
4
+ export interface OpsHost {
5
+ importServer(): Promise<{
6
+ server?: AkanServer;
7
+ migrations?: Migrations;
8
+ }>;
9
+ }
1
10
  export declare class OpsCommand {
2
11
  #private;
3
12
  static readonly usage: string;
4
- static run(argv: string[]): Promise<number>;
13
+ static run(argv: string[], host?: OpsHost): Promise<number>;
5
14
  }
@@ -23,8 +23,6 @@ export interface AkanRouterStateV1 {
23
23
  href: string;
24
24
  routeId: string;
25
25
  segments: AkanRouteSegmentState[];
26
- /** The route's `.config({ transition })`, which the browser plays as a view transition on the way in and out. */
27
- transition?: string;
28
26
  }
29
27
  export type AkanHeadSnapshotTag = "title" | "meta" | "link";
30
28
  export interface AkanHeadSnapshotNode {
@@ -70,11 +68,10 @@ export declare function readAkanRouterStateResponseHeader(headers: Headers): Aka
70
68
  export declare function encodeAkanRscPatchSegmentPath(segmentPath: string[]): string;
71
69
  export declare function decodeAkanRscPatchSegmentPath(value: string | null | undefined): string[] | null;
72
70
  export declare function readAkanRscPatchMetadataResponseHeaders(headers: Headers): AkanRscPatchMetadata | null;
73
- export declare function createAkanRouterState({ pathRoute, href, buildId, transition, }: {
71
+ export declare function createAkanRouterState({ pathRoute, href, buildId, }: {
74
72
  pathRoute: PathRoute;
75
73
  href: string;
76
74
  buildId?: number;
77
- transition?: string;
78
75
  }): AkanRouterStateV1;
79
76
  export declare function createAkanRouteSegments(pathRoute: PathRoute): AkanRouteSegmentState[];
80
77
  export declare function createAkanSegmentOutletKey(segmentPath: string[], segmentIndex: number): string | null;
@@ -86,10 +86,9 @@ interface CommitRscNavigationInput<T> {
86
86
  startTransition: (callback: () => void) => void;
87
87
  commitThenable: (thenable: T) => void;
88
88
  updateHistory?: () => void;
89
- scrollToTop?: boolean;
90
- bumpScrollToTop?: () => void;
89
+ requestScroll?: () => void;
91
90
  }
92
- export declare function commitRscNavigation<T>({ cache, href, thenable, maxEntries, startTransition, commitThenable, updateHistory, scrollToTop, bumpScrollToTop, }: CommitRscNavigationInput<T>): void;
91
+ export declare function commitRscNavigation<T>({ cache, href, thenable, maxEntries, startTransition, commitThenable, updateHistory, requestScroll, }: CommitRscNavigationInput<T>): void;
93
92
  export declare function commitLatestRscNavigation<T>({ navId, getCurrentNavId, ...input }: CommitRscNavigationInput<T> & {
94
93
  navId: number;
95
94
  getCurrentNavId: () => number;