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
@@ -2,76 +2,169 @@
2
2
  import "tsx/esm";
3
3
  import {
4
4
  CONTROLLER_MANIFEST_FILE
5
- } from "./chunk-47CINLWF.js";
5
+ } from "./chunk-44J2ANQC.js";
6
6
  import {
7
7
  parseCookieHeader
8
8
  } from "./chunk-V7MTRM6Q.js";
9
+ import {
10
+ initCacheEngineFromConfig
11
+ } from "./chunk-Q5L5EGWZ.js";
9
12
  import {
10
13
  preflightNodeAndBindings
11
14
  } from "./chunk-KTMQUYED.js";
12
15
  import {
13
16
  applyNonceToInlineScripts,
17
+ createAgentSubjectResolver,
14
18
  extractHeadTags,
15
19
  handleAgentApproval,
16
20
  injectIntoHead,
17
21
  isApprovalPath,
22
+ matchAgentAuxRoute,
23
+ parseApprovalAgentName,
24
+ resolvePluginSpecifiers,
18
25
  resolveTransformer,
19
- serveAgentAuxRoute,
20
- writeWebResponseToServerResponse
21
- } from "./chunk-GRI4XHBJ.js";
26
+ serveMatchedAuxRoute,
27
+ serveThroughPluginLifecycle
28
+ } from "./chunk-JWRCZIA4.js";
22
29
  import "./chunk-2CVV6CNN.js";
23
30
  import {
24
31
  findRootDiv
25
32
  } from "./chunk-3PWQQWT6.js";
26
- import {
27
- loadConfig
28
- } from "./chunk-S433N3CT.js";
29
- import {
30
- loadEnv
31
- } from "./chunk-HBU2GIMZ.js";
32
- import "./chunk-GVW5EKEU.js";
33
- import "./chunk-7VPQHEAJ.js";
34
33
  import {
35
34
  InMemoryStore,
36
- buildSecurityHeaders,
35
+ createCorsHandler,
37
36
  createPluginRunnerFromConfig,
38
37
  createProductionLoader,
39
38
  executeAction,
40
39
  executeRoute,
41
40
  findSuggestion,
42
- generateNonce,
43
- mountAgent
44
- } from "./chunk-BIVCP6X5.js";
41
+ mountAgent,
42
+ readAgentPolicy,
43
+ writeWebResponseToServerResponse
44
+ } from "./chunk-C62IZEJI.js";
45
45
  import {
46
46
  getApprovalRegistry,
47
47
  resolveProvider
48
- } from "./chunk-6GGWS7J3.js";
48
+ } from "./chunk-5YPXXSYY.js";
49
49
  import {
50
+ createWebRequestSource,
50
51
  dispatchControllerRequest,
51
- incomingMessageToWebRequest,
52
+ sendError
53
+ } from "./chunk-HWBRS4DZ.js";
54
+ import {
55
+ buildSecurityHeaders,
56
+ generateNonce
57
+ } from "./chunk-RPET332G.js";
58
+ import {
59
+ TRACE_HEADER,
60
+ createObservabilityPluginFromConfig,
61
+ extractTraceId,
62
+ generateNewTraceContext
63
+ } from "./chunk-7PM6K5EV.js";
64
+ import {
52
65
  logRequest,
53
- sendError,
54
66
  warnOnce
55
- } from "./chunk-T5C46IIU.js";
67
+ } from "./chunk-2AMLGJJA.js";
56
68
  import {
57
69
  loadManifest
58
- } from "./chunk-ZB7D62OA.js";
70
+ } from "./chunk-KUZVRJ7M.js";
59
71
  import {
60
72
  scanAgents
61
- } from "./chunk-LNVMHQ2Z.js";
73
+ } from "./chunk-EVZKNA2W.js";
62
74
  import {
63
75
  matchRoute,
64
76
  scanServerActions,
65
77
  scanServerRoutes,
66
78
  scanWebSocketRoutes
67
- } from "./chunk-BMHS4WAN.js";
68
- import "./chunk-A7JBF5FO.js";
79
+ } from "./chunk-XS7EX55U.js";
80
+ import "./chunk-FD4ZDTQ6.js";
81
+ import {
82
+ loadConfig
83
+ } from "./chunk-QTHVHNJJ.js";
84
+ import {
85
+ loadEnv
86
+ } from "./chunk-3QPVEJ7D.js";
87
+ import "./chunk-U5PWXS3J.js";
88
+ import "./chunk-FH3SQR6P.js";
89
+ import "./chunk-ZNZISJDZ.js";
90
+ import "./chunk-VI7ZANB3.js";
69
91
  import "./chunk-VQIUTCK2.js";
