theokit 0.48.13 → 0.50.0

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 (327) hide show
  1. package/README.md +1 -0
  2. package/dist/{actions-virtual-module-YQXRSSMW.js → actions-virtual-module-5WBVSDOM.js} +22 -12
  3. package/dist/actions-virtual-module-5WBVSDOM.js.map +1 -0
  4. package/dist/{actions-virtual-module-LB4NGONI.js → actions-virtual-module-ZYLMNW6K.js} +13 -8
  5. package/dist/{actions-virtual-module-LB4NGONI.js.map → actions-virtual-module-ZYLMNW6K.js.map} +1 -1
  6. package/dist/adapters/agent-mount.d.ts +127 -0
  7. package/dist/adapters/agent-mount.js +24 -0
  8. package/dist/adapters/security-headers.d.ts +132 -0
  9. package/dist/adapters/security-headers.js +64 -0
  10. package/dist/adapters/security-headers.js.map +1 -0
  11. package/dist/adapters/web-shim.d.ts +100 -13
  12. package/dist/adapters/web-shim.js +158 -54
  13. package/dist/adapters/web-shim.js.map +1 -1
  14. package/dist/agent-GKUEL6OH.js +15 -0
  15. package/dist/agent-scan-BZa-pagG.d.ts +16 -0
  16. package/dist/{app-typed-client-GHO3EWZK.js → app-typed-client-4LAIEGFX.js} +23 -13
  17. package/dist/app-typed-client-4LAIEGFX.js.map +1 -0
  18. package/dist/{app-typed-client-G3J5G7E5.js → app-typed-client-DQM3Y6YY.js} +14 -9
  19. package/dist/app-typed-client-DQM3Y6YY.js.map +1 -0
  20. package/dist/aws-lambda-VKMYUMP2.js +261 -0
  21. package/dist/aws-lambda-VKMYUMP2.js.map +1 -0
  22. package/dist/{build-WU6AKKIB.js → build-FLX6VF7Q.js} +71 -26
  23. package/dist/build-FLX6VF7Q.js.map +1 -0
  24. package/dist/{bun-33RD6K7O.js → bun-L7PP6ID5.js} +105 -13
  25. package/dist/bun-L7PP6ID5.js.map +1 -0
  26. package/dist/{check-45NKUVSQ.js → check-GIPZBFTX.js} +2 -2
  27. package/dist/{chunk-KD5G3YXI.js → chunk-2AMLGJJA.js} +35 -9
  28. package/dist/chunk-2AMLGJJA.js.map +1 -0
  29. package/dist/chunk-3PBAN2YE.js +146 -0
  30. package/dist/chunk-3PBAN2YE.js.map +1 -0
  31. package/dist/{chunk-HBU2GIMZ.js → chunk-3QPVEJ7D.js} +15 -9
  32. package/dist/chunk-3QPVEJ7D.js.map +1 -0
  33. package/dist/{chunk-47CINLWF.js → chunk-44J2ANQC.js} +2 -2
  34. package/dist/{chunk-IEES3CHD.js → chunk-47MM2JUK.js} +8 -2
  35. package/dist/chunk-47MM2JUK.js.map +1 -0
  36. package/dist/chunk-4X6H2BXP.js +108 -0
  37. package/dist/chunk-4X6H2BXP.js.map +1 -0
  38. package/dist/{chunk-A7JBF5FO.js → chunk-5K4TDLRG.js} +8 -5
  39. package/dist/chunk-5K4TDLRG.js.map +1 -0
  40. package/dist/chunk-5YPXXSYY.js +181 -0
  41. package/dist/chunk-5YPXXSYY.js.map +1 -0
  42. package/dist/{chunk-YGAXV5HR.js → chunk-6J4JWHDJ.js} +191 -112
  43. package/dist/chunk-6J4JWHDJ.js.map +1 -0
  44. package/dist/chunk-72DMJBXI.js +424 -0
  45. package/dist/chunk-72DMJBXI.js.map +1 -0
  46. package/dist/chunk-7PM6K5EV.js +513 -0
  47. package/dist/chunk-7PM6K5EV.js.map +1 -0
  48. package/dist/{chunk-MTEWLGVY.js → chunk-BPYMC7SU.js} +4 -48
  49. package/dist/chunk-BPYMC7SU.js.map +1 -0
  50. package/dist/chunk-BU6RJPPJ.js +421 -0
  51. package/dist/chunk-BU6RJPPJ.js.map +1 -0
  52. package/dist/{chunk-FB2HBNIC.js → chunk-BX6EUYHU.js} +6 -2
  53. package/dist/chunk-BX6EUYHU.js.map +1 -0
  54. package/dist/{chunk-BIVCP6X5.js → chunk-C62IZEJI.js} +465 -202
  55. package/dist/chunk-C62IZEJI.js.map +1 -0
  56. package/dist/chunk-D4VP2QPR.js +16 -0
  57. package/dist/chunk-D4VP2QPR.js.map +1 -0
  58. package/dist/{chunk-J5MXCGKA.js → chunk-DHAD2O3S.js} +6 -6
  59. package/dist/chunk-DHAD2O3S.js.map +1 -0
  60. package/dist/chunk-E43VJ3E5.js +188 -0
  61. package/dist/chunk-E43VJ3E5.js.map +1 -0
  62. package/dist/chunk-EVZKNA2W.js +110 -0
  63. package/dist/chunk-EVZKNA2W.js.map +1 -0
  64. package/dist/chunk-FD4ZDTQ6.js +181 -0
  65. package/dist/chunk-FD4ZDTQ6.js.map +1 -0
  66. package/dist/chunk-FDOOBTXJ.js +17 -0
  67. package/dist/chunk-FDOOBTXJ.js.map +1 -0
  68. package/dist/chunk-FH3SQR6P.js +275 -0
  69. package/dist/chunk-FH3SQR6P.js.map +1 -0
  70. package/dist/chunk-HJHGTFEJ.js +23 -0
  71. package/dist/chunk-HJHGTFEJ.js.map +1 -0
  72. package/dist/{chunk-LXAESF4Y.js → chunk-HK4AZBKX.js} +7 -4
  73. package/dist/chunk-HK4AZBKX.js.map +1 -0
  74. package/dist/{chunk-T5C46IIU.js → chunk-HWBRS4DZ.js} +28 -269
  75. package/dist/chunk-HWBRS4DZ.js.map +1 -0
  76. package/dist/chunk-IRQGAC4L.js +52 -0
  77. package/dist/chunk-IRQGAC4L.js.map +1 -0
  78. package/dist/{chunk-FNTLKHZ7.js → chunk-JDN5SAAD.js} +7 -4
  79. package/dist/chunk-JDN5SAAD.js.map +1 -0
  80. package/dist/{chunk-GXEX4CBH.js → chunk-JIKNR5LX.js} +673 -484
  81. package/dist/chunk-JIKNR5LX.js.map +1 -0
  82. package/dist/{chunk-GRI4XHBJ.js → chunk-JWRCZIA4.js} +266 -108
  83. package/dist/chunk-JWRCZIA4.js.map +1 -0
  84. package/dist/{chunk-E576KYYT.js → chunk-KI4DOTN4.js} +25 -2
  85. package/dist/chunk-KI4DOTN4.js.map +1 -0
  86. package/dist/{chunk-ZB7D62OA.js → chunk-KUZVRJ7M.js} +3 -3
  87. package/dist/chunk-L4VFNFDL.js +248 -0
  88. package/dist/chunk-L4VFNFDL.js.map +1 -0
  89. package/dist/chunk-M2WC5MF7.js +127 -0
  90. package/dist/chunk-M2WC5MF7.js.map +1 -0
  91. package/dist/{chunk-O3JIAU3V.js → chunk-MCTC6HSE.js} +157 -103
  92. package/dist/chunk-MCTC6HSE.js.map +1 -0
  93. package/dist/{chunk-PXFXSFJL.js → chunk-NZ5JU6D3.js} +9 -9
  94. package/dist/{chunk-YRBR424R.js → chunk-OAUI273L.js} +338 -165
  95. package/dist/chunk-OAUI273L.js.map +1 -0
  96. package/dist/chunk-OGLS76RN.js +43 -0
  97. package/dist/chunk-OGLS76RN.js.map +1 -0
  98. package/dist/{chunk-7LVM22VG.js → chunk-OQCRCXCP.js} +6 -6
  99. package/dist/chunk-OQCRCXCP.js.map +1 -0
  100. package/dist/{chunk-OLGPYOLO.js → chunk-P6OS7652.js} +5 -2
  101. package/dist/chunk-P6OS7652.js.map +1 -0
  102. package/dist/chunk-Q5L5EGWZ.js +26 -0
  103. package/dist/chunk-Q5L5EGWZ.js.map +1 -0
  104. package/dist/{chunk-S433N3CT.js → chunk-QTHVHNJJ.js} +6 -36
  105. package/dist/chunk-QTHVHNJJ.js.map +1 -0
  106. package/dist/chunk-RPET332G.js +84 -0
  107. package/dist/chunk-RPET332G.js.map +1 -0
  108. package/dist/{chunk-646CA6RV.js → chunk-RQW5YMH7.js} +12 -4
  109. package/dist/chunk-RQW5YMH7.js.map +1 -0
  110. package/dist/{chunk-XALU5LCU.js → chunk-RWNYIU6A.js} +550 -146
  111. package/dist/chunk-RWNYIU6A.js.map +1 -0
  112. package/dist/chunk-SL7YUHPV.js +111 -0
  113. package/dist/chunk-SL7YUHPV.js.map +1 -0
  114. package/dist/chunk-U5PWXS3J.js +39 -0
  115. package/dist/chunk-U5PWXS3J.js.map +1 -0
  116. package/dist/chunk-ULDCFL2O.js +273 -0
  117. package/dist/chunk-ULDCFL2O.js.map +1 -0
  118. package/dist/{chunk-RWNSW4FM.js → chunk-UMNXCU3K.js} +12 -6
  119. package/dist/{chunk-RWNSW4FM.js.map → chunk-UMNXCU3K.js.map} +1 -1
  120. package/dist/chunk-VI7ZANB3.js +193 -0
  121. package/dist/chunk-VI7ZANB3.js.map +1 -0
  122. package/dist/chunk-VQPHPQ5L.js +14 -0
  123. package/dist/chunk-VQPHPQ5L.js.map +1 -0
  124. package/dist/chunk-WNJTJRM6.js +147 -0
  125. package/dist/chunk-WNJTJRM6.js.map +1 -0
  126. package/dist/chunk-WOBSEO75.js +790 -0
  127. package/dist/chunk-WOBSEO75.js.map +1 -0
  128. package/dist/{chunk-BMHS4WAN.js → chunk-XS7EX55U.js} +156 -42
  129. package/dist/chunk-XS7EX55U.js.map +1 -0
  130. package/dist/chunk-YN4W7LCX.js +31 -0
  131. package/dist/chunk-YN4W7LCX.js.map +1 -0
  132. package/dist/chunk-YSJOZEI6.js +1 -0
  133. package/dist/{chunk-JA2ZAT5Q.js → chunk-Z4PJMZLM.js} +2 -2
  134. package/dist/chunk-Z4PJMZLM.js.map +1 -0
  135. package/dist/{chunk-7VPQHEAJ.js → chunk-ZNZISJDZ.js} +6 -2
  136. package/dist/chunk-ZNZISJDZ.js.map +1 -0
  137. package/dist/chunk-ZWN3AODA.js +11 -0
  138. package/dist/chunk-ZWN3AODA.js.map +1 -0
  139. package/dist/cli/index.js +25 -10
  140. package/dist/cli/index.js.map +1 -1
  141. package/dist/client/core.d.ts +1 -1
  142. package/dist/client/core.js +2 -0
  143. package/dist/client/core.js.map +1 -1
  144. package/dist/client/index.d.ts +44 -10
  145. package/dist/client/index.js +35 -0
  146. package/dist/client/index.js.map +1 -1
  147. package/dist/cloudflare-SIG42OIW.js +335 -0
  148. package/dist/cloudflare-SIG42OIW.js.map +1 -0
  149. package/dist/config-support-WQHQIJTA.js +104 -0
  150. package/dist/config-support-WQHQIJTA.js.map +1 -0
  151. package/dist/{csrf-BBrEZSBW.d.ts → csrf-Dgot9qSM.d.ts} +1 -1
  152. package/dist/deno-deploy-LQAYOOPW.js +196 -0
  153. package/dist/deno-deploy-LQAYOOPW.js.map +1 -0
  154. package/dist/{dev-MUWJAZRD.js → dev-ANDSEVLB.js} +28 -18
  155. package/dist/dev-ANDSEVLB.js.map +1 -0
  156. package/dist/{dev-emit-GWD6IXV7.js → dev-emit-BFNMDCPB.js} +5 -5
  157. package/dist/{dev-emit-NBT6JD7R.js → dev-emit-MVAJAFGX.js} +5 -3
  158. package/dist/dev-emit-MVAJAFGX.js.map +1 -0
  159. package/dist/engine-singleton-X4R7AZBJ.js +315 -0
  160. package/dist/engine-singleton-X4R7AZBJ.js.map +1 -0
  161. package/dist/{generate-Y3GWM57K.js → generate-EN6EDITF.js} +43 -4
  162. package/dist/generate-EN6EDITF.js.map +1 -0
  163. package/dist/index-CzxtQcnp.d.ts +1058 -0
  164. package/dist/index.d.ts +4 -0
  165. package/dist/index.js +24 -13
  166. package/dist/index.js.map +1 -1
  167. package/dist/{info-XW7HGUPH.js → info-Y55RWS42.js} +8 -6
  168. package/dist/{info-XW7HGUPH.js.map → info-Y55RWS42.js.map} +1 -1
  169. package/dist/{internal-api-V5L65YSJ.js → internal-api-IP35YU3G.js} +22 -12
  170. package/dist/{internal-api-WEOSTMSN.js → internal-api-OPU456AT.js} +30 -16
  171. package/dist/internal-api-OPU456AT.js.map +1 -0
  172. package/dist/load-config-4ATXQUN3.js +16 -0
  173. package/dist/match-DmGgxjIU.d.ts +44 -0
  174. package/dist/{mcp-ULUFJNSZ.js → mcp-5LLNAGKA.js} +7 -7
  175. package/dist/netlify-C2IRCZKI.js +245 -0
  176. package/dist/netlify-C2IRCZKI.js.map +1 -0
  177. package/dist/node-OSVPYQ3D.js +10 -0
  178. package/dist/nonce-BXt7Qu_C.d.ts +31 -0
  179. package/dist/observability-bootstrap-MZMSOE66.js +15 -0
  180. package/dist/{openapi-HZXR335W.js → openapi-VFPEZSRI.js} +13 -11
  181. package/dist/{openapi-HZXR335W.js.map → openapi-VFPEZSRI.js.map} +1 -1
  182. package/dist/{plugin-runner-BFEcgtmJ.d.ts → plugin-runner-BVMOSxvb.d.ts} +1 -1
  183. package/dist/{plugin-types-D69-lJZ9.d.ts → plugin-types-BUVfUQ0V.d.ts} +13 -1
  184. package/dist/preview-GHPT2EQ5.js +23 -0
  185. package/dist/preview-GHPT2EQ5.js.map +1 -0
  186. package/dist/provider-resolver-Dx6QuWrw.d.ts +128 -0
  187. package/dist/registry-KBZDCFVQ.js +23 -0
  188. package/dist/route-config-Cm_ZMA1C.d.ts +72 -0
  189. package/dist/route-policy-BxOycCDq.d.ts +65 -0
  190. package/dist/router/element-scroll-restoration.d.ts +28 -0
  191. package/dist/router/element-scroll-restoration.js +96 -0
  192. package/dist/router/element-scroll-restoration.js.map +1 -0
  193. package/dist/{routes-OLNQX7CT.js → routes-BPLU3ISV.js} +11 -9
  194. package/dist/{routes-OLNQX7CT.js.map → routes-BPLU3ISV.js.map} +1 -1
  195. package/dist/{scan-7MJC6PYU.js → scan-YJEE4KQK.js} +2 -2
  196. package/dist/{schema-ZO3OSWVG.js → schema-SOAD43RQ.js} +7 -5
  197. package/dist/schemas-4AXHQMV3.js +25 -0
  198. package/dist/schemas-4AXHQMV3.js.map +1 -0
  199. package/dist/security-headers-Ccj7ncNx.d.ts +129 -0
  200. package/dist/server/agent/index.d.ts +2 -90
  201. package/dist/server/agent/index.js +1 -1
  202. package/dist/server/auth/index.d.ts +2 -21
  203. package/dist/server/auth/index.js +3 -2
  204. package/dist/server/cron/index.js +4 -3
  205. package/dist/server/define/index.d.ts +51 -57
  206. package/dist/server/define/index.js +10 -1
  207. package/dist/server/http/index.d.ts +7 -5
  208. package/dist/server/http/index.js +56 -12
  209. package/dist/server/index.d.ts +47 -439
  210. package/dist/server/index.js +119 -201
  211. package/dist/server/index.js.map +1 -1
  212. package/dist/server/jobs/index.js +4 -3
  213. package/dist/server/observability/index.d.ts +109 -35
  214. package/dist/server/observability/index.js +10 -7
  215. package/dist/server/plugins/index.d.ts +3 -3
  216. package/dist/server/scan/index.d.ts +47 -12
  217. package/dist/server/scan/index.js +13 -4
  218. package/dist/server/security/index.d.ts +61 -103
  219. package/dist/server/security/index.js +15 -6
  220. package/dist/server/webhook/index.d.ts +90 -3
  221. package/dist/server/webhook/index.js +12 -2
  222. package/dist/server-boundary-6B4ZQUY7.js +148 -0
  223. package/dist/server-boundary-6B4ZQUY7.js.map +1 -0
  224. package/dist/server-boundary-7VZQRPPX.js +133 -0
  225. package/dist/server-boundary-7VZQRPPX.js.map +1 -0
  226. package/dist/{services-typed-client-PSAGRPFF.js → services-typed-client-XGT5SUUN.js} +2 -2
  227. package/dist/{start-KR2JJR7K.js → start-UZDMOT7I.js} +342 -111
  228. package/dist/start-UZDMOT7I.js.map +1 -0
  229. package/dist/{static-M2W4HUWS.js → static-SVDWIOXJ.js} +24 -13
  230. package/dist/static-SVDWIOXJ.js.map +1 -0
  231. package/dist/{theo-cloud-XAHWOUFK.js → theo-cloud-3ET4G5T6.js} +9 -2
  232. package/dist/theo-cloud-3ET4G5T6.js.map +1 -0
  233. package/dist/vercel-BMCQKCWE.js +277 -0
  234. package/dist/vercel-BMCQKCWE.js.map +1 -0
  235. package/dist/vite-plugin/index.js +24 -13
  236. package/dist/vite-plugin-VKCT2LF2.js +42 -0
  237. package/dist/vite-plugin-VKCT2LF2.js.map +1 -0
  238. package/package.json +19 -6
  239. package/dist/actions-virtual-module-YQXRSSMW.js.map +0 -1
  240. package/dist/agent-7JJW3TPB.js +0 -15
  241. package/dist/app-typed-client-G3J5G7E5.js.map +0 -1
  242. package/dist/app-typed-client-GHO3EWZK.js.map +0 -1
  243. package/dist/aws-lambda-CYNDGU5O.js +0 -172
  244. package/dist/aws-lambda-CYNDGU5O.js.map +0 -1
  245. package/dist/build-WU6AKKIB.js.map +0 -1
  246. package/dist/bun-33RD6K7O.js.map +0 -1
  247. package/dist/chunk-646CA6RV.js.map +0 -1
  248. package/dist/chunk-6E5WKMDS.js +0 -67
  249. package/dist/chunk-6E5WKMDS.js.map +0 -1
  250. package/dist/chunk-6GGWS7J3.js +0 -91
  251. package/dist/chunk-6GGWS7J3.js.map +0 -1
  252. package/dist/chunk-7LVM22VG.js.map +0 -1
  253. package/dist/chunk-7VPQHEAJ.js.map +0 -1
  254. package/dist/chunk-A7JBF5FO.js.map +0 -1
  255. package/dist/chunk-AM3QABW5.js +0 -161
  256. package/dist/chunk-AM3QABW5.js.map +0 -1
  257. package/dist/chunk-BIVCP6X5.js.map +0 -1
  258. package/dist/chunk-BMHS4WAN.js.map +0 -1
  259. package/dist/chunk-E576KYYT.js.map +0 -1
  260. package/dist/chunk-FB2HBNIC.js.map +0 -1
  261. package/dist/chunk-FNTLKHZ7.js.map +0 -1
  262. package/dist/chunk-GRI4XHBJ.js.map +0 -1
  263. package/dist/chunk-GVW5EKEU.js +0 -422
  264. package/dist/chunk-GVW5EKEU.js.map +0 -1
  265. package/dist/chunk-GXEX4CBH.js.map +0 -1
  266. package/dist/chunk-HBU2GIMZ.js.map +0 -1
  267. package/dist/chunk-IEES3CHD.js.map +0 -1
  268. package/dist/chunk-J5MXCGKA.js.map +0 -1
  269. package/dist/chunk-JA2ZAT5Q.js.map +0 -1
  270. package/dist/chunk-KD5G3YXI.js.map +0 -1
  271. package/dist/chunk-LNVMHQ2Z.js +0 -54
  272. package/dist/chunk-LNVMHQ2Z.js.map +0 -1
  273. package/dist/chunk-LXAESF4Y.js.map +0 -1
  274. package/dist/chunk-MTEWLGVY.js.map +0 -1
  275. package/dist/chunk-O3JIAU3V.js.map +0 -1
  276. package/dist/chunk-OJLL4YD6.js +0 -403
  277. package/dist/chunk-OJLL4YD6.js.map +0 -1
  278. package/dist/chunk-OLGPYOLO.js.map +0 -1
  279. package/dist/chunk-S433N3CT.js.map +0 -1
  280. package/dist/chunk-T5C46IIU.js.map +0 -1
  281. package/dist/chunk-U267AOWS.js +0 -28
  282. package/dist/chunk-U267AOWS.js.map +0 -1
  283. package/dist/chunk-UW2TEAGR.js +0 -77
  284. package/dist/chunk-UW2TEAGR.js.map +0 -1
  285. package/dist/chunk-WPJOTQA5.js +0 -1
  286. package/dist/chunk-XALU5LCU.js.map +0 -1
  287. package/dist/chunk-XR74JD4M.js +0 -457
  288. package/dist/chunk-XR74JD4M.js.map +0 -1
  289. package/dist/chunk-YGAXV5HR.js.map +0 -1
  290. package/dist/chunk-YRBR424R.js.map +0 -1
  291. package/dist/cloudflare-KYUWCEPL.js +0 -122
  292. package/dist/cloudflare-KYUWCEPL.js.map +0 -1
  293. package/dist/deno-deploy-CCTB7HGS.js +0 -107
  294. package/dist/deno-deploy-CCTB7HGS.js.map +0 -1
  295. package/dist/dev-MUWJAZRD.js.map +0 -1
  296. package/dist/dev-emit-NBT6JD7R.js.map +0 -1
  297. package/dist/generate-Y3GWM57K.js.map +0 -1
  298. package/dist/index-BEtEv6ZH.d.ts +0 -575
  299. package/dist/load-config-VKD6LKWU.js +0 -14
  300. package/dist/match-CfbEFRG4.d.ts +0 -26
  301. package/dist/netlify-AFMDNKT4.js +0 -150
  302. package/dist/netlify-AFMDNKT4.js.map +0 -1
  303. package/dist/node-ZJQEJSP3.js +0 -10
  304. package/dist/registry-GKR3EWRW.js +0 -23
  305. package/dist/start-KR2JJR7K.js.map +0 -1
  306. package/dist/static-M2W4HUWS.js.map +0 -1
  307. package/dist/theo-cloud-XAHWOUFK.js.map +0 -1
  308. package/dist/vercel-SRS2DH6O.js +0 -133
  309. package/dist/vercel-SRS2DH6O.js.map +0 -1
  310. package/dist/vite-plugin-VPJFD4HK.js +0 -36
  311. /package/dist/{chunk-WPJOTQA5.js.map → adapters/agent-mount.js.map} +0 -0
  312. /package/dist/{agent-7JJW3TPB.js.map → agent-GKUEL6OH.js.map} +0 -0
  313. /package/dist/{check-45NKUVSQ.js.map → check-GIPZBFTX.js.map} +0 -0
  314. /package/dist/{chunk-47CINLWF.js.map → chunk-44J2ANQC.js.map} +0 -0
  315. /package/dist/{chunk-ZB7D62OA.js.map → chunk-KUZVRJ7M.js.map} +0 -0
  316. /package/dist/{chunk-PXFXSFJL.js.map → chunk-NZ5JU6D3.js.map} +0 -0
  317. /package/dist/{internal-api-WEOSTMSN.js.map → chunk-YSJOZEI6.js.map} +0 -0
  318. /package/dist/{dev-emit-GWD6IXV7.js.map → dev-emit-BFNMDCPB.js.map} +0 -0
  319. /package/dist/{internal-api-V5L65YSJ.js.map → internal-api-IP35YU3G.js.map} +0 -0
  320. /package/dist/{load-config-VKD6LKWU.js.map → load-config-4ATXQUN3.js.map} +0 -0
  321. /package/dist/{mcp-ULUFJNSZ.js.map → mcp-5LLNAGKA.js.map} +0 -0
  322. /package/dist/{node-ZJQEJSP3.js.map → node-OSVPYQ3D.js.map} +0 -0
  323. /package/dist/{scan-7MJC6PYU.js.map → observability-bootstrap-MZMSOE66.js.map} +0 -0
  324. /package/dist/{registry-GKR3EWRW.js.map → registry-KBZDCFVQ.js.map} +0 -0
  325. /package/dist/{schema-ZO3OSWVG.js.map → scan-YJEE4KQK.js.map} +0 -0
  326. /package/dist/{vite-plugin-VPJFD4HK.js.map → schema-SOAD43RQ.js.map} +0 -0
  327. /package/dist/{services-typed-client-PSAGRPFF.js.map → services-typed-client-XGT5SUUN.js.map} +0 -0
