theokit 0.48.14 → 0.50.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/{actions-virtual-module-YZRZMHAX.js → actions-virtual-module-DSIVNGK7.js} +14 -8
- package/dist/{actions-virtual-module-YZRZMHAX.js.map → actions-virtual-module-DSIVNGK7.js.map} +1 -1
- package/dist/{actions-virtual-module-E4PISKMB.js → actions-virtual-module-RXL2RJTW.js} +23 -12
- package/dist/actions-virtual-module-RXL2RJTW.js.map +1 -0
- package/dist/adapters/agent-mount.d.ts +127 -0
- package/dist/adapters/agent-mount.js +25 -0
- package/dist/adapters/security-headers.d.ts +132 -0
- package/dist/adapters/security-headers.js +64 -0
- package/dist/adapters/security-headers.js.map +1 -0
- package/dist/adapters/web-shim.d.ts +100 -13
- package/dist/adapters/web-shim.js +158 -54
- package/dist/adapters/web-shim.js.map +1 -1
- package/dist/agent-7IPEVCAY.js +15 -0
- package/dist/agent-scan-BZa-pagG.d.ts +16 -0
- package/dist/{app-typed-client-I4X2UJWW.js → app-typed-client-UTBMJZOE.js} +15 -9
- package/dist/app-typed-client-UTBMJZOE.js.map +1 -0
- package/dist/{app-typed-client-HLP26EYM.js → app-typed-client-XGDZKH73.js} +24 -13
- package/dist/app-typed-client-XGDZKH73.js.map +1 -0
- package/dist/aws-lambda-VKMYUMP2.js +261 -0
- package/dist/aws-lambda-VKMYUMP2.js.map +1 -0
- package/dist/{body-parser-web-4Z2QTPDU.js → body-parser-web-ON5CUTEL.js} +5 -2
- package/dist/body-parser-web-ON5CUTEL.js.map +1 -0
- package/dist/{body-parser-web-TIOTXPDW.js → body-parser-web-RV2SSAI3.js} +5 -2
- package/dist/body-parser-web-RV2SSAI3.js.map +1 -0
- package/dist/{build-F2Q5QTSC.js → build-VZODSYIQ.js} +72 -26
- package/dist/build-VZODSYIQ.js.map +1 -0
- package/dist/{bun-A5B2MJMO.js → bun-L7PP6ID5.js} +105 -13
- package/dist/bun-L7PP6ID5.js.map +1 -0
- package/dist/{check-45NKUVSQ.js → check-GIPZBFTX.js} +2 -2
- package/dist/{chunk-WYHYOYRH.js → chunk-2COPDKIG.js} +468 -203
- package/dist/chunk-2COPDKIG.js.map +1 -0
- package/dist/chunk-3PBAN2YE.js +146 -0
- package/dist/chunk-3PBAN2YE.js.map +1 -0
- package/dist/{chunk-HBU2GIMZ.js → chunk-3QPVEJ7D.js} +15 -9
- package/dist/chunk-3QPVEJ7D.js.map +1 -0
- package/dist/{chunk-IEES3CHD.js → chunk-47MM2JUK.js} +8 -2
- package/dist/chunk-47MM2JUK.js.map +1 -0
- package/dist/chunk-4X6H2BXP.js +108 -0
- package/dist/chunk-4X6H2BXP.js.map +1 -0
- package/dist/{chunk-A7JBF5FO.js → chunk-5K4TDLRG.js} +8 -5
- package/dist/chunk-5K4TDLRG.js.map +1 -0
- package/dist/chunk-5YPXXSYY.js +181 -0
- package/dist/chunk-5YPXXSYY.js.map +1 -0
- package/dist/{chunk-YGAXV5HR.js → chunk-6J4JWHDJ.js} +191 -112
- package/dist/chunk-6J4JWHDJ.js.map +1 -0
- package/dist/{chunk-FTFN4MYN.js → chunk-7AEBH52I.js} +639 -516
- package/dist/chunk-7AEBH52I.js.map +1 -0
- package/dist/chunk-7UZZHCRN.js +21 -0
- package/dist/chunk-7UZZHCRN.js.map +1 -0
- package/dist/{chunk-MTEWLGVY.js → chunk-BPYMC7SU.js} +4 -48
- package/dist/chunk-BPYMC7SU.js.map +1 -0
- package/dist/chunk-BU6RJPPJ.js +421 -0
- package/dist/chunk-BU6RJPPJ.js.map +1 -0
- package/dist/{chunk-FB2HBNIC.js → chunk-BX6EUYHU.js} +6 -2
- package/dist/chunk-BX6EUYHU.js.map +1 -0
- package/dist/chunk-CHTAWXC2.js +18 -0
- package/dist/chunk-CHTAWXC2.js.map +1 -0
- package/dist/chunk-D4VP2QPR.js +16 -0
- package/dist/chunk-D4VP2QPR.js.map +1 -0
- package/dist/{chunk-YXG2SGQ3.js → chunk-DHAD2O3S.js} +6 -6
- package/dist/chunk-DHAD2O3S.js.map +1 -0
- package/dist/chunk-DOI4G4X3.js +428 -0
- package/dist/chunk-DOI4G4X3.js.map +1 -0
- package/dist/chunk-E43VJ3E5.js +188 -0
- package/dist/chunk-E43VJ3E5.js.map +1 -0
- package/dist/{chunk-47CINLWF.js → chunk-EDWEYQRG.js} +2 -2
- package/dist/chunk-EVZKNA2W.js +110 -0
- package/dist/chunk-EVZKNA2W.js.map +1 -0
- package/dist/chunk-FD4ZDTQ6.js +181 -0
- package/dist/chunk-FD4ZDTQ6.js.map +1 -0
- package/dist/chunk-FDOOBTXJ.js +17 -0
- package/dist/chunk-FDOOBTXJ.js.map +1 -0
- package/dist/chunk-FH3SQR6P.js +275 -0
- package/dist/chunk-FH3SQR6P.js.map +1 -0
- package/dist/{chunk-T5C46IIU.js → chunk-FMTRNQQ7.js} +28 -269
- package/dist/chunk-FMTRNQQ7.js.map +1 -0
- package/dist/chunk-H53KNS6Q.js +513 -0
- package/dist/chunk-H53KNS6Q.js.map +1 -0
- package/dist/chunk-HJHGTFEJ.js +23 -0
- package/dist/chunk-HJHGTFEJ.js.map +1 -0
- package/dist/{chunk-LXAESF4Y.js → chunk-HK4AZBKX.js} +7 -4
- package/dist/chunk-HK4AZBKX.js.map +1 -0
- package/dist/chunk-IRQGAC4L.js +52 -0
- package/dist/chunk-IRQGAC4L.js.map +1 -0
- package/dist/{chunk-FNTLKHZ7.js → chunk-JDN5SAAD.js} +7 -4
- package/dist/chunk-JDN5SAAD.js.map +1 -0
- package/dist/{chunk-XALU5LCU.js → chunk-JKF25N73.js} +555 -147
- package/dist/chunk-JKF25N73.js.map +1 -0
- package/dist/{chunk-BHOTGS7N.js → chunk-KI4DOTN4.js} +25 -2
- package/dist/chunk-KI4DOTN4.js.map +1 -0
- package/dist/chunk-KOS567NB.js +790 -0
- package/dist/chunk-KOS567NB.js.map +1 -0
- package/dist/{chunk-OOBYPCZC.js → chunk-KTS6G26H.js} +304 -195
- package/dist/chunk-KTS6G26H.js.map +1 -0
- package/dist/{chunk-ZB7D62OA.js → chunk-KUZVRJ7M.js} +3 -3
- package/dist/chunk-L4VFNFDL.js +248 -0
- package/dist/chunk-L4VFNFDL.js.map +1 -0
- package/dist/chunk-M2WC5MF7.js +127 -0
- package/dist/chunk-M2WC5MF7.js.map +1 -0
- package/dist/chunk-N42ZWWOW.js +273 -0
- package/dist/chunk-N42ZWWOW.js.map +1 -0
- package/dist/chunk-OGLS76RN.js +43 -0
- package/dist/chunk-OGLS76RN.js.map +1 -0
- package/dist/{chunk-7LVM22VG.js → chunk-OQCRCXCP.js} +6 -6
- package/dist/chunk-OQCRCXCP.js.map +1 -0
- package/dist/{chunk-OLGPYOLO.js → chunk-P6OS7652.js} +5 -2
- package/dist/chunk-P6OS7652.js.map +1 -0
- package/dist/{chunk-O3JIAU3V.js → chunk-PF3YM6NY.js} +157 -103
- package/dist/chunk-PF3YM6NY.js.map +1 -0
- package/dist/{chunk-NTWNO24W.js → chunk-PLUHPNGA.js} +266 -110
- package/dist/chunk-PLUHPNGA.js.map +1 -0
- package/dist/chunk-Q5L5EGWZ.js +26 -0
- package/dist/chunk-Q5L5EGWZ.js.map +1 -0
- package/dist/{chunk-AATSV4UV.js → chunk-QTHVHNJJ.js} +6 -36
- package/dist/chunk-QTHVHNJJ.js.map +1 -0
- package/dist/{chunk-KD5G3YXI.js → chunk-RARK7JBR.js} +39 -10
- package/dist/chunk-RARK7JBR.js.map +1 -0
- package/dist/chunk-RJJF457I.js +111 -0
- package/dist/chunk-RJJF457I.js.map +1 -0
- package/dist/chunk-RPET332G.js +84 -0
- package/dist/chunk-RPET332G.js.map +1 -0
- package/dist/{chunk-646CA6RV.js → chunk-RQW5YMH7.js} +12 -4
- package/dist/chunk-RQW5YMH7.js.map +1 -0
- package/dist/chunk-U5PWXS3J.js +39 -0
- package/dist/chunk-U5PWXS3J.js.map +1 -0
- package/dist/{chunk-RWNSW4FM.js → chunk-UMNXCU3K.js} +12 -6
- package/dist/{chunk-RWNSW4FM.js.map → chunk-UMNXCU3K.js.map} +1 -1
- package/dist/{chunk-DS5MCU2X.js → chunk-URCXSUI3.js} +9 -9
- package/dist/chunk-VI7ZANB3.js +193 -0
- package/dist/chunk-VI7ZANB3.js.map +1 -0
- package/dist/chunk-VQPHPQ5L.js +14 -0
- package/dist/chunk-VQPHPQ5L.js.map +1 -0
- package/dist/chunk-WNJTJRM6.js +147 -0
- package/dist/chunk-WNJTJRM6.js.map +1 -0
- package/dist/{chunk-BMHS4WAN.js → chunk-XS7EX55U.js} +156 -42
- package/dist/chunk-XS7EX55U.js.map +1 -0
- package/dist/chunk-YN4W7LCX.js +31 -0
- package/dist/chunk-YN4W7LCX.js.map +1 -0
- package/dist/chunk-YSJOZEI6.js +1 -0
- package/dist/{chunk-JA2ZAT5Q.js → chunk-Z4PJMZLM.js} +2 -2
- package/dist/chunk-Z4PJMZLM.js.map +1 -0
- package/dist/{chunk-WSXNGF7X.js → chunk-ZNZISJDZ.js} +6 -2
- package/dist/chunk-ZNZISJDZ.js.map +1 -0
- package/dist/chunk-ZWN3AODA.js +11 -0
- package/dist/chunk-ZWN3AODA.js.map +1 -0
- package/dist/cli/index.js +25 -10
- package/dist/cli/index.js.map +1 -1
- package/dist/client/core.d.ts +1 -1
- package/dist/client/core.js +2 -0
- package/dist/client/core.js.map +1 -1
- package/dist/client/index.d.ts +44 -10
- package/dist/client/index.js +35 -0
- package/dist/client/index.js.map +1 -1
- package/dist/cloudflare-SIG42OIW.js +335 -0
- package/dist/cloudflare-SIG42OIW.js.map +1 -0
- package/dist/config-support-WQHQIJTA.js +104 -0
- package/dist/config-support-WQHQIJTA.js.map +1 -0
- package/dist/{csrf-BBrEZSBW.d.ts → csrf-Dgot9qSM.d.ts} +1 -1
- package/dist/deno-deploy-LQAYOOPW.js +196 -0
- package/dist/deno-deploy-LQAYOOPW.js.map +1 -0
- package/dist/{dev-CDFPXISP.js → dev-3UQVD2W6.js} +29 -18
- package/dist/dev-3UQVD2W6.js.map +1 -0
- package/dist/{dev-emit-GWD6IXV7.js → dev-emit-BFNMDCPB.js} +5 -5
- package/dist/{dev-emit-NBT6JD7R.js → dev-emit-MVAJAFGX.js} +5 -3
- package/dist/dev-emit-MVAJAFGX.js.map +1 -0
- package/dist/engine-singleton-X4R7AZBJ.js +315 -0
- package/dist/engine-singleton-X4R7AZBJ.js.map +1 -0
- package/dist/{generate-Y3GWM57K.js → generate-EN6EDITF.js} +43 -4
- package/dist/generate-EN6EDITF.js.map +1 -0
- package/dist/index-DctfHtv-.d.ts +1058 -0
- package/dist/index.d.ts +8 -4
- package/dist/index.js +25 -13
- package/dist/index.js.map +1 -1
- package/dist/{info-QXZW722N.js → info-Y55RWS42.js} +8 -6
- package/dist/{info-QXZW722N.js.map → info-Y55RWS42.js.map} +1 -1
- package/dist/{internal-api-FBK2YXSI.js → internal-api-4X6NDS2F.js} +23 -12
- package/dist/{internal-api-ZCJWJ5EC.js → internal-api-XQHU5JKY.js} +31 -16
- package/dist/internal-api-XQHU5JKY.js.map +1 -0
- package/dist/load-config-4ATXQUN3.js +16 -0
- package/dist/match-DmGgxjIU.d.ts +44 -0
- package/dist/{mcp-KTYP4ZON.js → mcp-IQRHFP3Y.js} +7 -7
- package/dist/netlify-C2IRCZKI.js +245 -0
- package/dist/netlify-C2IRCZKI.js.map +1 -0
- package/dist/node-OSVPYQ3D.js +10 -0
- package/dist/nonce-BXt7Qu_C.d.ts +31 -0
- package/dist/observability-bootstrap-LERYDHKY.js +16 -0
- package/dist/{openapi-OUXNB2F2.js → openapi-VFPEZSRI.js} +13 -11
- package/dist/{openapi-OUXNB2F2.js.map → openapi-VFPEZSRI.js.map} +1 -1
- package/dist/{plugin-runner-DHVr1cC5.d.ts → plugin-runner-BVMOSxvb.d.ts} +1 -1
- package/dist/{plugin-types-4VN1GMqV.d.ts → plugin-types-BUVfUQ0V.d.ts} +1 -1
- package/dist/preview-BT47VMIB.js +23 -0
- package/dist/preview-BT47VMIB.js.map +1 -0
- package/dist/provider-resolver-Dx6QuWrw.d.ts +128 -0
- package/dist/registry-KBZDCFVQ.js +23 -0
- package/dist/route-config-Cm_ZMA1C.d.ts +72 -0
- package/dist/route-policy-BxOycCDq.d.ts +65 -0
- package/dist/router/element-scroll-restoration.d.ts +28 -0
- package/dist/router/element-scroll-restoration.js +96 -0
- package/dist/router/element-scroll-restoration.js.map +1 -0
- package/dist/{routes-NJR4ISCT.js → routes-BPLU3ISV.js} +11 -9
- package/dist/{routes-NJR4ISCT.js.map → routes-BPLU3ISV.js.map} +1 -1
- package/dist/{scan-7MJC6PYU.js → scan-YJEE4KQK.js} +2 -2
- package/dist/{schema-DNIT7JQX.js → schema-SOAD43RQ.js} +7 -5
- package/dist/schemas-4AXHQMV3.js +25 -0
- package/dist/schemas-4AXHQMV3.js.map +1 -0
- package/dist/security-headers-Ccj7ncNx.d.ts +129 -0
- package/dist/server/agent/index.d.ts +2 -105
- package/dist/server/agent/index.js +1 -1
- package/dist/server/auth/index.d.ts +2 -21
- package/dist/server/auth/index.js +3 -2
- package/dist/server/cron/index.js +4 -3
- package/dist/server/define/index.d.ts +43 -57
- package/dist/server/define/index.js +10 -1
- package/dist/server/http/index.d.ts +7 -5
- package/dist/server/http/index.js +57 -12
- package/dist/server/index.d.ts +47 -439
- package/dist/server/index.js +120 -201
- package/dist/server/index.js.map +1 -1
- package/dist/server/jobs/index.js +4 -3
- package/dist/server/observability/index.d.ts +109 -35
- package/dist/server/observability/index.js +11 -7
- package/dist/server/plugins/index.d.ts +3 -3
- package/dist/server/scan/index.d.ts +47 -12
- package/dist/server/scan/index.js +13 -4
- package/dist/server/security/index.d.ts +61 -103
- package/dist/server/security/index.js +15 -6
- package/dist/server/webhook/index.d.ts +90 -3
- package/dist/server/webhook/index.js +12 -2
- package/dist/server-boundary-2WFT546S.js +149 -0
- package/dist/server-boundary-2WFT546S.js.map +1 -0
- package/dist/server-boundary-A67OPRKO.js +134 -0
- package/dist/server-boundary-A67OPRKO.js.map +1 -0
- package/dist/{services-typed-client-P4JERLBL.js → services-typed-client-XGT5SUUN.js} +2 -2
- package/dist/{start-25OV2CAK.js → start-3K3C4Z2X.js} +224 -161
- package/dist/start-3K3C4Z2X.js.map +1 -0
- package/dist/{static-RTO637XW.js → static-SVDWIOXJ.js} +24 -13
- package/dist/static-SVDWIOXJ.js.map +1 -0
- package/dist/{theo-cloud-UZ3GINRU.js → theo-cloud-3ET4G5T6.js} +9 -2
- package/dist/theo-cloud-3ET4G5T6.js.map +1 -0
- package/dist/vercel-BMCQKCWE.js +277 -0
- package/dist/vercel-BMCQKCWE.js.map +1 -0
- package/dist/vite-plugin/index.js +25 -13
- package/dist/vite-plugin-USXUIV3H.js +43 -0
- package/dist/vite-plugin-USXUIV3H.js.map +1 -0
- package/package.json +19 -6
- package/dist/actions-virtual-module-E4PISKMB.js.map +0 -1
- package/dist/agent-XAQCUQNB.js +0 -15
- package/dist/app-typed-client-HLP26EYM.js.map +0 -1
- package/dist/app-typed-client-I4X2UJWW.js.map +0 -1
- package/dist/aws-lambda-KES4MFJV.js +0 -172
- package/dist/aws-lambda-KES4MFJV.js.map +0 -1
- package/dist/body-parser-web-4Z2QTPDU.js.map +0 -1
- package/dist/body-parser-web-TIOTXPDW.js.map +0 -1
- package/dist/build-F2Q5QTSC.js.map +0 -1
- package/dist/bun-A5B2MJMO.js.map +0 -1
- package/dist/chunk-646CA6RV.js.map +0 -1
- package/dist/chunk-7LVM22VG.js.map +0 -1
- package/dist/chunk-A7JBF5FO.js.map +0 -1
- package/dist/chunk-AATSV4UV.js.map +0 -1
- package/dist/chunk-AM3QABW5.js +0 -161
- package/dist/chunk-AM3QABW5.js.map +0 -1
- package/dist/chunk-AXKUA57G.js +0 -94
- package/dist/chunk-AXKUA57G.js.map +0 -1
- package/dist/chunk-BHOTGS7N.js.map +0 -1
- package/dist/chunk-BMHS4WAN.js.map +0 -1
- package/dist/chunk-CMYSHZFT.js +0 -422
- package/dist/chunk-CMYSHZFT.js.map +0 -1
- package/dist/chunk-DQIPV7L5.js +0 -118
- package/dist/chunk-DQIPV7L5.js.map +0 -1
- package/dist/chunk-FB2HBNIC.js.map +0 -1
- package/dist/chunk-FNTLKHZ7.js.map +0 -1
- package/dist/chunk-FTFN4MYN.js.map +0 -1
- package/dist/chunk-HBU2GIMZ.js.map +0 -1
- package/dist/chunk-IEES3CHD.js.map +0 -1
- package/dist/chunk-JA2ZAT5Q.js.map +0 -1
- package/dist/chunk-KD5G3YXI.js.map +0 -1
- package/dist/chunk-KTKTHIUF.js +0 -405
- package/dist/chunk-KTKTHIUF.js.map +0 -1
- package/dist/chunk-LNVMHQ2Z.js +0 -54
- package/dist/chunk-LNVMHQ2Z.js.map +0 -1
- package/dist/chunk-LXAESF4Y.js.map +0 -1
- package/dist/chunk-MTEWLGVY.js.map +0 -1
- package/dist/chunk-NTWNO24W.js.map +0 -1
- package/dist/chunk-O3JIAU3V.js.map +0 -1
- package/dist/chunk-OLGPYOLO.js.map +0 -1
- package/dist/chunk-OOBYPCZC.js.map +0 -1
- package/dist/chunk-T5C46IIU.js.map +0 -1
- package/dist/chunk-U267AOWS.js +0 -28
- package/dist/chunk-U267AOWS.js.map +0 -1
- package/dist/chunk-UW2TEAGR.js +0 -77
- package/dist/chunk-UW2TEAGR.js.map +0 -1
- package/dist/chunk-WPJOTQA5.js +0 -1
- package/dist/chunk-WSXNGF7X.js.map +0 -1
- package/dist/chunk-WYHYOYRH.js.map +0 -1
- package/dist/chunk-XALU5LCU.js.map +0 -1
- package/dist/chunk-XR74JD4M.js +0 -457
- package/dist/chunk-XR74JD4M.js.map +0 -1
- package/dist/chunk-YGAXV5HR.js.map +0 -1
- package/dist/chunk-YXG2SGQ3.js.map +0 -1
- package/dist/cloudflare-IN2WB7FZ.js +0 -122
- package/dist/cloudflare-IN2WB7FZ.js.map +0 -1
- package/dist/deno-deploy-LYXQEJ6A.js +0 -107
- package/dist/deno-deploy-LYXQEJ6A.js.map +0 -1
- package/dist/dev-CDFPXISP.js.map +0 -1
- package/dist/dev-emit-NBT6JD7R.js.map +0 -1
- package/dist/generate-Y3GWM57K.js.map +0 -1
- package/dist/index-D_PxPXgQ.d.ts +0 -575
- package/dist/load-config-FIWNKOJO.js +0 -14
- package/dist/match-CfbEFRG4.d.ts +0 -26
- package/dist/netlify-DLEOCFAD.js +0 -150
- package/dist/netlify-DLEOCFAD.js.map +0 -1
- package/dist/node-QXYSUWQ4.js +0 -10
- package/dist/registry-S7OMF3OS.js +0 -23
- package/dist/start-25OV2CAK.js.map +0 -1
- package/dist/static-RTO637XW.js.map +0 -1
- package/dist/theo-cloud-UZ3GINRU.js.map +0 -1
- package/dist/vercel-6D6EZUVD.js +0 -133
- package/dist/vercel-6D6EZUVD.js.map +0 -1
- package/dist/vite-plugin-RJFKLF2U.js +0 -36
- /package/dist/{chunk-WPJOTQA5.js.map → adapters/agent-mount.js.map} +0 -0
- /package/dist/{agent-XAQCUQNB.js.map → agent-7IPEVCAY.js.map} +0 -0
- /package/dist/{check-45NKUVSQ.js.map → check-GIPZBFTX.js.map} +0 -0
- /package/dist/{chunk-47CINLWF.js.map → chunk-EDWEYQRG.js.map} +0 -0
- /package/dist/{chunk-ZB7D62OA.js.map → chunk-KUZVRJ7M.js.map} +0 -0
- /package/dist/{chunk-DS5MCU2X.js.map → chunk-URCXSUI3.js.map} +0 -0
- /package/dist/{internal-api-ZCJWJ5EC.js.map → chunk-YSJOZEI6.js.map} +0 -0
- /package/dist/{dev-emit-GWD6IXV7.js.map → dev-emit-BFNMDCPB.js.map} +0 -0
- /package/dist/{internal-api-FBK2YXSI.js.map → internal-api-4X6NDS2F.js.map} +0 -0
- /package/dist/{load-config-FIWNKOJO.js.map → load-config-4ATXQUN3.js.map} +0 -0
- /package/dist/{mcp-KTYP4ZON.js.map → mcp-IQRHFP3Y.js.map} +0 -0
- /package/dist/{node-QXYSUWQ4.js.map → node-OSVPYQ3D.js.map} +0 -0
- /package/dist/{scan-7MJC6PYU.js.map → observability-bootstrap-LERYDHKY.js.map} +0 -0
- /package/dist/{registry-S7OMF3OS.js.map → registry-KBZDCFVQ.js.map} +0 -0
- /package/dist/{schema-DNIT7JQX.js.map → scan-YJEE4KQK.js.map} +0 -0
- /package/dist/{vite-plugin-RJFKLF2U.js.map → schema-SOAD43RQ.js.map} +0 -0
- /package/dist/{services-typed-client-P4JERLBL.js.map → services-typed-client-XGT5SUUN.js.map} +0 -0
|
@@ -2,101 +2,102 @@
|
|
|
2
2
|
import "tsx/esm";
|
|
3
3
|
import {
|
|
4
4
|
CONTROLLER_MANIFEST_FILE
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-EDWEYQRG.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
|
-
|
|
20
|
-
|
|
21
|
-
} from "./chunk-
|
|
26
|
+
serveMatchedAuxRoute,
|
|
27
|
+
serveThroughPluginLifecycle
|
|
28
|
+
} from "./chunk-PLUHPNGA.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-AATSV4UV.js";
|
|
29
|
-
import {
|
|
30
|
-
loadEnv
|
|
31
|
-
} from "./chunk-HBU2GIMZ.js";
|
|
32
|
-
import "./chunk-CMYSHZFT.js";
|
|
33
|
-
import "./chunk-WSXNGF7X.js";
|
|
34
33
|
import {
|
|
35
34
|
InMemoryStore,
|
|
36
|
-
|
|
35
|
+
createCorsHandler,
|
|
37
36
|
createPluginRunnerFromConfig,
|
|
38
37
|
createProductionLoader,
|
|
39
38
|
executeAction,
|
|
40
39
|
executeRoute,
|
|
41
40
|
findSuggestion,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
mountAgent,
|
|
42
|
+
readAgentPolicy,
|
|
43
|
+
writeWebResponseToServerResponse
|
|
44
|
+
} from "./chunk-2COPDKIG.js";
|
|
45
45
|
import {
|
|
46
46
|
getApprovalRegistry,
|
|
47
47
|
resolveProvider
|
|
48
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-5YPXXSYY.js";
|
|
49
49
|
import {
|
|
50
|
+
createWebRequestSource,
|
|
50
51
|
dispatchControllerRequest,
|
|
51
|
-
|
|
52
|
+
sendError
|
|
53
|
+
} from "./chunk-FMTRNQQ7.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-H53KNS6Q.js";
|
|
64
|
+
import {
|
|
52
65
|
logRequest,
|
|
53
|
-
sendError,
|
|
54
66
|
warnOnce
|
|
55
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-RARK7JBR.js";
|
|
68
|
+
import "./chunk-7UZZHCRN.js";
|
|
56
69
|
import {
|
|
57
70
|
loadManifest
|
|
58
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-KUZVRJ7M.js";
|
|
59
72
|
import {
|
|
60
73
|
scanAgents
|
|
61
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-EVZKNA2W.js";
|
|
62
75
|
import {
|
|
63
76
|
matchRoute,
|
|
64
77
|
scanServerActions,
|
|
65
78
|
scanServerRoutes,
|
|
66
79
|
scanWebSocketRoutes
|
|
67
|
-
} from "./chunk-
|
|
68
|
-
import "./chunk-
|
|
80
|
+
} from "./chunk-XS7EX55U.js";
|
|
81
|
+
import "./chunk-FD4ZDTQ6.js";
|
|
82
|
+
import {
|
|
83
|
+
loadConfig
|
|
84
|
+
} from "./chunk-QTHVHNJJ.js";
|
|
85
|
+
import {
|
|
86
|
+
loadEnv
|
|
87
|
+
} from "./chunk-3QPVEJ7D.js";
|
|
88
|
+
import "./chunk-U5PWXS3J.js";
|
|
89
|
+
import "./chunk-FH3SQR6P.js";
|
|
90
|
+
import "./chunk-ZNZISJDZ.js";
|
|
91
|
+
import "./chunk-VI7ZANB3.js";
|
|
69
92
|
import "./chunk-VQIUTCK2.js";
|
|
70
93
|
|
|
71
94
|
// src/cli/commands/start/index.ts
|
|
72
|
-
import { existsSync as
|
|
95
|
+
import { existsSync as existsSync4, readFileSync as readFileSync4 } from "fs";
|
|
73
96
|
import { createServer } from "http";
|
|
74
97
|
import { join as join2, resolve as resolve4 } from "path";
|
|
75
98
|
|
|
76
99
|
// src/server/cron/cron-runtime-node.ts
|
|
77
100
|
import { CronExpressionParser } from "cron-parser";
|
|
78
|
-
|
|
79
|
-
// src/server/observability/trace-context-propagation.ts
|
|
80
|
-
function generateNewTraceContext() {
|
|
81
|
-
return {
|
|
82
|
-
trace_id: randomHex(16),
|
|
83
|
-
// 16 bytes = 32 hex chars
|
|
84
|
-
span_id: randomHex(8),
|
|
85
|
-
// 8 bytes = 16 hex chars
|
|
86
|
-
flags: "01"
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
function randomHex(bytes) {
|
|
90
|
-
for (; ; ) {
|
|
91
|
-
const buf = new Uint8Array(bytes);
|
|
92
|
-
globalThis.crypto.getRandomValues(buf);
|
|
93
|
-
let hex = "";
|
|
94
|
-
for (const b of buf) hex += b.toString(16).padStart(2, "0");
|
|
95
|
-
if (!/^0+$/.test(hex)) return hex;
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
// src/server/cron/cron-runtime-node.ts
|
|
100
101
|
function createCronScheduler(definitions) {
|
|
101
102
|
const states = definitions.map((def) => ({
|
|
102
103
|
def,
|
|
@@ -423,7 +424,7 @@ async function configureStorageManagerFromConfig(storageConfig) {
|
|
|
423
424
|
if (storageConfig === void 0 || storageConfig === null) return;
|
|
424
425
|
try {
|
|
425
426
|
const { getStorageManager } = await import("./storage-manager-3O5PDO6O.js");
|
|
426
|
-
const { storageSchema } = await import("./schema-
|
|
427
|
+
const { storageSchema } = await import("./schema-SOAD43RQ.js");
|
|
427
428
|
const parsed = storageSchema.parse(storageConfig);
|
|
428
429
|
getStorageManager().configure(parsed);
|
|
429
430
|
} catch (err) {
|
|
@@ -501,6 +502,16 @@ function installGracefulShutdown(server) {
|
|
|
501
502
|
message: msg
|
|
502
503
|
});
|
|
503
504
|
}
|
|
505
|
+
try {
|
|
506
|
+
const { getObservabilityAdapter } = await import("./observability-bootstrap-LERYDHKY.js");
|
|
507
|
+
await getObservabilityAdapter()?.shutdown();
|
|
508
|
+
} catch (err) {
|
|
509
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
510
|
+
warnOnce("shutdown.observability_error", {
|
|
511
|
+
event: "shutdown.observability_error",
|
|
512
|
+
message: msg
|
|
513
|
+
});
|
|
514
|
+
}
|
|
504
515
|
console.log(` [theokit] shutdown complete`);
|
|
505
516
|
server.close(() => {
|
|
506
517
|
process.exit(0);
|
|
@@ -551,16 +562,13 @@ function loadRoutesAndActions(distDir, serverDir, agentsDir = "agents") {
|
|
|
551
562
|
};
|
|
552
563
|
}
|
|
553
564
|
|
|
554
|
-
// src/cli/commands/start/request-handler.ts
|
|
555
|
-
import { randomUUID } from "crypto";
|
|
556
|
-
|
|
557
565
|
// src/cli/commands/start/handlers.ts
|
|
558
566
|
import { extname as extname2 } from "path";
|
|
559
567
|
import { pathToFileURL } from "url";
|
|
560
568
|
|
|
561
569
|
// src/server/http/static.ts
|
|
562
|
-
import {
|
|
563
|
-
import { resolve as resolve3, extname } from "path";
|
|
570
|
+
import { closeSync, fstatSync, openSync, readFileSync as readFileSync3, realpathSync } from "fs";
|
|
571
|
+
import { resolve as resolve3, extname, sep } from "path";
|
|
564
572
|
var MIME_TYPES = {
|
|
565
573
|
".html": "text/html",
|
|
566
574
|
".js": "application/javascript",
|
|
@@ -582,23 +590,40 @@ var MIME_TYPES = {
|
|
|
582
590
|
function serveStaticFile(req, res, clientDir) {
|
|
583
591
|
const urlPath = (req.url ?? "/").split("?")[0];
|
|
584
592
|
const filePath = resolve3(clientDir, "." + urlPath);
|
|
585
|
-
if (!filePath.startsWith(clientDir)) {
|
|
593
|
+
if (filePath !== clientDir && !filePath.startsWith(clientDir + sep)) {
|
|
586
594
|
res.writeHead(403);
|
|
587
595
|
res.end("Forbidden");
|
|
588
596
|
return true;
|
|
589
597
|
}
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
598
|
+
let realPath;
|
|
599
|
+
let realRoot;
|
|
600
|
+
try {
|
|
601
|
+
realPath = realpathSync(filePath);
|
|
602
|
+
realRoot = realpathSync(clientDir);
|
|
603
|
+
} catch {
|
|
604
|
+
return false;
|
|
605
|
+
}
|
|
606
|
+
if (realPath !== realRoot && !realPath.startsWith(realRoot + sep)) return false;
|
|
607
|
+
let fd;
|
|
608
|
+
try {
|
|
609
|
+
fd = openSync(realPath, "r");
|
|
610
|
+
} catch {
|
|
611
|
+
return false;
|
|
612
|
+
}
|
|
613
|
+
try {
|
|
614
|
+
if (!fstatSync(fd).isFile()) return false;
|
|
615
|
+
const ext = extname(filePath);
|
|
616
|
+
const contentType = MIME_TYPES[ext] ?? "application/octet-stream";
|
|
617
|
+
const content = readFileSync3(fd);
|
|
618
|
+
res.writeHead(200, {
|
|
619
|
+
"Content-Type": contentType,
|
|
620
|
+
"Content-Length": content.length
|
|
621
|
+
});
|
|
622
|
+
res.end(content);
|
|
623
|
+
return true;
|
|
624
|
+
} finally {
|
|
625
|
+
closeSync(fd);
|
|
626
|
+
}
|
|
602
627
|
}
|
|
603
628
|
|
|
604
629
|
// src/cli/commands/start/handlers.ts
|
|
@@ -606,6 +631,15 @@ async function loadCompiledController(absPath) {
|
|
|
606
631
|
return await import(pathToFileURL(absPath).href);
|
|
607
632
|
}
|
|
608
633
|
var X_REQUEST_ID = "x-request-id";
|
|
634
|
+
function agentSubjectResolver(c) {
|
|
635
|
+
return createAgentSubjectResolver({
|
|
636
|
+
req: c.req,
|
|
637
|
+
res: c.res,
|
|
638
|
+
loadModule: c.loadModule,
|
|
639
|
+
serverDir: c.serverDir,
|
|
640
|
+
pluginRunner: c.pluginRunner
|
|
641
|
+
});
|
|
642
|
+
}
|
|
609
643
|
async function applyRateLimit(c, method) {
|
|
610
644
|
if (!c.rateLimiter) return false;
|
|
611
645
|
const check = await c.rateLimiter(c.req);
|
|
@@ -687,23 +721,41 @@ async function tryServeAction(c) {
|
|
|
687
721
|
}
|
|
688
722
|
async function tryServeAgentAux(c) {
|
|
689
723
|
const urlPath = c.url.split("?")[0];
|
|
690
|
-
const
|
|
691
|
-
const request = incomingMessageToWebRequest(c.req);
|
|
692
|
-
const response = await serveAgentAuxRoute(request, urlPath, {
|
|
724
|
+
const deps = {
|
|
693
725
|
agents: c.cachedAgents,
|
|
694
726
|
loadModule: c.loadModule,
|
|
695
|
-
baseUrl
|
|
727
|
+
baseUrl: `http://${c.req.headers.host ?? "localhost"}`,
|
|
696
728
|
// M34 (#97) — the MCP aux route drives the agent (spends tokens); enforce CSRF like the run route.
|
|
697
729
|
csrfMode: c.csrfMode,
|
|
698
730
|
// M39 — the thread follow-up route drives the agent; resolve the key on demand.
|
|
699
731
|
// theokit#328 — the thread route drives an agent, so its key follows the model too.
|
|
700
|
-
resolveApiKey: (model) => resolveProvider(model).apiKey
|
|
701
|
-
|
|
702
|
-
|
|
732
|
+
resolveApiKey: (model) => resolveProvider(model).apiKey,
|
|
733
|
+
// usetheokit/theokit#365 — who is asking. Memoized and LAZY: built here, invoked only inside
|
|
734
|
+
// `serveMatchedAuxRoute` and only when the matched agent declares a policy, so the application's
|
|
735
|
+
// `createContext` never runs for a url this branch declines.
|
|
736
|
+
resolveSubject: agentSubjectResolver(c)
|
|
737
|
+
};
|
|
738
|
+
const method = (c.req.method ?? "GET").toUpperCase();
|
|
739
|
+
const route = await matchAgentAuxRoute(method, urlPath, deps);
|
|
740
|
+
if (route === null) return false;
|
|
703
741
|
c.res.setHeader(X_REQUEST_ID, c.requestId);
|
|
704
|
-
await
|
|
742
|
+
await serveThroughPluginLifecycle(
|
|
743
|
+
{
|
|
744
|
+
source: createWebRequestSource(c.req),
|
|
745
|
+
res: c.res,
|
|
746
|
+
requestId: c.requestId,
|
|
747
|
+
pluginRunner: c.pluginRunner,
|
|
748
|
+
failureMessage: "Agent aux handler failed"
|
|
749
|
+
},
|
|
750
|
+
async (request) => {
|
|
751
|
+
await writeWebResponseToServerResponse(
|
|
752
|
+
await serveMatchedAuxRoute(route, request, deps),
|
|
753
|
+
c.res
|
|
754
|
+
);
|
|
755
|
+
}
|
|
756
|
+
);
|
|
705
757
|
logRequest({
|
|
706
|
-
method
|
|
758
|
+
method,
|
|
707
759
|
url: c.url,
|
|
708
760
|
status: c.res.statusCode,
|
|
709
761
|
duration: Date.now() - c.startTime,
|
|
@@ -736,25 +788,27 @@ async function tryServeAgent(c) {
|
|
|
736
788
|
});
|
|
737
789
|
return true;
|
|
738
790
|
}
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
791
|
+
await serveThroughPluginLifecycle(
|
|
792
|
+
{
|
|
793
|
+
source: createWebRequestSource(c.req),
|
|
794
|
+
res: c.res,
|
|
795
|
+
requestId: c.requestId,
|
|
796
|
+
pluginRunner: c.pluginRunner,
|
|
797
|
+
failureMessage: "Approve handler failed"
|
|
798
|
+
},
|
|
799
|
+
async (request) => {
|
|
800
|
+
const approveAgent = c.cachedAgents.find((a) => a.name === parseApprovalAgentName(urlPath));
|
|
801
|
+
const policy = approveAgent === void 0 ? void 0 : readAgentPolicy(await c.loadModule(approveAgent.filePath), approveAgent.filePath);
|
|
802
|
+
const response = await handleAgentApproval(
|
|
803
|
+
request,
|
|
804
|
+
urlPath,
|
|
805
|
+
getApprovalRegistry(),
|
|
806
|
+
c.csrfMode,
|
|
807
|
+
{ policy, resolveSubject: agentSubjectResolver(c) }
|
|
808
|
+
);
|
|
809
|
+
await writeWebResponseToServerResponse(response, c.res);
|
|
810
|
+
}
|
|
811
|
+
);
|
|
758
812
|
logRequest({
|
|
759
813
|
method: method2,
|
|
760
814
|
url: c.url,
|
|
@@ -791,64 +845,31 @@ async function tryServeAgent(c) {
|
|
|
791
845
|
return true;
|
|
792
846
|
}
|
|
793
847
|
async function serveAgentTurn(c, agent, method) {
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
return;
|
|
816
|
-
}
|
|
817
|
-
if (c.pluginRunner) {
|
|
818
|
-
c.pluginRunner.applyDecorations(pluginCtx.ctx);
|
|
819
|
-
const onRequest = await c.pluginRunner.runOnRequest(pluginCtx);
|
|
820
|
-
if (onRequest.shortCircuited) {
|
|
821
|
-
logRequest({
|
|
822
|
-
method,
|
|
823
|
-
url: c.url,
|
|
824
|
-
status: c.res.statusCode,
|
|
825
|
-
duration: Date.now() - c.startTime,
|
|
826
|
-
requestId: c.requestId
|
|
848
|
+
const resolveSubject = agentSubjectResolver(c);
|
|
849
|
+
await serveThroughPluginLifecycle(
|
|
850
|
+
{
|
|
851
|
+
source: createWebRequestSource(c.req),
|
|
852
|
+
res: c.res,
|
|
853
|
+
requestId: c.requestId,
|
|
854
|
+
pluginRunner: c.pluginRunner,
|
|
855
|
+
failureMessage: "Agent handler failed"
|
|
856
|
+
},
|
|
857
|
+
async (request) => {
|
|
858
|
+
const mod = await c.loadModule(agent.filePath);
|
|
859
|
+
const apiKey = (model) => resolveProvider(model).apiKey;
|
|
860
|
+
const response = await mountAgent(mod, request, apiKey, {
|
|
861
|
+
source: agent.filePath,
|
|
862
|
+
csrfMode: c.csrfMode,
|
|
863
|
+
projectRoot: c.projectRoot,
|
|
864
|
+
// usetheokit/theokit#365 — the policy is read off `mod` inside `mountAgent`; what this
|
|
865
|
+
// caller owes is the identity to judge it against. usetheokit/theokit#406 — and it is the
|
|
866
|
+
// same value the run's spans are labelled with, so `source` above never reaches telemetry.
|
|
867
|
+
agentName: agent.name,
|
|
868
|
+
resolveSubject
|
|
827
869
|
});
|
|
828
|
-
|
|
870
|
+
await writeWebResponseToServerResponse(response, c.res);
|
|
829
871
|
}
|
|
830
|
-
|
|
831
|
-
try {
|
|
832
|
-
const mod = await c.loadModule(agent.filePath);
|
|
833
|
-
const apiKey = (model) => resolveProvider(model).apiKey;
|
|
834
|
-
const response = await mountAgent(mod, request, apiKey, {
|
|
835
|
-
source: agent.filePath,
|
|
836
|
-
csrfMode: c.csrfMode,
|
|
837
|
-
projectRoot: c.projectRoot
|
|
838
|
-
});
|
|
839
|
-
await writeWebResponseToServerResponse(response, c.res);
|
|
840
|
-
} catch (err) {
|
|
841
|
-
if (c.pluginRunner) await c.pluginRunner.runOnError(pluginCtx, err);
|
|
842
|
-
sendError(
|
|
843
|
-
c.res,
|
|
844
|
-
"INTERNAL",
|
|
845
|
-
err instanceof Error ? err.message : "Agent handler failed",
|
|
846
|
-
500,
|
|
847
|
-
void 0,
|
|
848
|
-
c.requestId
|
|
849
|
-
);
|
|
850
|
-
}
|
|
851
|
-
if (c.pluginRunner) await c.pluginRunner.runOnResponse(pluginCtx);
|
|
872
|
+
);
|
|
852
873
|
logRequest({
|
|
853
874
|
method,
|
|
854
875
|
url: c.url,
|
|
@@ -1021,7 +1042,16 @@ async function handleSsrStreaming(ctx, req, res, url, nonce) {
|
|
|
1021
1042
|
try {
|
|
1022
1043
|
const result = await ctx.ssrRenderStreaming(url, res, {
|
|
1023
1044
|
signal: controller.signal,
|
|
1024
|
-
nonce
|
|
1045
|
+
nonce,
|
|
1046
|
+
// #343 — the streamed response carried neither of these, so `ssrStreaming: true`
|
|
1047
|
+
// served a bare React tree: no `<head>`, no client entry, no hydration data.
|
|
1048
|
+
//
|
|
1049
|
+
// `applyNonceToInlineScripts` and not `withHoistedHead`: hoisting reads the
|
|
1050
|
+
// RENDERED body for head elements, and nothing is rendered yet when the head
|
|
1051
|
+
// has to flush. Metadata hoisting under streaming is the same defect on a
|
|
1052
|
+
// different surface, and it is M9's, not this one's.
|
|
1053
|
+
htmlHead: applyNonceToInlineScripts(ctx.htmlHead, nonce),
|
|
1054
|
+
htmlTail: ctx.htmlTail
|
|
1025
1055
|
});
|
|
1026
1056
|
if (isRedirectResult(result)) sendRedirect(res, result);
|
|
1027
1057
|
return true;
|
|
@@ -1063,8 +1093,12 @@ function createRequestHandler(ctx) {
|
|
|
1063
1093
|
return (req, res) => {
|
|
1064
1094
|
void (async () => {
|
|
1065
1095
|
const url = req.url ?? "/";
|
|
1066
|
-
const requestId =
|
|
1096
|
+
const requestId = extractTraceId(req);
|
|
1067
1097
|
const start = Date.now();
|
|
1098
|
+
res.setHeader("x-request-id", requestId);
|
|
1099
|
+
res.setHeader(TRACE_HEADER, requestId);
|
|
1100
|
+
if (ctx.corsHandler?.handlePreflight(req, res) === true) return;
|
|
1101
|
+
ctx.corsHandler?.applyHeaders(req, res);
|
|
1068
1102
|
const nonce = generateNonce();
|
|
1069
1103
|
const securityHeaders = buildSecurityHeaders(
|
|
1070
1104
|
ctx.securityHeadersConfig,
|
|
@@ -1094,6 +1128,24 @@ function createRequestHandler(ctx) {
|
|
|
1094
1128
|
};
|
|
1095
1129
|
}
|
|
1096
1130
|
|
|
1131
|
+
// src/cli/commands/start/resolve-listen-host.ts
|
|
1132
|
+
function resolveListenTarget(host, env = process.env.HOST) {
|
|
1133
|
+
if (host === true) return { host: "0.0.0.0", source: "config" };
|
|
1134
|
+
if (typeof host === "string" && host !== "") return { host, source: "config" };
|
|
1135
|
+
if (host !== false && env !== void 0 && env !== "") return { host: env, source: "env" };
|
|
1136
|
+
return { host: "localhost", source: "default" };
|
|
1137
|
+
}
|
|
1138
|
+
function describeListenTarget(target, port) {
|
|
1139
|
+
const url = target.host === "0.0.0.0" || target.host === "::" ? "localhost" : target.host;
|
|
1140
|
+
const bound = target.host === "0.0.0.0" || target.host === "::" ? `bound to ${target.host} (every interface)` : `bound to ${target.host} only`;
|
|
1141
|
+
return ` \u2192 http://${url}:${String(port)} [${bound}${provenance(target.source)}]`;
|
|
1142
|
+
}
|
|
1143
|
+
function provenance(source) {
|
|
1144
|
+
if (source === "env") return " from HOST";
|
|
1145
|
+
if (source === "config") return "";
|
|
1146
|
+
return " \u2014 set `host: true` in theo.config.ts or HOST=0.0.0.0 to reach it from outside this machine";
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1097
1149
|
// src/cli/commands/start/websocket-handler.ts
|
|
1098
1150
|
async function attachWebSocketHandler(server, wsRoutes, loadModule) {
|
|
1099
1151
|
if (wsRoutes.length === 0) return;
|
|
@@ -1149,22 +1201,28 @@ async function startCommand(options) {
|
|
|
1149
1201
|
assertSdkCompatible();
|
|
1150
1202
|
await configureAgentRegistryFromConfig(config.agents?.registry);
|
|
1151
1203
|
await configureStorageManagerFromConfig(config.storage);
|
|
1204
|
+
await initCacheEngineFromConfig(config.cache);
|
|
1152
1205
|
const distDir = resolve4(cwd, ".theokit");
|
|
1153
1206
|
const clientDir = resolve4(distDir, "client");
|
|
1154
|
-
const controllersDistDir =
|
|
1207
|
+
const controllersDistDir = existsSync4(resolve4(distDir, CONTROLLER_MANIFEST_FILE)) ? resolve4(distDir, "controllers") : void 0;
|
|
1155
1208
|
const serverDir = resolve4(cwd, config.serverDir);
|
|
1156
|
-
if (!
|
|
1209
|
+
if (!existsSync4(clientDir)) {
|
|
1157
1210
|
throw new Error("No build found. Run `theo build` first.");
|
|
1158
1211
|
}
|
|
1159
1212
|
const indexHtml = readFileSync4(join2(clientDir, "index.html"), "utf-8");
|
|
1160
1213
|
const loadModule = createProductionLoader();
|
|
1161
|
-
const
|
|
1162
|
-
const
|
|
1214
|
+
const envPort = Number.parseInt(process.env.PORT ?? "", 10);
|
|
1215
|
+
const port = options.port ?? (Number.isInteger(envPort) ? envPort : void 0) ?? config.port;
|
|
1216
|
+
const observabilityPlugin = createObservabilityPluginFromConfig(config.observability, process.env);
|
|
1217
|
+
const declaredPlugins = await resolvePluginSpecifiers(config.plugins ?? [], cwd);
|
|
1218
|
+
const pluginRunner = await createPluginRunnerFromConfig(
|
|
1219
|
+
observabilityPlugin === void 0 ? declaredPlugins : [observabilityPlugin, ...declaredPlugins]
|
|
1220
|
+
);
|
|
1163
1221
|
const transformer = resolveTransformer(config.serialization);
|
|
1164
1222
|
const custom404Path = join2(clientDir, "404.html");
|
|
1165
1223
|
const custom500Path = join2(clientDir, "500.html");
|
|
1166
|
-
const custom404Html =
|
|
1167
|
-
const custom500Html =
|
|
1224
|
+
const custom404Html = existsSync4(custom404Path) ? readFileSync4(custom404Path, "utf-8") : null;
|
|
1225
|
+
const custom500Html = existsSync4(custom500Path) ? readFileSync4(custom500Path, "utf-8") : null;
|
|
1168
1226
|
const {
|
|
1169
1227
|
routes: cachedRoutes,
|
|
1170
1228
|
actions: cachedActions,
|
|
@@ -1202,6 +1260,10 @@ async function startCommand(options) {
|
|
|
1202
1260
|
rateLimiter
|
|
1203
1261
|
}),
|
|
1204
1262
|
securityHeadersConfig: config.security?.headers ?? {},
|
|
1263
|
+
// #409 — built once at startup, like the security headers beside it. Declaring `cors` and
|
|
1264
|
+
// being served by this command used to mean no CORS at all, which reads in a browser as a
|
|
1265
|
+
// blocked fetch and in the config as a setting that is present and validated.
|
|
1266
|
+
corsHandler: config.security?.cors ? createCorsHandler(config.security.cors) : null,
|
|
1205
1267
|
ssrRender: ssr.render,
|
|
1206
1268
|
ssrRenderStreaming: ssr.renderStreaming,
|
|
1207
1269
|
ssrStreamingEnabled: ssr.streamingEnabled,
|
|
@@ -1220,10 +1282,11 @@ async function startCommand(options) {
|
|
|
1220
1282
|
if (cronDefinitions.length > 0) {
|
|
1221
1283
|
createCronScheduler(cronDefinitions).start();
|
|
1222
1284
|
}
|
|
1223
|
-
|
|
1285
|
+
const listenTarget = resolveListenTarget(config.host);
|
|
1286
|
+
server.listen(port, listenTarget.host, () => {
|
|
1224
1287
|
console.log(`
|
|
1225
1288
|
Theo production server`);
|
|
1226
|
-
console.log(
|
|
1289
|
+
console.log(`${describeListenTarget(listenTarget, port)}
|
|
1227
1290
|
`);
|
|
1228
1291
|
if (cronDefinitions.length > 0) {
|
|
1229
1292
|
console.log(` Crons: ${String(cronDefinitions.length)} scheduled in-process
|
|
@@ -1236,4 +1299,4 @@ export {
|
|
|
1236
1299
|
resolveSsrEntry,
|
|
1237
1300
|
startCommand
|
|
1238
1301
|
};
|
|
1239
|
-
//# sourceMappingURL=start-
|
|
1302
|
+
//# sourceMappingURL=start-3K3C4Z2X.js.map
|