70
92
 
71
93
  // src/cli/commands/start/index.ts
72
- import { existsSync as existsSync4, readFileSync as readFileSync3 } from "fs";
94
+ import { existsSync as existsSync4, readFileSync as readFileSync4 } from "fs";
73
95
  import { createServer } from "http";
74
- import { join as join2, resolve as resolve3 } from "path";
96
+ import { join as join2, resolve as resolve4 } from "path";
97
+
98
+ // src/server/cron/cron-runtime-node.ts
99
+ import { CronExpressionParser } from "cron-parser";
100
+ function createCronScheduler(definitions) {
101
+ const states = definitions.map((def) => ({
102
+ def,
103
+ inFlight: false,
104
+ timer: null,
105
+ abortController: null
106
+ }));
107
+ let started = false;
108
+ const fireAndReschedule = (state, scheduledAt) => {
109
+ state.timer = null;
110
+ if (state.inFlight && state.def.concurrency === "forbid") {
111
+ console.warn(
112
+ `[theokit:cron] "${state.def.name}" skipped tick at ${scheduledAt.toISOString()} \u2014 previous handler still running (concurrency: forbid).`
113
+ );
114
+ scheduleNext(state);
115
+ return;
116
+ }
117
+ state.inFlight = true;
118
+ state.abortController = new AbortController();
119
+ const traceCtx = generateNewTraceContext();
120
+ const ctx = {
121
+ traceId: traceCtx.trace_id,
122
+ scheduledAt,
123
+ signal: state.abortController.signal
124
+ };
125
+ void Promise.resolve().then(() => state.def.handler(ctx)).catch((err) => {
126
+ console.error(
127
+ `[theokit:cron] "${state.def.name}" handler error:`,
128
+ err instanceof Error ? err.message : err
129
+ );
130
+ }).finally(() => {
131
+ state.inFlight = false;
132
+ });
133
+ scheduleNext(state);
134
+ };
135
+ const scheduleNext = (state) => {
136
+ if (!started) return;
137
+ const interval = CronExpressionParser.parse(state.def.schedule, {
138
+ tz: "UTC",
139
+ currentDate: /* @__PURE__ */ new Date()
140
+ });
141
+ const next = interval.next().toDate();
142
+ const delayMs = Math.max(0, next.getTime() - Date.now());
143
+ state.timer = setTimeout(() => {
144
+ fireAndReschedule(state, next);
145
+ }, delayMs);
146
+ };
147
+ return {
148
+ start() {
149
+ if (started) return;
150
+ started = true;
151
+ for (const state of states) {
152
+ scheduleNext(state);
153
+ }
154
+ },
155
+ stop() {
156
+ started = false;
157
+ for (const state of states) {
158
+ if (state.timer) {
159
+ clearTimeout(state.timer);
160
+ state.timer = null;
161
+ }
162
+ state.abortController?.abort();
163
+ state.abortController = null;
164
+ }
165
+ }
166
+ };
167
+ }
75
168
 
76
169
  // src/server/define/health-route.ts
77
170
  var HEALTH_PATH = "/__theo/health";
