gemi 0.62.0 → 0.63.0-rc.1

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 (386) hide show
  1. package/dist/ai/Agent.d.ts +120 -0
  2. package/dist/ai/Agent.d.ts.map +1 -1
  3. package/dist/ai/AgentController.d.ts +290 -18
  4. package/dist/ai/AgentController.d.ts.map +1 -1
  5. package/dist/ai/client/conformance.d.ts +21 -0
  6. package/dist/ai/client/conformance.d.ts.map +1 -0
  7. package/dist/ai/client/index.js +20 -3
  8. package/dist/ai/client/index.js.map +1 -1
  9. package/dist/ai/client/reducer.d.ts.map +1 -1
  10. package/dist/ai/index.d.ts +4 -3
  11. package/dist/ai/index.d.ts.map +1 -1
  12. package/dist/ai/index.js +11 -11
  13. package/dist/ai/index.js.map +10 -9
  14. package/dist/ai/providers/capabilities.d.ts +18 -0
  15. package/dist/ai/providers/capabilities.d.ts.map +1 -1
  16. package/dist/ai/providers/fakeProvider.d.ts +10 -1
  17. package/dist/ai/providers/fakeProvider.d.ts.map +1 -1
  18. package/dist/ai/providers/request.d.ts +17 -0
  19. package/dist/ai/providers/request.d.ts.map +1 -1
  20. package/dist/ai/store/Attachments.d.ts +433 -0
  21. package/dist/ai/store/Attachments.d.ts.map +1 -0
  22. package/dist/ai/store/LiveRuns.d.ts +8 -1
  23. package/dist/ai/store/LiveRuns.d.ts.map +1 -1
  24. package/dist/ai/store/index.d.ts +1 -0
  25. package/dist/ai/store/index.d.ts.map +1 -1
  26. package/dist/ai/types.d.ts +93 -3
  27. package/dist/ai/types.d.ts.map +1 -1
  28. package/dist/ai/useChat.d.ts +33 -4
  29. package/dist/ai/useChat.d.ts.map +1 -1
  30. package/dist/app/App.d.ts +14 -0
  31. package/dist/app/App.d.ts.map +1 -1
  32. package/dist/app/index.js +2 -2
  33. package/dist/app/index.js.map +1 -1
  34. package/dist/auth/AuthController.d.ts +17 -0
  35. package/dist/auth/AuthController.d.ts.map +1 -1
  36. package/dist/auth/UserProvider.d.ts +24 -1
  37. package/dist/auth/UserProvider.d.ts.map +1 -1
  38. package/dist/auth/oauth/GoogleOAuthProvider.d.ts +5 -0
  39. package/dist/auth/oauth/GoogleOAuthProvider.d.ts.map +1 -1
  40. package/dist/auth/oauth/OAuthProvider.d.ts +8 -0
  41. package/dist/auth/oauth/OAuthProvider.d.ts.map +1 -1
  42. package/dist/auth/types.d.ts +9 -0
  43. package/dist/auth/types.d.ts.map +1 -1
  44. package/dist/bin/ai-client/extract.d.ts +36 -0
  45. package/dist/bin/ai-client/extract.d.ts.map +1 -0
  46. package/dist/bin/ai-client/generate.d.ts +22 -0
  47. package/dist/bin/ai-client/generate.d.ts.map +1 -0
  48. package/dist/bin/ai-client/kotlin.d.ts +13 -0
  49. package/dist/bin/ai-client/kotlin.d.ts.map +1 -0
  50. package/dist/bin/ai-client/model.d.ts +99 -0
  51. package/dist/bin/ai-client/model.d.ts.map +1 -0
  52. package/dist/bin/ai-client/swift.d.ts +10 -0
  53. package/dist/bin/ai-client/swift.d.ts.map +1 -0
  54. package/dist/bin/gemi.js +952 -32
  55. package/dist/bin/gemi.js.map +17 -8
  56. package/dist/bin/orm-generator.js +30 -16
  57. package/dist/bin/orm-generator.js.map +2 -2
  58. package/dist/broadcasting/index.js +1 -1
  59. package/dist/bun/plugin.js +1 -1
  60. package/dist/bun/preload.js +2 -2
  61. package/dist/bun/preload.js.map +1 -1
  62. package/dist/chunk-0e5z1x9w.js +18 -0
  63. package/dist/{chunk-v7y8zm61.js.map → chunk-0e5z1x9w.js.map} +5 -4
  64. package/dist/{chunk-yk5wqmyh.js → chunk-0vnbwdy3.js} +2 -2
  65. package/dist/{chunk-yk5wqmyh.js.map → chunk-0vnbwdy3.js.map} +1 -1
  66. package/dist/{chunk-j23cengk.js → chunk-1gvtbywr.js} +2 -2
  67. package/dist/{chunk-j23cengk.js.map → chunk-1gvtbywr.js.map} +1 -1
  68. package/dist/{chunk-wcv6qtpq.js → chunk-1mmd77sp.js} +3 -3
  69. package/dist/{chunk-wcv6qtpq.js.map → chunk-1mmd77sp.js.map} +1 -1
  70. package/dist/chunk-1y8etsy5.js +9 -0
  71. package/dist/{chunk-ybqss0jy.js.map → chunk-1y8etsy5.js.map} +4 -7
  72. package/dist/chunk-2tdy5gc3.js +4 -0
  73. package/dist/{chunk-ds44bqr9.js.map → chunk-2tdy5gc3.js.map} +8 -9
  74. package/dist/{chunk-a1exbqcq.js → chunk-3j1yvdme.js} +2 -2
  75. package/dist/{chunk-a1exbqcq.js.map → chunk-3j1yvdme.js.map} +1 -1
  76. package/dist/chunk-4728yrmt.js +5 -0
  77. package/dist/chunk-4728yrmt.js.map +10 -0
  78. package/dist/chunk-5zem454h.js +6 -0
  79. package/dist/{chunk-cf7bvd12.js.map → chunk-5zem454h.js.map} +2 -2
  80. package/dist/chunk-61v1a1qj.js +5 -0
  81. package/dist/{chunk-tds3xq6b.js.map → chunk-61v1a1qj.js.map} +3 -3
  82. package/dist/chunk-65b9hesw.js +6 -0
  83. package/dist/{chunk-5fj71djg.js.map → chunk-65b9hesw.js.map} +2 -2
  84. package/dist/{chunk-k2sjvt0c.js → chunk-6szg6aga.js} +2 -2
  85. package/dist/{chunk-k2sjvt0c.js.map → chunk-6szg6aga.js.map} +1 -1
  86. package/dist/{chunk-m0tp7zjp.js → chunk-6vhdkcy5.js} +2 -2
  87. package/dist/{chunk-m0tp7zjp.js.map → chunk-6vhdkcy5.js.map} +1 -1
  88. package/dist/chunk-6x7ghyds.js +5 -0
  89. package/dist/chunk-6x7ghyds.js.map +12 -0
  90. package/dist/chunk-7kedxtbp.js +5 -0
  91. package/dist/chunk-7kedxtbp.js.map +10 -0
  92. package/dist/chunk-8g7b5q1v.js +141 -0
  93. package/dist/chunk-8g7b5q1v.js.map +22 -0
  94. package/dist/{chunk-tkdxv6cq.js → chunk-8z37k28d.js} +2 -2
  95. package/dist/{chunk-tkdxv6cq.js.map → chunk-8z37k28d.js.map} +1 -1
  96. package/dist/{chunk-5ad8era8.js → chunk-9a8qz3s7.js} +2 -2
  97. package/dist/{chunk-5ad8era8.js.map → chunk-9a8qz3s7.js.map} +1 -1
  98. package/dist/{chunk-rpjsmr41.js → chunk-9fnvfjc3.js} +2 -2
  99. package/dist/{chunk-rpjsmr41.js.map → chunk-9fnvfjc3.js.map} +1 -1
  100. package/dist/chunk-9tmwwtbm.js +5 -0
  101. package/dist/chunk-9tmwwtbm.js.map +11 -0
  102. package/dist/{chunk-x6y1z4cq.js → chunk-9y0ta780.js} +2 -2
  103. package/dist/{chunk-x6y1z4cq.js.map → chunk-9y0ta780.js.map} +1 -1
  104. package/dist/{chunk-ywntv8yw.js → chunk-amne2jdr.js} +3 -3
  105. package/dist/{chunk-ywntv8yw.js.map → chunk-amne2jdr.js.map} +1 -1
  106. package/dist/{chunk-hsfjt13m.js → chunk-apn07kkc.js} +1 -1
  107. package/dist/{chunk-hxb1eg2z.js → chunk-awsf2zsg.js} +2 -2
  108. package/dist/chunk-awsf2zsg.js.map +10 -0
  109. package/dist/{chunk-exndjhza.js → chunk-ay29dp5h.js} +2 -2
  110. package/dist/{chunk-exndjhza.js.map → chunk-ay29dp5h.js.map} +1 -1
  111. package/dist/chunk-c96xf434.js +4 -0
  112. package/dist/chunk-c96xf434.js.map +10 -0
  113. package/dist/{chunk-57a0nqfj.js → chunk-cbsfk6zk.js} +2 -2
  114. package/dist/chunk-cbsfk6zk.js.map +10 -0
  115. package/dist/{chunk-snb68dgr.js → chunk-deqxja6d.js} +1 -1
  116. package/dist/{chunk-9nmvm20t.js → chunk-e4ez431n.js} +2 -2
  117. package/dist/{chunk-9nmvm20t.js.map → chunk-e4ez431n.js.map} +1 -1
  118. package/dist/{chunk-ms13evzp.js → chunk-e91rq603.js} +2 -2
  119. package/dist/{chunk-ms13evzp.js.map → chunk-e91rq603.js.map} +1 -1
  120. package/dist/{chunk-gcszdwcb.js → chunk-ekddz8bc.js} +2 -2
  121. package/dist/{chunk-gcszdwcb.js.map → chunk-ekddz8bc.js.map} +1 -1
  122. package/dist/{chunk-k75phgj4.js → chunk-emj59xa9.js} +4 -4
  123. package/dist/{chunk-k75phgj4.js.map → chunk-emj59xa9.js.map} +1 -1
  124. package/dist/chunk-eww1fdv8.js +5 -0
  125. package/dist/chunk-eww1fdv8.js.map +10 -0
  126. package/dist/{chunk-1aqzcgfr.js → chunk-f7tvbpvy.js} +3 -3
  127. package/dist/{chunk-1aqzcgfr.js.map → chunk-f7tvbpvy.js.map} +1 -1
  128. package/dist/{chunk-wpb1xpdp.js → chunk-f8z4h69j.js} +2 -2
  129. package/dist/{chunk-wpb1xpdp.js.map → chunk-f8z4h69j.js.map} +1 -1
  130. package/dist/{chunk-5mhcwnyd.js → chunk-fkedjx42.js} +2 -2
  131. package/dist/{chunk-5mhcwnyd.js.map → chunk-fkedjx42.js.map} +1 -1
  132. package/dist/chunk-fn138g2s.js +24 -0
  133. package/dist/chunk-fn138g2s.js.map +16 -0
  134. package/dist/chunk-gp6h39z2.js +5 -0
  135. package/dist/chunk-gp6h39z2.js.map +16 -0
  136. package/dist/{chunk-ejrcyzx8.js → chunk-gvkydx8r.js} +2 -2
  137. package/dist/{chunk-ejrcyzx8.js.map → chunk-gvkydx8r.js.map} +1 -1
  138. package/dist/{chunk-8ag0da2s.js → chunk-gwcmkj1b.js} +2 -2
  139. package/dist/{chunk-8ag0da2s.js.map → chunk-gwcmkj1b.js.map} +1 -1
  140. package/dist/{chunk-tr3cbx8k.js → chunk-gyqn6rkq.js} +3 -3
  141. package/dist/{chunk-tr3cbx8k.js.map → chunk-gyqn6rkq.js.map} +1 -1
  142. package/dist/{chunk-djp2xeqe.js → chunk-jcznxakf.js} +3 -3
  143. package/dist/{chunk-djp2xeqe.js.map → chunk-jcznxakf.js.map} +2 -2
  144. package/dist/{chunk-ygfwtgvm.js → chunk-jdj1fdm3.js} +2 -2
  145. package/dist/{chunk-ygfwtgvm.js.map → chunk-jdj1fdm3.js.map} +1 -1
  146. package/dist/{chunk-5gdv4n4a.js → chunk-k53g6pnh.js} +3 -3
  147. package/dist/{chunk-5gdv4n4a.js.map → chunk-k53g6pnh.js.map} +1 -1
  148. package/dist/{chunk-528n3vgy.js → chunk-kda1qzkg.js} +2 -2
  149. package/dist/{chunk-528n3vgy.js.map → chunk-kda1qzkg.js.map} +1 -1
  150. package/dist/{chunk-fz5g2z6h.js → chunk-mdz5ej28.js} +2 -2
  151. package/dist/{chunk-fz5g2z6h.js.map → chunk-mdz5ej28.js.map} +1 -1
  152. package/dist/{chunk-9xpa7dpy.js → chunk-mtr7ckwn.js} +2 -2
  153. package/dist/{chunk-9xpa7dpy.js.map → chunk-mtr7ckwn.js.map} +1 -1
  154. package/dist/{chunk-7t1hjs9f.js → chunk-n2p97c8j.js} +2 -2
  155. package/dist/{chunk-7t1hjs9f.js.map → chunk-n2p97c8j.js.map} +1 -1
  156. package/dist/chunk-phea81f3.js +19 -0
  157. package/dist/{chunk-hk06nhxh.js.map → chunk-phea81f3.js.map} +12 -18
  158. package/dist/chunk-pspcnvxp.js +5 -0
  159. package/dist/{chunk-kac5vmvn.js.map → chunk-pspcnvxp.js.map} +8 -7
  160. package/dist/{chunk-fb4cy6sq.js → chunk-pzmzp7dx.js} +2 -2
  161. package/dist/{chunk-fb4cy6sq.js.map → chunk-pzmzp7dx.js.map} +1 -1
  162. package/dist/{chunk-71pk1mxx.js → chunk-q09y4xkz.js} +2 -2
  163. package/dist/{chunk-4dan69s4.js.map → chunk-q09y4xkz.js.map} +1 -1
  164. package/dist/{chunk-cyrxdj6a.js → chunk-rq6hfhtp.js} +2 -2
  165. package/dist/{chunk-cyrxdj6a.js.map → chunk-rq6hfhtp.js.map} +1 -1
  166. package/dist/{chunk-p3qd0gqa.js → chunk-safv6h9x.js} +2 -2
  167. package/dist/{chunk-p3qd0gqa.js.map → chunk-safv6h9x.js.map} +1 -1
  168. package/dist/{chunk-f233yzxf.js → chunk-sse0wcb1.js} +11 -11
  169. package/dist/chunk-sse0wcb1.js.map +10 -0
  170. package/dist/{chunk-xecj8025.js → chunk-t45f5k7r.js} +3 -3
  171. package/dist/{chunk-xecj8025.js.map → chunk-t45f5k7r.js.map} +1 -1
  172. package/dist/{chunk-1b7e9rj7.js → chunk-t9evs0wf.js} +2 -2
  173. package/dist/{chunk-1b7e9rj7.js.map → chunk-t9evs0wf.js.map} +1 -1
  174. package/dist/chunk-v0x436vz.js +5 -0
  175. package/dist/{chunk-q6qghsy7.js.map → chunk-v0x436vz.js.map} +1 -1
  176. package/dist/{chunk-3296fwss.js → chunk-vcwm0fcq.js} +2 -2
  177. package/dist/{chunk-3296fwss.js.map → chunk-vcwm0fcq.js.map} +1 -1
  178. package/dist/{chunk-7xvaace2.js → chunk-vgcd2c3t.js} +2 -2
  179. package/dist/{chunk-7xvaace2.js.map → chunk-vgcd2c3t.js.map} +1 -1
  180. package/dist/{chunk-bb19bwg6.js → chunk-vhwtc2jk.js} +2 -2
  181. package/dist/{chunk-bb19bwg6.js.map → chunk-vhwtc2jk.js.map} +1 -1
  182. package/dist/chunk-ws7wycyy.js +5 -0
  183. package/dist/chunk-ws7wycyy.js.map +17 -0
  184. package/dist/{chunk-r962ae93.js → chunk-x7nkv1xy.js} +2 -2
  185. package/dist/{chunk-r962ae93.js.map → chunk-x7nkv1xy.js.map} +1 -1
  186. package/dist/{chunk-m45j7p1y.js → chunk-x7zp4p7d.js} +2 -2
  187. package/dist/{chunk-m45j7p1y.js.map → chunk-x7zp4p7d.js.map} +1 -1
  188. package/dist/{chunk-htesx7ym.js → chunk-y2hjapnh.js} +3 -3
  189. package/dist/{chunk-htesx7ym.js.map → chunk-y2hjapnh.js.map} +1 -1
  190. package/dist/chunk-yfp9y444.js +5 -0
  191. package/dist/chunk-yfp9y444.js.map +11 -0
  192. package/dist/{chunk-4dan69s4.js → chunk-ymh919gr.js} +2 -2
  193. package/dist/{chunk-71pk1mxx.js.map → chunk-ymh919gr.js.map} +1 -1
  194. package/dist/chunk-yzqy6vt0.js +55 -0
  195. package/dist/chunk-yzqy6vt0.js.map +11 -0
  196. package/dist/chunk-zpzbdnyc.js +5 -0
  197. package/dist/chunk-zpzbdnyc.js.map +10 -0
  198. package/dist/chunk-zq5m4scz.js +5 -0
  199. package/dist/chunk-zq5m4scz.js.map +10 -0
  200. package/dist/{chunk-yf8kxjr2.js → chunk-zytmxty5.js} +2 -2
  201. package/dist/{chunk-yf8kxjr2.js.map → chunk-zytmxty5.js.map} +1 -1
  202. package/dist/chunks/{ThemeProvider-BZ2SsSZ3.js → ThemeProvider-CiBing7u.js} +20 -8
  203. package/dist/chunks/ThemeProvider-CiBing7u.js.map +1 -0
  204. package/dist/client/ClientRouter.d.ts.map +1 -1
  205. package/dist/client/ClientRouterContext.d.ts +2 -0
  206. package/dist/client/ClientRouterContext.d.ts.map +1 -1
  207. package/dist/client/ServerDataProvider.d.ts +2 -0
  208. package/dist/client/ServerDataProvider.d.ts.map +1 -1
  209. package/dist/client/index.js +5 -3
  210. package/dist/client/index.js.map +1 -1
  211. package/dist/client/useDictionary.d.ts.map +1 -1
  212. package/dist/config/assetBase.d.ts +52 -0
  213. package/dist/config/assetBase.d.ts.map +1 -0
  214. package/dist/config/index.d.ts +9 -0
  215. package/dist/config/index.d.ts.map +1 -1
  216. package/dist/config/index.js +1 -1
  217. package/dist/config/index.js.map +2 -2
  218. package/dist/console/run.js +2 -2
  219. package/dist/console/run.js.map +2 -2
  220. package/dist/container/index.js +2 -2
  221. package/dist/container/index.js.map +1 -1
  222. package/dist/database/index.js +2 -2
  223. package/dist/database/index.js.map +1 -1
  224. package/dist/email/index.js +2 -2
  225. package/dist/email/index.js.map +1 -1
  226. package/dist/facades/Auth.d.ts.map +1 -1
  227. package/dist/facades/index.js +2 -2
  228. package/dist/facades/index.js.map +1 -1
  229. package/dist/foundation/Application.d.ts +36 -0
  230. package/dist/foundation/Application.d.ts.map +1 -1
  231. package/dist/foundation/index.d.ts +1 -1
  232. package/dist/foundation/index.d.ts.map +1 -1
  233. package/dist/foundation/index.js +2 -2
  234. package/dist/foundation/index.js.map +1 -1
  235. package/dist/gemi.d.ts +7 -0
  236. package/dist/http/ApiRouter.d.ts +18 -0
  237. package/dist/http/ApiRouter.d.ts.map +1 -1
  238. package/dist/http/HttpRequest.d.ts +13 -0
  239. package/dist/http/HttpRequest.d.ts.map +1 -1
  240. package/dist/http/McpRouter.d.ts +207 -0
  241. package/dist/http/McpRouter.d.ts.map +1 -0
  242. package/dist/http/McpRouter.test-d.d.ts +2 -0
  243. package/dist/http/McpRouter.test-d.d.ts.map +1 -0
  244. package/dist/http/RateLimitMiddleware.d.ts +13 -0
  245. package/dist/http/RateLimitMiddleware.d.ts.map +1 -1
  246. package/dist/http/errors.d.ts +23 -0
  247. package/dist/http/errors.d.ts.map +1 -1
  248. package/dist/http/getCookies.d.ts +15 -0
  249. package/dist/http/getCookies.d.ts.map +1 -1
  250. package/dist/http/index.d.ts +1 -0
  251. package/dist/http/index.d.ts.map +1 -1
  252. package/dist/http/index.js +2 -2
  253. package/dist/http/index.js.map +1 -1
  254. package/dist/http/middleware-config.d.ts +10 -1
  255. package/dist/http/middleware-config.d.ts.map +1 -1
  256. package/dist/http/modelOriginated.d.ts +21 -0
  257. package/dist/http/modelOriginated.d.ts.map +1 -0
  258. package/dist/http/requestContext.d.ts +34 -0
  259. package/dist/http/requestContext.d.ts.map +1 -1
  260. package/dist/i18n/defineDictionary.d.ts +4 -2
  261. package/dist/i18n/defineDictionary.d.ts.map +1 -1
  262. package/dist/i18n/dictionaryRegistry.d.ts +18 -1
  263. package/dist/i18n/dictionaryRegistry.d.ts.map +1 -1
  264. package/dist/i18n/dictionaryRuntime.js +2 -2
  265. package/dist/i18n/dictionaryRuntime.js.map +1 -1
  266. package/dist/i18n/index.js +2 -2
  267. package/dist/i18n/index.js.map +2 -2
  268. package/dist/kernel/Kernel.d.ts +12 -1
  269. package/dist/kernel/Kernel.d.ts.map +1 -1
  270. package/dist/kernel/index.js +3 -3
  271. package/dist/kernel/index.js.map +5 -4
  272. package/dist/orm/compile/unique.d.ts +1 -1
  273. package/dist/orm/dialect/postgres.d.ts.map +1 -1
  274. package/dist/orm/errors.d.ts +8 -0
  275. package/dist/orm/errors.d.ts.map +1 -1
  276. package/dist/orm/fixtures.d.ts +1 -1
  277. package/dist/orm/index.js +2 -2
  278. package/dist/orm/index.js.map +5 -5
  279. package/dist/server/Server.d.ts +27 -1
  280. package/dist/server/Server.d.ts.map +1 -1
  281. package/dist/server/httpDev.d.ts.map +1 -1
  282. package/dist/server/httpProd.d.ts.map +1 -1
  283. package/dist/server/index.d.ts +1 -0
  284. package/dist/server/index.d.ts.map +1 -1
  285. package/dist/server/index.js +2 -2
  286. package/dist/server/index.js.map +3 -3
  287. package/dist/server/modulePreloads.d.ts +4 -2
  288. package/dist/server/modulePreloads.d.ts.map +1 -1
  289. package/dist/server/shutdown.d.ts +113 -0
  290. package/dist/server/shutdown.d.ts.map +1 -0
  291. package/dist/server/staticAssetMiss.d.ts +29 -0
  292. package/dist/server/staticAssetMiss.d.ts.map +1 -0
  293. package/dist/server/unhandledError.d.ts +2 -0
  294. package/dist/server/unhandledError.d.ts.map +1 -0
  295. package/dist/services/events/EventManager.d.ts +1 -1
  296. package/dist/services/events/EventManager.d.ts.map +1 -1
  297. package/dist/services/index.d.ts +6 -2
  298. package/dist/services/index.d.ts.map +1 -1
  299. package/dist/services/index.js +9 -9
  300. package/dist/services/index.js.map +4 -4
  301. package/dist/services/mcp/McpRegistry.d.ts +150 -0
  302. package/dist/services/mcp/McpRegistry.d.ts.map +1 -0
  303. package/dist/services/mcp/toAgentTools.d.ts +20 -0
  304. package/dist/services/mcp/toAgentTools.d.ts.map +1 -0
  305. package/dist/services/middleware/MiddlewareRegistry.d.ts +17 -0
  306. package/dist/services/middleware/MiddlewareRegistry.d.ts.map +1 -1
  307. package/dist/services/middleware/MiddlewareServiceProvider.d.ts +1 -0
  308. package/dist/services/middleware/MiddlewareServiceProvider.d.ts.map +1 -1
  309. package/dist/services/pubsub/BroadcastManager.d.ts.map +1 -1
  310. package/dist/services/queue/DatabaseQueueDriver.d.ts +137 -0
  311. package/dist/services/queue/DatabaseQueueDriver.d.ts.map +1 -0
  312. package/dist/services/queue/Job.d.ts +17 -1
  313. package/dist/services/queue/Job.d.ts.map +1 -1
  314. package/dist/services/queue/MemoryQueueDriver.d.ts +51 -0
  315. package/dist/services/queue/MemoryQueueDriver.d.ts.map +1 -0
  316. package/dist/services/queue/QueueDriver.d.ts +116 -0
  317. package/dist/services/queue/QueueDriver.d.ts.map +1 -0
  318. package/dist/services/queue/QueueManager.d.ts +154 -13
  319. package/dist/services/queue/QueueManager.d.ts.map +1 -1
  320. package/dist/services/queue/QueueServiceProvider.d.ts +44 -0
  321. package/dist/services/queue/QueueServiceProvider.d.ts.map +1 -1
  322. package/dist/services/queue/config.d.ts +43 -1
  323. package/dist/services/queue/config.d.ts.map +1 -1
  324. package/dist/services/queue/queueDriverContract.d.ts +21 -0
  325. package/dist/services/queue/queueDriverContract.d.ts.map +1 -0
  326. package/dist/services/router/ApiRouteDispatcher.d.ts +101 -3
  327. package/dist/services/router/ApiRouteDispatcher.d.ts.map +1 -1
  328. package/dist/services/router/RouteServiceProvider.d.ts +6 -4
  329. package/dist/services/router/RouteServiceProvider.d.ts.map +1 -1
  330. package/dist/services/router/ViewRouteDispatcher.d.ts +13 -0
  331. package/dist/services/router/ViewRouteDispatcher.d.ts.map +1 -1
  332. package/dist/services/router/apiPath.d.ts +23 -0
  333. package/dist/services/router/apiPath.d.ts.map +1 -0
  334. package/dist/services/router/config.d.ts +5 -0
  335. package/dist/services/router/config.d.ts.map +1 -1
  336. package/dist/services/router/createFlatApiRoutes.d.ts +3 -1
  337. package/dist/services/router/createFlatApiRoutes.d.ts.map +1 -1
  338. package/dist/services/router/globalMiddleware.d.ts +33 -0
  339. package/dist/services/router/globalMiddleware.d.ts.map +1 -0
  340. package/dist/services/router/policyDenied.d.ts +28 -0
  341. package/dist/services/router/policyDenied.d.ts.map +1 -0
  342. package/dist/support/ServiceProvider.d.ts +22 -3
  343. package/dist/support/ServiceProvider.d.ts.map +1 -1
  344. package/dist/support/discover.d.ts +2 -2
  345. package/dist/support/index.js +2 -2
  346. package/dist/support/index.js.map +1 -1
  347. package/dist/testing/index.js +1 -1
  348. package/dist/vite/index.mjs +83 -2
  349. package/package.json +5 -1
  350. package/skills/gemi-react-best-practices/SKILL.md +1 -1
  351. package/skills/gemi-react-best-practices/rules/controller-authorize-every-tenant-read.md +1 -1
  352. package/skills/gemi-react-best-practices/rules/controller-throw-framework-errors.md +1 -1
  353. package/skills/gemi-react-best-practices/rules/orm-transaction-no-io.md +2 -1
  354. package/skills/gemi-react-best-practices/rules/routing-middleware-dsl.md +5 -0
  355. package/skills/gemi-react-best-practices/rules/service-queue-is-in-memory.md +13 -4
  356. package/dist/chunk-57a0nqfj.js.map +0 -10
  357. package/dist/chunk-5fj71djg.js +0 -6
  358. package/dist/chunk-8r8epsef.js +0 -5
  359. package/dist/chunk-8r8epsef.js.map +0 -11
  360. package/dist/chunk-9penj44g.js +0 -5
  361. package/dist/chunk-9penj44g.js.map +0 -14
  362. package/dist/chunk-b0t4zp6b.js +0 -37
  363. package/dist/chunk-b0t4zp6b.js.map +0 -20
  364. package/dist/chunk-cf7bvd12.js +0 -6
  365. package/dist/chunk-ds44bqr9.js +0 -4
  366. package/dist/chunk-f233yzxf.js.map +0 -10
  367. package/dist/chunk-hk06nhxh.js +0 -19
  368. package/dist/chunk-hxb1eg2z.js.map +0 -10
  369. package/dist/chunk-k4a2gzyc.js +0 -55
  370. package/dist/chunk-k4a2gzyc.js.map +0 -11
  371. package/dist/chunk-kac5vmvn.js +0 -5
  372. package/dist/chunk-mca9wsvs.js +0 -5
  373. package/dist/chunk-mca9wsvs.js.map +0 -11
  374. package/dist/chunk-q6qghsy7.js +0 -5
  375. package/dist/chunk-sz051605.js +0 -5
  376. package/dist/chunk-sz051605.js.map +0 -14
  377. package/dist/chunk-tds3xq6b.js +0 -5
  378. package/dist/chunk-v7y8zm61.js +0 -17
  379. package/dist/chunk-xnytbrda.js +0 -4
  380. package/dist/chunk-xnytbrda.js.map +0 -10
  381. package/dist/chunk-ybqss0jy.js +0 -9
  382. package/dist/chunk-ys904esh.js +0 -5
  383. package/dist/chunk-ys904esh.js.map +0 -10
  384. package/dist/chunks/ThemeProvider-BZ2SsSZ3.js.map +0 -1
  385. /package/dist/{chunk-hsfjt13m.js.map → chunk-apn07kkc.js.map} +0 -0
  386. /package/dist/{chunk-snb68dgr.js.map → chunk-deqxja6d.js.map} +0 -0
