@agentuity/runtime 2.0.11 → 3.0.0-alpha.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 (415) hide show
  1. package/dist/index.d.ts +37 -65
  2. package/dist/index.d.ts.map +1 -1
  3. package/dist/index.js +59 -61
  4. package/dist/index.js.map +1 -1
  5. package/package.json +9 -38
  6. package/src/index.ts +58 -259
  7. package/AGENTS.md +0 -116
  8. package/dist/_config.d.ts +0 -100
  9. package/dist/_config.d.ts.map +0 -1
  10. package/dist/_config.js +0 -147
  11. package/dist/_config.js.map +0 -1
  12. package/dist/_context.d.ts +0 -80
  13. package/dist/_context.d.ts.map +0 -1
  14. package/dist/_context.js +0 -160
  15. package/dist/_context.js.map +0 -1
  16. package/dist/_events.d.ts +0 -64
  17. package/dist/_events.d.ts.map +0 -1
  18. package/dist/_events.js +0 -92
  19. package/dist/_events.js.map +0 -1
  20. package/dist/_globals.d.ts +0 -58
  21. package/dist/_globals.d.ts.map +0 -1
  22. package/dist/_globals.js +0 -71
  23. package/dist/_globals.js.map +0 -1
  24. package/dist/_idle.d.ts +0 -7
  25. package/dist/_idle.d.ts.map +0 -1
  26. package/dist/_idle.js +0 -10
  27. package/dist/_idle.js.map +0 -1
  28. package/dist/_metadata.d.ts +0 -117
  29. package/dist/_metadata.d.ts.map +0 -1
  30. package/dist/_metadata.js +0 -268
  31. package/dist/_metadata.js.map +0 -1
  32. package/dist/_process-protection.d.ts +0 -27
  33. package/dist/_process-protection.d.ts.map +0 -1
  34. package/dist/_process-protection.js +0 -56
  35. package/dist/_process-protection.js.map +0 -1
  36. package/dist/_server.d.ts +0 -50
  37. package/dist/_server.d.ts.map +0 -1
  38. package/dist/_server.js +0 -89
  39. package/dist/_server.js.map +0 -1
  40. package/dist/_services.d.ts +0 -25
  41. package/dist/_services.d.ts.map +0 -1
  42. package/dist/_services.js +0 -286
  43. package/dist/_services.js.map +0 -1
  44. package/dist/_standalone.d.ts +0 -212
  45. package/dist/_standalone.d.ts.map +0 -1
  46. package/dist/_standalone.js +0 -556
  47. package/dist/_standalone.js.map +0 -1
  48. package/dist/_tokens.d.ts +0 -12
  49. package/dist/_tokens.d.ts.map +0 -1
  50. package/dist/_tokens.js +0 -97
  51. package/dist/_tokens.js.map +0 -1
  52. package/dist/_util.d.ts +0 -16
  53. package/dist/_util.d.ts.map +0 -1
  54. package/dist/_util.js +0 -54
  55. package/dist/_util.js.map +0 -1
  56. package/dist/_validation.d.ts +0 -89
  57. package/dist/_validation.d.ts.map +0 -1
  58. package/dist/_validation.js +0 -29
  59. package/dist/_validation.js.map +0 -1
  60. package/dist/_waituntil.d.ts +0 -32
  61. package/dist/_waituntil.d.ts.map +0 -1
  62. package/dist/_waituntil.js +0 -156
  63. package/dist/_waituntil.js.map +0 -1
  64. package/dist/agent.d.ts +0 -1262
  65. package/dist/agent.d.ts.map +0 -1
  66. package/dist/agent.js +0 -981
  67. package/dist/agent.js.map +0 -1
  68. package/dist/app.d.ts +0 -514
  69. package/dist/app.d.ts.map +0 -1
  70. package/dist/app.js +0 -228
  71. package/dist/app.js.map +0 -1
  72. package/dist/bootstrap.d.ts +0 -44
  73. package/dist/bootstrap.d.ts.map +0 -1
  74. package/dist/bootstrap.js +0 -259
  75. package/dist/bootstrap.js.map +0 -1
  76. package/dist/bun-s3-patch.d.ts +0 -37
  77. package/dist/bun-s3-patch.d.ts.map +0 -1
  78. package/dist/bun-s3-patch.js +0 -142
  79. package/dist/bun-s3-patch.js.map +0 -1
  80. package/dist/cors.d.ts +0 -42
  81. package/dist/cors.d.ts.map +0 -1
  82. package/dist/cors.js +0 -117
  83. package/dist/cors.js.map +0 -1
  84. package/dist/dev-patches/aisdk.d.ts +0 -17
  85. package/dist/dev-patches/aisdk.d.ts.map +0 -1
  86. package/dist/dev-patches/aisdk.js +0 -160
  87. package/dist/dev-patches/aisdk.js.map +0 -1
  88. package/dist/dev-patches/gateway.d.ts +0 -16
  89. package/dist/dev-patches/gateway.d.ts.map +0 -1
  90. package/dist/dev-patches/gateway.js +0 -54
  91. package/dist/dev-patches/gateway.js.map +0 -1
  92. package/dist/dev-patches/index.d.ts +0 -21
  93. package/dist/dev-patches/index.d.ts.map +0 -1
  94. package/dist/dev-patches/index.js +0 -33
  95. package/dist/dev-patches/index.js.map +0 -1
  96. package/dist/dev-patches/otel-llm.d.ts +0 -12
  97. package/dist/dev-patches/otel-llm.d.ts.map +0 -1
  98. package/dist/dev-patches/otel-llm.js +0 -352
  99. package/dist/dev-patches/otel-llm.js.map +0 -1
  100. package/dist/devmode.d.ts +0 -3
  101. package/dist/devmode.d.ts.map +0 -1
  102. package/dist/devmode.js +0 -167
  103. package/dist/devmode.js.map +0 -1
  104. package/dist/eval.d.ts +0 -91
  105. package/dist/eval.d.ts.map +0 -1
  106. package/dist/eval.js +0 -16
  107. package/dist/eval.js.map +0 -1
  108. package/dist/handlers/_route-meta.d.ts +0 -22
  109. package/dist/handlers/_route-meta.d.ts.map +0 -1
  110. package/dist/handlers/_route-meta.js +0 -25
  111. package/dist/handlers/_route-meta.js.map +0 -1
  112. package/dist/handlers/cron.d.ts +0 -73
  113. package/dist/handlers/cron.d.ts.map +0 -1
  114. package/dist/handlers/cron.js +0 -43
  115. package/dist/handlers/cron.js.map +0 -1
  116. package/dist/handlers/index.d.ts +0 -6
  117. package/dist/handlers/index.d.ts.map +0 -1
  118. package/dist/handlers/index.js +0 -6
  119. package/dist/handlers/index.js.map +0 -1
  120. package/dist/handlers/sse.d.ts +0 -163
  121. package/dist/handlers/sse.d.ts.map +0 -1
  122. package/dist/handlers/sse.js +0 -175
  123. package/dist/handlers/sse.js.map +0 -1
  124. package/dist/handlers/stream.d.ts +0 -52
  125. package/dist/handlers/stream.d.ts.map +0 -1
  126. package/dist/handlers/stream.js +0 -108
  127. package/dist/handlers/stream.js.map +0 -1
  128. package/dist/handlers/webrtc.d.ts +0 -49
  129. package/dist/handlers/webrtc.d.ts.map +0 -1
  130. package/dist/handlers/webrtc.js +0 -109
  131. package/dist/handlers/webrtc.js.map +0 -1
  132. package/dist/handlers/websocket.d.ts +0 -88
  133. package/dist/handlers/websocket.d.ts.map +0 -1
  134. package/dist/handlers/websocket.js +0 -161
  135. package/dist/handlers/websocket.js.map +0 -1
  136. package/dist/logger/console.d.ts +0 -70
  137. package/dist/logger/console.d.ts.map +0 -1
  138. package/dist/logger/console.js +0 -278
  139. package/dist/logger/console.js.map +0 -1
  140. package/dist/logger/index.d.ts +0 -3
  141. package/dist/logger/index.d.ts.map +0 -1
  142. package/dist/logger/index.js +0 -3
  143. package/dist/logger/index.js.map +0 -1
  144. package/dist/logger/internal.d.ts +0 -79
  145. package/dist/logger/internal.d.ts.map +0 -1
  146. package/dist/logger/internal.js +0 -133
  147. package/dist/logger/internal.js.map +0 -1
  148. package/dist/logger/logger.d.ts +0 -41
  149. package/dist/logger/logger.d.ts.map +0 -1
  150. package/dist/logger/logger.js +0 -2
  151. package/dist/logger/logger.js.map +0 -1
  152. package/dist/logger/user.d.ts +0 -8
  153. package/dist/logger/user.d.ts.map +0 -1
  154. package/dist/logger/user.js +0 -7
  155. package/dist/logger/user.js.map +0 -1
  156. package/dist/logger/util.d.ts +0 -11
  157. package/dist/logger/util.d.ts.map +0 -1
  158. package/dist/logger/util.js +0 -77
  159. package/dist/logger/util.js.map +0 -1
  160. package/dist/middleware.d.ts +0 -105
  161. package/dist/middleware.d.ts.map +0 -1
  162. package/dist/middleware.js +0 -763
  163. package/dist/middleware.js.map +0 -1
  164. package/dist/otel/config.d.ts +0 -19
  165. package/dist/otel/config.d.ts.map +0 -1
  166. package/dist/otel/config.js +0 -26
  167. package/dist/otel/config.js.map +0 -1
  168. package/dist/otel/console.d.ts +0 -33
  169. package/dist/otel/console.d.ts.map +0 -1
  170. package/dist/otel/console.js +0 -86
  171. package/dist/otel/console.js.map +0 -1
  172. package/dist/otel/exporters/index.d.ts +0 -4
  173. package/dist/otel/exporters/index.d.ts.map +0 -1
  174. package/dist/otel/exporters/index.js +0 -4
  175. package/dist/otel/exporters/index.js.map +0 -1
  176. package/dist/otel/exporters/jsonl-log-exporter.d.ts +0 -36
  177. package/dist/otel/exporters/jsonl-log-exporter.d.ts.map +0 -1
  178. package/dist/otel/exporters/jsonl-log-exporter.js +0 -103
  179. package/dist/otel/exporters/jsonl-log-exporter.js.map +0 -1
  180. package/dist/otel/exporters/jsonl-metric-exporter.d.ts +0 -40
  181. package/dist/otel/exporters/jsonl-metric-exporter.d.ts.map +0 -1
  182. package/dist/otel/exporters/jsonl-metric-exporter.js +0 -104
  183. package/dist/otel/exporters/jsonl-metric-exporter.js.map +0 -1
  184. package/dist/otel/exporters/jsonl-trace-exporter.d.ts +0 -36
  185. package/dist/otel/exporters/jsonl-trace-exporter.d.ts.map +0 -1
  186. package/dist/otel/exporters/jsonl-trace-exporter.js +0 -111
  187. package/dist/otel/exporters/jsonl-trace-exporter.js.map +0 -1
  188. package/dist/otel/fetch.d.ts +0 -12
  189. package/dist/otel/fetch.d.ts.map +0 -1
  190. package/dist/otel/fetch.js +0 -82
  191. package/dist/otel/fetch.js.map +0 -1
  192. package/dist/otel/http.d.ts +0 -16
  193. package/dist/otel/http.d.ts.map +0 -1
  194. package/dist/otel/http.js +0 -44
  195. package/dist/otel/http.js.map +0 -1
  196. package/dist/otel/logger.d.ts +0 -37
  197. package/dist/otel/logger.d.ts.map +0 -1
  198. package/dist/otel/logger.js +0 -265
  199. package/dist/otel/logger.js.map +0 -1
  200. package/dist/otel/otel.d.ts +0 -68
  201. package/dist/otel/otel.d.ts.map +0 -1
  202. package/dist/otel/otel.js +0 -245
  203. package/dist/otel/otel.js.map +0 -1
  204. package/dist/otel/tracestate.d.ts +0 -44
  205. package/dist/otel/tracestate.d.ts.map +0 -1
  206. package/dist/otel/tracestate.js +0 -84
  207. package/dist/otel/tracestate.js.map +0 -1
  208. package/dist/router.d.ts +0 -66
  209. package/dist/router.d.ts.map +0 -1
  210. package/dist/router.js +0 -44
  211. package/dist/router.js.map +0 -1
  212. package/dist/services/evalrun/composite.d.ts +0 -21
  213. package/dist/services/evalrun/composite.d.ts.map +0 -1
  214. package/dist/services/evalrun/composite.js +0 -26
  215. package/dist/services/evalrun/composite.js.map +0 -1
  216. package/dist/services/evalrun/http.d.ts +0 -24
  217. package/dist/services/evalrun/http.d.ts.map +0 -1
  218. package/dist/services/evalrun/http.js +0 -115
  219. package/dist/services/evalrun/http.js.map +0 -1
  220. package/dist/services/evalrun/index.d.ts +0 -5
  221. package/dist/services/evalrun/index.d.ts.map +0 -1
  222. package/dist/services/evalrun/index.js +0 -5
  223. package/dist/services/evalrun/index.js.map +0 -1
  224. package/dist/services/evalrun/json.d.ts +0 -21
  225. package/dist/services/evalrun/json.d.ts.map +0 -1
  226. package/dist/services/evalrun/json.js +0 -38
  227. package/dist/services/evalrun/json.js.map +0 -1
  228. package/dist/services/evalrun/local.d.ts +0 -19
  229. package/dist/services/evalrun/local.d.ts.map +0 -1
  230. package/dist/services/evalrun/local.js +0 -22
  231. package/dist/services/evalrun/local.js.map +0 -1
  232. package/dist/services/local/_db.d.ts +0 -4
  233. package/dist/services/local/_db.d.ts.map +0 -1
  234. package/dist/services/local/_db.js +0 -281
  235. package/dist/services/local/_db.js.map +0 -1
  236. package/dist/services/local/_router.d.ts +0 -3
  237. package/dist/services/local/_router.d.ts.map +0 -1
  238. package/dist/services/local/_router.js +0 -28
  239. package/dist/services/local/_router.js.map +0 -1
  240. package/dist/services/local/_util.d.ts +0 -18
  241. package/dist/services/local/_util.d.ts.map +0 -1
  242. package/dist/services/local/_util.js +0 -44
  243. package/dist/services/local/_util.js.map +0 -1
  244. package/dist/services/local/email.d.ts +0 -24
  245. package/dist/services/local/email.d.ts.map +0 -1
  246. package/dist/services/local/email.js +0 -58
  247. package/dist/services/local/email.js.map +0 -1
  248. package/dist/services/local/index.d.ts +0 -10
  249. package/dist/services/local/index.d.ts.map +0 -1
  250. package/dist/services/local/index.js +0 -10
  251. package/dist/services/local/index.js.map +0 -1
  252. package/dist/services/local/keyvalue.d.ts +0 -17
  253. package/dist/services/local/keyvalue.d.ts.map +0 -1
  254. package/dist/services/local/keyvalue.js +0 -133
  255. package/dist/services/local/keyvalue.js.map +0 -1
  256. package/dist/services/local/queue.d.ts +0 -10
  257. package/dist/services/local/queue.d.ts.map +0 -1
  258. package/dist/services/local/queue.js +0 -96
  259. package/dist/services/local/queue.js.map +0 -1
  260. package/dist/services/local/stream.d.ts +0 -12
  261. package/dist/services/local/stream.d.ts.map +0 -1
  262. package/dist/services/local/stream.js +0 -266
  263. package/dist/services/local/stream.js.map +0 -1
  264. package/dist/services/local/task.d.ts +0 -55
  265. package/dist/services/local/task.d.ts.map +0 -1
  266. package/dist/services/local/task.js +0 -1248
  267. package/dist/services/local/task.js.map +0 -1
  268. package/dist/services/local/vector.d.ts +0 -17
  269. package/dist/services/local/vector.d.ts.map +0 -1
  270. package/dist/services/local/vector.js +0 -303
  271. package/dist/services/local/vector.js.map +0 -1
  272. package/dist/services/sandbox/http.d.ts +0 -23
  273. package/dist/services/sandbox/http.d.ts.map +0 -1
  274. package/dist/services/sandbox/http.js +0 -327
  275. package/dist/services/sandbox/http.js.map +0 -1
  276. package/dist/services/sandbox/index.d.ts +0 -2
  277. package/dist/services/sandbox/index.d.ts.map +0 -1
  278. package/dist/services/sandbox/index.js +0 -2
  279. package/dist/services/sandbox/index.js.map +0 -1
  280. package/dist/services/session/composite.d.ts +0 -21
  281. package/dist/services/session/composite.d.ts.map +0 -1
  282. package/dist/services/session/composite.js +0 -26
  283. package/dist/services/session/composite.js.map +0 -1
  284. package/dist/services/session/http.d.ts +0 -34
  285. package/dist/services/session/http.d.ts.map +0 -1
  286. package/dist/services/session/http.js +0 -124
  287. package/dist/services/session/http.js.map +0 -1
  288. package/dist/services/session/index.d.ts +0 -5
  289. package/dist/services/session/index.d.ts.map +0 -1
  290. package/dist/services/session/index.js +0 -5
  291. package/dist/services/session/index.js.map +0 -1
  292. package/dist/services/session/json.d.ts +0 -22
  293. package/dist/services/session/json.d.ts.map +0 -1
  294. package/dist/services/session/json.js +0 -35
  295. package/dist/services/session/json.js.map +0 -1
  296. package/dist/services/session/local.d.ts +0 -19
  297. package/dist/services/session/local.d.ts.map +0 -1
  298. package/dist/services/session/local.js +0 -23
  299. package/dist/services/session/local.js.map +0 -1
  300. package/dist/services/thread/local.d.ts +0 -20
  301. package/dist/services/thread/local.d.ts.map +0 -1
  302. package/dist/services/thread/local.js +0 -158
  303. package/dist/services/thread/local.js.map +0 -1
  304. package/dist/session.d.ts +0 -734
  305. package/dist/session.d.ts.map +0 -1
  306. package/dist/session.js +0 -1140
  307. package/dist/session.js.map +0 -1
  308. package/dist/signature.d.ts +0 -22
  309. package/dist/signature.d.ts.map +0 -1
  310. package/dist/signature.js +0 -63
  311. package/dist/signature.js.map +0 -1
  312. package/dist/validator.d.ts +0 -142
  313. package/dist/validator.d.ts.map +0 -1
  314. package/dist/validator.js +0 -149
  315. package/dist/validator.js.map +0 -1
  316. package/dist/version-check.d.ts +0 -20
  317. package/dist/version-check.d.ts.map +0 -1
  318. package/dist/version-check.js +0 -157
  319. package/dist/version-check.js.map +0 -1
  320. package/dist/web.d.ts +0 -8
  321. package/dist/web.d.ts.map +0 -1
  322. package/dist/web.js +0 -67
  323. package/dist/web.js.map +0 -1
  324. package/dist/webrtc-signaling.d.ts +0 -80
  325. package/dist/webrtc-signaling.d.ts.map +0 -1
  326. package/dist/webrtc-signaling.js +0 -237
  327. package/dist/webrtc-signaling.js.map +0 -1
  328. package/dist/workbench.d.ts +0 -17
  329. package/dist/workbench.d.ts.map +0 -1
  330. package/dist/workbench.js +0 -605
  331. package/dist/workbench.js.map +0 -1
  332. package/src/_config.ts +0 -163
  333. package/src/_context.ts +0 -240
  334. package/src/_events.ts +0 -142
  335. package/src/_globals.ts +0 -92
  336. package/src/_idle.ts +0 -10
  337. package/src/_metadata.ts +0 -407
  338. package/src/_process-protection.ts +0 -71
  339. package/src/_server.ts +0 -109
  340. package/src/_services.ts +0 -379
  341. package/src/_standalone.ts +0 -710
  342. package/src/_tokens.ts +0 -114
  343. package/src/_util.ts +0 -62
  344. package/src/_validation.ts +0 -119
  345. package/src/_waituntil.ts +0 -188
  346. package/src/agent.ts +0 -2739
  347. package/src/app.ts +0 -769
  348. package/src/bootstrap.ts +0 -321
  349. package/src/bun-s3-patch.ts +0 -224
  350. package/src/cors.ts +0 -137
  351. package/src/dev-patches/aisdk.ts +0 -169
  352. package/src/dev-patches/gateway.ts +0 -68
  353. package/src/dev-patches/index.ts +0 -37
  354. package/src/dev-patches/otel-llm.ts +0 -405
  355. package/src/devmode.ts +0 -171
  356. package/src/eval.ts +0 -109
  357. package/src/globals.d.ts +0 -28
  358. package/src/handlers/_route-meta.ts +0 -33
  359. package/src/handlers/cron.ts +0 -141
  360. package/src/handlers/index.ts +0 -18
  361. package/src/handlers/sse.ts +0 -358
  362. package/src/handlers/stream.ts +0 -121
  363. package/src/handlers/webrtc.ts +0 -125
  364. package/src/handlers/websocket.ts +0 -203
  365. package/src/logger/console.ts +0 -323
  366. package/src/logger/index.ts +0 -2
  367. package/src/logger/internal.ts +0 -165
  368. package/src/logger/logger.ts +0 -44
  369. package/src/logger/user.ts +0 -15
  370. package/src/logger/util.ts +0 -80
  371. package/src/middleware.ts +0 -1095
  372. package/src/otel/config.ts +0 -47
  373. package/src/otel/console.ts +0 -91
  374. package/src/otel/exporters/README.md +0 -217
  375. package/src/otel/exporters/index.ts +0 -3
  376. package/src/otel/exporters/jsonl-log-exporter.ts +0 -113
  377. package/src/otel/exporters/jsonl-metric-exporter.ts +0 -120
  378. package/src/otel/exporters/jsonl-trace-exporter.ts +0 -121
  379. package/src/otel/fetch.ts +0 -105
  380. package/src/otel/http.ts +0 -53
  381. package/src/otel/logger.ts +0 -293
  382. package/src/otel/otel.ts +0 -354
  383. package/src/otel/tracestate.ts +0 -108
  384. package/src/router.ts +0 -75
  385. package/src/services/evalrun/composite.ts +0 -34
  386. package/src/services/evalrun/http.ts +0 -167
  387. package/src/services/evalrun/index.ts +0 -4
  388. package/src/services/evalrun/json.ts +0 -46
  389. package/src/services/evalrun/local.ts +0 -28
  390. package/src/services/local/README.md +0 -1576
  391. package/src/services/local/_db.ts +0 -353
  392. package/src/services/local/_router.ts +0 -40
  393. package/src/services/local/_util.ts +0 -55
  394. package/src/services/local/email.ts +0 -91
  395. package/src/services/local/index.ts +0 -9
  396. package/src/services/local/keyvalue.ts +0 -174
  397. package/src/services/local/queue.ts +0 -145
  398. package/src/services/local/stream.ts +0 -358
  399. package/src/services/local/task.ts +0 -1711
  400. package/src/services/local/vector.ts +0 -438
  401. package/src/services/sandbox/http.ts +0 -522
  402. package/src/services/sandbox/index.ts +0 -1
  403. package/src/services/session/composite.ts +0 -33
  404. package/src/services/session/http.ts +0 -167
  405. package/src/services/session/index.ts +0 -4
  406. package/src/services/session/json.ts +0 -42
  407. package/src/services/session/local.ts +0 -33
  408. package/src/services/thread/local.ts +0 -199
  409. package/src/session.ts +0 -1960
  410. package/src/signature.ts +0 -82
  411. package/src/validator.ts +0 -283
  412. package/src/version-check.ts +0 -184
  413. package/src/web.ts +0 -76
  414. package/src/webrtc-signaling.ts +0 -288
  415. package/src/workbench.ts +0 -725