@@ -330,7 +423,7 @@ async function configureStorageManagerFromConfig(storageConfig) {
330
423
  if (storageConfig === void 0 || storageConfig === null) return;
331
424
  try {
332
425
  const { getStorageManager } = await import("./storage-manager-3O5PDO6O.js");
333
- const { storageSchema } = await import("./schema-ZO3OSWVG.js");
426
+ const { storageSchema } = await import("./schema-SOAD43RQ.js");
334
427
  const parsed = storageSchema.parse(storageConfig);
335
428
  getStorageManager().configure(parsed);
336
429
  } catch (err) {
@@ -350,6 +443,32 @@ function resolveSsrEntry(distDir) {
350
443
  return null;
351
444
  }
352
445
 
446
+ // src/cli/commands/start/cron-bootstrap.ts
447
+ import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
448
+ import { resolve as resolve2 } from "path";
449
+ async function loadCronDefinitions(manifestPath, projectRoot, loadModule) {
450
+ if (!existsSync2(manifestPath)) return [];
451
+ const manifest = JSON.parse(readFileSync2(manifestPath, "utf-8"));
452
+ const definitions = [];
453
+ for (const entry of manifest.crons) {
454
+ const filePath = resolve2(projectRoot, entry.filePath);
455
+ const mod = await loadModule(filePath);
456
+ const exported = mod.default;
457
+ if (!isCronDefinition(exported)) {
458
+ throw new Error(
459
+ `Cron "${entry.name}" declared in "${entry.filePath}" is missing a valid default export. Expected \`export default defineCron(name, { schedule, handler })\`. Re-run \`theokit build\` if the file changed since the last build.`
460
+ );
461
+ }
462
+ definitions.push(exported);
463
+ }
464
+ return definitions;
465
+ }
466
+ function isCronDefinition(value) {
467
+ if (typeof value !== "object" || value === null) return false;
468
+ const candidate = value;
469
+ return typeof candidate.name === "string" && typeof candidate.schedule === "string" && typeof candidate.handler === "function";
470
+ }
471
+
353
472
  // src/cli/commands/start/graceful-shutdown.ts
354
473
  function installGracefulShutdown(server) {
355
474
  let shuttingDown = false;
@@ -382,6 +501,16 @@ function installGracefulShutdown(server) {
382
501
  message: msg
383
502
  });
384
503
  }
504
+ try {
505
+ const { getObservabilityAdapter } = await import("./observability-bootstrap-MZMSOE66.js");
506
+ await getObservabilityAdapter()?.shutdown();
507
+ } catch (err) {
508
+ const msg = err instanceof Error ? err.message : String(err);
509
+ warnOnce("shutdown.observability_error", {
510
+ event: "shutdown.observability_error",
511
+ message: msg
512
+ });
513
+ }
385
514
  console.log(` [theokit] shutdown complete`);
386
515
  server.close(() => {
387
516
  process.exit(0);
@@ -404,12 +533,12 @@ function installGracefulShutdown(server) {
404
533
  }
405
534
 
406
535
  // src/cli/commands/start/manifest-loader.ts
407
- import { existsSync as existsSync2 } from "fs";
536
+ import { existsSync as existsSync3 } from "fs";
408
537
  import { join } from "path";
409
538
  import { dirname } from "path";
410
539
  function loadRoutesAndActions(distDir, serverDir, agentsDir = "agents") {
411
540
  const manifestPath = join(distDir, "manifest.json");
412
- if (existsSync2(manifestPath)) {
541
+ if (existsSync3(manifestPath)) {
413
542
  const manifest = loadManifest(distDir, serverDir);
414
543
  return {
415
544
  routes: manifest.routes,
@@ -432,16 +561,13 @@ function loadRoutesAndActions(distDir, serverDir, agentsDir = "agents") {
432
561
  };
433
562
  }
434
563
 
435
- // src/cli/commands/start/request-handler.ts
436
- import { randomUUID } from "crypto";
437
-
438
564
  // src/cli/commands/start/handlers.ts
439
565
  import { extname as extname2 } from "path";
440
566
  import { pathToFileURL } from "url";
441
567
 
442
568
  // src/server/http/static.ts
443
- import { existsSync as existsSync3, readFileSync as readFileSync2, statSync } from "fs";
444
- import { resolve as resolve2, extname } from "path";
569
+ import { closeSync, fstatSync, openSync, readFileSync as readFileSync3, realpathSync } from "fs";
570
+ import { resolve as resolve3, extname, sep } from "path";
445
571
  var MIME_TYPES = {
446
572
  ".html": "text/html",
447
573
  ".js": "application/javascript",
@@ -462,24 +588,41 @@ var MIME_TYPES = {
462
588
  };
463
589
  function serveStaticFile(req, res, clientDir) {
464
590
  const urlPath = (req.url ?? "/").split("?")[0];
465
- const filePath = resolve2(clientDir, "." + urlPath);
466
- if (!filePath.startsWith(clientDir)) {
591
+ const filePath = resolve3(clientDir, "." + urlPath);
592
+ if (filePath !== clientDir && !filePath.startsWith(clientDir + sep)) {
467
593
  res.writeHead(403);
468
594
  res.end("Forbidden");
469
595
  return true;
470
596
  }
471
- if (!existsSync3(filePath)) return false;
472
- const stat = statSync(filePath);
473
- if (!stat.isFile()) return false;
474
- const ext = extname(filePath);
475
- const contentType = MIME_TYPES[ext] ?? "application/octet-stream";
476
- const content = readFileSync2(filePath);
477
- res.writeHead(200, {
478
- "Content-Type": contentType,
479
- "Content-Length": content.length
480
- });
481
- res.end(content);
482
- return true;
597
+ let realPath;
598
+ let realRoot;
599
+ try {
600
+ realPath = realpathSync(filePath);
601
+ realRoot = realpathSync(clientDir);
602
+ } catch {
603
+ return false;
604
+ }
605
+ if (realPath !== realRoot && !realPath.startsWith(realRoot + sep)) return false;
606
+ let fd;
607
+ try {
608
+ fd = openSync(realPath, "r");
609
+ } catch {
610
+ return false;
611
+ }
612
+ try {
613
+ if (!fstatSync(fd).isFile()) return false;
614
+ const ext = extname(filePath);
615
+ const contentType = MIME_TYPES[ext] ?? "application/octet-stream";
616
+ const content = readFileSync3(fd);
617
+ res.writeHead(200, {
618
+ "Content-Type": contentType,
619
+ "Content-Length": content.length
620
+ });
621
+ res.end(content);
622
+ return true;
623
+ } finally {
624
+ closeSync(fd);
625
+ }
483
626
  }
484
627
 
485
628
  // src/cli/commands/start/handlers.ts
@@ -487,6 +630,15 @@ async function loadCompiledController(absPath) {
487
630
  return await import(pathToFileURL(absPath).href);
488
631
  }
489
632
  var X_REQUEST_ID = "x-request-id";
633
+ function agentSubjectResolver(c) {
634
+ return createAgentSubjectResolver({
635
+ req: c.req,
636
+ res: c.res,
637
+ loadModule: c.loadModule,
638
+ serverDir: c.serverDir,
639
+ pluginRunner: c.pluginRunner
640
+ });
641
+ }
490
642
  async function applyRateLimit(c, method) {
491
643
  if (!c.rateLimiter) return false;
492
644
  const check = await c.rateLimiter(c.req);
@@ -568,22 +720,41 @@ async function tryServeAction(c) {
568
720
  }
569
721
  async function tryServeAgentAux(c) {
570
722
  const urlPath = c.url.split("?")[0];
571
- const baseUrl = `http://${c.req.headers.host ?? "localhost"}`;
572
- const request = incomingMessageToWebRequest(c.req);
573
- const response = await serveAgentAuxRoute(request, urlPath, {
723
+ const deps = {
574
724
  agents: c.cachedAgents,
575
725
  loadModule: c.loadModule,
576
- baseUrl,
726
+ baseUrl: `http://${c.req.headers.host ?? "localhost"}`,
577
727
  // M34 (#97) — the MCP aux route drives the agent (spends tokens); enforce CSRF like the run route.
578
728
  csrfMode: c.csrfMode,
579
729
  // M39 — the thread follow-up route drives the agent; resolve the key on demand.
580
- resolveApiKey: () => resolveProvider().apiKey
581
- });
582
- if (response === null) return false;
730
+ // theokit#328 — the thread route drives an agent, so its key follows the model too.
731
+ resolveApiKey: (model) => resolveProvider(model).apiKey,
732
+ // usetheokit/theokit#365 — who is asking. Memoized and LAZY: built here, invoked only inside
733
+ // `serveMatchedAuxRoute` and only when the matched agent declares a policy, so the application's
734
+ // `createContext` never runs for a url this branch declines.
735
+ resolveSubject: agentSubjectResolver(c)
736
+ };
737
+ const method = (c.req.method ?? "GET").toUpperCase();
738
+ const route = await matchAgentAuxRoute(method, urlPath, deps);
739
+ if (route === null) return false;
583
740
  c.res.setHeader(X_REQUEST_ID, c.requestId);
584
- await writeWebResponseToServerResponse(response, c.res);
741
+ await serveThroughPluginLifecycle(
742
+ {
743
+ source: createWebRequestSource(c.req),
744
+ res: c.res,
745
+ requestId: c.requestId,
746
+ pluginRunner: c.pluginRunner,
747
+ failureMessage: "Agent aux handler failed"
748
+ },
749
+ async (request) => {
750
+ await writeWebResponseToServerResponse(
751
+ await serveMatchedAuxRoute(route, request, deps),
752
+ c.res
753
+ );
754
+ }
755
+ );
585
756
  logRequest({
586
- method: (c.req.method ?? "GET").toUpperCase(),
757
+ method,
587
758
  url: c.url,
588
759
  status: c.res.statusCode,
589
760
  duration: Date.now() - c.startTime,
@@ -616,25 +787,27 @@ async function tryServeAgent(c) {
616
787
  });
617
788
  return true;
618
789
  }
619
- try {
620
- const request = incomingMessageToWebRequest(c.req);
621
- const response = await handleAgentApproval(
622
- request,
623
- urlPath,
624
- getApprovalRegistry(),
625
- c.csrfMode
626
- );
627
- await writeWebResponseToServerResponse(response, c.res);
628
- } catch (err) {
629
- sendError(
630
- c.res,
631
- "INTERNAL",
632
- err instanceof Error ? err.message : "Approve handler failed",
633
- 500,
634
- void 0,
635
- c.requestId
636
- );
637
- }
790
+ await serveThroughPluginLifecycle(
791
+ {
792
+ source: createWebRequestSource(c.req),
793
+ res: c.res,
794
+ requestId: c.requestId,
795
+ pluginRunner: c.pluginRunner,
796
+ failureMessage: "Approve handler failed"
797
+ },
798
+ async (request) => {
799
+ const approveAgent = c.cachedAgents.find((a) => a.name === parseApprovalAgentName(urlPath));
800
+ const policy = approveAgent === void 0 ? void 0 : readAgentPolicy(await c.loadModule(approveAgent.filePath), approveAgent.filePath);
801
+ const response = await handleAgentApproval(
802
+ request,
803
+ urlPath,
804
+ getApprovalRegistry(),
805
+ c.csrfMode,
806
+ { policy, resolveSubject: agentSubjectResolver(c) }
807
+ );
808
+ await writeWebResponseToServerResponse(response, c.res);
809
+ }
810
+ );
638
811
  logRequest({
639
812
  method: method2,
640
813
  url: c.url,
@@ -667,26 +840,35 @@ async function tryServeAgent(c) {
667
840
  });
668
841
  return true;
669
842
  }
670
- try {
671
- const mod = await c.loadModule(agent.filePath);
672
- const apiKey = resolveProvider().apiKey;
673
- const request = incomingMessageToWebRequest(c.req);
674
- const response = await mountAgent(mod, request, apiKey, {
675
- source: agent.filePath,
676
- csrfMode: c.csrfMode,
677
- projectRoot: c.projectRoot
678
- });
679
- await writeWebResponseToServerResponse(response, c.res);
680
- } catch (err) {
681
- sendError(
682
- c.res,
683
- "INTERNAL",
684
- err instanceof Error ? err.message : "Agent handler failed",
685
- 500,
686
- void 0,
687
- c.requestId
688
- );
689
- }
843
+ await serveAgentTurn(c, agent, method);
844
+ return true;
845
+ }
846
+ async function serveAgentTurn(c, agent, method) {
847
+ const resolveSubject = agentSubjectResolver(c);
848
+ await serveThroughPluginLifecycle(
849
+ {
850
+ source: createWebRequestSource(c.req),
851
+ res: c.res,
852
+ requestId: c.requestId,
853
+ pluginRunner: c.pluginRunner,
854
+ failureMessage: "Agent handler failed"
855
+ },
856
+ async (request) => {
857
+ const mod = await c.loadModule(agent.filePath);
858
+ const apiKey = (model) => resolveProvider(model).apiKey;
859
+ const response = await mountAgent(mod, request, apiKey, {
860
+ source: agent.filePath,
861
+ csrfMode: c.csrfMode,
862
+ projectRoot: c.projectRoot,
863
+ // usetheokit/theokit#365 — the policy is read off `mod` inside `mountAgent`; what this
864
+ // caller owes is the identity to judge it against. usetheokit/theokit#406 — and it is the
865
+ // same value the run's spans are labelled with, so `source` above never reaches telemetry.
866
+ agentName: agent.name,
867
+ resolveSubject
868
+ });
869
+ await writeWebResponseToServerResponse(response, c.res);
870
+ }
871
+ );
690
872
  logRequest({
691
873
  method,
692
874
  url: c.url,
@@ -694,7 +876,6 @@ async function tryServeAgent(c) {
694
876
  duration: Date.now() - c.startTime,
695
877
  requestId: c.requestId
696
878
  });
697
- return true;
698
879
  }
699
880
  async function tryServeApiRoute(c) {
700
881
  if (!c.url.startsWith("/api/")) return false;
@@ -860,7 +1041,16 @@ async function handleSsrStreaming(ctx, req, res, url, nonce) {
860
1041
  try {
861
1042
  const result = await ctx.ssrRenderStreaming(url, res, {
862
1043
  signal: controller.signal,
863
- nonce
1044
+ nonce,
1045
+ // #343 — the streamed response carried neither of these, so `ssrStreaming: true`
1046
+ // served a bare React tree: no `<head>`, no client entry, no hydration data.
1047
+ //
1048
+ // `applyNonceToInlineScripts` and not `withHoistedHead`: hoisting reads the
1049
+ // RENDERED body for head elements, and nothing is rendered yet when the head
1050
+ // has to flush. Metadata hoisting under streaming is the same defect on a
1051
+ // different surface, and it is M9's, not this one's.
1052
+ htmlHead: applyNonceToInlineScripts(ctx.htmlHead, nonce),
1053
+ htmlTail: ctx.htmlTail
864
1054
  });
865
1055
  if (isRedirectResult(result)) sendRedirect(res, result);
866
1056
  return true;
@@ -902,8 +1092,12 @@ function createRequestHandler(ctx) {
902
1092
  return (req, res) => {
903
1093
  void (async () => {
904
1094
  const url = req.url ?? "/";
905
- const requestId = randomUUID();
1095
+ const requestId = extractTraceId(req);
906
1096
  const start = Date.now();
1097
+ res.setHeader("x-request-id", requestId);
1098
+ res.setHeader(TRACE_HEADER, requestId);
1099
+ if (ctx.corsHandler?.handlePreflight(req, res) === true) return;
1100
+ ctx.corsHandler?.applyHeaders(req, res);
907
1101
  const nonce = generateNonce();
908
1102
  const securityHeaders = buildSecurityHeaders(
909
1103
  ctx.securityHeadersConfig,
@@ -933,6 +1127,24 @@ function createRequestHandler(ctx) {
933
1127
  };
934
1128
  }
935
1129
 
1130
+ // src/cli/commands/start/resolve-listen-host.ts
1131
+ function resolveListenTarget(host, env = process.env.HOST) {
1132
+ if (host === true) return { host: "0.0.0.0", source: "config" };
1133
+ if (typeof host === "string" && host !== "") return { host, source: "config" };
1134
+ if (host !== false && env !== void 0 && env !== "") return { host: env, source: "env" };
1135
+ return { host: "localhost", source: "default" };
1136
+ }
1137
+ function describeListenTarget(target, port) {
1138
+ const url = target.host === "0.0.0.0" || target.host === "::" ? "localhost" : target.host;
1139
+ const bound = target.host === "0.0.0.0" || target.host === "::" ? `bound to ${target.host} (every interface)` : `bound to ${target.host} only`;
1140
+ return ` \u2192 http://${url}:${String(port)} [${bound}${provenance(target.source)}]`;
1141
+ }
1142
+ function provenance(source) {
1143
+ if (source === "env") return " from HOST";
1144
+ if (source === "config") return "";
1145
+ return " \u2014 set `host: true` in theo.config.ts or HOST=0.0.0.0 to reach it from outside this machine";
1146
+ }
1147
+
936
1148
  // src/cli/commands/start/websocket-handler.ts
937
1149
  async function attachWebSocketHandler(server, wsRoutes, loadModule) {
938
1150
  if (wsRoutes.length === 0) return;
@@ -988,22 +1200,28 @@ async function startCommand(options) {
988
1200
  assertSdkCompatible();
989
1201
  await configureAgentRegistryFromConfig(config.agents?.registry);
990
1202
  await configureStorageManagerFromConfig(config.storage);
991
- const distDir = resolve3(cwd, ".theokit");
992
- const clientDir = resolve3(distDir, "client");
993
- const controllersDistDir = existsSync4(resolve3(distDir, CONTROLLER_MANIFEST_FILE)) ? resolve3(distDir, "controllers") : void 0;
994
- const serverDir = resolve3(cwd, config.serverDir);
1203
+ await initCacheEngineFromConfig(config.cache);
1204
+ const distDir = resolve4(cwd, ".theokit");
1205
+ const clientDir = resolve4(distDir, "client");
1206
+ const controllersDistDir = existsSync4(resolve4(distDir, CONTROLLER_MANIFEST_FILE)) ? resolve4(distDir, "controllers") : void 0;
1207
+ const serverDir = resolve4(cwd, config.serverDir);
995
1208
  if (!existsSync4(clientDir)) {
996
1209
  throw new Error("No build found. Run `theo build` first.");
997
1210
  }
998
- const indexHtml = readFileSync3(join2(clientDir, "index.html"), "utf-8");
1211
+ const indexHtml = readFileSync4(join2(clientDir, "index.html"), "utf-8");
999
1212
  const loadModule = createProductionLoader();
1000
- const port = options.port ?? config.port;
1001
- const pluginRunner = await createPluginRunnerFromConfig(config.plugins);
1213
+ const envPort = Number.parseInt(process.env.PORT ?? "", 10);
1214
+ const port = options.port ?? (Number.isInteger(envPort) ? envPort : void 0) ?? config.port;
1215
+ const observabilityPlugin = createObservabilityPluginFromConfig(config.observability, process.env);
1216
+ const declaredPlugins = await resolvePluginSpecifiers(config.plugins ?? [], cwd);
1217
+ const pluginRunner = await createPluginRunnerFromConfig(
1218
+ observabilityPlugin === void 0 ? declaredPlugins : [observabilityPlugin, ...declaredPlugins]
1219
+ );
1002
1220
  const transformer = resolveTransformer(config.serialization);
1003
1221
  const custom404Path = join2(clientDir, "404.html");
1004
1222
  const custom500Path = join2(clientDir, "500.html");
1005
- const custom404Html = existsSync4(custom404Path) ? readFileSync3(custom404Path, "utf-8") : null;
1006
- const custom500Html = existsSync4(custom500Path) ? readFileSync3(custom500Path, "utf-8") : null;
1223
+ const custom404Html = existsSync4(custom404Path) ? readFileSync4(custom404Path, "utf-8") : null;
1224
+ const custom500Html = existsSync4(custom500Path) ? readFileSync4(custom500Path, "utf-8") : null;
1007
1225
  const {
1008
1226
  routes: cachedRoutes,
1009
1227
  actions: cachedActions,
@@ -1041,6 +1259,10 @@ async function startCommand(options) {
1041
1259
  rateLimiter
1042
1260
  }),
1043
1261
  securityHeadersConfig: config.security?.headers ?? {},
1262
+ // #409 — built once at startup, like the security headers beside it. Declaring `cors` and
1263
+ // being served by this command used to mean no CORS at all, which reads in a browser as a
1264
+ // blocked fetch and in the config as a setting that is present and validated.
1265
+ corsHandler: config.security?.cors ? createCorsHandler(config.security.cors) : null,
1044
1266
  ssrRender: ssr.render,
1045
1267
  ssrRenderStreaming: ssr.renderStreaming,
1046
1268
  ssrStreamingEnabled: ssr.streamingEnabled,
@@ -1055,11 +1277,20 @@ async function startCommand(options) {
1055
1277
  })
1056
1278
  );
1057
1279
  await attachWebSocketHandler(server, cachedWsRoutes, loadModule);
1058
- server.listen(port, () => {
1280
+ const cronDefinitions = await loadCronDefinitions(resolve4(distDir, "crons.json"), cwd, loadModule);
1281
+ if (cronDefinitions.length > 0) {
1282
+ createCronScheduler(cronDefinitions).start();
1283
+ }
1284
+ const listenTarget = resolveListenTarget(config.host);
1285
+ server.listen(port, listenTarget.host, () => {
1059
1286
  console.log(`
1060
1287
  Theo production server`);
1061
- console.log(` \u2192 http://localhost:${String(port)}
1288
+ console.log(`${describeListenTarget(listenTarget, port)}
1289
+ `);
1290
+ if (cronDefinitions.length > 0) {
1291
+ console.log(` Crons: ${String(cronDefinitions.length)} scheduled in-process
1062
1292
  `);
1293
+ }
1063
1294
  });
1064
1295
  installGracefulShutdown(server);
1065
1296
  }
@@ -1067,4 +1298,4 @@ export {
1067
1298
  resolveSsrEntry,
1068
1299
  startCommand
1069
1300
  };
1070
- //# sourceMappingURL=start-KR2JJR7K.js.map
1301
+ //# sourceMappingURL=start-UZDMOT7I.js.map