akanjs 3.0.0-alpha.7 → 3.0.0-alpha.71

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 (719) 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/csrTypes.ts +4 -3
  10. package/client/index.ts +1 -0
  11. package/client/locale.ts +2 -2
  12. package/client/router.ts +7 -7
  13. package/client/sharedContext.ts +31 -0
  14. package/client/translator.ts +2 -2
  15. package/client/types.ts +3 -3
  16. package/common/Logger.ts +280 -67
  17. package/common/clientAddress.ts +40 -0
  18. package/common/deepObjectify.ts +24 -9
  19. package/common/index.ts +42 -1
  20. package/common/logContext.ts +27 -0
  21. package/common/mcpExposure.ts +114 -0
  22. package/common/pathGetLoose.ts +31 -0
  23. package/common/pathSet.ts +17 -5
  24. package/common/plainFieldsOf.ts +13 -0
  25. package/common/routeConvention.ts +22 -12
  26. package/common/websocketBinaryFrame.ts +46 -0
  27. package/constant/crystalize.ts +94 -28
  28. package/constant/dateSlot.ts +62 -0
  29. package/constant/deserialize.ts +3 -2
  30. package/constant/fieldInfo.ts +43 -3
  31. package/constant/fieldQueryMeta.ts +35 -0
  32. package/constant/getDefault.ts +16 -11
  33. package/constant/hydrationPlan.ts +72 -0
  34. package/constant/immerify.ts +4 -6
  35. package/constant/index.ts +5 -0
  36. package/constant/labelOf.ts +26 -0
  37. package/constant/mask.ts +67 -0
  38. package/constant/purify.ts +17 -11
  39. package/constant/textFieldPaths.ts +13 -7
  40. package/constant/types.ts +19 -13
  41. package/constant/via.ts +24 -17
  42. package/dictionary/DictionaryLookup.ts +30 -0
  43. package/dictionary/agent.dictionary.ts +31 -0
  44. package/dictionary/agentTurn.dictionary.ts +29 -0
  45. package/dictionary/base.dictionary.ts +81 -0
  46. package/dictionary/dictInfo.ts +11 -2
  47. package/dictionary/dictionary.ts +9 -3
  48. package/dictionary/index.ts +1 -0
  49. package/dictionary/trans.ts +2 -2
  50. package/document/documentQuery.ts +1 -0
  51. package/document/filterMeta.ts +77 -12
  52. package/document/index.ts +1 -0
  53. package/document/noDocumentError.ts +12 -0
  54. package/document/types.ts +0 -1
  55. package/fetch/agentTurn.ts +19 -0
  56. package/fetch/client/fetchClient.ts +137 -37
  57. package/fetch/client/httpClient.ts +95 -20
  58. package/fetch/client/wsClient.ts +27 -12
  59. package/fetch/fetchType/appliedReturn.type.ts +65 -44
  60. package/fetch/fetchType/endpointFetch.type.ts +17 -8
  61. package/fetch/fetchType/sliceFetch.type.ts +27 -50
  62. package/fetch/index.ts +1 -0
  63. package/index.ts +80 -6
  64. package/local/apps/akan/akan-local.db +0 -0
  65. package/local/apps/akan/akan-local.db-shm +0 -0
  66. package/local/apps/akan/akan-local.db-wal +0 -0
  67. package/local/apps/akan/akan-local_solid.db +0 -0
  68. package/local/apps/akan/akan-local_solid.db-shm +0 -0
  69. package/local/apps/akan/akan-local_solid.db-wal +0 -0
  70. package/local/apps/serverLifecycle/serverLifecycle-local.db +0 -0
  71. package/local/apps/serverLifecycle/serverLifecycle-local.db-shm +0 -0
  72. package/local/apps/serverLifecycle/serverLifecycle-local.db-wal +0 -0
  73. package/local/apps/serverLifecycle/serverLifecycle-local_solid.db +0 -0
  74. package/local/apps/serverLifecycle/serverLifecycle-local_solid.db-shm +0 -0
  75. package/local/apps/serverLifecycle/serverLifecycle-local_solid.db-wal +0 -0
  76. package/package.json +27 -18
  77. package/server/akanApp.ts +278 -138
  78. package/server/akanAppHeaders.ts +16 -2
  79. package/server/akanOption.ts +63 -8
  80. package/server/akanServer.ts +387 -32
  81. package/server/animatedImage.ts +83 -0
  82. package/server/assetEncoding.ts +4 -24
  83. package/server/binaryPubsub.ts +55 -0
  84. package/server/console.ts +110 -101
  85. package/server/consoleEvaluator.ts +51 -0
  86. package/server/consolePasteFilter.ts +91 -0
  87. package/server/consoleSession.ts +242 -0
  88. package/server/contentEncoding.ts +83 -0
  89. package/server/devtools/signalSerializer.ts +2 -2
  90. package/server/devtools/types.ts +4 -4
  91. package/server/di/diLifecycle.ts +123 -13
  92. package/server/di/predefinedAdaptor.ts +6 -0
  93. package/server/di/utils.ts +40 -0
  94. package/server/imageOptimizer.ts +154 -57
  95. package/server/lifecycle/runtimeDir.ts +14 -0
  96. package/server/lifecycle/shutdownManager.ts +1 -1
  97. package/server/logging/childOutputReader.ts +137 -0
  98. package/server/logging/hubFileSink.ts +39 -0
  99. package/server/logging/logControlSocket.ts +173 -0
  100. package/server/logging/logForwarder.ts +131 -0
  101. package/server/logging/logHub.ts +0 -0
  102. package/server/logging/logQuery.ts +130 -0
  103. package/server/logging/logStdoutWriter.ts +39 -0
  104. package/server/logging/logStreamRoute.ts +87 -0
  105. package/server/logging/logTailClient.ts +161 -0
  106. package/server/mcp/McpAuth.ts +177 -0
  107. package/server/mcp/McpDispatcher.ts +289 -0
  108. package/server/mcp/McpEventStream.ts +24 -0
  109. package/server/mcp/McpExecutionContext.ts +105 -0
  110. package/server/mcp/McpRouter.ts +621 -0
  111. package/server/mcp/index.ts +5 -0
  112. package/server/processMetricsCollector.ts +1 -1
  113. package/server/resolver/database.resolver.ts +5 -4
  114. package/server/resolver/signal.resolver.ts +208 -86
  115. package/server/routeTreeBuilder.ts +10 -8
  116. package/server/routing/apiRouter.ts +44 -14
  117. package/server/routing/appWsData.ts +24 -2
  118. package/server/routing/eventStream.ts +93 -0
  119. package/server/routing/soloAppRoutes.ts +50 -0
  120. package/server/rscWorker.tsx +36 -22
  121. package/server/rscWorkerHost.ts +59 -8
  122. package/server/semaphore.ts +22 -0
  123. package/server/subRouteIndexDocument.tsx +61 -0
  124. package/server/systemPageDocument.tsx +3 -3
  125. package/server/systemPages.tsx +49 -16
  126. package/server/types.tsx +28 -0
  127. package/server/vendor/akanjs-fetch.ts +1 -0
  128. package/server/webRouter.ts +96 -39
  129. package/service/adapt.ts +4 -4
  130. package/service/agent.service.ts +81 -0
  131. package/service/base.service.ts +2 -1
  132. package/service/index.ts +1 -0
  133. package/service/injectInfo.ts +8 -3
  134. package/service/ipcTypes.ts +6 -0
  135. package/service/predefinedAdaptor/compress.adaptor.ts +5 -1
  136. package/service/predefinedAdaptor/database.adaptor.ts +68 -37
  137. package/service/predefinedAdaptor/deepseekLlm.ts +271 -0
  138. package/service/predefinedAdaptor/index.ts +3 -0
  139. package/service/predefinedAdaptor/insightQuery.ts +183 -0
  140. package/service/predefinedAdaptor/llm.adaptor.ts +115 -0
  141. package/service/predefinedAdaptor/logging.adaptor.ts +1 -1
  142. package/service/predefinedAdaptor/queue.adaptor.ts +5 -2
  143. package/service/predefinedAdaptor/role.adaptor.ts +2 -0
  144. package/service/predefinedAdaptor/schedule.adaptor.ts +12 -5
  145. package/service/predefinedAdaptor/solidPubsub.adaptor.ts +10 -6
  146. package/service/predefinedAdaptor/solidQueue.adaptor.ts +6 -2
  147. package/service/predefinedAdaptor/solidSqlite.ts +11 -9
  148. package/service/predefinedAdaptor/websocket.adaptor.ts +6 -1
  149. package/service/serve.ts +16 -9
  150. package/service/toolNames.ts +119 -0
  151. package/signal/agent/AgentCatalogue.ts +165 -0
  152. package/signal/agent/index.ts +1 -0
  153. package/signal/agent.signal.ts +38 -0
  154. package/signal/agentTurn.ts +8 -0
  155. package/signal/agentTurnStream.ts +60 -0
  156. package/signal/base.signal.ts +2 -1
  157. package/signal/endpointInfo.ts +38 -2
  158. package/signal/guard.ts +28 -1
  159. package/signal/guards.ts +49 -1
  160. package/signal/index.ts +6 -0
  161. package/signal/intercept.ts +4 -4
  162. package/signal/internalArg.ts +21 -4
  163. package/signal/mcp/McpDocument.ts +326 -0
  164. package/signal/mcp/McpProgress.ts +106 -0
  165. package/signal/mcp/McpUriTemplate.ts +80 -0
  166. package/signal/mcp/Msg.ts +368 -0
  167. package/signal/mcp/index.ts +5 -0
  168. package/signal/mcp/mcpProtocol.ts +120 -0
  169. package/signal/middleware.ts +3 -3
  170. package/signal/openapi/openapi.ts +36 -173
  171. package/signal/schema/JsonSchemaBuilder.ts +221 -0
  172. package/signal/schema/index.ts +1 -0
  173. package/signal/serializer/fetch.serializer.ts +51 -0
  174. package/signal/signalContext.ts +324 -76
  175. package/signal/slice.ts +62 -27
  176. package/signal/trace.ts +268 -9
  177. package/signal/types.ts +55 -4
  178. package/store/action.ts +34 -41
  179. package/store/actionTag.ts +33 -0
  180. package/store/agent/AgentBridge.ts +87 -0
  181. package/store/agent/AgentContext.ts +71 -0
  182. package/store/agent/AgentPrompts.ts +111 -0
  183. package/store/agent/ScreenReader.ts +349 -0
  184. package/store/agent/ScreenSettle.ts +45 -0
  185. package/store/agent/ScreenTarget.ts +135 -0
  186. package/store/agent/StoreCatalogue.ts +116 -0
  187. package/store/agent/StoreSurfaceSource.ts +225 -0
  188. package/store/agent/index.ts +13 -0
  189. package/store/agent/storeSurface.ts +28 -0
  190. package/store/agent/types.ts +16 -0
  191. package/store/agentic/AgentValue.ts +119 -0
  192. package/store/agentic/StExposeBuilder.ts +47 -0
  193. package/store/agentic/StExposeDraft.ts +24 -0
  194. package/store/agentic/StStateBuilder.ts +85 -0
  195. package/store/agentic/StStateDraft.ts +23 -0
  196. package/store/agentic/StToolBuilder.ts +279 -0
  197. package/store/agentic/StToolDraft.ts +22 -0
  198. package/store/agentic/attachAgentic.ts +33 -0
  199. package/store/agentic/formFields.ts +194 -0
  200. package/store/agentic/index.ts +12 -0
  201. package/store/agentic/useFieldTool.ts +183 -0
  202. package/store/agentic/useFormTools.ts +77 -0
  203. package/store/agentic/useRelationFieldTool.ts +113 -0
  204. package/store/baseSt.ts +1 -1
  205. package/store/databaseStateNames.ts +31 -0
  206. package/store/formSetterNames.ts +35 -0
  207. package/store/index.ts +8 -0
  208. package/store/rootStore.ts +3 -1
  209. package/store/sliceRole.ts +36 -0
  210. package/store/state.ts +2 -12
  211. package/store/store.ts +9 -0
  212. package/store/storeInstance.ts +185 -20
  213. package/store/storeRegistry.ts +39 -1
  214. package/store/types.ts +5 -0
  215. package/store/withSelector.ts +5 -4
  216. package/test/index.ts +1 -1
  217. package/test/registerDom.ts +4 -0
  218. package/test/sampleOf.ts +2 -0
  219. package/test/signalTestRuntime.ts +5 -5
  220. package/test/testServer.ts +14 -11
  221. package/types/base/baseEnv.d.ts +1 -1
  222. package/types/base/primitiveRegistry.d.ts +20 -8
  223. package/types/base/symbols.d.ts +4 -0
  224. package/types/client/capacitor.d.ts +39 -0
  225. package/types/client/clientRuntime.d.ts +7 -0
  226. package/types/client/index.d.ts +1 -0
  227. package/types/client/sharedContext.d.ts +21 -0
  228. package/types/client/types.d.ts +5 -3
  229. package/types/common/Logger.d.ts +88 -6
  230. package/types/common/clientAddress.d.ts +19 -0
  231. package/types/common/deepObjectify.d.ts +4 -2
  232. package/types/common/index.d.ts +8 -2
  233. package/types/common/logContext.d.ts +17 -0
  234. package/types/common/mcpExposure.d.ts +64 -0
  235. package/types/common/pathGetLoose.d.ts +8 -0
  236. package/types/common/plainFieldsOf.d.ts +6 -0
  237. package/types/common/routeConvention.d.ts +6 -0
  238. package/types/common/websocketBinaryFrame.d.ts +17 -0
  239. package/types/constant/constantRegistry.d.ts +2 -10
  240. package/types/constant/crystalize.d.ts +5 -0
  241. package/types/constant/dateSlot.d.ts +14 -0
  242. package/types/constant/fieldInfo.d.ts +20 -3
  243. package/types/constant/fieldQueryMeta.d.ts +17 -0
  244. package/types/constant/getDefault.d.ts +8 -0
  245. package/types/constant/hydrationPlan.d.ts +24 -0
  246. package/types/constant/index.d.ts +5 -0
  247. package/types/constant/labelOf.d.ts +7 -0
  248. package/types/constant/mask.d.ts +41 -0
  249. package/types/constant/purify.d.ts +2 -2
  250. package/types/constant/types.d.ts +5 -5
  251. package/types/dictionary/DictionaryLookup.d.ts +14 -0
  252. package/types/dictionary/agent.dictionary.d.ts +1 -0
  253. package/types/dictionary/agentTurn.dictionary.d.ts +1 -0
  254. package/types/dictionary/base.dictionary.d.ts +1 -1
  255. package/types/dictionary/dictInfo.d.ts +7 -1
  256. package/types/dictionary/dictionary.d.ts +11 -9
  257. package/types/dictionary/index.d.ts +1 -0
  258. package/types/document/filterMeta.d.ts +24 -4
  259. package/types/document/index.d.ts +1 -0
  260. package/types/document/noDocumentError.d.ts +12 -0
  261. package/types/document/types.d.ts +0 -1
  262. package/types/fetch/agentTurn.d.ts +475 -0
  263. package/types/fetch/client/fetchClient.d.ts +12 -0
  264. package/types/fetch/client/httpClient.d.ts +2 -1
  265. package/types/fetch/fetchType/appliedReturn.type.d.ts +37 -18
  266. package/types/fetch/fetchType/endpointFetch.type.d.ts +8 -5
  267. package/types/fetch/fetchType/sliceFetch.type.d.ts +11 -15
  268. package/types/fetch/index.d.ts +1 -0
  269. package/types/index.d.ts +74 -10
  270. package/types/server/akanApp.d.ts +12 -0
  271. package/types/server/akanAppHeaders.d.ts +7 -1
  272. package/types/server/akanOption.d.ts +36 -6
  273. package/types/server/akanServer.d.ts +67 -9
  274. package/types/server/animatedImage.d.ts +7 -0
  275. package/types/server/assetEncoding.d.ts +1 -1
  276. package/types/server/binaryPubsub.d.ts +18 -0
  277. package/types/server/console.d.ts +11 -1
  278. package/types/server/consoleEvaluator.d.ts +2 -0
  279. package/types/server/consolePasteFilter.d.ts +11 -0
  280. package/types/server/consoleSession.d.ts +22 -0
  281. package/types/server/contentEncoding.d.ts +28 -0
  282. package/types/server/devtools/types.d.ts +4 -4
  283. package/types/server/di/diLifecycle.d.ts +10 -2
  284. package/types/server/di/predefinedAdaptor.d.ts +4 -1
  285. package/types/server/di/utils.d.ts +16 -0
  286. package/types/server/lifecycle/runtimeDir.d.ts +5 -0
  287. package/types/server/logging/childOutputReader.d.ts +40 -0
  288. package/types/server/logging/hubFileSink.d.ts +18 -0
  289. package/types/server/logging/logControlSocket.d.ts +60 -0
  290. package/types/server/logging/logForwarder.d.ts +37 -0
  291. package/types/server/logging/logHub.d.ts +70 -0
  292. package/types/server/logging/logQuery.d.ts +31 -0
  293. package/types/server/logging/logStdoutWriter.d.ts +35 -0
  294. package/types/server/logging/logStreamRoute.d.ts +20 -0
  295. package/types/server/logging/logTailClient.d.ts +42 -0
  296. package/types/server/mcp/McpAuth.d.ts +62 -0
  297. package/types/server/mcp/McpDispatcher.d.ts +61 -0
  298. package/types/server/mcp/McpEventStream.d.ts +17 -0
  299. package/types/server/mcp/McpExecutionContext.d.ts +44 -0
  300. package/types/server/mcp/McpRouter.d.ts +65 -0
  301. package/types/server/mcp/index.d.ts +5 -0
  302. package/types/server/mcp.d.ts +1 -0
  303. package/types/server/resolver/signal.resolver.d.ts +7 -4
  304. package/types/server/routing/apiRouter.d.ts +2 -1
  305. package/types/server/routing/appWsData.d.ts +13 -1
  306. package/types/server/routing/eventStream.d.ts +23 -0
  307. package/types/server/routing/soloAppRoutes.d.ts +17 -0
  308. package/types/server/rscWorkerHost.d.ts +4 -1
  309. package/types/server/semaphore.d.ts +5 -0
  310. package/types/server/subRouteIndexDocument.d.ts +8 -0
  311. package/types/server/systemPageDocument.d.ts +1 -0
  312. package/types/server/systemPages.d.ts +5 -0
  313. package/types/server/types.d.ts +16 -0
  314. package/types/server/vendor/akanjs-fetch.d.ts +1 -0
  315. package/types/server/webRouter.d.ts +15 -4
  316. package/types/service/adapt.d.ts +2 -2
  317. package/types/service/agent.service.d.ts +32 -0
  318. package/types/service/base.service.d.ts +4 -0
  319. package/types/service/index.d.ts +1 -0
  320. package/types/service/injectInfo.d.ts +2 -2
  321. package/types/service/ipcTypes.d.ts +12 -0
  322. package/types/service/predefinedAdaptor/compress.adaptor.d.ts +1 -1
  323. package/types/service/predefinedAdaptor/database.adaptor.d.ts +9 -3
  324. package/types/service/predefinedAdaptor/deepseekLlm.d.ts +76 -0
  325. package/types/service/predefinedAdaptor/index.d.ts +3 -0
  326. package/types/service/predefinedAdaptor/insightQuery.d.ts +50 -0
  327. package/types/service/predefinedAdaptor/llm.adaptor.d.ts +105 -0
  328. package/types/service/predefinedAdaptor/queue.adaptor.d.ts +3 -2
  329. package/types/service/predefinedAdaptor/role.adaptor.d.ts +2 -0
  330. package/types/service/predefinedAdaptor/schedule.adaptor.d.ts +10 -6
  331. package/types/service/predefinedAdaptor/solidQueue.adaptor.d.ts +6 -2
  332. package/types/service/predefinedAdaptor/solidSqlite.d.ts +2 -2
  333. package/types/service/serve.d.ts +3 -3
  334. package/types/service/toolNames.d.ts +35 -0
  335. package/types/signal/agent/AgentCatalogue.d.ts +100 -0
  336. package/types/signal/agent/index.d.ts +1 -0
  337. package/types/signal/agent.d.ts +1 -0
  338. package/types/signal/agent.signal.d.ts +24 -0
  339. package/types/signal/agentTurn.d.ts +9 -0
  340. package/types/signal/agentTurnStream.d.ts +24 -0
  341. package/types/signal/base.signal.d.ts +1 -1
  342. package/types/signal/endpointInfo.d.ts +21 -3
  343. package/types/signal/guard.d.ts +12 -0
  344. package/types/signal/guards.d.ts +23 -1
  345. package/types/signal/index.d.ts +6 -0
  346. package/types/signal/intercept.d.ts +2 -2
  347. package/types/signal/internalArg.d.ts +22 -6
  348. package/types/signal/mcp/McpDocument.d.ts +84 -0
  349. package/types/signal/mcp/McpProgress.d.ts +40 -0
  350. package/types/signal/mcp/McpUriTemplate.d.ts +25 -0
  351. package/types/signal/mcp/Msg.d.ts +143 -0
  352. package/types/signal/mcp/index.d.ts +5 -0
  353. package/types/signal/mcp/mcpProtocol.d.ts +107 -0
  354. package/types/signal/mcp.d.ts +1 -0
  355. package/types/signal/middleware.d.ts +7 -7
  356. package/types/signal/openapi/openapi.d.ts +3 -3
  357. package/types/signal/schema/JsonSchemaBuilder.d.ts +51 -0
  358. package/types/signal/schema/index.d.ts +1 -0
  359. package/types/signal/schema.d.ts +1 -0
  360. package/types/signal/signalContext.d.ts +67 -8
  361. package/types/signal/slice.d.ts +42 -15
  362. package/types/signal/trace.d.ts +52 -2
  363. package/types/signal/types.d.ts +53 -4
  364. package/types/store/action.d.ts +7 -5
  365. package/types/store/actionTag.d.ts +21 -0
  366. package/types/store/agent/AgentBridge.d.ts +37 -0
  367. package/types/store/agent/AgentContext.d.ts +16 -0
  368. package/types/store/agent/AgentPrompts.d.ts +31 -0
  369. package/types/store/agent/ScreenReader.d.ts +29 -0
  370. package/types/store/agent/ScreenSettle.d.ts +22 -0
  371. package/types/store/agent/ScreenTarget.d.ts +34 -0
  372. package/types/store/agent/StoreCatalogue.d.ts +26 -0
  373. package/types/store/agent/StoreSurfaceSource.d.ts +30 -0
  374. package/types/store/agent/index.d.ts +11 -0
  375. package/types/store/agent/storeSurface.d.ts +14 -0
  376. package/types/store/agent/types.d.ts +15 -0
  377. package/types/store/agent.d.ts +1 -0
  378. package/types/store/agentic/AgentValue.d.ts +43 -0
  379. package/types/store/agentic/StExposeBuilder.d.ts +21 -0
  380. package/types/store/agentic/StExposeDraft.d.ts +13 -0
  381. package/types/store/agentic/StStateBuilder.d.ts +21 -0
  382. package/types/store/agentic/StStateDraft.d.ts +12 -0
  383. package/types/store/agentic/StToolBuilder.d.ts +56 -0
  384. package/types/store/agentic/StToolDraft.d.ts +13 -0
  385. package/types/store/agentic/attachAgentic.d.ts +25 -0
  386. package/types/store/agentic/formFields.d.ts +53 -0
  387. package/types/store/agentic/index.d.ts +12 -0
  388. package/types/store/agentic/useFieldTool.d.ts +22 -0
  389. package/types/store/agentic/useFormTools.d.ts +19 -0
  390. package/types/store/agentic/useRelationFieldTool.d.ts +27 -0
  391. package/types/store/agentic.d.ts +1 -0
  392. package/types/store/baseSt.d.ts +35 -39
  393. package/types/store/databaseStateNames.d.ts +25 -0
  394. package/types/store/formSetterNames.d.ts +30 -0
  395. package/types/store/index.d.ts +7 -0
  396. package/types/store/rootStore.d.ts +5 -1
  397. package/types/store/sliceRole.d.ts +25 -0
  398. package/types/store/store.d.ts +5 -1
  399. package/types/store/storeInstance.d.ts +33 -1
  400. package/types/store/storeRegistry.d.ts +5 -0
  401. package/types/store/types.d.ts +4 -0
  402. package/types/store/withSelector.d.ts +5 -4
  403. package/types/test/index.d.ts +1 -1
  404. package/types/test/registerDom.d.ts +1 -0
  405. package/types/test/signalTestRuntime.d.ts +2 -3
  406. package/types/test/testServer.d.ts +6 -4
  407. package/types/ui/Agent/Approval.d.ts +8 -0
  408. package/types/ui/Agent/Attach.d.ts +16 -0
  409. package/types/ui/Agent/Bubble.d.ts +26 -0
  410. package/types/ui/Agent/Chat.d.ts +91 -0
  411. package/types/ui/Agent/ChatCommands.d.ts +34 -0
  412. package/types/ui/Agent/Composer.d.ts +23 -0
  413. package/types/ui/Agent/Context.d.ts +13 -0
  414. package/types/ui/Agent/Dock.d.ts +17 -0
  415. package/types/ui/Agent/Guide.d.ts +9 -0
  416. package/types/ui/Agent/History.d.ts +26 -0
  417. package/types/ui/Agent/Launcher.d.ts +16 -0
  418. package/types/ui/Agent/Markdown.d.ts +19 -0
  419. package/types/ui/Agent/Menu.d.ts +18 -0
  420. package/types/ui/Agent/Mic.d.ts +8 -0
  421. package/types/ui/Agent/Question.d.ts +14 -0
  422. package/types/ui/Agent/Section.d.ts +10 -0
  423. package/types/ui/Agent/Skip.d.ts +22 -0
  424. package/types/ui/Agent/StateKey.d.ts +16 -0
  425. package/types/ui/Agent/Tool.d.ts +15 -0
  426. package/types/ui/Agent/Transcript.d.ts +13 -0
  427. package/types/ui/Agent/Zone.d.ts +48 -0
  428. package/types/ui/Agent/agentSessionOf.d.ts +27 -0
  429. package/types/ui/Agent/attachment.d.ts +34 -0
  430. package/types/ui/Agent/fetchRunner.d.ts +12 -0
  431. package/types/ui/Agent/index.d.ts +19 -0
  432. package/types/ui/Agent/index_.d.ts +1 -0
  433. package/types/ui/Agent/markdownBlocks.d.ts +35 -0
  434. package/types/ui/Agent/markdownSpans.d.ts +2 -0
  435. package/types/ui/Agent/markdownTable.d.ts +16 -0
  436. package/types/ui/Agent/sessionHistory.d.ts +14 -0
  437. package/types/ui/Agent/sessionView.d.ts +15 -0
  438. package/types/ui/Agent/tokenCount.d.ts +6 -0
  439. package/types/ui/Agent/useChatAttachments.d.ts +24 -0
  440. package/types/ui/Agent/useChatVoice.d.ts +30 -0
  441. package/types/ui/Agent/useDraftRecall.d.ts +14 -0
  442. package/types/ui/Agent/useKeyboardInset.d.ts +8 -0
  443. package/types/ui/Agent/useSlashMenu.d.ts +24 -0
  444. package/types/ui/Agent/voice.d.ts +71 -0
  445. package/types/ui/Agent.d.ts +1 -0
  446. package/types/ui/Badge.d.ts +1 -1
  447. package/types/ui/Button.d.ts +1 -1
  448. package/types/ui/Constant/Graph.d.ts +10 -0
  449. package/types/ui/Constant/index.d.ts +2 -1
  450. package/types/ui/Constant/schemaGraph.d.ts +39 -0
  451. package/types/ui/Data/Dashboard.d.ts +16 -3
  452. package/types/ui/Data/Insight.d.ts +1 -1
  453. package/types/ui/Data/ListContainer.d.ts +15 -7
  454. package/types/ui/Data/QueryMaker.d.ts +45 -3
  455. package/types/ui/Data/RefPicker.d.ts +16 -0
  456. package/types/ui/Data/dataExport.d.ts +5 -0
  457. package/types/ui/Data/dataText.d.ts +6 -0
  458. package/types/ui/Data/index.d.ts +2 -0
  459. package/types/ui/Data/index_.d.ts +1 -0
  460. package/types/ui/DatePicker.d.ts +15 -11
  461. package/types/ui/Dialog/LegacyModal.d.ts +13 -0
  462. package/types/ui/Dialog/Provider.d.ts +3 -1
  463. package/types/ui/Dialog/context.d.ts +9 -1
  464. package/types/ui/Dialog/index.d.ts +1 -0
  465. package/types/ui/DraggableList.d.ts +1 -1
  466. package/types/ui/Dropdown.d.ts +5 -1
  467. package/types/ui/Field.d.ts +13 -12
  468. package/types/ui/Layout/BottomTab.d.ts +3 -2
  469. package/types/ui/LegacyModal.d.ts +24 -0
  470. package/types/ui/Loading/ProgressBar.d.ts +4 -0
  471. package/types/ui/Loading/Spin.d.ts +2 -1
  472. package/types/ui/Model/AdminPanel.d.ts +15 -3
  473. package/types/ui/Model/EditModal.d.ts +1 -1
  474. package/types/ui/Model/New.d.ts +3 -1
  475. package/types/ui/Model/NewWrapper.d.ts +2 -0
  476. package/types/ui/Model/NewWrapper_Client.d.ts +2 -1
  477. package/types/ui/Pagination.d.ts +2 -2
  478. package/types/ui/Radio.d.ts +1 -1
  479. package/types/ui/RecentTime.d.ts +18 -1
  480. package/types/ui/Reference/Collapse.d.ts +11 -0
  481. package/types/ui/Reference/Panel.d.ts +29 -0
  482. package/types/ui/Reference/Segmented.d.ts +17 -0
  483. package/types/ui/Reference/Summary.d.ts +13 -0
  484. package/types/ui/Reference/Toolbar.d.ts +21 -0
  485. package/types/ui/Reference/dictText.d.ts +6 -0
  486. package/types/ui/Reference/index.d.ts +7 -0
  487. package/types/ui/Reference/style.d.ts +20 -0
  488. package/types/ui/Reference.d.ts +1 -0
  489. package/types/ui/ScreenNavigator.d.ts +3 -1
  490. package/types/ui/Signal/Arg.d.ts +7 -3
  491. package/types/ui/Signal/Doc.d.ts +4 -6
  492. package/types/ui/Signal/Object.d.ts +2 -1
  493. package/types/ui/Signal/RestApi.d.ts +2 -1
  494. package/types/ui/Signal/WebSocket.d.ts +2 -1
  495. package/types/ui/Signal/endpointEntries.d.ts +20 -0
  496. package/types/ui/Signal/style.d.ts +9 -8
  497. package/types/ui/System/Client.d.ts +1 -2
  498. package/types/ui/System/Common.d.ts +3 -4
  499. package/types/ui/System/Messages.d.ts +1 -1
  500. package/types/ui/Tab/Provider.d.ts +3 -1
  501. package/types/ui/Tab/context.d.ts +4 -2
  502. package/types/ui/ToggleSelect.d.ts +1 -0
  503. package/types/ui/UiOverride/context.d.ts +18 -1
  504. package/types/ui/agentAttrs.d.ts +14 -0
  505. package/types/ui/index.d.ts +22 -1
  506. package/types/ui/overlayLayer.d.ts +13 -0
  507. package/types/ui/overlayPosition.d.ts +28 -0
  508. package/types/ui/recipe/badgeRecipe.d.ts +2 -2
  509. package/types/ui/recipe/buttonRecipe.d.ts +2 -2
  510. package/types/vendor/use-agentic/AgentAbort.d.ts +17 -0
  511. package/types/vendor/use-agentic/AgentProgress.d.ts +27 -0
  512. package/types/vendor/use-agentic/AgentProvider.d.ts +17 -0
  513. package/types/vendor/use-agentic/AgentScope.d.ts +9 -0
  514. package/types/vendor/use-agentic/AgentSession.d.ts +163 -0
  515. package/types/vendor/use-agentic/Agentic.d.ts +21 -0
  516. package/types/vendor/use-agentic/AgenticSurface.d.ts +58 -0
  517. package/types/vendor/use-agentic/Compaction.d.ts +48 -0
  518. package/types/vendor/use-agentic/ToolOutput.d.ts +21 -0
  519. package/types/vendor/use-agentic/Transcript.d.ts +18 -0
  520. package/types/vendor/use-agentic/httpRunner.d.ts +15 -0
  521. package/types/vendor/use-agentic/index.d.ts +19 -0
  522. package/types/vendor/use-agentic/sharedContext.d.ts +15 -0
  523. package/types/vendor/use-agentic/surfaceContext.d.ts +5 -0
  524. package/types/vendor/use-agentic/types.d.ts +182 -0
  525. package/types/vendor/use-agentic/useAgent.d.ts +4 -0
  526. package/types/vendor/use-agentic/useAgentGuide.d.ts +6 -0
  527. package/types/vendor/use-agentic/useAgentResource.d.ts +12 -0
  528. package/types/vendor/use-agentic/useAgentState.d.ts +16 -0
  529. package/types/vendor/use-agentic/useAgentTool.d.ts +16 -0
  530. package/types/vendor/use-agentic.d.ts +1 -0
  531. package/types/webkit/index.d.ts +4 -0
  532. package/types/webkit/useBodyScrollLock.d.ts +2 -0
  533. package/types/webkit/usePageTool.d.ts +19 -0
  534. package/types/webkit/useScreenScope.d.ts +25 -0
  535. package/ui/Agent/Approval.tsx +32 -0
  536. package/ui/Agent/Attach.tsx +77 -0
  537. package/ui/Agent/Bubble.tsx +192 -0
  538. package/ui/Agent/Chat.tsx +525 -0
  539. package/ui/Agent/ChatCommands.ts +141 -0
  540. package/ui/Agent/Composer.tsx +94 -0
  541. package/ui/Agent/Context.tsx +49 -0
  542. package/ui/Agent/Dock.tsx +77 -0
  543. package/ui/Agent/Guide.tsx +16 -0
  544. package/ui/Agent/History.tsx +49 -0
  545. package/ui/Agent/Launcher.tsx +60 -0
  546. package/ui/Agent/Markdown.tsx +142 -0
  547. package/ui/Agent/Menu.tsx +55 -0
  548. package/ui/Agent/Mic.tsx +27 -0
  549. package/ui/Agent/Question.tsx +63 -0
  550. package/ui/Agent/Section.tsx +24 -0
  551. package/ui/Agent/Skip.tsx +30 -0
  552. package/ui/Agent/StateKey.tsx +46 -0
  553. package/ui/Agent/Tool.tsx +59 -0
  554. package/ui/Agent/Transcript.tsx +33 -0
  555. package/ui/Agent/Zone.tsx +116 -0
  556. package/ui/Agent/agentSessionOf.ts +60 -0
  557. package/ui/Agent/attachment.ts +73 -0
  558. package/ui/Agent/fetchRunner.ts +44 -0
  559. package/ui/Agent/index.ts +27 -0
  560. package/ui/Agent/index_.tsx +4 -0
  561. package/ui/Agent/markdownBlocks.ts +137 -0
  562. package/ui/Agent/markdownSpans.tsx +49 -0
  563. package/ui/Agent/markdownTable.ts +54 -0
  564. package/ui/Agent/sessionHistory.ts +62 -0
  565. package/ui/Agent/sessionView.ts +38 -0
  566. package/ui/Agent/tokenCount.ts +10 -0
  567. package/ui/Agent/useChatAttachments.ts +84 -0
  568. package/ui/Agent/useChatVoice.ts +129 -0
  569. package/ui/Agent/useDraftRecall.ts +42 -0
  570. package/ui/Agent/useKeyboardInset.ts +26 -0
  571. package/ui/Agent/useSlashMenu.ts +58 -0
  572. package/ui/Agent/voice.ts +177 -0
  573. package/ui/Badge.tsx +1 -1
  574. package/ui/BottomSheet.tsx +32 -36
  575. package/ui/Button.tsx +3 -1
  576. package/ui/Clipboard.tsx +3 -6
  577. package/ui/Constant/Doc.tsx +265 -254
  578. package/ui/Constant/Graph.tsx +151 -0
  579. package/ui/Constant/index.ts +3 -2
  580. package/ui/Constant/schemaGraph.ts +232 -0
  581. package/ui/Data/CardList.tsx +14 -3
  582. package/ui/Data/Dashboard.tsx +70 -52
  583. package/ui/Data/Insight.tsx +18 -12
  584. package/ui/Data/Item.tsx +42 -56
  585. package/ui/Data/ListContainer.tsx +246 -132
  586. package/ui/Data/Pagination.tsx +10 -3
  587. package/ui/Data/QueryMaker.tsx +160 -11
  588. package/ui/Data/RefPicker.tsx +202 -0
  589. package/ui/Data/TableList.tsx +22 -13
  590. package/ui/Data/dataExport.ts +54 -0
  591. package/ui/Data/dataText.ts +22 -0
  592. package/ui/Data/index.ts +13 -1
  593. package/ui/Data/index_.tsx +1 -0
  594. package/ui/DatePicker.tsx +110 -128
  595. package/ui/Dialog/Close.tsx +3 -7
  596. package/ui/Dialog/LegacyModal.tsx +241 -0
  597. package/ui/Dialog/Modal.tsx +62 -195
  598. package/ui/Dialog/Provider.tsx +47 -3
  599. package/ui/Dialog/Trigger.tsx +3 -7
  600. package/ui/Dialog/context.ts +14 -2
  601. package/ui/Dialog/index.tsx +2 -0
  602. package/ui/DragAction.tsx +3 -2
  603. package/ui/DraggableList.tsx +9 -4
  604. package/ui/Dropdown.tsx +89 -27
  605. package/ui/Empty.tsx +6 -4
  606. package/ui/Field.tsx +128 -58
  607. package/ui/Input.tsx +27 -5
  608. package/ui/KeyboardAvoiding.tsx +2 -2
  609. package/ui/Layout/BottomTab.tsx +32 -37
  610. package/ui/Layout/Sider.tsx +37 -14
  611. package/ui/LegacyModal.tsx +53 -0
  612. package/ui/Link/CsrLink.tsx +1 -1
  613. package/ui/Load/Pagination.tsx +15 -8
  614. package/ui/Load/Units.tsx +30 -7
  615. package/ui/Load/View.tsx +10 -3
  616. package/ui/Loading/Area.tsx +7 -6
  617. package/ui/Loading/Button.tsx +7 -9
  618. package/ui/Loading/Input.tsx +7 -9
  619. package/ui/Loading/ProgressBar.tsx +16 -7
  620. package/ui/Loading/Skeleton.tsx +8 -13
  621. package/ui/Loading/Spin.tsx +20 -14
  622. package/ui/Menu.tsx +1 -1
  623. package/ui/Model/AdminPanel.tsx +52 -12
  624. package/ui/Model/EditModal.tsx +28 -6
  625. package/ui/Model/EditWrapper.tsx +16 -4
  626. package/ui/Model/New.tsx +4 -0
  627. package/ui/Model/NewWrapper.tsx +2 -0
  628. package/ui/Model/NewWrapper_Client.tsx +20 -6
  629. package/ui/Model/Remove.tsx +18 -6
  630. package/ui/Model/RemoveWrapper.tsx +12 -2
  631. package/ui/Model/SureToRemove.tsx +18 -6
  632. package/ui/Model/ViewEditModal.tsx +64 -15
  633. package/ui/Model/ViewModal.tsx +25 -11
  634. package/ui/Model/ViewWrapper.tsx +15 -4
  635. package/ui/Model/index_.tsx +1 -1
  636. package/ui/Pagination.tsx +51 -66
  637. package/ui/Popconfirm.tsx +88 -78
  638. package/ui/Radio.tsx +53 -24
  639. package/ui/RecentTime.tsx +83 -35
  640. package/ui/Reference/Collapse.tsx +26 -0
  641. package/ui/Reference/Panel.tsx +79 -0
  642. package/ui/Reference/Segmented.tsx +41 -0
  643. package/ui/Reference/Summary.tsx +25 -0
  644. package/ui/Reference/Toolbar.tsx +44 -0
  645. package/ui/Reference/dictText.ts +9 -0
  646. package/ui/Reference/index.ts +7 -0
  647. package/ui/Reference/style.ts +45 -0
  648. package/ui/ScreenNavigator.tsx +17 -2
  649. package/ui/Select.tsx +96 -57
  650. package/ui/Signal/Arg.tsx +83 -68
  651. package/ui/Signal/Doc.tsx +163 -129
  652. package/ui/Signal/Listener.tsx +40 -29
  653. package/ui/Signal/Message.tsx +87 -135
  654. package/ui/Signal/Object.tsx +79 -57
  655. package/ui/Signal/PubSub.tsx +72 -113
  656. package/ui/Signal/Request.tsx +2 -22
  657. package/ui/Signal/Response.tsx +19 -45
  658. package/ui/Signal/RestApi.tsx +170 -200
  659. package/ui/Signal/WebSocket.tsx +29 -26
  660. package/ui/Signal/endpointEntries.ts +59 -0
  661. package/ui/Signal/makeExample.ts +10 -3
  662. package/ui/Signal/style.ts +34 -29
  663. package/ui/Switch.tsx +4 -0
  664. package/ui/System/CSR.tsx +1 -1
  665. package/ui/System/Client.tsx +31 -15
  666. package/ui/System/Common.tsx +3 -4
  667. package/ui/System/DevModeToggle.tsx +1 -1
  668. package/ui/System/Gtag.tsx +2 -2
  669. package/ui/System/Messages.tsx +52 -31
  670. package/ui/System/Reconnect.tsx +22 -56
  671. package/ui/System/SelectLanguage.tsx +24 -15
  672. package/ui/System/ThemeToggle.tsx +25 -13
  673. package/ui/Tab/Menu.tsx +24 -12
  674. package/ui/Tab/Menus.tsx +6 -3
  675. package/ui/Tab/Provider.tsx +30 -3
  676. package/ui/Tab/context.ts +8 -4
  677. package/ui/Table.tsx +66 -60
  678. package/ui/ToggleSelect.tsx +8 -7
  679. package/ui/Tooltip.tsx +15 -1
  680. package/ui/UiOverride/context.ts +21 -2
  681. package/ui/Unauthorized.tsx +6 -4
  682. package/ui/agentAttrs.ts +19 -0
  683. package/ui/index.ts +49 -1
  684. package/ui/overlayLayer.ts +12 -2
  685. package/ui/overlayPosition.ts +104 -0
  686. package/ui/recipe/buttonRecipe.ts +2 -2
  687. package/ui/styles.css +31 -0
  688. package/vendor/use-agentic/AgentAbort.ts +29 -0
  689. package/vendor/use-agentic/AgentProgress.ts +40 -0
  690. package/vendor/use-agentic/AgentProvider.tsx +39 -0
  691. package/vendor/use-agentic/AgentScope.tsx +20 -0
  692. package/vendor/use-agentic/AgentSession.ts +750 -0
  693. package/vendor/use-agentic/Agentic.tsx +44 -0
  694. package/vendor/use-agentic/AgenticSurface.ts +333 -0
  695. package/vendor/use-agentic/Compaction.ts +120 -0
  696. package/vendor/use-agentic/ToolOutput.ts +60 -0
  697. package/vendor/use-agentic/Transcript.ts +50 -0
  698. package/vendor/use-agentic/WIRE.md +86 -0
  699. package/vendor/use-agentic/httpRunner.ts +131 -0
  700. package/vendor/use-agentic/index.ts +20 -0
  701. package/vendor/use-agentic/sharedContext.ts +25 -0
  702. package/vendor/use-agentic/surfaceContext.ts +10 -0
  703. package/vendor/use-agentic/types.ts +192 -0
  704. package/vendor/use-agentic/useAgent.ts +18 -0
  705. package/vendor/use-agentic/useAgentGuide.ts +16 -0
  706. package/vendor/use-agentic/useAgentResource.ts +36 -0
  707. package/vendor/use-agentic/useAgentState.ts +64 -0
  708. package/vendor/use-agentic/useAgentTool.ts +55 -0
  709. package/webkit/bootCsr.tsx +10 -8
  710. package/webkit/index.ts +4 -0
  711. package/webkit/lazy.tsx +5 -1
  712. package/webkit/useBodyScrollLock.tsx +29 -0
  713. package/webkit/useFrameRuntime.ts +1 -1
  714. package/webkit/usePageTool.tsx +37 -0
  715. package/webkit/useScreenScope.tsx +60 -0
  716. package/types/ui/Constant/Mermaid.d.ts +0 -8
  717. package/types/ui/Signal/Collapse.d.ts +0 -12
  718. package/ui/Constant/Mermaid.tsx +0 -149
  719. package/ui/Signal/Collapse.tsx +0 -29
