akanjs 3.0.0-alpha.8 → 3.0.0-alpha.80

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 (832) hide show
  1. package/CHANGELOG.md +103 -0
  2. package/README.ko.md +1 -1
  3. package/README.md +1 -1
  4. package/base/baseEnv.ts +7 -4
  5. package/base/primitiveRegistry.ts +59 -12
  6. package/base/symbols.ts +4 -0
  7. package/client/capacitor.ts +34 -0
  8. package/client/clientRuntime.ts +5 -0
  9. package/client/cookie.ts +21 -34
  10. package/client/csrTypes.ts +4 -15
  11. package/client/frameConfig.ts +13 -0
  12. package/client/index.ts +1 -0
  13. package/client/locale.ts +2 -2
  14. package/client/router.ts +7 -7
  15. package/client/sharedContext.ts +31 -0
  16. package/client/translator.ts +2 -2
  17. package/client/types.ts +3 -3
  18. package/common/Logger.ts +287 -67
  19. package/common/TrustedProxy.ts +134 -0
  20. package/common/clamp.ts +2 -0
  21. package/common/clientAddress.ts +40 -0
  22. package/common/deepObjectify.ts +3 -2
  23. package/common/dynamicRecord.ts +12 -0
  24. package/common/index.ts +47 -2
  25. package/common/isValidDate.ts +1 -1
  26. package/common/logContext.ts +27 -0
  27. package/common/mcpExposure.ts +114 -0
  28. package/common/pathGetLoose.ts +31 -0
  29. package/common/plainFieldsOf.ts +13 -0
  30. package/common/requestOrigin.ts +32 -0
  31. package/common/{httpClient.ts → restClient.ts} +16 -9
  32. package/common/routeConvention.ts +22 -12
  33. package/common/websocketBinaryFrame.ts +46 -0
  34. package/constant/crystalize.ts +92 -28
  35. package/constant/dateSlot.ts +62 -0
  36. package/constant/deserialize.ts +3 -2
  37. package/constant/fieldInfo.ts +43 -3
  38. package/constant/fieldQueryMeta.ts +35 -0
  39. package/constant/getDefault.ts +16 -11
  40. package/constant/hydrationPlan.ts +72 -0
  41. package/constant/immerify.ts +4 -6
  42. package/constant/index.ts +5 -0
  43. package/constant/labelOf.ts +26 -0
  44. package/constant/mask.ts +67 -0
  45. package/constant/purify.ts +17 -11
  46. package/constant/textFieldPaths.ts +13 -7
  47. package/constant/types.ts +41 -13
  48. package/constant/via.ts +24 -17
  49. package/dictionary/DictionaryLookup.ts +30 -0
  50. package/dictionary/agent.dictionary.ts +31 -0
  51. package/dictionary/agentTurn.dictionary.ts +29 -0
  52. package/dictionary/base.dictionary.ts +85 -0
  53. package/dictionary/dictInfo.ts +11 -2
  54. package/dictionary/dictionary.ts +9 -3
  55. package/dictionary/index.ts +1 -0
  56. package/dictionary/trans.ts +26 -7
  57. package/document/dataLoader.ts +0 -4
  58. package/document/documentQuery.ts +1 -0
  59. package/document/filterMeta.ts +79 -14
  60. package/document/index.ts +1 -0
  61. package/document/loaderInfo.ts +4 -1
  62. package/document/noDocumentError.ts +12 -0
  63. package/document/types.ts +0 -1
  64. package/fetch/agentTurn.ts +19 -0
  65. package/fetch/client/fetchClient.ts +166 -89
  66. package/fetch/client/fetchHandle.ts +57 -0
  67. package/fetch/client/httpClient.ts +140 -30
  68. package/fetch/client/sliceInitHandle.ts +101 -0
  69. package/fetch/client/wsClient.ts +27 -12
  70. package/fetch/fetchType/appliedReturn.type.ts +126 -42
  71. package/fetch/fetchType/endpointFetch.type.ts +17 -8
  72. package/fetch/fetchType/sliceFetch.type.ts +30 -53
  73. package/fetch/index.ts +1 -0
  74. package/fetch/requestStorage.ts +19 -5
  75. package/index.ts +132 -8
  76. package/local/apps/akan/akan-local.db +0 -0
  77. package/local/apps/akan/akan-local.db-shm +0 -0
  78. package/local/apps/akan/akan-local.db-wal +0 -0
  79. package/local/apps/akan/akan-local_solid.db +0 -0
  80. package/local/apps/akan/akan-local_solid.db-shm +0 -0
  81. package/local/apps/akan/akan-local_solid.db-wal +0 -0
  82. package/local/apps/serverLifecycle/serverLifecycle-local.db +0 -0
  83. package/local/apps/serverLifecycle/serverLifecycle-local.db-shm +0 -0
  84. package/local/apps/serverLifecycle/serverLifecycle-local.db-wal +0 -0
  85. package/local/apps/serverLifecycle/serverLifecycle-local_solid.db +0 -0
  86. package/local/apps/serverLifecycle/serverLifecycle-local_solid.db-shm +0 -0
  87. package/local/apps/serverLifecycle/serverLifecycle-local_solid.db-wal +0 -0
  88. package/package.json +27 -18
  89. package/server/akanApp.ts +325 -157
  90. package/server/akanAppHeaders.ts +23 -3
  91. package/server/akanOption.ts +76 -8
  92. package/server/akanServer.ts +390 -32
  93. package/server/animatedImage.ts +83 -0
  94. package/server/assetEncoding.ts +4 -24
  95. package/server/binaryPubsub.ts +55 -0
  96. package/server/cachePolicy.ts +2 -11
  97. package/server/console.ts +110 -101
  98. package/server/consoleEvaluator.ts +51 -0
  99. package/server/consolePasteFilter.ts +91 -0
  100. package/server/consoleSession.ts +242 -0
  101. package/server/contentEncoding.ts +83 -0
  102. package/server/decorators.ts +12 -3
  103. package/server/devtools/constantSerializer.ts +8 -1
  104. package/server/devtools/signalSerializer.ts +2 -2
  105. package/server/devtools/types.ts +4 -4
  106. package/server/di/diLifecycle.ts +144 -14
  107. package/server/di/predefinedAdaptor.ts +6 -0
  108. package/server/di/resolveHierarchy.ts +3 -3
  109. package/server/di/utils.ts +40 -0
  110. package/server/hmr/clientScript.ts +1 -1
  111. package/server/imageOptimizer.ts +156 -74
  112. package/server/lifecycle/runtimeDir.ts +14 -0
  113. package/server/lifecycle/shutdownManager.ts +17 -2
  114. package/server/logging/childOutputReader.ts +137 -0
  115. package/server/logging/hubFileSink.ts +39 -0
  116. package/server/logging/logControlSocket.ts +173 -0
  117. package/server/logging/logForwarder.ts +131 -0
  118. package/server/logging/logHub.ts +0 -0
  119. package/server/logging/logQuery.ts +130 -0
  120. package/server/logging/logStdoutWriter.ts +39 -0
  121. package/server/logging/logStreamRoute.ts +87 -0
  122. package/server/logging/logTailClient.ts +161 -0
  123. package/server/mcp/McpAuth.ts +177 -0
  124. package/server/mcp/McpDispatcher.ts +295 -0
  125. package/server/mcp/McpEventStream.ts +24 -0
  126. package/server/mcp/McpExecutionContext.ts +105 -0
  127. package/server/mcp/McpRouter.ts +621 -0
  128. package/server/mcp/index.ts +5 -0
  129. package/server/processMetricsCollector.ts +1 -1
  130. package/server/resolver/database.resolver.ts +18 -12
  131. package/server/resolver/signal.resolver.ts +211 -89
  132. package/server/routeTreeBuilder.ts +11 -23
  133. package/server/routing/apiRouter.ts +45 -16
  134. package/server/routing/appWsData.ts +30 -5
  135. package/server/routing/eventStream.ts +93 -0
  136. package/server/routing/soloAppRoutes.ts +50 -0
  137. package/server/rscWorker.tsx +63 -22
  138. package/server/rscWorkerHost.ts +59 -8
  139. package/server/semaphore.ts +22 -0
  140. package/server/ssrFromRscRenderer.tsx +50 -0
  141. package/server/staticPath.ts +34 -0
  142. package/server/subRouteIndexDocument.tsx +61 -0
  143. package/server/systemPageDocument.tsx +3 -3
  144. package/server/systemPages.tsx +49 -16
  145. package/server/types.tsx +28 -0
  146. package/server/vendor/akanjs-fetch.ts +1 -0
  147. package/server/webRouter.ts +130 -73
  148. package/service/adapt.ts +5 -9
  149. package/service/agent.service.ts +81 -0
  150. package/service/base.service.ts +2 -1
  151. package/service/index.ts +1 -0
  152. package/service/injectInfo.ts +8 -3
  153. package/service/ipcTypes.ts +6 -0
  154. package/service/predefinedAdaptor/cache.adaptor.ts +8 -4
  155. package/service/predefinedAdaptor/compress.adaptor.ts +5 -1
  156. package/service/predefinedAdaptor/database.adaptor.ts +59 -1757
  157. package/service/predefinedAdaptor/deepseekLlm.ts +271 -0
  158. package/service/predefinedAdaptor/index.ts +3 -0
  159. package/service/predefinedAdaptor/insightQuery.ts +183 -0
  160. package/service/predefinedAdaptor/llm.adaptor.ts +115 -0
  161. package/service/predefinedAdaptor/logging.adaptor.ts +1 -1
  162. package/service/predefinedAdaptor/queue.adaptor.ts +5 -2
  163. package/service/predefinedAdaptor/role.adaptor.ts +2 -0
  164. package/service/predefinedAdaptor/schedule.adaptor.ts +12 -5
  165. package/service/predefinedAdaptor/solidPubsub.adaptor.ts +10 -6
  166. package/service/predefinedAdaptor/solidQueue.adaptor.ts +6 -2
  167. package/service/predefinedAdaptor/solidSqlite.ts +11 -9
  168. package/service/predefinedAdaptor/sql/PendingStoreEnsures.ts +22 -0
  169. package/service/predefinedAdaptor/sql/QueryCompiler.ts +225 -0
  170. package/service/predefinedAdaptor/sql/SqlDocumentStore.ts +812 -0
  171. package/service/predefinedAdaptor/sql/UpdateCompiler.ts +67 -0
  172. package/service/predefinedAdaptor/sql/dialect/postgres.ts +151 -0
  173. package/service/predefinedAdaptor/sql/dialect/sqlite.ts +134 -0
  174. package/service/predefinedAdaptor/sql/driver/bunSqlite.ts +29 -0
  175. package/service/predefinedAdaptor/sql/driver/libsql.ts +37 -0
  176. package/service/predefinedAdaptor/sql/driver/postgres.ts +42 -0
  177. package/service/predefinedAdaptor/sql/types.ts +251 -0
  178. package/service/predefinedAdaptor/sql/values.ts +91 -0
  179. package/service/predefinedAdaptor/websocket.adaptor.ts +6 -1
  180. package/service/serve.ts +16 -9
  181. package/service/toolNames.ts +119 -0
  182. package/signal/CrossSiteGuard.ts +71 -0
  183. package/signal/SignalFailure.ts +51 -0
  184. package/signal/agent/AgentCatalogue.ts +165 -0
  185. package/signal/agent/index.ts +1 -0
  186. package/signal/agent.signal.ts +38 -0
  187. package/signal/agentTurn.ts +8 -0
  188. package/signal/agentTurnStream.ts +60 -0
  189. package/signal/base.signal.ts +2 -1
  190. package/signal/endpoint.ts +2 -2
  191. package/signal/endpointInfo.ts +38 -2
  192. package/signal/exception.ts +43 -6
  193. package/signal/guard.ts +28 -1
  194. package/signal/guards.ts +49 -1
  195. package/signal/index.ts +8 -0
  196. package/signal/intercept.ts +9 -6
  197. package/signal/internal.ts +10 -2
  198. package/signal/internalArg.ts +21 -4
  199. package/signal/mcp/McpDocument.ts +326 -0
  200. package/signal/mcp/McpProgress.ts +106 -0
  201. package/signal/mcp/McpUriTemplate.ts +80 -0
  202. package/signal/mcp/Msg.ts +368 -0
  203. package/signal/mcp/index.ts +5 -0
  204. package/signal/mcp/mcpProtocol.ts +120 -0
  205. package/signal/middleware.ts +3 -3
  206. package/signal/openapi/openapi.ts +36 -173
  207. package/signal/schema/JsonSchemaBuilder.ts +221 -0
  208. package/signal/schema/index.ts +1 -0
  209. package/signal/serializer/fetch.serializer.ts +62 -1
  210. package/signal/signalContext.ts +339 -94
  211. package/signal/slice.ts +63 -28
  212. package/signal/trace.ts +268 -9
  213. package/signal/types.ts +55 -4
  214. package/store/SliceRequest.ts +23 -0
  215. package/store/action.ts +210 -154
  216. package/store/actionTag.ts +33 -0
  217. package/store/agent/AgentBridge.ts +89 -0
  218. package/store/agent/AgentContext.ts +71 -0
  219. package/store/agent/AgentPrompts.ts +111 -0
  220. package/store/agent/ScreenReader.ts +349 -0
  221. package/store/agent/ScreenSettle.ts +45 -0
  222. package/store/agent/ScreenTarget.ts +135 -0
  223. package/store/agent/StoreCatalogue.ts +116 -0
  224. package/store/agent/StoreSurfaceSource.ts +225 -0
  225. package/store/agent/index.ts +13 -0
  226. package/store/agent/storeSurface.ts +28 -0
  227. package/store/agent/types.ts +16 -0
  228. package/store/agentic/AgentValue.ts +119 -0
  229. package/store/agentic/StExposeBuilder.ts +50 -0
  230. package/store/agentic/StExposeDraft.ts +24 -0
  231. package/store/agentic/StStateBuilder.ts +90 -0
  232. package/store/agentic/StStateDraft.ts +23 -0
  233. package/store/agentic/StToolBuilder.ts +293 -0
  234. package/store/agentic/StToolDraft.ts +22 -0
  235. package/store/agentic/attachAgentic.ts +33 -0
  236. package/store/agentic/formFields.ts +194 -0
  237. package/store/agentic/index.ts +12 -0
  238. package/store/agentic/useFieldTool.ts +183 -0
  239. package/store/agentic/useFormTools.ts +77 -0
  240. package/store/agentic/useRelationFieldTool.ts +113 -0
  241. package/store/baseSt.ts +1 -1
  242. package/store/databaseStateNames.ts +31 -0
  243. package/store/formSetterNames.ts +35 -0
  244. package/store/index.ts +8 -0
  245. package/store/rootStore.ts +3 -1
  246. package/store/sliceRole.ts +36 -0
  247. package/store/state.ts +2 -12
  248. package/store/store.ts +10 -1
  249. package/store/storeInstance.ts +185 -22
  250. package/store/storeRegistry.ts +40 -2
  251. package/store/types.ts +5 -0
  252. package/store/withSelector.ts +5 -4
  253. package/test/index.ts +1 -1
  254. package/test/registerDom.ts +4 -0
  255. package/test/sampleOf.ts +2 -0
  256. package/test/signalTestRuntime.ts +5 -5
  257. package/test/testServer.ts +14 -11
  258. package/types/base/baseEnv.d.ts +1 -1
  259. package/types/base/primitiveRegistry.d.ts +20 -8
  260. package/types/base/symbols.d.ts +4 -0
  261. package/types/client/capacitor.d.ts +39 -0
  262. package/types/client/clientRuntime.d.ts +7 -0
  263. package/types/client/cookie.d.ts +13 -2
  264. package/types/client/csrTypes.d.ts +0 -1
  265. package/types/client/frameConfig.d.ts +1 -0
  266. package/types/client/index.d.ts +1 -0
  267. package/types/client/sharedContext.d.ts +21 -0
  268. package/types/client/types.d.ts +5 -3
  269. package/types/common/Logger.d.ts +88 -6
  270. package/types/common/TrustedProxy.d.ts +24 -0
  271. package/types/common/clamp.d.ts +2 -0
  272. package/types/common/clientAddress.d.ts +19 -0
  273. package/types/common/dynamicRecord.d.ts +14 -0
  274. package/types/common/index.d.ts +13 -3
  275. package/types/common/logContext.d.ts +17 -0
  276. package/types/common/mcpExposure.d.ts +64 -0
  277. package/types/common/pathGetLoose.d.ts +8 -0
  278. package/types/common/plainFieldsOf.d.ts +6 -0
  279. package/types/common/requestOrigin.d.ts +14 -0
  280. package/types/common/restClient.d.ts +27 -0
  281. package/types/common/routeConvention.d.ts +6 -0
  282. package/types/common/websocketBinaryFrame.d.ts +17 -0
  283. package/types/constant/constantRegistry.d.ts +2 -10
  284. package/types/constant/crystalize.d.ts +5 -0
  285. package/types/constant/dateSlot.d.ts +14 -0
  286. package/types/constant/fieldInfo.d.ts +20 -3
  287. package/types/constant/fieldQueryMeta.d.ts +17 -0
  288. package/types/constant/getDefault.d.ts +8 -0
  289. package/types/constant/hydrationPlan.d.ts +24 -0
  290. package/types/constant/index.d.ts +5 -0
  291. package/types/constant/labelOf.d.ts +7 -0
  292. package/types/constant/mask.d.ts +41 -0
  293. package/types/constant/purify.d.ts +2 -2
  294. package/types/constant/types.d.ts +18 -5
  295. package/types/dictionary/DictionaryLookup.d.ts +14 -0
  296. package/types/dictionary/agent.dictionary.d.ts +1 -0
  297. package/types/dictionary/agentTurn.dictionary.d.ts +1 -0
  298. package/types/dictionary/base.dictionary.d.ts +1 -1
  299. package/types/dictionary/dictInfo.d.ts +7 -1
  300. package/types/dictionary/dictionary.d.ts +11 -9
  301. package/types/dictionary/index.d.ts +1 -0
  302. package/types/document/dataLoader.d.ts +0 -3
  303. package/types/document/filterMeta.d.ts +26 -6
  304. package/types/document/index.d.ts +1 -0
  305. package/types/document/loaderInfo.d.ts +2 -2
  306. package/types/document/noDocumentError.d.ts +12 -0
  307. package/types/document/types.d.ts +0 -1
  308. package/types/fetch/agentTurn.d.ts +475 -0
  309. package/types/fetch/client/fetchClient.d.ts +12 -0
  310. package/types/fetch/client/fetchHandle.d.ts +24 -0
  311. package/types/fetch/client/httpClient.d.ts +10 -4
  312. package/types/fetch/client/sliceInitHandle.d.ts +29 -0
  313. package/types/fetch/fetchType/appliedReturn.type.d.ts +71 -15
  314. package/types/fetch/fetchType/endpointFetch.type.d.ts +8 -5
  315. package/types/fetch/fetchType/sliceFetch.type.d.ts +14 -18
  316. package/types/fetch/index.d.ts +1 -0
  317. package/types/fetch/requestStorage.d.ts +14 -0
  318. package/types/index.d.ts +124 -12
  319. package/types/server/akanApp.d.ts +12 -0
  320. package/types/server/akanAppHeaders.d.ts +7 -1
  321. package/types/server/akanOption.d.ts +43 -6
  322. package/types/server/akanServer.d.ts +67 -9
  323. package/types/server/animatedImage.d.ts +7 -0
  324. package/types/server/assetEncoding.d.ts +1 -1
  325. package/types/server/binaryPubsub.d.ts +18 -0
  326. package/types/server/console.d.ts +11 -1
  327. package/types/server/consoleEvaluator.d.ts +2 -0
  328. package/types/server/consolePasteFilter.d.ts +11 -0
  329. package/types/server/consoleSession.d.ts +22 -0
  330. package/types/server/contentEncoding.d.ts +28 -0
  331. package/types/server/decorators.d.ts +12 -2
  332. package/types/server/devtools/types.d.ts +4 -4
  333. package/types/server/di/diLifecycle.d.ts +19 -3
  334. package/types/server/di/predefinedAdaptor.d.ts +4 -1
  335. package/types/server/di/utils.d.ts +16 -0
  336. package/types/server/lifecycle/runtimeDir.d.ts +5 -0
  337. package/types/server/lifecycle/shutdownManager.d.ts +2 -1
  338. package/types/server/logging/childOutputReader.d.ts +40 -0
  339. package/types/server/logging/hubFileSink.d.ts +18 -0
  340. package/types/server/logging/logControlSocket.d.ts +60 -0
  341. package/types/server/logging/logForwarder.d.ts +37 -0
  342. package/types/server/logging/logHub.d.ts +70 -0
  343. package/types/server/logging/logQuery.d.ts +31 -0
  344. package/types/server/logging/logStdoutWriter.d.ts +35 -0
  345. package/types/server/logging/logStreamRoute.d.ts +20 -0
  346. package/types/server/logging/logTailClient.d.ts +42 -0
  347. package/types/server/mcp/McpAuth.d.ts +62 -0
  348. package/types/server/mcp/McpDispatcher.d.ts +61 -0
  349. package/types/server/mcp/McpEventStream.d.ts +17 -0
  350. package/types/server/mcp/McpExecutionContext.d.ts +44 -0
  351. package/types/server/mcp/McpRouter.d.ts +65 -0
  352. package/types/server/mcp/index.d.ts +5 -0
  353. package/types/server/mcp.d.ts +1 -0
  354. package/types/server/resolver/signal.resolver.d.ts +7 -4
  355. package/types/server/routeTreeBuilder.d.ts +1 -2
  356. package/types/server/routing/apiRouter.d.ts +2 -1
  357. package/types/server/routing/appWsData.d.ts +19 -3
  358. package/types/server/routing/eventStream.d.ts +23 -0
  359. package/types/server/routing/soloAppRoutes.d.ts +17 -0
  360. package/types/server/rscWorkerHost.d.ts +4 -1
  361. package/types/server/semaphore.d.ts +5 -0
  362. package/types/server/ssrFromRscRenderer.d.ts +14 -0
  363. package/types/server/staticPath.d.ts +17 -0
  364. package/types/server/subRouteIndexDocument.d.ts +8 -0
  365. package/types/server/systemPageDocument.d.ts +1 -0
  366. package/types/server/systemPages.d.ts +5 -0
  367. package/types/server/types.d.ts +16 -0
  368. package/types/server/vendor/akanjs-fetch.d.ts +1 -0
  369. package/types/server/webRouter.d.ts +15 -4
  370. package/types/service/adapt.d.ts +3 -3
  371. package/types/service/agent.service.d.ts +32 -0
  372. package/types/service/base.service.d.ts +4 -0
  373. package/types/service/index.d.ts +1 -0
  374. package/types/service/injectInfo.d.ts +2 -2
  375. package/types/service/ipcTypes.d.ts +12 -0
  376. package/types/service/predefinedAdaptor/compress.adaptor.d.ts +1 -1
  377. package/types/service/predefinedAdaptor/database.adaptor.d.ts +16 -402
  378. package/types/service/predefinedAdaptor/deepseekLlm.d.ts +76 -0
  379. package/types/service/predefinedAdaptor/index.d.ts +3 -0
  380. package/types/service/predefinedAdaptor/insightQuery.d.ts +50 -0
  381. package/types/service/predefinedAdaptor/llm.adaptor.d.ts +105 -0
  382. package/types/service/predefinedAdaptor/queue.adaptor.d.ts +3 -2
  383. package/types/service/predefinedAdaptor/role.adaptor.d.ts +2 -0
  384. package/types/service/predefinedAdaptor/schedule.adaptor.d.ts +10 -6
  385. package/types/service/predefinedAdaptor/solidQueue.adaptor.d.ts +6 -2
  386. package/types/service/predefinedAdaptor/solidSqlite.d.ts +2 -2
  387. package/types/service/predefinedAdaptor/sql/PendingStoreEnsures.d.ts +6 -0
  388. package/types/service/predefinedAdaptor/sql/QueryCompiler.d.ts +28 -0
  389. package/types/service/predefinedAdaptor/sql/SqlDocumentStore.d.ts +127 -0
  390. package/types/service/predefinedAdaptor/sql/UpdateCompiler.d.ts +17 -0
  391. package/types/service/predefinedAdaptor/sql/dialect/postgres.d.ts +27 -0
  392. package/types/service/predefinedAdaptor/sql/dialect/sqlite.d.ts +27 -0
  393. package/types/service/predefinedAdaptor/sql/driver/bunSqlite.d.ts +16 -0
  394. package/types/service/predefinedAdaptor/sql/driver/libsql.d.ts +17 -0
  395. package/types/service/predefinedAdaptor/sql/driver/postgres.d.ts +17 -0
  396. package/types/service/predefinedAdaptor/sql/types.d.ts +226 -0
  397. package/types/service/predefinedAdaptor/sql/values.d.ts +13 -0
  398. package/types/service/serve.d.ts +3 -3
  399. package/types/service/toolNames.d.ts +35 -0
  400. package/types/signal/CrossSiteGuard.d.ts +44 -0
  401. package/types/signal/SignalFailure.d.ts +28 -0
  402. package/types/signal/agent/AgentCatalogue.d.ts +100 -0
  403. package/types/signal/agent/index.d.ts +1 -0
  404. package/types/signal/agent.d.ts +1 -0
  405. package/types/signal/agent.signal.d.ts +24 -0
  406. package/types/signal/agentTurn.d.ts +9 -0
  407. package/types/signal/agentTurnStream.d.ts +24 -0
  408. package/types/signal/base.signal.d.ts +1 -1
  409. package/types/signal/endpointInfo.d.ts +21 -3
  410. package/types/signal/exception.d.ts +38 -54774
  411. package/types/signal/guard.d.ts +12 -0
  412. package/types/signal/guards.d.ts +23 -1
  413. package/types/signal/index.d.ts +8 -0
  414. package/types/signal/intercept.d.ts +5 -5
  415. package/types/signal/internal.d.ts +5 -1
  416. package/types/signal/internalArg.d.ts +22 -6
  417. package/types/signal/mcp/McpDocument.d.ts +84 -0
  418. package/types/signal/mcp/McpProgress.d.ts +40 -0
  419. package/types/signal/mcp/McpUriTemplate.d.ts +25 -0
  420. package/types/signal/mcp/Msg.d.ts +143 -0
  421. package/types/signal/mcp/index.d.ts +5 -0
  422. package/types/signal/mcp/mcpProtocol.d.ts +107 -0
  423. package/types/signal/mcp.d.ts +1 -0
  424. package/types/signal/middleware.d.ts +7 -7
  425. package/types/signal/openapi/openapi.d.ts +3 -3
  426. package/types/signal/schema/JsonSchemaBuilder.d.ts +51 -0
  427. package/types/signal/schema/index.d.ts +1 -0
  428. package/types/signal/schema.d.ts +1 -0
  429. package/types/signal/serializer/fetch.serializer.d.ts +7 -1
  430. package/types/signal/signalContext.d.ts +67 -8
  431. package/types/signal/slice.d.ts +42 -15
  432. package/types/signal/trace.d.ts +52 -2
  433. package/types/signal/types.d.ts +53 -4
  434. package/types/store/SliceRequest.d.ts +16 -0
  435. package/types/store/action.d.ts +7 -5
  436. package/types/store/actionTag.d.ts +21 -0
  437. package/types/store/agent/AgentBridge.d.ts +37 -0
  438. package/types/store/agent/AgentContext.d.ts +16 -0
  439. package/types/store/agent/AgentPrompts.d.ts +31 -0
  440. package/types/store/agent/ScreenReader.d.ts +29 -0
  441. package/types/store/agent/ScreenSettle.d.ts +22 -0
  442. package/types/store/agent/ScreenTarget.d.ts +34 -0
  443. package/types/store/agent/StoreCatalogue.d.ts +26 -0
  444. package/types/store/agent/StoreSurfaceSource.d.ts +30 -0
  445. package/types/store/agent/index.d.ts +11 -0
  446. package/types/store/agent/storeSurface.d.ts +14 -0
  447. package/types/store/agent/types.d.ts +15 -0
  448. package/types/store/agent.d.ts +1 -0
  449. package/types/store/agentic/AgentValue.d.ts +43 -0
  450. package/types/store/agentic/StExposeBuilder.d.ts +21 -0
  451. package/types/store/agentic/StExposeDraft.d.ts +13 -0
  452. package/types/store/agentic/StStateBuilder.d.ts +21 -0
  453. package/types/store/agentic/StStateDraft.d.ts +12 -0
  454. package/types/store/agentic/StToolBuilder.d.ts +65 -0
  455. package/types/store/agentic/StToolDraft.d.ts +13 -0
  456. package/types/store/agentic/attachAgentic.d.ts +25 -0
  457. package/types/store/agentic/formFields.d.ts +53 -0
  458. package/types/store/agentic/index.d.ts +12 -0
  459. package/types/store/agentic/useFieldTool.d.ts +22 -0
  460. package/types/store/agentic/useFormTools.d.ts +19 -0
  461. package/types/store/agentic/useRelationFieldTool.d.ts +27 -0
  462. package/types/store/agentic.d.ts +1 -0
  463. package/types/store/baseSt.d.ts +35 -39
  464. package/types/store/databaseStateNames.d.ts +25 -0
  465. package/types/store/formSetterNames.d.ts +30 -0
  466. package/types/store/index.d.ts +7 -0
  467. package/types/store/rootStore.d.ts +5 -1
  468. package/types/store/sliceRole.d.ts +25 -0
  469. package/types/store/store.d.ts +5 -1
  470. package/types/store/storeInstance.d.ts +33 -1
  471. package/types/store/storeRegistry.d.ts +5 -0
  472. package/types/store/types.d.ts +4 -0
  473. package/types/store/withSelector.d.ts +5 -4
  474. package/types/test/index.d.ts +1 -1
  475. package/types/test/registerDom.d.ts +1 -0
  476. package/types/test/signalTestRuntime.d.ts +2 -3
  477. package/types/test/testServer.d.ts +6 -4
  478. package/types/ui/Agent/Approval.d.ts +8 -0
  479. package/types/ui/Agent/Attach.d.ts +16 -0
  480. package/types/ui/Agent/Bubble.d.ts +26 -0
  481. package/types/ui/Agent/Chat.d.ts +91 -0
  482. package/types/ui/Agent/ChatCommands.d.ts +34 -0
  483. package/types/ui/Agent/Composer.d.ts +23 -0
  484. package/types/ui/Agent/Context.d.ts +13 -0
  485. package/types/ui/Agent/Dock.d.ts +17 -0
  486. package/types/ui/Agent/Guide.d.ts +9 -0
  487. package/types/ui/Agent/History.d.ts +26 -0
  488. package/types/ui/Agent/Launcher.d.ts +16 -0
  489. package/types/ui/Agent/Markdown.d.ts +19 -0
  490. package/types/ui/Agent/Menu.d.ts +18 -0
  491. package/types/ui/Agent/Mic.d.ts +8 -0
  492. package/types/ui/Agent/Question.d.ts +14 -0
  493. package/types/ui/Agent/Section.d.ts +10 -0
  494. package/types/ui/Agent/Skip.d.ts +22 -0
  495. package/types/ui/Agent/StateKey.d.ts +16 -0
  496. package/types/ui/Agent/Tool.d.ts +15 -0
  497. package/types/ui/Agent/Transcript.d.ts +13 -0
  498. package/types/ui/Agent/Zone.d.ts +48 -0
  499. package/types/ui/Agent/agentSessionOf.d.ts +27 -0
  500. package/types/ui/Agent/attachment.d.ts +34 -0
  501. package/types/ui/Agent/fetchRunner.d.ts +12 -0
  502. package/types/ui/Agent/index.d.ts +19 -0
  503. package/types/ui/Agent/index_.d.ts +1 -0
  504. package/types/ui/Agent/markdownBlocks.d.ts +35 -0
  505. package/types/ui/Agent/markdownSpans.d.ts +2 -0
  506. package/types/ui/Agent/markdownTable.d.ts +16 -0
  507. package/types/ui/Agent/sessionHistory.d.ts +14 -0
  508. package/types/ui/Agent/sessionView.d.ts +15 -0
  509. package/types/ui/Agent/tokenCount.d.ts +6 -0
  510. package/types/ui/Agent/useChatAttachments.d.ts +24 -0
  511. package/types/ui/Agent/useChatVoice.d.ts +30 -0
  512. package/types/ui/Agent/useDraftRecall.d.ts +14 -0
  513. package/types/ui/Agent/useKeyboardInset.d.ts +8 -0
  514. package/types/ui/Agent/useSlashMenu.d.ts +24 -0
  515. package/types/ui/Agent/voice.d.ts +71 -0
  516. package/types/ui/Agent.d.ts +1 -0
  517. package/types/ui/Badge.d.ts +1 -1
  518. package/types/ui/Button.d.ts +1 -1
  519. package/types/ui/Constant/Graph.d.ts +10 -0
  520. package/types/ui/Constant/index.d.ts +2 -1
  521. package/types/ui/Constant/schemaGraph.d.ts +39 -0
  522. package/types/ui/Data/Dashboard.d.ts +16 -3
  523. package/types/ui/Data/Insight.d.ts +1 -1
  524. package/types/ui/Data/ListContainer.d.ts +15 -7
  525. package/types/ui/Data/QueryMaker.d.ts +45 -3
  526. package/types/ui/Data/RefPicker.d.ts +16 -0
  527. package/types/ui/Data/dataExport.d.ts +5 -0
  528. package/types/ui/Data/dataText.d.ts +6 -0
  529. package/types/ui/Data/index.d.ts +2 -0
  530. package/types/ui/Data/index_.d.ts +1 -0
  531. package/types/ui/DatePicker.d.ts +15 -11
  532. package/types/ui/Dialog/LegacyModal.d.ts +13 -0
  533. package/types/ui/Dialog/Provider.d.ts +3 -1
  534. package/types/ui/Dialog/context.d.ts +9 -1
  535. package/types/ui/Dialog/index.d.ts +1 -0
  536. package/types/ui/DraggableList.d.ts +1 -1
  537. package/types/ui/Dropdown.d.ts +5 -1
  538. package/types/ui/Field/Choice.d.ts +52 -0
  539. package/types/ui/Field/Collection.d.ts +51 -0
  540. package/types/ui/Field/DateField.d.ts +32 -0
  541. package/types/ui/Field/Label.d.ts +9 -0
  542. package/types/ui/Field/NumberField.d.ts +43 -0
  543. package/types/ui/Field/Relation.d.ts +80 -0
  544. package/types/ui/Field/Text.d.ts +101 -0
  545. package/types/ui/Field/index.d.ts +50 -0
  546. package/types/ui/Field.d.ts +1 -411
  547. package/types/ui/Layout/BottomTab.d.ts +3 -2
  548. package/types/ui/LegacyModal.d.ts +24 -0
  549. package/types/ui/Load/Edit_Client.d.ts +3 -1
  550. package/types/ui/Load/Stream.d.ts +22 -0
  551. package/types/ui/Load/index.d.ts +2 -0
  552. package/types/ui/Loading/ProgressBar.d.ts +4 -0
  553. package/types/ui/Loading/Spin.d.ts +2 -1
  554. package/types/ui/Loading/index_.d.ts +13 -0
  555. package/types/ui/Model/AdminPanel.d.ts +15 -3
  556. package/types/ui/Model/EditModal.d.ts +1 -1
  557. package/types/ui/Model/New.d.ts +3 -1
  558. package/types/ui/Model/NewWrapper.d.ts +2 -0
  559. package/types/ui/Model/NewWrapper_Client.d.ts +2 -1
  560. package/types/ui/Pagination.d.ts +2 -2
  561. package/types/ui/Radio.d.ts +1 -1
  562. package/types/ui/RecentTime.d.ts +18 -1
  563. package/types/ui/Reference/Collapse.d.ts +11 -0
  564. package/types/ui/Reference/Panel.d.ts +29 -0
  565. package/types/ui/Reference/Segmented.d.ts +17 -0
  566. package/types/ui/Reference/Summary.d.ts +13 -0
  567. package/types/ui/Reference/Toolbar.d.ts +21 -0
  568. package/types/ui/Reference/dictText.d.ts +6 -0
  569. package/types/ui/Reference/index.d.ts +7 -0
  570. package/types/ui/Reference/style.d.ts +20 -0
  571. package/types/ui/Reference.d.ts +1 -0
  572. package/types/ui/ScreenNavigator.d.ts +3 -1
  573. package/types/ui/Signal/Arg.d.ts +7 -3
  574. package/types/ui/Signal/Doc.d.ts +4 -6
  575. package/types/ui/Signal/Object.d.ts +2 -1
  576. package/types/ui/Signal/RestApi.d.ts +2 -1
  577. package/types/ui/Signal/WebSocket.d.ts +2 -1
  578. package/types/ui/Signal/endpointEntries.d.ts +20 -0
  579. package/types/ui/Signal/style.d.ts +9 -8
  580. package/types/ui/System/Client.d.ts +1 -2
  581. package/types/ui/System/Common.d.ts +3 -4
  582. package/types/ui/System/Messages.d.ts +1 -1
  583. package/types/ui/System/Root.d.ts +4 -0
  584. package/types/ui/Tab/Provider.d.ts +3 -1
  585. package/types/ui/Tab/context.d.ts +4 -2
  586. package/types/ui/ToggleSelect.d.ts +1 -0
  587. package/types/ui/UiOverride/context.d.ts +18 -1
  588. package/types/ui/agentAttrs.d.ts +14 -0
  589. package/types/ui/index.d.ts +22 -1
  590. package/types/ui/overlayLayer.d.ts +13 -0
  591. package/types/ui/overlayPosition.d.ts +28 -0
  592. package/types/ui/recipe/badgeRecipe.d.ts +2 -2
  593. package/types/ui/recipe/buttonRecipe.d.ts +2 -2
  594. package/types/vendor/use-agentic/AgentAbort.d.ts +17 -0
  595. package/types/vendor/use-agentic/AgentProgress.d.ts +27 -0
  596. package/types/vendor/use-agentic/AgentProvider.d.ts +17 -0
  597. package/types/vendor/use-agentic/AgentScope.d.ts +9 -0
  598. package/types/vendor/use-agentic/AgentSession.d.ts +163 -0
  599. package/types/vendor/use-agentic/Agentic.d.ts +21 -0
  600. package/types/vendor/use-agentic/AgenticSurface.d.ts +58 -0
  601. package/types/vendor/use-agentic/Compaction.d.ts +48 -0
  602. package/types/vendor/use-agentic/ToolOutput.d.ts +21 -0
  603. package/types/vendor/use-agentic/Transcript.d.ts +18 -0
  604. package/types/vendor/use-agentic/httpRunner.d.ts +15 -0
  605. package/types/vendor/use-agentic/index.d.ts +19 -0
  606. package/types/vendor/use-agentic/sharedContext.d.ts +15 -0
  607. package/types/vendor/use-agentic/surfaceContext.d.ts +5 -0
  608. package/types/vendor/use-agentic/types.d.ts +182 -0
  609. package/types/vendor/use-agentic/useAgent.d.ts +4 -0
  610. package/types/vendor/use-agentic/useAgentGuide.d.ts +6 -0
  611. package/types/vendor/use-agentic/useAgentResource.d.ts +12 -0
  612. package/types/vendor/use-agentic/useAgentState.d.ts +16 -0
  613. package/types/vendor/use-agentic/useAgentTool.d.ts +16 -0
  614. package/types/vendor/use-agentic.d.ts +1 -0
  615. package/types/webkit/index.d.ts +4 -0
  616. package/types/webkit/useBodyScrollLock.d.ts +2 -0
  617. package/types/webkit/useCamera.d.ts +10 -1
  618. package/types/webkit/usePageTool.d.ts +19 -0
  619. package/types/webkit/usePurchase.d.ts +4 -0
  620. package/types/webkit/useScreenScope.d.ts +25 -0
  621. package/ui/Agent/Approval.tsx +32 -0
  622. package/ui/Agent/Attach.tsx +77 -0
  623. package/ui/Agent/Bubble.tsx +192 -0
  624. package/ui/Agent/Chat.tsx +525 -0
  625. package/ui/Agent/ChatCommands.ts +141 -0
  626. package/ui/Agent/Composer.tsx +94 -0
  627. package/ui/Agent/Context.tsx +49 -0
  628. package/ui/Agent/Dock.tsx +77 -0
  629. package/ui/Agent/Guide.tsx +16 -0
  630. package/ui/Agent/History.tsx +49 -0
  631. package/ui/Agent/Launcher.tsx +60 -0
  632. package/ui/Agent/Markdown.tsx +142 -0
  633. package/ui/Agent/Menu.tsx +55 -0
  634. package/ui/Agent/Mic.tsx +27 -0
  635. package/ui/Agent/Question.tsx +63 -0
  636. package/ui/Agent/Section.tsx +24 -0
  637. package/ui/Agent/Skip.tsx +30 -0
  638. package/ui/Agent/StateKey.tsx +46 -0
  639. package/ui/Agent/Tool.tsx +59 -0
  640. package/ui/Agent/Transcript.tsx +33 -0
  641. package/ui/Agent/Zone.tsx +116 -0
  642. package/ui/Agent/agentSessionOf.ts +60 -0
  643. package/ui/Agent/attachment.ts +73 -0
  644. package/ui/Agent/fetchRunner.ts +44 -0
  645. package/ui/Agent/index.ts +27 -0
  646. package/ui/Agent/index_.tsx +4 -0
  647. package/ui/Agent/markdownBlocks.ts +137 -0
  648. package/ui/Agent/markdownSpans.tsx +49 -0
  649. package/ui/Agent/markdownTable.ts +54 -0
  650. package/ui/Agent/sessionHistory.ts +62 -0
  651. package/ui/Agent/sessionView.ts +38 -0
  652. package/ui/Agent/tokenCount.ts +10 -0
  653. package/ui/Agent/useChatAttachments.ts +84 -0
  654. package/ui/Agent/useChatVoice.ts +129 -0
  655. package/ui/Agent/useDraftRecall.ts +42 -0
  656. package/ui/Agent/useKeyboardInset.ts +26 -0
  657. package/ui/Agent/useSlashMenu.ts +58 -0
  658. package/ui/Agent/voice.ts +177 -0
  659. package/ui/Badge.tsx +1 -1
  660. package/ui/BottomSheet.tsx +32 -36
  661. package/ui/Button.tsx +3 -1
  662. package/ui/Clipboard.tsx +3 -6
  663. package/ui/Constant/Doc.tsx +265 -254
  664. package/ui/Constant/Graph.tsx +151 -0
  665. package/ui/Constant/index.ts +3 -2
  666. package/ui/Constant/schemaGraph.ts +232 -0
  667. package/ui/Data/CardList.tsx +14 -3
  668. package/ui/Data/Dashboard.tsx +70 -52
  669. package/ui/Data/Insight.tsx +18 -12
  670. package/ui/Data/Item.tsx +42 -56
  671. package/ui/Data/ListContainer.tsx +246 -132
  672. package/ui/Data/Pagination.tsx +10 -3
  673. package/ui/Data/QueryMaker.tsx +160 -11
  674. package/ui/Data/RefPicker.tsx +202 -0
  675. package/ui/Data/TableList.tsx +22 -13
  676. package/ui/Data/dataExport.ts +54 -0
  677. package/ui/Data/dataText.ts +22 -0
  678. package/ui/Data/index.ts +13 -1
  679. package/ui/Data/index_.tsx +1 -0
  680. package/ui/DatePicker.tsx +110 -128
  681. package/ui/Dialog/Close.tsx +3 -7
  682. package/ui/Dialog/LegacyModal.tsx +241 -0
  683. package/ui/Dialog/Modal.tsx +62 -195
  684. package/ui/Dialog/Provider.tsx +47 -3
  685. package/ui/Dialog/Trigger.tsx +3 -7
  686. package/ui/Dialog/context.ts +14 -2
  687. package/ui/Dialog/index.tsx +2 -0
  688. package/ui/DragAction.tsx +3 -2
  689. package/ui/DraggableList.tsx +10 -6
  690. package/ui/Dropdown.tsx +89 -27
  691. package/ui/Empty.tsx +6 -4
  692. package/ui/Field/Choice.tsx +172 -0
  693. package/ui/Field/Collection.tsx +293 -0
  694. package/ui/Field/DateField.tsx +138 -0
  695. package/ui/Field/Label.tsx +31 -0
  696. package/ui/Field/NumberField.tsx +169 -0
  697. package/ui/Field/Relation.tsx +387 -0
  698. package/ui/Field/Text.tsx +360 -0
  699. package/ui/Field/index.tsx +70 -0
  700. package/ui/Input.tsx +30 -8
  701. package/ui/KeyboardAvoiding.tsx +2 -2
  702. package/ui/Layout/BottomTab.tsx +32 -37
  703. package/ui/Layout/Sider.tsx +37 -14
  704. package/ui/LegacyModal.tsx +53 -0
  705. package/ui/Link/CsrLink.tsx +1 -1
  706. package/ui/Load/Edit.tsx +2 -2
  707. package/ui/Load/Edit_Client.tsx +11 -3
  708. package/ui/Load/Pagination.tsx +35 -28
  709. package/ui/Load/Stream.tsx +38 -0
  710. package/ui/Load/Units.tsx +76 -40
  711. package/ui/Load/View.tsx +34 -19
  712. package/ui/Load/index.ts +2 -0
  713. package/ui/Loading/Area.tsx +7 -6
  714. package/ui/Loading/Button.tsx +7 -9
  715. package/ui/Loading/Input.tsx +7 -9
  716. package/ui/Loading/ProgressBar.tsx +16 -7
  717. package/ui/Loading/Skeleton.tsx +8 -13
  718. package/ui/Loading/Spin.tsx +20 -14
  719. package/ui/Loading/index.ts +15 -0
  720. package/ui/Loading/index_.tsx +22 -0
  721. package/ui/Menu.tsx +1 -1
  722. package/ui/Model/AdminPanel.tsx +52 -12
  723. package/ui/Model/EditModal.tsx +35 -13
  724. package/ui/Model/EditWrapper.tsx +16 -4
  725. package/ui/Model/New.tsx +4 -0
  726. package/ui/Model/NewWrapper.tsx +2 -0
  727. package/ui/Model/NewWrapper_Client.tsx +20 -6
  728. package/ui/Model/Remove.tsx +18 -6
  729. package/ui/Model/RemoveWrapper.tsx +12 -2
  730. package/ui/Model/SureToRemove.tsx +18 -6
  731. package/ui/Model/ViewEditModal.tsx +64 -15
  732. package/ui/Model/ViewModal.tsx +25 -11
  733. package/ui/Model/ViewWrapper.tsx +15 -4
  734. package/ui/Model/index_.tsx +1 -1
  735. package/ui/Pagination.tsx +51 -66
  736. package/ui/Popconfirm.tsx +88 -78
  737. package/ui/Radio.tsx +53 -24
  738. package/ui/RecentTime.tsx +83 -35
  739. package/ui/Reference/Collapse.tsx +26 -0
  740. package/ui/Reference/Panel.tsx +79 -0
  741. package/ui/Reference/Segmented.tsx +41 -0
  742. package/ui/Reference/Summary.tsx +25 -0
  743. package/ui/Reference/Toolbar.tsx +44 -0
  744. package/ui/Reference/dictText.ts +9 -0
  745. package/ui/Reference/index.ts +7 -0
  746. package/ui/Reference/style.ts +45 -0
  747. package/ui/ScreenNavigator.tsx +17 -2
  748. package/ui/Select.tsx +96 -57
  749. package/ui/Signal/Arg.tsx +83 -68
  750. package/ui/Signal/Doc.tsx +163 -129
  751. package/ui/Signal/Listener.tsx +40 -29
  752. package/ui/Signal/Message.tsx +94 -142
  753. package/ui/Signal/Object.tsx +79 -57
  754. package/ui/Signal/PubSub.tsx +76 -114
  755. package/ui/Signal/Request.tsx +2 -22
  756. package/ui/Signal/Response.tsx +19 -45
  757. package/ui/Signal/RestApi.tsx +170 -200
  758. package/ui/Signal/WebSocket.tsx +29 -26
  759. package/ui/Signal/endpointEntries.ts +59 -0
  760. package/ui/Signal/makeExample.ts +10 -3
  761. package/ui/Signal/style.ts +34 -29
  762. package/ui/Switch.tsx +4 -0
  763. package/ui/System/CSR.tsx +1 -1
  764. package/ui/System/Client.tsx +31 -17
  765. package/ui/System/Common.tsx +3 -4
  766. package/ui/System/DevModeToggle.tsx +1 -1
  767. package/ui/System/Gtag.tsx +3 -3
  768. package/ui/System/Messages.tsx +52 -31
  769. package/ui/System/Reconnect.tsx +22 -56
  770. package/ui/System/Root.tsx +4 -0
  771. package/ui/System/SelectLanguage.tsx +24 -15
  772. package/ui/System/ThemeToggle.tsx +25 -13
  773. package/ui/Tab/Menu.tsx +24 -12
  774. package/ui/Tab/Menus.tsx +6 -3
  775. package/ui/Tab/Provider.tsx +30 -3
  776. package/ui/Tab/context.ts +8 -4
  777. package/ui/Table.tsx +66 -60
  778. package/ui/ToggleSelect.tsx +8 -7
  779. package/ui/Tooltip.tsx +15 -1
  780. package/ui/UiOverride/context.ts +21 -2
  781. package/ui/Unauthorized.tsx +6 -4
  782. package/ui/agentAttrs.ts +19 -0
  783. package/ui/index.ts +49 -1
  784. package/ui/overlayLayer.ts +12 -2
  785. package/ui/overlayPosition.ts +103 -0
  786. package/ui/recipe/buttonRecipe.ts +2 -2
  787. package/ui/styles.css +31 -0
  788. package/vendor/use-agentic/AgentAbort.ts +29 -0
  789. package/vendor/use-agentic/AgentProgress.ts +40 -0
  790. package/vendor/use-agentic/AgentProvider.tsx +39 -0
  791. package/vendor/use-agentic/AgentScope.tsx +20 -0
  792. package/vendor/use-agentic/AgentSession.ts +750 -0
  793. package/vendor/use-agentic/Agentic.tsx +44 -0
  794. package/vendor/use-agentic/AgenticSurface.ts +333 -0
  795. package/vendor/use-agentic/Compaction.ts +120 -0
  796. package/vendor/use-agentic/ToolOutput.ts +60 -0
  797. package/vendor/use-agentic/Transcript.ts +50 -0
  798. package/vendor/use-agentic/WIRE.md +86 -0
  799. package/vendor/use-agentic/httpRunner.ts +131 -0
  800. package/vendor/use-agentic/index.ts +20 -0
  801. package/vendor/use-agentic/sharedContext.ts +25 -0
  802. package/vendor/use-agentic/surfaceContext.ts +10 -0
  803. package/vendor/use-agentic/types.ts +192 -0
  804. package/vendor/use-agentic/useAgent.ts +18 -0
  805. package/vendor/use-agentic/useAgentGuide.ts +16 -0
  806. package/vendor/use-agentic/useAgentResource.ts +36 -0
  807. package/vendor/use-agentic/useAgentState.ts +64 -0
  808. package/vendor/use-agentic/useAgentTool.ts +55 -0
  809. package/webkit/bootCsr.tsx +10 -8
  810. package/webkit/index.ts +4 -0
  811. package/webkit/lazy.tsx +5 -1
  812. package/webkit/useBodyScrollLock.tsx +29 -0
  813. package/webkit/useCamera.tsx +22 -6
  814. package/webkit/useCodepush.tsx +2 -2
  815. package/webkit/useCsrValues.ts +1 -3
  816. package/webkit/useFetch.ts +4 -3
  817. package/webkit/useFrameRuntime.ts +15 -8
  818. package/webkit/usePageTool.tsx +37 -0
  819. package/webkit/usePurchase.tsx +4 -1
  820. package/webkit/useScreenScope.tsx +60 -0
  821. package/fetch/serializer/fetch.serializer.ts +0 -142
  822. package/fetch/serializer/index.ts +0 -1
  823. package/types/common/httpClient.d.ts +0 -20
  824. package/types/fetch/serializer/fetch.serializer.d.ts +0 -14
  825. package/types/fetch/serializer/index.d.ts +0 -1
  826. package/types/fetch/serializer.d.ts +0 -1
  827. package/types/ui/Constant/Mermaid.d.ts +0 -8
  828. package/types/ui/Signal/Collapse.d.ts +0 -12
  829. package/ui/Constant/Mermaid.tsx +0 -149
  830. package/ui/Field.tsx +0 -1569
  831. package/ui/Loading/index.tsx +0 -22
  832. package/ui/Signal/Collapse.tsx +0 -29