@@ -1,6 +1,7 @@
1
1
  import type { HttpRequest } from "../http";
2
2
  import type { AgentProvider } from "./AgentProvider";
3
3
  import type { Infer, Schema } from "./Schema";
4
+ import type { ScopedAttachments, ToolAttachments } from "./store/Attachments";
4
5
  import type { AgentMessage, AgentStreamEvent, AgentStreamFrame, ClientTurn, FinishReason, NestedRun, PendingToolCall, ToolShapes, Usage } from "./types";
5
6
  /**
6
7
  * Everything a tool needs from the request it is running inside.
@@ -40,6 +41,43 @@ export interface ToolContext {
40
41
  * to tell it otherwise: the tool body ran once already.
41
42
  */
42
43
  readonly resumed: boolean;
44
+ /**
45
+ * Files, both directions.
46
+ *
47
+ * WHAT THIS FIXES. Before it, files travelled one way: a user's upload became
48
+ * a provider file id the model could look at, and a tool that *produced*
49
+ * something — an edited image, a rendered chart — had a string to return and
50
+ * nowhere to put the bytes. `put(blob)` parks them and answers a record whose
51
+ * `id` is the handle everything else uses; `put(blob, { showModel: true })`
52
+ * also sends them to the provider and puts them in front of the model as an
53
+ * input-role message once this tool call settles, which is what makes
54
+ * generate → look → fix a loop rather than a one-way report.
55
+ *
56
+ * SCOPED, AND THAT IS THE WHOLE SECURITY STORY. The object is built from the
57
+ * `ScopedAttachments` the controller resolved for *this request* (see
58
+ * `AgentController.attachmentScope`), and none of its methods takes a scope,
59
+ * so there is nothing for a tool to pass the model's arguments into. An id
60
+ * that came from another user resolves to `AttachmentNotFoundError`, with the
61
+ * same wording an unknown id gets.
62
+ *
63
+ * PER TOOL CALL, LIKE `runAgent`, AND FOR THE SAME REASON. `put` is memoized
64
+ * by call index within the tool call, so a tool that escalates and is
65
+ * re-entered does not store, upload or inject a second time. Read the note on
66
+ * `ToolAttachments.put` before writing a body whose `put` calls sit in a
67
+ * branch.
68
+ *
69
+ * ALWAYS PRESENT, NEVER NULL. A request with no attachment scope — an
70
+ * unauthenticated, thread-less chat — gets an object whose every method
71
+ * throws with a sentence naming `attachmentScope()`. A nullable `ctx`
72
+ * member would be a guard every tool has to remember and most would not,
73
+ * and the failure of forgetting is a `TypeError` in a tool body rather than
74
+ * an explanation.
75
+ */
76
+ attachments: ToolAttachments;
77
+ /**
78
+ * What the user sent with the turn this tool call answers. See `ToolTurn`.
79
+ */
80
+ readonly turn: ToolTurn;
43
81
  /**
44
82
  * Runs another agent from inside this tool, wired into the parent run.
45
83
  *
@@ -86,6 +124,72 @@ export interface ToolContext {
86
124
  */