@@ -0,0 +1,127 @@
1
+ #!/usr/bin/env node
2
+ import "tsx/esm";
3
+
4
+ // src/adapters/deployed-agents.ts
5
+ var EMPTY = { imports: [], declarations: [], branch: [] };
6
+ var AGENT_PREFIX = "/api/agents/";
7
+ function deployedAgentsFragment(source, host = {}) {
8
+ if (source === void 0) return EMPTY;
9
+ if (source.kind === "baked" && source.agents.length === 0) return EMPTY;
10
+ const pathname = host.pathname ?? "url.pathname";
11
+ const notFound = host.notFound ?? "notFoundResponse()";
12
+ const prefix = host.importPrefix ?? "";
13
+ const resolution = source.kind === "baked" ? bakedResolution(source.agents) : scannedResolution(source);
14
+ return {
15
+ imports: [
16
+ // `theokit/adapters/agent-mount`, not `theokit/server`: `mount-agent` is deliberately not on
17
+ // the app-facing surface (ADR 0041), and a generated entry is not an app. See that module.
18
+ `import { mountAgent, resolveProvider${source.kind === "scan" ? ", scanAgents" : ""} } from '${prefix}theokit/adapters/agent-mount'`,
19
+ ...resolution.imports
20
+ ],
21
+ declarations: resolution.declarations,
22
+ branch: [
23
+ ` // #367 \u2014 the agent convention owns this prefix. It is answered BEFORE the file-route`,
24
+ ` // table because an agent matches no file route: falling through is how a deployed`,
25
+ ` // \`/api/agents/<name>\` used to 404 on every target.`,
26
+ ` if (${pathname}.startsWith(${JSON.stringify(AGENT_PREFIX)})) {`,
27
+ ` const agentName = ${pathname}.slice(${String(AGENT_PREFIX.length)}).split('/')[0]`,
28
+ ...resolution.lookup,
29
+ ` // A name nobody scanned is a 404, exactly like any other unknown path. Handing`,
30
+ ` // \`undefined\` to mountAgent would surface as a 500 for what is a routing miss.`,
31
+ ` if (mod === undefined) return ${notFound}`,
32
+ ` const agentResponse = await mountAgent(mod, request, (model) => resolveProvider(model).apiKey, {`,
33
+ ` agentName,`,
34
+ ` ...CSRF_CONFIG,`,
35
+ ` })`,
36
+ host.wrapSecurityHeaders === true ? ` return withSecurityHeaders(agentResponse, SECURITY_HEADERS)` : ` return agentResponse`,
37
+ ` }`
38
+ ]
39
+ };
40
+ }
41
+ function bakedResolution(agents) {
42
+ const varOf = (index) => `__theoAgent${String(index)}`;
43
+ return {
44
+ imports: agents.map(
45
+ (agent, index) => `import * as ${varOf(index)} from '../../${agent.filePath}'`
46
+ ),
47
+ declarations: [
48
+ `// #367 \u2014 the app's agents, keyed by NAME because that is what the URL carries, what the`,
49
+ `// access policy is judged under, and what the run's spans are labelled with (#406).`,
50
+ `const agents = {`,
51
+ ...agents.map((agent, index) => ` ${JSON.stringify(agent.name)}: ${varOf(index)},`),
52
+ `}`
53
+ ],
54
+ lookup: [
55
+ ` const mod = Object.prototype.hasOwnProperty.call(agents, agentName)`,
56
+ ` ? agents[agentName]`,
57
+ ` : undefined`
58
+ ]
59
+ };
60
+ }
61
+ function scannedResolution(source) {
62
+ return {
63
+ imports: [],
64
+ declarations: [
65
+ `// #367 \u2014 scanned on first use and cached, the same shape this entry already gives routes.`,
66
+ `// Baking would tie an agent's existence to a rebuild on a target that has a filesystem.`,
67
+ `let agentsCache = null`
68
+ ],
69
+ lookup: [
70
+ ...source.ensureLoader === void 0 ? [] : [` ${source.ensureLoader}`],
71
+ ` if (!agentsCache) agentsCache = scanAgents(${source.projectRoot})`,
72
+ ` const agentNode = agentsCache.find((a) => a.name === agentName)`,
73
+ ` const mod = agentNode === undefined ? undefined : await ${source.loadModule}(agentNode.filePath)`
74
+ ]
75
+ };
76
+ }
77
+
78
+ // src/adapters/deployed-plugins-module.ts
79
+ var UnbakeablePluginError = class extends Error {
80
+ constructor(index, name, target) {
81
+ super(
82
+ `plugins[${index}] ("${name}") cannot be carried to the ${target} target: it is a constructed plugin, and a closure has no literal a generated entry could hold. Declare it by module specifier instead \u2014 plugins: ['./src/plugins/${name}.ts'] \u2014 so the build can emit a static import for it. Both forms work locally; only the specifier survives a deploy.`
83
+ );
84
+ this.name = "UnbakeablePluginError";
85
+ }
86
+ };
87
+ var MODULE_FILENAME = "theo.plugins.mjs";
88
+ function planDeployedPlugins(plugins, target) {
89
+ if (plugins === void 0 || plugins.length === 0) return void 0;
90
+ const specifiers = plugins.map((entry, index) => {
91
+ if (typeof entry === "string") return entry;
92
+ throw new UnbakeablePluginError(index, nameOf(entry), target);
93
+ });
94
+ const vars = specifiers.map((_, i) => `__theoPlugin${String(i)}`);
95
+ return {
96
+ moduleSpecifier: `./${MODULE_FILENAME}`,
97
+ specifiers,
98
+ source: [
99
+ `// Generated by Theo \u2014 the plugins the deployed entry registers (usetheokit/theokit#425).`,
100
+ `//`,
101
+ `// Static imports, resolved on the build machine. A constructed plugin has no literal, which`,
102
+ `// is why the config declares these by module specifier and why this file can exist at all.`,
103
+ ...specifiers.map((s, i) => `import ${vars[i]} from '${entrySpecifier(s)}'`),
104
+ ``,
105
+ `// Order is DECLARED order, because plugin order is hook order.`,
106
+ `export default { plugins: [${vars.join(", ")}] }`,
107
+ ``
108
+ ].join("\n")
109
+ };
110
+ }
111
+ function entrySpecifier(specifier) {
112
+ if (!specifier.startsWith(".")) return specifier;
113
+ return `../../${specifier.replace(/^\.\/+/, "")}`;
114
+ }
115
+ function nameOf(entry) {
116
+ if (entry != null && typeof entry === "object") {
117
+ const named = entry.name;
118
+ if (typeof named === "string" && named.length > 0) return named;
119
+ }
120
+ return "unnamed";
121
+ }
122
+
123
+ export {
124
+ deployedAgentsFragment,
125
+ planDeployedPlugins
126
+ };
127
+ //# sourceMappingURL=chunk-M2WC5MF7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/adapters/deployed-agents.ts","../src/adapters/deployed-plugins-module.ts"],"sourcesContent":["/**\n * Serving an agent from a generated deploy entry (usetheokit/theokit#367).\n *\n * ## The gap this closes\n *\n * `grep -rc \"agent\" packages/theo/src/adapters/*.ts` used to return nothing across 14 files. The\n * notion did not exist in this layer at all: every generated entry routes `/api/` exclusively\n * through `scanServerRoutes` + `executeRoute`, and an agent is a DIFFERENT scan served by a\n * DIFFERENT function — `scanAgents` + `mountAgent`. So `/api/agents/chat` matched no file route and\n * fell into `notFoundResponse()` on every target.\n *\n * For a framework whose stated reason to exist is \"the agent is a file, delivered by the same\n * pipeline that serves the page\", that is the gap which contradicts the sentence: the agent was\n * delivered by no pipeline at all outside a machine running `theokit start`.\n *\n * ## Why baking, and why `../../`\n *\n * A Worker has no filesystem to scan and no path to `import()`, which is the same reason routes are\n * baked (#369). The agent modules are resolved on the build machine and emitted as static imports,\n * relative to the entry's directory — every target that can do this writes two levels below the\n * project root, so the arithmetic is the one `renderBakedRoutes` already does.\n *\n * ## Which targets can do it\n *\n * Only the ones whose output is BUNDLED from the project: `cloudflare` (wrangler), `bun` and\n * `deno-deploy` resolve the emitted import against the app's own source tree. `vercel`, `netlify`\n * and `aws-lambda` receive a standalone function directory that never sees the app's modules, so\n * an agent cannot travel there by this road at all. Same split as plugins (#425), same cause.\n *\n * ## The table is keyed by NAME\n *\n * The URL carries the name, the access policy is judged under the name, and the run's spans are\n * labelled with it (#406). Keying by file path would make the lookup depend on the server's\n * directory layout — which changes per deploy, and which is exactly the value #406 removed from\n * telemetry for the same reason.\n */\n\n/** One agent, as `scanAgents` reports it. Structural, so the adapters need no `server/` import. */\nexport interface DeployedAgent {\n /** Path relative to the project root — the specifier the static import uses. */\n readonly filePath: string\n /** The URL the agent answers on. */\n readonly agentPath: string\n /** The agent's NAME — what the URL carries, the policy is judged under, and spans are labelled. */\n readonly name: string\n}\n\nexport interface DeployedAgentsFragment {\n /** Top-level imports of the agent modules. */\n readonly imports: string[]\n /** Module-scope declarations — the name→module table. */\n readonly declarations: string[]\n /** The request-handler branch, to be emitted before the file-route table is consulted. */\n readonly branch: string[]\n}\n\nconst EMPTY: DeployedAgentsFragment = { imports: [], declarations: [], branch: [] }\n\n/**\n * How the host entry names the things this branch has to use.\n *\n * The fragment is generated code injected into three entries that do NOT agree on their own\n * vocabulary — Bun reads `pathname`, Cloudflare reads `url.pathname`; Deno calls `notFound()`,\n * Cloudflare calls `notFoundResponse()`; Cloudflare wraps each branch in the security baseline\n * while Bun and Deno wrap once at the caller; Deno resolves npm packages with an `npm:` prefix.\n *\n * Naming those differences is what keeps this ONE fragment. The alternative — three near-identical\n * branches, one per adapter — is the copy that `serveThroughPluginLifecycle` was extracted to undo\n * after it had drifted five ways (#405).\n */\n/**\n * How the target REACHES its agent modules — and the two answers are genuinely different, not a\n * copy waiting to be merged.\n *\n * A Worker has no filesystem: its agents must be resolved on the build machine and emitted as\n * static imports, which is what `renderBakedRoutes` already does for routes there. Bun and Deno DO\n * have a filesystem and already scan their routes at request time; making them bake would couple an\n * agent's existence to a rebuild for no gain. The split mirrors the one routes already have on\n * exactly these targets, which is the argument for keeping it.\n */\nexport type DeployedAgentsSource =\n | {\n readonly kind: 'baked'\n /** Scanned on the build machine, emitted as static imports. */\n readonly agents: readonly DeployedAgent[]\n }\n | {\n readonly kind: 'scan'\n /** Expression yielding the project root at runtime. */\n readonly projectRoot: string\n /** Expression yielding the module loader the entry already builds. */\n readonly loadModule: string\n /**\n * A statement that guarantees `loadModule` is usable, for a host that builds its loader\n * lazily. Deno's `loaderCache` is created on the route path, which runs AFTER this branch —\n * so without this the agent branch would call `null`.\n */\n readonly ensureLoader?: string\n }\n\nexport interface DeployedAgentsHost {\n /** Expression yielding the request path inside the handler. Default `url.pathname`. */\n readonly pathname?: string\n /** Call producing the 404 response. Default `notFoundResponse()`. */\n readonly notFound?: string\n /** Whether THIS branch applies the security baseline, or the caller already does. */\n readonly wrapSecurityHeaders?: boolean\n /** Prefix for bare package specifiers. Deno needs `npm:`; the others need nothing. */\n readonly importPrefix?: string\n}\n\n/** The prefix the agent convention owns. Matches `handlers.ts`'s own `tryServeAgent`. */\nconst AGENT_PREFIX = '/api/agents/'\n\n/**\n * What a deployed entry needs in order to serve the app's agents.\n *\n * @param agents - the agents scanned on the build machine. Empty emits nothing at all.\n */\nexport function deployedAgentsFragment(\n source: DeployedAgentsSource | undefined,\n host: DeployedAgentsHost = {},\n): DeployedAgentsFragment {\n if (source === undefined) return EMPTY\n if (source.kind === 'baked' && source.agents.length === 0) return EMPTY\n\n const pathname = host.pathname ?? 'url.pathname'\n const notFound = host.notFound ?? 'notFoundResponse()'\n const prefix = host.importPrefix ?? ''\n\n const resolution =\n source.kind === 'baked' ? bakedResolution(source.agents) : scannedResolution(source)\n\n return {\n imports: [\n // `theokit/adapters/agent-mount`, not `theokit/server`: `mount-agent` is deliberately not on\n // the app-facing surface (ADR 0041), and a generated entry is not an app. See that module.\n `import { mountAgent, resolveProvider${source.kind === 'scan' ? ', scanAgents' : ''} } from '${prefix}theokit/adapters/agent-mount'`,\n ...resolution.imports,\n ],\n declarations: resolution.declarations,\n branch: [\n ` // #367 — the agent convention owns this prefix. It is answered BEFORE the file-route`,\n ` // table because an agent matches no file route: falling through is how a deployed`,\n ` // \\`/api/agents/<name>\\` used to 404 on every target.`,\n ` if (${pathname}.startsWith(${JSON.stringify(AGENT_PREFIX)})) {`,\n ` const agentName = ${pathname}.slice(${String(AGENT_PREFIX.length)}).split('/')[0]`,\n ...resolution.lookup,\n ` // A name nobody scanned is a 404, exactly like any other unknown path. Handing`,\n ` // \\`undefined\\` to mountAgent would surface as a 500 for what is a routing miss.`,\n ` if (mod === undefined) return ${notFound}`,\n ` const agentResponse = await mountAgent(mod, request, (model) => resolveProvider(model).apiKey, {`,\n ` agentName,`,\n ` ...CSRF_CONFIG,`,\n ` })`,\n host.wrapSecurityHeaders === true\n ? ` return withSecurityHeaders(agentResponse, SECURITY_HEADERS)`\n : ` return agentResponse`,\n ` }`,\n ],\n }\n}\n\ninterface AgentResolution {\n imports: string[]\n declarations: string[]\n /** Lines that must leave `mod` bound to the agent's module, or `undefined`. */\n lookup: string[]\n}\n\n/** No filesystem: every agent module is a static import decided on the build machine. */\nfunction bakedResolution(agents: readonly DeployedAgent[]): AgentResolution {\n const varOf = (index: number): string => `__theoAgent${String(index)}`\n return {\n imports: agents.map(\n (agent, index) => `import * as ${varOf(index)} from '../../${agent.filePath}'`,\n ),\n declarations: [\n `// #367 — the app's agents, keyed by NAME because that is what the URL carries, what the`,\n `// access policy is judged under, and what the run's spans are labelled with (#406).`,\n `const agents = {`,\n ...agents.map((agent, index) => ` ${JSON.stringify(agent.name)}: ${varOf(index)},`),\n `}`,\n ],\n lookup: [\n ` const mod = Object.prototype.hasOwnProperty.call(agents, agentName)`,\n ` ? agents[agentName]`,\n ` : undefined`,\n ],\n }\n}\n\n/** A filesystem: scan once and load on demand, exactly as this entry already treats its routes. */\nfunction scannedResolution(source: {\n projectRoot: string\n loadModule: string\n ensureLoader?: string\n}): AgentResolution {\n return {\n imports: [],\n declarations: [\n `// #367 — scanned on first use and cached, the same shape this entry already gives routes.`,\n `// Baking would tie an agent's existence to a rebuild on a target that has a filesystem.`,\n `let agentsCache = null`,\n ],\n lookup: [\n ...(source.ensureLoader === undefined ? [] : [` ${source.ensureLoader}`]),\n ` if (!agentsCache) agentsCache = scanAgents(${source.projectRoot})`,\n ` const agentNode = agentsCache.find((a) => a.name === agentName)`,\n ` const mod = agentNode === undefined ? undefined : await ${source.loadModule}(agentNode.filePath)`,\n ],\n }\n}\n","/**\n * The plugins module a build writes beside a deployed entry (usetheokit/theokit#425).\n *\n * ## What it is for\n *\n * `config.plugins` used to reach no deployed target at all, so `onRequest`, `preHandler`,\n * `onResponse` and `onError` were dead on every Web-standards deployment while firing locally. The\n * reason was never the hook loop — `executeRoute` has always run it — but that a constructed\n * plugin closes over state, and there is no literal for a closure.\n *\n * A plugin declared as a module SPECIFIER can be carried, because the build can emit a static\n * import for it. That is the road `renderBakedRoutes` already takes for route modules (#369):\n * resolve on the build machine, emit a static specifier, let the target's bundler see through it.\n *\n * ## Why the specifier is `../../`\n *\n * Every target that can carry plugins writes its entry two levels below the project root —\n * `.theokit/cloudflare/`, `.theokit/bun/`, `.theokit/deno/` — and a declared specifier is relative\n * to that root. The same arithmetic `renderBakedRoutes` does for routes, for the same reason.\n *\n * ## Which targets can carry them at all\n *\n * Only the ones whose output is BUNDLED from the project: Cloudflare (wrangler), Bun and Deno all\n * resolve the emitted import against the app's own source tree. Vercel, Netlify and AWS Lambda\n * receive a standalone function directory and never see the app's modules, so for them a named\n * refusal — which `findUnappliedConfig` already prints — remains the honest answer, and this module\n * is not called.\n */\n\n/**\n * A plugin the build was asked to carry and cannot.\n *\n * Its own type because the alternative is the defect this whole issue is: hooks that do not fire\n * and nothing that says so. A target that CAN carry a named module but was handed a closure has\n * something actionable to say, so it says it at build time rather than at the first request\n * (`rules/three-target-parity.md` § 3 — refuse by name).\n */\nexport class UnbakeablePluginError extends Error {\n constructor(index: number, name: string, target: string) {\n super(\n `plugins[${index}] (\"${name}\") cannot be carried to the ${target} target: it is a constructed ` +\n `plugin, and a closure has no literal a generated entry could hold. Declare it by module ` +\n `specifier instead — plugins: ['./src/plugins/${name}.ts'] — so the build can emit a ` +\n `static import for it. Both forms work locally; only the specifier survives a deploy.`,\n )\n this.name = 'UnbakeablePluginError'\n }\n}\n\nexport interface DeployedPluginsPlan {\n /** The module source to write beside the entry. */\n readonly source: string\n /** What the entry imports it as — a sibling, because both are written to the same directory. */\n readonly moduleSpecifier: string\n /** The declared specifiers, in order, for the build to report. */\n readonly specifiers: readonly string[]\n}\n\nconst MODULE_FILENAME = 'theo.plugins.mjs'\n\n/**\n * Plan the plugins module for a target that can carry one.\n *\n * @param plugins - the raw `config.plugins` array.\n * @param target - the deploy target, named in the refusal so the message says where it applies.\n * @returns `undefined` when the app declares no plugins, so an app carrying none emits nothing.\n * @throws UnbakeablePluginError when an entry is a constructed plugin rather than a specifier.\n */\nexport function planDeployedPlugins(\n plugins: readonly unknown[] | undefined,\n target: string,\n): DeployedPluginsPlan | undefined {\n if (plugins === undefined || plugins.length === 0) return undefined\n\n const specifiers = plugins.map((entry, index) => {\n if (typeof entry === 'string') return entry\n throw new UnbakeablePluginError(index, nameOf(entry), target)\n })\n\n const vars = specifiers.map((_, i) => `__theoPlugin${String(i)}`)\n\n return {\n moduleSpecifier: `./${MODULE_FILENAME}`,\n specifiers,\n source: [\n `// Generated by Theo — the plugins the deployed entry registers (usetheokit/theokit#425).`,\n `//`,\n `// Static imports, resolved on the build machine. A constructed plugin has no literal, which`,\n `// is why the config declares these by module specifier and why this file can exist at all.`,\n ...specifiers.map((s, i) => `import ${vars[i]} from '${entrySpecifier(s)}'`),\n ``,\n `// Order is DECLARED order, because plugin order is hook order.`,\n `export default { plugins: [${vars.join(', ')}] }`,\n ``,\n ].join('\\n'),\n }\n}\n\n/**\n * How the emitted module names a declared specifier.\n *\n * A RELATIVE specifier is relative to the project root, and the module sits two levels below it, so\n * it is re-based — the arithmetic `renderBakedRoutes` does for routes. A BARE specifier is a package\n * and must be left alone: `../../my-plugin-pkg` is a path that does not exist, where\n * `my-plugin-pkg` is a dependency the target's bundler resolves from `node_modules` like any other.\n */\nfunction entrySpecifier(specifier: string): string {\n if (!specifier.startsWith('.')) return specifier\n return `../../${specifier.replace(/^\\.\\/+/, '')}`\n}\n\n/** The plugin's own name when it has one, so the refusal names the thing the author wrote. */\nfunction nameOf(entry: unknown): string {\n if (entry != null && typeof entry === 'object') {\n const named = (entry as { name?: unknown }).name\n if (typeof named === 'string' && named.length > 0) return named\n }\n return 'unnamed'\n}\n"],"mappings":";;;;AAwDA,IAAM,QAAgC,EAAE,SAAS,CAAC,GAAG,cAAc,CAAC,GAAG,QAAQ,CAAC,EAAE;AAwDlF,IAAM,eAAe;AAOd,SAAS,uBACd,QACA,OAA2B,CAAC,GACJ;AACxB,MAAI,WAAW,OAAW,QAAO;AACjC,MAAI,OAAO,SAAS,WAAW,OAAO,OAAO,WAAW,EAAG,QAAO;AAElE,QAAM,WAAW,KAAK,YAAY;AAClC,QAAM,WAAW,KAAK,YAAY;AAClC,QAAM,SAAS,KAAK,gBAAgB;AAEpC,QAAM,aACJ,OAAO,SAAS,UAAU,gBAAgB,OAAO,MAAM,IAAI,kBAAkB,MAAM;AAErF,SAAO;AAAA,IACL,SAAS;AAAA;AAAA;AAAA,MAGP,uCAAuC,OAAO,SAAS,SAAS,iBAAiB,EAAE,YAAY,MAAM;AAAA,MACrG,GAAG,WAAW;AAAA,IAChB;AAAA,IACA,cAAc,WAAW;AAAA,IACzB,QAAQ;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW,QAAQ,eAAe,KAAK,UAAU,YAAY,CAAC;AAAA,MAC9D,2BAA2B,QAAQ,UAAU,OAAO,aAAa,MAAM,CAAC;AAAA,MACxE,GAAG,WAAW;AAAA,MACd;AAAA,MACA;AAAA,MACA,uCAAuC,QAAQ;AAAA,MAC/C;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,KAAK,wBAAwB,OACzB,sEACA;AAAA,MACJ;AAAA,IACF;AAAA,EACF;AACF;AAUA,SAAS,gBAAgB,QAAmD;AAC1E,QAAM,QAAQ,CAAC,UAA0B,cAAc,OAAO,KAAK,CAAC;AACpE,SAAO;AAAA,IACL,SAAS,OAAO;AAAA,MACd,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eAAe;AAAA,IACrC;AAAA,IACA,QAAQ;AAAA,MACN;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,GAAG,WAAW,IAAI,CAAC,GAAG,MAAM,UAAU,KAAK,CAAC,CAAC,UAAU,eAAe,CAAC,CAAC,GAAG;AAAA,MAC3E;AAAA,MACA;AAAA,MACA,8BAA8B,KAAK,KAAK,IAAI,CAAC;AAAA,MAC7C;AAAA,IACF,EAAE,KAAK,IAAI;AAAA,EACb;AACF;AAUA,SAAS,eAAe,WAA2B;AACjD,MAAI,CAAC,UAAU,WAAW,GAAG,EAAG,QAAO;AACvC,SAAO,SAAS,UAAU,QAAQ,UAAU,EAAE,CAAC;AACjD;AAGA,SAAS,OAAO,OAAwB;AACtC,MAAI,SAAS,QAAQ,OAAO,UAAU,UAAU;AAC9C,UAAM,QAAS,MAA6B;AAC5C,QAAI,OAAO,UAAU,YAAY,MAAM,SAAS,EAAG,QAAO;AAAA,EAC5D;AACA,SAAO;AACT;","names":[]}
@@ -1,14 +1,25 @@
1
+ import {
2
+ extractW3CTraceContext
3
+ } from "./chunk-72DMJBXI.js";
4
+ import {
5
+ newSpanId,
6
+ newTraceId
7
+ } from "./chunk-UMNXCU3K.js";
8
+
1
9
  // src/server/observability/span.ts