@@ -0,0 +1,62 @@
1
+ import { type Dayjs, dayjs } from "akanjs/base";
2
+
3
+ /**
4
+ * A Date field stores a native `Date` under a per-key symbol and builds the `Dayjs` its type promises on first
5
+ * read, memoized by that `Date`. A dayjs instance is ~300 bytes and eight getter calls at construction; a `Date`
6
+ * is 40 bytes. A listing carries every row's dates and reads a handful of them, so this is most of what a
7
+ * hydrated list used to cost — see `crystalize`.
8
+ *
9
+ * The slot is a function of the key, not the class (`Symbol.for`): `applyMixins` copies a light model's accessors
10
+ * onto the full model's prototype, so an accessor and the `set()` that fills its slot must agree on the slot
11
+ * whichever class defined either one.
12
+ */
13
+ const slotByKey = new Map<string, symbol>();
14
+ export const dateSlotOf = (key: string): symbol => {
15
+ const cached = slotByKey.get(key);
16
+ if (cached) return cached;
17
+ const slot = Symbol.for(`akan.date.${key}`);
18
+ slotByKey.set(key, slot);
19
+ return slot;
20
+ };
21
+
22
+ const dayjsByDate = new WeakMap<Date, Dayjs>();
23
+ const lazyDayjsOf = (date: Date): Dayjs => {
24
+ const cached = dayjsByDate.get(date);
25
+ if (cached) return cached;
26
+ const value = dayjs(date);
27
+ dayjsByDate.set(date, value);
28
+ return value;
29
+ };
30
+
31
+ /** A caller's own `Date` is copied: the slot must not alias an object the caller can still mutate. */
32
+ export const toDateValue = (value: unknown): Date | null | undefined => {
33
+ if (value === null || value === undefined) return value;
34
+ if (value instanceof Date) return new Date(value.getTime());
35
+ if (dayjs.isDayjs(value)) return value.toDate();
36
+ return new Date(value as string | number);
37
+ };
38
+
39
+ type DateSlotHolder = Record<symbol, Date | null | undefined>;
40
+
41
+ /**
42
+ * Enumerable so `for...in` — `plainFieldsOf`, `immerify`, `deepObjectify` — still sees the field. immer calls a
43
+ * prototype setter with the draft as `this`, so a write through the accessor stays copy-on-write, and the getter
44
+ * writes nothing, so a read never marks a draft modified.
45
+ */
46
+ export const dateAccessorOf = (key: string): PropertyDescriptor => {
47
+ const slot = dateSlotOf(key);
48
+ return {
49
+ enumerable: true,
50
+ configurable: true,
51
+ get(this: DateSlotHolder) {
52
+ const date = this[slot];
53
+ return date === null || date === undefined ? date : lazyDayjsOf(date);
54
+ },
55
+ set(this: DateSlotHolder, value: unknown) {
56
+ this[slot] = toDateValue(value);
57
+ },
58
+ };
59
+ };
60
+
61
+ export const isDateSlotField = (props: { modelRef: unknown; isArray: boolean; isMap: boolean }): boolean =>
62
+ props.modelRef === Date && !props.isArray && !props.isMap;
@@ -1,6 +1,6 @@
1
1
  import { Any, applyFnToArrayObjects, type Cls, FIELD_META, PrimitiveRegistry, type PrimitiveScalar } from "akanjs/base";