@@ -0,0 +1,105 @@
1
+ export interface AgentWireToolCall {
2
+ id: string;
3
+ name: string;
4
+ args: Record<string, unknown>;
5
+ }
6
+ export interface AgentWireToolResult {
7
+ id: string;
8
+ name: string;
9
+ result?: unknown;
10
+ changes?: unknown[];
11
+ error?: string;
12
+ }
13
+ /**
14
+ * A file the caller attached to one message. Exactly one carrier reaches the model — `data` as inlined bytes, `url`
15
+ * as something the provider fetches, `text` as content already extracted — and which of them a given provider can
16
+ * read is what `LlmAccepts` answers.
17
+ */
18
+ export interface AgentWireAttachment {
19
+ name: string;
20
+ mimeType: string;
21
+ /** Base64, with no `data:` prefix. */
22
+ data?: string;
23
+ url?: string;
24
+ text?: string;
25
+ }
26
+ /**
27
+ * One transcript message of the in-page agent wire (`use-agentic`'s WIRE.md), typed at both ends independently —
28
+ * the wire is the contract, so the server never imports the client package.
29
+ */
30
+ export interface AgentWireMessage {
31
+ role: "user" | "assistant" | "tool";
32
+ text?: string;
33
+ attachments?: AgentWireAttachment[];
34
+ toolCalls?: AgentWireToolCall[];
35
+ toolResults?: AgentWireToolResult[];
36
+ error?: string;
37
+ /**
38
+ * Stands in for the messages the client's own compaction replaced. It arrives with the user's role because the
39
+ * wire has no other, but it is history rather than an ask, so a provider mapping frames it as one.
40
+ */
41
+ summary?: boolean;
42
+ }
43
+ export interface AgentWireTool {
44
+ name: string;
45
+ description?: string;
46
+ parameters?: Record<string, unknown>;
47
+ needsConfirm?: boolean;
48
+ }
49
+ export interface AgentWireContext {
50
+ kind: string;
51
+ [key: string]: unknown;
52
+ }
53
+ export interface LlmTurnRequest {
54
+ messages: AgentWireMessage[];
55
+ tools: AgentWireTool[];
56
+ context: AgentWireContext[];
57
+ instructions?: string;
58
+ }
59
+ export interface LlmTurnAnswer {
60
+ text?: string;
61
+ toolCalls?: AgentWireToolCall[];
62
+ stop: "end" | "toolUse";
63
+ }
64
+ /**
65
+ * The provider seam for one stateless agent turn: the whole transcript in, one assistant answer out. The server
66
+ * relays — it never executes a client tool — so this is the only surface a provider integration fills. An
67
+ * implementation is an `adapt()` class in a lib's `srvkit/`.
68
+ *
69
+ * `null` means this provider is not configured, and the caller turns it into the one sentence that says so. A
70
+ * failure the provider explained is logged and **thrown** instead, as an `Err` whose text the chat prints: a
71
+ * refused turn and an unconfigured app are different things to be told, and collapsing both into `null` left a
72
+ * user reading "no model is configured" about a conversation that had merely outgrown the context window.
73
+ */
74
+ export interface LlmAdaptor {
75
+ /**
76
+ * `onDelta` opts into streaming: the adapter reports assistant text as it arrives and still resolves the full
77
+ * answer. An adapter may ignore it — the caller treats zero reported deltas as "answered whole".
78
+ */
79
+ chat(request: LlmTurnRequest, onDelta?: (delta: string) => void): Promise<LlmTurnAnswer | null>;
80
+ /** Which attachment carriers this provider's model can read. Omitted means text only. */
81
+ readonly accepts?: LlmAccepts;
82
+ }
83
+ /**
84
+ * What an adaptor's model reads beyond text. Declared rather than defaulted to true, because the failure of
85
+ * guessing wrong is the worst one available: a provider handed bytes it cannot decode either rejects the whole
86
+ * turn or accepts it having seen nothing, and the model then answers confidently about a file it never read.
87
+ * `AgentService` degrades what is not accepted into a note the model can repeat back, so a text-only provider
88
+ * needs no attachment code at all — which is every provider until somebody swaps one in for vision.
89
+ */
90
+ export interface LlmAccepts {
91
+ /** Inlined or linked image bytes. */
92
+ image?: boolean;
93
+ /** Non-image bytes handed over whole — a PDF the model parses itself. */
94
+ document?: boolean;
95
+ }
96
+ /**
97
+ * Settings for whichever adaptor fills `LlmAdaptorRole`, registered with `option.setLlm(...)` and injected as the
98
+ * `llmOption` use. It belongs to the role rather than to one provider: swapping the default for another `adapt()`
99
+ * class re-reads the same three fields under that provider's own defaults.
100
+ */
101
+ export interface LlmOption {
102
+ apiKey?: string;
103
+ model?: string;
104
+ host?: string;
105
+ }
@@ -1,4 +1,3 @@
1
- import type { BaseEnv } from "akanjs/base";
2
1
  import type { AkanJob, AkanJobOptions, AkanWorker } from "../ipcTypes.d.ts";
