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.
- package/README.md +1 -0
- package/dist/{actions-virtual-module-YQXRSSMW.js → actions-virtual-module-5WBVSDOM.js} +22 -12
- package/dist/actions-virtual-module-5WBVSDOM.js.map +1 -0
- package/dist/{actions-virtual-module-LB4NGONI.js → actions-virtual-module-ZYLMNW6K.js} +13 -8
- package/dist/{actions-virtual-module-LB4NGONI.js.map → actions-virtual-module-ZYLMNW6K.js.map} +1 -1
- package/dist/adapters/agent-mount.d.ts +127 -0
- package/dist/adapters/agent-mount.js +24 -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-GKUEL6OH.js +15 -0
- package/dist/agent-scan-BZa-pagG.d.ts +16 -0
- package/dist/{app-typed-client-GHO3EWZK.js → app-typed-client-4LAIEGFX.js} +23 -13
- package/dist/app-typed-client-4LAIEGFX.js.map +1 -0
- package/dist/{app-typed-client-G3J5G7E5.js → app-typed-client-DQM3Y6YY.js} +14 -9
- package/dist/app-typed-client-DQM3Y6YY.js.map +1 -0
- package/dist/aws-lambda-VKMYUMP2.js +261 -0
- package/dist/aws-lambda-VKMYUMP2.js.map +1 -0
- package/dist/{build-WU6AKKIB.js → build-FLX6VF7Q.js} +71 -26
- package/dist/build-FLX6VF7Q.js.map +1 -0
- package/dist/{bun-33RD6K7O.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-KD5G3YXI.js → chunk-2AMLGJJA.js} +35 -9
- package/dist/chunk-2AMLGJJA.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-47CINLWF.js → chunk-44J2ANQC.js} +2 -2
- 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-72DMJBXI.js +424 -0
- package/dist/chunk-72DMJBXI.js.map +1 -0
- package/dist/chunk-7PM6K5EV.js +513 -0
- package/dist/chunk-7PM6K5EV.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-BIVCP6X5.js → chunk-C62IZEJI.js} +465 -202
- package/dist/chunk-C62IZEJI.js.map +1 -0
- package/dist/chunk-D4VP2QPR.js +16 -0
- package/dist/chunk-D4VP2QPR.js.map +1 -0
- package/dist/{chunk-J5MXCGKA.js → chunk-DHAD2O3S.js} +6 -6
- package/dist/chunk-DHAD2O3S.js.map +1 -0
- package/dist/chunk-E43VJ3E5.js +188 -0
- package/dist/chunk-E43VJ3E5.js.map +1 -0
- 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-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-T5C46IIU.js → chunk-HWBRS4DZ.js} +28 -269
- package/dist/chunk-HWBRS4DZ.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-GXEX4CBH.js → chunk-JIKNR5LX.js} +673 -484
- package/dist/chunk-JIKNR5LX.js.map +1 -0
- package/dist/{chunk-GRI4XHBJ.js → chunk-JWRCZIA4.js} +266 -108
- package/dist/chunk-JWRCZIA4.js.map +1 -0
- package/dist/{chunk-E576KYYT.js → chunk-KI4DOTN4.js} +25 -2
- package/dist/chunk-KI4DOTN4.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-O3JIAU3V.js → chunk-MCTC6HSE.js} +157 -103
- package/dist/chunk-MCTC6HSE.js.map +1 -0
- package/dist/{chunk-PXFXSFJL.js → chunk-NZ5JU6D3.js} +9 -9
- package/dist/{chunk-YRBR424R.js → chunk-OAUI273L.js} +338 -165
- package/dist/chunk-OAUI273L.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-Q5L5EGWZ.js +26 -0
- package/dist/chunk-Q5L5EGWZ.js.map +1 -0
- package/dist/{chunk-S433N3CT.js → chunk-QTHVHNJJ.js} +6 -36
- package/dist/chunk-QTHVHNJJ.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-XALU5LCU.js → chunk-RWNYIU6A.js} +550 -146
- package/dist/chunk-RWNYIU6A.js.map +1 -0
- package/dist/chunk-SL7YUHPV.js +111 -0
- package/dist/chunk-SL7YUHPV.js.map +1 -0
- package/dist/chunk-U5PWXS3J.js +39 -0
- package/dist/chunk-U5PWXS3J.js.map +1 -0
- package/dist/chunk-ULDCFL2O.js +273 -0
- package/dist/chunk-ULDCFL2O.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-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-WOBSEO75.js +790 -0
- package/dist/chunk-WOBSEO75.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-7VPQHEAJ.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-MUWJAZRD.js → dev-ANDSEVLB.js} +28 -18
- package/dist/dev-ANDSEVLB.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-CzxtQcnp.d.ts +1058 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +24 -13
- package/dist/index.js.map +1 -1
- package/dist/{info-XW7HGUPH.js → info-Y55RWS42.js} +8 -6
- package/dist/{info-XW7HGUPH.js.map → info-Y55RWS42.js.map} +1 -1
- package/dist/{internal-api-V5L65YSJ.js → internal-api-IP35YU3G.js} +22 -12
- package/dist/{internal-api-WEOSTMSN.js → internal-api-OPU456AT.js} +30 -16
- package/dist/internal-api-OPU456AT.js.map +1 -0
- package/dist/load-config-4ATXQUN3.js +16 -0
- package/dist/match-DmGgxjIU.d.ts +44 -0
- package/dist/{mcp-ULUFJNSZ.js → mcp-5LLNAGKA.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-MZMSOE66.js +15 -0
- package/dist/{openapi-HZXR335W.js → openapi-VFPEZSRI.js} +13 -11
- package/dist/{openapi-HZXR335W.js.map → openapi-VFPEZSRI.js.map} +1 -1
- package/dist/{plugin-runner-BFEcgtmJ.d.ts → plugin-runner-BVMOSxvb.d.ts} +1 -1
- package/dist/{plugin-types-D69-lJZ9.d.ts → plugin-types-BUVfUQ0V.d.ts} +13 -1
- package/dist/preview-GHPT2EQ5.js +23 -0
- package/dist/preview-GHPT2EQ5.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-OLNQX7CT.js → routes-BPLU3ISV.js} +11 -9
- package/dist/{routes-OLNQX7CT.js.map → routes-BPLU3ISV.js.map} +1 -1
- package/dist/{scan-7MJC6PYU.js → scan-YJEE4KQK.js} +2 -2
- package/dist/{schema-ZO3OSWVG.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 -90
- 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 +51 -57
- package/dist/server/define/index.js +10 -1
- package/dist/server/http/index.d.ts +7 -5
- package/dist/server/http/index.js +56 -12
- package/dist/server/index.d.ts +47 -439
- package/dist/server/index.js +119 -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 +10 -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-6B4ZQUY7.js +148 -0
- package/dist/server-boundary-6B4ZQUY7.js.map +1 -0
- package/dist/server-boundary-7VZQRPPX.js +133 -0
- package/dist/server-boundary-7VZQRPPX.js.map +1 -0
- package/dist/{services-typed-client-PSAGRPFF.js → services-typed-client-XGT5SUUN.js} +2 -2
- package/dist/{start-KR2JJR7K.js → start-UZDMOT7I.js} +342 -111
- package/dist/start-UZDMOT7I.js.map +1 -0
- package/dist/{static-M2W4HUWS.js → static-SVDWIOXJ.js} +24 -13
- package/dist/static-SVDWIOXJ.js.map +1 -0
- package/dist/{theo-cloud-XAHWOUFK.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 +24 -13
- package/dist/vite-plugin-VKCT2LF2.js +42 -0
- package/dist/vite-plugin-VKCT2LF2.js.map +1 -0
- package/package.json +19 -6
- package/dist/actions-virtual-module-YQXRSSMW.js.map +0 -1
- package/dist/agent-7JJW3TPB.js +0 -15
- package/dist/app-typed-client-G3J5G7E5.js.map +0 -1
- package/dist/app-typed-client-GHO3EWZK.js.map +0 -1
- package/dist/aws-lambda-CYNDGU5O.js +0 -172
- package/dist/aws-lambda-CYNDGU5O.js.map +0 -1
- package/dist/build-WU6AKKIB.js.map +0 -1
- package/dist/bun-33RD6K7O.js.map +0 -1
- package/dist/chunk-646CA6RV.js.map +0 -1
- package/dist/chunk-6E5WKMDS.js +0 -67
- package/dist/chunk-6E5WKMDS.js.map +0 -1
- package/dist/chunk-6GGWS7J3.js +0 -91
- package/dist/chunk-6GGWS7J3.js.map +0 -1
- package/dist/chunk-7LVM22VG.js.map +0 -1
- package/dist/chunk-7VPQHEAJ.js.map +0 -1
- package/dist/chunk-A7JBF5FO.js.map +0 -1
- package/dist/chunk-AM3QABW5.js +0 -161
- package/dist/chunk-AM3QABW5.js.map +0 -1
- package/dist/chunk-BIVCP6X5.js.map +0 -1
- package/dist/chunk-BMHS4WAN.js.map +0 -1
- package/dist/chunk-E576KYYT.js.map +0 -1
- package/dist/chunk-FB2HBNIC.js.map +0 -1
- package/dist/chunk-FNTLKHZ7.js.map +0 -1
- package/dist/chunk-GRI4XHBJ.js.map +0 -1
- package/dist/chunk-GVW5EKEU.js +0 -422
- package/dist/chunk-GVW5EKEU.js.map +0 -1
- package/dist/chunk-GXEX4CBH.js.map +0 -1
- package/dist/chunk-HBU2GIMZ.js.map +0 -1
- package/dist/chunk-IEES3CHD.js.map +0 -1
- package/dist/chunk-J5MXCGKA.js.map +0 -1
- package/dist/chunk-JA2ZAT5Q.js.map +0 -1
- package/dist/chunk-KD5G3YXI.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-O3JIAU3V.js.map +0 -1
- package/dist/chunk-OJLL4YD6.js +0 -403
- package/dist/chunk-OJLL4YD6.js.map +0 -1
- package/dist/chunk-OLGPYOLO.js.map +0 -1
- package/dist/chunk-S433N3CT.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-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-YRBR424R.js.map +0 -1
- package/dist/cloudflare-KYUWCEPL.js +0 -122
- package/dist/cloudflare-KYUWCEPL.js.map +0 -1
- package/dist/deno-deploy-CCTB7HGS.js +0 -107
- package/dist/deno-deploy-CCTB7HGS.js.map +0 -1
- package/dist/dev-MUWJAZRD.js.map +0 -1
- package/dist/dev-emit-NBT6JD7R.js.map +0 -1
- package/dist/generate-Y3GWM57K.js.map +0 -1
- package/dist/index-BEtEv6ZH.d.ts +0 -575
- package/dist/load-config-VKD6LKWU.js +0 -14
- package/dist/match-CfbEFRG4.d.ts +0 -26
- package/dist/netlify-AFMDNKT4.js +0 -150
- package/dist/netlify-AFMDNKT4.js.map +0 -1
- package/dist/node-ZJQEJSP3.js +0 -10
- package/dist/registry-GKR3EWRW.js +0 -23
- package/dist/start-KR2JJR7K.js.map +0 -1
- package/dist/static-M2W4HUWS.js.map +0 -1
- package/dist/theo-cloud-XAHWOUFK.js.map +0 -1
- package/dist/vercel-SRS2DH6O.js +0 -133
- package/dist/vercel-SRS2DH6O.js.map +0 -1
- package/dist/vite-plugin-VPJFD4HK.js +0 -36
- /package/dist/{chunk-WPJOTQA5.js.map → adapters/agent-mount.js.map} +0 -0
- /package/dist/{agent-7JJW3TPB.js.map → agent-GKUEL6OH.js.map} +0 -0
- /package/dist/{check-45NKUVSQ.js.map → check-GIPZBFTX.js.map} +0 -0
- /package/dist/{chunk-47CINLWF.js.map → chunk-44J2ANQC.js.map} +0 -0
- /package/dist/{chunk-ZB7D62OA.js.map → chunk-KUZVRJ7M.js.map} +0 -0
- /package/dist/{chunk-PXFXSFJL.js.map → chunk-NZ5JU6D3.js.map} +0 -0
- /package/dist/{internal-api-WEOSTMSN.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-V5L65YSJ.js.map → internal-api-IP35YU3G.js.map} +0 -0
- /package/dist/{load-config-VKD6LKWU.js.map → load-config-4ATXQUN3.js.map} +0 -0
- /package/dist/{mcp-ULUFJNSZ.js.map → mcp-5LLNAGKA.js.map} +0 -0
- /package/dist/{node-ZJQEJSP3.js.map → node-OSVPYQ3D.js.map} +0 -0
- /package/dist/{scan-7MJC6PYU.js.map → observability-bootstrap-MZMSOE66.js.map} +0 -0
- /package/dist/{registry-GKR3EWRW.js.map → registry-KBZDCFVQ.js.map} +0 -0
- /package/dist/{schema-ZO3OSWVG.js.map → scan-YJEE4KQK.js.map} +0 -0
- /package/dist/{vite-plugin-VPJFD4HK.js.map → schema-SOAD43RQ.js.map} +0 -0
- /package/dist/{services-typed-client-PSAGRPFF.js.map → services-typed-client-XGT5SUUN.js.map} +0 -0
package/README.md
CHANGED
|
@@ -47,6 +47,7 @@ missing:
|
|
|
47
47
|
import { route, action, websocket, middleware, tool, plugin } from 'theokit/server'
|
|
48
48
|
|
|
49
49
|
export const GET = route()
|
|
50
|
+
.policy('public')
|
|
50
51
|
.query(z.object({ search: z.string().optional() }))
|
|
51
52
|
.handler(({ query }) => ({ results: search(query.search) }))
|
|
52
53
|
.build()
|
|
@@ -1,24 +1,34 @@
|
|
|
1
|
-
import "./chunk-
|
|
2
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-SL7YUHPV.js";
|
|
2
|
+
import "./chunk-WOBSEO75.js";
|
|
3
|
+
import "./chunk-RWNYIU6A.js";
|
|
3
4
|
import "./chunk-47FFT43U.js";
|
|
4
5
|
import "./chunk-NTDN54XO.js";
|
|
5
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-MCTC6HSE.js";
|
|
7
|
+
import "./chunk-72DMJBXI.js";
|
|
6
8
|
import "./chunk-VSLTKX5L.js";
|
|
7
9
|
import "./chunk-TNI4MARH.js";
|
|
8
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-OQCRCXCP.js";
|
|
9
11
|
import {
|
|
10
12
|
scanServerActionsEnriched
|
|
11
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-6J4JWHDJ.js";
|
|
12
14
|
import "./chunk-DV34VG3N.js";
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
15
|
+
import "./chunk-L4VFNFDL.js";
|
|
16
|
+
import "./chunk-BX6EUYHU.js";
|
|
17
|
+
import "./chunk-BPYMC7SU.js";
|
|
18
|
+
import "./chunk-IRQGAC4L.js";
|
|
19
|
+
import "./chunk-P6OS7652.js";
|
|
16
20
|
import "./chunk-AVQU5CQF.js";
|
|
17
21
|
import "./chunk-ACKBVBUI.js";
|
|
18
22
|
import "./chunk-IZ3TIL6K.js";
|
|
19
|
-
import "./chunk-
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
23
|
+
import "./chunk-3PBAN2YE.js";
|
|
24
|
+
import "./chunk-YSJOZEI6.js";
|
|
25
|
+
import "./chunk-Z4PJMZLM.js";
|
|
26
|
+
import "./chunk-UMNXCU3K.js";
|
|
27
|
+
import "./chunk-52PDWL5S.js";
|
|
28
|
+
import "./chunk-5K4TDLRG.js";
|
|
29
|
+
import "./chunk-ZWN3AODA.js";
|
|
30
|
+
import "./chunk-D4VP2QPR.js";
|
|
31
|
+
import "./chunk-YN4W7LCX.js";
|
|
22
32
|
import "./chunk-XTHN6JBX.js";
|
|
23
33
|
|
|
24
34
|
// src/vite-plugin/actions-virtual-module.ts
|
|
@@ -222,4 +232,4 @@ export const actions = manifest
|
|
|
222
232
|
export {
|
|
223
233
|
actionsVirtualModule
|
|
224
234
|
};
|
|
225
|
-
//# sourceMappingURL=actions-virtual-module-
|
|
235
|
+
//# sourceMappingURL=actions-virtual-module-5WBVSDOM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/vite-plugin/actions-virtual-module.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBA,SAAS,YAAY,WAAW,YAAY,SAAS,SAAS,qBAAqB;AACnF,SAAS,SAAS,MAAM,OAAO,eAAe;AAM9C,IAAM,aAAa;AACnB,IAAM,cAAc,KAAK,UAAU;AAc5B,SAAS,qBAAqB,MAA2C;AAC9E,QAAM,EAAE,WAAW,QAAQ,IAAI;AAE/B,WAAS,iBAAuB;AAC9B,QAAI,YAAY,OAAW;AAC3B,UAAM,UAAU,SAAS,SAAS;AAClC,UAAM,UAAU,MAAM,KAAK,QAAQ,OAAO,EAAE,QAAQ,OAAO,GAAG,GAAG,cAAc;AAC/E,UAAM,UAAU,mBAAmB,OAAO;AAC1C,QAAI;AAEF,gBAAU,QAAQ,OAAO,GAAG,EAAE,WAAW,KAAK,CAAC;AAC/C,YAAM,MAAM,GAAG,OAAO,IAAI,QAAQ,GAAG;AAErC,oBAAc,KAAK,OAAO;AAE1B,iBAAW,KAAK,OAAO;AAAA,IACzB,SAAS,KAAK;AACZ,cAAQ,MAAM,oDAAoD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AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0FhB;AAOA,SAAS,uBAAuB,SAAwC;AACtE,SAAO;AAAA;AAAA,0BAEiB,KAAK,UAAU,SAAS,MAAM,CAAC,CAAC;AAAA;AAAA;AAG1D;","names":[]}
|
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import "tsx/esm";
|
|
3
|
-
import "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
3
|
+
import "./chunk-C62IZEJI.js";
|
|
4
|
+
import "./chunk-5YPXXSYY.js";
|
|
5
|
+
import "./chunk-HWBRS4DZ.js";
|
|
6
|
+
import "./chunk-RPET332G.js";
|
|
7
|
+
import "./chunk-7PM6K5EV.js";
|
|
8
|
+
import "./chunk-2AMLGJJA.js";
|
|
9
|
+
import "./chunk-KUZVRJ7M.js";
|
|
10
|
+
import "./chunk-EVZKNA2W.js";
|
|
8
11
|
import {
|
|
9
12
|
scanServerActionsEnriched
|
|
10
|
-
} from "./chunk-
|
|
11
|
-
import "./chunk-
|
|
13
|
+
} from "./chunk-XS7EX55U.js";
|
|
14
|
+
import "./chunk-FD4ZDTQ6.js";
|
|
15
|
+
import "./chunk-U5PWXS3J.js";
|
|
16
|
+
import "./chunk-VI7ZANB3.js";
|
|
12
17
|
import "./chunk-VQIUTCK2.js";
|
|
13
18
|
|
|
14
19
|
// src/vite-plugin/actions-virtual-module.ts
|
|
@@ -212,4 +217,4 @@ export const actions = manifest
|
|
|
212
217
|
export {
|
|
213
218
|
actionsVirtualModule
|
|
214
219
|
};
|
|
215
|
-
//# sourceMappingURL=actions-virtual-module-
|
|
220
|
+
//# sourceMappingURL=actions-virtual-module-ZYLMNW6K.js.map
|
package/dist/{actions-virtual-module-LB4NGONI.js.map → actions-virtual-module-ZYLMNW6K.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/vite-plugin/actions-virtual-module.ts"],"sourcesContent":["/**\n * Vite plugin: resolves `@theo/actions` virtual module and emits a typed\n * Proxy facade that calls `theoFetch('/_actions/<name>', body)` against the\n * server-side action handlers.\n *\n * Per plan g3-server-actions-and-useaction v1.2 § Phase 3 / T3.1 + ADR D4.\n * Astro `vite-plugin-actions.ts` modular pattern. Single focused plugin\n * (not monolithic), virtual module + `configureServer` watcher.\n *\n * Module shape emitted on client environment: thin proxy that forwards\n * `actions.<name>(input)` to `POST /_actions/<name>` with JSON or\n * FormData body. On server environment: re-export of the manifest for\n * SSR / module-loader access (T1.3 sub-C consumer).\n *\n * EC-15 (DOCUMENT): HMR uses Vite default invalidation — coarse but\n * correct. Optimization (fine-grained invalidation of only consumers of\n * `@theo/actions`) deferred to G3.1 if dev-server p95 reload > 500ms.\n */\nimport { existsSync, mkdirSync, renameSync, watch as fsWatch, writeFileSync } from 'node:fs'\nimport { dirname, join, posix, resolve } from 'node:path'\n\nimport type { Plugin, ViteDevServer } from 'vite'\n\nimport { scanServerActionsEnriched, type ActionManifestEntry } from '../server/internal-api.js'\n\nconst VIRTUAL_ID = '@theo/actions'\nconst RESOLVED_ID = `\\0${VIRTUAL_ID}`\n\ninterface ActionsVirtualModuleOptions {\n /** Path to server directory (where `actions/` lives). */\n serverDir: string\n /**\n * Optional `.theokit/` output dir for emitting `actions.d.ts`. When provided,\n * the plugin writes an ambient `declare module '@theo/actions'` so TS in\n * consumer apps can resolve the virtual module import. Mirrors the G1\n * `app-typed-client` emit pattern.\n */\n distDir?: string\n}\n\nexport function actionsVirtualModule(opts: ActionsVirtualModuleOptions): Plugin {\n const { serverDir, distDir } = opts\n\n function emitActionsDts(): void {\n if (distDir === undefined) return\n const entries = safeScan(serverDir)\n const dtsPath = posix.join(resolve(distDir).replace(/\\\\/g, '/'), 'actions.d.ts')\n const content = generateActionsDts(entries)\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename -- build-time derived path\n mkdirSync(dirname(dtsPath), { recursive: true })\n const tmp = `${dtsPath}.${process.pid}.tmp`\n // eslint-disable-next-line security/detect-non-literal-fs-filename -- build-time derived path\n writeFileSync(tmp, content)\n // eslint-disable-next-line security/detect-non-literal-fs-filename -- build-time derived path\n renameSync(tmp, dtsPath)\n } catch (err) {\n console.error('[theokit:actions-virtual-module] dts emit error:', err)\n }\n }\n\n return {\n name: 'theo:actions-virtual-module',\n enforce: 'pre',\n configResolved() {\n emitActionsDts()\n },\n buildEnd() {\n emitActionsDts()\n },\n resolveId(id: string) {\n if (id === VIRTUAL_ID) return RESOLVED_ID\n return undefined\n },\n load(id: string) {\n if (id !== RESOLVED_ID) return undefined\n const entries = safeScan(serverDir)\n const ctx = this as unknown as { environment?: { name?: string } } | undefined\n const envName = ctx?.environment?.name\n const isClient = envName === 'client' || envName === undefined\n return isClient ? generateClientFacade(entries) : generateServerManifest(entries)\n },\n configureServer(server: ViteDevServer) {\n const actionsDir = join(serverDir, 'actions')\n // eslint-disable-next-line security/detect-non-literal-fs-filename -- build-time derived path\n if (!existsSync(actionsDir)) return\n // EC-15: coarse invalidation — invalidate ALL modules on actions file change.\n // Optimization deferred per plan ADR D4 note.\n // eslint-disable-next-line security/detect-non-literal-fs-filename -- build-time path\n const watcher = fsWatch(actionsDir, { recursive: true }, () => {\n emitActionsDts()\n const mod = server.moduleGraph.getModuleById(RESOLVED_ID)\n if (mod) {\n server.moduleGraph.invalidateModule(mod)\n }\n server.ws.send({ type: 'full-reload' })\n })\n server.httpServer?.once('close', () => {\n watcher.close()\n })\n },\n }\n}\n\n/**\n * Emit `.theokit/actions.d.ts` — ambient declaration of `@theo/actions` so\n * consumer TS apps can `import { actions } from '@theo/actions'` and get\n * typed completions for each scanned action name. Each entry maps name to\n * a generic `(input: unknown) => Promise<{data, error}>` invoker — the full\n * input/output inference from defineAction would require either monomorphic\n * dts-bundle or virtual type emit (deferred to a future plan).\n */\nfunction generateActionsDts(entries: readonly ActionManifestEntry[]): string {\n const lines = entries\n .map((entry) => {\n const invokerType = `(input: unknown) => Promise<{ data: unknown; error: undefined } | { data: undefined; error: { code: string; message: string; fields?: Record<string, string[]>; type?: string } }>`\n // P#4 plugin-forms typed __zodSchema (per plan p4-plugin-forms v1.1 EC-3).\n // When schemaFilePath present, emit intersection type so consumers see both\n // the callable invoker AND the __zodSchema field with the exact schema type.\n if (entry.schemaFilePath !== undefined) {\n const schemaImportPath = entry.schemaFilePath\n .replace(/\\\\/g, '/')\n .replace(/\\.(ts|tsx|js|jsx)$/, '.js')\n return ` ${JSON.stringify(entry.name)}: (${invokerType}) & { readonly __zodSchema: typeof import(${JSON.stringify(schemaImportPath)}).schema }`\n }\n return ` ${JSON.stringify(entry.name)}: ${invokerType}`\n })\n .join('\\n')\n return `// AUTO-GENERATED by @theo/actions virtual module. DO NOT EDIT MANUALLY.\ndeclare module '@theo/actions' {\n export const actions: {\n${lines}\n }\n}\n`\n}\n\nfunction safeScan(serverDir: string): ActionManifestEntry[] {\n try {\n return scanServerActionsEnriched(serverDir)\n } catch {\n // ActionScanError surfaces at build time; for HMR keep an empty manifest\n // so the dev server doesn't crash mid-edit.\n return []\n }\n}\n\n/**\n * Client-side module: emits a Proxy facade. For each action `name` in\n * manifest, `actions.<name>(input)` POSTs to `/_actions/<name>` with JSON\n * body (or FormData when input is a FormData instance) and parses the\n * `application/json+devalue` response via the runtime helper.\n */\nfunction generateClientFacade(entries: ActionManifestEntry[]): string {\n const entryLines = entries\n .map((entry) => ` ${JSON.stringify(entry.name)}: ${JSON.stringify(entry.urlPath)},`)\n .join('\\n')\n\n // P#4 plugin-forms shared-schema convention (per plan p4-plugin-forms v1.1 T1.1).\n // Emit ESM imports + ACTION_SCHEMA_MAP so the Proxy can attach __zodSchema.\n // Vite resolves absolute filesystem paths via its module graph; schema files\n // are isomorphic (zod-only, no server APIs) so they bundle into the client.\n const schemaEntries = entries.filter((e) => e.schemaFilePath !== undefined)\n const schemaImports = schemaEntries\n .map((entry, idx) => {\n // schemaEntries was filtered by `e.schemaFilePath !== undefined` above,\n // so the assertion is provably safe in this scope.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const importPath = entry.schemaFilePath!.replace(/\\\\/g, '/')\n return `import { schema as __theoSchema${idx} } from ${JSON.stringify(importPath)}`\n })\n .join('\\n')\n const schemaMapLines = schemaEntries\n .map((entry, idx) => ` ${JSON.stringify(entry.name)}: __theoSchema${idx},`)\n .join('\\n')\n\n return `// AUTO-GENERATED by @theo/actions virtual module\n/* eslint-disable */\n${schemaImports}\n\nconst ACTION_URL_MAP = {\n${entryLines}\n}\n\nconst ACTION_SCHEMA_MAP = {\n${schemaMapLines}\n}\n\n// Devtools telemetry — fires in the SAME realm as the Overlay React tree\n// (browser), so the Actions tab updates immediately on each call.\n// The Overlay component installs \\`window.__theoDevtoolsDispatcher\\` on\n// mount (dev only; prod tree-shakes the Overlay entirely). Reading the\n// global avoids a cross-package dynamic import that Vite's virtual-module\n// resolver cannot trace. Same pattern as React DevTools'\n// \\`__REACT_DEVTOOLS_GLOBAL_HOOK__\\`.\nfunction emitTelemetry(name, startedAt, input, outcome) {\n if (typeof window === 'undefined') return\n const dispatcher = window.__theoDevtoolsDispatcher\n if (!dispatcher || typeof dispatcher.onActionCall !== 'function') return\n try {\n dispatcher.onActionCall({\n id: 'act-' + String(Date.now()) + '-' + Math.random().toString(36).slice(2, 8),\n timestamp: startedAt,\n name,\n input,\n output: outcome.status === 'success' ? outcome.data : undefined,\n error: outcome.status === 'error' ? outcome.error : undefined,\n durationMs: Date.now() - startedAt,\n status: outcome.status,\n })\n } catch (_) {\n // dispatcher threw — devtools UI bug; never bubble to consumer code\n }\n}\n\nasync function callAction(name, url, input) {\n const startedAt = Date.now()\n const isForm = typeof FormData !== 'undefined' && input instanceof FormData\n const headers = { 'x-theo-action': '1' }\n const body = isForm ? input : JSON.stringify(input ?? {})\n if (!isForm) headers['content-type'] = 'application/json'\n let response\n try {\n response = await fetch(url, { method: 'POST', headers, body, credentials: 'same-origin' })\n } catch (e) {\n const err = { code: 'NETWORK_ERROR', message: e && e.message ? e.message : 'fetch failed' }\n emitTelemetry(name, startedAt, input, { status: 'error', error: err })\n return { data: undefined, error: err }\n }\n const contentType = response.headers.get('content-type') ?? ''\n let result\n if (response.status === 204) {\n result = { data: undefined, error: undefined }\n } else if (contentType.startsWith('application/json+devalue')) {\n const text = await response.text()\n const { parse } = await import('devalue')\n result = { data: parse(text, { URL: (h) => new URL(h) }), error: undefined }\n } else if (contentType.startsWith('application/json')) {\n const json = await response.json()\n result = response.ok ? { data: json, error: undefined } : { data: undefined, error: json }\n } else {\n result = { data: undefined, error: { code: 'INTERNAL_SERVER_ERROR', message: await response.text() } }\n }\n emitTelemetry(name, startedAt, input, result.error\n ? { status: 'error', error: result.error }\n : { status: 'success', data: result.data })\n return result\n}\n\n// P#4 plugin-forms cache: callable proxies must be stable per action so that\n// repeated property access does not allocate + reset the __zodSchema attach.\nconst ACTION_CALLABLE_CACHE = {}\n\nexport const actions = new Proxy({}, {\n get(target, prop) {\n if (typeof prop !== 'string') return undefined\n const url = ACTION_URL_MAP[prop]\n if (!url) return undefined\n if (!ACTION_CALLABLE_CACHE[prop]) {\n const callable = (input) => callAction(prop, url, input)\n const schema = ACTION_SCHEMA_MAP[prop]\n if (schema !== undefined) {\n Object.defineProperty(callable, '__zodSchema', {\n value: schema,\n enumerable: false,\n writable: false,\n configurable: false,\n })\n }\n ACTION_CALLABLE_CACHE[prop] = callable\n }\n return ACTION_CALLABLE_CACHE[prop]\n },\n})\n`\n}\n\n/**\n * Server-side module: re-exports the manifest entries for SSR / module-\n * loader consumption (T1.3 sub-C in action-execute.ts will route requests\n * via this manifest).\n */\nfunction generateServerManifest(entries: ActionManifestEntry[]): string {\n return `// AUTO-GENERATED by @theo/actions virtual module (server env)\n/* eslint-disable */\nexport const manifest = ${JSON.stringify(entries, null, 2)}\nexport const actions = manifest\n`\n}\n"],"mappings":";;;;;;;;;;;;;;AAkBA,SAAS,YAAY,WAAW,YAAY,SAAS,SAAS,qBAAqB;AACnF,SAAS,SAAS,MAAM,OAAO,eAAe;AAM9C,IAAM,aAAa;AACnB,IAAM,cAAc,KAAK,UAAU;AAc5B,SAAS,qBAAqB,MAA2C;AAC9E,QAAM,EAAE,WAAW,QAAQ,IAAI;AAE/B,WAAS,iBAAuB;AAC9B,QAAI,YAAY,OAAW;AAC3B,UAAM,UAAU,SAAS,SAAS;AAClC,UAAM,UAAU,MAAM,KAAK,QAAQ,OAAO,EAAE,QAAQ,OAAO,GAAG,GAAG,cAAc;AAC/E,UAAM,UAAU,mBAAmB,OAAO;AAC1C,QAAI;AAEF,gBAAU,QAAQ,OAAO,GAAG,EAAE,WAAW,KAAK,CAAC;AAC/C,YAAM,MAAM,GAAG,OAAO,IAAI,QAAQ,GAAG;AAErC,oBAAc,KAAK,OAAO;AAE1B,iBAAW,KAAK,OAAO;AAAA,IACzB,SAAS,KAAK;AACZ,cAAQ,MAAM,oDAAoD,GAAG;AAAA,IACvE;AAAA,EACF;AAEA,SAAO;AAAA,IACL,MAAM;AAAA,IACN,SAAS;AAAA,IACT,iBAAiB;AACf,qBAAe;AAAA,IACjB;AAAA,IACA,WAAW;AACT,qBAAe;AAAA,IACjB;AAAA,IACA,UAAU,IAAY;AACpB,UAAI,OAAO,WAAY,QAAO;AAC9B,aAAO;AAAA,IACT;AAAA,IACA,KAAK,IAAY;AACf,UAAI,OAAO,YAAa,QAAO;AAC/B,YAAM,UAAU,SAAS,SAAS;AAClC,YAAM,MAAM;AACZ,YAAM,UAAU,KAAK,aAAa;AAClC,YAAM,WAAW,YAAY,YAAY,YAAY;AACrD,aAAO,WAAW,qBAAqB,OAAO,IAAI,uBAAuB,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theo/actions` virtual module and emits a typed\n * Proxy facade that calls `theoFetch('/_actions/<name>', body)` against the\n * server-side action handlers.\n *\n * Per plan g3-server-actions-and-useaction v1.2 § Phase 3 / T3.1 + ADR D4.\n * Astro `vite-plugin-actions.ts` modular pattern. Single focused plugin\n * (not monolithic), virtual module + `configureServer` watcher.\n *\n * Module shape emitted on client environment: thin proxy that forwards\n * `actions.<name>(input)` to `POST /_actions/<name>` with JSON or\n * FormData body. On server environment: re-export of the manifest for\n * SSR / module-loader access (T1.3 sub-C consumer).\n *\n * EC-15 (DOCUMENT): HMR uses Vite default invalidation — coarse but\n * correct. Optimization (fine-grained invalidation of only consumers of\n * `@theo/actions`) deferred to G3.1 if dev-server p95 reload > 500ms.\n */\nimport { existsSync, mkdirSync, renameSync, watch as fsWatch, writeFileSync } from 'node:fs'\nimport { dirname, join, posix, resolve } from 'node:path'\n\nimport type { Plugin, ViteDevServer } from 'vite'\n\nimport { scanServerActionsEnriched, type ActionManifestEntry } from '../server/internal-api.js'\n\nconst VIRTUAL_ID = '@theo/actions'\nconst RESOLVED_ID = `\\0${VIRTUAL_ID}`\n\ninterface ActionsVirtualModuleOptions {\n /** Path to server directory (where `actions/` lives). */\n serverDir: string\n /**\n * Optional `.theokit/` output dir for emitting `actions.d.ts`. When provided,\n * the plugin writes an ambient `declare module '@theo/actions'` so TS in\n * consumer apps can resolve the virtual module import. Mirrors the G1\n * `app-typed-client` emit pattern.\n */\n distDir?: string\n}\n\nexport function actionsVirtualModule(opts: ActionsVirtualModuleOptions): Plugin {\n const { serverDir, distDir } = opts\n\n function emitActionsDts(): void {\n if (distDir === undefined) return\n const entries = safeScan(serverDir)\n const dtsPath = posix.join(resolve(distDir).replace(/\\\\/g, '/'), 'actions.d.ts')\n const content = generateActionsDts(entries)\n try {\n // eslint-disable-next-line security/detect-non-literal-fs-filename -- build-time derived path\n mkdirSync(dirname(dtsPath), { recursive: true })\n const tmp = `${dtsPath}.${process.pid}.tmp`\n // eslint-disable-next-line security/detect-non-literal-fs-filename -- build-time derived path\n writeFileSync(tmp, content)\n // eslint-disable-next-line security/detect-non-literal-fs-filename -- build-time derived path\n renameSync(tmp, dtsPath)\n } catch (err) {\n console.error('[theokit:actions-virtual-module] dts emit error:', err)\n }\n }\n\n return {\n name: 'theo:actions-virtual-module',\n enforce: 'pre',\n configResolved() {\n emitActionsDts()\n },\n buildEnd() {\n emitActionsDts()\n },\n resolveId(id: string) {\n if (id === VIRTUAL_ID) return RESOLVED_ID\n return undefined\n },\n load(id: string) {\n if (id !== RESOLVED_ID) return undefined\n const entries = safeScan(serverDir)\n const ctx = this as unknown as { environment?: { name?: string } } | undefined\n const envName = ctx?.environment?.name\n const isClient = envName === 'client' || envName === undefined\n return isClient ? generateClientFacade(entries) : generateServerManifest(entries)\n },\n configureServer(server: ViteDevServer) {\n const actionsDir = join(serverDir, 'actions')\n // eslint-disable-next-line security/detect-non-literal-fs-filename -- build-time derived path\n if (!existsSync(actionsDir)) return\n // EC-15: coarse invalidation — invalidate ALL modules on actions file change.\n // Optimization deferred per plan ADR D4 note.\n // eslint-disable-next-line security/detect-non-literal-fs-filename -- build-time path\n const watcher = fsWatch(actionsDir, { recursive: true }, () => {\n emitActionsDts()\n const mod = server.moduleGraph.getModuleById(RESOLVED_ID)\n if (mod) {\n server.moduleGraph.invalidateModule(mod)\n }\n server.ws.send({ type: 'full-reload' })\n })\n server.httpServer?.once('close', () => {\n watcher.close()\n })\n },\n }\n}\n\n/**\n * Emit `.theokit/actions.d.ts` — ambient declaration of `@theo/actions` so\n * consumer TS apps can `import { actions } from '@theo/actions'` and get\n * typed completions for each scanned action name. Each entry maps name to\n * a generic `(input: unknown) => Promise<{data, error}>` invoker — the full\n * input/output inference from defineAction would require either monomorphic\n * dts-bundle or virtual type emit (deferred to a future plan).\n */\nfunction generateActionsDts(entries: readonly ActionManifestEntry[]): string {\n const lines = entries\n .map((entry) => {\n const invokerType = `(input: unknown) => Promise<{ data: unknown; error: undefined } | { data: undefined; error: { code: string; message: string; fields?: Record<string, string[]>; type?: string } }>`\n // P#4 plugin-forms typed __zodSchema (per plan p4-plugin-forms v1.1 EC-3).\n // When schemaFilePath present, emit intersection type so consumers see both\n // the callable invoker AND the __zodSchema field with the exact schema type.\n if (entry.schemaFilePath !== undefined) {\n const schemaImportPath = entry.schemaFilePath\n .replace(/\\\\/g, '/')\n .replace(/\\.(ts|tsx|js|jsx)$/, '.js')\n return ` ${JSON.stringify(entry.name)}: (${invokerType}) & { readonly __zodSchema: typeof import(${JSON.stringify(schemaImportPath)}).schema }`\n }\n return ` ${JSON.stringify(entry.name)}: ${invokerType}`\n })\n .join('\\n')\n return `// AUTO-GENERATED by @theo/actions virtual module. DO NOT EDIT MANUALLY.\ndeclare module '@theo/actions' {\n export const actions: {\n${lines}\n }\n}\n`\n}\n\nfunction safeScan(serverDir: string): ActionManifestEntry[] {\n try {\n return scanServerActionsEnriched(serverDir)\n } catch {\n // ActionScanError surfaces at build time; for HMR keep an empty manifest\n // so the dev server doesn't crash mid-edit.\n return []\n }\n}\n\n/**\n * Client-side module: emits a Proxy facade. For each action `name` in\n * manifest, `actions.<name>(input)` POSTs to `/_actions/<name>` with JSON\n * body (or FormData when input is a FormData instance) and parses the\n * `application/json+devalue` response via the runtime helper.\n */\nfunction generateClientFacade(entries: ActionManifestEntry[]): string {\n const entryLines = entries\n .map((entry) => ` ${JSON.stringify(entry.name)}: ${JSON.stringify(entry.urlPath)},`)\n .join('\\n')\n\n // P#4 plugin-forms shared-schema convention (per plan p4-plugin-forms v1.1 T1.1).\n // Emit ESM imports + ACTION_SCHEMA_MAP so the Proxy can attach __zodSchema.\n // Vite resolves absolute filesystem paths via its module graph; schema files\n // are isomorphic (zod-only, no server APIs) so they bundle into the client.\n const schemaEntries = entries.filter((e) => e.schemaFilePath !== undefined)\n const schemaImports = schemaEntries\n .map((entry, idx) => {\n // schemaEntries was filtered by `e.schemaFilePath !== undefined` above,\n // so the assertion is provably safe in this scope.\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n const importPath = entry.schemaFilePath!.replace(/\\\\/g, '/')\n return `import { schema as __theoSchema${idx} } from ${JSON.stringify(importPath)}`\n })\n .join('\\n')\n const schemaMapLines = schemaEntries\n .map((entry, idx) => ` ${JSON.stringify(entry.name)}: __theoSchema${idx},`)\n .join('\\n')\n\n return `// AUTO-GENERATED by @theo/actions virtual module\n/* eslint-disable */\n${schemaImports}\n\nconst ACTION_URL_MAP = {\n${entryLines}\n}\n\nconst ACTION_SCHEMA_MAP = {\n${schemaMapLines}\n}\n\n// Devtools telemetry — fires in the SAME realm as the Overlay React tree\n// (browser), so the Actions tab updates immediately on each call.\n// The Overlay component installs \\`window.__theoDevtoolsDispatcher\\` on\n// mount (dev only; prod tree-shakes the Overlay entirely). Reading the\n// global avoids a cross-package dynamic import that Vite's virtual-module\n// resolver cannot trace. Same pattern as React DevTools'\n// \\`__REACT_DEVTOOLS_GLOBAL_HOOK__\\`.\nfunction emitTelemetry(name, startedAt, input, outcome) {\n if (typeof window === 'undefined') return\n const dispatcher = window.__theoDevtoolsDispatcher\n if (!dispatcher || typeof dispatcher.onActionCall !== 'function') return\n try {\n dispatcher.onActionCall({\n id: 'act-' + String(Date.now()) + '-' + Math.random().toString(36).slice(2, 8),\n timestamp: startedAt,\n name,\n input,\n output: outcome.status === 'success' ? outcome.data : undefined,\n error: outcome.status === 'error' ? outcome.error : undefined,\n durationMs: Date.now() - startedAt,\n status: outcome.status,\n })\n } catch (_) {\n // dispatcher threw — devtools UI bug; never bubble to consumer code\n }\n}\n\nasync function callAction(name, url, input) {\n const startedAt = Date.now()\n const isForm = typeof FormData !== 'undefined' && input instanceof FormData\n const headers = { 'x-theo-action': '1' }\n const body = isForm ? input : JSON.stringify(input ?? {})\n if (!isForm) headers['content-type'] = 'application/json'\n let response\n try {\n response = await fetch(url, { method: 'POST', headers, body, credentials: 'same-origin' })\n } catch (e) {\n const err = { code: 'NETWORK_ERROR', message: e && e.message ? e.message : 'fetch failed' }\n emitTelemetry(name, startedAt, input, { status: 'error', error: err })\n return { data: undefined, error: err }\n }\n const contentType = response.headers.get('content-type') ?? ''\n let result\n if (response.status === 204) {\n result = { data: undefined, error: undefined }\n } else if (contentType.startsWith('application/json+devalue')) {\n const text = await response.text()\n const { parse } = await import('devalue')\n result = { data: parse(text, { URL: (h) => new URL(h) }), error: undefined }\n } else if (contentType.startsWith('application/json')) {\n const json = await response.json()\n result = response.ok ? { data: json, error: undefined } : { data: undefined, error: json }\n } else {\n result = { data: undefined, error: { code: 'INTERNAL_SERVER_ERROR', message: await response.text() } }\n }\n emitTelemetry(name, startedAt, input, result.error\n ? { status: 'error', error: result.error }\n : { status: 'success', data: result.data })\n return result\n}\n\n// P#4 plugin-forms cache: callable proxies must be stable per action so that\n// repeated property access does not allocate + reset the __zodSchema attach.\nconst ACTION_CALLABLE_CACHE = {}\n\nexport const actions = new Proxy({}, {\n get(target, prop) {\n if (typeof prop !== 'string') return undefined\n const url = ACTION_URL_MAP[prop]\n if (!url) return undefined\n if (!ACTION_CALLABLE_CACHE[prop]) {\n const callable = (input) => callAction(prop, url, input)\n const schema = ACTION_SCHEMA_MAP[prop]\n if (schema !== undefined) {\n Object.defineProperty(callable, '__zodSchema', {\n value: schema,\n enumerable: false,\n writable: false,\n configurable: false,\n })\n }\n ACTION_CALLABLE_CACHE[prop] = callable\n }\n return ACTION_CALLABLE_CACHE[prop]\n },\n})\n`\n}\n\n/**\n * Server-side module: re-exports the manifest entries for SSR / module-\n * loader consumption (T1.3 sub-C in action-execute.ts will route requests\n * via this manifest).\n */\nfunction generateServerManifest(entries: ActionManifestEntry[]): string {\n return `// AUTO-GENERATED by @theo/actions virtual module (server env)\n/* eslint-disable */\nexport const manifest = ${JSON.stringify(entries, null, 2)}\nexport const actions = manifest\n`\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAkBA,SAAS,YAAY,WAAW,YAAY,SAAS,SAAS,qBAAqB;AACnF,SAAS,SAAS,MAAM,OAAO,eAAe;AAM9C,IAAM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iBAAiB,cACpB,IAAI,CAAC,OAAO,QAAQ,KAAK,KAAK,UAAU,MAAM,IAAI,CAAC,iBAAiB,GAAG,GAAG,EAC1E,KAAK,IAAI;AAEZ,SAAO;AAAA;AAAA,EAEP,aAAa;AAAA;AAAA;AAAA,EAGb,UAAU;AAAA;AAAA;AAAA;AAAA,EAIV,cAAc;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0FhB;AAOA,SAAS,uBAAuB,SAAwC;AACtE,SAAO;AAAA;AAAA,0BAEiB,KAAK,UAAU,SAAS,MAAM,CAAC,CAAC;AAAA;AAAA;AAG1D;","names":[]}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { a as RouteSubject, R as RoutePolicy } from '../route-policy-BxOycCDq.js';
|
|
2
|
+
import { C as CsrfMode } from '../csrf-Dgot9qSM.js';
|
|
3
|
+
export { r as resolveProvider } from '../provider-resolver-Dx6QuWrw.js';
|
|
4
|
+
export { s as scanAgents } from '../agent-scan-BZa-pagG.js';
|
|
5
|
+
import 'node:http';
|
|
6
|
+
import '../audit-log-BQWM5YLG.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* ADR 0001, applied to the agent surface (usetheokit/theokit#365).
|
|
10
|
+
*
|
|
11
|
+
* `RouteConfig.policy` gave routes one access decision evaluated by both HTTP executors and
|
|
12
|
+
* `callProcedure`. The agent endpoints are dispatched BEFORE route matching
|
|
13
|
+
* (`request-handler.ts` runs `tryServeAgentAux` and `tryServeAgent` ahead of `tryServeApiRoute`),
|
|
14
|
+
* so no `route()`, no `server/middleware/` and no `server/context.ts` ever observed those URLs.
|
|
15
|
+
* The policy existed and did not reach them.
|
|
16
|
+
*
|
|
17
|
+
* ## Why the policy is declared on the agent module and not passed by the caller
|
|
18
|
+
*
|
|
19
|
+
* `mountAgent` already accepted `policy` and `subject` as options. Every production caller invoked
|
|
20
|
+
* it without either, so the evaluator saw `undefined` and admitted everyone — a gate that works
|
|
21
|
+
* perfectly and is never reached. An option nobody passes is not a seam; it is a comment with a
|
|
22
|
+
* type. So the declaration travels WITH the agent:
|
|
23
|
+
*
|
|
24
|
+
* ```ts
|
|
25
|
+
* // agents/support.ts
|
|
26
|
+
* import { requireOwner } from 'theokit/server/define'
|
|
27
|
+
*
|
|
28
|
+
* export const policy = ({ subject, params }) => requireOwner(subject, ownerOf(params.sessionId))
|
|
29
|
+
* export default defineAgent({ ... })
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* One declaration covers every endpoint the agent exposes — the run, the thread routes, the
|
|
33
|
+
* approval surface and MCP — because they all reach the same conversation and the same paused
|
|
34
|
+
* tools. `params.endpoint` says which one is being asked for, so a policy that wants to answer
|
|
35
|
+
* them differently can.
|
|
36
|
+
*
|
|
37
|
+
* `'public'` is the other legal value, and it is a decision rather than the absence of one. It is
|
|
38
|
+
* greppable; silence was not.
|
|
39
|
+
*
|
|
40
|
+
* ## Why the refusal does not repeat the policy's reason
|
|
41
|
+
*
|
|
42
|
+
* `requireOwner` distinguishes `'resource has no recorded owner'` from `'subject does not own this
|
|
43
|
+
* resource'`. Echoed to the wire, that pair tells an unauthenticated caller whether a conversation
|
|
44
|
+
* id exists — the enumeration oracle `docs/program/journeys/j08-tenant.md` grades under criterion 2,
|
|
45
|
+
* rebuilt out of the very check added to close the leak. So the reason goes to the server log,
|
|
46
|
+
* where an operator can read it, and the wire gets one fixed sentence that names what the caller
|
|
47
|
+
* must do. The status stays `403`: the decision is taken before any lookup, so `403` is returned
|
|
48
|
+
* identically for an id that exists and one that never did, and a truthful `403` beats a `404`
|
|
49
|
+
* whose truthfulness a reader cannot check (`docs/adr/0002-*`).
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
/** Resolve the caller's identity, lazily — see `resolveAgentSubject` for why it must be lazy. */
|
|
53
|
+
type AgentSubjectResolver = () => RouteSubject | null | Promise<RouteSubject | null>;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* How a caller picks the credential for a model.
|
|
57
|
+
*
|
|
58
|
+
* It lives in its own module rather than beside either consumer because both need it and they
|
|
59
|
+
* already point at each other: `mount-agent.ts` imports `buildAgentHitl` from
|
|
60
|
+
* `build-agent-streamer.ts`, so declaring the type in `mount-agent.ts` and importing it back
|
|
61
|
+
* created a cycle the architecture guard rejected — correctly. A shared contract that two modules
|
|
62
|
+
* depend on belongs to neither of them.
|
|
63
|
+
*/
|
|
64
|
+
/**
|
|
65
|
+
* Chooses the API key for a model. Receives the model id the compiled agent declares, or
|
|
66
|
+
* `undefined` when it declares none.
|
|
67
|
+
*
|
|
68
|
+
* The resolver form exists because the credential depends on the model, and the model is only
|
|
69
|
+
* known once the agent module is compiled. Callers that resolved eagerly were choosing a provider
|
|
70
|
+
* before anyone could read which one the agent asked for — usetheokit/theokit#326 on the agent
|
|
71
|
+
* endpoint, #328 on the thread follow-up route.
|
|
72
|
+
*
|
|
73
|
+
* @public
|
|
74
|
+
*/
|
|
75
|
+
type ApiKeyResolver = (modelId: string | undefined) => string;
|
|
76
|
+
|
|
77
|
+
/** Non-runtime options for {@link mountAgent} (grouped so the call stays ≤ 5 params). */
|
|
78
|
+
interface MountAgentOptions {
|
|
79
|
+
/** Labels a fail-fast `AgentDefinitionError` (the agent file path). Default `'agent module'`. */
|
|
80
|
+
source?: string;
|
|
81
|
+
/** CSRF posture at this boundary. Default `'strict'`; `'off'` when a controller already gated (G5). */
|
|
82
|
+
csrfMode?: CsrfMode;
|
|
83
|
+
/**
|
|
84
|
+
* theokit-file-based-config (EC-1) — the framework-resolved app root. When the agent opted into
|
|
85
|
+
* `.theokit/` file-based config (`.settingSources([...])`), discovery points here, NOT `process.cwd()`.
|
|
86
|
+
*/
|
|
87
|
+
projectRoot?: string;
|
|
88
|
+
/**
|
|
89
|
+
* The agent's name, as the scanner discovered it. Reported to the policy under
|
|
90
|
+
* `params.agent` and named in a refusal. Defaults to {@link MountAgentOptions.source}.
|
|
91
|
+
*/
|
|
92
|
+
agentName?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Who may run this agent, and against which conversation (ADR 0001,
|
|
95
|
+
* usetheokit/theokit#365).
|
|
96
|
+
*
|
|
97
|
+
* NORMALLY ABSENT, and that is the fix rather than an omission: the policy is read from the
|
|
98
|
+
* agent module's own `export const policy`, so it travels with the agent instead of depending
|
|
99
|
+
* on every caller remembering to pass it. This option exists for a host that resolved the
|
|
100
|
+
* decision itself (an `@Expose`-bound controller, an embedder), and it OVERRIDES the module's
|
|
101
|
+
* declaration when given.
|
|
102
|
+
*
|
|
103
|
+
* Evaluated against the parsed request body, so a policy can ask who owns the
|
|
104
|
+
* conversation being resumed. Absent on both ends ⇒ not evaluated, matching the route
|
|
105
|
+
* executors: absence means "not declared" and is not reinterpreted as denial. Absence is
|
|
106
|
+
* refused at scan time instead, where the file that omitted it can be named.
|
|
107
|
+
*/
|
|
108
|
+
policy?: RoutePolicy;
|
|
109
|
+
/**
|
|
110
|
+
* Resolve the authenticated caller. Invoked at most once, and only when a policy exists — an
|
|
111
|
+
* agent declaring `'public'` never pays for the application's `createContext`.
|
|
112
|
+
*/
|
|
113
|
+
resolveSubject?: AgentSubjectResolver;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Mount a loaded agent module as a `Response`.
|
|
117
|
+
*
|
|
118
|
+
* `apiKey` accepts either a resolved string or an {@link ApiKeyResolver}. The resolver form exists
|
|
119
|
+
* because the credential depends on the model, and the model is only known once the module is
|
|
120
|
+
* compiled — inside here. Callers that resolved eagerly were choosing a provider before anyone
|
|
121
|
+
* could read which one the agent asked for, which is theokit#326.
|
|
122
|
+
*
|
|
123
|
+
* See {@link MountAgentOptions} for the labeling / CSRF / app-root knobs.
|
|
124
|
+
*/
|
|
125
|
+
declare function mountAgent(mod: unknown, request: Request, apiKey: string | ApiKeyResolver, { source, csrfMode, projectRoot, agentName, policy, resolveSubject, }?: MountAgentOptions): Promise<Response>;
|
|
126
|
+
|
|
127
|
+
export { mountAgent };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import {
|
|
2
|
+
mountAgent
|
|
3
|
+
} from "../chunk-WOBSEO75.js";
|
|
4
|
+
import "../chunk-MCTC6HSE.js";
|
|
5
|
+
import "../chunk-72DMJBXI.js";
|
|
6
|
+
import {
|
|
7
|
+
scanAgents
|
|
8
|
+
} from "../chunk-L4VFNFDL.js";
|
|
9
|
+
import "../chunk-P6OS7652.js";
|
|
10
|
+
import "../chunk-AVQU5CQF.js";
|
|
11
|
+
import {
|
|
12
|
+
resolveProvider
|
|
13
|
+
} from "../chunk-3PBAN2YE.js";
|
|
14
|
+
import "../chunk-UMNXCU3K.js";
|
|
15
|
+
import "../chunk-5K4TDLRG.js";
|
|
16
|
+
import "../chunk-ZWN3AODA.js";
|
|
17
|
+
import "../chunk-YN4W7LCX.js";
|
|
18
|
+
import "../chunk-XTHN6JBX.js";
|
|
19
|
+
export {
|
|
20
|
+
mountAgent,
|
|
21
|
+
resolveProvider,
|
|
22
|
+
scanAgents
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=agent-mount.js.map
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
export { g as generateNonce } from '../nonce-BXt7Qu_C.js';
|
|
2
|
+
import { S as SecurityHeadersConfig } from '../security-headers-Ccj7ncNx.js';
|
|
3
|
+
export { b as buildSecurityHeaders } from '../security-headers-Ccj7ncNx.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The security headers a deployed target puts on its responses.
|
|
7
|
+
*
|
|
8
|
+
* `theokit start` applies the configured baseline to every response it writes
|
|
9
|
+
* (`cli/commands/start/request-handler.ts`). None of the six Web-standards
|
|
10
|
+
* deploy adapters applied any, so the same page carried a CSP,
|
|
11
|
+
* `X-Frame-Options`, HSTS and `nosniff` under `theokit start` and none of them
|
|
12
|
+
* once deployed (usetheokit/theokit#410, GHSA-87qq-fgcr-384x).
|
|
13
|
+
*
|
|
14
|
+
* This module is the seam that closes that half of the gap. It has two halves
|
|
15
|
+
* and they live together on purpose: the code that writes the literal into a
|
|
16
|
+
* generated entry and the code that reads it at request time have to agree on
|
|
17
|
+
* one shape, and a shape stated in two files drifts.
|
|
18
|
+
*
|
|
19
|
+
* - **Build time** — {@link renderSecurityHeadersConfigLiteral} turns
|
|
20
|
+
* `security.headers` into a JSON literal the adapter inlines. A deployed
|
|
21
|
+
* runtime has no `theo.config.ts` to read, so the configuration travels as
|
|
22
|
+
* data.
|
|
23
|
+
* - **Request time** — the generated entry calls {@link buildSecurityHeaders}
|
|
24
|
+
* on that literal and hands every response to {@link withSecurityHeaders}.
|
|
25
|
+
* The same function `theokit start` calls, on the same input, so the two
|
|
26
|
+
* cannot disagree about what the configuration means.
|
|
27
|
+
*
|
|
28
|
+
* ## The per-request nonce, and where it stops
|
|
29
|
+
*
|
|
30
|
+
* `buildSecurityHeaders` accepts a per-request `nonce` and substitutes it into
|
|
31
|
+
* `script-src`. A nonce cannot survive a build-time literal — it is minted per
|
|
32
|
+
* response — so a target reaches one only if it renders the HTML at request
|
|
33
|
+
* time and can put the same value on the script tags it emits.
|
|
34
|
+
*
|
|
35
|
+
* Exactly one deploy path does: **Cloudflare with `ssrStreaming: true`**, whose
|
|
36
|
+
* worker calls `renderStreamingWeb(request, { nonce })`, and that renderer
|
|
37
|
+
* threads the value into `renderToReadableStream` and into the hydration script
|
|
38
|
+
* (`router/entry-server.ts`). That branch mints a nonce per request and builds
|
|
39
|
+
* its CSP from it. Everything else serves HTML written at build time, or no
|
|
40
|
+
* HTML at all, and carries a **nonce-less CSP** — the same answer
|
|
41
|
+
* `buildSecurityHeaders` already gives a prerendered route (EC-4), for the same
|
|
42
|
+
* reason: a nonce in the header with no nonce on the tag blocks every inline
|
|
43
|
+
* script.
|
|
44
|
+
*
|
|
45
|
+
* That asymmetry is real and is not smoothed over. It is stated in the emitted
|
|
46
|
+
* entry, printed by the build through
|
|
47
|
+
* {@link describeDeployedSecurityHeaders}, and written down in
|
|
48
|
+
* `docs/surfaces/build-adapters.md`.
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The `security.headers` block, as a literal a generated entry can carry.
|
|
53
|
+
*
|
|
54
|
+
* `{}` when the app declares none — which is not the same as "no headers".
|
|
55
|
+
* `buildSecurityHeaders({})` returns the full default baseline, and `{}` is
|
|
56
|
+
* exactly what `theokit start` passes when `security.headers` is absent
|
|
57
|
+
* (`cli/commands/start/index.ts`). An app with no security block gets the same
|
|
58
|
+
* baseline deployed as it gets locally.
|
|
59
|
+
*/
|
|
60
|
+
declare function renderSecurityHeadersConfigLiteral(headers: SecurityHeadersConfig | undefined): string;
|
|
61
|
+
/**
|
|
62
|
+
* Put the headers on a response, without overruling the handler.
|
|
63
|
+
*
|
|
64
|
+
* `theokit start` sets the baseline BEFORE the route handler runs, so a handler
|
|
65
|
+
* can override it with `res.setHeader` (last write wins, Node convention). On a
|
|
66
|
+
* Web target the response arrives already built, so the equivalent of "the
|
|
67
|
+
* handler wins" is to skip a header the response already carries: a route that
|
|
68
|
+
* set its own `Content-Security-Policy` keeps it.
|
|
69
|
+
*
|
|
70
|
+
* Mutates and returns the same `Response` rather than constructing a
|
|
71
|
+
* replacement, because these responses are handed to the runtime while their
|
|
72
|
+
* body is still being written (#382) and re-wrapping the stream is exactly the
|
|
73
|
+
* second buffering point that change removed.
|
|
74
|
+
*
|
|
75
|
+
* Mutation is safe for every response these entries produce: the Fetch spec
|
|
76
|
+
* gives a locally constructed `Response` the `response` header guard, which
|
|
77
|
+
* permits `set` for every name used here. The `immutable` guard belongs to
|
|
78
|
+
* responses that came back from `fetch()`, and none of the six emitted handlers
|
|
79
|
+
* returns one — each builds its response from `createWebShim`, from a `new
|
|
80
|
+
* Response(...)`, or from the SSR renderer. The WebSocket upgrade, which is the
|
|
81
|
+
* one response an adapter gets from its runtime rather than building, is
|
|
82
|
+
* deliberately not routed through here.
|
|
83
|
+
*/
|
|
84
|
+
declare function withSecurityHeaders(response: Response, headers: Record<string, string>): Response;
|
|
85
|
+
interface DeployedSecurityHeaderLimits {
|
|
86
|
+
target: string;
|
|
87
|
+
/** The app's `security.headers` block, or undefined when it declares none. */
|
|
88
|
+
securityHeaders: SecurityHeadersConfig | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* Does the emitted handler render HTML at request time and mint a CSP nonce
|
|
91
|
+
* for it? True only for Cloudflare with `ssrStreaming: true`.
|
|
92
|
+
*/
|
|
93
|
+
mintsNonce: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Is the HTML document served by a platform static host rather than by the
|
|
96
|
+
* handler this build emits? True wherever the emitted handler answers
|
|
97
|
+
* `/api/*` and returns 404 for everything else.
|
|
98
|
+
*/
|
|
99
|
+
/**
|
|
100
|
+
* Who puts the security headers on the HTML DOCUMENT — a different question from who serves it,
|
|
101
|
+
* and the two used to be collapsed into one boolean (usetheokit/theokit#412).
|
|
102
|
+
*
|
|
103
|
+
* - `handler` — this target's own handler returns the document, so it carries the same baseline
|
|
104
|
+
* every API response carries. No caveat.
|
|
105
|
+
* - `platform-configured` — the platform's static host serves the document, AND this build emits
|
|
106
|
+
* the configuration that puts the headers on it (`.vercel/output/config.json`, `netlify.toml`).
|
|
107
|
+
* Still worth stating, because nothing here has seen a deployed response.
|
|
108
|
+
* - `platform-unmanaged` — the platform serves it and this build owns no artifact that could
|
|
109
|
+
* configure it. This is the real remaining gap, and it stays named.
|
|
110
|
+
*
|
|
111
|
+
* The two-value version reported `platform-configured` targets with the same message as
|
|
112
|
+
* `platform-unmanaged` ones, telling an operator to go and do work the build had already done —
|
|
113
|
+
* and a stale limitation reads exactly like a current one.
|
|
114
|
+
*/
|
|
115
|
+
documentHeaders: 'handler' | 'platform-configured' | 'platform-unmanaged';
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* What the build tells the operator, once, per target.
|
|
119
|
+
*
|
|
120
|
+
* Silent degradation is the failure mode `rules/three-target-parity.md` exists
|
|
121
|
+
* to prevent. Two things degrade quietly here and both are named rather than
|
|
122
|
+
* discovered in production: a CSP that refuses inline scripts on a deploy while
|
|
123
|
+
* allowing them locally, and an HTML document that never passes through the
|
|
124
|
+
* handler these headers are attached to.
|
|
125
|
+
*
|
|
126
|
+
* The header names are read from the map the entry will actually carry, not
|
|
127
|
+
* from a list written next to it. A configuration that switches HSTS or the CSP
|
|
128
|
+
* off would otherwise be announced as sending them.
|
|
129
|
+
*/
|
|
130
|
+
declare function describeDeployedSecurityHeaders(limits: DeployedSecurityHeaderLimits): string;
|
|
131
|
+
|
|
132
|
+
export { type DeployedSecurityHeaderLimits, describeDeployedSecurityHeaders, renderSecurityHeadersConfigLiteral, withSecurityHeaders };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildSecurityHeaders
|
|
3
|
+
} from "../chunk-IRQGAC4L.js";
|
|
4
|
+
import {
|
|
5
|
+
generateNonce
|
|
6
|
+
} from "../chunk-Z4PJMZLM.js";
|
|
7
|
+
import "../chunk-XTHN6JBX.js";
|
|
8
|
+
|
|
9
|
+
// src/adapters/security-headers.ts
|
|
10
|
+
function renderSecurityHeadersConfigLiteral(headers) {
|
|
11
|
+
return JSON.stringify(headers ?? {});
|
|
12
|
+
}
|
|
13
|
+
function withSecurityHeaders(response, headers) {
|
|
14
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
15
|
+
if (!response.headers.has(key)) response.headers.set(key, value);
|
|
16
|
+
}
|
|
17
|
+
return response;
|
|
18
|
+
}
|
|
19
|
+
function describeDeployedSecurityHeaders(limits) {
|
|
20
|
+
const headers = buildSecurityHeaders(limits.securityHeaders ?? {}, { production: true });
|
|
21
|
+
const names = Object.keys(headers);
|
|
22
|
+
if (names.length === 0) {
|
|
23
|
+
return ` ! \`${limits.target}\` sends no security headers: the configuration switched every one of them off.`;
|
|
24
|
+
}
|
|
25
|
+
const lines = [
|
|
26
|
+
` \u2713 security headers on every response \`${limits.target}\` returns: ${names.join(", ")}.`
|
|
27
|
+
];
|
|
28
|
+
const sendsCsp = names.some((name) => name.startsWith("Content-Security-Policy"));
|
|
29
|
+
if (sendsCsp && !limits.mintsNonce) {
|
|
30
|
+
lines.push(
|
|
31
|
+
` - The CSP carries no nonce: this target serves HTML written at build time,`,
|
|
32
|
+
` so there is no per-request value to put on a script tag. An inline`,
|
|
33
|
+
` <script> is refused by \`script-src 'self'\` here, while the same page`,
|
|
34
|
+
` under \`theokit start\` gets a nonce and runs it. Move inline scripts to`,
|
|
35
|
+
` \`<script src="...">\`, or set \`security.headers.cspMode: 'report-only'\``,
|
|
36
|
+
` while you migrate.`
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
if (limits.documentHeaders === "platform-configured") {
|
|
40
|
+
lines.push(
|
|
41
|
+
` - The HTML document is served by the platform's static host, and reaches`,
|
|
42
|
+
` the browser with these headers through config this build emits. That`,
|
|
43
|
+
` path is not verified by a deploy from here \u2014 the values come from the`,
|
|
44
|
+
` same function the handler uses, but no response has been read back.`
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
if (limits.documentHeaders === "platform-unmanaged") {
|
|
48
|
+
lines.push(
|
|
49
|
+
` - The HTML document does NOT pass through this handler \u2014 the platform's`,
|
|
50
|
+
` static host serves it \u2014 so these headers reach \`/api/*\` responses and`,
|
|
51
|
+
` not the page. This build emits no artifact that could configure it, so`,
|
|
52
|
+
` set the document's headers on the platform (usetheokit/theokit#412).`
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
return lines.join("\n");
|
|
56
|
+
}
|
|
57
|
+
export {
|
|
58
|
+
buildSecurityHeaders,
|
|
59
|
+
describeDeployedSecurityHeaders,
|
|
60
|
+
generateNonce,
|
|
61
|
+
renderSecurityHeadersConfigLiteral,
|
|
62
|
+
withSecurityHeaders
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=security-headers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/adapters/security-headers.ts"],"mappings":";;;;;;;;;AA8EO,SAAS,mCACd,SACQ;AACR,SAAO,KAAK,UAAU,WAAW,CAAC,CAAC;AACrC;AAyBO,SAAS,oBAAoB,UAAoB,SAA2C;AACjG,aAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,OAAO,GAAG;AAClD,QAAI,CAAC,SAAS,QAAQ,IAAI,GAAG,EAAG,UAAS,QAAQ,IAAI,KAAK,KAAK;AAAA,EACjE;AACA,SAAO;AACT;AAgDO,SAAS,gCAAgC,QAA8C;AAC5F,QAAM,UAAU,qBAAqB,OAAO,mBAAmB,CAAC,GAAG,EAAE,YAAY,KAAK,CAAC;AACvF,QAAM,QAAQ,OAAO,KAAK,OAAO;AACjC,MAAI,MAAM,WAAW,GAAG;AACtB,WAAO,SAAS,OAAO,MAAM;AAAA,EAC/B;AAEA,QAAM,QAAQ;AAAA,IACZ,iDAA4C,OAAO,MAAM,eAAe,MAAM,KAAK,IAAI,CAAC;AAAA,EAC1F;AACA,QAAM,WAAW,MAAM,KAAK,CAAC,SAAS,KAAK,WAAW,yBAAyB,CAAC;AAChF,MAAI,YAAY,CAAC,OAAO,YAAY;AAClC,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,MAAI,OAAO,oBAAoB,uBAAuB;AACpD,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,MAAI,OAAO,oBAAoB,sBAAsB;AACnD,UAAM;AAAA,MACJ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACA,SAAO,MAAM,KAAK,IAAI;AACxB;","names":[]}
|