2
2
 
3
- import { type ConstantCls, type ConstantModelRef, ConstantRegistry, type FieldProps } from ".";
3
+ import { type ConstantCls, type ConstantModelRef, ConstantRegistry, type FieldProps, withSharedInstances } from ".";
4
4
 
5
5
  const getDeserializeFn = (inputRef: ConstantModelRef | PrimitiveScalar) => {
6
6
  const deserializeFn = PrimitiveRegistry.has(inputRef as Cls)
@@ -66,5 +66,6 @@ export const deserialize = (
66
66
  if (nullable && (value === null || value === undefined)) return null;
67
67
  else if (!nullable && (value === null || value === undefined) && argRef !== Any)
68
68
  throw new Error(`Invalid Value (Nullable) in ${key} ${argRef} for value ${value}`);
69
- return deserializeInput(value, argRef, arrDepth, convertFn) as object[];
69
+
70
+ return withSharedInstances(() => deserializeInput(value, argRef, arrDepth, convertFn)) as object[];
70
71
  };
@@ -106,6 +106,13 @@ export interface ConstantFieldProps<
106
106
  validate?: (value: FieldValue, model: any) => boolean;
107
107
  text?: TextFieldRole;
108
108
  cascade?: CascadeAction;
109
+ /**
110
+ * Renders on the page, never reaches an agent. Stripped wherever a value is masked for an AI caller — the
111
+ * in-page agent's reads and every MCP result — and left untouched everywhere else, so a `File`'s blur
112
+ * placeholder still ships to `<Image>`. Unlike `hidden`/`secret` this is about cost, not secrecy: a field
113
+ * nothing can answer a question with is pure spend on every turn it rides.
114
+ */
115
+ visual?: boolean;
109
116
  meta?: Metadata;
110
117
  }