87
125
  runAgent<A extends AnyAgent>(agent: A, params?: RunAgentParams): Promise<NestedRunResult>;
88
126
  }
127
+ /**
128
+ * The files of the turn a tool call belongs to, as data the model cannot write.
129
+ *
130
+ * WHAT THIS FIXES. Every method on `ctx.attachments` takes an id, and before
131
+ * this the only ids a tool could get were the ones the model put in its
132
+ * arguments. So a tool meant to use "the image the user attached" had to trust
133
+ * the model to name it, and a prompt-injected document could name a different
134
+ * upload of the same user's — yesterday's contract instead of today's photo —
135
+ * which the scope check passes, because it is the user's file. Reading the ids
136
+ * from here instead leaves the model nothing to steer.
137
+ *
138
+ * WHICH TURN: THE USER MESSAGE BEFORE THIS CALL, NOT THE LATEST ONE. Found by
139
+ * walking back from the assistant message that made the call, never by taking
140
+ * the last user message in the history when the tool runs, and the difference
141
+ * is re-entry. An escalating tool runs again from the top on a later turn (see
142
+ * `runAgent`), and "latest" is recomputed each time: a turn that answers the
143
+ * sub-agent can carry text or files of its own, and when the re-entered tool
144
+ * asks again, that turn's user message is appended *after* the still-open call
145
+ * — so on the next re-entry "latest" is the answer turn, and a tool that read
146
+ * "the image" would pick a different file, or none, on its second attempt. The
147
+ * replay checks do not reliably catch that: `putMismatch` compares the media
148
+ * type and showModel, never the bytes, and a sub-run seeded with the file as
149
+ * a message part fingerprints as `<file>` whichever file it was. The message
150
+ * that preceded the call is in the history on every attempt and does not
151
+ * move, so every attempt sees the same list.
152
+ *
153
+ * ONE TURN, NOT THE THREAD. The whole thread is what "the image I sent earlier"
154
+ * needs, and it is the wider thing to bind to: a tool that picks "the first
155
+ * image" out of forty turns picks whichever one the history happens to put
156
+ * first, and the user who uploaded a new one sees the old one used. A tool that
157
+ * wants earlier turns can take an id from the model and let the scope check it;
158
+ * one that binds should bind to the turn the user is looking at. A turn with
159
+ * text and no files gives an empty list, which is also the answer to "the user
160
+ * attached nothing this time".
161
+ *
162
+ * NOT THE FILES A TOOL MADE. A file a tool showed with `put(…, { showModel:
163
+ * true })` is injected as a user-role message and carries an `attachmentId`
164
+ * too, and taking it would make it "the user's upload" to the next tool — so
165
+ * the walk steps over every message a tool call's record names as injected,
166
+ * the same test `historyForProvider` uses. A tool that wants what an earlier
167
+ * tool produced has that tool's result to read the id from.
168
+ *
169
+ * IDS ONLY, AND NOT TRUSTED. The name and type beside them on the `FilePart`
170
+ * are what the client said, so they are left off rather than offered as a
171
+ * second, weaker copy of what `ctx.attachments.get(id)` answers from the
172
+ * store. And the ids themselves are only as trustworthy as the history they
173
+ * came from — which, for a stateless client, is whatever it posted. That is
174
+ * fine for the reason everything else about attachments is fine: resolution
175
+ * goes through `ctx.attachments`, whose scope was fixed by the request, so an
176
+ * id from somebody else's upload answers `AttachmentNotFoundError` here
177
+ * exactly as it would from the model's arguments. This list narrows which of
178
+ * the caller's own files a tool reaches for; it grants nothing.
179
+ *
180
+ * Inside a sub-run the turn is the sub-run's own: the message its parent's
181
+ * tool started it with, which has files only if that tool put them there. The
182
+ * parent's upload is not inherited — the tool that called `runAgent` read its
183
+ * own `ctx.turn` and decided what the sub-agent is given.
184
+ */
185
+ export interface ToolTurn {
186
+ /**
187
+ * The `attachmentId`s on that user message's file parts, in order, without
188
+ * duplicates, and only ids of gemi's own shape. Frozen, and computed once
189
+ * before the body runs.
190
+ */
191
+ readonly attachments: readonly string[];
192
+ }
89
193
  /** What `ctx.runAgent` is given. `messages` and `prompt` are alternatives. */