3
2
  type QueueLike = {
4
3
  add(name: string, args: unknown[], options?: AkanJobOptions): Promise<unknown>;
@@ -10,7 +9,9 @@ export interface QueueAdaptor {
10
9
  }
11
10
  declare const BullQueue_base: import("..").AdaptorCls<{}, {
12
11
  redis: import("..").InjectInfo<"plug", import("ioredis").default, never, never>;
13
- prefix: import("..").InjectInfo<"env", string, BaseEnv, never>;
12
+ prefix: import("..").InjectInfo<"env", string, {
13
+ [key: string]: any;
14
+ }, never>;
14
15
  }>;
15
16
  export declare class BullQueue extends BullQueue_base implements QueueAdaptor {
16
17
  #private;
@@ -2,6 +2,7 @@ import { type AdaptorCls } from "../adapt.d.ts";
2
2
  import type { CacheAdaptor } from "./cache.adaptor";
3
3
  import type { CompressAdaptor } from "./compress.adaptor";
4
4
  import type { DatabaseAdaptor } from "./database.adaptor";
5
+ import type { LlmAdaptor } from "./llm.adaptor";
5
6
  import type { LoggingAdaptor } from "./logging.adaptor";
6
7
  import type { QueueAdaptor } from "./queue.adaptor";
7
8
  import type { ScheduleAdaptor } from "./schedule.adaptor";
@@ -15,3 +16,4 @@ export declare const ScheduleAdaptorRole: AdaptorCls<ScheduleAdaptor>;
15
16
  export declare const LoggingAdaptorRole: AdaptorCls<LoggingAdaptor>;
16
17
  export declare const WebsocketAdaptorRole: AdaptorCls<WebsocketAdaptor>;
17
18
  export declare const CompressAdaptorRole: AdaptorCls<CompressAdaptor>;
19
+ export declare const LlmAdaptorRole: AdaptorCls<LlmAdaptor>;
@@ -1,9 +1,13 @@
1
- import { Cron } from "croner";
1
+ /** The scheduler's own job handle, so the cron backend stays behind this interface. `Bun.cron` satisfies it. */
2
+ export interface AkanCronJob {
3
+ readonly cron: string;
4
+ stop(): void;
5
+ }
2
6
  export interface ScheduleAdaptor {
3
- getCron(key: string): Cron | undefined;
7
+ getCron(key: string): AkanCronJob | undefined;
4
8
  registerCron(key: string, cronStr: string, callback: () => Promise<void>, option?: {
5
9
  lock?: boolean;
6
- }): Cron;
10
+ }): AkanCronJob;
7
11
  unregisterCron(key: string): void;
8
12
  getInterval(key: string): NodeJS.Timeout | undefined;
9
13
  registerInterval(key: string, scheduleTime: number, callback: () => Promise<void>, option?: {
@@ -29,15 +33,15 @@ declare const Scheduler_base: import("..").AdaptorCls<{}, {
29
33
  }>;
30
34
  export declare class Scheduler extends Scheduler_base implements ScheduleAdaptor {
31
35
  readonly lockMap: Map<string, boolean>;
32
- readonly cronMap: Map<string, Cron<undefined>>;
36
+ readonly cronMap: Map<string, AkanCronJob>;
33
37
  readonly intervalMap: Map<string, NodeJS.Timeout>;
34
38
  readonly timeoutMap: Map<string, NodeJS.Timeout>;
35
39
  readonly initMap: Map<string, () => Promise<void>>;
36
40
  readonly destroyMap: Map<string, () => Promise<void>>;
37
- getCron(key: string): Cron<undefined> | undefined;
41
+ getCron(key: string): AkanCronJob | undefined;
38
42
  registerCron(key: string, cronStr: string, callback: () => Promise<void>, { lock }?: {
39
43
  lock?: boolean;
40
- }): Cron<undefined>;
44
+ }): Bun.CronJob;
41
45
  unregisterCron(key: string): void;
42
46
  getInterval(key: string): NodeJS.Timeout | undefined;
43
47
  registerInterval(key: string, scheduleTime: number, callback: () => Promise<void>, { lock }?: {
@@ -3,8 +3,12 @@ import type { QueueAdaptor } from "./queue.adaptor";
3
3
  import { type SolidConfig, type SolidEnv } from "./solidSqlite.d.ts";
4
4
  declare const SolidQueue_base: import("..").AdaptorCls<{}, {
5
5
  config: import("..").InjectInfo<"env", Required<SolidConfig>, SolidEnv, never>;
6
- queueName: import("..").InjectInfo<"env", string, SolidEnv, never>;
7
- workerId: import("..").InjectInfo<"env", string, SolidEnv, never>;
6
+ queueName: import("..").InjectInfo<"env", string, {
7
+ [key: string]: any;
8
+ }, never>;
9
+ workerId: import("..").InjectInfo<"env", string, {
10
+ [key: string]: any;
11
+ }, never>;
8
12
  }>;
9
13
  export declare class SolidQueue extends SolidQueue_base implements QueueAdaptor {
10
14
  #private;
@@ -1,5 +1,5 @@
1
1
  import { Database } from "bun:sqlite";
2
- import type { BaseEnv, Dayjs } from "akanjs/base";
2
+ import { type Dayjs } from "akanjs/base";
3
3
  export interface SolidConfig {
4
4
  filePath?: string;
5
5
  journalMode?: "WAL" | "DELETE" | "TRUNCATE" | "PERSIST" | "MEMORY" | "OFF";
@@ -9,7 +9,7 @@ export interface SolidConfig {
9
9
  queuePollIntervalMs?: number;
10
10
  queueLeaseMs?: number;
11
11
  }
12
- export interface SolidEnv extends BaseEnv {
12
+ export interface SolidEnv {
13
13
  workspaceRoot?: string;
14
14
  solid?: SolidConfig;
15
15
  }
@@ -4,15 +4,15 @@ import type { DatabaseModel } from "akanjs/document";
4
4
  import { type ExtractInjectInfoObject, type InjectBuilder, InjectInfo } from "./injectInfo.d.ts";
5
5
  import type { DatabaseServiceForModel } from "./types.d.ts";
6
6
  interface ServiceOptions {
7
- enabled?: boolean;
7
+ enabled?: boolean | (() => boolean);
8
8
  serverMode?: "batch" | "federation";
9
9
  }
10
10
  export type ServiceType = "database" | "plain";
11
11
  export interface Service {
12
12
  readonly logger: Logger;
13
- onInit(): Promise<void>;
13
+ onInit(): Promise<void> | void;
14
14
  _libsOnInit(): Promise<void>;
15
- onDestroy(): Promise<void>;
15
+ onDestroy(): Promise<void> | void;
16
16
  _libsOnDestroy(): Promise<void>;
17
17
  }
18
18
  export type ServiceCls<RefName extends string = string, Methods = {}, InjectMap extends {
@@ -0,0 +1,35 @@
1
+ import type { AgentWireToolCall, LlmTurnRequest } from "./predefinedAdaptor/llm.adaptor";
2
+ /**
3
+ * Renames a turn's tools onto what a provider's function-calling wire accepts, and reads the answer back.
4
+ *
5
+ * A zone publishes its tools scope-prefixed — `videoProjectDraft.createVideoProject` — which is legal for MCP,
6
+ * where `.` is an allowed character and the scope join. Every OpenAI-compatible and Anthropic function schema is
7
+ * narrower: `[A-Za-z0-9_-]`, at most 64 characters. A provider that validates answers 400; DeepSeek does not, and
8
+ * what happened instead was worse to debug — the model normalized the illegal name itself, called the bare
9
+ * `createVideoProject`, and the browser answered `Unknown tool`, spending a turn on a tool that was published all
10
+ * along.
11
+ *
12
+ * Renamed here rather than in each adaptor for the reason `AgentService.explained` gives: every adaptor would
13
+ * otherwise have to remember, and forgetting is silent. A name the wire already accepts is left alone, so the
14
+ * root agent's request is byte-for-byte what it was.
15
+ */
16
+ export declare class ToolNames {
17
+ #private;
18
+ /** Both dialects reject a longer name, and neither says so in terms of the tool you wrote. */
19
+ static readonly limit = 64;
20
+ /**
21
+ * Every name the request carries, not just the published ones: the transcript holds calls to tools that have
22
+ * since left the screen, and one of those reaching the wire unrenamed is the same failure a turn later.
23
+ */
24
+ static of(request: LlmTurnRequest): ToolNames;
25
+ constructor(names: Iterable<string>);
26
+ get renamed(): boolean;
27
+ wire(name: string): string;
28
+ /**
29
+ * Unknown stays as it came. A model that invented a name is answered by the surface's own `Unknown tool`, which
30
+ * lands in the transcript as a tool result it can correct from — guessing which tool it meant would run one.
31
+ */
32
+ surface(name: string): string;
33
+ encode(request: LlmTurnRequest): LlmTurnRequest;
34
+ decode(calls: AgentWireToolCall[]): AgentWireToolCall[];
35
+ }
@@ -0,0 +1,100 @@
1
+ import { mcpBaseVerbOf } from "akanjs/common";
2
+ import type { SerializedEndpoint, SerializedSignal, SerializedSlice } from "../types.d.ts";
3
+ /** Where an endpoint came from, which is what decides where an audience's opt-in for it can be written. */
4
+ export type AgentOrigin = "base" | "slice" | "endpoint";
5
+ /** Which generated CRUD verb a `base` candidate is. Its opt-in lives on the signal, not on the endpoint. */
6
+ export type AgentBaseVerb = NonNullable<ReturnType<typeof mcpBaseVerbOf>>;
7
+ /** One endpoint a signal registry holds, before any audience has decided anything about it. */
8
+ export interface AgentCandidate {
9
+ refName: string;
10
+ key: string;
11
+ endpoint: SerializedEndpoint;
12
+ origin: AgentOrigin;
13
+ /** The signal it belongs to. A generated verb carries no option of its own, so its opt-in is written here. */
14
+ signal: SerializedSignal;
15
+ /** The slice this key was generated from, where the opt-in for a `slice` candidate is written. */
16
+ slice?: SerializedSlice;
17
+ baseVerb?: AgentBaseVerb;
18
+ }
19
+ /** An opt-in a catalogue did not honour, with the reason it did not. */
20
+ export interface AgentRefusal {
21
+ key: string;
22
+ reason: string;
23
+ }
24
+ /** A published entry carrying no description its author wrote, and what to write so that it does. */
25
+ export interface AgentUndescribed {
26
+ key: string;
27
+ reason: string;
28
+ }
29
+ export interface AgentCatalogueOptions {
30
+ resolveDescription?: (key: string) => string | undefined;
31
+ excludeSignals?: string[];
32
+ }
33
+ /**
34
+ * The half of an agent catalogue that does not depend on who is asking.
35
+ *
36
+ * Enumerating what a signal registry holds, keeping that order stable, holding one name per entry, and resolving
37
+ * the words a module wrote in its dictionary are the same work for every audience — an external MCP client, an
38
+ * in-page agent driving the store, a transport that does not exist yet. What differs is only which option admits
39
+ * an endpoint and what shape it is published in, and both of those stay with the audience that decides them.
40
+ *
41
+ * Separated while exactly one audience existed. The cost then is moving code between two files; the cost later is
42
+ * telling two audiences apart inside one class that never expected a second.
43
+ */
44
+ export declare class AgentCatalogue {
45
+ #private;
46
+ /**
47
+ * Everything a registry holds, in an order that does not move between boots: clients cache a catalogue, and an
48
+ * LLM prompt cache keys on its exact text, so an order that depends on object iteration is a cache that misses.
49
+ *
50
+ * Every endpoint is listed, including ones no audience will take. Deciding is the caller's half.
51
+ */
52
+ static candidates(serializedSignal: Record<string, SerializedSignal>, { excludeSignals }?: {
53
+ excludeSignals?: string[];
54
+ }): AgentCandidate[];
55
+ /**
56
+ * What opted in and was refused anyway. Collected rather than merely dropped so a server can say so at boot:
57
+ * the rejections an audience makes are fail-closed by design, and an author whose deliberate opt-in vanished
58
+ * from the catalogue otherwise has nowhere to look but the framework source.
59
+ */
60
+ readonly refusals: AgentRefusal[];
61
+ constructor(options?: AgentCatalogueOptions);
62
+ /**
63
+ * What is published with no description of its own. Description is the one field a model picks an entry by, so
64
+ * one without it is a broken entry rather than an untidy one — and a source scanner cannot answer this: it
65
+ * reads files, where an opt-in is visible only as a literal in a builder call and where the model `.desc()`
66
+ * every generated entry borrows is not written as a description of the entry at all.
67
+ */
68
+ get undescribed(): AgentUndescribed[];
69
+ /**
70
+ * Takes the name for this entry, or refuses it because something else already holds it.
71
+ *
72
+ * A name must be unique within a catalogue, across every kind of entry it publishes. Keys are globally unique
73
+ * by construction, so a collision means two signals disagree — the first in candidate order keeps it, which is
74
+ * what makes the catalogue the same on the next boot either way.
75
+ */
76
+ claim(key: string): boolean;
77
+ refuse(key: string, reason: string): void;
78
+ texts(titleKey: string, descKey?: string): {
79
+ description?: string | undefined;
80
+ title?: string | undefined;
81
+ };
82
+ /**
83
+ * Every entry the framework generates borrows the model's own words, because none of them has any of its own.
84
+ *
85
+ * `slice()` generates the root slice under the empty key and `baseSliceDictionary` fills its text, so
86
+ * `<model>List` and `<model>Insight` publish as "Slice List - Universal" whatever the dictionary says. The five
87
+ * base CRUD entries are no better off: `getBaseSignalDictionary` writes "Get Banner" as both title and
88
+ * description, and both are assigned last, so a module author has nowhere to write over either one.
89
+ *
90
+ * That matters more here than anywhere else — description is the one field a model picks an entry by, and "Get
91
+ * Banner" says nothing about what a Banner is. So the model's `.desc()` is appended rather than substituted:
92
+ * on `removeBanner` a bare model description would read as if the tool returned one. And when the model has no
93
+ * `.desc()` either, the entry is recorded as undescribed — its only possible text is missing, and that is the
94
+ * one thing a source scanner cannot see.
95
+ */
96
+ entryTexts(refName: string, key: string): {
97
+ description?: string | undefined;
98
+ title?: string | undefined;
99
+ };
100
+ }
@@ -0,0 +1 @@
1
+ export * from "./AgentCatalogue.d.ts";
@@ -0,0 +1 @@
1
+ export * from "./agent/index.d.ts";
@@ -0,0 +1,24 @@
1
+ import { AgentTurn } from "./agentTurn.d.ts";
2
+ declare const AgentInternal_base: import("./internal.d.ts").InternalCls<import("akanjs/service").ServiceModel<typeof import("akanjs/service").AgentService, any, any, {
3
+ agentService: import("akanjs/service").AgentService;
4
+ }>, {}>;
5
+ export declare class AgentInternal extends AgentInternal_base {
6
+ }
7
+ declare const AgentEndpoint_base: import("./endpoint.d.ts").EndpointCls<import("akanjs/service").ServiceModel<typeof import("akanjs/service").AgentService, any, any, {
8
+ agentService: import("akanjs/service").AgentService;
9
+ }>, {
10
+ runAgentTurn: import("./endpointInfo.d.ts").EndpointInfo<"mutation", {
11
+ agentService: import("akanjs/service").AgentService;
12
+ }, ["messages", "tools", "context", "instructions"], [arg: unknown[], arg: unknown[], arg: unknown[], arg?: string | null | undefined], [arg: Bun.BunRequest<string>], [arg: unknown[], arg: unknown[], arg: unknown[], arg: string | undefined], typeof AgentTurn, AgentTurn, Promise<AgentTurn | {
13
+ text: string;
14
+ toolCalls: import("akanjs/service").AgentWireToolCall[];
15
+ stop: "end" | "toolUse";
16
+ }>, false>;
17
+ }>;
18
+ export declare class AgentEndpoint extends AgentEndpoint_base {
19
+ }
20
+ declare const Agent_base: import("./serverSignal.d.ts").ServerSignalCls<typeof AgentEndpoint, typeof AgentInternal>;
21
+ export declare class Agent extends Agent_base {
22
+ }
23
+ export declare const agent: import("./signalRegistry.d.ts").ServiceSignal<typeof AgentInternal, typeof AgentEndpoint, typeof Agent>;
24
+ export {};
@@ -0,0 +1,9 @@
1
+ export { AgentStop, AgentTurn, agentTurnConstant } from "akanjs/fetch";
2
+ declare const AgentTurnDocument_base: import("akanjs/document").DatabaseCls<{
3
+ text: string;
4
+ toolCalls: unknown[];
5
+ stop: NonNullable<"end" | "toolUse">;
6
+ } & {}>;
7
+ export declare class AgentTurnDocument extends AgentTurnDocument_base {
8
+ }
9
+ export declare const agentTurnDocument: import("akanjs/document").DatabaseCls<AgentTurnDocument>;
@@ -0,0 +1,24 @@
1
+ import type { AgentWireToolCall } from "akanjs/service";
2
+ interface StreamedTurn {
3
+ text?: string;
4
+ toolCalls?: AgentWireToolCall[];
5
+ stop?: "end" | "toolUse";
6
+ }
7
+ /**
8
+ * The streaming half of the agent turn wire (use-agentic WIRE.md): the same endpoint answers `text/event-stream`
9
+ * when the request asks for it, one RunnerEvent JSON per SSE `data:` line, ending with `done`. The signal layer
10
+ * passes a raw `Response` through untouched, which is what lets one mutation serve both shapes.
11
+ */
12
+ export declare class AgentTurnStream {
13
+ static wants(request: Bun.BunRequest): boolean;
14
+ /**
15
+ * A domain `Err` carries its dictionary key as the message and the values its text interpolates as `data`, so
16
+ * both travel: the key alone would reach the chat as `agent.error.…` with its placeholders unfilled.
17
+ */
18
+ static failure(error: unknown): {
19
+ message: string;
20
+ data?: Record<string, string | number>;
21
+ };
22
+ static response(run: (onDelta: (delta: string) => void) => Promise<StreamedTurn>): Response;
23
+ }
24
+ export {};
@@ -31,7 +31,7 @@ declare const Base_base: import("./serverSignal.d.ts").ServerSignalCls<typeof Ba
31
31
  export declare class Base extends Base_base {
32
32
  }
33
33
  export declare const base: import("./signalRegistry.d.ts").ServiceSignal<typeof BaseInternal, typeof BaseEndpoint, typeof Base>;
34
- export declare const fetch: import("akanjs/fetch").FetchClientType<[import("./signalRegistry.d.ts").ServiceSignal<typeof BaseInternal, typeof BaseEndpoint, typeof Base>]>;
34
+ export declare const fetch: import("akanjs/fetch").FetchClientType<[import("./signalRegistry.d.ts").ServiceSignal<typeof BaseInternal, typeof BaseEndpoint, typeof Base>, import("./signalRegistry.d.ts").ServiceSignal<typeof import("./agent.signal").AgentInternal, typeof import("./agent.signal").AgentEndpoint, typeof import("./agent.signal").Agent>]>;
35
35
  export declare const getSerializedSignal: () => {
36
36
  [key: string]: import("./types.d.ts").SerializedSignal;
37
37
  };
@@ -1,9 +1,21 @@
1
- import { type Dayjs, type EnumInstance, type PromiseOrObject } from "akanjs/base";
1
+ import { Any, type Dayjs, type EnumInstance, type PromiseOrObject } from "akanjs/base";
2
2
  import type { ConstantFieldType, ConstantFieldTypeInput, DocumentModel, FieldToValue, ParamFieldType, PlainTypeToFieldType, PurifiedModel, UploadableClientArg } from "akanjs/constant";
3
3
  import type { ServiceModel } from "akanjs/service";
4
4
  import type { InternalArgCls } from "./internalArg.d.ts";
5
+ import type { PromptResult } from "./mcp.d.ts";
5
6
  import type { ArgType, SignalOption, SrvMap } from "./types.d.ts";
6
- export type EndpointType = "query" | "mutation" | "pubsub" | "message";
7
+ export type EndpointType = "query" | "mutation" | "pubsub" | "message" | "prompt";
8
+ /**
9
+ * A prompt travels as `Any` because `PrimitiveRegistry.has(Any)` is true, so `resolveReturn` and `makeResponse`
10
+ * hand the messages back untouched. Registering a scalar for `PromptMessage` would buy nothing the builder's
11
+ * `exec` constraint does not already give, and would push a client-side model into every app that never uses one.
12
+ *
13
+ * It does not follow that a prompt's payload is unmasked. What a return ref masks is the value's own fields, and
14
+ * a prompt's are fixed by the protocol; the document inside an attachment is a JSON string by the time any return
15
+ * ref could reach it. So masking is declared at the attachment instead — `Msg.mask` — where the model is named
16
+ * and a payload that lost its class on the way still masks correctly.
17
+ */
18
+ declare const promptCarrier: typeof Any;
7
19
  export interface EndpointArgProps<Optional extends boolean = false> {
8
20
  nullable?: Optional;
9
21
  example?: string | number | boolean | Dayjs;
@@ -34,6 +46,7 @@ export declare class EndpointInfo<ReqType extends EndpointType = EndpointType, S
34
46
  } = {
35
47
  [key: string]: any;
36
48
  }, ArgNames extends string[] = any, Args extends any[] = any, InternalArgs extends any[] = any, ServerArgs extends any[] = any, Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, ClientReturns = never, ServerReturns = never, Nullable extends boolean = boolean> {
49
+ #private;
37
50
  readonly type: ReqType;
38
51
  readonly argNames: ArgNames;
39
52
  readonly args: ArgInfo<EndpointArgProps<boolean>>[];
@@ -52,7 +65,7 @@ export declare class EndpointInfo<ReqType extends EndpointType = EndpointType, S
52
65
  _addArgs(args: ArgInfo<EndpointArgProps<boolean>>[]): this;
53
66
  with<ArgType, Optional extends boolean = false>(argRef: InternalArgCls<ArgType>, option?: InternalArgProps<Optional>): EndpointInfo<ReqType, Srvs, ArgNames, Args, [...InternalArgs, arg: NonNullable<ArgType> | (Optional extends true ? null : never)], ServerArgs, Returns, ClientReturns, ServerReturns, Nullable>;
54
67
  _addInternalArgs(args: InternalArgInfo<boolean>[]): this;
55
- exec<ExecFn extends (this: Srvs, ...args: [...ServerArgs, ...InternalArgs]) => ReqType extends "pubsub" ? Promise<void> | void : PromiseOrObject<DocumentModel<FieldToValue<Returns>> | (Nullable extends true ? null | undefined : never)>>(execFn: ExecFn): EndpointInfo<ReqType, Srvs, ArgNames, Args, InternalArgs, ServerArgs, Returns, FieldToValue<Returns>, ReturnType<ExecFn>, Nullable>;
68
+ exec<ExecFn extends (this: Srvs, ...args: [...ServerArgs, ...InternalArgs]) => ReqType extends "pubsub" ? Promise<void> | void : ReqType extends "prompt" ? PromiseOrObject<PromptResult> : PromiseOrObject<DocumentModel<FieldToValue<Returns>> | (Nullable extends true ? null | undefined : never)>>(execFn: ExecFn): EndpointInfo<ReqType, Srvs, ArgNames, Args, InternalArgs, ServerArgs, Returns, FieldToValue<Returns>, ReturnType<ExecFn>, Nullable>;
56
69
  getPath(key: string): string;
57
70
  }
58
71
  export type BuildEndpoint<SrvModule extends ServiceModel = ServiceModel> = {
@@ -60,6 +73,11 @@ export type BuildEndpoint<SrvModule extends ServiceModel = ServiceModel> = {
60
73
  mutation: <Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOption?: SignalOption<Returns, Nullable>) => EndpointInfo<"mutation", SrvMap<SrvModule>, [], [], [], [], Returns, never, never, Nullable>;
61
74
  pubsub: <Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOption?: SignalOption<Returns, Nullable>) => EndpointInfo<"pubsub", SrvMap<SrvModule>, [], [], [], [], Returns, never, never, Nullable>;
62
75
  message: <Returns extends ConstantFieldTypeInput = ConstantFieldTypeInput, Nullable extends boolean = false>(returnRef: Returns, signalOption?: SignalOption<Returns, Nullable>) => EndpointInfo<"message", SrvMap<SrvModule>, [], [], [], [], Returns, never, never, Nullable>;
76
+ /**
77
+ * Declares an MCP prompt. It takes no return type because the return is always `PromptMessage[]`, and no
78
+ * `.body()` because `prompts/get` sends its arguments as a flat string map — see `param`.
79
+ */
80
+ prompt: (signalOption?: SignalOption<typeof promptCarrier, false>) => EndpointInfo<"prompt", SrvMap<SrvModule>, [], [], [], [], typeof promptCarrier, never, never, false>;
63
81
  };
64
82
  export declare const buildEndpoint: BuildEndpoint<any>;
65
83
  export type EndpointBuilder<SrvModule extends ServiceModel = ServiceModel> = (builder: BuildEndpoint<SrvModule>) => {
@@ -3,8 +3,20 @@ import type { SignalContext } from "./signalContext.d.ts";
3
3
  export interface Guard {
4
4
  canPass(context: SignalContext): PromiseOrObject<boolean>;
5
5
  }
6
+ /**
7
+ * What a guard needs in order to answer. `account` reads the caller and nothing else, so it can be evaluated
8
+ * with no arguments — which is what lets a catalogue hide what the caller certainly cannot use. `resource` needs
9
+ * the call's arguments and fails closed without them, so evaluating one early would erase legitimate entries.
10
+ *
11
+ * Required, with no default. Exposure is decided by a guard rather than by an opt-in, so an unmarked guard would
12
+ * silently take the `resource` path and list its endpoint to every caller — the whole guarded surface's names,
13
+ * refused only at call time. There is no safe guess here, so the author states it.
14
+ */
15
+ export type GuardScope = "account" | "resource";
6
16
  export type GuardCls<Name extends string = string> = Cls<Guard, {
7
17
  readonly name: Name;
18
+ readonly scope: GuardScope;
8
19
  }>;
9
20
  /** Creates a named guard base class for signal access checks. */
10
21
  export declare const guard: <T extends string>(name: T) => GuardCls<T>;
22
+ export declare const guardOf: (GuardCls: GuardCls) => Guard;
@@ -1,10 +1,32 @@
1
- import type { Guard } from "./guard.d.ts";
1
+ import { type Guard, type GuardCls, type GuardScope } from "./guard.d.ts";
2
2
  import type { SignalContext } from "./signalContext.d.ts";
3
3
  export declare class Public implements Guard {
4
4
  static name: string;
5
+ static scope: GuardScope;
5
6
  canPass(context: SignalContext): boolean;
6
7
  }
7
8
  export declare class None implements Guard {
8
9
  static name: string;
10
+ static scope: GuardScope;
9
11
  canPass(context: SignalContext): boolean;
10
12
  }
13
+ /**
14
+ * Gate for the `runAgentTurn` relay. Every tool runs in the caller's own browser session, so the LLM key is the
15
+ * one thing this endpoint spends — ungated, any visitor can bill the app's provider through fetch alone.
16
+ *
17
+ * The framework has no account model to gate on, so with no guard registered it refuses every call — the same
18
+ * answer `None` gives. An app names its own at boot, e.g. `AgentRelayAccess.use(Every)`, usually through
19
+ * `option.setAgentAccess(...)`. Several are ANDed, as an endpoint's own `guards` array is.
20
+ */
21
+ export declare class AgentRelayAccess implements Guard {
22
+ #private;
23
+ static name: string;
24
+ static use(guards: GuardCls | GuardCls[] | null): void;
25
+ static get hasPolicy(): boolean;
26
+ /**
27
+ * Whatever the registered guards need, since this one only forwards to them. With none registered it reads the
28
+ * caller and nothing else — the refusal is unconditional — so a listing may still evaluate it argument-free.
29
+ */
30
+ static get scope(): GuardScope;
31
+ canPass(context: SignalContext): Promise<boolean>;
32
+ }
@@ -1,3 +1,7 @@
1
+ export * from "./agent.d.ts";
2
+ export * from "./agent.signal";
3
+ export * from "./agentTurn.d.ts";
4
+ export * from "./agentTurnStream.d.ts";
1
5
  export * from "./base.signal";
2
6
  export * from "./endpoint.d.ts";
3
7
  export * from "./endpointInfo.d.ts";
@@ -8,8 +12,10 @@ export * from "./intercept.d.ts";
8
12
  export * from "./internal.d.ts";
9
13
  export * from "./internalArg.d.ts";
10
14
  export * from "./internalInfo.d.ts";
15
+ export * from "./mcp.d.ts";
11
16
  export * from "./middleware.d.ts";
12
17
  export * from "./openapi.d.ts";
18
+ export * from "./schema.d.ts";
13
19
  export * from "./serializer.d.ts";
14
20
  export * from "./serverSignal.d.ts";
15
21
  export * from "./signalContext.d.ts";
@@ -6,8 +6,8 @@ export type InterceptorCls<Methods = {}, InjectMap extends {
6
6
  [key: string]: InjectInfo;
7
7
  } = {}> = Cls<Methods & ExtractInjectInfoObject<InjectMap> & {
8
8
  readonly logger: Logger;
9
- onInit(): Promise<void>;
10
- onDestroy(): Promise<void>;
9
+ onInit(): Promise<void> | void;
10
+ onDestroy(): Promise<void> | void;
11
11
  intercept(context: SignalContext): AsyncGenerator<unknown> | Promise<unknown>;
12
12
  }, {
13
13
  readonly [INJECT_META]: InjectMap;
@@ -18,14 +18,30 @@ export declare class Res implements InternalArg {
18
18
  redirect(url: string | URL, status?: number): Response;
19
19
  };
20
20
  }
21
- /** Injects websocket state and subscription hooks into message/pubsub handlers. */
21
+ /**
22
+ * Injects the caller's IP, as the nearest proxy recorded it rather than as the socket peer reports it.
23
+ * Behind the federation gateway every peer is the gateway, so an endpoint that reads `remoteAddress` sees
24
+ * `127.0.0.1` for every caller — this reads the forwarded headers first and falls back to the peer only
25
+ * when nothing proxied the call. IPv4 comes back unwrapped from `::ffff:`, so it can address a `udp4`
26
+ * socket. `null` when no proxy recorded one and the transport has no peer.
27
+ */
28
+ export declare class Ip implements InternalArg<string | null> {
29
+ getArg(context: SignalContext): string | null;
30
+ }
31
+ /**
32
+ * Injects websocket state, this connection's id, and subscription hooks into message/pubsub handlers.
33
+ * `socketId` is the one `AppWsData` minted at the handshake, so a handler never reads `ws.data` to
34
+ * tell two callers apart — and never mints an id of its own, which would not match the room bookkeeping.
35
+ * `on`/`off` register cleanup that runs when the room is unsubscribed or the socket closes.
36
+ */
22
37
  export declare class Ws implements InternalArg {
23
- onDisconnect?: () => void;
24
- onUnsubscribe?: () => void;
25
38
  getArg(context: SignalContext): {
26
- ws: Bun.ServerWebSocket<unknown>;
39
+ ws: Bun.ServerWebSocket<{
40
+ socketId: string;
41
+ }>;
42
+ socketId: string;
27
43
  subscribe: boolean;
28
- on: (event: "disconnect" | "unsubscribe", handler: () => void) => void;
29
- off: (event: "disconnect" | "unsubscribe", handler: () => void) => void;
44
+ on: (event: "disconnect" | "unsubscribe", handler: () => PromiseOrObject<void>) => void;
45
+ off: (event: "disconnect" | "unsubscribe", handler: () => PromiseOrObject<void>) => void;
30
46
  };
31
47
  }