111
118
  export const fieldPresets = ["email", "password", "url"] as const;
@@ -197,6 +204,7 @@ interface ConstantFieldBuildProps<
197
204
  validate?: (value: FieldValue, model: any) => boolean;
198
205
  text?: TextFieldRole;
199
206
  cascade?: CascadeAction;
207
+ visual: boolean;
200
208
  modelRef: ConstantModelRef;
201
209
  arrDepth: number;
202
210
  optArrDepth: number;
@@ -321,6 +329,7 @@ export class ConstantField<
321
329
  readonly validate?: (value: FieldValue, model: any) => boolean;
322
330
  readonly text?: TextFieldRole;
323
331
  readonly cascade?: CascadeAction;
332
+ readonly visual: boolean;
324
333
  readonly modelRef: ConstantModelRef;
325
334
  readonly arrDepth: number;
326
335
  readonly optArrDepth: number;
@@ -353,6 +362,7 @@ export class ConstantField<
353
362
  this.validate = props.validate;
354
363
  this.text = props.text;
355
364
  this.cascade = props.cascade;
365
+ this.visual = props.visual;
356
366
  this.modelRef = props.modelRef;
357
367
  this.arrDepth = props.arrDepth;
358
368
  this.optArrDepth = props.optArrDepth;
@@ -432,6 +442,7 @@ export class ConstantField<
432
442
  validate: option.validate,