2
10
  var SpanImpl = class {
3
11
  data;
4
12
  ended = false;
5
- constructor(name, attributes) {
13
+ constructor(name, attributes, context) {
6
14
  this.data = {
7
15
  name,
16
+ traceId: context?.traceId ?? newTraceId(),
17
+ spanId: context?.spanId ?? newSpanId(),
8
18
  attributes: {},
9
19
  status: "ok",
10
20
  startTimeMs: Date.now()
11
21
  };
22
+ if (context?.parentSpanId !== void 0) this.data.parentSpanId = context.parentSpanId;
12
23
  if (attributes) {
13
24
  for (const [k, v] of Object.entries(attributes)) {
14
25
  if (v !== void 0) this.data.attributes[k] = v;
@@ -50,33 +61,6 @@ var NoopSpan = class {
50
61
  }
51
62
  };
52
63
 
53
- // src/server/observability/adapters/noop.ts
54
- var NoopObservabilityAdapter = class {
55
- name = "noop";
56
- isShutdown = false;
57
- startSpan(_name, _attributes) {
58
- return new NoopSpan();
59
- }
60
- // Null Object: discarding the call IS the behaviour. An empty body is the honest
61
- // implementation — a fabricated one would only hide that from the next reader.
62
- /* eslint-disable @typescript-eslint/no-empty-function -- no-op adapter by design */
63
- counter(_name, _value, _attributes) {
64
- }
65
- histogram(_name, _value, _attributes) {
66
- }
67
- log(_level, _message, _attributes) {
68
- }
69
- /* eslint-enable @typescript-eslint/no-empty-function */
70
- // Not `async`: there is nothing to await, and declaring it so would claim otherwise.
71
- flush() {
72
- return Promise.resolve();
73
- }
74
- shutdown() {
75
- this.isShutdown = true;
76
- return Promise.resolve();
77
- }
78
- };
79
-
80
64
  // src/server/observability/adapters/console.ts
81
65
  var ConsoleObservabilityAdapter = class {
82
66
  name = "console";
@@ -86,9 +70,9 @@ var ConsoleObservabilityAdapter = class {
86
70
  constructor(options = {}) {
87
71
  this.write = options.write ?? ((line) => process.stderr.write(line + "\n"));
88
72
  }
89
- startSpan(name, attributes) {
73
+ startSpan(name, attributes, context) {
90
74
  if (this.isShutdown) return new NoopSpan();
91
- const span = new SpanImpl(name, attributes);
75
+ const span = new SpanImpl(name, attributes, context);
92
76
  this.spans.push(span);
93
77
  return {
94
78
  setAttribute: (k, v) => {
@@ -150,21 +134,52 @@ var ConsoleObservabilityAdapter = class {
150
134
  }
151
135
  };
152
136
 
137
+ // src/server/observability/adapters/noop.ts
138
+ var NoopObservabilityAdapter = class {
139
+ name = "noop";
140
+ isShutdown = false;
141
+ startSpan(_name, _attributes) {
142
+ return new NoopSpan();
143
+ }
144
+ // Null Object: discarding the call IS the behaviour. An empty body is the honest
145
+ // implementation — a fabricated one would only hide that from the next reader.
146
+ /* eslint-disable @typescript-eslint/no-empty-function -- no-op adapter by design */
147
+ counter(_name, _value, _attributes) {
148
+ }
149
+ histogram(_name, _value, _attributes) {
150
+ }
151
+ log(_level, _message, _attributes) {
152
+ }
153
+ /* eslint-enable @typescript-eslint/no-empty-function */
154
+ // Not `async`: there is nothing to await, and declaring it so would claim otherwise.
155
+ flush() {
156
+ return Promise.resolve();
157
+ }
158
+ shutdown() {
159
+ this.isShutdown = true;
160
+ return Promise.resolve();
161
+ }
162
+ };
163
+
153
164
  // src/server/observability/otlp-serializer.ts
154
165
  function paraValorOtlp(value) {
155
166
  switch (typeof value) {
156
167
  case "string":
157
168
  return { stringValue: value };
158
169
  case "number":
159
- return { intValue: String(value) };
170
+ return Number.isInteger(value) ? { intValue: String(value) } : { doubleValue: value };
160
171
  default:
161
172
  return { boolValue: value };
162
173
  }
163
174
  }
164
175
  function serializeSpansToOtlp(spans, serviceName = "theokit") {
165
176
  const otlpSpans = spans.map((s) => ({
166
- traceId: randomHex(32),
167
- spanId: randomHex(16),
177
+ // #368 — read, never minted. This used to call `randomHex` for both, which
178
+ // gave every span a trace of its own and made a multi-span run unreadable at
179
+ // the collector. The ids now arrive on the span, decided when it started.
180
+ traceId: s.traceId,
181
+ spanId: s.spanId,
182
+ ...s.parentSpanId === void 0 ? {} : { parentSpanId: s.parentSpanId },
168
183
  name: s.name,
169
184
  kind: 2,
170
185
  // SPAN_KIND_SERVER
@@ -190,24 +205,36 @@ function serializeSpansToOtlp(spans, serviceName = "theokit") {
190
205
  };
191
206
  return new TextEncoder().encode(JSON.stringify(request));
192
207
  }
193
- function randomHex(length) {
194
- const bytes = new Uint8Array(length / 2);
195
- globalThis.crypto.getRandomValues(bytes);
196
- return Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
197
- }
198
208
 
199
209
  // src/server/observability/adapters/theo-cloud.ts
200
210
  var TheoCloudObservabilityAdapter = class {
201
211
  name = "theo-cloud";
202
212
  pendingSpans = [];
203
213
  isShutdown = false;
214
+ dropped = 0;
215
+ flushTimer;
204
216
  opts;
205
217
  constructor(options) {
206
- this.opts = { flushIntervalMs: 5e3, ...options };
207
- }
208
- startSpan(name, attributes) {
218
+ this.opts = { flushIntervalMs: 5e3, maxPendingSpans: 1e4, ...options };
219
+ this.flushTimer = setInterval(() => {
220
+ void this.flush();
221
+ }, this.opts.flushIntervalMs);
222
+ this.flushTimer.unref();
223
+ }
224
+ /** How many spans were dropped because the buffer was full. */
225
+ droppedSpanCount() {
226
+ return this.dropped;
227
+ }
228
+ /**
229
+ * Whether the periodic flush is unref'd. A test seam: "the timer does not hold
230
+ * the process open" is otherwise only observable by hanging.
231
+ */
232
+ hasUnrefdFlushTimer() {
233
+ return !this.flushTimer.hasRef();
234
+ }
235
+ startSpan(name, attributes, context) {
209
236
  if (this.isShutdown) return new NoopSpan();
210
- const span = new SpanImpl(name, attributes);
237
+ const span = new SpanImpl(name, attributes, context);
211
238
  return {
212
239
  setAttribute: (k, v) => {
213
240
  span.setAttribute(k, v);
@@ -217,6 +244,10 @@ var TheoCloudObservabilityAdapter = class {
217
244
  },
218
245
  end: () => {
219
246
  span.end();
247
+ if (this.pendingSpans.length >= this.opts.maxPendingSpans) {
248
+ this.pendingSpans.shift();
249
+ this.dropped++;
250
+ }
220
251
  this.pendingSpans.push(span.getData());
221
252
  }
222
253
  };
@@ -251,6 +282,7 @@ var TheoCloudObservabilityAdapter = class {
251
282
  }
252
283
  async shutdown() {
253
284
  if (this.isShutdown) return;
285
+ clearInterval(this.flushTimer);
254
286
  await this.flush();
255
287
  this.isShutdown = true;
256
288
  }
@@ -272,82 +304,104 @@ function resolveAdapter(options) {
272
304
  return new NoopObservabilityAdapter();
273
305
  }
274
306
 
307
+ // src/server/observability/request-trace.ts
308
+ var resolved = /* @__PURE__ */ new WeakMap();
309
+ function requestTrace(request) {
310
+ const existing = resolved.get(request);
311
+ if (existing !== void 0) return existing;
312
+ const trace = resolve(request);
313
+ resolved.set(request, trace);
314
+ return trace;
315
+ }
316
+ function resolve(request) {
317
+ const inbound = extractW3CTraceContext(request);
318
+ if (inbound === void 0) return { traceId: newTraceId() };
319
+ if (inbound.parentSpanId === void 0) return { traceId: inbound.traceId };
320
+ return { traceId: inbound.traceId, parentSpanId: inbound.parentSpanId };
321
+ }
322
+ function recordOutermostSpan(request, spanId) {
323
+ const trace = requestTrace(request);
324
+ trace.outermostSpanId ??= spanId;
325
+ }
326
+
275
327
  // src/server/observability/middleware.ts
276
- var activeSpans = /* @__PURE__ */ new Map();
277
- function createObservabilityPlugin(adapter) {
328
+ var DEFAULT_MAX_ACTIVE_SPANS = 1024;
329
+ function createObservabilityPlugin(adapter, options = {}) {
330
+ const maxActiveSpans = options.maxActiveSpans ?? DEFAULT_MAX_ACTIVE_SPANS;
331
+ const activeSpans = /* @__PURE__ */ new Map();
332
+ function evictUntilRoom() {
333
+ while (activeSpans.size >= maxActiveSpans) {
334
+ const oldest = activeSpans.keys().next();
335
+ if (oldest.done === true) return;
336
+ const span = activeSpans.get(oldest.value);
337
+ activeSpans.delete(oldest.value);
338
+ if (span === void 0) continue;
339
+ span.setAttribute("span.abandoned", true);
340
+ span.setStatus("error", "span abandoned: onResponse never fired for this request");
341
+ span.end();
342
+ }
343
+ }
344
+ function requestSpanContext(request) {
345
+ const trace = requestTrace(request);
346
+ const spanId = newSpanId();
347
+ recordOutermostSpan(request, spanId);
348
+ return trace.parentSpanId === void 0 ? { traceId: trace.traceId, spanId } : { traceId: trace.traceId, spanId, parentSpanId: trace.parentSpanId };
349
+ }
350
+ function claim(requestId) {
351
+ const span = activeSpans.get(requestId);
352
+ if (span === void 0) return void 0;
353
+ activeSpans.delete(requestId);
354
+ return span;
355
+ }
278
356
  return {
279
357
  name: "theokit:observability",
280
- // NOT `async`: every hook here is synchronous work on an in-memory span map. Declaring them
281
- // async would advertise awaiting that never happens (M56).
282
- onRequest(ctx) {
283
- const url = new URL(ctx.request.url, "http://localhost");
284
- const span = adapter.startSpan("http.request", {
285
- method: ctx.request.method,
286
- path: url.pathname,
287
- requestId: ctx.requestId
358
+ register(app) {
359
+ app.addHook("onRequest", (ctx) => {
360
+ evictUntilRoom();
361
+ const span = adapter.startSpan(
362
+ "http.request",
363
+ {
364
+ method: ctx.request.method,
365
+ // `ctx.request.url` is absolute, because that is what a Web `Request`
366
+ // carries (`plugin-types.ts` says so, at length, for this reason).
367
+ path: new URL(ctx.request.url).pathname,
368
+ requestId: ctx.requestId
369
+ },
370
+ requestSpanContext(ctx.request)
371
+ );
372
+ activeSpans.set(ctx.requestId, span);
288
373
  });
289
- activeSpans.set(ctx.requestId, span);
290
- return Promise.resolve();
291
- },
292
- onResponse(ctx) {
293
- const span = activeSpans.get(ctx.requestId);
294
- if (!span) return Promise.resolve();
295
- activeSpans.delete(ctx.requestId);
296
- if (ctx.response) {
297
- span.setAttribute("status", ctx.response.statusCode);
298
- }
299
- span.setStatus("ok");
300
- span.end();
301
- adapter.counter("http.requests", 1, {
302
- method: ctx.request.method,
303
- status: ctx.response?.statusCode ?? 0
374
+ app.addHook("onResponse", (ctx) => {
375
+ const span = claim(ctx.requestId);
376
+ if (span === void 0) return;
377
+ const status = ctx.response.statusCode;
378
+ span.setAttribute("status", status);
379
+ span.setStatus("ok");
380
+ span.end();
381
+ adapter.counter("http.requests", 1, { method: ctx.request.method, status });
304
382
  });
305
- return Promise.resolve();
306
- },
307
- onError(ctx) {
308
- const span = activeSpans.get(ctx.requestId);
309
- if (!span) return Promise.resolve();
310
- activeSpans.delete(ctx.requestId);
311
- const message = ctx.error instanceof Error ? ctx.error.message : "unknown error";
312
- span.setAttribute("error", true);
313
- span.setStatus("error", message);
314
- span.end();
315
- adapter.counter("http.errors", 1, {
316
- method: ctx.request.method
383
+ app.addHook("onError", (ctx) => {
384
+ const span = claim(ctx.requestId);
385
+ if (span === void 0) return;
386
+ const message = ctx.error instanceof Error ? ctx.error.message : "unknown error";
387
+ span.setAttribute("error", true);
388
+ span.setStatus("error", message);
389
+ span.end();
390
+ adapter.counter("http.errors", 1, { method: ctx.request.method });
317
391
  });
318
- return Promise.resolve();
319
392
  }
320
393
  };
321
394
  }
322
395
 
323
- // src/server/observability/define-adapter.ts
324
- function defineObservabilityAdapter(config) {
325
- return {
326
- name: config.name,
327
- startSpan: (name, attrs) => config.startSpan(name, attrs),
328
- counter: (name, value, attrs) => {
329
- config.counter(name, value, attrs);
330
- },
331
- histogram: (name, value, attrs) => {
332
- config.histogram(name, value, attrs);
333
- },
334
- log: (level, message, attrs) => {
335
- config.log(level, message, attrs);
336
- },
337
- flush: () => config.flush(),
338
- shutdown: () => config.shutdown()
339
- };
340
- }
341
-
342
396
  export {
397
+ requestTrace,
343
398
  SpanImpl,
344
399
  NoopSpan,
345
- NoopObservabilityAdapter,
346
400
  ConsoleObservabilityAdapter,
401
+ NoopObservabilityAdapter,
347
402
  serializeSpansToOtlp,
348
403
  TheoCloudObservabilityAdapter,
349
404
  resolveAdapter,
350
- createObservabilityPlugin,
351
- defineObservabilityAdapter
405
+ createObservabilityPlugin
352
406
  };
353
- //# sourceMappingURL=chunk-O3JIAU3V.js.map
407
+ //# sourceMappingURL=chunk-MCTC6HSE.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/server/observability/span.ts","../src/server/observability/adapters/console.ts","../src/server/observability/adapters/noop.ts","../src/server/observability/otlp-serializer.ts","../src/server/observability/adapters/theo-cloud.ts","../src/server/observability/adapter-registry.ts","../src/server/observability/request-trace.ts","../src/server/observability/middleware.ts"],"mappings":";;;;;;;;;AAgCO,IAAM,WAAN,MAAqC;AAAA,EACzB;AAAA,EACT,QAAQ;AAAA,EAEhB,YAAY,MAAc,YAA6B,SAA4B;AACjF,SAAK,OAAO;AAAA,MACV;AAAA,MACA,SAAS,SAAS,WAAW,WAAW;AAAA,MACxC,QAAQ,SAAS,UAAU,UAAU;AAAA,MACrC,YAAY,CAAC;AAAA,MACb,QAAQ;AAAA,MACR,aAAa,KAAK,IAAI;AAAA,IACxB;AACA,QAAI,SAAS,iBAAiB,OAAW,MAAK,KAAK,eAAe,QAAQ;AAC1E,QAAI,YAAY;AACd,iBAAW,CAAC,GAAG,CAAC,KAAK,OAAO,QAAQ,UAAU,GAAG;AAC/C,YAAI,MAAM,OAAW,MAAK,KAAK,WAAW,CAA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,IAAI,QAAQ,OAAO,CAAC;AAAA,MAClE,CAAC;AAAA,IACH;AAAA,EACF;AACF;","names":[]}
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
2
  import "tsx/esm";
3
- import {
4
- loadEnv
5
- } from "./chunk-HBU2GIMZ.js";
6
3
  import {
7
4
  getApprovalRegistry,
8
5
  resolveProvider
9
- } from "./chunk-6GGWS7J3.js";
6
+ } from "./chunk-5YPXXSYY.js";
10
7
  import {
11
8
  scanAgents
12
- } from "./chunk-LNVMHQ2Z.js";
9
+ } from "./chunk-EVZKNA2W.js";
10
+ import {
11
+ loadEnv
12
+ } from "./chunk-3QPVEJ7D.js";
13
13
 
14
14
  // src/server/agent/run-terminal-agent.ts
15
15
  import {
@@ -145,7 +145,7 @@ async function agentCommand(name, message, deps = {}) {
145
145
  );
146
146
  }
147
147
  const projectRoot = deps.projectRoot ?? process.cwd();
148
- const agentsDir = deps.agentsDir ?? (await (await import("./load-config-VKD6LKWU.js")).loadConfig(projectRoot)).agentsDir;
148
+ const agentsDir = deps.agentsDir ?? (await (await import("./load-config-4ATXQUN3.js")).loadConfig(projectRoot)).agentsDir;
149
149
  const agents = scanAgents(projectRoot, agentsDir);
150
150
  const agent = agents.find((a) => a.name === name);
151
151
  if (!agent) {
@@ -178,8 +178,8 @@ async function agentCommand(name, message, deps = {}) {
178
178
  async function createAgentSsrLoader(projectRoot) {
179
179
  const { createServer } = await import("vite");
180
180
  const react = (await import("@vitejs/plugin-react")).default;
181
- const { theoPluginAsync } = await import("./vite-plugin-VPJFD4HK.js");
182
- const { loadConfig } = await import("./load-config-VKD6LKWU.js");
181
+ const { theoPluginAsync } = await import("./vite-plugin-VKCT2LF2.js");
182
+ const { loadConfig } = await import("./load-config-4ATXQUN3.js");
183
183
  const config = await loadConfig(projectRoot);
184
184
  const theoPlugins = await theoPluginAsync({
185
185
  root: projectRoot,
@@ -212,4 +212,4 @@ export {
212
212
  agentCommand,
213
213
  createAgentSsrLoader
214
214
  };
215
- //# sourceMappingURL=chunk-PXFXSFJL.js.map
215
+ //# sourceMappingURL=chunk-NZ5JU6D3.js.map