@@ -1,142 +0,0 @@
1
- /**
2
- * Bun S3 monkey-patch for Agentuity storage endpoints
3
- *
4
- * Agentuity storage uses virtual-hosted-style URLs (e.g., ag-{id}.t3.storageapi.dev).
5
- * Bun's default s3 export uses path-style addressing, causing bucket path mismatch.
6
- *
7
- * This module patches Bun.S3Client.prototype methods to automatically set
8
- * virtualHostedStyle: true when S3_ENDPOINT matches *.storage.dev
9
- *
10
- * Patched methods:
11
- * - file(path, options?) - S3Options
12
- * - presign(path, options?) - S3FilePresignOptions
13
- * - write(path, data, options?) - S3Options
14
- * - delete(path, options?) - S3Options
15
- * - exists(path, options?) - S3Options
16
- * - stat(path, options?) - S3Options
17
- * - size(path, options?) - S3Options
18
- * - unlink(path, options?) - S3Options
19
- * - list(input?, options?) - options type doesn't include virtualHostedStyle but we inject it anyway
20
- */
21
- const PATCHED_SYMBOL = Symbol.for('agentuity.s3.patched');
22
- /**
23
- * Check if an endpoint is an Agentuity storage endpoint (*.storage.dev or *.storageapi.dev)
24
- */
25
- export function isAgentuityStorageEndpoint(raw) {
26
- let host = raw.trim();
27
- if (!host)
28
- return false;
29
- try {
30
- const url = new URL(host.includes('://') ? host : `https://${host}`);
31
- host = url.hostname;
32
- }
33
- catch {
34
- // raw value wasn't a URL string; treat it as host already
35
- }
36
- return (host === 'storage.dev' ||
37
- host.endsWith('.storage.dev') ||
38
- host === 'storageapi.dev' ||
39
- host.endsWith('.storageapi.dev'));
40
- }
41
- /**
42
- * Helper to inject virtualHostedStyle into options if not already set
43
- */
44
- function injectVirtualHostedStyle(options) {
45
- if (!options || typeof options.virtualHostedStyle === 'undefined') {
46
- return { ...options, virtualHostedStyle: true };
47
- }
48
- return options;
49
- }
50
- /**
51
- * Patch Bun's S3Client to automatically use virtualHostedStyle for storage.dev endpoints
52
- *
53
- * This function:
54
- * 1. Checks if we're running in Bun with S3 support
55
- * 2. Checks if S3_ENDPOINT (or AWS_ENDPOINT) points to *.storage.dev
56
- * 3. Patches S3Client.prototype methods to inject virtualHostedStyle: true
57
- *
58
- * Safe to call in non-Bun environments (will no-op).
59
- * Idempotent (safe to call multiple times).
60
- */
61
- export function patchBunS3ForStorageDev() {
62
- const bun = globalThis.Bun;
63
- if (!bun?.s3 || !bun.S3Client?.prototype?.file) {
64
- return;
65
- }
66
- const endpointEnv = process.env.S3_ENDPOINT ?? process.env.AWS_ENDPOINT;
67
- if (!endpointEnv) {
68
- return;
69
- }
70
- if (!isAgentuityStorageEndpoint(endpointEnv)) {
71
- return;
72
- }
73
- const S3ClientProto = bun.S3Client.prototype;
74
- if (S3ClientProto[PATCHED_SYMBOL]) {
75
- return;
76
- }
77
- // Patch file(path, options?)
78
- const originalFile = S3ClientProto.file;
79
- S3ClientProto.file = function patchedFile(path, options) {
80
- return originalFile.call(this, path, injectVirtualHostedStyle(options));
81
- };
82
- // Patch presign(path, options?)
83
- if (S3ClientProto.presign) {
84
- const originalPresign = S3ClientProto.presign;
85
- S3ClientProto.presign = function patchedPresign(path, options) {
86
- return originalPresign.call(this, path, injectVirtualHostedStyle(options));
87
- };
88
- }
89
- // Patch write(path, data, options?)
90
- if (S3ClientProto.write) {
91
- const originalWrite = S3ClientProto.write;
92
- S3ClientProto.write = function patchedWrite(path, data, options) {
93
- return originalWrite.call(this, path, data, injectVirtualHostedStyle(options));
94
- };
95
- }
96
- // Patch delete(path, options?)
97
- if (S3ClientProto.delete) {
98
- const originalDelete = S3ClientProto.delete;
99
- S3ClientProto.delete = function patchedDelete(path, options) {
100
- return originalDelete.call(this, path, injectVirtualHostedStyle(options));
101
- };
102
- }
103
- // Patch exists(path, options?)
104
- if (S3ClientProto.exists) {
105
- const originalExists = S3ClientProto.exists;
106
- S3ClientProto.exists = function patchedExists(path, options) {
107
- return originalExists.call(this, path, injectVirtualHostedStyle(options));
108
- };
109
- }
110
- // Patch stat(path, options?)
111
- if (S3ClientProto.stat) {
112
- const originalStat = S3ClientProto.stat;
113
- S3ClientProto.stat = function patchedStat(path, options) {
114
- return originalStat.call(this, path, injectVirtualHostedStyle(options));
115
- };
116
- }
117
- // Patch size(path, options?)
118
- if (S3ClientProto.size) {
119
- const originalSize = S3ClientProto.size;
120
- S3ClientProto.size = function patchedSize(path, options) {
121
- return originalSize.call(this, path, injectVirtualHostedStyle(options));
122
- };
123
- }
124
- // Patch unlink(path, options?)
125
- if (S3ClientProto.unlink) {
126
- const originalUnlink = S3ClientProto.unlink;
127
- S3ClientProto.unlink = function patchedUnlink(path, options) {
128
- return originalUnlink.call(this, path, injectVirtualHostedStyle(options));
129
- };
130
- }
131
- // Patch list(input?, options?)
132
- // Note: The TypeScript type for list's options doesn't include virtualHostedStyle,
133
- // but we inject it anyway as the underlying implementation may still use it
134
- if (S3ClientProto.list) {
135
- const originalList = S3ClientProto.list;
136
- S3ClientProto.list = function patchedList(input, options) {
137
- return originalList.call(this, input, injectVirtualHostedStyle(options));
138
- };
139
- }
140
- S3ClientProto[PATCHED_SYMBOL] = true;
141
- }
142
- //# sourceMappingURL=bun-s3-patch.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bun-s3-patch.js","sourceRoot":"","sources":["../src/bun-s3-patch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;AAE1D;;GAEG;AACH,MAAM,UAAU,0BAA0B,CAAC,GAAW;IACrD,IAAI,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;IACtB,IAAI,CAAC,IAAI;QAAE,OAAO,KAAK,CAAC;IAExB,IAAI,CAAC;QACJ,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,IAAI,EAAE,CAAC,CAAC;QACrE,IAAI,GAAG,GAAG,CAAC,QAAQ,CAAC;IACrB,CAAC;IAAC,MAAM,CAAC;QACR,0DAA0D;IAC3D,CAAC;IAED,OAAO,CACN,IAAI,KAAK,aAAa;QACtB,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC;QAC7B,IAAI,KAAK,gBAAgB;QACzB,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAChC,CAAC;AACH,CAAC;AAED;;GAEG;AACH,SAAS,wBAAwB,CAAC,OAAiC;IAClE,IAAI,CAAC,OAAO,IAAI,OAAO,OAAO,CAAC,kBAAkB,KAAK,WAAW,EAAE,CAAC;QACnE,OAAO,EAAE,GAAG,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC;IACjD,CAAC;IACD,OAAO,OAAO,CAAC;AAChB,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,uBAAuB;IACtC,MAAM,GAAG,GAAI,UAAsC,CAAC,G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iC;YAEjC,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC;QACzE,CAAC,CAAC;IACH,CAAC;IAED,+BAA+B;IAC/B,IAAI,aAAa,CAAC,MAAM,EAAE,CAAC;QAC1B,MAAM,cAAc,GAAG,aAAa,CAAC,MAAM,CAAC;QAC5C,aAAa,CAAC,MAAM,GAAG,SAAS,aAAa,CAE5C,IAAY,EACZ,OAAiC;YAEjC,OAAO,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC;QAC3E,CAAC,CAAC;IACH,CAAC;IAED,+BAA+B;IAC/B,mFAAmF;IACnF,4EAA4E;IAC5E,IAAI,aAAa,CAAC,IAAI,EAAE,CAAC;QACxB,MAAM,YAAY,GAAG,aAAa,CAAC,IAAI,CAAC;QACxC,aAAa,CAAC,IAAI,GAAG,SAAS,WAAW,CAExC,KAAsC,EACtC,OAAiC;YAEjC,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,wBAAwB,CAAC,OAAO,CAAC,CAAC,CAAC;QAC1E,CAAC,CAAC;IACH,CAAC;IAED,aAAa,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC;AACtC,CAAC"}
package/dist/cors.d.ts DELETED
@@ -1,42 +0,0 @@
1
- /**
2
- * CORS trusted origin helpers for same-origin configuration.
3
- *
4
- * Provides the same trusted-origin logic as @agentuity/auth,
5
- * allowing CORS to be restricted to platform-trusted domains.
6
- */
7
- import type { Context } from 'hono';
8
- /**
9
- * Options for createTrustedCorsOrigin.
10
- */
11
- export interface TrustedCorsOriginOptions {
12
- /**
13
- * Additional origins to allow on top of environment-derived ones.
14
- * Can be full URLs (https://example.com) or bare domains (example.com).
15
- */
16
- allowedOrigins?: string[];
17
- }
18
- /**
19
- * Create a Hono CORS origin callback that only allows trusted origins.
20
- *
21
- * Trusted origins are derived from:
22
- * - AGENTUITY_BASE_URL environment variable
23
- * - AGENTUITY_CLOUD_DOMAINS environment variable (comma-separated)
24
- * - AUTH_TRUSTED_DOMAINS environment variable (comma-separated)
25
- * - The same-origin of the incoming request URL
26
- * - Any additional origins specified in allowedOrigins option
27
- *
28
- * @example
29
- * ```typescript
30
- * import { createApp, createTrustedCorsOrigin } from '@agentuity/runtime';
31
- *
32
- * await createApp({
33
- * cors: {
34
- * origin: createTrustedCorsOrigin({
35
- * allowedOrigins: ['https://admin.myapp.com'],
36
- * }),
37
- * },
38
- * });
39
- * ```
40
- */
41
- export declare function createTrustedCorsOrigin(options?: TrustedCorsOriginOptions): (origin: string, c: Context) => string | undefined;
42
- //# sourceMappingURL=cors.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cors.d.ts","sourceRoot":"","sources":["../src/cors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAwEpC;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACxC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,uBAAuB,CACtC,OAAO,CAAC,EAAE,wBAAwB,GAChC,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,KAAK,MAAM,GAAG,SAAS,CAqBpD"}
package/dist/cors.js DELETED
@@ -1,117 +0,0 @@
1
- /**
2
- * CORS trusted origin helpers for same-origin configuration.
3
- *
4
- * Provides the same trusted-origin logic as @agentuity/auth,
5
- * allowing CORS to be restricted to platform-trusted domains.
6
- */
7
- /**
8
- * Safely extract origin from a URL string.
9
- * Returns undefined if the URL is invalid.
10
- */
11
- function safeOrigin(url) {
12
- if (!url)
13
- return undefined;
14
- try {
15
- return new URL(url).origin;
16
- }
17
- catch {
18
- return undefined;
19
- }
20
- }
21
- /**
22
- * Parse an origin-like value (URL or bare domain) into a normalized origin.
23
- *
24
- * - Full URLs (http://... or https://...) are parsed as-is
25
- * - Bare domains (example.com) are treated as https://
26
- * - Invalid values return undefined
27
- */
28
- function parseOriginLike(value) {
29
- const trimmed = value.trim();
30
- if (!trimmed)
31
- return undefined;
32
- // If it looks like a URL (has a scheme), parse directly
33
- if (/^[a-zA-Z][a-zA-Z0-9+.-]*:\/\//.test(trimmed)) {
34
- return safeOrigin(trimmed);
35
- }
36
- // Otherwise, treat as host[:port] and assume https
37
- return safeOrigin(`https://${trimmed}`);
38
- }
39
- /**
40
- * Build the static trusted origins set from environment variables.
41
- *
42
- * Reads from:
43
- * - AGENTUITY_BASE_URL - The base URL for the deployment
44
- * - AGENTUITY_CLOUD_DOMAINS - Platform-set domains (comma-separated)
45
- * - AUTH_TRUSTED_DOMAINS - Developer-set additional domains (comma-separated)
46
- */
47
- function buildEnvTrustedOrigins() {
48
- const agentuityURL = process.env.AGENTUITY_BASE_URL;
49
- const cloudDomains = process.env.AGENTUITY_CLOUD_DOMAINS;
50
- const devTrustedDomains = process.env.AUTH_TRUSTED_DOMAINS;
51
- const origins = new Set();
52
- const agentuityOrigin = safeOrigin(agentuityURL);
53
- if (agentuityOrigin)
54
- origins.add(agentuityOrigin);
55
- // Platform-set cloud domains (deployment, project, PR, custom domains, tunnels)
56
- if (cloudDomains) {
57
- for (const raw of cloudDomains.split(',')) {
58
- const origin = parseOriginLike(raw);
59
- if (origin)
60
- origins.add(origin);
61
- }
62
- }
63
- // Developer-set additional trusted domains
64
- if (devTrustedDomains) {
65
- for (const raw of devTrustedDomains.split(',')) {
66
- const origin = parseOriginLike(raw);
67
- if (origin)
68
- origins.add(origin);
69
- }
70
- }
71
- return origins;
72
- }
73
- /**
74
- * Create a Hono CORS origin callback that only allows trusted origins.
75
- *
76
- * Trusted origins are derived from:
77
- * - AGENTUITY_BASE_URL environment variable
78
- * - AGENTUITY_CLOUD_DOMAINS environment variable (comma-separated)
79
- * - AUTH_TRUSTED_DOMAINS environment variable (comma-separated)
80
- * - The same-origin of the incoming request URL
81
- * - Any additional origins specified in allowedOrigins option
82
- *
83
- * @example
84
- * ```typescript
85
- * import { createApp, createTrustedCorsOrigin } from '@agentuity/runtime';
86
- *
87
- * await createApp({
88
- * cors: {
89
- * origin: createTrustedCorsOrigin({
90
- * allowedOrigins: ['https://admin.myapp.com'],
91
- * }),
92
- * },
93
- * });
94
- * ```
95
- */
96
- export function createTrustedCorsOrigin(options) {
97
- // Build static origins from env vars at creation time
98
- const baseOrigins = buildEnvTrustedOrigins();
99
- // Add any extra origins from options
100
- if (options?.allowedOrigins) {
101
- for (const raw of options.allowedOrigins) {
102
- const origin = parseOriginLike(raw);
103
- if (origin)
104
- baseOrigins.add(origin);
105
- }
106
- }
107
- return (origin, c) => {
108
- // Build allowed set per-request to include same-origin of the server
109
- const allowed = new Set(baseOrigins);
110
- const requestOrigin = safeOrigin(c.req.url);
111
- if (requestOrigin)
112
- allowed.add(requestOrigin);
113
- // Only echo back if trusted; otherwise return undefined (no CORS header)
114
- return allowed.has(origin) ? origin : undefined;
115
- };
116
- }
117
- //# sourceMappingURL=cors.js.map
package/dist/cors.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"cors.js","sourceRoot":"","sources":["../src/cors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH;;;GAGG;AACH,SAAS,UAAU,CAAC,GAAuB;IAC1C,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC;IAC3B,IAAI,CAAC;QACJ,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,SAAS,CAAC;IAClB,CAAC;AACF,CAAC;AAED;;;;;;GAMG;AACH,SAAS,eAAe,CAAC,KAAa;IACrC,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS,CAAC;IAE/B,wDA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BAAuB,CACtC,OAAkC;IAElC,sDAAsD;IACtD,MAAM,WAAW,GAAG,sBAAsB,EAAE,CAAC;IAE7C,qCAAqC;IACrC,IAAI,OAAO,EAAE,cAAc,EAAE,CAAC;QAC7B,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;YAC1C,MAAM,MAAM,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;YACpC,IAAI,MAAM;gBAAE,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACrC,CAAC;IACF,CAAC;IAED,OAAO,CAAC,MAAc,EAAE,CAAU,EAAsB,EAAE;QACzD,qEAAqE;QACrE,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,WAAW,CAAC,CAAC;QACrC,MAAM,aAAa,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC5C,IAAI,aAAa;YAAE,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;QAE9C,yEAAyE;QACzE,OAAO,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;IACjD,CAAC,CAAC;AACH,CAAC"}
@@ -1,17 +0,0 @@
1
- /**
2
- * Runtime AI SDK patches for dev mode.
3
- *
4
- * Replaces the build-time patches from cli/src/cmd/build/patch/aisdk.ts.
5
- * Monkey-patches Vercel AI SDK functions to:
6
- * 1. Enable experimental telemetry on all AI function calls
7
- * 2. Route AI SDK provider factory functions through the AI Gateway
8
- */
9
- /**
10
- * Patch AI SDK core functions (generateText, streamText, etc.) with telemetry injection.
11
- */
12
- export declare function applyAISDKCorePatches(): Promise<void>;
13
- /**
14
- * Patch AI SDK provider factory functions to route through the AI Gateway.
15
- */
16
- export declare function applyAISDKProviderPatches(): Promise<void>;
17
- //# sourceMappingURL=aisdk.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"aisdk.d.ts","sourceRoot":"","sources":["../../src/dev-patches/aisdk.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAgIH;;GAEG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAC,IAAI,CAAC,CAa3D;AAED;;GAEG;AACH,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,IAAI,CAAC,CAY/D"}
@@ -1,160 +0,0 @@
1
- /**
2
- * Runtime AI SDK patches for dev mode.
3
- *
4
- * Replaces the build-time patches from cli/src/cmd/build/patch/aisdk.ts.
5
- * Monkey-patches Vercel AI SDK functions to:
6
- * 1. Enable experimental telemetry on all AI function calls
7
- * 2. Route AI SDK provider factory functions through the AI Gateway
8
- */
9
- var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
10
- if (typeof path === "string" && /^\.\.?\//.test(path)) {
11
- return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
12
- return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
13
- });
14
- }
15
- return path;
16
- };
17
- /* eslint-disable @typescript-eslint/no-explicit-any */
18
- function warnMissingKey(envKey) {
19
- const isDev = process.env.AGENTUITY_ENVIRONMENT === 'development' || process.env.NODE_ENV !== 'production';
20
- // Align no-bundle runtime behavior with historical build-time expectations:
21
- // in development, don't emit eager startup errors for every provider.
22
- if (isDev) {
23
- return;
24
- }
25
- console.error(`[ERROR] The environment variable ${envKey} is required. Either:`);
26
- console.error(' 1. Use Agentuity Cloud AI Gateway by ensuring AGENTUITY_SDK_KEY is configured');
27
- console.error(` 2. Set ${envKey} using "agentuity env set ${envKey}" and redeploy`);
28
- }
29
- /**
30
- * Wrap an AI SDK function to inject experimental_telemetry: { isEnabled: true }.
31
- */
32
- function wrapWithTelemetry(originalFn) {
33
- return function (...args) {
34
- const opts = { ...(args[0] ?? {}) };
35
- opts.experimental_telemetry = { isEnabled: true };
36
- args[0] = opts;
37
- return originalFn.apply(this, args);
38
- };
39
- }
40
- /**
41
- * Wrap a provider factory function (e.g., createOpenAI) to inject gateway config.
42
- */
43
- function wrapProviderFactory(originalFn, envKey, provider) {
44
- return function (...args) {
45
- const currentKey = process.env[envKey];
46
- const sdkKey = process.env.AGENTUITY_SDK_KEY;
47
- // If user provided their own key (and it's not the SDK key), leave it alone
48
- if (currentKey && currentKey !== sdkKey) {
49
- if (!sdkKey) {
50
- console.log(`User provided ${provider} api key set. Use the Agentuity AI Gateway more features.`);
51
- }
52
- return originalFn.apply(this, args);
53
- }
54
- // Route through gateway
55
- const transportUrl = process.env.AGENTUITY_TRANSPORT_URL;
56
- if (transportUrl && sdkKey) {
57
- const opts = { ...(args[0] ?? {}) };
58
- if (!opts.baseURL) {
59
- opts.apiKey = sdkKey;
60
- opts.baseURL = `${transportUrl}/gateway/${provider}`;
61
- args[0] = opts;
62
- }
63
- }
64
- else if (!currentKey) {
65
- warnMissingKey(envKey);
66
- }
67
- return originalFn.apply(this, args);
68
- };
69
- }
70
- /** AI SDK core functions to wrap with telemetry injection */
71
- const AI_CORE_FUNCTIONS = [
72
- 'generateText',
73
- 'streamText',
74
- 'generateObject',
75
- 'streamObject',
76
- 'embed',
77
- 'embedMany',
78
- ];
79
- /** AI SDK provider packages and their factory functions */
80
- const AI_PROVIDER_CONFIGS = [
81
- {
82
- module: '@ai-sdk/openai',
83
- factory: 'createOpenAI',
84
- envKey: 'OPENAI_API_KEY',
85
- provider: 'openai',
86
- },
87
- {
88
- module: '@ai-sdk/anthropic',
89
- factory: 'createAnthropic',
90
- envKey: 'ANTHROPIC_API_KEY',
91
- provider: 'anthropic',
92
- },
93
- {
94
- module: '@ai-sdk/cohere',
95
- factory: 'createCohere',
96
- envKey: 'COHERE_API_KEY',
97
- provider: 'cohere',
98
- },
99
- {
100
- module: '@ai-sdk/deepseek',
101
- factory: 'createDeepSeek',
102
- envKey: 'DEEPSEEK_API_KEY',
103
- provider: 'deepseek',
104
- },
105
- {
106
- module: '@ai-sdk/google',
107
- factory: 'createGoogleGenerativeAI',
108
- envKey: 'GOOGLE_GENERATIVE_AI_API_KEY',
109
- provider: 'google-ai-studio',
110
- },
111
- { module: '@ai-sdk/xai', factory: 'createXai', envKey: 'XAI_API_KEY', provider: 'grok' },
112
- { module: '@ai-sdk/groq', factory: 'createGroq', envKey: 'GROQ_API_KEY', provider: 'groq' },
113
- {
114
- module: '@ai-sdk/mistral',
115
- factory: 'createMistral',
116
- envKey: 'MISTRAL_API_KEY',
117
- provider: 'mistral',
118
- },
119
- {
120
- module: '@ai-sdk/perplexity',
121
- factory: 'createPerplexity',
122
- envKey: 'PERPLEXITY_API_KEY',
123
- provider: 'perplexity-ai',
124
- },
125
- ];
126
- /**
127
- * Patch AI SDK core functions (generateText, streamText, etc.) with telemetry injection.
128
- */
129
- export async function applyAISDKCorePatches() {
130
- try {
131
- const aiModule = await import('ai');
132
- for (const fnName of AI_CORE_FUNCTIONS) {
133
- const original = aiModule[fnName];
134
- if (typeof original === 'function') {
135
- aiModule[fnName] = wrapWithTelemetry(original);
136
- }
137
- }
138
- }
139
- catch {
140
- // 'ai' package not installed — skip
141
- }
142
- }
143
- /**
144
- * Patch AI SDK provider factory functions to route through the AI Gateway.
145
- */
146
- export async function applyAISDKProviderPatches() {
147
- for (const config of AI_PROVIDER_CONFIGS) {
148
- try {
149
- const mod = await import(__rewriteRelativeImportExtension(config.module));
150
- const original = mod[config.factory];
151
- if (typeof original === 'function') {
152
- mod[config.factory] = wrapProviderFactory(original, config.envKey, config.provider);
153
- }
154
- }
155
- catch {
156
- // Provider package not installed — skip
157
- }
158
- }
159
- }
160
- //# sourceMappingURL=aisdk.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"aisdk.js","sourceRoot":"","sources":["../../src/dev-patches/aisdk.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;;;;;;;;;AAEH,uDAAuD;AAEvD,SAAS,cAAc,CAAC,MAAc;IACrC,MAAM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AAG,MAAM,MAAM,kCAAC,MAAM,CAAC,MAAM,EAAC,CAAC;YACxC,MAAM,QAAQ,GAAG,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACrC,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;gBACpC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;YACrF,CAAC;QACF,CAAC;QAAC,MAAM,CAAC;YACR,wCAAwC;QACzC,CAAC;IACF,CAAC;AACF,CAAC"}
@@ -1,16 +0,0 @@
1
- /**
2
- * Runtime LLM Gateway patches for dev mode.
3
- *
4
- * Replaces the build-time patches from cli/src/cmd/build/patch/llm.ts.
5
- * Sets environment variables to route LLM SDK calls through the Agentuity AI Gateway
6
- * when the user hasn't provided their own API keys.
7
- */
8
- /**
9
- * Set environment variables to route LLM calls through the AI Gateway.
10
- *
11
- * For each provider, if the user hasn't set their own API key (or it equals
12
- * the SDK key), we redirect to the gateway. This matches the behavior of
13
- * the build-time patches in patch/llm.ts.
14
- */
15
- export declare function applyGatewayPatches(): void;
16
- //# sourceMappingURL=gateway.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"gateway.d.ts","sourceRoot":"","sources":["../../src/dev-patches/gateway.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA8BH;;;;;;GAMG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAwB1C"}
@@ -1,54 +0,0 @@
1
- /**
2
- * Runtime LLM Gateway patches for dev mode.
3
- *
4
- * Replaces the build-time patches from cli/src/cmd/build/patch/llm.ts.
5
- * Sets environment variables to route LLM SDK calls through the Agentuity AI Gateway
6
- * when the user hasn't provided their own API keys.
7
- */
8
- const GATEWAY_CONFIGS = [
9
- { apiKeyEnv: 'ANTHROPIC_API_KEY', baseUrlEnv: 'ANTHROPIC_BASE_URL', provider: 'anthropic' },
10
- { apiKeyEnv: 'GROQ_API_KEY', baseUrlEnv: 'GROQ_BASE_URL', provider: 'groq' },
11
- { apiKeyEnv: 'OPENAI_API_KEY', baseUrlEnv: 'OPENAI_BASE_URL', provider: 'openai' },
12
- ];
13
- function warnMissingKey(envKey) {
14
- const isDev = process.env.AGENTUITY_ENVIRONMENT === 'development' || process.env.NODE_ENV !== 'production';
15
- // Align no-bundle runtime behavior with historical build-time expectations:
16
- // in development, don't emit eager startup errors for every provider.
17
- // Missing credentials should surface when/if that provider is actually used.
18
- if (isDev) {
19
- return;
20
- }
21
- console.error(`[ERROR] The environment variable ${envKey} is required. Either:`);
22
- console.error(' 1. Use Agentuity Cloud AI Gateway by ensuring AGENTUITY_SDK_KEY is configured');
23
- console.error(` 2. Set ${envKey} using "agentuity env set ${envKey}" and redeploy`);
24
- }
25
- /**
26
- * Set environment variables to route LLM calls through the AI Gateway.
27
- *
28
- * For each provider, if the user hasn't set their own API key (or it equals
29
- * the SDK key), we redirect to the gateway. This matches the behavior of
30
- * the build-time patches in patch/llm.ts.
31
- */
32
- export function applyGatewayPatches() {
33
- const sdkKey = process.env.AGENTUITY_SDK_KEY;
34
- const gatewayUrl = process.env.AGENTUITY_AIGATEWAY_URL ||
35
- process.env.AGENTUITY_TRANSPORT_URL ||
36
- (sdkKey ? 'https://catalyst.agentuity.cloud' : '');
37
- for (const config of GATEWAY_CONFIGS) {
38
- const currentKey = process.env[config.apiKeyEnv];
39
- // If the user provided their own key (and it's not the SDK key), leave it alone
40
- if (currentKey && currentKey !== sdkKey) {
41
- continue;
42
- }
43
- // Route through gateway if we have both URL and SDK key
44
- if (gatewayUrl && sdkKey) {
45
- process.env[config.apiKeyEnv] = sdkKey;
46
- process.env[config.baseUrlEnv] = `${gatewayUrl}/gateway/${config.provider}`;
47
- console.debug(`Enabled Agentuity AI Gateway for ${config.provider}`);
48
- }
49
- else if (!currentKey) {
50
- warnMissingKey(config.apiKeyEnv);
51
- }
52
- }
53
- }
54
- //# sourceMappingUR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AG,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAEjD,gFAAgF;QAChF,IAAI,UAAU,IAAI,UAAU,KAAK,MAAM,EAAE,CAAC;YACzC,SAAS;QACV,CAAC;QAED,wDAAwD;QACxD,IAAI,UAAU,IAAI,MAAM,EAAE,CAAC;YAC1B,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,MAAM,CAAC;YACvC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,GAAG,GAAG,UAAU,YAAY,MAAM,CAAC,QAAQ,EAAE,CAAC;YAC5E,OAAO,CAAC,KAAK,CAAC,oCAAoC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;QACtE,CAAC;aAAM,IAAI,CAAC,UAAU,EAAE,CAAC;YACxB,cAAc,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAClC,CAAC;IACF,CAAC;AACF,CAAC"}
@@ -1,21 +0,0 @@
1
- /**
2
- * Runtime dev patches — replaces build-time Bun.build patches for dev mode.
3
- *
4
- * When --experimental-no-bundle is used, the generated entry file (src/generated/app.ts)
5
- * is run directly by Bun without bundling. These runtime patches apply the same
6
- * monkey-patches that would normally be injected by the Bun.build plugin during bundling.
7
- *
8
- * Three categories of patches:
9
- * 1. Gateway: Set env vars to route LLM calls through Agentuity AI Gateway
10
- * 2. AI SDK: Wrap Vercel AI SDK functions with telemetry + gateway config
11
- * 3. OTel LLM: Wrap LLM SDK .create() methods with OpenTelemetry spans
12
- */
13
- /**
14
- * Apply all runtime dev patches.
15
- *
16
- * Must be called:
17
- * - AFTER bootstrapRuntimeEnv() (so env vars like AGENTUITY_SDK_KEY are loaded)
18
- * - BEFORE any user code imports LLM SDKs
19
- */
20
- export declare function applyDevPatches(): Promise<void>;
21
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/dev-patches/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH;;;;;;GAMG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,IAAI,CAAC,CAYrD"}
@@ -1,33 +0,0 @@
1
- /**
2
- * Runtime dev patches — replaces build-time Bun.build patches for dev mode.
3
- *
4
- * When --experimental-no-bundle is used, the generated entry file (src/generated/app.ts)
5
- * is run directly by Bun without bundling. These runtime patches apply the same
6
- * monkey-patches that would normally be injected by the Bun.build plugin during bundling.
7
- *
8
- * Three categories of patches:
9
- * 1. Gateway: Set env vars to route LLM calls through Agentuity AI Gateway
10
- * 2. AI SDK: Wrap Vercel AI SDK functions with telemetry + gateway config
11
- * 3. OTel LLM: Wrap LLM SDK .create() methods with OpenTelemetry spans
12
- */
13
- import { applyGatewayPatches } from './gateway';
14
- import { applyAISDKCorePatches, applyAISDKProviderPatches } from './aisdk';
15
- import { applyOtelLLMPatches } from './otel-llm';
16
- /**
17
- * Apply all runtime dev patches.
18
- *
19
- * Must be called:
20
- * - AFTER bootstrapRuntimeEnv() (so env vars like AGENTUITY_SDK_KEY are loaded)
21
- * - BEFORE any user code imports LLM SDKs
22
- */
23
- export async function applyDevPatches() {
24
- // 1. Set gateway env vars first (other patches may read them)
25
- applyGatewayPatches();
26
- // 2. Patch AI SDK core functions (telemetry injection)
27
- await applyAISDKCorePatches();
28
- // 3. Patch AI SDK provider factories (gateway routing)
29
- await applyAISDKProviderPatches();
30
- // 4. Patch LLM SDK prototypes with OTel spans
31
- await applyOtelLLMPatches();
32
- }
33
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/dev-patches/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEjD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe;IACpC,8DAA8D;IAC9D,mBAAmB,EAAE,CAAC;IAEtB,uDAAuD;IACvD,MAAM,qBAAqB,EAAE,CAAC;IAE9B,uDAAuD;IACvD,MAAM,yBAAyB,EAAE,CAAC;IAElC,8CAA8C;IAC9C,MAAM,mBAAmB,EAAE,CAAC;AAC7B,CAAC"}