433
443
  text: option.text,
434
444
  cascade: option.cascade,
445
+ visual: option.visual ?? false,
435
446
  modelRef,
436
447
  arrDepth: arrDepth,
437
448
  optArrDepth: optArrDepth,
@@ -478,6 +489,7 @@ export class ConstantField<
478
489
  validate: this.validate,
479
490
  text: this.text,
480
491
  cascade: this.cascade,
492
+ visual: this.visual,
481
493
  modelRef: this.modelRef,
482
494
  arrDepth: this.arrDepth,
483
495
  optArrDepth: this.optArrDepth,
@@ -493,6 +505,14 @@ export interface FieldObject {
493
505
  [key: string]: ConstantField;
494
506
  }
495
507
 
508
+ /**
509
+ * `text` names a column in the plaintext search mirror, so a masked field carrying one would publish what it
510
+ * masks through search — the class build refuses it (`TextFieldPaths`). Removing the key from the option type
511
+ * moves that refusal to the call site, where the fix is obvious. Distributive because `FieldOption` is a union:
512
+ * a plain `Omit` over it would collapse to the keys the members share.
513
+ */
514
+ type WithoutTextRole<Option> = Option extends unknown ? Omit<Option, "text"> : never;
515
+
496
516
  type FieldOption<
497
517
  Value extends ConstantFieldTypeInput,