90
194
  export interface RunAgentParams {
91
195
  /** Prior turns for the sub-agent. Starts empty when omitted. */
@@ -435,6 +539,22 @@ export interface AgentStreamParams {
435
539
  * pending call is resolved later; a store keyed by id should upsert.
436
540
  */
437
541
  onMessage?: (message: AgentMessage) => void | Promise<void>;
542
+ /**
543
+ * The attachment handle every tool of this run is given as `ctx.attachments`.
544
+ *
545
+ * Resolved by the controller from the request — `attachmentsFor(req,
546
+ * threadId)` — and passed in rather than reached for, because the scope is a
547
+ * fact about the caller and the run has no way to derive one. `null`, or
548
+ * omitted, is a request with no subject: the object tools get still exists
549
+ * and every method on it throws a sentence naming `attachmentScope()`.
550
+ *
551
+ * Handed down unchanged to a sub-run started by `ctx.runAgent`. A sub-agent
552
+ * is running on behalf of the same caller — that is the only reason it is
553
+ * allowed to run at all — so it reads and writes the same scope, and a tool
554
+ * three levels down can be given an id its parent parked. Widening it here
555
+ * would be the confused-deputy hole in reverse.
556
+ */
557
+ attachments?: ScopedAttachments | null;
438
558
  /**
439
559
  * Set by `ctx.runAgent` and by nothing else.
440
560
  *
@@ -1 +1 @@
1
- {"version":3,"file":"Agent.d.ts","sourceRoot":"","sources":["../../ai/Agent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,KAAK,EACV,aAAa,EAGd,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAW9C,OAAO,KAAK,EAEV,YAAY,EACZ,gBAAgB,EAChB,gBAAgB,EAEhB,UAAU,EACV,YAAY,EACZ,SAAS,EACT,eAAe,EAGf,UAAU,EACV,KAAK,EACN,MAAM,SAA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AEnC,OAAO;IAyBP,MAAM,CAAC,MAAM,CACX,KAAK,CAAC,CAAC,SAAS,SAAS,SAAS,EAAE,EACpC,KAAK,CAAC,CAAC,SAAS,SAAS,KAAK,EAAE,EAChC,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,GAAG,SAAS,EAC7C,MAAM,EAAE,iBAAiB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IAIrD,MAAM,CAAC,MAAM,EAAE,iBAAiB,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;CAY1E;AAED,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;AAEnE,MAAM,MAAM,QAAQ,GAAG,KAAK,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC"}
@@ -2,6 +2,7 @@ import { Controller } from "../http/Controller";
2
2
  import { HttpRequest } from "../http/HttpRequest";
3
3
  import type { MiddlewareInput } from "../http/middlewareList";
4
4
  import type { AgentRun, AgentRunResult, AnyAgent, ToolShapesOf } from "./Agent";
5
+ import { type AttachmentDestination, type AttachmentScope, type AttachmentStorage, type AttachmentStore, ScopedAttachments } from "./store/Attachments";
5
6
  import { FrameCursorEvictedError, liveRuns as defaultLiveRuns, LiveRunNotFoundError, MemoryLiveRuns } from "./store/LiveRuns";
6
7
  import { defaultAgentStore, MemoryAgentStore } from "./store/MemoryAgentStore";
7
8
  import type { AgentError, AgentMessage, PendingToolCall, ToolShapes } from "./types";
@@ -58,6 +59,8 @@ export interface AgentStore {
58
59
  }
59
60
  /** The default: conversations last as long as the process. */
60
61
  export { defaultAgentStore, MemoryAgentStore };
62
+ /** The attachment half of the same story. See `store/Attachments.ts`. */
63
+ export { type Attachment, type AttachmentDestination, AttachmentNotFoundError, type AttachmentScope, type AttachmentStorage, type AttachmentStore, defaultAttachmentStore, InvalidAttachmentScopeError, MemoryAttachmentStore, type PutAttachmentParams, ScopedAttachments, type ToolAttachmentPut, type ToolAttachmentRecord, type ToolAttachments, } from "./store/Attachments";
61
64
  /**
62
65
  * The runs currently in flight, and their frames.
63
66
  *
@@ -96,6 +99,59 @@ export type AgentHookContext = {
96
99
  runId: string;
97
100
  threadId?: string;
98
101
  };
102
+ /**
103
+ * What `POST /<path>/files` answers.
104
+ *
105
+ * TWO IDS, AND THEY ARE NOT INTERCHANGEABLE. `fileId` is the *provider's* id and
106
+ * means exactly what it always meant — the value a `FilePart` carries so the
107
+ * model can see the file. `attachmentId` is *gemi's*, and is the handle a tool
108
+ * resolves through `ScopedAttachments` to get the bytes back. A file can have
109
+ * both, and usually does.
110
+ *
111
+ * `fileId` stays first and stays named that on purpose: `useChat.uploadFile`
112
+ * already reads it, apps already put it in a `FilePart`, and renaming it or
113
+ * folding the two into one id would break vision for every existing app while
114
+ * looking like a tidier API. The two ids exist because there are two systems
115
+ * holding the file.
116
+ *
117
+ * Both are optional, and `destination` says which to expect: `provider` has no
118
+ * `attachmentId` (nothing was kept), `storage` has no `fileId` (the provider
119
+ * never saw it, so there is nothing for a `FilePart` to point at), `both` has
120
+ * both.
121
+ *
122
+ * `destination` ALONE IS NOT ENOUGH TO SAY WHY AN ID IS MISSING, which is why
123
+ * `downgraded` is here. An upload that reached a route with no authentication
124
+ * and no `threadId` answers `destination: "provider"` — truthfully, that is
125
+ * where the bytes went — and so does a controller that deliberately returns
126
+ * `"provider"` from `attachmentDestination`. Those two answers were byte
127
+ * identical, and they are the opposite situations: one is the app's policy
128
+ * working, the other is the app's policy silently not applying because the
129
+ * server could not tell who was calling. The server logs the second one once
130
+ * per process; the client saw nothing at all. `downgraded` is the difference,
131
+ * carried in the answer so a client — or an integration test — can assert on
132
+ * it.
133
+ */
134
+ export type UploadResult = {
135
+ /** The provider's id, for a `FilePart`. Absent when the file never went there. */
136
+ fileId?: string;
137
+ /** gemi's id, for a tool. Absent when nothing was kept — see `attachmentScope`. */
138
+ attachmentId?: string;
139
+ name: string;
140
+ mimeType: string;
141
+ size: number;
142
+ destination: AttachmentDestination;
143
+ /**
144
+ * Set only when the app's policy asked for a copy and the request had no
145
+ * subject to file it under, so the upload fell back to the provider alone.
146
+ * Absent when `destination` is what the app actually chose.
147
+ *
148
+ * A string rather than `true` because there is exactly one reason today and
149
+ * there will be more (a store that refused the write, say), and a boolean
150
+ * that later needs a reason beside it is two fields where one would have
151
+ * done.
152
+ */
153
+ downgraded?: "no_scope";
154
+ };
99
155
  /**
100
156
  * `Controller.kind` is typed as the literal `"controller"`, so a subclass that
101
157
  * declares a `kind` of its own fails the static-side check (TS2417). Widening
@@ -127,9 +183,79 @@ export declare abstract class AgentController<A extends AnyAgent = AnyAgent> ext
127
183
  * done. See `MemoryLiveRuns`.
128
184
  */
129
185
  liveRuns: MemoryLiveRuns;
186
+ /**
187
+ * Where attachment *records* live — the row that says which bytes, whose, and
188
+ * under what id. Defaults to the process-wide `MemoryAttachmentStore`, with
189
+ * the same warning `store` carries: assign something that outlives the
190
+ * request, because this controller is constructed per call.
191
+ */
192
+ attachments: AttachmentStore;
193
+ /**
194
+ * Where an attachment's *bytes* live. Defaults to the app's configured
195
+ * `FileStorage` through the `Storage` facade, which resolves the driver per
196
+ * call out of the container — so an app that configured S3 gets S3 here
197
+ * without saying so twice.
198
+ *
199
+ * Overridable mostly for tests and for an app that keeps user uploads in a
200
+ * different bucket from everything else.
201
+ */
202
+ attachmentStorage: AttachmentStorage;
203
+ /**
204
+ * How long the request that started a run is held open for its hooks, in
205
+ * milliseconds, once the run has settled. The run itself is not bounded
206
+ * here — the request is held for as long as it runs — only the app's code
207
+ * still going after it, from `onMessage` to an `onAwaitingInput` queued
208
+ * behind a slow `onToolCall`.
209
+ *
210
+ * The hooks read the user from that request (`ctx.req.ctx().user`,
211
+ * `Auth.user()`, a policied query), so the request stays open until they are
212
+ * done; but a hook that never settles — a `fetch` with no timeout — would
213
+ * then hold the store, the user and `onRequestEnd` forever, one per turn. Past
214
+ * this the request ends anyway: `onRequestEnd` runs, the user is released,
215
+ * and the hook runs on without one. Thirty seconds is far past a healthy
216
+ * write or notification, so a hook that reaches it is hung rather than slow.
217
+ * Raise it for a hook that is legitimately longer; `Infinity` holds the
218
+ * request until the hooks are done, however long that is.
219
+ */
220
+ protected hookHoldMs: number;
130
221
  /** Appended to the agent's static instructions for this request — the user's
131
222
  * name, tenant, today's date. */
132
223
  instructions(req: HttpRequest<any, any>): string | Promise<string> | void;
224
+ /**
225
+ * Refuse a turn that arrives without a `threadId`, with a 400
226
+ * `thread_required`, before anything runs.
227
+ *
228
+ * A stateless turn is otherwise open to any caller the route's middleware
229
+ * lets through: the client carries the history, so the model runs, and is
230
+ * billed, as a general-purpose chat. An app whose tools resolve their subject
231
+ * from the thread can make them refuse such a turn, but the model has still
232
+ * been paid for by then.
233
+ *
234
+ * It governs `stream` only. `upload` can still reach the provider without a
235
+ * thread (a `provider` destination); refuse that in `authorizeRequest`.
236
+ */
237
+ protected requireThread: boolean;
238
+ /**
239
+ * Decides whether this caller may use this route, on every one of the four:
240
+ * `stream`, `attach`, `stop` and `upload` (#542). Throw a request breaker
241
+ * (`InsufficientPermissionsError`, say) to refuse; return to let it through.
242
+ *
243
+ * It runs before the route does any work of its own: on `stream`, ahead of
244
+ * the thread's lock and load, `instructions()` and the provider, so a refused
245
+ * turn is not charged for, waits behind no run and does not learn whether its
246
+ * thread exists; on `attach`, before a live run's frames are read.
247
+ *
248
+ * `threadId` is the one the client sent, taken on trust and not yet checked
249
+ * against the store — which is what makes this the place to check that the
250
+ * caller owns it. A thread-scoped app that checks it here on every route
251
+ * keeps a thread's live answer, its stop button and its attachments to its
252
+ * owner. It is `undefined` when the request names no thread: a stateless
253
+ * turn, an upload without one, a stop by `runId` or `clientRunId`.
254
+ */
255
+ protected authorizeRequest(req: HttpRequest<any, any>, params: {
256
+ route: "stream" | "attach" | "stop" | "upload";
257
+ threadId?: string;
258
+ }): void | Promise<void>;
133
259
  /**
134
260
  * `POST /<path>` — one route for every client turn. A first message, an
135
261
  * approval, an answer to a question and a client tool's result are all just
@@ -155,13 +281,14 @@ export declare abstract class AgentController<A extends AnyAgent = AnyAgent> ext
155
281
  * for the old run to unwind, which is as long as its slowest tool in flight —
156
282
  * and that wait is the thing that puts `assistant1` before `user2`.
157
283
  *
158
- * The wait is on `persistRun`, not on `run.result()`. `result()` settling is
159
- * the transcript being final, not stored: `appendMessages` runs after it, and
160
- * a `loadThread` in that gap reads a history the old answer is missing from,
161
- * which is the original bug by a shorter route. It is also *only* that:
162
- * `persistRun` settles once the transcript is stored and lets the app's
163
- * hooks run on without it, so a slow `onMessage` is not a slow thread and a
164
- * hung one is not a hung thread.
284
+ * The wait is on `persistRun`'s `stored`, not on `run.result()`. `result()`
285
+ * settling is the transcript being final, not stored: `appendMessages` runs
286
+ * after it, and a `loadThread` in that gap reads a history the old answer is
287
+ * missing from, which is the original bug by a shorter route. It is also
288
+ * *only* that: `stored` settles once the transcript is stored, and the app's
289
+ * hooks run on in `hooks`, which holds the old run's request and not the
290
+ * thread, so a slow `onMessage` is not a slow thread and a hung one is not a
291
+ * hung thread.
165
292
  *
166
293
  * The lock around it is what makes a *third* turn wait for the second rather
167
294
  * than for the first. Two turns arriving together both see the same live
@@ -201,14 +328,151 @@ export declare abstract class AgentController<A extends AnyAgent = AnyAgent> ext
201
328
  stop(req?: HttpRequest<any, any>): Promise<{
202
329
  stopped: boolean;
203
330
  } | Response>;
204
- /** `POST /<path>/files` — uploads an attachment and returns its file id. */
205
- upload(req?: HttpRequest<any, any>): Promise<{
206
- fileId: string;
207
- }>;
331
+ /**
332
+ * WHO A SCOPE BELONGS TO, and the one question in this file whose wrong
333
+ * answer is a data leak rather than a bug.
334
+ *
335
+ * An attachment id given to the model comes back *from* the model, and what
336
+ * the model writes is a function of everything it read — the user's text, a
337
+ * tool's output, a document someone uploaded. So the id is untrusted in
338
+ * exactly the way a request body is, and the scope it resolves under must come
339
+ * from the server's own knowledge of the request. Nothing that reaches this
340
+ * method may be readable or writable by the model: `req` is the HTTP request,
341
+ * and `threadId` is the client's handle, not the model's.
342
+ *
343
+ * THE DEFAULT IS THE AUTHENTICATED USER, falling back to the thread, falling
344
+ * back to `null`.
345
+ *
346
+ * - `user:<id>` when the request is authenticated. `req.ctx().user` is what
347
+ * `AuthenticationMiddleware` and the `Auth` facade put there, so an agent
348
+ * route behind `middlewares = ["auth"]` — which `ApiRouter.agent()` makes
349
+ * the default posture — has a subject without the app writing anything.
350
+ * - `thread:<id>` for an unauthenticated chat that has a thread. A `threadId`
351
+ * is minted by `createThread` as a uuid and is documented as a capability,
352
+ * and `upload` only passes one here that `store.loadThread` finds;
353
+ * an anonymous support widget has nothing better, and scoping to the
354
+ * conversation is strictly narrower than scoping to nothing.
355
+ * - `null` otherwise, which means no attachment id is minted at all. There is
356
+ * no third fallback on purpose. `sessionId()` is the tempting one and it is
357
+ * the wrong one: it is a cookie the visitor writes, documented as *not a
358
+ * credential*, so scoping to it is scoping to a value the caller chooses —
359
+ * which is not a scope, it is a lookup key with extra steps.
360
+ *
361
+ * WHAT THIS DEFAULT GETS WRONG, since it will get something wrong for someone:
362
+ * it is per user, not per conversation, so a user's own upload from one thread
363
+ * resolves in another thread of theirs. That is the loose direction, and it is
364
+ * chosen because the tight one breaks the flow the framework actually ships —
365
+ * `useChat.uploadFile` posts a file before any thread exists, so a per-thread
366
+ * default would make the first upload of every conversation unresolvable. An
367
+ * app that wants per-conversation isolation returns
368
+ * `{ key: \`user:${id}:thread:${threadId}\` }` here and has it; an app with
369
+ * tenants returns `{ key: \`org:${orgId}\` }` and has that. What the default
370
+ * must never be is broader than a user, and it is not.
371
+ *
372
+ * WHATEVER THIS READS MUST BE PRESENT ON EVERY AGENT ROUTE, and the default
373
+ * reads `req.ctx().user`, which is present only where authentication
374
+ * middleware ran. `agent()` mounts four routes and `.middleware()` guards
375
+ * them individually, so `middleware({ stream: "auth" })` — the example in
376
+ * `ApiRouter.agent`'s own doc — leaves `POST /chat/files` unauthenticated.
377
+ * The upload then files the record under `thread:<id>` (or nothing at all)
378
+ * while the run that follows, on the guarded route, resolves under
379
+ * `user:<id>`, and every id minted on upload is a miss for the rest of the
380
+ * conversation. It fails as `AttachmentNotFoundError`, worded identically to
381
+ * an id the model invented, which is the point of that error and is also why
382
+ * this particular misconfiguration is invisible. Guard `upload` and `stream`
383
+ * together, or derive the key from something both of them have.
384
+ *
385
+ * gemi does not detect the skew for you, and the reason is the module's whole
386
+ * premise: noticing that an id exists under a *different* scope requires
387
+ * looking it up without one, and an unscoped read is the thing that must not
388
+ * exist here — not even behind a `console.warn`. So the answer is the
389
+ * documentation you are reading and the identical error, not a probe.
390
+ *
391
+ * The key is opaque and compared with `===`. It is never sent to the client
392
+ * and never shown to the model.
393
+ */
394
+ protected attachmentScope(req: HttpRequest<any, any>, threadId?: string): AttachmentScope | null | Promise<AttachmentScope | null>;
395
+ /**
396
+ * WHERE ONE FILE'S BYTES SHOULD GO. Called once per upload, with the file in
397
+ * hand.
398
+ *
399
+ * The model needs to perceive a file only for vision or document reading; a
400
+ * tool needs the bytes only to forward them. Those are different needs and
401
+ * they were being answered the same way, because `upload` sent everything to
402
+ * the vendor unconditionally — which is a cost and a data-minimisation problem
403
+ * as much as a capability one. A CSV that exists to be imported belongs in
404
+ * storage and not at the provider; an image the model must look at and no tool
405
+ * will forward is the reverse.
406
+ *
407
+ * THE DEFAULT IS `"both"`, AND THE JUSTIFICATION IS THE FAILURE MODE, not the
408
+ * hit rate. A mimeType table was the obvious alternative — images and PDFs to
409
+ * the provider, everything else to storage — and it is wrong in the quiet
410
+ * direction. Getting `"both"` wrong sends a file to a vendor that did not need
411
+ * it: it costs money, it is visible on an invoice and in the vendor's file
412
+ * list, and it is corrected by overriding one method. Getting `"storage"`
413
+ * wrong drops the file out of the model's view with no error anywhere; the
414
+ * model answers as though the image were not there, which is indistinguishable
415
+ * from a bad prompt, and the developer debugs their instructions for an
416
+ * afternoon. Being wrong on the invoice beats being wrong in a way that
417
+ * presents as "the AI is stupid".
418
+ *
419
+ * `"both"` is also what keeps this change additive: every upload that reached
420
+ * the provider before still reaches it, and storage is added underneath. An
421
+ * app that never asks for an attachment id sees no difference except a second
422
+ * copy it owns.
423
+ *
424
+ * A client may ask, per file, for `"storage"` under a `"both"` policy — the
425
+ * one direction that only ever removes the vendor. It may not ask for
426
+ * anything else, including `"provider"`, which would let a form field decide
427
+ * that the app does not keep its own copy. See `narrowDestination`.
428
+ */
429
+ protected attachmentDestination(file: File, req: HttpRequest<any, any>): AttachmentDestination | Promise<AttachmentDestination>;
430
+ /**
431
+ * The attachment handle for this request — the object a tool is given.
432
+ *
433
+ * `null` when `attachmentScope` says the request has no subject, and a caller
434
+ * that gets `null` must not fall back to anything: there is no unscoped handle
435
+ * to fall back to, which is the point.
436
+ *
437
+ * Issue #490 hangs `ctx.attachments` off this.
438
+ */
439
+ protected attachmentsFor(req: HttpRequest<any, any>, threadId?: string): Promise<ScopedAttachments | null>;
440
+ /**
441
+ * `POST /<path>/files` — takes an attachment and answers the handles for it.
442
+ *
443
+ * `fileId` IS STILL IN THE ANSWER AND STILL MEANS THE SAME THING: the
444
+ * provider's id for the file, the thing a `FilePart` carries, unchanged. It
445
+ * has to stay, because it is what makes vision work and what
446
+ * `useChat.uploadFile` already reads; `attachmentId` is added beside it rather
447
+ * than in place of it. The two are not interchangeable, and swapping them
448
+ * would reach the vendor as a file id it has never issued — so
449
+ * `toResponsesInput` rejects a `gemi_att_` prefix in `FilePart.fileId` with a
450
+ * sentence saying so, rather than leaving it to whatever the vendor answers
451
+ * (not measured).
452
+ *
453
+ * `fileId` is absent exactly when the file did not go to the provider, which
454
+ * only happens when the app or the client asked for that. `attachmentId` is
455
+ * absent when there was no scope to file the record under — see
456
+ * `attachmentScope` — and the answer then carries `downgraded: "no_scope"`,
457
+ * which is the only thing separating that case from a controller that chose
458
+ * `"provider"` on purpose. Both answer `destination: "provider"`, because both
459
+ * are true about where the bytes went.
460
+ *
461
+ * ORDER: storage first, then the provider. If the second one fails the request
462
+ * fails either way, so the only question is where the orphan is left, and an
463
+ * orphan in our own bucket is ours to sweep on a schedule we set, while an
464
+ * orphan at the vendor sits under a retention policy that is not ours.
465
+ */
466
+ upload(req?: HttpRequest<any, any>): Promise<UploadResult>;
208
467
  /**
209
468
  * Protected, not private: these exist to be overridden. `onMessage` fires for
210
469
  * every completed message, user and assistant alike, and is the intended
211
470
  * persistence point for an app that is not using `store`.
471
+ *
472
+ * Every hook runs inside the request that started the run, which is held
473
+ * open for them — after the run, and after a client that left — so
474
+ * `ctx.req.ctx().user` is the user who sent the turn. See `hookHoldMs` for
475
+ * how long a hook that does not finish keeps it.
212
476
  */
213
477
  protected onMessage(message: AgentMessage, ctx: AgentHookContext): void | Promise<void>;
214
478
  protected onToolCall(call: {
@@ -247,13 +511,21 @@ export declare abstract class AgentController<A extends AnyAgent = AnyAgent> ext
247
511
  * a finished one does: `stop()` finalizes the transcript, so by the time this
248
512
  * resolves there is a valid history to store.
249
513
  *
250
- * Settles when the transcript is in the store, not when the app is done with
251
- * it. The next turn on this thread waits on this (see `withThread`), and the
252
- * hooks are the app's: an `onMessage` that writes to something slow would
253
- * make every later turn wait for it, once per message of the old run, and
254
- * one that never settles — which `safely` cannot catch — would hold the
255
- * thread, and every turn queued on it, behind an open connection each. So
256
- * the hooks run on after this on their own, reported the same way.
514
+ * `stored` settles when the transcript is in the store, not when the app is
515
+ * done with it. The next turn on this thread waits on that (see
516
+ * `withThread`), and the hooks are the app's: an `onMessage` that writes to
517
+ * something slow would make every later turn wait for it, once per message
518
+ * of the old run, and one that never settles — which `safely` cannot catch —
519
+ * would hold the thread, and every turn queued on it, behind an open
520
+ * connection each. So the hooks run on after it on their own, reported the
521
+ * same way.
522
+ *
523
+ * `hooks` settles once they have too, and every event-stream hook the run
524
+ * led to (`eventHooks`), or after `hookHoldMs` of them, and is what the
525
+ * request that started the run is held open for. Separate from
526
+ * `stored` for the reason above, and it has to exist from the start: by the
527
+ * time the hooks are called the run has settled, and the request with it,
528
+ * unless something was already holding it. Neither rejects.
257
529
  */
258
530
  private persistRun;
259
531
  /** The hooks on a finished run, in order. Never rejects: see `safely`. */
@@ -1 +1 @@
1
- {"version":3,"file":"AgentController.d.ts","sourceRoot":"","sources":["../../ai/AgentController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAClD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChF,OAAO,EACL,uBAAuB,EACvB,QAAQ,IAAI,eAAe,EAC3B,oBAAoB,EACpB,cAAc,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE/E,OAAO,KAAK,EACV,UAAU,EACV,YAAY,EAGZ,eAAe,EACf,UAAU,EACX,MAAM,SAAS,CAAC;AAIjB;;;;;;;;GAQG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;;;;OAQG;IACH,YAAY,CAAC,MAAM,EAAE;QAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAClF;;;;;;;;;;OAUG;IACH,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,YAAY,EAAE,GAAG,IAAI,CAAC,CAAC;IAC7D;;;;;;;;;;;;OAYG;IACH,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,YAAY,EAAE,GAAG,OAAO,CAA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I;IACpE,OAAO,EAAE,IAAI,CAAC;IACd,KAAK,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,QAAQ,GAC5C,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,GAC/C,UAAU,CAAC;IACf,MAAM,EAAE,OAAO,CAAC;CACjB,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { applyFrame, initialChatState, markAborted } from "./reducer";
2
+ import { SSEFrameDecoder } from "./sse";
3
+ /**
4
+ * `applyFrame`, `markAborted` and `initialChatState`, recording as they run.
5
+ *
6
+ * Identical calls are kept once. The tests fold the same run from scratch many
7
+ * times over, and a corpus of the same case repeated is only slower to replay.
8
+ * The copy kept is named after the alphabetically first test that made the
9
+ * call, not the first to run, so the name does not depend on test order.
10
+ */
11
+ export declare function recordReducer(target: string): {
12
+ applyFrame: typeof applyFrame;
13
+ markAborted: typeof markAborted;
14
+ initialChatState: typeof initialChatState;
15
+ };
16
+ /**
17
+ * An `SSEFrameDecoder` that logs every push and flush with what came out and
18
+ * where the cursor stood after, one case per decoder.
19
+ */
20
+ export declare function recordDecoder(target: string): new () => SSEFrameDecoder;
21
+ //# sourceMappingURL=conformance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conformance.d.ts","sourceRoot":"","sources":["../../../ai/client/conformance.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAgIxC;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM;gBAqClC,OAAO,UAAU;iBAajB,OAAO,WAAW;sBAYlB,OAAO,gBAAgB;EAEhC;AAeD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,eAAe,CAuCvE"}