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
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import "tsx/esm";
|
|
3
|
+
|
|
4
|
+
// src/server/_internal/compare-by-code-unit.ts
|
|
5
|
+
function compareByCodeUnit(a, b) {
|
|
6
|
+
if (a < b) return -1;
|
|
7
|
+
if (a > b) return 1;
|
|
8
|
+
return 0;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// src/server/_internal/scan-walker.ts
|
|
12
|
+
import { readdirSync } from "fs";
|
|
13
|
+
import { extname, join, resolve } from "path";
|
|
14
|
+
function walkSourceFiles(root, opts, onFile) {
|
|
15
|
+
const skipPrefixes = opts.skipPrefixes ?? ["_", "."];
|
|
16
|
+
const readDir = opts.readDir ?? ((dir) => readdirSync(dir, { withFileTypes: true }));
|
|
17
|
+
const visit = (dir) => {
|
|
18
|
+
let entries;
|
|
19
|
+
try {
|
|
20
|
+
entries = readDir(dir);
|
|
21
|
+
} catch {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const ordered = [...entries].sort((a, b) => compareByCodeUnit(a.name, b.name));
|
|
25
|
+
for (const entry of ordered) {
|
|
26
|
+
const fullPath = join(dir, entry.name);
|
|
27
|
+
if (entry.isDirectory() && !skipPrefixes.some((p) => entry.name.startsWith(p))) {
|
|
28
|
+
visit(fullPath);
|
|
29
|
+
} else if (entry.isFile() && opts.extensions.has(extname(entry.name))) {
|
|
30
|
+
onFile(resolve(fullPath));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
visit(root);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// src/server/scan/errors.ts
|
|
38
|
+
var ROUTER_MIGRATION_GUIDE_URL = "https://theokit.dev/migration/0.3-to-0.4-router";
|
|
39
|
+
var RouterConventionError = class extends Error {
|
|
40
|
+
name = "RouterConventionError";
|
|
41
|
+
file;
|
|
42
|
+
suggestion;
|
|
43
|
+
migrationUrl;
|
|
44
|
+
constructor(opts) {
|
|
45
|
+
const migrationUrl = opts.migrationUrl ?? ROUTER_MIGRATION_GUIDE_URL;
|
|
46
|
+
const message = [
|
|
47
|
+
`Router convention violation: dotted route basename is not supported in theokit 0.4+.`,
|
|
48
|
+
``,
|
|
49
|
+
` File: ${opts.file}`,
|
|
50
|
+
` Use directory-nested form: ${opts.suggestion}`,
|
|
51
|
+
``,
|
|
52
|
+
`Migration guide: ${migrationUrl}`,
|
|
53
|
+
`Run \`theokit migrate router\` to convert all dotted basenames automatically.`
|
|
54
|
+
].join("\n");
|
|
55
|
+
super(message);
|
|
56
|
+
this.file = opts.file;
|
|
57
|
+
this.suggestion = opts.suggestion;
|
|
58
|
+
this.migrationUrl = migrationUrl;
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var ROUTE_POLICY_MIGRATION_GUIDE_URL = "https://theokit.dev/migration/route-policy";
|
|
62
|
+
var MissingRoutePolicyError = class extends Error {
|
|
63
|
+
name = "MissingRoutePolicyError";
|
|
64
|
+
file;
|
|
65
|
+
routePath;
|
|
66
|
+
methods;
|
|
67
|
+
migrationUrl;
|
|
68
|
+
constructor(opts) {
|
|
69
|
+
const migrationUrl = opts.migrationUrl ?? ROUTE_POLICY_MIGRATION_GUIDE_URL;
|
|
70
|
+
const methods = [...opts.methods].sort(compareByCodeUnit);
|
|
71
|
+
const message = [
|
|
72
|
+
`Route policy not declared: every route says who may call it (ADR 0001).`,
|
|
73
|
+
``,
|
|
74
|
+
` File: ${opts.file}`,
|
|
75
|
+
` Route: ${opts.routePath}`,
|
|
76
|
+
` Missing: ${methods.join(", ")}`,
|
|
77
|
+
``,
|
|
78
|
+
`Add a policy to each method listed above:`,
|
|
79
|
+
``,
|
|
80
|
+
// The import is part of the remedy, not decoration. This message shipped
|
|
81
|
+
// naming `requireOwner` while no entry point exported it, so it read as
|
|
82
|
+
// actionable and was not. `tests/unit/policy-gate-remedy-is-importable.test.ts`
|
|
83
|
+
// asserts that every symbol named here is reachable from the path named here.
|
|
84
|
+
` import { route, requireOwner } from 'theokit/server/define'`,
|
|
85
|
+
``,
|
|
86
|
+
` export const ${methods[0] ?? "GET"} = route()`,
|
|
87
|
+
` .policy('public') // anyone may call this`,
|
|
88
|
+
` .handler(...)`,
|
|
89
|
+
` .build()`,
|
|
90
|
+
``,
|
|
91
|
+
` export const ${methods[0] ?? "GET"} = route()`,
|
|
92
|
+
` .policy(({ subject, params }) => requireOwner(subject, ownerOf(params.id)))`,
|
|
93
|
+
` .handler(...)`,
|
|
94
|
+
` .build()`,
|
|
95
|
+
``,
|
|
96
|
+
`Writing 'public' is a decision and not a default. It states that this route`,
|
|
97
|
+
`is open to anyone who can reach it, and it is greppable, so how much of the`,
|
|
98
|
+
`app is open becomes a number somebody can read.`,
|
|
99
|
+
``,
|
|
100
|
+
`Migration guide: ${migrationUrl}`
|
|
101
|
+
].join("\n");
|
|
102
|
+
super(message);
|
|
103
|
+
this.file = opts.file;
|
|
104
|
+
this.routePath = opts.routePath;
|
|
105
|
+
this.methods = methods;
|
|
106
|
+
this.migrationUrl = migrationUrl;
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
var AGENT_POLICY_MIGRATION_GUIDE_URL = "https://theokit.dev/migration/agent-policy";
|
|
110
|
+
var MissingAgentPolicyError = class extends Error {
|
|
111
|
+
name = "MissingAgentPolicyError";
|
|
112
|
+
file;
|
|
113
|
+
agentPath;
|
|
114
|
+
migrationUrl;
|
|
115
|
+
constructor(opts) {
|
|
116
|
+
const migrationUrl = opts.migrationUrl ?? AGENT_POLICY_MIGRATION_GUIDE_URL;
|
|
117
|
+
const message = [
|
|
118
|
+
`Agent policy not declared: every agent says who may run it (ADR 0001).`,
|
|
119
|
+
``,
|
|
120
|
+
` File: ${opts.file}`,
|
|
121
|
+
` Agent: ${opts.agentPath}`,
|
|
122
|
+
``,
|
|
123
|
+
`This one declaration covers every endpoint the agent exposes - the run, the`,
|
|
124
|
+
`thread routes, the pending-approval listing, the approve route and MCP - because`,
|
|
125
|
+
`they all reach the same conversation and the same paused tools.`,
|
|
126
|
+
``,
|
|
127
|
+
`Add ONE of these to the file above:`,
|
|
128
|
+
``,
|
|
129
|
+
` export const policy = 'public' // anyone who can reach it may run it`,
|
|
130
|
+
``,
|
|
131
|
+
` import { requireOwner } from 'theokit/server/define'`,
|
|
132
|
+
``,
|
|
133
|
+
` // subject <- what server/context.ts put on ctx.subject`,
|
|
134
|
+
` // params <- { agent, endpoint, sessionId?, approvalId? }`,
|
|
135
|
+
` // body <- the parsed chat body, on the endpoints that have one`,
|
|
136
|
+
` export const policy = ({ subject, params }) =>`,
|
|
137
|
+
` requireOwner(subject, ownerOf(params.sessionId))`,
|
|
138
|
+
``,
|
|
139
|
+
`Writing 'public' is a decision and not a default. The endpoint resumes whatever`,
|
|
140
|
+
`conversation the CALLER names, so 'public' means any caller holding an id may read`,
|
|
141
|
+
`and continue that conversation - a capability model, which is legitimate when it is`,
|
|
142
|
+
`the choice somebody made and greppable once it is written down.`,
|
|
143
|
+
``,
|
|
144
|
+
`Migration guide: ${migrationUrl}`
|
|
145
|
+
].join("\n");
|
|
146
|
+
super(message);
|
|
147
|
+
this.file = opts.file;
|
|
148
|
+
this.agentPath = opts.agentPath;
|
|
149
|
+
this.migrationUrl = migrationUrl;
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
// src/server/scan/file-stamp-cache.ts
|
|
154
|
+
import { statSync } from "fs";
|
|
155
|
+
function createFileStampCache() {
|
|
156
|
+
const entries = /* @__PURE__ */ new Map();
|
|
157
|
+
return {
|
|
158
|
+
get(filePath, compute) {
|
|
159
|
+
const stat = statSync(filePath);
|
|
160
|
+
const key = `${filePath}:${String(stat.mtimeMs)}:${String(stat.size)}`;
|
|
161
|
+
const hit = entries.get(key);
|
|
162
|
+
if (hit !== void 0 || entries.has(key)) return hit;
|
|
163
|
+
const value = compute();
|
|
164
|
+
entries.set(key, value);
|
|
165
|
+
return value;
|
|
166
|
+
},
|
|
167
|
+
clear() {
|
|
168
|
+
entries.clear();
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export {
|
|
174
|
+
compareByCodeUnit,
|
|
175
|
+
walkSourceFiles,
|
|
176
|
+
RouterConventionError,
|
|
177
|
+
MissingRoutePolicyError,
|
|
178
|
+
MissingAgentPolicyError,
|
|
179
|
+
createFileStampCache
|
|
180
|
+
};
|
|
181
|
+
//# sourceMappingURL=chunk-FD4ZDTQ6.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/server/_internal/compare-by-code-unit.ts","../src/server/_internal/scan-walker.ts","../src/server/scan/errors.ts","../src/server/scan/file-stamp-cache.ts"],"sourcesContent":["/**\n * Total order over strings by UTF-16 code unit — the ordering build-time output\n * must use.\n *\n * `localeCompare` is the wrong instrument here, and reads like the right one,\n * which is why it kept being chosen. With no locale argument it uses the default\n * collator, and Node derives that from `LC_ALL`/`LANG`: under `sv-SE` an `ä`\n * sorts after `z`, under `en-US` before `a`. A scanner ordering that way emits a\n * different manifest per machine — and where the order being emitted is an\n * execution order, it decides which middleware runs first\n * (usetheokit/theokit#346, usetheokit/theokit#351).\n *\n * What build output needs from a comparator is that it be total and stable.\n * Being alphabetical for a reader of one particular language is not a property\n * it needs, and is the one that costs reproducibility.\n *\n * Presentation code is the opposite case and should keep `localeCompare`: a list\n * a human reads should collate the way that human's language collates.\n *\n * @internal\n */\nexport function compareByCodeUnit(a: string, b: string): number {\n if (a < b) return -1\n if (a > b) return 1\n return 0\n}\n","/* eslint-disable security/detect-non-literal-fs-filename --\n * Build-time scanner: walks directories derived from cwd.\n * No HTTP input ever reaches these fs calls.\n */\nimport { readdirSync } from 'node:fs'\nimport type { Dirent } from 'node:fs'\nimport { extname, join, resolve } from 'node:path'\n\nimport { compareByCodeUnit } from './compare-by-code-unit.js'\n\n/**\n * Options for walkSourceFiles.\n *\n * Sequential by design — callers (route precedence) depend on insertion\n * order (EC-19 documented decision). Async-callback support is implicit\n * via JavaScript's serial await loop.\n *\n * Tested on macOS + Linux. Windows long-path support not validated (EC-20).\n */\ninterface WalkOptions {\n /** File extensions to include (e.g., new Set(['.ts', '.tsx'])). */\n extensions: ReadonlySet<string>\n /** Skip directories whose name starts with any of these (default: ['_', '.']). */\n skipPrefixes?: readonly string[]\n /**\n * Read one directory. Defaults to `readdirSync`.\n *\n * Injected for one reason: the ordering below cannot be tested against a real\n * filesystem. `readdirSync` returns whatever the filesystem returns — creation\n * order on tmpfs, hash order on ext4 with `dir_index` — and on the machine\n * this was written on those four names came back already sorted, so a\n * name-based test passed before the sort existed and proved nothing. A test\n * that agrees with the code because both read the same accidental order is\n * `B-022`, and writing one here would have been that item committed inside its\n * own fix.\n */\n readDir?: (dir: string) => Dirent[]\n}\n\n/**\n * Recursively walk `root`, invoking `onFile(absPath)` for every file matching\n * `opts.extensions`. Directories whose name starts with any `skipPrefixes`\n * char are skipped (defaults to `_` and `.`).\n *\n * Entries are emitted in UTF-16 code-unit order, files and directories in one\n * total order. Without it the walker passed the filesystem's order through to\n * six scanners — routes, actions, websockets, cron, agents, jobs — and only one\n * re-orders afterwards, so five emitted a different manifest per machine. Where\n * that order is an execution order it decides what runs first (#346, B-004).\n *\n * Replaces 3 near-identical recursive walkers in scan.ts, action-scan.ts,\n * ws-scan.ts (PV-3 — DRY consolidation). Resolves T3.1 of\n * architecture-review-remediation-plan. Six call sites consume it today, not\n * three; the count in this paragraph was true when it was written.\n *\n * Symlink loops are NOT tracked — callers must avoid them or pre-resolve\n * via `fs.realpath`. EC-11 documented but not implemented (rare in dev).\n */\nexport function walkSourceFiles(\n root: string,\n opts: WalkOptions,\n onFile: (absPath: string) => void,\n): void {\n const skipPrefixes = opts.skipPrefixes ?? ['_', '.']\n const readDir = opts.readDir ?? ((dir: string) => readdirSync(dir, { withFileTypes: true }))\n const visit = (dir: string): void => {\n let entries\n try {\n entries = readDir(dir)\n } catch {\n // Silently skip unreadable directories — caller controls discoverability\n return\n }\n // One total order over files and directories together, so a name sorts the\n // same way whichever it is. Sorting the two groups separately would emit a\n // different interleaving than a single pass, which is an ordering decision\n // nobody made (#346).\n const ordered = [...entries].sort((a, b) => compareByCodeUnit(a.name, b.name))\n for (const entry of ordered) {\n const fullPath = join(dir, entry.name)\n if (entry.isDirectory() && !skipPrefixes.some((p) => entry.name.startsWith(p))) {\n visit(fullPath)\n } else if (entry.isFile() && opts.extensions.has(extname(entry.name))) {\n onFile(resolve(fullPath))\n }\n }\n }\n visit(root)\n}\n","import { compareByCodeUnit } from '../_internal/compare-by-code-unit.js'\n\n/**\n * Router-convention errors thrown by the server-route scanner.\n *\n *\n * theokit 0.4.0+ enforces directory-nested file-system routing\n * (`auth/[provider]/login.ts`) and REJECTS dotted-basename routes\n * (`auth.[provider].login.ts`) because the legacy regex extracted the\n * dotted basename incorrectly — `params.provider` was undefined at request\n * time. Decision recorded in the plan above (`g6-router-convention-plan.md`) and CHANGELOG 0.4.0\n * (no standalone ADR was cut for this router-convention change).\n */\n\n/**\n * Canonical migration guide URL. T4.2 establishes this as the authoritative\n * landing page. EC-3: error message uses this constant so the URL never\n * drifts from the doc location.\n */\nexport const ROUTER_MIGRATION_GUIDE_URL = 'https://theokit.dev/migration/0.3-to-0.4-router'\n\ninterface RouterConventionErrorOptions {\n /** Absolute path of the offending route file. */\n file: string\n /** Suggested directory-nested replacement path (relative, e.g. `routes/auth/[provider]/login.ts`). */\n suggestion: string\n /** Migration guide URL (defaults to `ROUTER_MIGRATION_GUIDE_URL`). */\n migrationUrl?: string\n}\n\n/**\n * Thrown by `scanServerRoutes` when a route file uses the legacy\n * dotted-basename convention (`auth.[provider].login.ts`).\n *\n * The error is FAIL-FAST by design — running with a route that has wrong\n * `paramNames` produces silent 404s at request time, which is strictly\n * worse than a build-time error.\n */\nexport class RouterConventionError extends Error {\n override readonly name = 'RouterConventionError'\n readonly file: string\n readonly suggestion: string\n readonly migrationUrl: string\n\n constructor(opts: RouterConventionErrorOptions) {\n const migrationUrl = opts.migrationUrl ?? ROUTER_MIGRATION_GUIDE_URL\n const message = [\n `Router convention violation: dotted route basename is not supported in theokit 0.4+.`,\n ``,\n ` File: ${opts.file}`,\n ` Use directory-nested form: ${opts.suggestion}`,\n ``,\n `Migration guide: ${migrationUrl}`,\n `Run \\`theokit migrate router\\` to convert all dotted basenames automatically.`,\n ].join('\\n')\n super(message)\n this.file = opts.file\n this.suggestion = opts.suggestion\n this.migrationUrl = migrationUrl\n }\n}\n\n/**\n * Canonical landing page for the policy-declaration migration. Held as a\n * constant for the same reason as {@link ROUTER_MIGRATION_GUIDE_URL}: the error\n * message and the doc cannot drift apart if only one of them names the URL.\n *\n * Module-local, unlike its sibling: nothing outside this file needs to name it,\n * and an export with no consumer is what `knip` exists to refuse.\n */\nconst ROUTE_POLICY_MIGRATION_GUIDE_URL = 'https://theokit.dev/migration/route-policy'\n\ninterface MissingRoutePolicyErrorOptions {\n /** Absolute path of the route file. */\n file: string\n /** The URL path the file resolves to, so the message reads like the app, not like the disk. */\n routePath: string\n /** The exported HTTP methods that declare no policy. */\n methods: string[]\n /** Migration guide URL (defaults to {@link ROUTE_POLICY_MIGRATION_GUIDE_URL}). */\n migrationUrl?: string\n}\n\n/**\n * Thrown by `scanServerRoutes` when a route file exports an HTTP method that\n * declares no access policy (ADR 0001, Decision point 5).\n *\n * Absence used to mean \"not declared\", which every reader and every transport\n * had to interpret as open. The interpretation was the bug: a route nobody\n * thought about looked exactly like a route deliberately left open. This error\n * is where the two stop looking alike.\n *\n * It fires at scan time — `theo build`, `theo start`, `theo dev`, `theo routes`\n * and every deployment adapter go through the same scanner — so the answer\n * arrives before a request does, in the same place the scanner already refuses\n * a dotted basename and a collision with the reserved batch path.\n */\nexport class MissingRoutePolicyError extends Error {\n override readonly name = 'MissingRoutePolicyError'\n readonly file: string\n readonly routePath: string\n readonly methods: string[]\n readonly migrationUrl: string\n\n constructor(opts: MissingRoutePolicyErrorOptions) {\n const migrationUrl = opts.migrationUrl ?? ROUTE_POLICY_MIGRATION_GUIDE_URL\n const methods = [...opts.methods].sort(compareByCodeUnit)\n const message = [\n `Route policy not declared: every route says who may call it (ADR 0001).`,\n ``,\n ` File: ${opts.file}`,\n ` Route: ${opts.routePath}`,\n ` Missing: ${methods.join(', ')}`,\n ``,\n `Add a policy to each method listed above:`,\n ``,\n // The import is part of the remedy, not decoration. This message shipped\n // naming `requireOwner` while no entry point exported it, so it read as\n // actionable and was not. `tests/unit/policy-gate-remedy-is-importable.test.ts`\n // asserts that every symbol named here is reachable from the path named here.\n ` import { route, requireOwner } from 'theokit/server/define'`,\n ``,\n ` export const ${methods[0] ?? 'GET'} = route()`,\n ` .policy('public') // anyone may call this`,\n ` .handler(...)`,\n ` .build()`,\n ``,\n ` export const ${methods[0] ?? 'GET'} = route()`,\n ` .policy(({ subject, params }) => requireOwner(subject, ownerOf(params.id)))`,\n ` .handler(...)`,\n ` .build()`,\n ``,\n `Writing 'public' is a decision and not a default. It states that this route`,\n `is open to anyone who can reach it, and it is greppable, so how much of the`,\n `app is open becomes a number somebody can read.`,\n ``,\n `Migration guide: ${migrationUrl}`,\n ].join('\\n')\n super(message)\n this.file = opts.file\n this.routePath = opts.routePath\n this.methods = methods\n this.migrationUrl = migrationUrl\n }\n}\n\n/**\n * Canonical landing page for the agent-policy migration. Module-local for the same reason as its\n * route sibling: nothing outside this file names it, and an export with no consumer is what `knip`\n * exists to refuse.\n */\nconst AGENT_POLICY_MIGRATION_GUIDE_URL = 'https://theokit.dev/migration/agent-policy'\n\ninterface MissingAgentPolicyErrorOptions {\n /** Absolute path of the agent file. */\n file: string\n /** The URL the agent is served at, so the message reads like the app rather than like the disk. */\n agentPath: string\n /** Migration guide URL (defaults to {@link AGENT_POLICY_MIGRATION_GUIDE_URL}). */\n migrationUrl?: string\n}\n\n/**\n * Thrown by `scanAgents` when an agent file declares no access policy\n * (ADR 0001 Decision point 5, extended to the agent surface by usetheokit/theokit#365).\n *\n * ## Why absence had to stop meaning open HERE and not at runtime\n *\n * The agent endpoints resume a conversation the CALLER names, and they are dispatched before route\n * matching, so no route, no middleware and no `server/context.ts` ever saw those URLs. A caller\n * holding a conversation id and no credential read that conversation back.\n *\n * There is no safe runtime default for that. Refusing every caller-named session id would break\n * multi-turn chat, which is the base case; admitting them is the defect. So the decision moves to\n * where a person can answer it once, in the file that owns the agent — the same place and the same\n * reasoning as the route gate, which is why this error reads like its sibling.\n *\n * ## What it costs\n *\n * Every existing application with an agent fails its next build until it adds one line. That is the\n * half of ADR 0001 the ADR itself called breaking, and the trade it names: a build error that\n * points at a file beats a silent 200 that hands over somebody else's conversation.\n */\nexport class MissingAgentPolicyError extends Error {\n override readonly name = 'MissingAgentPolicyError'\n readonly file: string\n readonly agentPath: string\n readonly migrationUrl: string\n\n constructor(opts: MissingAgentPolicyErrorOptions) {\n const migrationUrl = opts.migrationUrl ?? AGENT_POLICY_MIGRATION_GUIDE_URL\n const message = [\n `Agent policy not declared: every agent says who may run it (ADR 0001).`,\n ``,\n ` File: ${opts.file}`,\n ` Agent: ${opts.agentPath}`,\n ``,\n `This one declaration covers every endpoint the agent exposes - the run, the`,\n `thread routes, the pending-approval listing, the approve route and MCP - because`,\n `they all reach the same conversation and the same paused tools.`,\n ``,\n `Add ONE of these to the file above:`,\n ``,\n ` export const policy = 'public' // anyone who can reach it may run it`,\n ``,\n ` import { requireOwner } from 'theokit/server/define'`,\n ``,\n ` // subject <- what server/context.ts put on ctx.subject`,\n ` // params <- { agent, endpoint, sessionId?, approvalId? }`,\n ` // body <- the parsed chat body, on the endpoints that have one`,\n ` export const policy = ({ subject, params }) =>`,\n ` requireOwner(subject, ownerOf(params.sessionId))`,\n ``,\n `Writing 'public' is a decision and not a default. The endpoint resumes whatever`,\n `conversation the CALLER names, so 'public' means any caller holding an id may read`,\n `and continue that conversation - a capability model, which is legitimate when it is`,\n `the choice somebody made and greppable once it is written down.`,\n ``,\n `Migration guide: ${migrationUrl}`,\n ].join('\\n')\n super(message)\n this.file = opts.file\n this.agentPath = opts.agentPath\n this.migrationUrl = migrationUrl\n }\n}\n","/**\n * Memoise per source file, invalidated by the file's own stamp.\n *\n * ## Why this exists\n *\n * `theokit dev` re-scans the routes and agents directories on EVERY request, so any work that\n * parses a file with the TypeScript AST turns a build-time check into per-request latency.\n * `agent-scan.ts` recognised this and carried its own `Map` keyed on `path:mtimeMs:size`;\n * `scan.ts` — with far more files — carried neither the cache nor the reasoning, and the\n * route-policy gate then added a SECOND full parse of every route file on top of the one\n * `detectExportedHttpMethods` had been paying since before it (usetheokit/theokit#417).\n *\n * Lifting the mechanism here rather than copying it is the point: two hand-rolled caches keyed\n * \"the same way\" are two chances for the keys to stop being the same.\n *\n * ## Why the stamp and not a watcher\n *\n * `mtimeMs` and `size` together come from the `statSync` the scanner is doing anyway, so an edit\n * invalidates the entry without anyone remembering to, and a `theokit build` — one process, one\n * scan — never notices the cache exists.\n *\n * The known limit, stated rather than discovered: a rewrite that preserves BOTH mtime and size is\n * invisible. That is a deliberate trade every mtime cache makes, and the alternative (hashing the\n * contents) reads the file to avoid reading the file.\n */\nimport { statSync } from 'node:fs'\n\nexport interface FileStampCache<T> {\n /** The memoised value for `filePath`, computing it when the file's stamp has changed. */\n get: (filePath: string, compute: () => T) => T\n /** Test seam — a module-level cache would otherwise outlive a fixture directory. */\n clear: () => void\n}\n\nexport function createFileStampCache<T>(): FileStampCache<T> {\n const entries = new Map<string, T>()\n\n return {\n get(filePath, compute) {\n // A path the scanner itself discovered by globbing the project, never caller input at runtime.\n // eslint-disable-next-line security/detect-non-literal-fs-filename -- see above\n const stat = statSync(filePath)\n const key = `${filePath}:${String(stat.mtimeMs)}:${String(stat.size)}`\n\n const hit = entries.get(key)\n // `has` rather than a truthiness check on the value: `false`, `0` and `''` are all legitimate\n // results to cache, and a truthiness test would recompute them on every call — which is the\n // defect this file exists to remove, wearing a subtler hat.\n if (hit !== undefined || entries.has(key)) return hit as T\n\n const value = compute()\n entries.set(key, value)\n return value\n },\n clear() {\n entries.clear()\n },\n }\n}\n"],"mappings":";;;;AAqBO,SAAS,kBAAkB,GAAW,GAAmB;AAC9D,MAAI,IAAI,EAAG,QAAO;AAClB,MAAI,IAAI,EAAG,QAAO;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ACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA,oBAAoB,YAAY;AAAA,IAClC,EAAE,KAAK,IAAI;AACX,UAAM,OAAO;AACb,SAAK,OAAO,KAAK;AACjB,SAAK,YAAY,KAAK;AACtB,SAAK,eAAe;AAAA,EACtB;AACF;;;ACxMA,SAAS,gBAAgB;AASlB,SAAS,uBAA6C;AAC3D,QAAM,UAAU,oBAAI,IAAe;AAEnC,SAAO;AAAA,IACL,IAAI,UAAU,SAAS;AAGrB,YAAM,OAAO,SAAS,QAAQ;AAC9B,YAAM,MAAM,GAAG,QAAQ,IAAI,OAAO,KAAK,OAAO,CAAC,IAAI,OAAO,KAAK,IAAI,CAAC;AAEpE,YAAM,MAAM,QAAQ,IAAI,GAAG;AAI3B,UAAI,QAAQ,UAAa,QAAQ,IAAI,GAAG,EAAG,QAAO;AAElD,YAAM,QAAQ,QAAQ;AACtB,cAAQ,IAAI,KAAK,KAAK;AACtB,aAAO;AAAA,IACT;AAAA,IACA,QAAQ;AACN,cAAQ,MAAM;AAAA,IAChB;AAAA,EACF;AACF;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import "tsx/esm";
|
|
3
|
+
|
|
4
|
+
// src/vite-plugin/resolve-theo-root.ts
|
|
5
|
+
import { existsSync } from "fs";
|
|
6
|
+
import { resolve } from "path";
|
|
7
|
+
function resolveTheoRootDir(currentDir) {
|
|
8
|
+
if (existsSync(resolve(currentDir, "client"))) {
|
|
9
|
+
return currentDir;
|
|
10
|
+
}
|
|
11
|
+
return resolve(currentDir, "..");
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
resolveTheoRootDir
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=chunk-FDOOBTXJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/vite-plugin/resolve-theo-root.ts"],"sourcesContent":["/* eslint-disable security/detect-non-literal-fs-filename --\n * Resolves theokit's own install directory (the `node_modules/theokit/`).\n * Build-time tool. Read-only check. No HTTP input.\n */\nimport { existsSync } from 'node:fs'\nimport { resolve } from 'node:path'\n\n/**\n * Resolve the directory that holds the framework's compiled (or source)\n * subpaths — `client/`, `server/`, `react-query/`, etc.\n *\n * Cases (regression T1.3):\n * - Source mode (`src/vite-plugin/index.ts`) — `currentDir` is\n * `…/src/vite-plugin`. Parent (`…/src`) contains `client/`. Return parent.\n * - Dist mode (`dist/chunk-XYZ.js`) — `currentDir` is `…/dist`. That dir\n * itself contains `client/`. Return currentDir.\n * - Unknown shape — fall back to parent (legacy behavior). The dogfood\n * validator will catch the misconfiguration before runtime.\n *\n * Pure function — no side effects, only filesystem reads via `existsSync`.\n * Exported so the regression test can exercise the branch logic directly.\n */\nexport function resolveTheoRootDir(currentDir: string): string {\n if (existsSync(resolve(currentDir, 'client'))) {\n return currentDir\n }\n return resolve(currentDir, '..')\n}\n"],"mappings":";;;;AAIA,SAAS,kBAAkB;AAC3B,SAAS,eAAe;AAiBjB,SAAS,mBAAmB,YAA4B;AAC7D,MAAI,WAAW,QAAQ,YAAY,QAAQ,CAAC,GAAG;AAC7C,WAAO;AAAA,EACT;AACA,SAAO,QAAQ,YAAY,IAAI;AACjC;","names":[]}
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import "tsx/esm";
|
|
3
|
+
import {
|
|
4
|
+
servicesConfigSchema
|
|
5
|
+
} from "./chunk-ZNZISJDZ.js";
|
|
6
|
+
import {
|
|
7
|
+
cacheSchema,
|
|
8
|
+
loggingSchema,
|
|
9
|
+
observabilitySchema,
|
|
10
|
+
rateLimitSchema,
|
|
11
|
+
securitySchema,
|
|
12
|
+
storageSchema,
|
|
13
|
+
uploadSchema
|
|
14
|
+
} from "./chunk-VI7ZANB3.js";
|
|
15
|
+
|
|
16
|
+
// src/config/schema.ts
|
|
17
|
+
import { z } from "zod";
|
|
18
|
+
|
|
19
|
+
// src/core/contracts/theo-ui-theme.ts
|
|
20
|
+
var THEME_NAME_PATTERN = /^[a-z][a-z0-9-]*$/;
|
|
21
|
+
|
|
22
|
+
// src/config/schema.ts
|
|
23
|
+
var theoConfigSchema = z.object({
|
|
24
|
+
/**
|
|
25
|
+
* Plan v1.2 T2.1 — project identifier propagated into
|
|
26
|
+
* `.theokit/services.json` v2 `project` field. DNS-1123 compatible (drives
|
|
27
|
+
* Gitea repo + ArgoCD App naming on TheoCloud). When omitted, the build
|
|
28
|
+
* emits services.json v1 with the legacy `services-bundle` fallback
|
|
29
|
+
* (ADR D10) and logs a deprecation warning.
|
|
30
|
+
*/
|
|
31
|
+
name: z.string().max(63).refine(
|
|
32
|
+
// DNS-1123 equivalent expressed as explicit single-char anchors so
|
|
33
|
+
// security/detect-unsafe-regex stays clean (no backtracking).
|
|
34
|
+
(value) => value.length > 0 && /^[a-z0-9-]+$/u.test(value) && !value.startsWith("-") && !value.endsWith("-"),
|
|
35
|
+
"name must match DNS-1123 (lowercase alphanumeric+hyphens, 1-63 chars, no leading/trailing hyphen)"
|
|
36
|
+
).optional(),
|
|
37
|
+
appDir: z.string().default("app"),
|
|
38
|
+
serverDir: z.string().default("server"),
|
|
39
|
+
/**
|
|
40
|
+
* Directory (relative to the project root) holding `agents/<name>.ts` definitions, scanned by
|
|
41
|
+
* dev/build/terminal/mcp. Defaults to `"agents"` — apps that keep the canonical layout are
|
|
42
|
+
* unaffected. Set to e.g. `"core/agents"` to organize agents under a domain root (#95 follow-up).
|
|
43
|
+
*/
|
|
44
|
+
agentsDir: z.string().default("agents"),
|
|
45
|
+
/**
|
|
46
|
+
* T2.2 / EC-4 — Build output directory. Must be a relative path inside
|
|
47
|
+
* the project root. Refused absolute or parent-relative paths to prevent
|
|
48
|
+
* `cleanOutDir` from wiping arbitrary locations (defense-in-depth on
|
|
49
|
+
* top of cleanOutDir's runtime EC-3 guard).
|
|
50
|
+
*/
|
|
51
|
+
distDir: z.string().default(".theokit").refine(
|
|
52
|
+
(d) => !/^([A-Za-z]:)?[/\\]/.test(d) && !d.startsWith(".."),
|
|
53
|
+
'distDir must be a relative path inside the project root (e.g., ".theokit")'
|
|
54
|
+
),
|
|
55
|
+
/**
|
|
56
|
+
* Agent runtime configuration.
|
|
57
|
+
*
|
|
58
|
+
* - `maxRegistries` (T2.3, legacy): dev-mode cleanup of stale
|
|
59
|
+
* `.theokit/agents/<id>/` dirs by mtime. Now superseded by SDK's
|
|
60
|
+
* native registry GC but kept for backward-compat.
|
|
61
|
+
* - `registry` (Phase 6, Production-Readiness #2): forwarded to
|
|
62
|
+
* `Agent.registry.configure()` lazily on first request.
|
|
63
|
+
* * `maxAgents` — LRU cap. MUST be ≥ max-concurrent-active-conversations
|
|
64
|
+
* (EC-17 DOCUMENT): with maxAgents:1 and 2 concurrent chats, LRU evicts
|
|
65
|
+
* mid-stream → SDK aborts with code:'aborted'. Default 100 covers
|
|
66
|
+
* indie/small-team; tune up for high-traffic.
|
|
67
|
+
* * `idleTimeoutMs` — auto-evict idle agents (default 30 min). 0 disables
|
|
68
|
+
* idle eviction (LRU only).
|
|
69
|
+
*/
|
|
70
|
+
agents: z.object({
|
|
71
|
+
maxRegistries: z.number().int().positive().default(100),
|
|
72
|
+
registry: z.object({
|
|
73
|
+
/** LRU cap — MUST be ≥ max-concurrent-active-conversations. */
|
|
74
|
+
maxAgents: z.number().int().positive().max(1e4).default(100),
|
|
75
|
+
/** Idle eviction window in ms. 0 disables idle eviction (LRU only). */
|
|
76
|
+
idleTimeoutMs: z.number().int().nonnegative().default(30 * 6e4)
|
|
77
|
+
}).optional()
|
|
78
|
+
}).optional(),
|
|
79
|
+
port: z.number().int().min(1).max(65535).default(3e3),
|
|
80
|
+
/** Listen on all addresses (0.0.0.0) for LAN/mobile testing. */
|
|
81
|
+
host: z.union([z.string(), z.boolean()]).default("localhost"),
|
|
82
|
+
/** Automatically open browser on `theokit dev`. */
|
|
83
|
+
open: z.union([z.boolean(), z.string()]).default(false),
|
|
84
|
+
/** Exit if port is already in use instead of trying next available. */
|
|
85
|
+
strictPort: z.boolean().default(false),
|
|
86
|
+
/** Forward browser console/errors to terminal — useful for AI agent dev. */
|
|
87
|
+
forwardConsole: z.union([
|
|
88
|
+
z.boolean(),
|
|
89
|
+
z.object({
|
|
90
|
+
unhandledErrors: z.boolean().optional(),
|
|
91
|
+
logLevels: z.array(z.enum(["error", "warn", "info", "log", "debug"])).optional()
|
|
92
|
+
})
|
|
93
|
+
]).default(false),
|
|
94
|
+
/** Pre-transform files on startup for faster first page load. */
|
|
95
|
+
warmup: z.object({
|
|
96
|
+
clientFiles: z.array(z.string()).optional(),
|
|
97
|
+
ssrFiles: z.array(z.string()).optional()
|
|
98
|
+
}).optional(),
|
|
99
|
+
ssr: z.boolean().default(false),
|
|
100
|
+
/** When true (and ssr === true), use renderToPipeableStream with progressive
|
|
101
|
+
* shell flush instead of single-shot renderToString. Opt-in for streaming
|
|
102
|
+
* SSR; default false preserves the current behavior. */
|
|
103
|
+
ssrStreaming: z.boolean().default(false),
|
|
104
|
+
rateLimit: rateLimitSchema.optional(),
|
|
105
|
+
upload: uploadSchema.optional(),
|
|
106
|
+
logging: loggingSchema.optional(),
|
|
107
|
+
security: securitySchema.optional(),
|
|
108
|
+
serialization: z.enum(["json", "superjson"]).default("json"),
|
|
109
|
+
// Plugins are validated structurally at runtime by createPluginRunnerFromConfig.
|
|
110
|
+
// Zod only checks the shape minimally (must be array). Type-level safety is
|
|
111
|
+
// provided through defineConfig at the user surface.
|
|
112
|
+
//
|
|
113
|
+
// #425 — an entry MAY also be a module SPECIFIER (a string), resolved to that module's default
|
|
114
|
+
// export by `config/resolve-plugin-specifiers.ts`. A constructed plugin closes over state and
|
|
115
|
+
// therefore has no literal, so it is the string form — and only the string form — that a
|
|
116
|
+
// generated deploy entry can carry. Both shapes are accepted here for the same reason they are
|
|
117
|
+
// accepted at runtime: one declaration has to serve the local server and the deployed one.
|
|
118
|
+
plugins: z.array(z.unknown()).optional(),
|
|
119
|
+
/** Enable client-side batching of theoFetch calls and the
|
|
120
|
+
* /api/__theo_batch__ server endpoint. */
|
|
121
|
+
batching: z.union([z.boolean(), z.object({ max: z.number().int().positive().optional() })]).optional(),
|
|
122
|
+
/** T4.1 — Audit log. When `logger` is provided, framework events
|
|
123
|
+
* (csrf.warn, rate-limit.exceeded, session.rotated, csp.violation) are
|
|
124
|
+
* emitted to it. Default: noop. */
|
|
125
|
+
audit: z.object({
|
|
126
|
+
logger: z.unknown().optional()
|
|
127
|
+
}).optional(),
|
|
128
|
+
/** TheoUI auto-wire (T2.1). `false` = opt-out; object = explicit theme/fonts;
|
|
129
|
+
* undefined = enabled when @theokit/ui is detected in node_modules. */
|
|
130
|
+
ui: z.union([
|
|
131
|
+
z.literal(false),
|
|
132
|
+
z.object({
|
|
133
|
+
// Any theme @theokit/ui knows — built-in or from `defineTheme()`. This was a closed
|
|
134
|
+
// enum of `violet-forge | noir | paper`, two of which never existed in @theokit/ui, so
|
|
135
|
+
// the only accepted value was the default and every real theme was rejected. The pattern
|
|
136
|
+
// mirrors what @theokit/ui's ThemeProvider enforces, and it is load-bearing: the value is
|
|
137
|
+
// interpolated into the generated entry and into a CSS selector.
|
|
138
|
+
theme: z.string().regex(
|
|
139
|
+
THEME_NAME_PATTERN,
|
|
140
|
+
"must start with a letter and contain only lowercase letters, digits and hyphens"
|
|
141
|
+
).optional(),
|
|
142
|
+
fonts: z.enum(["bundled", "cdn"]).optional()
|
|
143
|
+
})
|
|
144
|
+
]).optional(),
|
|
145
|
+
/**
|
|
146
|
+
* Cache subsystem (caching-and-revalidation-plan).
|
|
147
|
+
* Default `undefined` keeps caching disabled (backward compatible).
|
|
148
|
+
* Pass `cache: {}` to opt in with defaults.
|
|
149
|
+
*/
|
|
150
|
+
cache: cacheSchema.optional(),
|
|
151
|
+
/**
|
|
152
|
+
* Observability (#353). Default `undefined` keeps telemetry off. Present and
|
|
153
|
+
* not `enabled: false` opts in; `provider` overrides the environment-derived
|
|
154
|
+
* adapter, which is the priority `adapter-registry.ts` has always documented.
|
|
155
|
+
*/
|
|
156
|
+
observability: observabilitySchema.optional(),
|
|
157
|
+
/**
|
|
158
|
+
* Devtools overlay (Phase 0.4.0+ —
|
|
159
|
+
*
|
|
160
|
+
* - `undefined` (default): devtools auto-injects in `pnpm dev`, NEVER in `vite build`.
|
|
161
|
+
* - `false`: devtools disabled entirely (Vite plugin skips injection even in dev).
|
|
162
|
+
* - `{ ... }`: devtools enabled with explicit defaults (position, theme).
|
|
163
|
+
*
|
|
164
|
+
* Tree-shaken to noop in prod via the dual-export pattern in
|
|
165
|
+
* `packages/theo/src/devtools/index.ts` (EC-17 positive prod check).
|
|
166
|
+
*/
|
|
167
|
+
devtools: z.union([
|
|
168
|
+
z.literal(false),
|
|
169
|
+
z.object({
|
|
170
|
+
position: z.enum(["top-left", "top-right", "bottom-left", "bottom-right"]).optional(),
|
|
171
|
+
theme: z.enum(["light", "dark", "system"]).optional()
|
|
172
|
+
})
|
|
173
|
+
]).optional(),
|
|
174
|
+
/**
|
|
175
|
+
* Informative list of deploy adapters the app supports. Does NOT
|
|
176
|
+
* trigger per-build translations — only the `--target` CLI flag does
|
|
177
|
+
* (EC-201 / ADR D2). If `config.adapters` includes a target NOT
|
|
178
|
+
* matching `--target`, `theokit build` emits a cross-reference note.
|
|
179
|
+
*/
|
|
180
|
+
adapters: z.array(z.string()).optional(),
|
|
181
|
+
/**
|
|
182
|
+
* Extra package names to pre-bundle via Vite's `optimizeDeps.include`.
|
|
183
|
+
*
|
|
184
|
+
* Framework auto-includes `@theokit/ui` and `lucide-react` when present.
|
|
185
|
+
* Apps adding plugin peer-deps that rely on a runtime `import('<pkg>')`
|
|
186
|
+
* (dynamic specifier) — e.g. `@theokit/plugin-canvas` consumers
|
|
187
|
+
* installing `mermaid` for Mermaid SVG rendering — must declare those
|
|
188
|
+
* here so Vite can resolve the literal in dev mode without
|
|
189
|
+
* "Failed to resolve module specifier" errors. Production builds use
|
|
190
|
+
* tsup/esbuild bundling and are not affected.
|
|
191
|
+
*
|
|
192
|
+
* Example:
|
|
193
|
+
* viteOptimizeDeps: ['mermaid']
|
|
194
|
+
*/
|
|
195
|
+
viteOptimizeDeps: z.array(z.string()).optional(),
|
|
196
|
+
/**
|
|
197
|
+
* Jobs backend (ADR D3 + T2.1). When configured, every request gets
|
|
198
|
+
* `ctx.queue.enqueue` auto-wired via the outbox lifecycle. Pass a
|
|
199
|
+
* `JobBackend` instance (InMemoryJobBackend, PostgresJobBackend, etc.).
|
|
200
|
+
*/
|
|
201
|
+
jobs: z.object({
|
|
202
|
+
backend: z.custom((v) => typeof v === "object" && v !== null)
|
|
203
|
+
}).optional(),
|
|
204
|
+
/**
|
|
205
|
+
* StorageManager configuration (T1.1 / ADR-0007).
|
|
206
|
+
*
|
|
207
|
+
* Declares Postgres servers + databases + Redis servers. Consumed by
|
|
208
|
+
* `getStorageManager().configure()` at boot via `start.ts`.
|
|
209
|
+
*
|
|
210
|
+
* Default `undefined` means manager exists but is not configured — adapters
|
|
211
|
+
* relying on the manager (PostgresJobBackend.fromStorageManager, etc.) will
|
|
212
|
+
* throw with an actionable error on first use.
|
|
213
|
+
*/
|
|
214
|
+
storage: storageSchema.optional(),
|
|
215
|
+
/**
|
|
216
|
+
* Wave 2 — Polyglot services orchestration (T1.1 / ADR-0012/0013/0014/0015).
|
|
217
|
+
*
|
|
218
|
+
* Declarative external sidecar processes (Python FastAPI / Node Hono)
|
|
219
|
+
* that boot alongside the TheoKit TS app. Empty `services: {}` is the
|
|
220
|
+
* default and preserves Wave 1 behavior.
|
|
221
|
+
*/
|
|
222
|
+
services: servicesConfigSchema,
|
|
223
|
+
/**
|
|
224
|
+
* G2 — OpenAPI emit (build-time only).
|
|
225
|
+
*
|
|
226
|
+
* When present, `theokit build` writes a generated `openapi.json` from
|
|
227
|
+
* every `defineRoute()` body/query/params Zod schema. `undefined` keeps
|
|
228
|
+
* the framework backward-compatible (no emit). Pass `openapi: {}` to
|
|
229
|
+
* opt in with defaults.
|
|
230
|
+
*
|
|
231
|
+
* Defaults: spec 3.1.0 · servers `http://localhost:3000` · title
|
|
232
|
+
* "TheoKit App" · version "0.0.0" · outDir ".theokit" (next to dist).
|
|
233
|
+
*
|
|
234
|
+
* The env var `THEOKIT_OPENAPI_SERVERS` (CSV of URLs) overrides
|
|
235
|
+
* `servers[].url` at emit time without rebuilding the config.
|
|
236
|
+
*/
|
|
237
|
+
openapi: z.object({
|
|
238
|
+
servers: z.array(
|
|
239
|
+
z.object({
|
|
240
|
+
url: z.url(),
|
|
241
|
+
description: z.string().optional()
|
|
242
|
+
})
|
|
243
|
+
).default([{ url: "http://localhost:3000", description: "Local development" }]),
|
|
244
|
+
specVersion: z.enum(["3.1.0", "3.0.3"]).default("3.1.0"),
|
|
245
|
+
title: z.string().default("TheoKit App"),
|
|
246
|
+
version: z.string().default("0.0.0"),
|
|
247
|
+
outDir: z.string().default(".theokit")
|
|
248
|
+
}).optional(),
|
|
249
|
+
/**
|
|
250
|
+
* G5 T1.3 — error envelope transformer hook (blueprint ADR D3).
|
|
251
|
+
*
|
|
252
|
+
* When present, runs at framework error-boundary time to enrich the
|
|
253
|
+
* envelope with consumer-defined extensions (`hint`, custom telemetry
|
|
254
|
+
* tags, etc.) BEFORE the envelope is serialized to the client. The
|
|
255
|
+
* function signature is preserved via the explicit `FormatErrorHook`
|
|
256
|
+
* type — TS inference flows from `theo.config.ts` into `@theo/client`
|
|
257
|
+
* codegen and `@theokit/ui` AgentErrorCard consumers.
|
|
258
|
+
*
|
|
259
|
+
* Use `z.custom<FormatErrorHook>(...)` because Zod's built-in
|
|
260
|
+
* `z.function()` discards its TS signature after parse; `z.custom`
|
|
261
|
+
* with a function-typed runtime guard preserves the call-site type
|
|
262
|
+
* without trading off Zod runtime validation.
|
|
263
|
+
*/
|
|
264
|
+
formatError: z.custom((val) => typeof val === "function", {
|
|
265
|
+
message: "formatError must be a function"
|
|
266
|
+
}).optional()
|
|
267
|
+
}).refine((cfg) => !Object.values(cfg.services).some((s) => s.port === cfg.port), {
|
|
268
|
+
message: "service.port collides with TheoKit web port \u2014 change one of them",
|
|
269
|
+
path: ["services"]
|
|
270
|
+
});
|
|
271
|
+
|
|
272
|
+
export {
|
|
273
|
+
theoConfigSchema
|
|
274
|
+
};
|
|
275
|
+
//# sourceMappingURL=chunk-FH3SQR6P.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/config/schema.ts","../src/core/contracts/theo-ui-theme.ts"],"sourcesContent":["import { z } from 'zod'\n\nimport { THEME_NAME_PATTERN } from '../core/contracts/theo-ui-theme.js'\nimport { servicesConfigSchema } from '../services/index.js'\n\nimport {\n cacheSchema,\n loggingSchema,\n observabilitySchema,\n rateLimitSchema,\n securitySchema,\n storageSchema,\n uploadSchema,\n type FormatErrorContext,\n type FormatErrorHook,\n} from './schemas/index.js'\n\n// Re-export per-concern schemas + types so downstream consumers\n// (`adapters/*`, vite-plugin, generators) keep their existing imports valid.\n// Per plan T2.3 — pure structural split; zero behavior change at the call site.\n//\n// `rateLimitSchema` and `securitySchema` are NOT re-exported: they are composed into\n// `theoConfigSchema` below and nothing imports them from here. They remain available at their\n// source of truth, `./schemas/index.js`.\nexport { cacheSchema, corsSchema, securityHeadersSchema, storageSchema } from './schemas/index.js'\n\nexport type { StorageConfig } from './schemas/index.js'\n\n/**\n * Root `theo.config.ts` schema — composer assembled from the per-concern\n * primitives re-exported above.\n *\n * Embedded blocks that exist ONLY as part of the root config (`agents`,\n * `ui`, `devtools`, `jobs`, `openapi`) stay inline below. They have no\n * external consumers; splitting them would create lonely files (M5\n * smell) without comprehension benefit.\n */\nexport const theoConfigSchema = z\n .object({\n /**\n * Plan v1.2 T2.1 — project identifier propagated into\n * `.theokit/services.json` v2 `project` field. DNS-1123 compatible (drives\n * Gitea repo + ArgoCD App naming on TheoCloud). When omitted, the build\n * emits services.json v1 with the legacy `services-bundle` fallback\n * (ADR D10) and logs a deprecation warning.\n */\n name: z\n .string()\n .max(63)\n .refine(\n // DNS-1123 equivalent expressed as explicit single-char anchors so\n // security/detect-unsafe-regex stays clean (no backtracking).\n (value) =>\n value.length > 0 &&\n /^[a-z0-9-]+$/u.test(value) &&\n !value.startsWith('-') &&\n !value.endsWith('-'),\n 'name must match DNS-1123 (lowercase alphanumeric+hyphens, 1-63 chars, no leading/trailing hyphen)',\n )\n .optional(),\n appDir: z.string().default('app'),\n serverDir: z.string().default('server'),\n /**\n * Directory (relative to the project root) holding `agents/<name>.ts` definitions, scanned by\n * dev/build/terminal/mcp. Defaults to `\"agents\"` — apps that keep the canonical layout are\n * unaffected. Set to e.g. `\"core/agents\"` to organize agents under a domain root (#95 follow-up).\n */\n agentsDir: z.string().default('agents'),\n /**\n * T2.2 / EC-4 — Build output directory. Must be a relative path inside\n * the project root. Refused absolute or parent-relative paths to prevent\n * `cleanOutDir` from wiping arbitrary locations (defense-in-depth on\n * top of cleanOutDir's runtime EC-3 guard).\n */\n distDir: z\n .string()\n .default('.theokit')\n .refine(\n (d) => !/^([A-Za-z]:)?[/\\\\]/.test(d) && !d.startsWith('..'),\n 'distDir must be a relative path inside the project root (e.g., \".theokit\")',\n ),\n /**\n * Agent runtime configuration.\n *\n * - `maxRegistries` (T2.3, legacy): dev-mode cleanup of stale\n * `.theokit/agents/<id>/` dirs by mtime. Now superseded by SDK's\n * native registry GC but kept for backward-compat.\n * - `registry` (Phase 6, Production-Readiness #2): forwarded to\n * `Agent.registry.configure()` lazily on first request.\n * * `maxAgents` — LRU cap. MUST be ≥ max-concurrent-active-conversations\n * (EC-17 DOCUMENT): with maxAgents:1 and 2 concurrent chats, LRU evicts\n * mid-stream → SDK aborts with code:'aborted'. Default 100 covers\n * indie/small-team; tune up for high-traffic.\n * * `idleTimeoutMs` — auto-evict idle agents (default 30 min). 0 disables\n * idle eviction (LRU only).\n */\n agents: z\n .object({\n maxRegistries: z.number().int().positive().default(100),\n registry: z\n .object({\n /** LRU cap — MUST be ≥ max-concurrent-active-conversations. */\n maxAgents: z.number().int().positive().max(10_000).default(100),\n /** Idle eviction window in ms. 0 disables idle eviction (LRU only). */\n idleTimeoutMs: z\n .number()\n .int()\n .nonnegative()\n .default(30 * 60_000),\n })\n .optional(),\n })\n .optional(),\n port: z.number().int().min(1).max(65535).default(3000),\n /** Listen on all addresses (0.0.0.0) for LAN/mobile testing. */\n host: z.union([z.string(), z.boolean()]).default('localhost'),\n /** Automatically open browser on `theokit dev`. */\n open: z.union([z.boolean(), z.string()]).default(false),\n /** Exit if port is already in use instead of trying next available. */\n strictPort: z.boolean().default(false),\n /** Forward browser console/errors to terminal — useful for AI agent dev. */\n forwardConsole: z\n .union([\n z.boolean(),\n z.object({\n unhandledErrors: z.boolean().optional(),\n logLevels: z.array(z.enum(['error', 'warn', 'info', 'log', 'debug'])).optional(),\n }),\n ])\n .default(false),\n /** Pre-transform files on startup for faster first page load. */\n warmup: z\n .object({\n clientFiles: z.array(z.string()).optional(),\n ssrFiles: z.array(z.string()).optional(),\n })\n .optional(),\n ssr: z.boolean().default(false),\n /** When true (and ssr === true), use renderToPipeableStream with progressive\n * shell flush instead of single-shot renderToString. Opt-in for streaming\n * SSR; default false preserves the current behavior. */\n ssrStreaming: z.boolean().default(false),\n rateLimit: rateLimitSchema.optional(),\n upload: uploadSchema.optional(),\n logging: loggingSchema.optional(),\n security: securitySchema.optional(),\n serialization: z.enum(['json', 'superjson']).default('json'),\n // Plugins are validated structurally at runtime by createPluginRunnerFromConfig.\n // Zod only checks the shape minimally (must be array). Type-level safety is\n // provided through defineConfig at the user surface.\n //\n // #425 — an entry MAY also be a module SPECIFIER (a string), resolved to that module's default\n // export by `config/resolve-plugin-specifiers.ts`. A constructed plugin closes over state and\n // therefore has no literal, so it is the string form — and only the string form — that a\n // generated deploy entry can carry. Both shapes are accepted here for the same reason they are\n // accepted at runtime: one declaration has to serve the local server and the deployed one.\n plugins: z.array(z.unknown()).optional(),\n /** Enable client-side batching of theoFetch calls and the\n * /api/__theo_batch__ server endpoint. */\n batching: z\n .union([z.boolean(), z.object({ max: z.number().int().positive().optional() })])\n .optional(),\n /** T4.1 — Audit log. When `logger` is provided, framework events\n * (csrf.warn, rate-limit.exceeded, session.rotated, csp.violation) are\n * emitted to it. Default: noop. */\n audit: z\n .object({\n logger: z.unknown().optional(),\n })\n .optional(),\n /** TheoUI auto-wire (T2.1). `false` = opt-out; object = explicit theme/fonts;\n * undefined = enabled when @theokit/ui is detected in node_modules. */\n ui: z\n .union([\n z.literal(false),\n z.object({\n // Any theme @theokit/ui knows — built-in or from `defineTheme()`. This was a closed\n // enum of `violet-forge | noir | paper`, two of which never existed in @theokit/ui, so\n // the only accepted value was the default and every real theme was rejected. The pattern\n // mirrors what @theokit/ui's ThemeProvider enforces, and it is load-bearing: the value is\n // interpolated into the generated entry and into a CSS selector.\n theme: z\n .string()\n .regex(\n THEME_NAME_PATTERN,\n 'must start with a letter and contain only lowercase letters, digits and hyphens',\n )\n .optional(),\n fonts: z.enum(['bundled', 'cdn']).optional(),\n }),\n ])\n .optional(),\n /**\n * Cache subsystem (caching-and-revalidation-plan).\n * Default `undefined` keeps caching disabled (backward compatible).\n * Pass `cache: {}` to opt in with defaults.\n */\n cache: cacheSchema.optional(),\n /**\n * Observability (#353). Default `undefined` keeps telemetry off. Present and\n * not `enabled: false` opts in; `provider` overrides the environment-derived\n * adapter, which is the priority `adapter-registry.ts` has always documented.\n */\n observability: observabilitySchema.optional(),\n /**\n * Devtools overlay (Phase 0.4.0+ —\n *\n * - `undefined` (default): devtools auto-injects in `pnpm dev`, NEVER in `vite build`.\n * - `false`: devtools disabled entirely (Vite plugin skips injection even in dev).\n * - `{ ... }`: devtools enabled with explicit defaults (position, theme).\n *\n * Tree-shaken to noop in prod via the dual-export pattern in\n * `packages/theo/src/devtools/index.ts` (EC-17 positive prod check).\n */\n devtools: z\n .union([\n z.literal(false),\n z.object({\n position: z.enum(['top-left', 'top-right', 'bottom-left', 'bottom-right']).optional(),\n theme: z.enum(['light', 'dark', 'system']).optional(),\n }),\n ])\n .optional(),\n /**\n * Informative list of deploy adapters the app supports. Does NOT\n * trigger per-build translations — only the `--target` CLI flag does\n * (EC-201 / ADR D2). If `config.adapters` includes a target NOT\n * matching `--target`, `theokit build` emits a cross-reference note.\n */\n adapters: z.array(z.string()).optional(),\n /**\n * Extra package names to pre-bundle via Vite's `optimizeDeps.include`.\n *\n * Framework auto-includes `@theokit/ui` and `lucide-react` when present.\n * Apps adding plugin peer-deps that rely on a runtime `import('<pkg>')`\n * (dynamic specifier) — e.g. `@theokit/plugin-canvas` consumers\n * installing `mermaid` for Mermaid SVG rendering — must declare those\n * here so Vite can resolve the literal in dev mode without\n * \"Failed to resolve module specifier\" errors. Production builds use\n * tsup/esbuild bundling and are not affected.\n *\n * Example:\n * viteOptimizeDeps: ['mermaid']\n */\n viteOptimizeDeps: z.array(z.string()).optional(),\n /**\n * Jobs backend (ADR D3 + T2.1). When configured, every request gets\n * `ctx.queue.enqueue` auto-wired via the outbox lifecycle. Pass a\n * `JobBackend` instance (InMemoryJobBackend, PostgresJobBackend, etc.).\n */\n jobs: z\n .object({\n backend: z.custom<unknown>((v) => typeof v === 'object' && v !== null),\n })\n .optional(),\n /**\n * StorageManager configuration (T1.1 / ADR-0007).\n *\n * Declares Postgres servers + databases + Redis servers. Consumed by\n * `getStorageManager().configure()` at boot via `start.ts`.\n *\n * Default `undefined` means manager exists but is not configured — adapters\n * relying on the manager (PostgresJobBackend.fromStorageManager, etc.) will\n * throw with an actionable error on first use.\n */\n storage: storageSchema.optional(),\n /**\n * Wave 2 — Polyglot services orchestration (T1.1 / ADR-0012/0013/0014/0015).\n *\n * Declarative external sidecar processes (Python FastAPI / Node Hono)\n * that boot alongside the TheoKit TS app. Empty `services: {}` is the\n * default and preserves Wave 1 behavior.\n */\n services: servicesConfigSchema,\n /**\n * G2 — OpenAPI emit (build-time only).\n *\n * When present, `theokit build` writes a generated `openapi.json` from\n * every `defineRoute()` body/query/params Zod schema. `undefined` keeps\n * the framework backward-compatible (no emit). Pass `openapi: {}` to\n * opt in with defaults.\n *\n * Defaults: spec 3.1.0 · servers `http://localhost:3000` · title\n * \"TheoKit App\" · version \"0.0.0\" · outDir \".theokit\" (next to dist).\n *\n * The env var `THEOKIT_OPENAPI_SERVERS` (CSV of URLs) overrides\n * `servers[].url` at emit time without rebuilding the config.\n */\n openapi: z\n .object({\n servers: z\n .array(\n z.object({\n url: z.url(),\n description: z.string().optional(),\n }),\n )\n .default([{ url: 'http://localhost:3000', description: 'Local development' }]),\n specVersion: z.enum(['3.1.0', '3.0.3']).default('3.1.0'),\n title: z.string().default('TheoKit App'),\n version: z.string().default('0.0.0'),\n outDir: z.string().default('.theokit'),\n })\n .optional(),\n /**\n * G5 T1.3 — error envelope transformer hook (blueprint ADR D3).\n *\n * When present, runs at framework error-boundary time to enrich the\n * envelope with consumer-defined extensions (`hint`, custom telemetry\n * tags, etc.) BEFORE the envelope is serialized to the client. The\n * function signature is preserved via the explicit `FormatErrorHook`\n * type — TS inference flows from `theo.config.ts` into `@theo/client`\n * codegen and `@theokit/ui` AgentErrorCard consumers.\n *\n * Use `z.custom<FormatErrorHook>(...)` because Zod's built-in\n * `z.function()` discards its TS signature after parse; `z.custom`\n * with a function-typed runtime guard preserves the call-site type\n * without trading off Zod runtime validation.\n */\n formatError: z\n .custom<FormatErrorHook>((val) => typeof val === 'function', {\n message: 'formatError must be a function',\n })\n .optional(),\n })\n // EC-2 fix: cross-config refine — no service may share TheoKit's web port.\n .refine((cfg) => !Object.values(cfg.services).some((s) => s.port === cfg.port), {\n message: 'service.port collides with TheoKit web port — change one of them',\n path: ['services'],\n })\n\nexport type TheoConfig = z.infer<typeof theoConfigSchema>\n\n// Silence unused-import warnings for type-only re-exports — TS strips at compile,\n// but exports above re-introduce them for downstream consumers.\ntype _FormatErrorContext = FormatErrorContext\n","/**\n * The `@theokit/ui` theme name — a contract shared by the config schema, the entry generators and\n * the Vite plugin's detector.\n *\n * It lives in `core/contracts/` because those three sit in different modules that may not depend on\n * one another: `config/` and `router/` are allowed to reach into `core/` only. Before this file the\n * union was written out separately in all three places, and all three drifted from what the design\n * system actually ships.\n */\n\n/**\n * Theme names `@theokit/ui` ships today — an autocomplete hint, NOT the accepted set.\n *\n * The accepted set used to be exactly `'violet-forge' | 'noir' | 'paper'`, and two of those three\n * were never real: the design system has no `noir` and no `paper`. So the only value config\n * validation accepted was the default, and every genuine theme — plus anything from\n * `defineTheme()` — was rejected.\n *\n * A closed union here is a copy of another package's catalogue; it rots the moment that package\n * ships a theme. This list is therefore advisory, and {@link TheoUiTheme} stays open. The\n * authoritative list is `builtinThemes`, exported by `@theokit/ui`.\n */\nexport type BuiltinThemeName =\n | 'violet-forge'\n | 'falcon-red'\n | 'classic-paper'\n | 'aurora-terminal'\n | 'vercel-mono'\n | 'github-dark'\n | 'dracula'\n | 'one-dark'\n | 'anthropic-style'\n | 'openai-style'\n | 'linear-glass'\n\n/**\n * A theme name. Built-ins autocomplete; a custom theme from `defineTheme()` is equally valid.\n *\n * `(string & {})` is the idiomatic way to keep literal suggestions on an open union — without it\n * TypeScript widens the whole type to `string` and the hints disappear.\n */\nexport type TheoUiTheme = BuiltinThemeName | (string & {})\n\n/** How fonts are delivered — bundled with the app, or fetched from a CDN. */\nexport type TheoUiFonts = 'bundled' | 'cdn'\n\n/**\n * The shape a theme name must have — mirrors the pattern `@theokit/ui`'s `ThemeProvider` enforces\n * before it writes `[data-theme=\"<name>\"]`.\n *\n * Validating here is not cosmetic. The value is interpolated into the generated entry\n * (`defaultTheme: '<name>'`) and into a CSS selector, so an unchecked name is a code-injection\n * vector — and anything this rejects would be rejected by the provider anyway, so the developer\n * gets the error at config time instead of at render time.\n */\nexport const THEME_NAME_PATTERN = /^[a-z][a-z0-9-]*$/\n"],"mappings":";;;;;;;;;;;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O,IAAI,QAAQ,EAAE,KAAK,CAAC,MAAM,EAAE,SAAS,IAAI,IAAI,GAAG;AAAA,EAC9E,SAAS;AAAA,EACT,MAAM,CAAC,UAAU;AACnB,CAAC;","names":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// src/server/observability/define-adapter.ts
|
|
2
|
+
function defineObservabilityAdapter(config) {
|
|
3
|
+
return {
|
|
4
|
+
name: config.name,
|
|
5
|
+
startSpan: (name, attrs, context) => config.startSpan(name, attrs, context),
|
|
6
|
+
counter: (name, value, attrs) => {
|
|
7
|
+
config.counter(name, value, attrs);
|
|
8
|
+
},
|
|
9
|
+
histogram: (name, value, attrs) => {
|
|
10
|
+
config.histogram(name, value, attrs);
|
|
11
|
+
},
|
|
12
|
+
log: (level, message, attrs) => {
|
|
13
|
+
config.log(level, message, attrs);
|
|
14
|
+
},
|
|
15
|
+
flush: () => config.flush(),
|
|
16
|
+
shutdown: () => config.shutdown()
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export {
|
|
21
|
+
defineObservabilityAdapter
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=chunk-HJHGTFEJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/server/observability/define-adapter.ts"],"mappings":";AAsDO,SAAS,2BAA2B,QAAmD;AAC5F,SAAO;AAAA,IACL,MAAM,OAAO;AAAA,IACb,WAAW,CAAC,MAAM,OAAO,YAAY,OAAO,UAAU,MAAM,OAAO,OAAO;AAAA,IAC1E,SAAS,CAAC,MAAM,OAAO,UAAU;AAC/B,aAAO,QAAQ,MAAM,OAAO,KAAK;AAAA,IACnC;AAAA,IACA,WAAW,CAAC,MAAM,OAAO,UAAU;AACjC,aAAO,UAAU,MAAM,OAAO,KAAK;AAAA,IACrC;AAAA,IACA,KAAK,CAAC,OAAO,SAAS,UAAU;AAC9B,aAAO,IAAI,OAAO,SAAS,KAAK;AAAA,IAClC;AAAA,IACA,OAAO,MAAM,OAAO,MAAM;AAAA,IAC1B,UAAU,MAAM,OAAO,SAAS;AAAA,EAClC;AACF;","names":[]}
|
|
@@ -3,13 +3,16 @@ import {
|
|
|
3
3
|
} from "./chunk-VZTYCAO6.js";
|
|
4
4
|
import {
|
|
5
5
|
generateNewTraceContext
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-UMNXCU3K.js";
|
|
7
7
|
import {
|
|
8
8
|
importUserModule
|
|
9
9
|
} from "./chunk-52PDWL5S.js";
|
|
10
10
|
import {
|
|
11
11
|
walkSourceFiles
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-5K4TDLRG.js";
|
|
13
|
+
import {
|
|
14
|
+
compareByCodeUnit
|
|
15
|
+
} from "./chunk-ZWN3AODA.js";
|
|
13
16
|
|
|
14
17
|
// src/server/cron/cron-validate.ts
|
|
15
18
|
import { CronExpressionParser } from "cron-parser";
|
|
@@ -372,7 +375,7 @@ async function scanCronDirs(dirs) {
|
|
|
372
375
|
throw new DuplicateCronNameError(name, paths);
|
|
373
376
|
}
|
|
374
377
|
}
|
|
375
|
-
return nodes.sort((a, b) => a.name
|
|
378
|
+
return nodes.sort((a, b) => compareByCodeUnit(a.name, b.name));
|
|
376
379
|
}
|
|
377
380
|
|
|
378
381
|
export {
|
|
@@ -392,4 +395,4 @@ export {
|
|
|
392
395
|
scanCrons,
|
|
393
396
|
scanCronDirs
|
|
394
397
|
};
|
|
395
|
-
//# sourceMappingURL=chunk-
|
|
398
|
+
//# sourceMappingURL=chunk-HK4AZBKX.js.map
|