498
518
  MapValue = Value extends MapConstructor ? typeof PrimitiveScalar : never,
@@ -530,13 +550,33 @@ export const field = <
530
550
  fieldType: "property",
531
551
  });
532
552
 
533
- field.hidden = <
553
+ /**
554
+ * A stored property the page renders and an agent never sees — `field(value, { visual: true })`, spelled short
555
+ * because the reason to reach for it is always the same one. A blur placeholder, a rendered HTML body, a
556
+ * serialized geometry: real data the screen needs, and hundreds of tokens per record that no question is answered
557
+ * from. It stays a plain `property` everywhere else, so persistence, search, forms and the page response are
558
+ * untouched.
559
+ */
560
+ field.visual = <
534
561
  ExplicitType,
535
562
  Value extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>,
536
563
  MapValue = Value extends MapConstructor ? typeof PrimitiveScalar : never,
537
564
  >(
538
565
  value: Value,
539
566
  option: FieldOption<Value, MapValue> = {},
567
+ ) =>
568
+ new FieldInfo<"property", Value, ExplicitType, MapValue>(value, {
569
+ ...option,
570
+ fieldType: "property",
571
+ visual: true,
572
+ });
573
+ field.hidden = <
574
+ ExplicitType,
575
+ Value extends ConstantFieldTypeInput = PlainTypeToFieldType<ExplicitType>,
576
+ MapValue = Value extends MapConstructor ? typeof PrimitiveScalar : never,
577
+ >(
578
+ value: Value,
579
+ option: WithoutTextRole<FieldOption<Value, MapValue>> = {},
540
580
  ) =>
541
581
  new FieldInfo<"hidden", Value, ExplicitType, MapValue>(value, {
542
582
  ...option,
@@ -549,7 +589,7 @@ field.secret = <
549
589
  MapValue = Value extends MapConstructor ? typeof PrimitiveScalar : never,
550
590
  >(
551
591
  value: Value,
552
- option: FieldOption<Value, MapValue> = {},
592
+ option: WithoutTextRole<FieldOption<Value, MapValue>> = {},
553
593
  ) =>
554
594
  new FieldInfo<"secret", Value | null, ExplicitType | null, MapValue>(value, {
555
595
  ...option,
@@ -564,7 +604,7 @@ export const resolve = <
564
604
  MapValue = Value extends MapConstructor ? typeof PrimitiveScalar : never,
565
605
  >(
566
606
  value: Value,
567
- option: FieldOption<Value, MapValue> = {},
607
+ option: WithoutTextRole<FieldOption<Value, MapValue>> = {},
568
608
  ) =>
569
609
  new FieldInfo<"resolve", Value, ExplicitType, MapValue>(value, {
570
610
  ...option,
@@ -0,0 +1,35 @@
1
+ import { FIELD_META } from "akanjs/base";
2
+ import { ConstantRegistry } from "./constantRegistry";
3
+ import type { FieldObject } from "./fieldInfo";
4
+
5
+ /**
6
+ * The query a field's value stands for, declared on the field itself with `.meta(...)`. A summary counter is the
7
+ * case this exists for: `hau` is however many rows one filter returns, so the tile showing it can open that exact
8
+ * listing without the page restating the filter beside it.
9
+ *
10
+ * The shape is read structurally rather than by class, so an app declares it with whatever builder it already has.
11
+ */
12
+ export interface FieldQueryMeta {
13
+ /** The model the query runs against. */
14
+ refName: string;
15
+ /** One of that model's declared filter keys. */
16
+ queryKey: string | null;
17
+ /** Read when the query is applied, so an arg relative to now — `() => [dayjs().subtract(1, "hour")]` — is current. */
18
+ queryArgs?: unknown[] | (() => unknown[]);
19
+ }
20
+
21
+ const isFieldQueryMeta = (meta: unknown): meta is FieldQueryMeta => {
22
+ if (!meta || typeof meta !== "object") return false;
23
+ const { refName, queryKey, queryArgs } = meta as Record<string, unknown>;
24
+ if (typeof refName !== "string" || !refName) return false;
25
+ if (queryKey !== null && typeof queryKey !== "string") return false;
26
+ return queryArgs === undefined || Array.isArray(queryArgs) || typeof queryArgs === "function";
27
+ };
28
+
29
+ /** The query one field of `refName` names, or nothing when the model, the field, or the declaration is absent. */
30
+ export const fieldQueryMetaOf = (refName: string, field: string): FieldQueryMeta | undefined => {
31
+ const cnst = ConstantRegistry.getDatabase(refName, { allowEmpty: true });
32
+ const fieldMap = cnst?.full[FIELD_META] as FieldObject | undefined;
33
+ const meta = fieldMap?.[field]?.meta;
34
+ return isFieldQueryMeta(meta) ? meta : undefined;
35
+ };
@@ -2,11 +2,11 @@ import { DEFAULT_VALUE, FIELD_META, type PrimitiveScalar } from "akanjs/base";
2
2
  import type { FieldObject } from ".";
3
3
  import type { DefaultOf } from "./types";
4
4
 
5
- interface DefaultPlan {
5
+ export interface DefaultPlan {
6
6
  /** Fields whose default is a value that can be shared: a primitive, `null`, or the field's own literal. */
7
7
  shared: Record<string, unknown>;
8
8
  /** Fields that have to be produced per call — a thunk, a fresh array, or a nested scalar record. */
9
- perCall: [key: string, make: () => unknown][];
9
+ perCall: Map<string, () => unknown>;
10
10
  }
11
11
 
12
12
  const planCache = new WeakMap<FieldObject, DefaultPlan>();
@@ -17,28 +17,33 @@ const planCache = new WeakMap<FieldObject, DefaultPlan>();
17
17
  * sharing one. Only values that were already shared before this cache existed live in `shared`.
18
18
  */
19
19
  export const getDefault = <T>(fieldObj: FieldObject): DefaultOf<T> => {
20
- let plan = planCache.get(fieldObj);
21
- if (!plan) {
22
- plan = buildPlan(fieldObj);
23
- planCache.set(fieldObj, plan);
24
- }
20
+ const plan = defaultPlanOf(fieldObj);
25
21
  const result: Record<string, unknown> = { ...plan.shared };
26
22
  for (const [key, make] of plan.perCall) result[key] = make();
27
23
  return result as DefaultOf<T>;
28
24
  };
29
25
 
26
+ /** The per-field default rules, split as above; `HydrationPlan` reads them per field so a present value skips its thunk. */
27
+ export const defaultPlanOf = (fieldObj: FieldObject): DefaultPlan => {
28
+ const cached = planCache.get(fieldObj);
29
+ if (cached) return cached;
30
+ const plan = buildPlan(fieldObj);
31
+ planCache.set(fieldObj, plan);
32
+ return plan;
33
+ };
34
+
30
35
  const buildPlan = (fieldObj: FieldObject): DefaultPlan => {
31
36
  const shared: Record<string, unknown> = {};
32
- const perCall: [string, () => unknown][] = [];
37
+ const perCall = new Map<string, () => unknown>();
33
38
  for (const [key, field] of Object.entries(fieldObj)) {
34
39
  if (field.fieldType === "hidden" || field.fieldType === "secret") shared[key] = null;
35
40
  else if (field.default !== undefined && field.default !== null) {
36
- if (typeof field.default === "function") perCall.push([key, field.default as () => unknown]);
41
+ if (typeof field.default === "function") perCall.set(key, field.default as () => unknown);
37
42
  else shared[key] = field.default as object;
38
- } else if (field.isArray) perCall.push([key, () => []]);
43
+ } else if (field.isArray) perCall.set(key, () => []);
39
44
  else if (field.nullable) shared[key] = null;
40
45
  else if (field.isClass) {
41
- if (field.isScalar) perCall.push([key, () => getDefault(field.modelRef[FIELD_META])]);
46
+ if (field.isScalar) perCall.set(key, () => getDefault(field.modelRef[FIELD_META]));
42
47
  else shared[key] = null;
43
48
  } else shared[key] = (field.modelRef as unknown as typeof PrimitiveScalar)[DEFAULT_VALUE];
44
49
  }
@@ -0,0 +1,72 @@
1
+ import { FIELD_META } from "akanjs/base";
2
+
3
+ import { type Converter, converterOf } from "./crystalize";
4
+ import { dateSlotOf, isDateSlotField, toDateValue } from "./dateSlot";
5
+ import type { FieldObject } from "./fieldInfo";
6
+ import { defaultPlanOf } from "./getDefault";
7
+
8
+ interface PlanEntry {
9
+ key: string;
10
+ /** The own property the value lands on: the key itself, or a Date field's slot symbol. */
11
+ target: string | symbol;
12
+ convert: Converter;
13
+ makeDefault: () => unknown;
14
+ }
15
+ type PlanTarget = Record<string | symbol, unknown>;
16
+ interface PlanOwner {
17
+ [FIELD_META]: FieldObject;
18
+ }
19
+
20
+ /**
21
+ * One hydration plan per model class, compiled from `FIELD_META` on the first instance. Reading the field map,
22
+ * resolving `getProps()` and dispatching on the field kind used to happen per field per instance, and was most of
23
+ * what a listing paid after the dayjs objects — a plan turns a row into a plain loop over precomputed converters.
24
+ *
25
+ * Cached per class rather than per field map because `fullModelOf` extends a lib model's `FIELD_META` in place;
26
+ * `applyConstantStatics` resets the entry whenever it finishes wiring a class.
27
+ */
28
+ export class HydrationPlan {
29
+ static #byClass = new WeakMap<object, HydrationPlan>();
30
+ static of(cls: PlanOwner): HydrationPlan {
31
+ const cached = HydrationPlan.#byClass.get(cls);
32
+ if (cached) return cached;
33
+ const plan = new HydrationPlan(cls[FIELD_META]);
34
+ HydrationPlan.#byClass.set(cls, plan);
35
+ return plan;
36
+ }
37
+ static reset(cls: object) {
38
+ HydrationPlan.#byClass.delete(cls);
39
+ }
40
+
41
+ #entries: PlanEntry[];
42
+ constructor(fieldObj: FieldObject) {
43
+ const defaults = defaultPlanOf(fieldObj);
44
+ this.#entries = Object.entries(fieldObj).map(([key, field]) => {
45
+ const props = field.getProps();
46
+ const isDateSlot = isDateSlotField(props);
47
+ const convert: Converter = isDateSlot ? toDateValue : converterOf(props);
48
+ const perCall = defaults.perCall.get(key);
49
+ const rawDefault = perCall ?? (() => defaults.shared[key]);
50
+
51
+ return { key, target: isDateSlot ? dateSlotOf(key) : key, convert, makeDefault: () => convert(rawDefault()) };
52
+ });
53
+ }
54
+
55
+ /** Fills every field: the value when the source carries one, the field's default otherwise. */
56
+ construct(instance: object, source?: Record<string, unknown> | null) {
57
+ const target = instance as PlanTarget;
58
+ for (const entry of this.#entries) {
59
+ const value = source === undefined || source === null ? undefined : source[entry.key];
60
+ target[entry.target] = value === undefined ? entry.makeDefault() : entry.convert(value);
61
+ }
62
+ }
63
+
64
+ /** Overwrites only the fields the source names; `in` rather than own keys, so another instance's accessors count. */
65
+ assign(instance: object, source: Record<string, unknown>) {
66
+ const target = instance as PlanTarget;
67
+ for (const entry of this.#entries) {
68
+ if (!(entry.key in source)) continue;
69
+ target[entry.target] = entry.convert(source[entry.key]);
70
+ }
71
+ }
72
+ }
@@ -1,16 +1,14 @@
1
1
  import { FIELD_META } from "akanjs/base";
2
+ import { plainFieldsOf } from "akanjs/common";
2
3
  import { immerable } from "immer";
3
4
  import type { ConstantModelRef } from ".";
4
5
 
5
6
  export const immerify = <T extends object>(modelRef: ConstantModelRef, objOrArr: T): T => {
6
7
  if (Array.isArray(objOrArr)) return objOrArr.map((val) => immerify(modelRef, val as object)) as T;
7
- const immeredObj = Object.assign({}, objOrArr, {
8
- [immerable]: true,
9
- }) as Record<string, unknown>;
10
- const objRecord = objOrArr as Record<string, unknown>;
8
+ const immeredObj = Object.assign(plainFieldsOf(objOrArr), { [immerable]: true }) as Record<string, unknown>;
11
9
  Object.entries(modelRef[FIELD_META]).forEach(([key, field]) => {
12
- if (field.isScalar && field.isClass && !!objRecord[key])
13
- immeredObj[key] = immerify(field.modelRef, objRecord[key] as object);
10
+ if (field.isScalar && field.isClass && immeredObj[key])
11
+ immeredObj[key] = immerify(field.modelRef, immeredObj[key] as object);
14
12
  });
15
13
  return immeredObj as T;
16
14
  };
package/constant/index.ts CHANGED
@@ -1,10 +1,15 @@
1
1
  export * from "./cascadePaths";
2
2
  export * from "./constantRegistry";
3
3
  export * from "./crystalize";
4
+ export * from "./dateSlot";
4
5
  export * from "./deserialize";
5
6
  export * from "./fieldInfo";
7
+ export * from "./fieldQueryMeta";
6
8
  export * from "./getDefault";
9
+ export * from "./hydrationPlan";
7
10
  export * from "./immerify";
11
+ export * from "./labelOf";
12
+ export * from "./mask";
8
13
  export * from "./purify";
9
14
  export * from "./serialize";
10
15
  export * from "./textFieldPathSet";
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The one line a human scans for. A model that writes its own `Light<Model>.label()` owns the answer, since
3
+ * display logic is the Light class's job; otherwise it is derived from what the model already declared — the
4
+ * `text: "title"` search role names exactly that field, so an agent-facing label costs no new declaration.
5
+ * Falls back to the conventional `title`/`name` keys; the id is the caller's floor.
6
+ */
7
+ export const labelOf = (model: unknown, value: unknown): string | undefined => {
8
+ if (!value || typeof value !== "object") return undefined;
9
+ const source = value as Record<string, unknown>;
10
+ const written = source.label;
11
+ if (typeof written === "function") {
12
+ try {
13
+ const label = (written as () => unknown).call(source);
14
+ if (typeof label === "string" && label) return label;
15
+ } catch {
16
+ }
17
+ }
18
+ const paths = (model as { text?: { title?: Iterable<string> } } | null)?.text?.title;
19
+ const titlePath = [...(paths ?? [])].find((path) => !path.includes(".") && !path.includes("["));
20
+ for (const key of [titlePath, "title", "name"]) {
21
+ if (!key) continue;
22
+ const candidate = source[key];
23
+ if (typeof candidate === "string" && candidate) return candidate;
24
+ }
25
+ return undefined;
26
+ };
@@ -0,0 +1,67 @@
1
+ import { FIELD_META } from "akanjs/base";
2
+
3
+ /**
4
+ * A model as masking reads it — the constructor, for the field metadata it carries at runtime.
5
+ *
6
+ * Structural rather than `ConstantModelRef` so that anything holding the class can name it, and read through
7
+ * `FIELD_META` the way `resolveReturn` reads it.
8
+ */
9
+ export interface MaskModel {
10
+ name: string;
11
+ }
12
+
13
+ /** The part of a field's metadata masking turns on. Mirrors what `resolveReturn` branches over. */
14
+ interface MaskField {
15
+ fieldType?: string;
16
+ isClass?: boolean;
17
+ modelRef?: MaskModel;
18
+ visual?: boolean;
19
+ }
20
+
21
+ export const maskFieldsOf = (model: MaskModel): Record<string, MaskField> | null => {
22
+ const fields = (model as unknown as { [key: symbol]: unknown })[FIELD_META];
23
+ return fields && typeof fields === "object" ? (fields as Record<string, MaskField>) : null;
24
+ };
25
+
26
+ /**
27
+ * The `hidden` and `secret` field names of `model` that `value` still carries populated.
28
+ *
29
+ * `visual` is deliberately not among them. A refusal here means a value must not be published at all, and a blur
30
+ * placeholder is not a secret — it is merely not worth its tokens, which masking answers by dropping it.
31
+ */
32
+ export const leakingFieldsOf = (model: MaskModel, value: Record<string, unknown>): string[] => {
33
+ const fields = maskFieldsOf(model);
34
+ if (!fields) return [];
35
+ return Object.entries(fields)
36
+ .filter(([key, field]) => (field.fieldType === "hidden" || field.fieldType === "secret") && key in value)
37
+ .map(([key]) => key);
38
+ };
39
+
40
+ /**
41
+ * Strips what a model marks `hidden`, `secret`, or `visual`, by the model the caller names rather than by the one
42
+ * the value happens to still carry. The first two are secrecy and the third is cost, but the answer is the same
43
+ * one — leave the field out — and this is the only place every AI-facing read already passes through.
44
+ *
45
+ * That distinction is the whole point. A check that reads the class off the value can only mask what arrives as an
46
+ * instance, so a `{ ...doc }` spread, a `toJSON()`, an `immerify()`, or a round-trip through `JSON.stringify` reaches
47
+ * its destination with the metadata already gone and nothing can be done about it. A named model is metadata the
48
+ * value cannot lose, so a hydrated document and a plain object copied out of one mask identically.
49
+ *
50
+ * This is the field half of `resolveReturn` and deliberately not the whole of it. That one also loads every relation
51
+ * it walks past, which is right for a query's return value and wrong here, where the value is already in hand.
52
+ *
53
+ * Returns `unknown` rather than the argument's type, because what comes back is missing fields that type promises.
54
+ */
55
+ export const mask = (model: MaskModel, value: unknown): unknown => {
56
+ if (value === null || value === undefined || typeof value !== "object") return value;
57
+ if (Array.isArray(value)) return value.map((item: unknown) => mask(model, item));
58
+ const fields = maskFieldsOf(model);
59
+ if (!fields) return value;
60
+ const source = value as Record<string, unknown>;
61
+ const masked: Record<string, unknown> = {};
62
+ for (const [key, field] of Object.entries(fields)) {
63
+ if (field.fieldType === "hidden" || field.fieldType === "secret" || field.visual || !(key in source)) continue;
64
+ masked[key] = field.isClass && field.modelRef ? mask(field.modelRef, source[key]) : source[key];
65
+ }
66
+ return masked;
67
+ };
@@ -31,18 +31,24 @@ type Purified<O> = O extends BaseObject
31
31
  : O extends object
32
32
  ? PurifiedModel<O>
33
33
  : O;
34
- type PurifiedWithObjectToId<T, StateKeys extends keyof GetStateObject<T> = keyof GetStateObject<T>> = {
35
- [K in StateKeys as null extends T[K] ? never : K]: Purified<T[K]>;
36
- } & {
37
- [K in StateKeys as null extends T[K] ? K : never]?: Purified<T[K]> | undefined;
38
- };
39
- export type PurifiedModel<T> = T extends (infer S)[]
40
- ? PurifiedModel<S>[]
41
- : T extends string | number | boolean | Dayjs | File
34
+ type PurifiedWithObjectToId<T, StateKeys extends keyof GetStateObject<T> = keyof GetStateObject<T>> =
35
+
36
+ unknown extends T
42
37
  ? T
43
- : T extends Map<infer K, infer V>
44
- ? Map<K, PurifiedModel<V>>
45
- : PurifiedWithObjectToId<T>;
38
+ : {
39
+ [K in StateKeys as null extends T[K] ? never : K]: Purified<T[K]>;
40
+ } & {
41
+ [K in StateKeys as null extends T[K] ? K : never]?: Purified<T[K]> | undefined;
42
+ };
43
+ export type PurifiedModel<T> = unknown extends T
44
+ ? T
45
+ : T extends (infer S)[]
46
+ ? PurifiedModel<S>[]
47
+ : T extends string | number | boolean | Dayjs | File
48
+ ? T
49
+ : T extends Map<infer K, infer V>
50
+ ? Map<K, PurifiedModel<V>>
51
+ : PurifiedWithObjectToId<T>;
46
52
 
47
53
  export type UploadableClientArg<T> = [T] extends [File[]] ? File[] | FileList : T;
48
54
 
@@ -34,17 +34,23 @@ export class TextFieldPaths extends TextFieldPathSet {
34
34
  }
35
35
 
36
36
  #assertReachable(path: string, parent: ConstantField) {
37
- if (parent.fieldType === "secret") throw new Error(`Text field "${path}" is under a secret field`);
38
- if (parent.fieldType === "hidden") throw new Error(`Text field "${path}" is under a hidden field`);
39
- if (parent.fieldType === "resolve") throw new Error(`Text field "${path}" is under a resolved field`);
37
+
38
+ const fix = `Drop the text role on "${path}", or leave the parent unmasked.`;
39
+ if (parent.fieldType === "secret") throw new Error(`Text field "${path}" is under a secret field. ${fix}`);
40
+ if (parent.fieldType === "hidden") throw new Error(`Text field "${path}" is under a hidden field. ${fix}`);
41
+ if (parent.fieldType === "resolve") throw new Error(`Text field "${path}" is under a resolved field. ${fix}`);
40
42
  if (parent.arrDepth > 1) throw new Error(`Text field "${path}" is under a nested array and cannot be indexed`);
41
43
  }
42
44
 
43
45
  #assertIndexable(key: string, role: TextFieldRole, field: ConstantField) {
44
-
45
- if (field.fieldType === "secret") throw new Error(`Text field "${key}" is secret and must not be indexed`);
46
- if (field.fieldType === "hidden") throw new Error(`Text field "${key}" is hidden and must not be indexed`);
47
- if (field.fieldType === "resolve") throw new Error(`Text field "${key}" is resolved and is absent from _doc`);
46
+
47
+ const masked = `The search mirror stores plaintext. Drop the text role on "${key}", or make the field plain.`;
48
+ if (field.fieldType === "secret")
49
+ throw new Error(`Text field "${key}" is secret and must not be indexed. ${masked}`);
50
+ if (field.fieldType === "hidden")
51
+ throw new Error(`Text field "${key}" is hidden and must not be indexed. ${masked}`);
52
+ if (field.fieldType === "resolve")
53
+ throw new Error(`Text field "${key}" is resolved and is absent from _doc. Drop the text role on "${key}".`);
48
54
  if (field.isMap) throw new Error(`Text field "${key}" is a Map and cannot be indexed`);
49
55
  if (field.arrDepth > 1) throw new Error(`Text field "${key}" is a nested array and cannot be indexed`);
50
56
  const modelRef = field.modelRef as unknown as Cls;
package/constant/types.ts CHANGED
@@ -14,21 +14,27 @@ type ObjectToId<O> = O extends BaseObject
14
14
  ? DocumentModel<O>
15
15
  : O;
16
16
 
17
- type Docify<T, _StateKeys extends keyof GetStateObject<T> = keyof GetStateObject<T>> = {
18
- [K in _StateKeys as null extends T[K] ? never : K]-?: ObjectToId<NonNullable<T[K]>>;
19
- } & {
20
- [K in _StateKeys as null extends T[K] ? K : never]?: ObjectToId<NonNullable<T[K]>> | undefined;
21
- };
22
- export type DocumentModel<T> = T extends (infer S)[]
23
- ? DocumentModel<S>[]
24
- : T extends string | number | boolean | Dayjs | File
25
- ? T
26
- : T extends Map<infer K, infer V>
27
- ? Map<K, DocumentModel<V>>
28
- : Docify<T>;
17
+ type Docify<T, _StateKeys extends keyof GetStateObject<T> = keyof GetStateObject<T>> = unknown extends T
18
+ ? T
19
+ : { [K in _StateKeys as null extends T[K] ? never : K]-?: ObjectToId<NonNullable<T[K]>> } & {
20
+ [K in _StateKeys as null extends T[K] ? K : never]?: ObjectToId<NonNullable<T[K]>> | undefined;
21
+ };
22
+ export type DocumentModel<T> = unknown extends T
23
+ ? T
24
+ : T extends (infer S)[]
25
+ ? DocumentModel<S>[]
26
+ : T extends string | number | boolean | Dayjs | File
27
+ ? T
28
+ : T extends Map<infer K, infer V>
29
+ ? Map<K, DocumentModel<V>>
30
+ : Docify<T>;
29
31
 
30
32
  export type FieldState<T> = T extends { id: string } ? T | null : T;
31
- export type DefaultOf<S> = GetStateObject<{ [K in keyof S]: FieldState<S[K]> }>;
33
+ export type DefaultOf<S> = {
34
+ [K in keyof S as S[K] extends (...args: never[]) => unknown ? never : K extends "prototype" ? never : K]: FieldState<
35
+ S[K]
36
+ >;
37
+ };
32
38
 
33
39
  export type DefaultOfSchema<Schema, RelationKey = never> = [RelationKey] extends [never]
34
40
  ? Schema
@@ -98,6 +104,28 @@ export interface ProtoPatch {
98
104
  }
99
105
 
100
106
  export const DEFAULT_PAGE_SIZE = 20;
107
+ /**
108
+ * The most rows one list request may take, whatever it asks for.
109
+ *
110
+ * A page size arrives from the client, so without a ceiling anyone who may read one page may read the whole
111
+ * table in a single request — and `LIMIT 0` or `LIMIT -1` reaches SQLite as "no limit at all", so the two ways
112
+ * of asking for nothing were the two ways of asking for everything. `resolvePageLimit` is the one place that
113
+ * decides; a caller wanting more pages asks for more pages.
114
+ */
115
+ export const MAX_PAGE_SIZE = 500;
116
+
117
+ /** Clamps a caller-supplied page size into `[1, MAX_PAGE_SIZE]`, falling back to `DEFAULT_PAGE_SIZE`. */
118
+ export const resolvePageLimit = (limit: unknown, fallback: number = DEFAULT_PAGE_SIZE): number => {
119
+ const asked = Math.trunc(Number(limit));
120
+ if (!Number.isFinite(asked) || asked <= 0) return Math.min(fallback, MAX_PAGE_SIZE);
121
+ return Math.min(asked, MAX_PAGE_SIZE);
122
+ };
123
+
124
+ /** Clamps an offset to a non-negative integer; a negative `OFFSET` is silently read as zero by the database. */
125
+ export const resolvePageSkip = (skip: unknown): number => {
126
+ const asked = Math.trunc(Number(skip));
127
+ return Number.isFinite(asked) && asked > 0 ? asked : 0;
128
+ };
101
129
  export type NonFunctionalKeys<T> = {
102
130
  [K in keyof T]: T[K] extends (...args: never[]) => unknown ? never : K;
103
131
  }[keyof T];