@xano/sdk 1.0.15 → 1.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (290) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +33 -37
  3. package/dist/.build-fingerprint +1 -1
  4. package/dist/{agent-file-refresh-ZRGNOA6Q.js → agent-file-refresh-DBHTEFYM.js} +12 -12
  5. package/dist/{agent-skill-command-DV26SDA2.js → agent-skill-command-LHNTU7MH.js} +74 -73
  6. package/dist/{answer-shape-AVZSKBR6.js → answer-shape-ZRQS7ZC4.js} +5 -5
  7. package/dist/{backend-dir-NTMXWE5R.js → backend-dir-AXR43HNV.js} +11 -11
  8. package/dist/{backend-slot-DZAUHLTS.js → backend-slot-7BATLL3X.js} +4 -4
  9. package/dist/bin.js +64 -63
  10. package/dist/{branch-IJTBZZFO.js → branch-SJKKUCMZ.js} +9 -9
  11. package/dist/branch-commands-KGR52SZU.js +80 -0
  12. package/dist/bundle.d.ts +2 -2
  13. package/dist/bundle.js +15 -69
  14. package/dist/{capture-GW5KNKMB.js → capture-RYBJE25P.js} +5 -5
  15. package/dist/{chunk-66ZU2CD5.js → chunk-23GEFHRX.js} +236 -17
  16. package/dist/{chunk-3H7R4ISR.js → chunk-2DUYJR5N.js} +2 -2
  17. package/dist/{chunk-MFWF2NZJ.js → chunk-2H5BQRHF.js} +2 -2
  18. package/dist/{chunk-O44MJTLR.js → chunk-35SI4GBM.js} +3 -3
  19. package/dist/{chunk-ZYECXDVV.js → chunk-3ZV23FVR.js} +5 -5
  20. package/dist/{chunk-N72XNQNJ.js → chunk-47XIVDJ6.js} +14 -14
  21. package/dist/{chunk-ICK36EGF.js → chunk-4EVDCSEY.js} +2 -2
  22. package/dist/{chunk-AXMUYBWQ.js → chunk-4XGZ325S.js} +3 -3
  23. package/dist/{chunk-P7GKTV7N.js → chunk-4XYXUK5H.js} +75 -32
  24. package/dist/{chunk-AE5CRAKS.js → chunk-4ZBXS7YN.js} +8 -8
  25. package/dist/{chunk-JWASCOHO.js → chunk-52QAENY6.js} +14 -14
  26. package/dist/{chunk-2LF734YB.js → chunk-54CJ74BH.js} +4 -4
  27. package/dist/{chunk-TT6LN55R.js → chunk-57PGTPT3.js} +8 -8
  28. package/dist/{chunk-IKXXTRMN.js → chunk-64UVVLDT.js} +4 -4
  29. package/dist/{chunk-EQXHUWUO.js → chunk-6FCAFWD5.js} +2 -2
  30. package/dist/{chunk-4MX5LMPQ.js → chunk-6ODQ5GDZ.js} +2 -2
  31. package/dist/{chunk-G4WRZU5T.js → chunk-74YCPI4G.js} +7 -7
  32. package/dist/{chunk-Y5XAPLZS.js → chunk-7UQZ7C4W.js} +4 -4
  33. package/dist/{chunk-CJDPSCMX.js → chunk-7ZVQIKNL.js} +3 -3
  34. package/dist/{chunk-RVAEPPRH.js → chunk-AICWDCLJ.js} +2 -2
  35. package/dist/{chunk-WS4BA75E.js → chunk-AJBOGO5U.js} +4 -4
  36. package/dist/{chunk-FOBVJ2UR.js → chunk-AJQFUJEQ.js} +8 -8
  37. package/dist/{chunk-DH6O5NQU.js → chunk-C7AYP4H6.js} +29 -20
  38. package/dist/{chunk-SXMZNSQ6.js → chunk-DJMGDCVX.js} +8 -8
  39. package/dist/{chunk-K6SWZ6H4.js → chunk-DLD4FVRP.js} +54 -54
  40. package/dist/{chunk-Q7DGTQ5G.js → chunk-E34VGSCI.js} +2 -1
  41. package/dist/{chunk-YR3MNGWZ.js → chunk-E5M5P23K.js} +8 -8
  42. package/dist/{chunk-HJZUI2ZU.js → chunk-EAZTRU75.js} +2 -2
  43. package/dist/{chunk-V7WCTXEH.js → chunk-EINZSVEU.js} +5 -5
  44. package/dist/{chunk-KMKUH2IO.js → chunk-EPB6FAR5.js} +5 -5
  45. package/dist/chunk-EUAU4QKI.js +67 -0
  46. package/dist/{chunk-IDOVZLPK.js → chunk-EXJ4Q5F6.js} +2 -2
  47. package/dist/{chunk-FKQX6KU7.js → chunk-F3JK5RIY.js} +2 -2
  48. package/dist/{chunk-W2QFR3ZJ.js → chunk-FIOC7RSU.js} +2 -2
  49. package/dist/{chunk-YEH5OIPF.js → chunk-FMXPV5JI.js} +39 -11
  50. package/dist/{chunk-GVHWIDEJ.js → chunk-FRJB3NTE.js} +10 -5
  51. package/dist/{chunk-VIRFG3WG.js → chunk-FTFAPKCW.js} +23 -7
  52. package/dist/{chunk-LL6ED5IB.js → chunk-FTS42N37.js} +2 -2
  53. package/dist/{chunk-MIS6F4HM.js → chunk-G2XSDIYS.js} +4 -4
  54. package/dist/{chunk-ZY55DO5P.js → chunk-G6BEJ3NA.js} +2 -2
  55. package/dist/{chunk-RYWNNJK5.js → chunk-GA6HTO3O.js} +2 -2
  56. package/dist/{chunk-JIKGT7DO.js → chunk-GE3JV5SI.js} +1 -1
  57. package/dist/{chunk-GCINMMFL.js → chunk-GJZMKMWO.js} +2 -2
  58. package/dist/{chunk-VXHXSGPU.js → chunk-GRZ62LLU.js} +8 -8
  59. package/dist/{chunk-6X73VFCX.js → chunk-GT7PZCTK.js} +2 -2
  60. package/dist/{chunk-SH4RY6QX.js → chunk-HXPQXCOZ.js} +1536 -413
  61. package/dist/{chunk-ECQXASG3.js → chunk-IFHFJR5O.js} +2 -2
  62. package/dist/{chunk-7ZQ73AHJ.js → chunk-IOWNQEMW.js} +31 -31
  63. package/dist/{chunk-YCKKL5PD.js → chunk-ISIZFK5Q.js} +53 -47
  64. package/dist/{chunk-HCNIB3EC.js → chunk-IUJDUFT7.js} +4 -4
  65. package/dist/{chunk-74OPNM2Z.js → chunk-JHAZK4RY.js} +3 -3
  66. package/dist/{chunk-OZWAITII.js → chunk-KGHJ74HF.js} +6 -6
  67. package/dist/{chunk-XLP4CNSF.js → chunk-L2O5KG5Q.js} +6 -6
  68. package/dist/{chunk-NNI5R6V6.js → chunk-L3Q2QYIQ.js} +72 -72
  69. package/dist/{chunk-UNFQN3TT.js → chunk-LLBEPJBO.js} +3 -3
  70. package/dist/{chunk-VUWR5YLE.js → chunk-LWBGPPI5.js} +13 -13
  71. package/dist/{chunk-RBTZEHXF.js → chunk-MBSHONP3.js} +3 -3
  72. package/dist/{chunk-GKQTXUOW.js → chunk-MOVRSULZ.js} +2 -2
  73. package/dist/{chunk-QAEBBTYR.js → chunk-MSYMEP7Y.js} +7 -7
  74. package/dist/{chunk-Y453TW6J.js → chunk-NCERS5QH.js} +2 -2
  75. package/dist/{chunk-HXFLHA5K.js → chunk-NH5Z2NOD.js} +2 -2
  76. package/dist/{chunk-T3HNISBN.js → chunk-NJVY3GAX.js} +3 -3
  77. package/dist/{chunk-ZF2CBXT5.js → chunk-NQPPUNWP.js} +3 -3
  78. package/dist/{chunk-5SKWGCAJ.js → chunk-O7Z3LF44.js} +5 -5
  79. package/dist/{chunk-ASQX477B.js → chunk-OLXYZQR7.js} +7 -7
  80. package/dist/{chunk-5SJQAJLF.js → chunk-OQNYZ2OM.js} +3 -3
  81. package/dist/{chunk-DBDTQR23.js → chunk-OTQF4B37.js} +4 -4
  82. package/dist/{chunk-GBSHHNSD.js → chunk-PRSNMSVG.js} +3 -3
  83. package/dist/{chunk-DGYXCIBV.js → chunk-Q6AKSLD2.js} +2 -2
  84. package/dist/{chunk-WXKSB2N3.js → chunk-Q7KXMIR3.js} +3 -3
  85. package/dist/{chunk-B6AFJVG4.js → chunk-QCVH32T2.js} +5 -5
  86. package/dist/{chunk-7FIMUFBP.js → chunk-QDPY7RN3.js} +3 -3
  87. package/dist/{chunk-MGG4CHO4.js → chunk-QIT2GGNB.js} +3 -3
  88. package/dist/{chunk-QW7NGUYW.js → chunk-QSJH5AFU.js} +244 -173
  89. package/dist/{chunk-3GZMP7II.js → chunk-R7DS2TRZ.js} +38 -22
  90. package/dist/{chunk-BEKEOXNG.js → chunk-RGPHFHJU.js} +2 -2
  91. package/dist/{chunk-5FJ4M4HB.js → chunk-RHH6SCB4.js} +17 -32
  92. package/dist/{chunk-M7O3T7IM.js → chunk-RIT3WBBX.js} +4 -4
  93. package/dist/{chunk-45K2QZBR.js → chunk-RKNCISPM.js} +3 -3
  94. package/dist/{chunk-NPYYDTXS.js → chunk-RKTVXFBV.js} +5 -5
  95. package/dist/{chunk-AXNX4NWN.js → chunk-RLQX6LHW.js} +37 -37
  96. package/dist/{chunk-FIERONKM.js → chunk-ROWYW3JF.js} +2 -2
  97. package/dist/{chunk-LSJ3SQEU.js → chunk-RVWWNNZQ.js} +4 -4
  98. package/dist/{chunk-A2N2C2WD.js → chunk-S7MVI4W7.js} +7 -7
  99. package/dist/{chunk-4MIV244X.js → chunk-SGEOXJIH.js} +9 -2
  100. package/dist/{chunk-QRMKQYCB.js → chunk-SINL5WMI.js} +2 -2
  101. package/dist/{chunk-Z6N5N4MN.js → chunk-SIW2HT2H.js} +21 -5
  102. package/dist/{chunk-IEDQT4Z3.js → chunk-SOAZIMWL.js} +12 -12
  103. package/dist/{chunk-R3GPRNBT.js → chunk-SVQMDVND.js} +87 -16
  104. package/dist/{chunk-45ZUMF4E.js → chunk-TPUAXIPR.js} +2 -2
  105. package/dist/{chunk-SL55XKVL.js → chunk-TXU34ELY.js} +25 -25
  106. package/dist/{chunk-GDJCWQIK.js → chunk-U4UAWGIT.js} +12 -8
  107. package/dist/{chunk-76SBT7KS.js → chunk-U56HK2RG.js} +7 -5
  108. package/dist/{chunk-RXNMZM6H.js → chunk-UDW2KAVF.js} +6 -6
  109. package/dist/{chunk-NDV6CBR7.js → chunk-UH5VQGNR.js} +2 -2
  110. package/dist/{chunk-75QC66XI.js → chunk-V2MIBJZU.js} +2 -2
  111. package/dist/{chunk-ZDVVIJPU.js → chunk-VAQPQXOI.js} +4 -4
  112. package/dist/{chunk-XPSDDTUZ.js → chunk-VCFRALU7.js} +3 -3
  113. package/dist/{chunk-5KJBWIDZ.js → chunk-VQDVEHDB.js} +2 -2
  114. package/dist/{chunk-6EFXPTHT.js → chunk-WAP5362D.js} +5 -5
  115. package/dist/{chunk-XY4OBD26.js → chunk-WGKKDGSA.js} +4 -4
  116. package/dist/{chunk-TXFOQZUQ.js → chunk-WVVUE7LU.js} +14 -7
  117. package/dist/{chunk-JAYHFXWH.js → chunk-WXQ7BHVQ.js} +7 -7
  118. package/dist/{chunk-7REDHC4N.js → chunk-X5NF3ZXW.js} +69 -14
  119. package/dist/{chunk-5W7S2SCA.js → chunk-XAE4NIZ2.js} +4 -4
  120. package/dist/{chunk-SPLRKCFV.js → chunk-XDGLYIB2.js} +2 -2
  121. package/dist/{chunk-7AKH4QDJ.js → chunk-XKMZYU5B.js} +96 -65
  122. package/dist/{chunk-UVHSMANV.js → chunk-Y3RH35KM.js} +47 -47
  123. package/dist/{chunk-GIQIMWTK.js → chunk-YHT7TDSH.js} +14 -14
  124. package/dist/{chunk-FXZEZAV2.js → chunk-YJXJOMXW.js} +3 -3
  125. package/dist/{chunk-ZPJXWMHK.js → chunk-YPLHVRMS.js} +4 -4
  126. package/dist/{chunk-WS2X5BB2.js → chunk-YYBBJPCL.js} +5 -5
  127. package/dist/{chunk-ZOHEHIFS.js → chunk-YYDM4DNP.js} +2 -2
  128. package/dist/{chunk-ZC6H2ERE.js → chunk-ZF4LCHCT.js} +5 -5
  129. package/dist/{chunk-GRXX2TOJ.js → chunk-ZHFSIQ6E.js} +2 -2
  130. package/dist/{chunk-SHHXLI2K.js → chunk-ZJQFKBX7.js} +7 -7
  131. package/dist/{chunk-ZRXDPCMN.js → chunk-ZYZ7GRX3.js} +2 -2
  132. package/dist/{chunk-CJGLAQRD.js → chunk-ZZC5VSLP.js} +4 -4
  133. package/dist/cli.d.ts +3 -3
  134. package/dist/cli.js +62 -61
  135. package/dist/codegen-command-NAY6YAOD.js +183 -0
  136. package/dist/codegen.d.ts +3 -3
  137. package/dist/codegen.js +5 -5
  138. package/dist/{commands-5ILSWDSV.js → commands-Z2QZOORB.js} +3 -3
  139. package/dist/{completion-UNKBVVDT.js → completion-LFXXNQGR.js} +3 -3
  140. package/dist/{config-NTOASFCA.js → config-7GGINOFY.js} +4 -4
  141. package/dist/{deploy-command-BYAZZF37.js → deploy-command-PBM3S4ZL.js} +69 -68
  142. package/dist/{deploy-source-QCPZWNJO.js → deploy-source-JW7DAN75.js} +32 -32
  143. package/dist/{dev-env-sync-6MHK3UHC.js → dev-env-sync-FHJTFH3V.js} +63 -62
  144. package/dist/{diagnostics-FNVNRYMB.js → diagnostics-T3RN3372.js} +2 -2
  145. package/dist/{display-name-hint-MYXCCAOP.js → display-name-hint-5GLJGPQ6.js} +11 -11
  146. package/dist/{emit-YLt3GfsZ.d.ts → emit-t-gDE1BL.d.ts} +181 -93
  147. package/dist/env-example-refresh-HHEGMFNH.js +136 -0
  148. package/dist/{env-pull-command-KUIEKBTM.js → env-pull-command-FFPNRVWD.js} +52 -52
  149. package/dist/{env-target-Y77RLRS5.js → env-target-XHVRZXHX.js} +14 -14
  150. package/dist/{env-var-command-BZWJD75C.js → env-var-command-DJS62YRR.js} +41 -41
  151. package/dist/{ephemeral-VLPRDNEJ.js → ephemeral-2DXWP3VK.js} +9 -9
  152. package/dist/{ephemeral-command-SYKDPALW.js → ephemeral-command-VLQIQ5TS.js} +52 -52
  153. package/dist/{ephemeral-state-RUOU2GFS.js → ephemeral-state-56XEDUJW.js} +12 -12
  154. package/dist/{generate-command-CSQDQZSW.js → generate-command-PSDIIOTU.js} +89 -88
  155. package/dist/{gitignore-OQGYM7DO.js → gitignore-PMJ6MFNA.js} +15 -15
  156. package/dist/{guards-JUYBDLZY.js → guards-YICHJKX3.js} +51 -15
  157. package/dist/{impersonate-command-HSFCZBV6.js → impersonate-command-IKV4KUYA.js} +37 -37
  158. package/dist/{import-T4ZTOTBT.js → import-VJQGIS33.js} +5 -5
  159. package/dist/index.d.ts +552 -117
  160. package/dist/index.js +29 -28
  161. package/dist/init-command-LEQIE6GC.js +143 -0
  162. package/dist/{init-modules-BL2SR5RK.js → init-modules-G47Q7ABV.js} +8 -8
  163. package/dist/{init-web-DYE2FEXL.js → init-web-25QJ4JWB.js} +3 -3
  164. package/dist/internal.d.ts +55 -8
  165. package/dist/internal.js +692 -503
  166. package/dist/{io-PGTCBSIQ.js → io-47TFRYDB.js} +6 -6
  167. package/dist/{keep-data-merge-SHF75FC7.js → keep-data-merge-XCPCX7BZ.js} +38 -38
  168. package/dist/{lambda-config-reconcile-VOBVZPWS.js → lambda-config-reconcile-CC5QIP6E.js} +3 -3
  169. package/dist/{landed-F7PCHGCK.js → landed-VIUFHLCJ.js} +5 -5
  170. package/dist/{landing-record-7EOLEKH3.js → landing-record-JQ7HZDGI.js} +22 -22
  171. package/dist/{live-diff-M2OLXKM6.js → live-diff-KJ2TWWWT.js} +14 -14
  172. package/dist/{local-engine-choice-TOC3UYZZ.js → local-engine-choice-DFAMYOIF.js} +35 -35
  173. package/dist/{local-engine-command-6KSRDZBR.js → local-engine-command-5RP2J5QZ.js} +40 -40
  174. package/dist/{local-engine-deploy-4N4NFZ4T.js → local-engine-deploy-XAEDT55W.js} +12 -12
  175. package/dist/{local-engine-lookup-AQTUGSBT.js → local-engine-lookup-WBYTY2JE.js} +2 -2
  176. package/dist/{local-engine-mcp-bridge-AMYRH4SY.js → local-engine-mcp-bridge-3H5OXBWQ.js} +5 -5
  177. package/dist/{local-engine-mcp-command-XTP3EATV.js → local-engine-mcp-command-JSYVVZKK.js} +42 -42
  178. package/dist/{local-engine-process-OD5OSWDG.js → local-engine-process-35B2KQED.js} +7 -7
  179. package/dist/{local-engine-update-check-G3YCBXRE.js → local-engine-update-check-VXJZSIJU.js} +5 -5
  180. package/dist/{lock-HDCHD2ON.js → lock-JBKTDEDO.js} +4 -4
  181. package/dist/{lock-commands-437P6BHY.js → lock-commands-7VO6YWOV.js} +67 -66
  182. package/dist/{login-command-BNRDAVFV.js → login-command-WTZUBCW6.js} +27 -27
  183. package/dist/{logout-command-FCGCHB7Y.js → logout-command-5BJUNK3C.js} +17 -17
  184. package/dist/{loop-WOAEXMTC.js → loop-HILLODVH.js} +15 -15
  185. package/dist/{marketplace-command-SUBJZPJV.js → marketplace-command-NMOH4XOV.js} +30 -30
  186. package/dist/{marketplace-resolve-JR4BBJ6K.js → marketplace-resolve-63QWMQZU.js} +6 -6
  187. package/dist/{meta-client-AYJS3RQ3.js → meta-client-MRAMWUKV.js} +15 -15
  188. package/dist/{module-manifest-63I5GRK4.js → module-manifest-NWJWAQLQ.js} +4 -4
  189. package/dist/node.d.ts +8 -8
  190. package/dist/node.js +71 -70
  191. package/dist/{operation-outcome-ORQPVJKB.js → operation-outcome-WK7UW6PJ.js} +24 -24
  192. package/dist/{output-target-KNHHNDM3.js → output-target-5PYRCCK4.js} +16 -16
  193. package/dist/{plan-disclosure-4DUFRGCP.js → plan-disclosure-6MG4YYJV.js} +28 -28
  194. package/dist/{plugin-contributions-YYEP7IWH.js → plugin-contributions-DD6R6RL6.js} +5 -5
  195. package/dist/{plugin-prompt-GKCQKNYI.js → plugin-prompt-UX2TT5NS.js} +5 -5
  196. package/dist/{plugin-questions-P7MA3TYI.js → plugin-questions-WE2F4ZC4.js} +4 -4
  197. package/dist/{preflight-command-32GFVKSN.js → preflight-command-3BX2WW3S.js} +75 -74
  198. package/dist/{profile-command-U2XTKOMF.js → profile-command-GSUX3UMB.js} +28 -28
  199. package/dist/{profile-pointer-JJ7K5O2R.js → profile-pointer-RCPHVTJV.js} +4 -4
  200. package/dist/{project-dependency-X3KCWBK5.js → project-dependency-TPVV3YIX.js} +7 -7
  201. package/dist/{project-sdk-YHJZRCNB.js → project-sdk-DKZBK5H5.js} +4 -4
  202. package/dist/promote-command-3LQTXWCD.js +149 -0
  203. package/dist/{prompt-QNMJIWNI.js → prompt-OYQHQWKI.js} +4 -4
  204. package/dist/{publish-command-5ZVZ6IYT.js → publish-command-3BQCV4NE.js} +72 -71
  205. package/dist/pull-command-B7OVWTZD.js +171 -0
  206. package/dist/{pull-superseded-6HADGGC5.js → pull-superseded-3SSM3JFT.js} +4 -4
  207. package/dist/{raw-where-gWGr-E4t.d.ts → raw-where-CinW0keO.d.ts} +32 -4
  208. package/dist/release-command-XSDICMJE.js +153 -0
  209. package/dist/{release-ns-command-LDN5DOKQ.js → release-ns-command-EVAHK4CU.js} +96 -95
  210. package/dist/{retry-command-LFZYEVRU.js → retry-command-WP4ZI6CJ.js} +8 -8
  211. package/dist/{routes-manifest-BMAOL6WN.js → routes-manifest-N73THJB3.js} +16 -16
  212. package/dist/routes-manifest-file-LDUDIVFJ.js +41 -0
  213. package/dist/scaffold.js +2 -2
  214. package/dist/{secrets-file-7QM3ORGX.js → secrets-file-7XWR7HW3.js} +15 -15
  215. package/dist/{secrets-fill-command-OZ537VOD.js → secrets-fill-command-NKCGC75L.js} +66 -65
  216. package/dist/{seed-ATGBOEJP.js → seed-YKTZDS2Q.js} +13 -13
  217. package/dist/{source-resolve-QYSWA3QR.js → source-resolve-CQGDFQQC.js} +22 -22
  218. package/dist/{static-host-MO4VDHL7.js → static-host-3HPZKVKK.js} +5 -5
  219. package/dist/{status-command-IEB4K7ME.js → status-command-TBMQ3GJP.js} +38 -38
  220. package/dist/{store-AJX4MC7Y.js → store-B63BQV6R.js} +6 -6
  221. package/dist/{store-DspGMsFY.d.ts → store-in7gSpMS.d.ts} +185 -11
  222. package/dist/sync-baseline-GRS33AB5.js +38 -0
  223. package/dist/{sync-contributions-DLV5JZUK.js → sync-contributions-RKPLZPPO.js} +9 -9
  224. package/dist/{sync-record-NE62ERA3.js → sync-record-AWFCSS4D.js} +15 -15
  225. package/dist/{table-TFD4ZQXA.js → table-ONGT3JGE.js} +12 -12
  226. package/dist/{tables-command-IMCVPUFY.js → tables-command-UYQ277TJ.js} +41 -41
  227. package/dist/{tenant-IIYECNWO.js → tenant-IXIW3FOI.js} +10 -10
  228. package/dist/{tenant-command-77KG76MU.js → tenant-command-7LWZUK2V.js} +104 -103
  229. package/dist/{test-command-NSPU4RUO.js → test-command-7KTT5EAF.js} +56 -45
  230. package/dist/{tests-JWQRHFCT.js → tests-N4MMBABH.js} +6 -6
  231. package/dist/{token-BDHD7GU3.js → token-3TCMW2AP.js} +13 -13
  232. package/dist/{toolchain-hooks-QHJRDCRW.js → toolchain-hooks-IJWV3ZQS.js} +18 -18
  233. package/dist/{toolchain-modules-LY7BMYG6.js → toolchain-modules-PBVBCPQJ.js} +5 -5
  234. package/dist/{toolchain-peers-FQJBTKEB.js → toolchain-peers-EMOYN4U7.js} +8 -8
  235. package/dist/{tracked-backend-BIR7YJCE.js → tracked-backend-YDUUQZQF.js} +34 -34
  236. package/dist/update-check-C6KDFGMT.js +141 -0
  237. package/dist/{upgrade-command-YCADQCIA.js → upgrade-command-ZSBTSMBR.js} +68 -67
  238. package/dist/{whoami-command-IZCTUPM4.js → whoami-command-L6ERHR5K.js} +16 -16
  239. package/dist/{workspace-TK52V7WO.js → workspace-5DPSDM4A.js} +5 -5
  240. package/dist/{workspace-binding-3UT6PP4B.js → workspace-binding-MVOWGNYW.js} +15 -15
  241. package/dist/{workspace-command-46OCB6XT.js → workspace-command-PKQ5TDR7.js} +100 -99
  242. package/dist/{workspace-env-PVPOWFNZ.js → workspace-env-UZJZUIYV.js} +18 -12
  243. package/dist/{workspace-export-PUEXKZNS.js → workspace-export-3KMWNZDD.js} +5 -5
  244. package/dist/{writable-LMMG4AFZ.js → writable-X7BCN7XE.js} +4 -4
  245. package/dist/xano-YB6Y2IJS.js +44 -0
  246. package/dist/{xanosdk-import-XXJT365U.js → xanosdk-import-HHMQDK2I.js} +10 -10
  247. package/dist/{xanosdk-project-CJKRLQ6U.js → xanosdk-project-CKEUNJU4.js} +13 -13
  248. package/dist/{xdo-D4OwfF2J.d.ts → xdo-DNGZGO1j.d.ts} +50 -12
  249. package/guides/authoring.md +1 -0
  250. package/guides/codes.md +33 -3
  251. package/guides/coverage.md +2 -2
  252. package/guides/object-kinds.md +1 -1
  253. package/guides/typed-frontend.md +9 -0
  254. package/llms/client.md +54 -36
  255. package/llms/errors.md +26 -6
  256. package/llms/fields.md +53 -30
  257. package/llms/filters.md +55 -46
  258. package/llms/kinds-agent-mcp.md +10 -9
  259. package/llms/kinds-core.md +19 -15
  260. package/llms/kinds-knowledge.md +4 -4
  261. package/llms/kinds-realtime.md +25 -23
  262. package/llms/lambda.md +42 -30
  263. package/llms/legacy.md +6 -7
  264. package/llms/lock.md +21 -17
  265. package/llms/object-kinds.md +9 -11
  266. package/llms/statements-calls.md +41 -20
  267. package/llms/statements-catalog.md +32 -25
  268. package/llms/statements-data.md +35 -25
  269. package/llms/statements-runtime.md +28 -18
  270. package/llms/tests.md +20 -7
  271. package/llms/toolchain.md +12 -9
  272. package/llms/triggers.md +14 -18
  273. package/llms/values.md +16 -9
  274. package/llms-full.txt +643 -503
  275. package/llms.txt +120 -137
  276. package/manifest.json +147 -95
  277. package/package.json +1 -1
  278. package/skills/xano-backend/SKILL.md +10 -12
  279. package/types/lambda-globals.d.ts +6 -1
  280. package/dist/branch-commands-4PJEBNRK.js +0 -80
  281. package/dist/codegen-command-RDD4GL35.js +0 -182
  282. package/dist/env-example-refresh-MQWHY7ZS.js +0 -135
  283. package/dist/init-command-6Z7QNVDY.js +0 -142
  284. package/dist/promote-command-OO56IZBT.js +0 -148
  285. package/dist/pull-command-LT5PCEIW.js +0 -170
  286. package/dist/release-command-RBUOXIH7.js +0 -152
  287. package/dist/routes-manifest-file-MPOVKD6N.js +0 -41
  288. package/dist/sync-baseline-IB7MABZO.js +0 -38
  289. package/dist/update-check-JDARCXAX.js +0 -140
  290. package/dist/xano-EOUVXNQX.js +0 -43
@@ -2,16 +2,19 @@ import {
2
2
  assertInputValue,
3
3
  assertOneOf as assertOneOf2,
4
4
  leanInput
5
- } from "./chunk-ICK36EGF.js";
5
+ } from "./chunk-4EVDCSEY.js";
6
6
  import {
7
7
  FILTER_NAMES,
8
8
  fl
9
- } from "./chunk-AXNX4NWN.js";
9
+ } from "./chunk-RLQX6LHW.js";
10
+ import {
11
+ obj
12
+ } from "./chunk-U56HK2RG.js";
10
13
  import {
11
14
  assertCanonical,
12
15
  buildMiddlewareBlock,
13
16
  encodeContainerHistory
14
- } from "./chunk-6EFXPTHT.js";
17
+ } from "./chunk-WAP5362D.js";
15
18
  import {
16
19
  safeNames
17
20
  } from "./chunk-GSGDWJB5.js";
@@ -37,7 +40,7 @@ import {
37
40
  tableColumns,
38
41
  tableIndexes,
39
42
  unusableColumns
40
- } from "./chunk-TXFOQZUQ.js";
43
+ } from "./chunk-WVVUE7LU.js";
41
44
  import {
42
45
  brandDef
43
46
  } from "./chunk-ERVIASGL.js";
@@ -45,7 +48,7 @@ import {
45
48
  assertDefShape,
46
49
  encodeTags,
47
50
  registerKind
48
- } from "./chunk-74OPNM2Z.js";
51
+ } from "./chunk-JHAZK4RY.js";
49
52
  import {
50
53
  findNonJson,
51
54
  nonJsonMessage
@@ -63,7 +66,7 @@ import {
63
66
  } from "./chunk-WTPZRR4I.js";
64
67
  import {
65
68
  DiagnosticError
66
- } from "./chunk-YEH5OIPF.js";
69
+ } from "./chunk-FMXPV5JI.js";
67
70
  import {
68
71
  orNames,
69
72
  suggest,
@@ -74,7 +77,7 @@ import {
74
77
  identityNamesByGuid,
75
78
  lockNameForObject,
76
79
  sdkKindName
77
- } from "./chunk-5KJBWIDZ.js";
80
+ } from "./chunk-VQDVEHDB.js";
78
81
  import {
79
82
  annotate,
80
83
  assertBindsAs,
@@ -84,7 +87,10 @@ import {
84
87
  registerStatement,
85
88
  statementLabel,
86
89
  statementMark
87
- } from "./chunk-FKQX6KU7.js";
90
+ } from "./chunk-F3JK5RIY.js";
91
+ import {
92
+ subStacks
93
+ } from "./chunk-EUAU4QKI.js";
88
94
  import {
89
95
  LAMBDA_CODE_FILTERS,
90
96
  assertLambdaStatement,
@@ -100,7 +106,7 @@ import {
100
106
  sys,
101
107
  toPlainValue,
102
108
  withFilters
103
- } from "./chunk-Z6N5N4MN.js";
109
+ } from "./chunk-SIW2HT2H.js";
104
110
  import {
105
111
  maskNonCode
106
112
  } from "./chunk-VAX3UZOY.js";
@@ -108,10 +114,10 @@ import {
108
114
  guidSeedHint,
109
115
  refSpelling,
110
116
  resolveRef
111
- } from "./chunk-LL6ED5IB.js";
117
+ } from "./chunk-FTS42N37.js";
112
118
  import {
113
119
  isListColumn
114
- } from "./chunk-JIKGT7DO.js";
120
+ } from "./chunk-GE3JV5SI.js";
115
121
  import {
116
122
  argsOrEmpty,
117
123
  assertArg,
@@ -123,7 +129,7 @@ import {
123
129
  describeEntry,
124
130
  isRecordArg,
125
131
  isTaggedArg
126
- } from "./chunk-4MIV244X.js";
132
+ } from "./chunk-SGEOXJIH.js";
127
133
  import {
128
134
  withArticle
129
135
  } from "./chunk-36JUQZVQ.js";
@@ -483,16 +489,8 @@ function coerceCell(table, col, cell) {
483
489
  }
484
490
 
485
491
  // src/statements/special/db-search.ts
486
- var CONSTANT_WHERE_TAGS = /* @__PURE__ */ new Set([
487
- "const:bool",
488
- "const:int",
489
- "const:decimal",
490
- "const:null",
491
- "const:epochms"
492
- ]);
493
492
  function encodeSearch(where, additionalWhere, owner = "db search") {
494
493
  const nodes = [];
495
- let raw;
496
494
  for (const [field, w] of [["where", where], ["additionalWhere", additionalWhere]]) {
497
495
  if (!w) continue;
498
496
  if (Array.isArray(w)) {
@@ -506,29 +504,20 @@ function encodeSearch(where, additionalWhere, owner = "db search") {
506
504
  nodes.push(...w);
507
505
  } else if (isGroup(w) || isMixed(w) || isCmpNode(w)) nodes.push(w);
508
506
  else if (isValue(w)) {
509
- if (CONSTANT_WHERE_TAGS.has(w.tag)) {
510
- throw new Error(
511
- `${owner}: \`${field}\` is the constant ${w.tag}:${JSON.stringify(w.value)}, which cannot be a search clause \u2014 a fixed literal states no condition, and the engine reads the resulting \`context.search\` as neither a predicate nor an absent one. To match EVERY row, omit \`${field}\` entirely (an empty search is how "no filter" is spelled). To filter, use expr(col("x"), "=", \u2026), cmp(...), or an and()/or() group. The raw Value form is the escape hatch for a clause built elsewhere \u2014 inp("clause"), ref("built_where"), or an expression value \u2014 not for a literal.`
512
- );
513
- }
514
- raw = w;
507
+ throw new Error(
508
+ `${owner}: \`${field}\` is a value (${w.tag}), which cannot be a filter: the engine reads a filter only as a comparison tree, and runs a query whose filter is anything else over EVERY row. To filter, use expr(col("x"), "=", inp("x")), cmp(...), or an and()/or() group \u2014 the operands take inp()/ref() values. To match every row, omit \`${field}\`.`
509
+ );
515
510
  } else {
516
511
  throw new Error(
517
- `${owner}: \`${field}\` must be an expr(...)/cmp(...) comparison, an and()/or() group, an array of those, or a tagged Value (inp/ref/col/c.*) \u2014 got ${typeof w === "object" ? "an object that is neither. Check for a typo (e.g. `operator` instead of `op`)." : `${describeEntry(w)}.`}`
512
+ `${owner}: \`${field}\` must be an expr(...)/cmp(...) comparison, an and()/or() group, or an array of those \u2014 got ${typeof w === "object" ? "an object that is neither. Check for a typo (e.g. `operator` instead of `op`)." : `${describeEntry(w)}.`}`
518
513
  );
519
514
  }
520
515
  }
521
- if (raw !== void 0 && nodes.length) {
522
- throw new Error(
523
- `${owner}: a raw Value \`where\` cannot be combined with expr()/cmp()/and()/or() clauses \u2014 use one form or the other.`
524
- );
525
- }
526
516
  if (nodes.length) {
527
517
  const encoded = encodeExpression(nodes);
528
518
  assertNoBareRightColumn(encoded);
529
519
  return encoded;
530
520
  }
531
- if (raw !== void 0) return raw;
532
521
  return void 0;
533
522
  }
534
523
  var SORT_DIRS = ["asc", "desc", "rand"];
@@ -613,10 +602,18 @@ function encodeEval(evals) {
613
602
  }))
614
603
  }));
615
604
  }
616
- function qualifyAggregateEvals(evals, primaryAlias, kind) {
605
+ function needsQualifier(name, scope) {
606
+ if (scope?.evalAliases?.has(name)) return false;
607
+ if (!name.includes(".")) return true;
608
+ if (scope === void 0) return false;
609
+ const first = name.slice(0, name.indexOf("."));
610
+ return scope.ownColumns.has(first) && !scope.aliases.has(first);
611
+ }
612
+ function qualifyAggregateEvals(evals, primaryAlias, kind, scope) {
617
613
  if (!evals?.length) return evals;
618
614
  return evals.map((e) => {
619
- const name = e.name.includes(".") ? e.name : `${primaryAlias}.${e.name}`;
615
+ if (scope?.evalAliases?.has(e.name)) return { ...e };
616
+ const name = needsQualifier(e.name, scope) ? `${primaryAlias}.${e.name}` : e.name;
620
617
  if (!/^[^.]+\.[^.].*$/.test(name)) {
621
618
  throw new Error(
622
619
  `${kind === "query eval" ? "db.query eval" : `aggregate ${kind}`}: name "${e.name}" must be an alias-qualified column (e.g. "${primaryAlias || "<table>"}.${e.name}") \u2014 the engine rejects a bare column name there (\`Unsupported param format\`). Qualify it with the table alias, or the bind alias for a joined column.`
@@ -975,7 +972,7 @@ function expandRow(table, row, op, statement) {
975
972
  return cols.map((col) => {
976
973
  const cell = Object.hasOwn(row, col.name) ? row[col.name] : void 0;
977
974
  const supplied = cell !== void 0;
978
- const ignore = systemIgnore.has(col.name) || op === "edit" && !supplied;
975
+ const ignore = systemIgnore.has(col.name) && !(op === "add" && col.name === "id" && supplied) || op === "edit" && !supplied;
979
976
  if (supplied) assertCellShape(statement, col.name, cell);
980
977
  if (supplied && isNestedCell(cell)) {
981
978
  return { name: col.name, value: c.text(""), ignore, children: nestedFields(cell, statement, col.name) };
@@ -1473,11 +1470,23 @@ function assertNoEvalShadow(table, evals) {
1473
1470
  }
1474
1471
  }
1475
1472
  }
1476
- function encodeAggregate(agg, primaryAlias) {
1473
+ function assertAggregateNamesBaseOnly(agg, bindAliases, primaryAlias) {
1474
+ const joined = new Set(bindAliases.filter((a) => a !== "" && a !== primaryAlias));
1475
+ for (const [kind, list] of [["group", agg?.group], ["eval", agg?.eval]]) {
1476
+ for (const e of list ?? []) {
1477
+ const dot = e.name.indexOf(".");
1478
+ if (dot === -1 || !joined.has(e.name.slice(0, dot))) continue;
1479
+ throw new Error(
1480
+ `Statement "s.db.query": aggregate ${kind} "${e.name}" names a joined column. An aggregate reads only the query's own table, so the engine answers 400 "Unsupported object reference - ${e.name}" on every request. Project it with a query eval and name that alias bare: \`eval: [{ name: "${e.name}", as: "${e.as}" }]\`, then \`aggregate: { ${kind}: [{ name: "${e.as}", as: "${e.as}" }] }\`.`
1481
+ );
1482
+ }
1483
+ }
1484
+ }
1485
+ function encodeAggregate(agg, primaryAlias, scope) {
1477
1486
  const block = {
1478
1487
  sort: encodeSort(agg?.sort, "s.db.query", "aggregate.sort"),
1479
- eval: encodeEval(qualifyAggregateEvals(agg?.eval, primaryAlias, "eval")) ?? [],
1480
- group: encodeEval(qualifyAggregateEvals(agg?.group, primaryAlias, "group")) ?? []
1488
+ eval: encodeEval(qualifyAggregateEvals(agg?.eval, primaryAlias, "eval", scope)) ?? [],
1489
+ group: encodeEval(qualifyAggregateEvals(agg?.group, primaryAlias, "group", scope)) ?? []
1481
1490
  };
1482
1491
  if (agg?.paging) {
1483
1492
  block.paging = {
@@ -1508,9 +1517,9 @@ function normalizeReturnType(raw) {
1508
1517
  `Statement "s.db.query": \`returnType\` is ${shown}, which is not one of ${DB_RETURN_TYPES.map((t) => JSON.stringify(t)).join(", ")}. Falling through to "list" would run the query and return a different shape than the one asked for, with no error anywhere. \`returnType\` is read at encode time to pick the \`context.return\` block, so it cannot be a dynamic value \u2014 a filtered or non-constant tagged value cannot be resolved here.`
1509
1518
  );
1510
1519
  }
1511
- function encodeReturn(returnType, sort, paging, forceEnabled = false, distinct = "auto", aggregate, primaryAlias = "") {
1520
+ function encodeReturn(returnType, sort, paging, forceEnabled = false, distinct = "auto", aggregate, primaryAlias = "", scope) {
1512
1521
  const sortEls = encodeSort(sort);
1513
- if (returnType === "aggregate") return encodeAggregate(aggregate, primaryAlias);
1522
+ if (returnType === "aggregate") return encodeAggregate(aggregate, primaryAlias, scope);
1514
1523
  if (returnType === "count" || returnType === "exists") return { type: returnType };
1515
1524
  if (returnType === "single") return { type: "single", single: { sort: sortEls } };
1516
1525
  const enabled = pagingEnabled(paging, forceEnabled);
@@ -1564,6 +1573,18 @@ var DB_QUERY_KEYS = Object.keys({
1564
1573
  var DB_BIND_KEYS = Object.keys(
1565
1574
  { table: 1, expand: 1, as: 1, join: 1, where: 1 }
1566
1575
  );
1576
+ function assertLockable(returnType, paging) {
1577
+ if (returnType === "count" || returnType === "aggregate") {
1578
+ throw new Error(
1579
+ `Statement "s.db.query": \`lock: true\` needs a row-returning query, but returnType is "${returnType}". The lock is a Postgres FOR UPDATE, which is refused beside an aggregate (SQL Error 0A000, a 500 on every request). Lock the rows with a "list" or "single" query and count those, or drop \`lock\`.`
1580
+ );
1581
+ }
1582
+ if (paging?.totals === true) {
1583
+ throw new Error(
1584
+ `Statement "s.db.query": \`lock: true\` cannot be combined with \`paging.totals\`: the totals are a count(*) on the same locked query, which Postgres refuses FOR UPDATE (SQL Error 0A000, a 500 on every request). Drop \`totals\`, or count in a separate unlocked query.`
1585
+ );
1586
+ }
1587
+ }
1567
1588
  function dbQuery(args) {
1568
1589
  args = argsOrEmpty(args);
1569
1590
  if (args.return !== void 0) {
@@ -1582,12 +1603,20 @@ function dbQuery(args) {
1582
1603
  const returnType = normalizeReturnType(args.returnType);
1583
1604
  const tableName = args.table === null ? "" : typeof args.table === "string" ? args.table : args.table.name;
1584
1605
  const primaryAlias = args.tableAlias ?? tableName;
1585
- const aggregateAddsQualifier = returnType === "aggregate" && tableName !== "" && [...args.aggregate?.group ?? [], ...args.aggregate?.eval ?? []].some(
1586
- (e) => !e.name.includes(".")
1606
+ const bindAliasNames = (args.bind ?? []).map(
1607
+ (b) => b.as ?? (typeof b.table === "string" ? b.table : b.table?.name ?? "")
1587
1608
  );
1609
+ const queryEvalAliases = new Set((args.eval ?? []).map((e) => e.as));
1610
+ const qualifyScope = {
1611
+ ownColumns: args.table !== null && typeof args.table === "object" && "schema" in args.table ? new Set(tableColumns(args.table).map((col) => col.name)) : /* @__PURE__ */ new Set(),
1612
+ aliases: /* @__PURE__ */ new Set([primaryAlias, ...bindAliasNames]),
1613
+ evalAliases: queryEvalAliases
1614
+ };
1615
+ if (returnType === "aggregate") assertAggregateNamesBaseOnly(args.aggregate, bindAliasNames, primaryAlias);
1616
+ const aggregateAddsQualifier = returnType === "aggregate" && tableName !== "" && [...args.aggregate?.group ?? [], ...args.aggregate?.eval ?? []].some((e) => needsQualifier(e.name, qualifyScope));
1588
1617
  const evalAddsQualifier = tableName !== "" && (args.eval ?? []).some((e) => !e.name.includes("."));
1589
1618
  const joinedRowQuery = (returnType === "list" || returnType === "stream") && tableName !== "" && (args.bind?.length ?? 0) > 0;
1590
- const evalAliases = new Set((args.eval ?? []).map((e) => e.as));
1619
+ const evalAliases = queryEvalAliases;
1591
1620
  const qualifiesSort = (entry2) => entry2.qualify !== false && typeof entry2.sortBy === "string" && entry2.sortBy !== "" && !entry2.sortBy.includes(".") && !evalAliases.has(entry2.sortBy);
1592
1621
  const sortAddsQualifier = joinedRowQuery && (args.sort ?? []).some(qualifiesSort);
1593
1622
  const emittedAlias = args.tableAlias ?? (aggregateAddsQualifier || evalAddsQualifier || sortAddsQualifier ? tableName : void 0);
@@ -1623,14 +1652,15 @@ function dbQuery(args) {
1623
1652
  const encodedEvals = encodeEval(evals);
1624
1653
  if (encodedEvals) context.eval = encodedEvals;
1625
1654
  const lock = optionalFlag("s.db.query", "lock", args.lock);
1655
+ if (args.lock === true) assertLockable(returnType, args.paging);
1626
1656
  if (lock !== void 0) context.lock = lock;
1627
1657
  const simpleExternal = encodeSimpleExternal(args.paging);
1628
1658
  if (args.external !== void 0 && args.external !== null) {
1629
- context.return = encodeReturn(returnType, sort, args.paging, true, args.distinct, args.aggregate, primaryAlias);
1659
+ context.return = encodeReturn(returnType, sort, args.paging, true, args.distinct, args.aggregate, primaryAlias, qualifyScope);
1630
1660
  context.external = encodeExternal(args.external);
1631
1661
  if (simpleExternal) context.simpleExternal = simpleExternal;
1632
1662
  } else {
1633
- context.return = encodeReturn(returnType, sort, args.paging, false, args.distinct, args.aggregate, primaryAlias);
1663
+ context.return = encodeReturn(returnType, sort, args.paging, false, args.distinct, args.aggregate, primaryAlias, qualifyScope);
1634
1664
  if (simpleExternal) context.simpleExternal = simpleExternal;
1635
1665
  }
1636
1666
  const usesPagingEnvelope = returnType === "list" && pagingEnabled(args.paging, args.external !== void 0 && args.external !== null) && (args.paging?.metadata ?? true);
@@ -1768,9 +1798,9 @@ function nestedValueFields(v) {
1768
1798
  function pickDefined(o) {
1769
1799
  return Object.fromEntries(Object.entries(o).filter(([, v]) => v !== void 0));
1770
1800
  }
1771
- function setPath(obj, path, value) {
1801
+ function setPath(obj2, path, value) {
1772
1802
  const parts = path.split(".");
1773
- let cur = obj;
1803
+ let cur = obj2;
1774
1804
  for (let i = 0; i < parts.length - 1; i++) {
1775
1805
  const key = parts[i];
1776
1806
  if (typeof cur[key] !== "object" || cur[key] === null) cur[key] = {};
@@ -1800,6 +1830,13 @@ function specLabel(spec) {
1800
1830
  return spec.factory ?? readableStatementName(spec.name);
1801
1831
  }
1802
1832
  var SPEC_ENVELOPE_KEYS = ["disabled", "description", "mock", "asFilters", "uncheckedAs", "output"];
1833
+ function assertWholeNumber(label, rule, provided) {
1834
+ const [min, max] = rule.range ?? [Number.MIN_SAFE_INTEGER, Number.MAX_SAFE_INTEGER];
1835
+ if (typeof provided !== "number" || !Number.isInteger(provided) || provided < min || provided > max) {
1836
+ const want = rule.range ? `a whole number from ${min} to ${max}` : "a whole number";
1837
+ throw new Error(`Statement "${label}": argument "${rule.field}" must be ${want} \u2014 got ${describeEntry(provided)}.`);
1838
+ }
1839
+ }
1803
1840
  function encodeFromSpec(spec, authored) {
1804
1841
  authored ??= {};
1805
1842
  const label = specLabel(spec);
@@ -1839,6 +1876,7 @@ function encodeFromSpec(spec, authored) {
1839
1876
  break;
1840
1877
  case "context-plain":
1841
1878
  assertIgnorable(label, rule.field, provided);
1879
+ if (rule.type === "number") assertWholeNumber(label, rule, provided);
1842
1880
  setPath(context, rule.route.path, provided);
1843
1881
  break;
1844
1882
  case "context-spread":
@@ -1929,7 +1967,7 @@ var GENERATED_SPECS = [
1929
1967
  { "name": "mvp:amazon_s3_list_directory", "factory": "s.cloud.aws.s3.list_directory", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "bucket", "type": "value", "optional": false, "route": { "kind": "input", "name": "bucket" } }, { "field": "region", "type": "value", "optional": false, "route": { "kind": "input", "name": "region" } }, { "field": "key", "type": "value", "optional": false, "route": { "kind": "input", "name": "key" } }, { "field": "secret", "type": "value", "optional": false, "route": { "kind": "input", "name": "secret" } }, { "field": "prefix", "type": "value", "optional": true, "route": { "kind": "input", "name": "prefix" } }, { "field": "next_page_token", "type": "value", "optional": true, "route": { "kind": "input", "name": "next_page_token" } }] },
1930
1968
  { "name": "mvp:amazon_s3_signed_url", "factory": "s.cloud.aws.s3.sign_url", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "bucket", "type": "value", "optional": false, "route": { "kind": "input", "name": "bucket" } }, { "field": "region", "type": "value", "optional": false, "route": { "kind": "input", "name": "region" } }, { "field": "key", "type": "value", "optional": false, "route": { "kind": "input", "name": "key" } }, { "field": "secret", "type": "value", "optional": false, "route": { "kind": "input", "name": "secret" } }, { "field": "file_key", "type": "value", "optional": false, "route": { "kind": "input", "name": "file_key" } }, { "field": "ttl", "type": "value", "optional": true, "default": "300", "route": { "kind": "input", "name": "ttl" } }] },
1931
1969
  { "name": "mvp:amazon_s3_upload_file", "factory": "s.cloud.aws.s3.upload_file", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "bucket", "type": "value", "optional": false, "route": { "kind": "input", "name": "bucket" } }, { "field": "region", "type": "value", "optional": false, "route": { "kind": "input", "name": "region" } }, { "field": "key", "type": "value", "optional": false, "route": { "kind": "input", "name": "key" } }, { "field": "secret", "type": "value", "optional": false, "route": { "kind": "input", "name": "secret" } }, { "field": "file_key", "type": "value", "optional": true, "route": { "kind": "input", "name": "file_key" } }, { "field": "file", "type": "value", "optional": false, "route": { "kind": "input", "name": "file" } }, { "field": "metadata", "type": "value", "optional": true, "route": { "kind": "input", "name": "metadata" } }, { "field": "object_lock_mode", "type": "value", "optional": true, "enum": ["compliance", "governance"], "route": { "kind": "input", "name": "object_lock_mode" } }, { "field": "object_lock_retain_until", "type": "value", "optional": true, "route": { "kind": "input", "name": "object_lock_retain_until" } }] },
1932
- { "name": "mvp:api_request", "factory": "s.api.request", "output": true, "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "url", "type": "value", "optional": false, "route": { "kind": "input", "name": "url" } }, { "field": "method", "type": "value", "optional": true, "enum": ["GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS", "PATCH"], "route": { "kind": "input", "name": "method" } }, { "field": "params", "type": "value", "optional": true, "route": { "kind": "input", "name": "params" } }, { "field": "headers", "type": "value", "optional": true, "route": { "kind": "input", "name": "headers" } }, { "field": "timeout", "type": "value", "optional": true, "route": { "kind": "input", "name": "timeout" } }, { "field": "follow_location", "type": "value", "optional": true, "route": { "kind": "input", "name": "follow_location" } }, { "field": "verify_host", "type": "value", "optional": true, "route": { "kind": "input", "name": "verify_host" } }, { "field": "verify_peer", "type": "value", "optional": true, "route": { "kind": "input", "name": "verify_peer" } }, { "field": "ca_certificate", "type": "value", "optional": true, "route": { "kind": "input", "name": "ca_certificate" } }, { "field": "certificate", "type": "value", "optional": true, "route": { "kind": "input", "name": "certificate" } }, { "field": "certificate_pass", "type": "value", "optional": true, "route": { "kind": "input", "name": "certificate_pass" } }, { "field": "private_key", "type": "value", "optional": true, "route": { "kind": "input", "name": "private_key" } }, { "field": "private_key_pass", "type": "value", "optional": true, "route": { "kind": "input", "name": "private_key_pass" } }], "envelope": { "inputFull": true, "description": true, "settingsRegistry": true, "addon": true, "richOutput": true } },
1970
+ { "name": "mvp:api_request", "factory": "s.api.request", "output": true, "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "url", "type": "value", "optional": false, "route": { "kind": "input", "name": "url" } }, { "field": "method", "type": "value", "optional": true, "enum": ["GET", "POST", "PUT", "DELETE", "HEAD", "OPTIONS", "PATCH", "QUERY"], "route": { "kind": "input", "name": "method" } }, { "field": "params", "type": "value", "optional": true, "route": { "kind": "input", "name": "params" } }, { "field": "headers", "type": "value", "optional": true, "route": { "kind": "input", "name": "headers" } }, { "field": "timeout", "type": "value", "optional": true, "route": { "kind": "input", "name": "timeout" } }, { "field": "follow_location", "type": "value", "optional": true, "route": { "kind": "input", "name": "follow_location" } }, { "field": "verify_host", "type": "value", "optional": true, "route": { "kind": "input", "name": "verify_host" } }, { "field": "verify_peer", "type": "value", "optional": true, "route": { "kind": "input", "name": "verify_peer" } }, { "field": "ca_certificate", "type": "value", "optional": true, "route": { "kind": "input", "name": "ca_certificate" } }, { "field": "certificate", "type": "value", "optional": true, "route": { "kind": "input", "name": "certificate" } }, { "field": "certificate_pass", "type": "value", "optional": true, "route": { "kind": "input", "name": "certificate_pass" } }, { "field": "private_key", "type": "value", "optional": true, "route": { "kind": "input", "name": "private_key" } }, { "field": "private_key_pass", "type": "value", "optional": true, "route": { "kind": "input", "name": "private_key_pass" } }], "envelope": { "inputFull": true, "description": true, "settingsRegistry": true, "addon": true, "richOutput": true } },
1933
1971
  { "name": "mvp:array_difference", "factory": "s.array.difference", "rules": [{ "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "expr", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "left" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "right" } }, { "field": "by", "type": "value", "optional": true, "default": "null", "route": { "kind": "context-nest", "path": "transform_value" } }] },
1934
1972
  { "name": "mvp:array_every", "factory": "s.array.every", "output": true, "rules": [{ "field": "expr", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "array" } }, { "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "if", "type": "comparison", "optional": false, "route": { "kind": "context-compare", "path": "expr" } }] },
1935
1973
  { "name": "mvp:array_filter", "factory": "s.array.filter", "rules": [{ "field": "expr", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "array" } }, { "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "if", "type": "comparison", "optional": false, "route": { "kind": "context-compare", "path": "expr" } }] },
@@ -2068,7 +2106,7 @@ var GENERATED_SPECS = [
2068
2106
  { "name": "mvp:text_rtrim", "factory": "s.text.rtrim", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": false, "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
2069
2107
  { "name": "mvp:text_starts_with", "factory": "s.text.starts_with", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": false, "route": { "kind": "context-plain", "path": "name" } }, { "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
2070
2108
  { "name": "mvp:text_trim", "factory": "s.text.trim", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": false, "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
2071
- { "name": "mvp:throw_error", "factory": "s.throw", "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
2109
+ { "name": "mvp:throw_error", "factory": "s.throw", "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }, { "field": "status", "type": "number", "optional": true, "range": [100, 599], "route": { "kind": "context-plain", "path": "status" } }] },
2072
2110
  { "name": "mvp:uuid4", "factory": "s.security.create_uuid", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }] },
2073
2111
  { "name": "mvp:vault_sign_url", "factory": "s.storage.sign_private_url", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "pathname", "type": "value", "optional": false, "route": { "kind": "input", "name": "pathname" } }, { "field": "ttl", "type": "value", "optional": true, "route": { "kind": "input", "name": "ttl" } }] },
2074
2112
  { "name": "mvp:zip_add_file_resource", "factory": "s.zip.add_to_archive", "rules": [{ "field": "file", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "file" } }, { "field": "filename", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "filename" } }, { "field": "zip", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "zip" } }, { "field": "password", "type": "value", "optional": true, "emptyWhenAbsent": true, "route": { "kind": "context-nest", "path": "password" } }, { "field": "password_encryption", "type": "value", "optional": true, "emptyWhenAbsent": true, "route": { "kind": "context-nest", "path": "password_encryption" } }] },
@@ -2711,7 +2749,7 @@ var generated = {
2711
2749
  )
2712
2750
  },
2713
2751
  throw: (
2714
- /** `mvp:throw_error` — fields: name, value */
2752
+ /** `mvp:throw_error` — fields: name, value, status */
2715
2753
  (a) => fromSpec("mvp:throw_error", a)
2716
2754
  ),
2717
2755
  util: {
@@ -2872,9 +2910,11 @@ var cond = {
2872
2910
  between: (value, lo, hi) => and(expr(value, ">=", lo), expr(value, "<=", hi)),
2873
2911
  /**
2874
2912
  * The object at `value` has something at `path` — the engine's `has` filter,
2875
- * whose argument is a dotted path (`"address.city"`), not a value.
2913
+ * whose argument is a dotted path, not a runtime value. Pass it as a bare
2914
+ * string (`cond.has(inp("blob"), "address.city")`); it is wrapped as `c.text`
2915
+ * for you. A `Value` is still accepted for a computed path.
2876
2916
  */
2877
- has: (value, path) => predicate(value, fl.has(path), true),
2917
+ has: (value, path) => predicate(value, fl.has(typeof path === "string" ? c.text(path) : path), true),
2878
2918
  /**
2879
2919
  * `value` (an array or object) has exactly `n` entries.
2880
2920
  *
@@ -3054,7 +3094,7 @@ var guard = {
3054
3094
  var DECODE_ONLY_STATEMENTS = /* @__PURE__ */ new Map([
3055
3095
  [
3056
3096
  "mvp:placeholder",
3057
- 'an unconfigured statement slot the engine writes in place of a statement it could not resolve, so an export stays well-formed. There is no statement class behind it: importing a workspace that contains one fails outright with "Missing statement: mvp:placeholder". Replace it with the statement it stands in for before deploying \u2014 there is no destination where it runs'
3097
+ 'an unconfigured statement slot the engine writes for a statement it could not resolve. Importing a workspace that contains one fails with "Missing statement: mvp:placeholder" on every destination; replace it with the statement it stands in for before deploying'
3058
3098
  ]
3059
3099
  ]);
3060
3100
 
@@ -4300,19 +4340,19 @@ function statementTableGuid(statement) {
4300
4340
  function checkBlankTableBindings(sections, bag) {
4301
4341
  if (!bag.strict) return;
4302
4342
  for (const [payloadKey, arr] of Object.entries(sections)) {
4303
- for (const obj of arr ?? []) {
4304
- if (!obj || typeof obj !== "object") continue;
4343
+ for (const obj2 of arr ?? []) {
4344
+ if (!obj2 || typeof obj2 !== "object") continue;
4305
4345
  const statements = [];
4306
- collectStatements(obj, statements);
4346
+ collectStatements(obj2, statements);
4307
4347
  const blank = statements.filter((st) => statementTableGuid(st) === "");
4308
4348
  if (blank.length === 0) continue;
4309
- const name = obj.name;
4310
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
4349
+ const name = obj2.name;
4350
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
4311
4351
  const which = [...new Set(blank.map((st) => `\`${statementLabel(st.name)}\``))].join(", ");
4312
4352
  bag.warn(
4313
4353
  "stack.blank-table",
4314
4354
  `${owner} has ${blank.length === 1 ? "a db statement" : `${blank.length} db statements`} (${which}) bound to no table (\`table: null\`) \u2014 ${blank.length === 1 ? "it does" : "they do"} nothing when run. Point ${blank.length === 1 ? "it" : "each"} at a table, or remove ${blank.length === 1 ? "it" : "them"}.`,
4315
- obj
4355
+ obj2
4316
4356
  );
4317
4357
  }
4318
4358
  }
@@ -4485,9 +4525,9 @@ function checkInputScope(sections, bag) {
4485
4525
  }
4486
4526
  for (const [payloadKey, arr] of Object.entries(sections)) {
4487
4527
  if (payloadKey === "middleware") continue;
4488
- for (const obj of arr ?? []) {
4489
- if (!obj || typeof obj !== "object") continue;
4490
- const record = obj;
4528
+ for (const obj2 of arr ?? []) {
4529
+ if (!obj2 || typeof obj2 !== "object") continue;
4530
+ const record = obj2;
4491
4531
  const addon = payloadKey === "addon";
4492
4532
  if (!Array.isArray(record.run) && !addon) continue;
4493
4533
  const declared = declaredInputNames(record, tableColumns2);
@@ -4510,13 +4550,13 @@ function checkInputScope(sections, bag) {
4510
4550
  const channelParam = param ? ` \`${param}\` is a channel path param, not a trigger input: read it from \`s.realtime.get_session\` as \`ref("session.params.${param}")\`.` : "";
4511
4551
  const near = didYouMean(missing[0], declared);
4512
4552
  const links = new Set(
4513
- record.input.flatMap(
4553
+ (record.input ?? []).flatMap(
4514
4554
  (e) => typeof e?.type === "string" && e.type.endsWith("_mvpschema") && typeof e.name === "string" ? [e.name] : []
4515
4555
  )
4516
4556
  );
4517
4557
  const link = missing.find((m) => links.has(m));
4518
4558
  const linkNote = link ? ` \`${link}\` is an \`input.dbLink\`: its columns bind as the inputs, so read one by its own name (\`inp("<column>")\`).` : "";
4519
- const remedy = payloadKey === "trigger" ? `read it with \`ref("<var>.${missing[0]}")\`; a trigger's own inputs are fixed, so read them through the \`(t) => [...]\` stack callback's accessor (\`t.new\`, \`t.action\`, \u2026).` : `read it with \`ref("<var>.${missing[0]}")\`; if it really is a request input, declare it in this def's \`input\`.`;
4559
+ const remedy = payloadKey === "trigger" ? `read it with \`ref("<var>.${missing[0]}")\`; a trigger's own inputs are fixed, so read them through the \`(t) => [...]\` stack callback's accessor (\`t.new\`, \`t.action\`, \u2026).` : payloadKey === "task" || payloadKey === "workflow_test" ? `read it with \`ref("<var>.${missing[0]}")\`; a ${sdkKindName(payloadKey, record)} has no request inputs, so the value must come from a table read, \`env()\`, or an earlier \`ref()\`.` : `read it with \`ref("<var>.${missing[0]}")\`; if it really is a request input, declare it in this def's \`input\`.`;
4520
4560
  bag.warn(
4521
4561
  "stack.inp-undeclared",
4522
4562
  `${sdkKindName(payloadKey, record)} "${name}" reads ${missing.map((r) => `\`inp("${r}")\``).join(", ")}, which ${missing.length === 1 ? "is not a declared input" : "are not declared inputs"} here \u2014 ${declaredList}.${near ? ` Did you mean \`inp("${near}")\`?` : ""} This deploys clean and fails at runtime with \`Unable to locate input: ${missing[0]}\`. If the value comes from earlier in the stack rather than the request, ${remedy}` + linkNote + channelParam,
@@ -4527,9 +4567,9 @@ function checkInputScope(sections, bag) {
4527
4567
  }
4528
4568
  function checkColumnScope(sections, bag) {
4529
4569
  for (const [payloadKey, arr] of Object.entries(sections)) {
4530
- for (const obj of arr ?? []) {
4531
- if (!obj || typeof obj !== "object") continue;
4532
- const record = obj;
4570
+ for (const obj2 of arr ?? []) {
4571
+ if (!obj2 || typeof obj2 !== "object") continue;
4572
+ const record = obj2;
4533
4573
  if (!Array.isArray(record.run) && !Array.isArray(record.result)) continue;
4534
4574
  const reads = [];
4535
4575
  const pending = [[record.result, void 0], [record.run, void 0]];
@@ -4632,12 +4672,77 @@ function envReads(record) {
4632
4672
  const seen = /* @__PURE__ */ new Set();
4633
4673
  return read.filter((r) => seen.has(r.name) ? false : (seen.add(r.name), true));
4634
4674
  }
4675
+ function checkEnvSecretResponse(sections, bag) {
4676
+ for (const [payloadKey, arr] of Object.entries(sections)) {
4677
+ for (const obj2 of arr ?? []) {
4678
+ if (!obj2 || typeof obj2 !== "object") continue;
4679
+ const record = obj2;
4680
+ const bound = /* @__PURE__ */ new Set();
4681
+ walkNodes(record.run, (node) => {
4682
+ if (node.name === "mvp:get_env" && typeof node.as === "string" && node.as !== "") bound.add(node.as);
4683
+ });
4684
+ if (bound.size === 0) continue;
4685
+ const refs = [];
4686
+ collectVarRefs(record.result, refs);
4687
+ const leaked = /* @__PURE__ */ new Set();
4688
+ for (const path of refs) if (!path.includes(".") && bound.has(path)) leaked.add(path);
4689
+ if (leaked.size === 0) continue;
4690
+ const name = record.name;
4691
+ const owner = `${sdkKindName(payloadKey, record)} "${typeof name === "string" ? name : "?"}"`;
4692
+ const names = [...leaked].map((n) => `\`${n}\``).join(", ");
4693
+ const one = leaked.size === 1;
4694
+ bag.warn(
4695
+ "stack.env-secret-in-response",
4696
+ `${owner}: the \`s.util.get_env\` binding ${names} ${one ? "is" : "are"} returned in the response. \`get_env\` returns EVERY environment variable as one object \u2014 secrets like \`API_KEY\` included \u2014 so this ships all of them to the caller. Read just the value you need with \`env("NAME")\` and return that, or pick the needed keys off the binding before it reaches the response.`,
4697
+ record
4698
+ );
4699
+ }
4700
+ }
4701
+ }
4702
+ function checkCryptoWeakDefaults(sections, bag) {
4703
+ for (const [payloadKey, arr] of Object.entries(sections)) {
4704
+ for (const obj2 of arr ?? []) {
4705
+ if (!obj2 || typeof obj2 !== "object") continue;
4706
+ const record = obj2;
4707
+ const statements = [];
4708
+ collectStatements(record, statements);
4709
+ if (statements.length === 0) continue;
4710
+ let ownerCache;
4711
+ const owner = () => ownerCache ??= `${sdkKindName(payloadKey, record)} "${typeof record.name === "string" ? record.name : "?"}"`;
4712
+ for (const st of statements) {
4713
+ if ((st.name === "mvp:crypto_encrypt" || st.name === "mvp:crypto_decrypt") && statementInput(st, "algorithm") === void 0) {
4714
+ const verb = st.name === "mvp:crypto_encrypt" ? "encrypt" : "decrypt";
4715
+ bag.warn(
4716
+ "security.encrypt-default-algorithm",
4717
+ `${owner()}: \`s.security.${verb}\` sets no \`algorithm\`, so the engine uses \`aes-128-cbc\` \u2014 even a 256-bit key then runs AES-128. Pass \`algorithm\` explicitly (e.g. \`"aes-256-gcm"\`); encrypt and decrypt must name the same one.`,
4718
+ record
4719
+ );
4720
+ }
4721
+ if ((st.name === "mvp:crypto_jws_encode2" || st.name === "mvp:crypto_jwe_encode3") && statementInput(st, "ttl") === void 0) {
4722
+ const verb = st.name === "mvp:crypto_jws_encode2" ? "jws_encode" : "jwe_encode";
4723
+ bag.warn(
4724
+ "security.jwt-no-ttl",
4725
+ `${owner()}: \`s.security.${verb}\` sets no \`ttl\`, so the token carries no \`exp\` and never expires. Pass a \`ttl\` in seconds, unless a non-expiring token is intended.`,
4726
+ record
4727
+ );
4728
+ }
4729
+ if (st.name === "mvp:crypto_create_rsa_key" && statementInput(st, "bits") === void 0) {
4730
+ bag.warn(
4731
+ "security.rsa-default-bits",
4732
+ `${owner()}: \`s.security.create_rsa_key\` sets no \`bits\`, so the engine generates a 1024-bit key \u2014 below the 2048-bit minimum now considered safe. Pass \`bits\` (e.g. \`2048\`).`,
4733
+ record
4734
+ );
4735
+ }
4736
+ }
4737
+ }
4738
+ }
4739
+ }
4635
4740
  function envNamesRead(sections) {
4636
4741
  const names = /* @__PURE__ */ new Set();
4637
4742
  for (const [payloadKey, arr] of Object.entries(sections)) {
4638
- for (const obj of arr ?? []) {
4639
- if (!obj || typeof obj !== "object") continue;
4640
- for (const r of envReads(obj)) {
4743
+ for (const obj2 of arr ?? []) {
4744
+ if (!obj2 || typeof obj2 !== "object") continue;
4745
+ for (const r of envReads(obj2)) {
4641
4746
  if (!isSysSettingName(payloadKey, r.name)) names.add(r.name);
4642
4747
  }
4643
4748
  }
@@ -4661,9 +4766,9 @@ function checkEnvNames(workspaceConfig, sections, bag, envSource) {
4661
4766
  return;
4662
4767
  }
4663
4768
  for (const [payloadKey, arr] of Object.entries(sections)) {
4664
- for (const obj of arr ?? []) {
4665
- if (!obj || typeof obj !== "object") continue;
4666
- const record = obj;
4769
+ for (const obj2 of arr ?? []) {
4770
+ if (!obj2 || typeof obj2 !== "object") continue;
4771
+ const record = obj2;
4667
4772
  const missing = envReads(record).filter((r) => !declared.has(r.name) && !isSysSettingName(payloadKey, r.name));
4668
4773
  if (missing.length === 0) continue;
4669
4774
  const name = typeof record.name === "string" ? record.name : "?";
@@ -4683,9 +4788,9 @@ function isSysSettingName(payloadKey, name) {
4683
4788
  }
4684
4789
  function checkEnvSysNames(declared, sections, bag) {
4685
4790
  for (const [payloadKey, arr] of Object.entries(sections)) {
4686
- for (const obj of arr ?? []) {
4687
- if (!obj || typeof obj !== "object") continue;
4688
- const record = obj;
4791
+ for (const obj2 of arr ?? []) {
4792
+ if (!obj2 || typeof obj2 !== "object") continue;
4793
+ const record = obj2;
4689
4794
  const seen = /* @__PURE__ */ new Set();
4690
4795
  for (const r of envReads(record)) {
4691
4796
  if (declared.has(r.name) || seen.has(r.name) || !isSysSettingName(payloadKey, r.name)) continue;
@@ -4704,9 +4809,9 @@ function checkEnvAttached(sections, bag, envSource) {
4704
4809
  const where = [];
4705
4810
  const readers = [];
4706
4811
  for (const [payloadKey, arr] of Object.entries(sections)) {
4707
- for (const obj of arr ?? []) {
4708
- if (!obj || typeof obj !== "object") continue;
4709
- const record = obj;
4812
+ for (const obj2 of arr ?? []) {
4813
+ if (!obj2 || typeof obj2 !== "object") continue;
4814
+ const record = obj2;
4710
4815
  const read = envReads(record).filter((r) => !isSysSettingName(payloadKey, r.name));
4711
4816
  if (read.length === 0) continue;
4712
4817
  const at = `${sdkKindName(payloadKey, record)} "${typeof record.name === "string" ? record.name : "?"}"`;
@@ -4802,6 +4907,58 @@ function checkPostMergeOnList(sections, bag, workspaceConfig = {}) {
4802
4907
  );
4803
4908
  }
4804
4909
  }
4910
+ function checkPreReplaceDropsInput(sections, bag, workspaceConfig = {}) {
4911
+ const replacing = /* @__PURE__ */ new Map();
4912
+ for (const mw of sections.middleware ?? []) {
4913
+ const rec = mw ?? {};
4914
+ if (typeof rec.guid !== "string" || rec.result_type !== "replace" || !Array.isArray(rec.result)) continue;
4915
+ const entries = rec.result;
4916
+ if (entries.some((e) => typeof e?.name !== "string" || e.name === "")) continue;
4917
+ replacing.set(rec.guid, { name: typeof rec.name === "string" ? rec.name : "?", keys: new Set(entries.map((e) => String(e.name))) });
4918
+ }
4919
+ if (replacing.size === 0) return;
4920
+ const preIds = (host) => {
4921
+ const pre = host?.middleware?.pre;
4922
+ if (!Array.isArray(pre)) return [];
4923
+ return pre.map((st) => st).filter((st) => st?.name === "mvp:middleware" && st.disabled !== true).map((st) => st.context?.middleware?.id).filter((id) => typeof id === "string" && replacing.has(id));
4924
+ };
4925
+ const groups = /* @__PURE__ */ new Map();
4926
+ for (const g of sections.app ?? []) {
4927
+ const guid = g?.guid;
4928
+ if (typeof guid === "string") groups.set(guid, g);
4929
+ }
4930
+ const workspacePre = workspaceConfig.middleware?.query_pre;
4931
+ const overridesPre = (host) => host?.middleware?.pre_customize === true;
4932
+ for (const q of sections.query ?? []) {
4933
+ const rec = q ?? {};
4934
+ const group = typeof rec.app?.id === "string" ? groups.get(rec.app.id) : void 0;
4935
+ const inherited = overridesPre(q) || overridesPre(group) ? [] : preIds({ middleware: { pre: workspacePre } });
4936
+ const ids = [.../* @__PURE__ */ new Set([...preIds(q), ...preIds(group), ...inherited])];
4937
+ if (ids.length === 0) continue;
4938
+ const declared = new Set(
4939
+ (Array.isArray(rec.input) ? rec.input : []).map((i) => i?.name).filter((n) => typeof n === "string")
4940
+ );
4941
+ const read = /* @__PURE__ */ new Set();
4942
+ const { middleware: _mw, input: _in, ...body } = q;
4943
+ walkNodes(body, (record) => {
4944
+ if (record.tag !== "input") return;
4945
+ const path = typeof record.value === "string" ? record.value : typeof record.operand === "string" ? record.operand : void 0;
4946
+ const root = path?.split(".")[0];
4947
+ if (root !== void 0 && declared.has(root)) read.add(root);
4948
+ });
4949
+ for (const id of ids) {
4950
+ const mw = replacing.get(id);
4951
+ const dropped = [...read].filter((n) => !mw.keys.has(n));
4952
+ if (dropped.length === 0) continue;
4953
+ const one = dropped.length === 1;
4954
+ bag.warn(
4955
+ "middleware.pre-replace-drops-input",
4956
+ `query "${typeof rec.verb === "string" ? `${rec.verb} ` : ""}${typeof rec.name === "string" ? rec.name : "?"}" reads ${one ? "input" : "inputs"} ${dropped.map((n) => `"${n}"`).join(", ")}, which the pre middleware "${mw.name}" (\`resultStrategy: "replace"\`) does not re-emit: a replace swaps the caller's inputs for its response (${[...mw.keys].map((k) => `"${k}"`).join(", ")}), so every request 500s "Unable to locate input". Re-emit ${one ? "it" : "them"} in the middleware's response, or use \`resultStrategy: "merge"\`.`,
4957
+ q
4958
+ );
4959
+ }
4960
+ }
4961
+ }
4805
4962
  function wholeResponse(result) {
4806
4963
  if (!Array.isArray(result) || result.length !== 1) return void 0;
4807
4964
  const whole = result[0];
@@ -4894,24 +5051,24 @@ function storedFileInputs(inputs, prefix = "", out = /* @__PURE__ */ new Map(),
4894
5051
  var STORE_UPLOAD = /* @__PURE__ */ new Set(["mvp:create_image", "mvp:create_video", "mvp:create_audio", "mvp:create_attachment"]);
4895
5052
  function checkStoreFromStoredFileInput(sections, bag) {
4896
5053
  for (const [payloadKey, arr] of Object.entries(sections)) {
4897
- for (const obj of arr ?? []) {
4898
- if (!obj || typeof obj !== "object") continue;
4899
- const inputs = obj.input;
5054
+ for (const obj2 of arr ?? []) {
5055
+ if (!obj2 || typeof obj2 !== "object") continue;
5056
+ const inputs = obj2.input;
4900
5057
  if (!Array.isArray(inputs)) continue;
4901
5058
  const stored = storedFileInputs(inputs);
4902
5059
  if (stored.size === 0) continue;
4903
5060
  const statements = [];
4904
- collectStatements(obj.run, statements);
5061
+ collectStatements(obj2.run, statements);
4905
5062
  for (const st of statements) {
4906
5063
  if (!STORE_UPLOAD.has(String(st.name))) continue;
4907
5064
  const source = inputBehind(st.context ?? {}, statements, 0);
4908
5065
  if (source === void 0 || !stored.has(source)) continue;
4909
5066
  const kind = stored.get(source) === "blob" ? "attachment" : stored.get(source).replace(/^blob_(img)?/, (_m, img) => img ? "image" : "");
4910
- const name = obj.name;
5067
+ const name = obj2.name;
4911
5068
  bag.warn(
4912
5069
  "storage.stored-file-input",
4913
- `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}": \`s.storage.${String(st.name).slice("mvp:".length)}\` reads \`inp("${source}")\`${st.context?.tag === "var" ? ` (through \`ref("${String(st.context.value)}")\`)` : ""}, an \`input.${kind}()\` \u2014 that input takes an already-stored file, so an upload to it is refused (\`400 Missing param: path\`) before the stack runs. Declare the upload as \`input.file()\`.`,
4914
- obj
5070
+ `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}": \`s.storage.${String(st.name).slice("mvp:".length)}\` reads \`inp("${source}")\`${st.context?.tag === "var" ? ` (through \`ref("${String(st.context.value)}")\`)` : ""}, an \`input.${kind}()\` \u2014 that input takes an already-stored file, so an upload to it is refused (\`400 Missing param: path\`) before the stack runs. Declare the upload as \`input.file()\`.`,
5071
+ obj2
4915
5072
  );
4916
5073
  }
4917
5074
  }
@@ -5065,12 +5222,27 @@ function checkRowSelection(statement, owner, subject, selected, prefix, tables,
5065
5222
  if (!columns) return;
5066
5223
  const known = new Set(columns);
5067
5224
  const aliases = /* @__PURE__ */ new Set();
5068
- for (const list of [context?.eval, statement.addon]) {
5225
+ const evalAliases = /* @__PURE__ */ new Set();
5226
+ for (const [i, list] of [context?.eval, statement.addon].entries()) {
5069
5227
  for (const e of Array.isArray(list) ? list : []) {
5070
5228
  const as = e?.as;
5071
5229
  if (typeof as !== "string") continue;
5072
5230
  known.add(as);
5073
5231
  aliases.add(as);
5232
+ if (i === 0) evalAliases.add(as);
5233
+ }
5234
+ }
5235
+ if (statement.name === DB_QUERY && evalAliases.size > 0 && selected.length > 0) {
5236
+ const selectedNames = new Set(
5237
+ selected.map((node) => node?.name).filter((n) => typeof n === "string")
5238
+ );
5239
+ const unselected = [...evalAliases].filter((alias) => !selectedNames.has(alias));
5240
+ if (unselected.length > 0) {
5241
+ bag.warn(
5242
+ "db.eval-unselected",
5243
+ `${owner}: \`eval\` computes ${unselected.map((n) => `"${n}"`).join(", ")}, but \`output\` does not select ${unselected.length > 1 ? "them" : "it"} \u2014 \`output\` applies to the eval columns too, so ${unselected.length > 1 ? "they are" : "it is"} dropped from the result with no error (and \`InferResponse\` no longer types ${unselected.length > 1 ? "them" : "it"}). List the alias in \`output\` (\`"${prefix}${unselected[0]}"\`) to return it, or drop it from \`eval\`.`,
5244
+ subject
5245
+ );
5074
5246
  }
5075
5247
  }
5076
5248
  const joined = /* @__PURE__ */ new Set();
@@ -5105,17 +5277,17 @@ function checkRowSelection(statement, owner, subject, selected, prefix, tables,
5105
5277
  function checkPagedOutputRoot(sections, bag) {
5106
5278
  const tables = rowTablesOf(sections);
5107
5279
  for (const [payloadKey, arr] of Object.entries(sections)) {
5108
- for (const obj of arr ?? []) {
5109
- if (!obj || typeof obj !== "object") continue;
5110
- const name = obj.name;
5111
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
5280
+ for (const obj2 of arr ?? []) {
5281
+ if (!obj2 || typeof obj2 !== "object") continue;
5282
+ const name = obj2.name;
5283
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
5112
5284
  const statements = [];
5113
- collectStatements(obj, statements);
5285
+ collectStatements(obj2, statements);
5114
5286
  for (const statement of statements) {
5115
5287
  const roots = outputColumns(statement);
5116
5288
  if (roots === void 0 || roots.size === 0) continue;
5117
5289
  if (ROW_OUTPUT_STATEMENTS.has(String(statement.name))) {
5118
- checkRowSelection(statement, owner, obj, statement.output.items, "", tables, bag);
5290
+ checkRowSelection(statement, owner, obj2, statement.output.items, "", tables, bag);
5119
5291
  continue;
5120
5292
  }
5121
5293
  if (statement.name !== DB_QUERY) continue;
@@ -5123,20 +5295,20 @@ function checkPagedOutputRoot(sections, bag) {
5123
5295
  if (!paging || paging.enabled !== true || paging.metadata !== true) {
5124
5296
  const type = statement.context?.return?.type;
5125
5297
  if (type === void 0 || type === "list" || type === "single" || type === "stream") {
5126
- checkRowSelection(statement, owner, obj, statement.output.items, "", tables, bag);
5298
+ checkRowSelection(statement, owner, obj2, statement.output.items, "", tables, bag);
5127
5299
  }
5128
5300
  continue;
5129
5301
  }
5130
5302
  const envelope2 = [...roots].filter((root) => PAGING_ENVELOPE_ROOTS.includes(root));
5131
5303
  if (envelope2.length > 0) {
5132
- checkEnvelopeSelection(statement, owner, obj, envelope2, [...roots], paging, tables, bag);
5304
+ checkEnvelopeSelection(statement, owner, obj2, envelope2, [...roots], paging, tables, bag);
5133
5305
  continue;
5134
5306
  }
5135
5307
  const cols = [...roots];
5136
5308
  bag.warn(
5137
5309
  "db.query-output-not-envelope-rooted",
5138
5310
  `${owner}: \`s.db.query\` is PAGED with an envelope (\`metadata: true\`, the default), so \`output\` selects from that envelope \u2014 but this selection is rooted at the row (${cols.map((n) => `"${n}"`).join(", ")}). No name matches an envelope key, so every key is dropped and the endpoint answers \`[]\` at HTTP 200 with no error; a \`response\` reading \`ref("<var>.items")\` then dies with \`Unable to locate var: <var>.items\`. Prefix the columns (\`output: [${cols.map((n) => `"items.${n}"`).join(", ")}]\`, adding "curPage"/"itemsReceived"/\u2026 for the counters you want kept), or set \`metadata: false\` to bind the rows themselves and select them directly.`,
5139
- obj
5311
+ obj2
5140
5312
  );
5141
5313
  }
5142
5314
  }
@@ -5145,10 +5317,10 @@ function checkPagedOutputRoot(sections, bag) {
5145
5317
  function checkUnpagedEnvelopeReads(sections, bag) {
5146
5318
  const roots = PAGING_ENVELOPE_ROOTS;
5147
5319
  for (const [payloadKey, arr] of Object.entries(sections)) {
5148
- for (const obj of arr ?? []) {
5149
- if (!obj || typeof obj !== "object") continue;
5320
+ for (const obj2 of arr ?? []) {
5321
+ if (!obj2 || typeof obj2 !== "object") continue;
5150
5322
  const statements = [];
5151
- collectStatements(obj, statements);
5323
+ collectStatements(obj2, statements);
5152
5324
  const rowsOnly = /* @__PURE__ */ new Set();
5153
5325
  const other = /* @__PURE__ */ new Set();
5154
5326
  const metadataOff = /* @__PURE__ */ new Set();
@@ -5167,18 +5339,18 @@ function checkUnpagedEnvelopeReads(sections, bag) {
5167
5339
  }
5168
5340
  if (rowsOnly.size === 0) continue;
5169
5341
  const refs = [];
5170
- collectVarRefs(obj, refs);
5342
+ collectVarRefs(obj2, refs);
5171
5343
  const reported = /* @__PURE__ */ new Set();
5172
5344
  for (const path of refs) {
5173
5345
  const [base, field] = path.split(".");
5174
5346
  if (!base || !field || !rowsOnly.has(base) || other.has(base) || !roots.includes(field)) continue;
5175
5347
  if (reported.has(path)) continue;
5176
5348
  reported.add(path);
5177
- const name = obj.name;
5349
+ const name = obj2.name;
5178
5350
  bag.warn(
5179
5351
  "db.query-envelope-read-unpaged",
5180
- `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}": \`ref("${path}")\` reads the paging envelope, but \`s.db.query\` "${base}" is not paged with one, so it binds the row list and \`${field}\` is no key of it. Read \`ref("${base}")\` for the ` + (metadataOff.has(base) ? `rows, or drop \`metadata: false\` from its \`paging\` to bind \`{ items, \u2026 }\`.` : `rows, or page it (\`paging: { page, per_page }\`, envelope on by default) to bind \`{ items, \u2026 }\`.`),
5181
- obj
5352
+ `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}": \`ref("${path}")\` reads the paging envelope, but \`s.db.query\` "${base}" is not paged with one, so it binds the row list and \`${field}\` is no key of it. Read \`ref("${base}")\` for the ` + (metadataOff.has(base) ? `rows, or drop \`metadata: false\` from its \`paging\` to bind \`{ items, \u2026 }\`.` : `rows, or page it (\`paging: { page, per_page }\`, envelope on by default) to bind \`{ items, \u2026 }\`.`),
5353
+ obj2
5182
5354
  );
5183
5355
  }
5184
5356
  }
@@ -5186,8 +5358,8 @@ function checkUnpagedEnvelopeReads(sections, bag) {
5186
5358
  }
5187
5359
  function checkTriggerSearchColumns(sections, bag) {
5188
5360
  const columnsByGuid = tableColumnsOf(sections);
5189
- for (const obj of sections.trigger ?? []) {
5190
- const record = obj;
5361
+ for (const obj2 of sections.trigger ?? []) {
5362
+ const record = obj2;
5191
5363
  const search = record?.meta?.database?.search;
5192
5364
  if (search === void 0) continue;
5193
5365
  const bare = /* @__PURE__ */ new Map();
@@ -5221,10 +5393,10 @@ function checkTriggerSearchColumns(sections, bag) {
5221
5393
  function checkMixedJoins(sections, bag) {
5222
5394
  for (const [payloadKey, arr] of Object.entries(sections)) {
5223
5395
  if (payloadKey === "dbo" || payloadKey === "addon") continue;
5224
- for (const obj of arr ?? []) {
5225
- if (!obj || typeof obj !== "object") continue;
5396
+ for (const obj2 of arr ?? []) {
5397
+ if (!obj2 || typeof obj2 !== "object") continue;
5226
5398
  let found = false;
5227
- walkNodes(obj, (node) => {
5399
+ walkNodes(obj2, (node) => {
5228
5400
  const terms = node.expression;
5229
5401
  if (found || !Array.isArray(terms) || terms.length < 3) return;
5230
5402
  const joins = new Set(
@@ -5233,7 +5405,7 @@ function checkMixedJoins(sections, bag) {
5233
5405
  if (joins.size > 1 && terms.every((t) => typeof t?.type === "string")) found = true;
5234
5406
  });
5235
5407
  if (!found) continue;
5236
- const record = obj;
5408
+ const record = obj2;
5237
5409
  bag.warn(
5238
5410
  "condition.mixed",
5239
5411
  `${sdkKindName(payloadKey, record)} "${typeof record.name === "string" ? record.name : "?"}": a condition mixes AND and OR at one level (\`mixed(...)\`). A branch reads it left to right, a query filter AND-before-OR, and the stored form says neither. Write \`and(or(a, b), c)\` or \`or(a, and(b, c))\` \u2014 each has one reading everywhere. To keep it as stored: \`diagnostics: { allow: ["condition.mixed"] }\` on the def.`,
@@ -5300,10 +5472,13 @@ function checkTableViews(sections, bag) {
5300
5472
  function checkStacks(tables, sections, bag, workspaceConfig = {}, envSource = "authored") {
5301
5473
  checkMiddleware(sections, bag, workspaceConfig);
5302
5474
  checkPostMergeOnList(sections, bag, workspaceConfig);
5475
+ checkPreReplaceDropsInput(sections, bag, workspaceConfig);
5303
5476
  checkStoreFromStoredFileInput(sections, bag);
5304
5477
  checkInputScope(sections, bag);
5305
5478
  checkColumnScope(sections, bag);
5306
5479
  checkEnvNames(workspaceConfig, sections, bag, envSource);
5480
+ checkEnvSecretResponse(sections, bag);
5481
+ checkCryptoWeakDefaults(sections, bag);
5307
5482
  checkPagedOutputRoot(sections, bag);
5308
5483
  checkUnpagedEnvelopeReads(sections, bag);
5309
5484
  checkApiGroupCors(sections, bag);
@@ -5315,19 +5490,19 @@ function checkStacks(tables, sections, bag, workspaceConfig = {}, envSource = "a
5315
5490
  const tablesByGuid = /* @__PURE__ */ new Map();
5316
5491
  for (const def of tables) tablesByGuid.set(resolveRef("dbo", def), def);
5317
5492
  for (const [payloadKey, arr] of Object.entries(sections)) {
5318
- for (const obj of arr ?? []) {
5319
- if (!obj || typeof obj !== "object") continue;
5320
- const name = obj.name;
5321
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
5493
+ for (const obj2 of arr ?? []) {
5494
+ if (!obj2 || typeof obj2 !== "object") continue;
5495
+ const name = obj2.name;
5496
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
5322
5497
  const statements = [];
5323
- collectStatements(obj, statements);
5498
+ collectStatements(obj2, statements);
5324
5499
  if (statements.length === 0) continue;
5325
5500
  for (const statement of statements) {
5326
5501
  if (statement.name === BULK_UPDATE) {
5327
- checkBulkUpdate(statement, owner, obj, tablesByGuid, bag);
5502
+ checkBulkUpdate(statement, owner, obj2, tablesByGuid, bag);
5328
5503
  }
5329
5504
  }
5330
- checkInternalColumnReads(statements, owner, obj, tablesByGuid, bag);
5505
+ checkInternalColumnReads(statements, owner, obj2, tablesByGuid, bag);
5331
5506
  }
5332
5507
  }
5333
5508
  }
@@ -5350,14 +5525,14 @@ function checkIgnoreEmptyOperand(node, owner, host, bag) {
5350
5525
  }
5351
5526
  function checkExpressionOperands(sections, bag) {
5352
5527
  for (const [payloadKey, arr] of Object.entries(sections)) {
5353
- for (const obj of arr ?? []) {
5354
- if (!obj || typeof obj !== "object") continue;
5355
- const name = obj.name;
5356
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
5357
- walkNodes(obj, (record) => {
5528
+ for (const obj2 of arr ?? []) {
5529
+ if (!obj2 || typeof obj2 !== "object") continue;
5530
+ const name = obj2.name;
5531
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
5532
+ walkNodes(obj2, (record) => {
5358
5533
  const statement = record.statement;
5359
5534
  if (statement && typeof statement === "object" && "op" in statement) {
5360
- checkIgnoreEmptyOperand(statement, owner, obj, bag);
5535
+ checkIgnoreEmptyOperand(statement, owner, obj2, bag);
5361
5536
  }
5362
5537
  });
5363
5538
  }
@@ -5366,11 +5541,11 @@ function checkExpressionOperands(sections, bag) {
5366
5541
  var INTERPOLATED_OBJECT = "[object Object]";
5367
5542
  function checkInterpolatedValues(sections, bag) {
5368
5543
  for (const [payloadKey, arr] of Object.entries(sections)) {
5369
- for (const obj of arr ?? []) {
5370
- if (!obj || typeof obj !== "object") continue;
5371
- const name = obj.name;
5544
+ for (const obj2 of arr ?? []) {
5545
+ if (!obj2 || typeof obj2 !== "object") continue;
5546
+ const name = obj2.name;
5372
5547
  const samples = [];
5373
- walkNodes(obj, (record) => {
5548
+ walkNodes(obj2, (record) => {
5374
5549
  if (typeof record.tag !== "string" || typeof record.value !== "string") return;
5375
5550
  if (!record.value.includes(INTERPOLATED_OBJECT)) return;
5376
5551
  if (samples.length < 2) {
@@ -5379,11 +5554,11 @@ function checkInterpolatedValues(sections, bag) {
5379
5554
  }
5380
5555
  });
5381
5556
  if (samples.length === 0) continue;
5382
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
5557
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
5383
5558
  bag.warn(
5384
5559
  "value.interpolated-object",
5385
5560
  `${owner} stores ${samples.join(" and ")} \u2014 \`[object Object]\` is the JS toString of a tagged value (\`ref()\`/\`inp()\`/\`c.*\`) interpolated into a template literal or \`+\` concatenation, which evaluates at BUILD time; the engine serves this text verbatim. Compose at runtime instead: \`withFilters(c.text("\u2026"), fl.concat(ref("\u2026")))\`, an \`obj({...})\` member, or \`c.expression\`.`,
5386
- obj
5561
+ obj2
5387
5562
  );
5388
5563
  }
5389
5564
  }
@@ -5408,10 +5583,10 @@ var INT64_MIN = -(2n ** 63n);
5408
5583
  var INT64_MAX = 2n ** 63n - 1n;
5409
5584
  function checkIntRange(sections, bag) {
5410
5585
  for (const [payloadKey, arr] of Object.entries(sections)) {
5411
- for (const obj of arr ?? []) {
5412
- if (!obj || typeof obj !== "object") continue;
5586
+ for (const obj2 of arr ?? []) {
5587
+ if (!obj2 || typeof obj2 !== "object") continue;
5413
5588
  const out = [];
5414
- walkNodes(obj, (record) => {
5589
+ walkNodes(obj2, (record) => {
5415
5590
  if (record.tag !== "const:int") return;
5416
5591
  const raw = typeof record.value === "string" ? record.value : typeof record.operand === "string" ? record.operand : void 0;
5417
5592
  if (raw === void 0 || !/^[+-]?\d+$/.test(raw)) return;
@@ -5419,42 +5594,42 @@ function checkIntRange(sections, bag) {
5419
5594
  if ((n < INT64_MIN || n > INT64_MAX) && !out.includes(raw)) out.push(raw);
5420
5595
  });
5421
5596
  if (out.length === 0) continue;
5422
- const name = obj.name;
5597
+ const name = obj2.name;
5423
5598
  bag.warn(
5424
5599
  "value.int-out-of-range",
5425
- `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}" stores the integer ${out.map((v) => `\`${v}\``).join(", ")}, outside the signed 64-bit range (${INT64_MIN} to ${INT64_MAX}). The engine clamps it to the nearest bound with no error. Use a value in range, or c.decimal()/c.text() when the magnitude is the point.`,
5426
- obj
5600
+ `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}" stores the integer ${out.map((v) => `\`${v}\``).join(", ")}, outside the signed 64-bit range (${INT64_MIN} to ${INT64_MAX}). The engine clamps it to the nearest bound with no error. Use a value in range, or c.decimal()/c.text() when the magnitude is the point.`,
5601
+ obj2
5427
5602
  );
5428
5603
  }
5429
5604
  }
5430
5605
  }
5431
5606
  function checkZeroBasedObjects(sections, bag) {
5432
5607
  for (const [payloadKey, arr] of Object.entries(sections)) {
5433
- for (const obj of arr ?? []) {
5434
- if (!obj || typeof obj !== "object") continue;
5608
+ for (const obj2 of arr ?? []) {
5609
+ if (!obj2 || typeof obj2 !== "object") continue;
5435
5610
  const samples = [];
5436
- walkNodes(obj, (record) => {
5611
+ walkNodes(obj2, (record) => {
5437
5612
  const keys = indexRunKeys(record);
5438
5613
  if (keys !== null && samples.length < 2) samples.push(`{${keys.map((k) => `${JSON.stringify(k)}: \u2026`).join(", ")}}`);
5439
5614
  });
5440
5615
  if (samples.length === 0) continue;
5441
- const name = obj.name;
5442
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
5616
+ const name = obj2.name;
5617
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
5443
5618
  bag.warn(
5444
5619
  "value.obj-zero-based-numeric-keys",
5445
5620
  `${owner} stores the object ${samples.join(" and ")}, whose zero-based numeric keys make the engine evaluate it as a LIST, not an object. A numeric key IS an index in that data model, which is not something this encoding introduces. If you want the list, write c.array([\u2026]) and the intent is on the page; if you want an object, prefix the keys so they are not an index run (e.g. "k0"). A non-zero-based numeric key ({"2": \u2026}) survives as a key.`,
5446
- obj
5621
+ obj2
5447
5622
  );
5448
5623
  }
5449
5624
  }
5450
5625
  }
5451
5626
  function checkRegexOperandOrder(sections, bag) {
5452
5627
  for (const [payloadKey, arr] of Object.entries(sections)) {
5453
- for (const obj of arr ?? []) {
5454
- if (!obj || typeof obj !== "object") continue;
5455
- const name = obj.name;
5628
+ for (const obj2 of arr ?? []) {
5629
+ if (!obj2 || typeof obj2 !== "object") continue;
5630
+ const name = obj2.name;
5456
5631
  const seen = /* @__PURE__ */ new Set();
5457
- walkNodes(obj, (record) => {
5632
+ walkNodes(obj2, (record) => {
5458
5633
  if (typeof record.tag !== "string" || typeof record.value !== "string") return;
5459
5634
  if (!Array.isArray(record.filters)) return;
5460
5635
  const reversed = reversedRegexOperands(record);
@@ -5462,11 +5637,265 @@ function checkRegexOperandOrder(sections, bag) {
5462
5637
  seen.add(`\`${reversed.filter}\` (pattern ${JSON.stringify(reversed.subject)})`);
5463
5638
  });
5464
5639
  if (seen.size === 0) continue;
5465
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
5640
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
5466
5641
  bag.warn(
5467
5642
  "value.regex-operands-reversed",
5468
5643
  `${owner} pipes a regex filter's SUBJECT and passes its PATTERN as the argument: ${[...seen].join("; ")}. The regex family is pattern-piped \u2014 the piped value is the PATTERN and the argument is the text tested against it, the reverse of every other filter \u2014 so this answers false for every input with HTTP 200 and no error, and a precondition built on it lets through the values it exists to refuse. Swap the operands: \`withFilters(c.regex(\u2026), fl.regex_test(subject))\`.`,
5469
- obj
5644
+ obj2
5645
+ );
5646
+ }
5647
+ }
5648
+ }
5649
+ var TEXT_PREDICATES = {
5650
+ "mvp:text_contains": "contains",
5651
+ "mvp:text_icontains": "icontains",
5652
+ "mvp:text_starts_with": "starts_with",
5653
+ "mvp:text_istarts_with": "istarts_with",
5654
+ "mvp:text_ends_with": "ends_with",
5655
+ "mvp:text_iends_with": "iends_with"
5656
+ };
5657
+ function checkUnboundPredicates(sections, bag) {
5658
+ for (const [payloadKey, arr] of Object.entries(sections)) {
5659
+ for (const obj2 of arr ?? []) {
5660
+ if (!obj2 || typeof obj2 !== "object") continue;
5661
+ const found = /* @__PURE__ */ new Set();
5662
+ walkNodes(obj2, (record) => {
5663
+ const op = typeof record.name === "string" && Object.hasOwn(TEXT_PREDICATES, record.name) ? TEXT_PREDICATES[record.name] : void 0;
5664
+ if (op === void 0 || record.disabled === true) return;
5665
+ if (typeof record.as === "string" && record.as !== "") return;
5666
+ found.add(`s.text.${op}`);
5667
+ });
5668
+ if (found.size === 0) continue;
5669
+ const name = obj2.name;
5670
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
5671
+ for (const st of found) {
5672
+ bag.warn(
5673
+ "stack.predicate-unbound",
5674
+ `${owner}: \`${st}\` has no \`as\`, so it does nothing. Unlike the trims, a predicate does not write back into \`name\`: the bool it computes is dropped. Bind it: \`${st}({ name, value, as: "matches" })\`, then read \`ref("matches")\`.`,
5675
+ obj2
5676
+ );
5677
+ }
5678
+ }
5679
+ }
5680
+ }
5681
+ var PER_ITEM_KEY = {
5682
+ "mvp:array_group_by": { factory: "s.array.group_by", arg: "by" },
5683
+ "mvp:array_difference": { factory: "s.array.difference", arg: "by" },
5684
+ "mvp:array_intersection": { factory: "s.array.intersection", arg: "by" },
5685
+ "mvp:array_union": { factory: "s.array.union", arg: "transform" }
5686
+ };
5687
+ function constantForEveryItem(v) {
5688
+ if (!v || typeof v !== "object") return false;
5689
+ const { tag, filters } = v;
5690
+ if (typeof tag !== "string" || !tag.startsWith("const") || tag.startsWith("const:expr")) return false;
5691
+ if (filters === void 0) return true;
5692
+ if (!Array.isArray(filters)) return false;
5693
+ return filters.every((f) => {
5694
+ const arg = f?.arg;
5695
+ return arg === void 0 || Array.isArray(arg) && arg.every(constantForEveryItem);
5696
+ });
5697
+ }
5698
+ function checkConstantArrayKeys(sections, bag) {
5699
+ for (const [payloadKey, arr] of Object.entries(sections)) {
5700
+ for (const obj2 of arr ?? []) {
5701
+ if (!obj2 || typeof obj2 !== "object") continue;
5702
+ const found = /* @__PURE__ */ new Map();
5703
+ walkNodes(obj2, (record) => {
5704
+ if (typeof record.name !== "string" || !Object.hasOwn(PER_ITEM_KEY, record.name) || record.disabled === true) return;
5705
+ const key = record.context?.transform_value;
5706
+ if (!constantForEveryItem(key)) return;
5707
+ const { factory, arg } = PER_ITEM_KEY[record.name];
5708
+ found.set(factory, arg);
5709
+ });
5710
+ if (found.size === 0) continue;
5711
+ const name = obj2.name;
5712
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
5713
+ for (const [factory, arg] of found) {
5714
+ bag.warn(
5715
+ "stack.array-key-constant",
5716
+ `${owner}: \`${factory}\`'s \`${arg}\` is a constant, so every item gets the same key. \`${arg}\` is an expression evaluated per item, not a column name: read the item with \`ref("$this.<path>")\` (\`${arg}: ref("$this.id")\`). A constant returns wrong data with HTTP 200.`,
5717
+ obj2
5718
+ );
5719
+ }
5720
+ }
5721
+ }
5722
+ }
5723
+ var PREDICATES_WITHOUT_INDEX = {
5724
+ "mvp:array_filter": "s.array.filter",
5725
+ "mvp:array_find": "s.array.find",
5726
+ "mvp:array_find_index": "s.array.find_index",
5727
+ "mvp:array_has": "s.array.has",
5728
+ "mvp:array_every": "s.array.every",
5729
+ "mvp:array_filter_count": "s.array.filter_count"
5730
+ };
5731
+ function checkPredicateIndexReads(sections, bag) {
5732
+ for (const [payloadKey, arr] of Object.entries(sections)) {
5733
+ for (const obj2 of arr ?? []) {
5734
+ if (!obj2 || typeof obj2 !== "object") continue;
5735
+ const found = /* @__PURE__ */ new Set();
5736
+ walkNodes(obj2, (record) => {
5737
+ if (typeof record.name !== "string" || !Object.hasOwn(PREDICATES_WITHOUT_INDEX, record.name)) return;
5738
+ if (record.disabled === true) return;
5739
+ let reads = false;
5740
+ walkNodes(record.context?.expr, (node) => {
5741
+ const read = node.operand ?? node.value;
5742
+ if (node.tag === "var" && typeof read === "string" && /^\$index(?:$|[.[])/.test(read)) reads = true;
5743
+ });
5744
+ if (reads) found.add(PREDICATES_WITHOUT_INDEX[record.name]);
5745
+ });
5746
+ if (found.size === 0) continue;
5747
+ const name = obj2.name;
5748
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
5749
+ for (const st of found) {
5750
+ bag.warn(
5751
+ "stack.array-index-unbound",
5752
+ `${owner}: \`${st}\`'s \`if\` reads \`$index\`, which it does not bind (only \`$this\`), so every non-empty request fails with 500 "Missing var entry: $index". \`s.array.partition\` and \`s.array.map\` bind it: map each item to \`{ v: $this, i: $index }\` first, then test \`$this.i\`.`,
5753
+ obj2
5754
+ );
5755
+ }
5756
+ }
5757
+ }
5758
+ }
5759
+ function checkPreconditionBareErrors(sections, bag) {
5760
+ for (const [payloadKey, arr] of Object.entries(sections)) {
5761
+ for (const obj2 of arr ?? []) {
5762
+ if (!obj2 || typeof obj2 !== "object") continue;
5763
+ const messages = [];
5764
+ walkNodes(obj2, (record) => {
5765
+ if (record.name !== "mvp:precondition" || record.disabled === true) return;
5766
+ const error = record.context?.error;
5767
+ if (typeof error === "string" && error !== "") messages.push(error);
5768
+ });
5769
+ if (messages.length === 0) continue;
5770
+ const name = obj2.name;
5771
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
5772
+ for (const message of new Set(messages)) {
5773
+ bag.warn(
5774
+ "stack.precondition-bare-error",
5775
+ `${owner}: \`s.precondition\`'s \`error\` is a bare string (${JSON.stringify(message)}), which the engine drops: the client gets "Precondition failed." instead. Wrap it: \`error: c.text(${JSON.stringify(message)})\`.`,
5776
+ obj2
5777
+ );
5778
+ }
5779
+ }
5780
+ }
5781
+ }
5782
+ function checkReturnedStreams(sections, bag) {
5783
+ const readsVar = (root, names, hit) => {
5784
+ walkNodes(root, (node) => {
5785
+ if (node.tag !== "var" || typeof node.value !== "string") return;
5786
+ const head = /^[^.[]+/.exec(node.value)?.[0];
5787
+ if (head !== void 0 && names.has(head)) hit.add(head);
5788
+ });
5789
+ };
5790
+ for (const [payloadKey, arr] of Object.entries(sections)) {
5791
+ for (const obj2 of arr ?? []) {
5792
+ if (!obj2 || typeof obj2 !== "object") continue;
5793
+ const streams = /* @__PURE__ */ new Set();
5794
+ walkNodes(obj2, (record) => {
5795
+ if (record.name !== "mvp:dbo_view" || typeof record.as !== "string" || record.as === "") return;
5796
+ const type = record.context?.return?.type;
5797
+ if (type === "stream") streams.add(record.as);
5798
+ });
5799
+ if (streams.size === 0) continue;
5800
+ const hit = /* @__PURE__ */ new Set();
5801
+ readsVar(obj2.result, streams, hit);
5802
+ walkNodes(obj2, (record) => {
5803
+ if (record.name === "mvp:return") readsVar(record.context, streams, hit);
5804
+ });
5805
+ if (hit.size === 0) continue;
5806
+ const name = obj2.name;
5807
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
5808
+ for (const v of hit) {
5809
+ bag.warn(
5810
+ "db.stream-returned",
5811
+ `${owner} returns \`${v}\`, a \`returnType: "stream"\` binding. A stream is a cursor, not rows: returned, the client gets the text "@stream" with HTTP 200. Consume it with \`s.foreach({ list: ref("${v}"), \u2026 })\`, or query with \`returnType: "list"\` to return rows.`,
5812
+ obj2
5813
+ );
5814
+ }
5815
+ }
5816
+ }
5817
+ }
5818
+ var FILE_VALUE_MEMBERS = /* @__PURE__ */ new Set(["access", "path", "name", "type", "size", "mime", "meta"]);
5819
+ function checkReturnedIncludeMeta(sections, bag) {
5820
+ const readsVar = (root, names, hit) => {
5821
+ walkNodes(root, (node) => {
5822
+ if (node.tag !== "var" || typeof node.value !== "string") return;
5823
+ const m = /^([^.[]+)(?:\.([^.[]+))?/.exec(node.value);
5824
+ const head = m?.[1];
5825
+ if (head === void 0 || !names.has(head)) return;
5826
+ const member = m?.[2];
5827
+ if (member !== void 0 && FILE_VALUE_MEMBERS.has(member)) return;
5828
+ if (!hit.has(head) || node.value === head) hit.set(head, node.value);
5829
+ });
5830
+ };
5831
+ for (const [payloadKey, arr] of Object.entries(sections)) {
5832
+ for (const obj2 of arr ?? []) {
5833
+ if (!obj2 || typeof obj2 !== "object") continue;
5834
+ const records = /* @__PURE__ */ new Set();
5835
+ walkNodes(obj2, (record) => {
5836
+ if (record.name !== "mvp:create_attachment" || typeof record.as !== "string" || record.as === "") return;
5837
+ if (record.context?.include_meta === true) records.add(record.as);
5838
+ });
5839
+ if (records.size === 0) continue;
5840
+ const hit = /* @__PURE__ */ new Map();
5841
+ readsVar(obj2.result, records, hit);
5842
+ walkNodes(obj2, (record) => {
5843
+ if (record.name === "mvp:return") readsVar(record.context, records, hit);
5844
+ });
5845
+ if (hit.size === 0) continue;
5846
+ const name = obj2.name;
5847
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
5848
+ for (const [v, read] of hit) {
5849
+ bag.warn(
5850
+ "storage.include-meta-returned",
5851
+ `${owner} returns \`${read}\`, from an \`s.storage.create_attachment({ include_meta: true })\` binding. \`include_meta: true\` binds the engine's internal file record, not the file value: returned, it exposes storage internals (\`sig\`, \`guid\`, and \`storage\` with the bucket name) to the client. Return only the fields you need (\`ref("${v}.path")\`, \`ref("${v}.name")\`, \u2026), or drop \`include_meta\` to bind the file value.`,
5852
+ obj2
5853
+ );
5854
+ }
5855
+ }
5856
+ }
5857
+ }
5858
+ var INFERRED_RESPONSE_SECTIONS = ["query", "function", "tool", "middleware", "prompt", "resource", "trigger", "message"];
5859
+ function checkReturnsOutsideInferredType(sections, bag, declaresShape) {
5860
+ const same = (a, b) => JSON.stringify(a) === JSON.stringify(b);
5861
+ for (const payloadKey of INFERRED_RESPONSE_SECTIONS) {
5862
+ for (const obj2 of sections[payloadKey] ?? []) {
5863
+ if (!obj2 || typeof obj2 !== "object") continue;
5864
+ const o = obj2;
5865
+ if (!Array.isArray(o.result) || o.result.length === 0 || declaresShape(obj2)) continue;
5866
+ const items = o.result;
5867
+ let body;
5868
+ if (items.length === 1 && items[0].name === "") {
5869
+ body = { value: items[0].value, tag: items[0].tag, filters: items[0].filters };
5870
+ } else {
5871
+ try {
5872
+ const record = obj(Object.fromEntries(items.map((i) => [String(i.name), { tag: i.tag, value: i.value, filters: i.filters }])));
5873
+ body = { value: record.value, tag: record.tag, filters: record.filters };
5874
+ } catch {
5875
+ body = void 0;
5876
+ }
5877
+ }
5878
+ let other = false;
5879
+ const visit = (node) => {
5880
+ if (other) return;
5881
+ if (Array.isArray(node)) return node.forEach(visit);
5882
+ if (!node || typeof node !== "object") return;
5883
+ const record = node;
5884
+ if (typeof record.name === "string" && record.name.startsWith("mvp:") && record.disabled === true) return;
5885
+ if (record.name === "mvp:return") {
5886
+ const ctx = record.context ?? {};
5887
+ if (!same({ value: ctx.value, tag: ctx.tag, filters: ctx.filters }, body)) other = true;
5888
+ return;
5889
+ }
5890
+ Object.values(record).forEach(visit);
5891
+ };
5892
+ visit(o.run);
5893
+ if (!other) continue;
5894
+ const owner = `${sdkKindName(payloadKey, o)} "${typeof o.name === "string" ? o.name : "?"}"`;
5895
+ bag.warn(
5896
+ "response.return-outside-type",
5897
+ `${owner}: an \`s.return\` in its stack serves a body other than \`response\`, and \`InferResponse\` types this def from \`response\` only, so the early-return body is missing from the inferred type and a typed client reads fields that path never sends. Declare \`responseShape\` as the union of every body it serves: \`responseShape: null as A | B\`. If no typed client reads it, accept it: \`diagnostics: { allow: ["response.return-outside-type"] }\`.`,
5898
+ obj2
5470
5899
  );
5471
5900
  }
5472
5901
  }
@@ -5505,10 +5934,10 @@ function etcZoneFor(tz) {
5505
5934
  }
5506
5935
  function checkTimezoneArgs(sections, bag) {
5507
5936
  for (const [payloadKey, arr] of Object.entries(sections)) {
5508
- for (const obj of arr ?? []) {
5509
- if (!obj || typeof obj !== "object") continue;
5937
+ for (const obj2 of arr ?? []) {
5938
+ if (!obj2 || typeof obj2 !== "object") continue;
5510
5939
  const seen = /* @__PURE__ */ new Map();
5511
- walkNodes(obj, (record) => {
5940
+ walkNodes(obj2, (record) => {
5512
5941
  const at = typeof record.name === "string" && Array.isArray(record.arg) ? TIMEZONE_ARG[record.name] : void 0;
5513
5942
  if (at === void 0) return;
5514
5943
  const tz = record.arg[at];
@@ -5522,8 +5951,8 @@ function checkTimezoneArgs(sections, bag) {
5522
5951
  for (const [call, near] of seen) {
5523
5952
  bag.warn(
5524
5953
  "value.timezone-unknown",
5525
- `${sdkKindName(payloadKey, obj)} "${String(obj.name ?? "?")}": ${call} names a timezone the engine does not apply \u2014 it formats in UTC instead, without an error. ` + (near !== "" ? `Did you mean ${JSON.stringify(near)}?` : `Use an IANA name such as "America/New_York" or "UTC".`),
5526
- obj
5954
+ `${sdkKindName(payloadKey, obj2)} "${String(obj2.name ?? "?")}": ${call} names a timezone the engine does not apply \u2014 it formats in UTC instead, without an error. ` + (near !== "" ? `Did you mean ${JSON.stringify(near)}?` : `Use an IANA name such as "America/New_York" or "UTC".`),
5955
+ obj2
5527
5956
  );
5528
5957
  }
5529
5958
  }
@@ -5585,14 +6014,14 @@ function checkReservedColumnNames(tables, bag) {
5585
6014
  }
5586
6015
  function checkCacheTtl(sections, bag) {
5587
6016
  for (const key of ["query", "function"]) {
5588
- for (const obj of sections[key] ?? []) {
5589
- const o = obj;
6017
+ for (const obj2 of sections[key] ?? []) {
6018
+ const o = obj2;
5590
6019
  const ttl = o?.cache?.ttl;
5591
6020
  if (o?.cache?.active !== true || Number.isInteger(ttl) && ttl > 0) continue;
5592
6021
  bag.warn(
5593
6022
  "cache.ttl-not-positive",
5594
6023
  `${key} "${String(o.name)}": \`cache.ttl\` is ${JSON.stringify(ttl) ?? String(ttl)} \u2014 the engine stores a response only for a ttl of 1 or more whole seconds, so this cache never holds anything while every call still looks it up. Set a positive ttl (\`cache: { ttl: 60 }\`), or remove the \`cache\` block for no caching.`,
5595
- obj
6024
+ obj2
5596
6025
  );
5597
6026
  }
5598
6027
  }
@@ -5626,12 +6055,12 @@ function checkReservedInputNames(sections, bag) {
5626
6055
  }
5627
6056
  }
5628
6057
  for (const [payloadKey, arr] of Object.entries(sections)) {
5629
- for (const obj of arr ?? []) {
5630
- if (!obj || typeof obj !== "object") continue;
5631
- const objName = obj.name;
5632
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof objName === "string" ? objName : "?"}"`;
6058
+ for (const obj2 of arr ?? []) {
6059
+ if (!obj2 || typeof obj2 !== "object") continue;
6060
+ const objName = obj2.name;
6061
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof objName === "string" ? objName : "?"}"`;
5633
6062
  const statements = [];
5634
- collectStatements(obj, statements);
6063
+ collectStatements(obj2, statements);
5635
6064
  for (const statement of statements) {
5636
6065
  const factory = callsWithInput[statement.name];
5637
6066
  if (factory === void 0) continue;
@@ -5640,7 +6069,7 @@ function checkReservedInputNames(sections, bag) {
5640
6069
  bag.warn(
5641
6070
  "statement.reserved-input-name",
5642
6071
  `${owner}: \`${factory}\` passes an input named \`${reserved}\`, which is reserved by the engine \u2014 it skips a \`${reserved}\` key when it evaluates a call's arguments, so the callee receives the unevaluated argument: an object input binds its defaults with no error, a text input fails with HTTP 400 naming \`${reserved}\`. ${fix(reserved)}`,
5643
- obj
6072
+ obj2
5644
6073
  );
5645
6074
  }
5646
6075
  }
@@ -5666,10 +6095,10 @@ function enabledFunctionRuns(root) {
5666
6095
  }
5667
6096
  return out;
5668
6097
  }
5669
- function sdkSubject(payloadKey, obj) {
5670
- const name = typeof obj.name === "string" ? obj.name : "?";
5671
- const verb = payloadKey === "query" && typeof obj.verb === "string" && obj.verb !== "" ? `${obj.verb} ` : "";
5672
- return `${sdkKindName(payloadKey, obj)} "${verb}${name}"`;
6098
+ function sdkSubject(payloadKey, obj2) {
6099
+ const name = typeof obj2.name === "string" ? obj2.name : "?";
6100
+ const verb = payloadKey === "query" && typeof obj2.verb === "string" && obj2.verb !== "" ? `${obj2.verb} ` : "";
6101
+ return `${sdkKindName(payloadKey, obj2)} "${verb}${name}"`;
5673
6102
  }
5674
6103
  var RAW_REQUEST_HOSTS = /* @__PURE__ */ new Set(["query", "tool", "prompt"]);
5675
6104
  function callableInputNames(record, section, tableColumns2) {
@@ -5690,14 +6119,14 @@ function checkOmittedCallInputs(sections, bag) {
5690
6119
  });
5691
6120
  }
5692
6121
  for (const [payloadKey, arr] of Object.entries(sections)) {
5693
- for (const obj of arr ?? []) {
5694
- if (!obj || typeof obj !== "object") continue;
5695
- const own = declaredInputNames(obj, tableColumns2);
6122
+ for (const obj2 of arr ?? []) {
6123
+ if (!obj2 || typeof obj2 !== "object") continue;
6124
+ const own = declaredInputNames(obj2, tableColumns2);
5696
6125
  if (own === null) continue;
5697
6126
  const raw = own.size === 0 && RAW_REQUEST_HOSTS.has(payloadKey);
5698
6127
  if (own.size === 0 && !raw) continue;
5699
- const owner = sdkSubject(payloadKey, obj);
5700
- for (const statement of enabledFunctionRuns(obj)) {
6128
+ const owner = sdkSubject(payloadKey, obj2);
6129
+ for (const statement of enabledFunctionRuns(obj2)) {
5701
6130
  const id = statement.context?.function?.id;
5702
6131
  const target = typeof id === "string" ? declared.get(id) : void 0;
5703
6132
  if (target === void 0) continue;
@@ -5711,7 +6140,7 @@ function checkOmittedCallInputs(sections, bag) {
5711
6140
  bag.warn(
5712
6141
  "statement.omitted-input",
5713
6142
  `${owner}: \`s.function.run\` of function "${target.name}" does not pass ${list}. ${how} Pass ${one ? "it" : "them"} explicitly (\`ignored()\` keeps the target's default). If the pass-through is what you want, accept it with \`diagnostics: { allow: ["statement.omitted-input"] }\`.`,
5714
- obj
6143
+ obj2
5715
6144
  );
5716
6145
  }
5717
6146
  }
@@ -5732,8 +6161,8 @@ function checkUnknownCallInputs(sections, bag) {
5732
6161
  let hit = targets.get(section);
5733
6162
  if (hit !== void 0) return hit;
5734
6163
  hit = /* @__PURE__ */ new Map();
5735
- for (const obj of sections[section] ?? []) {
5736
- const record = obj ?? {};
6164
+ for (const obj2 of sections[section] ?? []) {
6165
+ const record = obj2 ?? {};
5737
6166
  if (typeof record.guid !== "string") continue;
5738
6167
  const inputs = declaredInputNames(record, tableColumns2);
5739
6168
  const name = typeof record.name === "string" ? record.name : "?";
@@ -5747,11 +6176,11 @@ function checkUnknownCallInputs(sections, bag) {
5747
6176
  return hit;
5748
6177
  };
5749
6178
  for (const [payloadKey, arr] of Object.entries(sections)) {
5750
- for (const obj of arr ?? []) {
5751
- if (!obj || typeof obj !== "object") continue;
5752
- const owner = sdkSubject(payloadKey, obj);
6179
+ for (const obj2 of arr ?? []) {
6180
+ if (!obj2 || typeof obj2 !== "object") continue;
6181
+ const owner = sdkSubject(payloadKey, obj2);
5753
6182
  const statements = [];
5754
- collectStatements(obj, statements);
6183
+ collectStatements(obj2, statements);
5755
6184
  for (const statement of statements) {
5756
6185
  if (statement.disabled === true) continue;
5757
6186
  const shape = NAMED_INPUT_CALLS[statement.name];
@@ -5769,7 +6198,7 @@ function checkUnknownCallInputs(sections, bag) {
5769
6198
  bag.warn(
5770
6199
  "statement.unknown-input",
5771
6200
  `${owner}: \`${surface}\` of ${sdkKindName(section, {})} "${target.name}" passes \`${key}\`, which that ${sdkKindName(section, {})} does not declare \u2014 the engine drops it, so the target never sees the value.` + (near !== void 0 ? ` Did you mean \`${near}\`?` : declared.length === 0 ? ` It declares no inputs.` : ` It declares ${proseList(declared.map((d) => `\`${d}\``), "and")}.`),
5772
- obj
6201
+ obj2
5773
6202
  );
5774
6203
  }
5775
6204
  }
@@ -5780,8 +6209,8 @@ function checkUnitTests(sections, bag) {
5780
6209
  const tableColumns2 = tableColumnsOf(sections);
5781
6210
  for (const [payloadKey, arr] of Object.entries(sections)) {
5782
6211
  if (payloadKey === "workflow_test") continue;
5783
- for (const obj of arr ?? []) {
5784
- const record = obj;
6212
+ for (const obj2 of arr ?? []) {
6213
+ const record = obj2;
5785
6214
  if (!record || typeof record !== "object" || !Array.isArray(record.test)) continue;
5786
6215
  const owner = sdkSubject(payloadKey, record);
5787
6216
  const declared = declaredInputNames(record, tableColumns2);
@@ -5821,8 +6250,8 @@ function checkAddonAliases(owner, attached, subject, bag) {
5821
6250
  }
5822
6251
  function checkAddonOutput(sections, bag) {
5823
6252
  const tables = rowTablesOf(sections);
5824
- for (const obj of sections.addon ?? []) {
5825
- const record = obj;
6253
+ for (const obj2 of sections.addon ?? []) {
6254
+ const record = obj2;
5826
6255
  if (!record || typeof record !== "object") continue;
5827
6256
  const output = record.output;
5828
6257
  if (output?.customize !== true || !Array.isArray(output.items)) continue;
@@ -5851,15 +6280,15 @@ function checkAddonAttachments(sections, bag) {
5851
6280
  return typeof id === "string" ? id : void 0;
5852
6281
  };
5853
6282
  for (const [payloadKey, arr] of Object.entries(sections)) {
5854
- for (const obj of arr ?? []) {
5855
- if (!obj || typeof obj !== "object") continue;
5856
- const owner = sdkSubject(payloadKey, obj);
6283
+ for (const obj2 of arr ?? []) {
6284
+ if (!obj2 || typeof obj2 !== "object") continue;
6285
+ const owner = sdkSubject(payloadKey, obj2);
5857
6286
  const statements = [];
5858
- collectStatements(obj, statements);
6287
+ collectStatements(obj2, statements);
5859
6288
  for (const statement of statements) {
5860
6289
  const attached = statement.addon;
5861
6290
  if (!Array.isArray(attached) || attached.length === 0) continue;
5862
- checkAddonAliases(owner, attached, obj, bag);
6291
+ checkAddonAliases(owner, attached, obj2, bag);
5863
6292
  const derived = hasDerivedColumns(statement.context);
5864
6293
  const pending = attached.map((spec) => ({
5865
6294
  spec,
@@ -5882,7 +6311,7 @@ function checkAddonAttachments(sections, bag) {
5882
6311
  bag.warn(
5883
6312
  "db.addon-unknown-input",
5884
6313
  `${owner}: the attached ${label} is passed \`${e.name}\`, which that addon does not declare \u2014 the engine drops it, so the addon runs with its input unset and grafts nothing.` + (near !== void 0 ? ` Did you mean \`${near}\`?` : known.length === 0 ? ` It declares no inputs.` : ` It declares ${proseList(known.map((k) => `\`${k}\``), "and")}.`),
5885
- obj
6314
+ obj2
5886
6315
  );
5887
6316
  }
5888
6317
  if (columns !== void 0 && e.tag === "output" && typeof e.value === "string" && e.value !== "") {
@@ -5892,12 +6321,12 @@ function checkAddonAttachments(sections, bag) {
5892
6321
  bag.warn(
5893
6322
  "db.addon-unknown-column",
5894
6323
  `${owner}: the attached ${label} binds \`out("${e.value}")\`, but the rows it reads have no \`${base}\` column \u2014 the binding is null on every row, so the addon grafts nothing.` + (near !== void 0 ? ` Did you mean \`out("${near}")\`?` : ` The columns are ${proseList(columns.map((c2) => `\`${c2}\``), "and")}.`),
5895
- obj
6324
+ obj2
5896
6325
  );
5897
6326
  }
5898
6327
  }
5899
6328
  if (Array.isArray(a.children)) {
5900
- checkAddonAliases(owner, a.children, obj, bag);
6329
+ checkAddonAliases(owner, a.children, obj2, bag);
5901
6330
  const childTable = target === void 0 ? void 0 : tableOf(target.context);
5902
6331
  for (const child of a.children) {
5903
6332
  pending.push({ spec: child, rowTable: childTable, derived: target === void 0 || hasDerivedColumns(target.context) });
@@ -5913,9 +6342,9 @@ var GATING_ACTIONS = {
5913
6342
  channel: ["join"]
5914
6343
  };
5915
6344
  function checkRealtimeGates(sections, bag) {
5916
- for (const obj of sections.trigger ?? []) {
5917
- if (!obj || typeof obj !== "object") continue;
5918
- const t = obj;
6345
+ for (const obj2 of sections.trigger ?? []) {
6346
+ if (!obj2 || typeof obj2 !== "object") continue;
6347
+ const t = obj2;
5919
6348
  if (Array.isArray(t.result) && t.result.length > 0) {
5920
6349
  checkGateAllowedLiteral(t, bag);
5921
6350
  continue;
@@ -5931,7 +6360,7 @@ function checkRealtimeGates(sections, bag) {
5931
6360
  bag.warn(
5932
6361
  "realtime.gate-denies-everyone",
5933
6362
  `${sdkKindName("trigger", t)} "${name}" gates \`${declared.join("`/`")}\` but declares no \`response\`, so it returns nothing on every run \u2014 and an empty return is a DENY, which refuses every client. A crash denies too, so there is no shape of this trigger that admits anyone. Add \`response: () => obj({ allowed: c.bool(true) })\` (any truthy value admits; an \`allowed: false\` with a \`reason\` reaches the client). If refusing everyone is the intent, say so with \`response: () => obj({ allowed: c.bool(false), reason: c.text("\u2026") })\`.`,
5934
- obj
6363
+ obj2
5935
6364
  );
5936
6365
  }
5937
6366
  }
@@ -6040,16 +6469,16 @@ function checkGateAllowedLiteral(t, bag) {
6040
6469
  );
6041
6470
  }
6042
6471
  function checkNonNullVectorColumns(sections, bag) {
6043
- for (const obj of sections.dbo ?? []) {
6044
- if (!obj || typeof obj !== "object") continue;
6045
- const table = obj;
6472
+ for (const obj2 of sections.dbo ?? []) {
6473
+ if (!obj2 || typeof obj2 !== "object") continue;
6474
+ const table = obj2;
6046
6475
  for (const col of Array.isArray(table.schema) ? table.schema : []) {
6047
6476
  const field = col;
6048
6477
  if (field?.type !== "vector" || field.nullable !== false || (field.default ?? "") !== "") continue;
6049
6478
  bag.warn(
6050
6479
  "field.vector-not-nullable",
6051
6480
  `table "${String(table.name)}", column "${String(field.name)}" is a vector with \`nullable: false\` and no default \u2014 an empty default becomes NULL only on a nullable column, and \`''\` is not a vector, so the table FAILS TO CREATE on deploy. Drop \`nullable: false\` (vectors are nullable by default).`,
6052
- obj
6481
+ obj2
6053
6482
  );
6054
6483
  }
6055
6484
  }
@@ -6057,22 +6486,22 @@ function checkNonNullVectorColumns(sections, bag) {
6057
6486
  function checkRealtimeSilentShapes(sections, bag) {
6058
6487
  const nameOf = (o) => typeof o.name === "string" ? o.name : "?";
6059
6488
  const channelsOn = /* @__PURE__ */ new Map();
6060
- for (const obj of sections.channel ?? []) {
6061
- if (!obj || typeof obj !== "object") continue;
6062
- const ch = obj;
6489
+ for (const obj2 of sections.channel ?? []) {
6490
+ if (!obj2 || typeof obj2 !== "object") continue;
6491
+ const ch = obj2;
6063
6492
  const server = ch.server?.id;
6064
6493
  if (typeof server === "string") channelsOn.set(server, (channelsOn.get(server) ?? 0) + 1);
6065
6494
  if (ch.conversation?.enabled === true && Number(ch.conversation.limit ?? 0) === 0) {
6066
6495
  bag.warn(
6067
6496
  "realtime.conversation-no-limit",
6068
6497
  `realtimeChannel "${nameOf(ch)}" sets \`conversation: { enabled: true }\` with no \`limit\` \u2014 \`limit\` defaults to 0 and 0 means retain NONE, so nothing is recorded or replayed. Pass a \`limit\` (e.g. \`conversation: { enabled: true, limit: 100 }\`).`,
6069
- obj
6498
+ obj2
6070
6499
  );
6071
6500
  }
6072
6501
  }
6073
- for (const obj of sections.realtime_server ?? []) {
6074
- if (!obj || typeof obj !== "object") continue;
6075
- const server = obj;
6502
+ for (const obj2 of sections.realtime_server ?? []) {
6503
+ if (!obj2 || typeof obj2 !== "object") continue;
6504
+ const server = obj2;
6076
6505
  const count = typeof server.guid === "string" ? channelsOn.get(server.guid) ?? 0 : 0;
6077
6506
  if (server.enabled === true || count === 0) continue;
6078
6507
  bag.warn(
@@ -6081,19 +6510,30 @@ function checkRealtimeSilentShapes(sections, bag) {
6081
6510
  server
6082
6511
  );
6083
6512
  }
6084
- for (const obj of sections.message ?? []) {
6085
- if (!obj || typeof obj !== "object") continue;
6086
- const msg = obj;
6513
+ for (const obj2 of sections.message ?? []) {
6514
+ if (!obj2 || typeof obj2 !== "object") continue;
6515
+ const msg = obj2;
6087
6516
  if (msg.deliver_to !== "explicit") continue;
6088
6517
  bag.warn(
6089
6518
  "realtime.deliver-explicit",
6090
6519
  `realtimeMessage "${nameOf(msg)}" sets \`deliverTo: "explicit"\`, which delivers to NOBODY \u2014 nothing selects recipients from inside a handler, and \`s.realtime.publish\` is not a substitute. Use \`"channel"\`, \`"others"\` or \`"sender"\`.`,
6091
- obj
6520
+ obj2
6092
6521
  );
6093
6522
  }
6094
- for (const obj of sections.trigger ?? []) {
6095
- if (!obj || typeof obj !== "object") continue;
6096
- const t = obj;
6523
+ for (const obj2 of sections.message ?? []) {
6524
+ if (!obj2 || typeof obj2 !== "object") continue;
6525
+ const statements = [];
6526
+ collectStatements(obj2.run, statements);
6527
+ if (!statements.some((st) => st.name === "mvp:precondition" && st.disabled !== true)) continue;
6528
+ bag.warn(
6529
+ "realtime.precondition-fails-open",
6530
+ `realtimeMessage "${nameOf(obj2)}" guards with \`s.precondition\`/\`guard.*\`, which cannot block a realtime message: a failing one crashes the handler, and a crashed handler FAILS OPEN \u2014 the sender's original, unvalidated payload is broadcast to the channel. Veto instead: branch with \`s.conditional\` and set the response var to \`c.null()\` (a null response delivers nothing).`,
6531
+ obj2
6532
+ );
6533
+ }
6534
+ for (const obj2 of sections.trigger ?? []) {
6535
+ if (!obj2 || typeof obj2 !== "object") continue;
6536
+ const t = obj2;
6097
6537
  if (t.obj_type !== "channel" || t.active === false || !Array.isArray(t.result) || t.result.length !== 1) continue;
6098
6538
  const actions = t.meta?.channel?.action;
6099
6539
  if (actions?.deliver !== true) continue;
@@ -6104,14 +6544,14 @@ function checkRealtimeSilentShapes(sections, bag) {
6104
6544
  bag.warn(
6105
6545
  "realtime.deliver-falsy-return",
6106
6546
  `realtimeChannelTrigger "${nameOf(t)}" gates \`deliver\` and returns \`${only.tag === "const:bool" ? "c.bool(false)" : only.tag === "const:int" ? "c.int(0)" : 'c.text("")'}\` \u2014 only an explicit NULL drops a message; \`false\`, \`0\` and \`""\` DELIVER IT UNCHANGED. Return \`c.null()\` to drop.`,
6107
- obj
6547
+ obj2
6108
6548
  );
6109
6549
  }
6110
6550
  }
6111
6551
  function checkRealtimeJoinDeliver(sections, bag) {
6112
- for (const obj of sections.trigger ?? []) {
6113
- if (!obj || typeof obj !== "object") continue;
6114
- const t = obj;
6552
+ for (const obj2 of sections.trigger ?? []) {
6553
+ if (!obj2 || typeof obj2 !== "object") continue;
6554
+ const t = obj2;
6115
6555
  if (t.obj_type !== "channel" || t.active === false || !Array.isArray(t.result)) continue;
6116
6556
  const actions = t.meta?.channel?.action;
6117
6557
  if (actions?.join !== true || actions?.deliver !== true) continue;
@@ -6120,7 +6560,7 @@ function checkRealtimeJoinDeliver(sections, bag) {
6120
6560
  bag.warn(
6121
6561
  "realtime.join-deliver-object-response",
6122
6562
  `${sdkKindName("trigger", t)} "${name}" serves both \`join\` and \`deliver\` with one object response \u2014 \`join\` reads it as the admit decision, but \`deliver\` reads an object as the recipient's NEW payload, so every delivered message is replaced by it. Split it into two \`realtimeChannelTrigger\`s: one with \`actions: { join: true }\` returning the admit object, one with \`actions: { deliver: true }\` returning the redacted payload (or null to drop).`,
6123
- obj
6563
+ obj2
6124
6564
  );
6125
6565
  }
6126
6566
  }
@@ -6139,20 +6579,20 @@ function checkRealtimeDeliver(bundleType, sections, bag) {
6139
6579
  return;
6140
6580
  }
6141
6581
  const channels = /* @__PURE__ */ new Map();
6142
- for (const obj of sections.channel ?? []) {
6143
- if (!obj || typeof obj !== "object") continue;
6144
- const ch = obj;
6582
+ for (const obj2 of sections.channel ?? []) {
6583
+ if (!obj2 || typeof obj2 !== "object") continue;
6584
+ const ch = obj2;
6145
6585
  if (typeof ch.guid !== "string" || ch.guid === "") continue;
6146
6586
  channels.set(ch.guid, {
6147
6587
  name: typeof ch.name === "string" ? ch.name : "?",
6148
6588
  perRecipient: ch.delivery?.per_recipient === true,
6149
- obj
6589
+ obj: obj2
6150
6590
  });
6151
6591
  }
6152
6592
  const delivered = /* @__PURE__ */ new Set();
6153
- for (const obj of sections.trigger ?? []) {
6154
- if (!obj || typeof obj !== "object") continue;
6155
- const t = obj;
6593
+ for (const obj2 of sections.trigger ?? []) {
6594
+ if (!obj2 || typeof obj2 !== "object") continue;
6595
+ const t = obj2;
6156
6596
  if (t.obj_type !== "channel" || t.active === false) continue;
6157
6597
  const actions = t.meta?.channel?.action;
6158
6598
  if (actions?.deliver !== true) continue;
@@ -6165,7 +6605,7 @@ function checkRealtimeDeliver(bundleType, sections, bag) {
6165
6605
  bag.warn(
6166
6606
  "realtime.deliver-without-per-recipient",
6167
6607
  `${sdkKindName("trigger", t)} "${name}" gates \`deliver\` on channel "${channel.name}", but that channel does not set \`delivery: { perRecipient: true }\` \u2014 the engine runs the per-recipient path only when BOTH halves are present, so this trigger never runs and every subscriber receives the UNREDACTED payload. Nothing errors and nothing is logged. Add \`delivery: { perRecipient: true }\` to the channel, noting that it costs one stack per recipient per message. If the redaction is no longer wanted, remove the trigger rather than leaving it as a gate that does not gate.`,
6168
- obj
6608
+ obj2
6169
6609
  );
6170
6610
  }
6171
6611
  for (const [guid, channel] of channels) {
@@ -6199,16 +6639,60 @@ function tail(path) {
6199
6639
  const dot = path.indexOf(".");
6200
6640
  return dot === -1 ? "" : path.slice(dot + 1);
6201
6641
  }
6202
- function collectBindings(statements) {
6642
+ var MUTATES_EXISTING_VAR_FACTORY = {
6643
+ "mvp:update_var": "s.update_var",
6644
+ ...Object.fromEntries(
6645
+ [
6646
+ "math.add",
6647
+ "math.sub",
6648
+ "math.mul",
6649
+ "math.div",
6650
+ "math.mod",
6651
+ "text.append",
6652
+ "text.prepend",
6653
+ "text.trim",
6654
+ "text.ltrim",
6655
+ "text.rtrim",
6656
+ "text.contains",
6657
+ "text.icontains",
6658
+ "text.starts_with",
6659
+ "text.istarts_with",
6660
+ "text.ends_with",
6661
+ "text.iends_with",
6662
+ "array.push",
6663
+ "array.pop",
6664
+ "array.shift",
6665
+ "array.unshift",
6666
+ "array.merge"
6667
+ ].map((path) => [`mvp:${path.replace(".", "_")}`, `s.${path}`])
6668
+ ),
6669
+ "mvp:bitwise_and": "s.math.bitwise.and",
6670
+ "mvp:bitwise_or": "s.math.bitwise.or",
6671
+ "mvp:bitwise_xor": "s.math.bitwise.xor"
6672
+ };
6673
+ var MUTATES_EXISTING_VAR = new Set(Object.keys(MUTATES_EXISTING_VAR_FACTORY));
6674
+ function collectBindings(statements, declarationsOnly = false) {
6203
6675
  const bound = /* @__PURE__ */ new Set();
6204
6676
  for (const statement of statements) {
6205
6677
  if (typeof statement.as === "string" && statement.as !== "") bound.add(statement.as);
6206
6678
  const context = statement.context;
6207
6679
  if (typeof context?.as === "string" && context.as !== "") bound.add(context.as);
6680
+ if (declarationsOnly && MUTATES_EXISTING_VAR.has(statement.name)) continue;
6208
6681
  if (typeof context?.name === "string" && context.name !== "") bound.add(context.name);
6209
6682
  }
6210
6683
  return bound;
6211
6684
  }
6685
+ function collectMutatedVars(statements) {
6686
+ const out = [];
6687
+ for (const statement of statements) {
6688
+ if (!MUTATES_EXISTING_VAR.has(statement.name) || statement.disabled === true) continue;
6689
+ const name = statement.context?.name;
6690
+ if (typeof name === "string" && name !== "") {
6691
+ out.push({ path: name, statement: MUTATES_EXISTING_VAR_FACTORY[statement.name] ?? statement.name });
6692
+ }
6693
+ }
6694
+ return out;
6695
+ }
6212
6696
  function editDistance(a, b) {
6213
6697
  const rows = [Array.from({ length: b.length + 1 }, (_, j) => j)];
6214
6698
  for (let i = 1; i <= a.length; i++) {
@@ -6242,24 +6726,37 @@ function sysAccessorFor(name) {
6242
6726
  sysAccessors ??= new Map(Object.entries(sys).map(([key, read]) => [read().value, key]));
6243
6727
  return sysAccessors.get(name);
6244
6728
  }
6729
+ var UPDATE_VAR_FACTORIES = MUTATES_EXISTING_VAR_FACTORY;
6245
6730
  function checkUnboundVarRefs(sections, bag) {
6246
6731
  for (const [payloadKey, arr] of Object.entries(sections)) {
6247
- for (const obj of arr ?? []) {
6248
- if (!obj || typeof obj !== "object") continue;
6249
- const name = obj.name;
6250
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
6732
+ for (const obj2 of arr ?? []) {
6733
+ if (!obj2 || typeof obj2 !== "object") continue;
6734
+ const name = obj2.name;
6735
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
6251
6736
  const statements = [];
6252
- collectStatements(obj, statements);
6253
- const bound = collectBindings(statements);
6737
+ collectStatements(obj2, statements);
6738
+ const bound = collectBindings(statements, true);
6254
6739
  const subjects = existenceSubjects(statements);
6255
6740
  const refs = [];
6256
- collectVarRefs(obj, refs, new Set(subjects.keys()));
6741
+ collectVarRefs(obj2, refs, new Set(subjects.keys()));
6257
6742
  const assertedOnly = [];
6258
6743
  for (const [subject, role] of subjects) {
6259
6744
  const value = subject.value;
6260
6745
  if (role === "never-bound" && typeof value === "string") assertedOnly.push(value);
6261
6746
  }
6262
6747
  const reported = /* @__PURE__ */ new Set();
6748
+ for (const { path, statement } of collectMutatedVars(statements)) {
6749
+ const dot = path.indexOf(".");
6750
+ const base = dot === -1 ? path : path.slice(0, dot);
6751
+ if (base === "" || base.startsWith("$") || bound.has(base) || reported.has(base)) continue;
6752
+ reported.add(base);
6753
+ const suggestion = didYouMean(base, bound);
6754
+ bag.warn(
6755
+ "stack.unbound-var",
6756
+ `${owner}: \`${statement}\` updates \`${path}\`, but nothing in this stack binds \`${base}\` \u2014 this statement changes an EXISTING variable and declares nothing, so at runtime it raises \`Missing var entry: ${base}\` (HTTP 500).${suggestion ? ` Did you mean "${suggestion}"?` : ""} Declare it first: \`s.set_var("${base}", \u2026)\`.`,
6757
+ obj2
6758
+ );
6759
+ }
6263
6760
  const reads = [
6264
6761
  ...refs.map((path) => ({ path, asserted: false })),
6265
6762
  ...assertedOnly.map((path) => ({ path, asserted: true }))
@@ -6275,18 +6772,18 @@ function checkUnboundVarRefs(sections, bag) {
6275
6772
  bag.warn(
6276
6773
  "stack.unbound-var",
6277
6774
  `${owner}: \`ref("${path}")\` reads a stack variable named \`${base}\`, but \`${base}\` is a request/system setting, not a variable \u2014 it resolves to nothing. Read it with \`sys.${accessor}()\`.`,
6278
- obj
6775
+ obj2
6279
6776
  );
6280
6777
  }
6281
6778
  continue;
6282
6779
  }
6283
6780
  reported.add(base);
6284
- const reserved = base === "auth" && payloadKey === "trigger" && REALTIME_TRIGGER_OBJ_TYPES.has(obj.obj_type) ? realtimeAuthRemedy : Object.hasOwn(RESERVED_VAR_NAMESPACES, base) ? RESERVED_VAR_NAMESPACES[base] : void 0;
6781
+ const reserved = base === "auth" && payloadKey === "trigger" && REALTIME_TRIGGER_OBJ_TYPES.has(obj2.obj_type) ? realtimeAuthRemedy : Object.hasOwn(RESERVED_VAR_NAMESPACES, base) ? RESERVED_VAR_NAMESPACES[base] : void 0;
6285
6782
  if (reserved) {
6286
6783
  (statements.length > 0 ? bag.error.bind(bag) : bag.warn.bind(bag))(
6287
6784
  "stack.reserved-var-namespace",
6288
6785
  `${owner}: \`ref("${path}")\` reads a STACK VARIABLE named \`${base}\`, and nothing in this stack binds one \u2014 so the engine raises \`Missing var entry: ${base}\` (ERROR_FATAL, HTTP 500) on the first request. \`ref\` only ever spells a stack variable. For ${reserved(path, base)}. (If you really do mean a stack variable named \`${base}\`, bind it first with \`as: "${base}"\` and this passes.)`,
6289
- obj
6786
+ obj2
6290
6787
  );
6291
6788
  continue;
6292
6789
  }
@@ -6294,7 +6791,7 @@ function checkUnboundVarRefs(sections, bag) {
6294
6791
  bag.warn(
6295
6792
  "stack.unbound-var",
6296
6793
  `${owner}: \`s.expect.to_be_defined\` asserts that \`${base}\` is set, and nothing in this stack binds it with \`as\` \u2014 so the assertion is about a variable that is never set. Bind \`${base}\` before asserting on it, or assert \`to_not_be_defined\` if its absence is what you mean.`,
6297
- obj
6794
+ obj2
6298
6795
  );
6299
6796
  continue;
6300
6797
  }
@@ -6302,7 +6799,7 @@ function checkUnboundVarRefs(sections, bag) {
6302
6799
  bag.warn(
6303
6800
  "stack.unbound-var",
6304
6801
  `${owner}: \`ref("${path}")\` names a variable that nothing in this stack binds with \`as\`. At runtime this raises \`Missing var entry: ${base}\` \u2014 an HTTP 500 on the deployed environment.${suggestion ? ` Did you mean "${suggestion}"?` : ""} Bind it first (\`as: "${base}"\` on the statement that produces it). Do NOT reach for \`ref(\u2026, { safe: true })\` here: that is for drilling into a value that may be null, and against a name that binds nothing it just turns the 500 into a silent \`null\`.`,
6305
- obj
6802
+ obj2
6306
6803
  );
6307
6804
  }
6308
6805
  }
@@ -6310,9 +6807,9 @@ function checkUnboundVarRefs(sections, bag) {
6310
6807
  }
6311
6808
  function checkPasswordInputHashing(sections, bag) {
6312
6809
  for (const [payloadKey, arr] of Object.entries(sections)) {
6313
- for (const obj of arr ?? []) {
6314
- if (!obj || typeof obj !== "object") continue;
6315
- const record = obj;
6810
+ for (const obj2 of arr ?? []) {
6811
+ if (!obj2 || typeof obj2 !== "object") continue;
6812
+ const record = obj2;
6316
6813
  if (!Array.isArray(record.input)) continue;
6317
6814
  const passwordInputs = /* @__PURE__ */ new Set();
6318
6815
  for (const entry2 of record.input) {
@@ -6323,9 +6820,9 @@ function checkPasswordInputHashing(sections, bag) {
6323
6820
  }
6324
6821
  if (passwordInputs.size === 0) continue;
6325
6822
  const name = record.name;
6326
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
6823
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
6327
6824
  const statements = [];
6328
- collectStatements(obj, statements);
6825
+ collectStatements(obj2, statements);
6329
6826
  const reported = /* @__PURE__ */ new Set();
6330
6827
  for (const statement of statements) {
6331
6828
  if (statement.name !== "mvp:check_pass") continue;
@@ -6338,7 +6835,7 @@ function checkPasswordInputHashing(sections, bag) {
6338
6835
  bag.warn(
6339
6836
  "stack.password-input-double-hash",
6340
6837
  `${owner}: \`s.security.check_password\` reads \`inp("${cell.value}")\`, and the input \`${declaredName}\` is declared \`input.password()\`. That hashes the submission on bind, and the stored \`f.password()\` column hashed on write, so \`check_password\` compares two DIFFERENT hashes and a correct password always fails \u2014 the endpoint answers false on a row it found, which reads as a wrong credential. Declare it \`input.text()\` and pass the plaintext: \`check_password\` does the comparison hash itself.`,
6341
- obj
6838
+ obj2
6342
6839
  );
6343
6840
  }
6344
6841
  }
@@ -6346,10 +6843,10 @@ function checkPasswordInputHashing(sections, bag) {
6346
6843
  }
6347
6844
  function checkZipPasswordKeys(sections, bag) {
6348
6845
  for (const [payloadKey, arr] of Object.entries(sections)) {
6349
- for (const obj of arr ?? []) {
6350
- if (!obj || typeof obj !== "object") continue;
6846
+ for (const obj2 of arr ?? []) {
6847
+ if (!obj2 || typeof obj2 !== "object") continue;
6351
6848
  const statements = [];
6352
- collectStatements(obj, statements);
6849
+ collectStatements(obj2, statements);
6353
6850
  let owner;
6354
6851
  for (const statement of statements) {
6355
6852
  const fields = READ_UNCONDITIONALLY[statement.name];
@@ -6358,13 +6855,13 @@ function checkZipPasswordKeys(sections, bag) {
6358
6855
  const record = context && typeof context === "object" ? context : {};
6359
6856
  const missing = fields.filter((field) => record[field] === void 0);
6360
6857
  if (missing.length === 0) continue;
6361
- const name = obj.name;
6362
- owner ??= `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
6858
+ const name = obj2.name;
6859
+ owner ??= `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
6363
6860
  const list = missing.map((field) => `\`${field}\``).join(" and ");
6364
6861
  bag.warn(
6365
6862
  "stack.zip-password-absent",
6366
6863
  `${owner}: \`${statementLabel(statement.name)}\` sends no ${list} key (\`${missing[0]}: null\`), and the engine rejects that at run time with \`Missing param: ${missing[0]}\`. Omit the field to send an empty password, or pass a value.`,
6367
- obj
6864
+ obj2
6368
6865
  );
6369
6866
  }
6370
6867
  }
@@ -6372,12 +6869,12 @@ function checkZipPasswordKeys(sections, bag) {
6372
6869
  }
6373
6870
  function checkToThrowScope(sections, bag) {
6374
6871
  for (const [payloadKey, arr] of Object.entries(sections)) {
6375
- for (const obj of arr ?? []) {
6376
- if (!obj || typeof obj !== "object") continue;
6377
- const name = obj.name;
6378
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
6872
+ for (const obj2 of arr ?? []) {
6873
+ if (!obj2 || typeof obj2 !== "object") continue;
6874
+ const name = obj2.name;
6875
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
6379
6876
  const all = [];
6380
- collectStatements(obj, all);
6877
+ collectStatements(obj2, all);
6381
6878
  const toThrows = all.filter((st) => st.name === "mvp:test_expect_to_throw");
6382
6879
  if (toThrows.length === 0) continue;
6383
6880
  const boundAnywhere = collectBindings(all);
@@ -6402,13 +6899,254 @@ function checkToThrowScope(sections, bag) {
6402
6899
  bag.warn(
6403
6900
  "stack.to-throw-isolated-var",
6404
6901
  `${owner}: \`ref("${path}")\` inside an \`s.expect.to_throw\` body names \`${base}\`, which is bound OUTSIDE the body. \`to_throw\` runs its \`body\` in an ISOLATED var stack, so \`${base}\` is not visible in there: the body raises \`Missing var entry: ${base}\` before reaching the statement under test, and the test reports \`to_throw failed - expected "\u2026" not found in error "Missing var entry: ${base}"\` \u2014 which reads as the guard not firing. Bind what the body needs INSIDE the body, or pass the value as a literal.`,
6405
- obj
6902
+ obj2
6406
6903
  );
6407
6904
  }
6408
6905
  }
6409
6906
  }
6410
6907
  }
6411
6908
  }
6909
+ var PATH_TERMINATORS = /* @__PURE__ */ new Set([
6910
+ "mvp:return",
6911
+ "mvp:throw_error",
6912
+ "mvp:die",
6913
+ "mvp:foreach_break",
6914
+ "mvp:foreach_continue"
6915
+ ]);
6916
+ var LOOP_FACTORIES = {
6917
+ "mvp:for": "s.for",
6918
+ "mvp:foreach": "s.foreach",
6919
+ "mvp:while": "s.while"
6920
+ };
6921
+ var ALWAYS_RUNS = /* @__PURE__ */ new Set(["mvp:group", "mvp:db_transaction"]);
6922
+ function intersectDefinite(states) {
6923
+ let out = null;
6924
+ for (const state of states) {
6925
+ if (state === null) continue;
6926
+ if (out === null) out = new Set(state);
6927
+ else for (const name of out) if (!state.has(name)) out.delete(name);
6928
+ }
6929
+ return out;
6930
+ }
6931
+ function unionDefinite(a, b) {
6932
+ if (a === null || b === null) return null;
6933
+ return /* @__PURE__ */ new Set([...a, ...b]);
6934
+ }
6935
+ function branchRun(context, key) {
6936
+ const value = context[key];
6937
+ return Array.isArray(value?.run) ? value.run : void 0;
6938
+ }
6939
+ function withoutContextKeys(statement, keys) {
6940
+ const context = statement.context;
6941
+ if (!context || typeof context !== "object") return statement;
6942
+ const rest = { ...context };
6943
+ for (const key of keys) delete rest[key];
6944
+ return { ...statement, context: rest };
6945
+ }
6946
+ function hasLoopControl(body) {
6947
+ let found = false;
6948
+ walkNodes(body, (record) => {
6949
+ if (record.name === "mvp:foreach_break" || record.name === "mvp:foreach_continue") found = true;
6950
+ });
6951
+ return found;
6952
+ }
6953
+ function checkConditionallyBoundVars(sections, bag) {
6954
+ for (const [payloadKey, arr] of Object.entries(sections)) {
6955
+ for (const obj2 of arr ?? []) {
6956
+ if (!obj2 || typeof obj2 !== "object") continue;
6957
+ const record = obj2;
6958
+ if (!Array.isArray(record.run)) continue;
6959
+ const name = record.name;
6960
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
6961
+ const all = [];
6962
+ collectStatements(record.run, all);
6963
+ const skip = new Set(existenceSubjects(all).keys());
6964
+ const dropped = /* @__PURE__ */ new Map();
6965
+ const reported = /* @__PURE__ */ new Set();
6966
+ let nextScope = 1;
6967
+ const report = (base, spelling, block) => {
6968
+ reported.add(base);
6969
+ bag.warn(
6970
+ "stack.var-conditionally-bound",
6971
+ `${owner}: ${spelling} reads \`${base}\`, which is bound only ${block}. On a path that skips that binding \`${base}\` is never set, and the read raises \`Missing var entry: ${base}\` (ERROR_FATAL, HTTP 500) \u2014 \`{ safe: true }\` does not help a missing base. Declare it on the enclosing path before the block: \`s.set_var("${base}", c.null())\`.`,
6972
+ obj2
6973
+ );
6974
+ };
6975
+ const readBase = (path, spelling, state, scope) => {
6976
+ const dot = path.indexOf(".");
6977
+ const base = dot === -1 ? path : path.slice(0, dot);
6978
+ if (base === "" || base.startsWith("$") || Object.hasOwn(RESERVED_VAR_NAMESPACES, base)) return;
6979
+ if (state.has(base) || reported.has(base)) return;
6980
+ const drop = dropped.get(base);
6981
+ if (drop === void 0 || drop.scope !== scope) return;
6982
+ report(base, spelling, drop.block);
6983
+ };
6984
+ const reads = (node, state, scope) => {
6985
+ const refs = [];
6986
+ collectVarRefs(node, refs, skip);
6987
+ for (const path of refs) readBase(path, `\`ref("${path}")\``, state, scope);
6988
+ };
6989
+ const closeBlock = (incoming, arms, out, scope) => {
6990
+ if (out === null) return;
6991
+ const armScopes = new Set(arms.map((arm2) => arm2.scope));
6992
+ for (const [base, drop] of dropped) {
6993
+ if (!armScopes.has(drop.scope) || out.has(base)) continue;
6994
+ const arm2 = arms.find((a) => a.scope === drop.scope);
6995
+ dropped.set(base, { block: arm2.block, scope });
6996
+ }
6997
+ for (const arm2 of arms) {
6998
+ if (arm2.state === null) continue;
6999
+ for (const base of arm2.state) {
7000
+ if (incoming.has(base) || out.has(base)) continue;
7001
+ dropped.set(base, { block: arm2.block, scope });
7002
+ }
7003
+ }
7004
+ };
7005
+ const runStack = (run, state, scope) => {
7006
+ if (!Array.isArray(run)) return state;
7007
+ for (const item of run) {
7008
+ if (state === null) return null;
7009
+ state = step(item, state, scope);
7010
+ }
7011
+ return state;
7012
+ };
7013
+ const arm = (run, state) => {
7014
+ const scope = nextScope++;
7015
+ return { state: runStack(run, new Set(state), scope), scope };
7016
+ };
7017
+ const step = (item, state, scope) => {
7018
+ if (!item || typeof item !== "object") return state;
7019
+ const statement = item;
7020
+ if (typeof statement.name !== "string" || !statement.name.startsWith("mvp:")) return state;
7021
+ if (statement.disabled === true) return state;
7022
+ const context = statement.context && typeof statement.context === "object" ? statement.context : {};
7023
+ switch (statement.name) {
7024
+ case "mvp:conditional": {
7025
+ reads(withoutContextKeys(statement, ["if", "elif", "else"]), state, scope);
7026
+ const block = "inside some branches of an `s.conditional`";
7027
+ const arms = [{ ...arm(branchRun(context, "if"), state), block }];
7028
+ for (const elif of branchRun(context, "elif") ?? []) {
7029
+ const e = elif;
7030
+ if (!e || typeof e !== "object" || e.disabled === true) continue;
7031
+ reads(withoutContextKeys(e, ["if"]), state, scope);
7032
+ const ec = e.context && typeof e.context === "object" ? e.context : {};
7033
+ arms.push({ ...arm(branchRun(ec, "if"), state), block });
7034
+ }
7035
+ const elseRun = branchRun(context, "else");
7036
+ const paths = arms.map((a) => a.state);
7037
+ if (elseRun && elseRun.length > 0) {
7038
+ const e = { ...arm(elseRun, state), block };
7039
+ arms.push(e);
7040
+ paths.push(e.state);
7041
+ } else {
7042
+ paths.push(state);
7043
+ }
7044
+ const out = intersectDefinite(paths);
7045
+ closeBlock(state, arms, out, scope);
7046
+ return out;
7047
+ }
7048
+ case "mvp:switch": {
7049
+ reads(withoutContextKeys(statement, ["elif", "else"]), state, scope);
7050
+ const defaultRun = branchRun(context, "else");
7051
+ const hasDefault = defaultRun !== void 0 && defaultRun.length > 0;
7052
+ const block = `inside some cases of an \`s.switch\`${hasDefault ? "" : " with no `default`"}`;
7053
+ const arms = [];
7054
+ const cases = [];
7055
+ for (const entry2 of branchRun(context, "elif") ?? []) {
7056
+ const c2 = entry2;
7057
+ if (!c2 || typeof c2 !== "object" || c2.disabled === true) continue;
7058
+ reads(withoutContextKeys(c2, ["if"]), state, scope);
7059
+ const cc = c2.context && typeof c2.context === "object" ? c2.context : {};
7060
+ const a = { ...arm(branchRun(cc, "if"), state), block };
7061
+ arms.push(a);
7062
+ cases.push({ state: a.state, brk: cc.break === true });
7063
+ }
7064
+ let next = state;
7065
+ if (hasDefault) {
7066
+ const d = { ...arm(defaultRun, state), block };
7067
+ arms.push(d);
7068
+ next = d.state;
7069
+ }
7070
+ const paths = [next];
7071
+ for (let i = cases.length - 1; i >= 0; i--) {
7072
+ const { state: body, brk } = cases[i];
7073
+ const effective = body === null ? null : brk ? body : unionDefinite(body, next);
7074
+ paths.push(effective);
7075
+ next = effective;
7076
+ }
7077
+ const out = intersectDefinite(paths);
7078
+ closeBlock(state, arms, out, scope);
7079
+ return out;
7080
+ }
7081
+ case "mvp:try_catch": {
7082
+ reads(withoutContextKeys(statement, ["if", "else", "then"]), state, scope);
7083
+ const t = {
7084
+ state: runStack(branchRun(context, "if"), new Set(state), scope),
7085
+ scope: -1,
7086
+ block: "inside the `try` block of an `s.try_catch` (a throw before it skips to `catch`)"
7087
+ };
7088
+ const k = { ...arm(branchRun(context, "else"), state), block: "inside the `catch` block of an `s.try_catch`" };
7089
+ const mid = intersectDefinite([t.state, k.state]);
7090
+ closeBlock(state, [t, k], mid, scope);
7091
+ const finallyRun = branchRun(context, "then");
7092
+ if (mid === null) {
7093
+ runStack(finallyRun, new Set(state), scope);
7094
+ return null;
7095
+ }
7096
+ return runStack(finallyRun, mid, scope);
7097
+ }
7098
+ case "mvp:for":
7099
+ case "mvp:foreach":
7100
+ case "mvp:while": {
7101
+ reads(withoutContextKeys(statement, ["run"]), state, scope);
7102
+ const entry2 = new Set(state);
7103
+ const loopVar = statement.name !== "mvp:while" && typeof context.as === "string" && context.as !== "" ? context.as : void 0;
7104
+ if (loopVar !== void 0) entry2.add(loopVar);
7105
+ const count = context.cnt;
7106
+ if (statement.name === "mvp:for" && count?.tag === "const:int" && Number(count.value) > 0 && !hasLoopControl(context.run)) {
7107
+ return runStack(context.run, entry2, scope);
7108
+ }
7109
+ const scopeId = nextScope++;
7110
+ const body = runStack(context.run, entry2, scopeId);
7111
+ const factory = LOOP_FACTORIES[statement.name];
7112
+ const block = `inside an \`${factory}\` body, which may run zero times`;
7113
+ closeBlock(state, [{ state: body, scope: scopeId, block }], state, scope);
7114
+ return state;
7115
+ }
7116
+ case "mvp:test_expect_to_throw":
7117
+ reads(withoutContextKeys(statement, ["run"]), state, scope);
7118
+ return state;
7119
+ default: {
7120
+ const nested = subStacks(statement);
7121
+ if (nested.length === 0) {
7122
+ reads(statement, state, scope);
7123
+ if (MUTATES_EXISTING_VAR.has(statement.name) && typeof context.name === "string") {
7124
+ readBase(context.name, `\`${MUTATES_EXISTING_VAR_FACTORY[statement.name]}\` of \`${context.name}\``, state, scope);
7125
+ }
7126
+ if (PATH_TERMINATORS.has(statement.name)) return null;
7127
+ const out2 = new Set(state);
7128
+ for (const bound of collectBindings([statement], true)) out2.add(bound);
7129
+ return out2;
7130
+ }
7131
+ reads(withoutContextKeys(statement, nested.map((n) => n.key)), state, scope);
7132
+ if (ALWAYS_RUNS.has(statement.name) && nested.length === 1) {
7133
+ return runStack(nested[0].run, state, scope);
7134
+ }
7135
+ const out = new Set(state);
7136
+ for (const n of nested) {
7137
+ const inner = runStack(n.run, new Set(state), nextScope++);
7138
+ for (const bound of inner ?? []) out.add(bound);
7139
+ }
7140
+ for (const bound of collectBindings([statement], true)) out.add(bound);
7141
+ return out;
7142
+ }
7143
+ }
7144
+ };
7145
+ const final = runStack(record.run, /* @__PURE__ */ new Set(), 0);
7146
+ if (final !== null) reads(record.result, final, 0);
7147
+ }
7148
+ }
7149
+ }
6412
7150
  var DB_MATCH_ARG = {
6413
7151
  "mvp:dbo_getby": "field_value",
6414
7152
  "mvp:dbo_delby": "field_value",
@@ -6430,12 +7168,12 @@ function isNullSafeDrill(cell) {
6430
7168
  }
6431
7169
  function checkSafeRefMatchArgs(sections, bag) {
6432
7170
  for (const [payloadKey, arr] of Object.entries(sections)) {
6433
- for (const obj of arr ?? []) {
6434
- if (!obj || typeof obj !== "object") continue;
6435
- const name = obj.name;
6436
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
7171
+ for (const obj2 of arr ?? []) {
7172
+ if (!obj2 || typeof obj2 !== "object") continue;
7173
+ const name = obj2.name;
7174
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
6437
7175
  const statements = [];
6438
- collectStatements(obj, statements);
7176
+ collectStatements(obj2, statements);
6439
7177
  for (const statement of statements) {
6440
7178
  const matchArg = Object.hasOwn(DB_MATCH_ARG, statement.name) ? DB_MATCH_ARG[statement.name] : void 0;
6441
7179
  if (matchArg === void 0 || !Array.isArray(statement.input)) continue;
@@ -6448,7 +7186,7 @@ function checkSafeRefMatchArgs(sections, bag) {
6448
7186
  bag.warn(
6449
7187
  "db.safe-ref-match-arg",
6450
7188
  `${owner}: a \`ref(\u2026, { safe: true })\` is the ${arg} of \`${statement.name}\`. That opt-in exists to produce \`null\` when \`${base}\` is null, and \`null\` is never a legal match value \u2014 the engine rejects the request with HTTP 400 \`Missing param: ${matchArg}\` before any later statement runs, so a following precondition never gets to answer and the caller sees an internal-sounding 400 instead of your 404. \`{ safe: true }\` is for an EXPRESSION operand (a precondition/condition, an \`obj()\` member), not a db match argument. Guard existence first \u2014 \`s.precondition({ expr: expr(ref("${base}"), "!=", c.null()), error_type: "notfound", \u2026 })\` \u2014 then drill WITHOUT \`safe\`, since the base is known non-null by then.`,
6451
- obj
7189
+ obj2
6452
7190
  );
6453
7191
  }
6454
7192
  }
@@ -6457,12 +7195,12 @@ function checkSafeRefMatchArgs(sections, bag) {
6457
7195
  }
6458
7196
  function checkNullMatchArgs(sections, bag) {
6459
7197
  for (const [payloadKey, arr] of Object.entries(sections)) {
6460
- for (const obj of arr ?? []) {
6461
- if (!obj || typeof obj !== "object") continue;
6462
- const name = obj.name;
6463
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
7198
+ for (const obj2 of arr ?? []) {
7199
+ if (!obj2 || typeof obj2 !== "object") continue;
7200
+ const name = obj2.name;
7201
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
6464
7202
  const statements = [];
6465
- collectStatements(obj, statements);
7203
+ collectStatements(obj2, statements);
6466
7204
  for (const statement of statements) {
6467
7205
  const matchArg = Object.hasOwn(DB_MATCH_ARG, statement.name) ? DB_MATCH_ARG[statement.name] : void 0;
6468
7206
  if (matchArg === void 0 || !Array.isArray(statement.input)) continue;
@@ -6475,7 +7213,7 @@ function checkNullMatchArgs(sections, bag) {
6475
7213
  bag.warn(
6476
7214
  "db.null-match-arg",
6477
7215
  `${owner}: \`c.null()\` is the ${arg} of \`${statement.name}\`. \`null\` is never a legal match value \u2014 the engine rejects the request with HTTP 400 \`Missing param: ${matchArg}\` on the FIRST call, and the caller sees an input error naming an argument they never sent. \`null\` belongs in an EXPRESSION operand (a precondition/condition, an \`obj()\` member), not in a lookup's match slot. Modelling an optional link? Store the sentinel instead \u2014 \`f.tableRef(users, { required: true, default: 0 })\` \u2014 and match on \`c.int(0)\`, which finds no row and binds \`null\`, the answer the null was after.`,
6478
- obj
7216
+ obj2
6479
7217
  );
6480
7218
  }
6481
7219
  }
@@ -6559,9 +7297,9 @@ function checkPathSegmentCandidates(sections, bag) {
6559
7297
  const t = table;
6560
7298
  if (typeof t?.guid === "string") columns.set(t.guid, fieldsByName(t.schema));
6561
7299
  }
6562
- for (const obj of sections["query"] ?? []) {
6563
- if (!obj || typeof obj !== "object") continue;
6564
- const query = obj;
7300
+ for (const obj2 of sections["query"] ?? []) {
7301
+ if (!obj2 || typeof obj2 !== "object") continue;
7302
+ const query = obj2;
6565
7303
  const name = typeof query.name === "string" ? query.name : "";
6566
7304
  const verb = typeof query.verb === "string" ? query.verb : "";
6567
7305
  if (!URL_ONLY_VERBS.has(verb)) continue;
@@ -6573,11 +7311,11 @@ function checkPathSegmentCandidates(sections, bag) {
6573
7311
  bag.warn(
6574
7312
  "query.input-name-mangled",
6575
7313
  `query "${name}" (${verb}) has an input named ${JSON.stringify(input)}, which a query string cannot deliver \u2014 the request parser rewrites param names, so \`?${input}=\u2026\` ${arrives} and the input stays empty. Rename the input with "_" or "-".`,
6576
- obj
7314
+ obj2
6577
7315
  );
6578
7316
  }
6579
7317
  const statements = [];
6580
- collectStatements(obj, statements);
7318
+ collectStatements(obj2, statements);
6581
7319
  const addressing = /* @__PURE__ */ new Set();
6582
7320
  for (const statement of statements) {
6583
7321
  const matchArg = Object.hasOwn(DB_MATCH_ARG, statement.name) ? DB_MATCH_ARG[statement.name] : void 0;
@@ -6598,7 +7336,7 @@ function checkPathSegmentCandidates(sections, bag) {
6598
7336
  bag.warn(
6599
7337
  "query.path-segment-candidate",
6600
7338
  `query "${name}" (${verb}) looks up one row by the \`${param}\` input, but the path declares no \`{${param}}\` segment \u2014 so the value arrives as \`?${param}=\u2026\` instead of addressing the resource. The endpoint works, but the route is not addressable the way a REST client expects, and \`getPath()\` types as static, so a caller cannot pass the value positionally. Put it in the path: \`name: "${name}/{${param}}"\` (the segment may sit anywhere \u2014 \`"${name}/{${param}}/edit"\` routes too), keeping the \`${param}\` input as it is; the segment binds to the input of the same name. If \`${param}\` really is a query-string param rather than part of the address, accept the warning on the query with \`diagnostics: { allow: ["query.path-segment-candidate"] }\`.`,
6601
- obj
7339
+ obj2
6602
7340
  );
6603
7341
  }
6604
7342
  }
@@ -6608,15 +7346,15 @@ function checkSameNameSiblings(sections, bag) {
6608
7346
  for (const [payloadKey, arr] of Object.entries(sections)) {
6609
7347
  const guidsByName = /* @__PURE__ */ new Map();
6610
7348
  const kindsByName = /* @__PURE__ */ new Map();
6611
- for (const obj of arr ?? []) {
6612
- if (!obj || typeof obj !== "object") continue;
6613
- const { name, guid } = obj;
7349
+ for (const obj2 of arr ?? []) {
7350
+ if (!obj2 || typeof obj2 !== "object") continue;
7351
+ const { name, guid } = obj2;
6614
7352
  if (typeof name !== "string" || name === "" || typeof guid !== "string") continue;
6615
- const identity = lockNameForObject(payloadKey, obj, appNames);
7353
+ const identity = lockNameForObject(payloadKey, obj2, appNames);
6616
7354
  const guids = guidsByName.get(identity) ?? /* @__PURE__ */ new Set();
6617
7355
  guids.add(guid);
6618
7356
  guidsByName.set(identity, guids);
6619
- kindsByName.set(identity, (kindsByName.get(identity) ?? /* @__PURE__ */ new Set()).add(sdkKindName(payloadKey, obj)));
7357
+ kindsByName.set(identity, (kindsByName.get(identity) ?? /* @__PURE__ */ new Set()).add(sdkKindName(payloadKey, obj2)));
6620
7358
  }
6621
7359
  for (const [name, guids] of guidsByName) {
6622
7360
  if (guids.size < 2) continue;
@@ -6700,9 +7438,9 @@ function segmentOverlap(a, b) {
6700
7438
  function checkRouteShadowing(sections, bag) {
6701
7439
  const appNames = appNamesByGuid(sections["app"]);
6702
7440
  const byGroupVerb = /* @__PURE__ */ new Map();
6703
- for (const obj of sections["query"] ?? []) {
6704
- if (!obj || typeof obj !== "object") continue;
6705
- const query = obj;
7441
+ for (const obj2 of sections["query"] ?? []) {
7442
+ if (!obj2 || typeof obj2 !== "object") continue;
7443
+ const query = obj2;
6706
7444
  if (typeof query.name !== "string" || query.name === "") continue;
6707
7445
  const verb = typeof query.verb === "string" ? query.verb : "";
6708
7446
  const narrowed = /* @__PURE__ */ new Map();
@@ -6720,7 +7458,7 @@ function checkRouteShadowing(sections, bag) {
6720
7458
  name: query.name,
6721
7459
  verb,
6722
7460
  segments: query.name.split("/").map((segment) => compileSegment(segment, narrowed)),
6723
- record: obj
7461
+ record: obj2
6724
7462
  });
6725
7463
  byGroupVerb.set(key, routes);
6726
7464
  }
@@ -6772,8 +7510,8 @@ function checkRealtimePublish(bundleType, sections, bag) {
6772
7510
  bag.skipped("realtime.publish-unknown-channel");
6773
7511
  return;
6774
7512
  }
6775
- const objName = (obj) => {
6776
- const name = obj?.name;
7513
+ const objName = (obj2) => {
7514
+ const name = obj2?.name;
6777
7515
  return typeof name === "string" ? name : void 0;
6778
7516
  };
6779
7517
  const servers = (sections.realtime_server ?? []).map(objName).filter((n) => n !== void 0);
@@ -6787,11 +7525,11 @@ function checkRealtimePublish(bundleType, sections, bag) {
6787
7525
  });
6788
7526
  const channels = channelRows.map((c2) => c2.name);
6789
7527
  for (const [payloadKey, arr] of Object.entries(sections)) {
6790
- for (const obj of arr ?? []) {
6791
- if (!obj || typeof obj !== "object") continue;
6792
- const owner = `${payloadKey} "${objName(obj) ?? "?"}"`;
7528
+ for (const obj2 of arr ?? []) {
7529
+ if (!obj2 || typeof obj2 !== "object") continue;
7530
+ const owner = `${payloadKey} "${objName(obj2) ?? "?"}"`;
6793
7531
  const statements = [];
6794
- collectStatements(obj, statements);
7532
+ collectStatements(obj2, statements);
6795
7533
  for (const statement of statements) {
6796
7534
  if (statement.name !== REALTIME_PUBLISH) continue;
6797
7535
  const context = statement.context ?? {};
@@ -6800,7 +7538,7 @@ function checkRealtimePublish(bundleType, sections, bag) {
6800
7538
  bag.warn(
6801
7539
  "realtime.publish-unknown-server",
6802
7540
  `${owner}: \`s.realtime.publish\` targets realtime server "${server}", which this workspace does not register. The engine resolves the server by NAME and FAILS SOFT \u2014 a miss is swallowed with nothing returned to the stack \u2014 so this publish goes nowhere and reports nothing. Pass the \`realtimeServer()\` handle rather than a bare name so a rename cannot break it.${servers.length > 0 ? ` Registered: ${servers.map((n) => `"${n}"`).join(", ")}.` : ""}`,
6803
- obj
7541
+ obj2
6804
7542
  );
6805
7543
  }
6806
7544
  const channel = constantCell(context.channel);
@@ -6810,13 +7548,13 @@ function checkRealtimePublish(bundleType, sections, bag) {
6810
7548
  bag.warn(
6811
7549
  "realtime.publish-unknown-channel",
6812
7550
  `${owner}: \`s.realtime.publish\` targets channel path "${channel}" on realtime server "${server}", but that path is a channel of ${[...new Set(holders.map((c2) => `"${c2.server ?? "?"}"`))].join(", ")} only, so no client of "${server}" can be subscribed to it \u2014 and the publish is swallowed silently rather than failing. Publish on the server that owns the channel.` + (own.length > 0 ? ` "${server}" registers: ${own.join(", ")}.` : ""),
6813
- obj
7551
+ obj2
6814
7552
  );
6815
7553
  } else if (channel !== void 0 && holders.length === 0) {
6816
7554
  bag.warn(
6817
7555
  "realtime.publish-unknown-channel",
6818
7556
  `${owner}: \`s.realtime.publish\` targets channel path "${channel}", which matches no \`realtimeChannel()\` on this workspace, so no client can be subscribed to it \u2014 and the publish is swallowed silently rather than failing. Build the path with \`channel.getChannel({ \u2026 })\` instead of writing it out.${channels.length > 0 ? ` Registered: ${channels.map((n) => `"${n}"`).join(", ")}.` : ""}`,
6819
- obj
7557
+ obj2
6820
7558
  );
6821
7559
  }
6822
7560
  }
@@ -6830,16 +7568,16 @@ var TRIGGER_BINDINGS = {
6830
7568
  toolset: "mcpServer` / `agent"
6831
7569
  };
6832
7570
  function checkTriggerBindings(sections, bag) {
6833
- for (const obj of sections.trigger ?? []) {
6834
- if (!obj || typeof obj !== "object") continue;
6835
- const t = obj;
7571
+ for (const obj2 of sections.trigger ?? []) {
7572
+ if (!obj2 || typeof obj2 !== "object") continue;
7573
+ const t = obj2;
6836
7574
  const objType = typeof t.obj_type === "string" ? t.obj_type : "";
6837
7575
  const flags = t.meta?.[objType]?.action;
6838
7576
  if (t.active !== false && objType !== "toolset" && flags && Object.values(flags).every((v) => v !== true)) {
6839
7577
  bag.warn(
6840
7578
  "trigger.no-action",
6841
7579
  `${sdkKindName("trigger", t)} "${typeof t.name === "string" ? t.name : "?"}" enables no action, so it deploys and never fires. Set at least one in \`actions\`: ${Object.keys(flags).map((k) => `\`${k}: true\``).join(", ")}.`,
6842
- obj
7580
+ obj2
6843
7581
  );
6844
7582
  }
6845
7583
  const arg = Object.hasOwn(TRIGGER_BINDINGS, objType) ? TRIGGER_BINDINGS[objType] : void 0;
@@ -6849,18 +7587,73 @@ function checkTriggerBindings(sections, bag) {
6849
7587
  bag.warn(
6850
7588
  "trigger.unbound",
6851
7589
  `${sdkKindName("trigger", t)} "${name}" names no object to fire on, so it deploys bound to nothing and never runs. Bind it with \`${arg}\` \u2014 pass the def handle (or its name) and it resolves to the target's guid at export, surviving a \`--reset\` deploy. A raw numeric \`objId\` is the escape hatch, and is rarely what you want: ids are assigned at import and are not knowable from a def.`,
6852
- obj
7590
+ obj2
7591
+ );
7592
+ }
7593
+ }
7594
+ var ACTION_GUARDS = /* @__PURE__ */ new Set(["mvp:conditional", "mvp:switch", "mvp:try_catch"]);
7595
+ function checkTriggerAbsentSideReads(sections, bag) {
7596
+ for (const obj2 of sections.trigger ?? []) {
7597
+ const t = obj2;
7598
+ if (!t || typeof t !== "object" || t.obj_type !== "database") continue;
7599
+ const flags = t.meta?.database?.action ?? {};
7600
+ const absent = [
7601
+ ...flags.insert === true ? [["old", "insert"]] : [],
7602
+ ...flags.delete === true ? [["new", "delete"]] : []
7603
+ ];
7604
+ if (absent.length === 0) continue;
7605
+ const reads = [];
7606
+ const visit = (node) => {
7607
+ if (Array.isArray(node)) return node.forEach(visit);
7608
+ if (!node || typeof node !== "object") return;
7609
+ const record = node;
7610
+ if (typeof record.name === "string" && ACTION_GUARDS.has(record.name)) return;
7611
+ if (record.disabled === true && typeof record.name === "string" && record.name.startsWith("mvp:")) return;
7612
+ if (record.tag === "input") {
7613
+ for (const v of [record.value, record.operand]) if (typeof v === "string") reads.push(v);
7614
+ }
7615
+ exprReads(record, "input", reads);
7616
+ Object.values(record).forEach(visit);
7617
+ };
7618
+ visit(t.run);
7619
+ for (const [side, action] of absent) {
7620
+ const hit = reads.find((r) => r.startsWith(`${side}.`));
7621
+ if (hit === void 0) continue;
7622
+ const col = hit.slice(side.length + 1);
7623
+ bag.warn(
7624
+ "trigger.absent-side-read",
7625
+ `tableTrigger "${typeof t.name === "string" ? t.name : "?"}" reads \`t.${side}("${col}")\` outside any branch, but on ${action === "insert" ? "an" : "a"} ${action} \`${side}\` is \`{}\`: the read RAISES \`Unable to locate input: ${hit}\` and silently aborts that run (nothing is logged with history off). Read it only inside \`s.conditional({ when: expr(t.action, "!=", c.text("${action}")), then: [...] })\`.`,
7626
+ t
7627
+ );
7628
+ }
7629
+ }
7630
+ }
7631
+ function checkMcpTriggerResponseKeys(sections, bag) {
7632
+ for (const obj2 of sections.trigger ?? []) {
7633
+ const t = obj2;
7634
+ if (!t || typeof t !== "object" || t.obj_type !== "toolset") continue;
7635
+ const inputs = Array.isArray(t.input) ? t.input.map((i) => i?.name) : [];
7636
+ if (!inputs.includes("prompts")) continue;
7637
+ const result = Array.isArray(t.result) ? t.result : [];
7638
+ const names = result.map((m) => m?.name);
7639
+ if (names.length === 0 || names.some((n) => typeof n !== "string" || n === "")) continue;
7640
+ const missing = ["toolset", "tools"].filter((k) => !names.includes(k));
7641
+ if (missing.length === 0) continue;
7642
+ bag.warn(
7643
+ "trigger.mcp-response-missing-key",
7644
+ `mcpServerTrigger "${typeof t.name === "string" ? t.name : "?"}": its response has no ${missing.map((k) => `\`${k}\``).join(" or ")} key. The server reads both unconditionally, so it breaks for EVERY client (an empty event stream, or no tools and no prompts listed). Only \`prompts\`/\`resources\` may be omitted to list all. Return them: \`response: (t) => ({ toolset: t.toolset, tools: t.tools, prompts: ref("p") })\`.`,
7645
+ t
6853
7646
  );
6854
7647
  }
6855
7648
  }
6856
7649
  function checkDecodeOnlyStatements(sections, bag) {
6857
7650
  for (const [payloadKey, arr] of Object.entries(sections)) {
6858
- for (const obj of arr ?? []) {
6859
- if (!obj || typeof obj !== "object") continue;
6860
- const objName = obj.name;
6861
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof objName === "string" ? objName : "?"}"`;
7651
+ for (const obj2 of arr ?? []) {
7652
+ if (!obj2 || typeof obj2 !== "object") continue;
7653
+ const objName = obj2.name;
7654
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof objName === "string" ? objName : "?"}"`;
6862
7655
  const statements = [];
6863
- collectStatements(obj, statements);
7656
+ collectStatements(obj2, statements);
6864
7657
  const found = new Set(
6865
7658
  statements.map((s) => s.name).filter((name) => DECODE_ONLY_STATEMENTS.has(name))
6866
7659
  );
@@ -7048,56 +7841,77 @@ function collectDanglingRefs(node, path, owner, known, out, embeddedOnly = false
7048
7841
  }
7049
7842
  function checkNonJsonValues(sections, bag, workspaceConfig) {
7050
7843
  const objects = Object.entries(sections).flatMap(
7051
- ([key, arr]) => (arr ?? []).map((obj) => [key, obj])
7844
+ ([key, arr]) => (arr ?? []).map((obj2) => [key, obj2])
7052
7845
  );
7053
7846
  if (workspaceConfig !== void 0) objects.push(["workspace", workspaceConfig]);
7054
- for (const [payloadKey, obj] of objects) {
7055
- if (!obj || typeof obj !== "object") continue;
7056
- const name = obj.name;
7057
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
7058
- for (const stringified of findStringifiedDefaults(obj)) {
7847
+ for (const [payloadKey, obj2] of objects) {
7848
+ if (!obj2 || typeof obj2 !== "object") continue;
7849
+ const name = obj2.name;
7850
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
7851
+ for (const stringified of findStringifiedDefaults(obj2)) {
7059
7852
  const cast = stringified.text.startsWith("[object ");
7060
7853
  bag.warn(
7061
7854
  "field.default-not-text",
7062
- `The \`default\` at ${sdkLocation(obj, stringified.path, owner)} ` + (cast ? `was stored as ${JSON.stringify(stringified.text)} \u2014 a field's default is TEXT (a string, number or boolean), and an object, Map, Set or class instance passed there through a cast is stringified into that. ` : `is the comma-joined text ${JSON.stringify(stringified.text)}, which is what an array passed through a cast becomes \u2014 a field's default is ONE text value (a string, number or boolean), stored as written, even on an \`array: true\` field. If you typed that text, it is stored as-is. `) + `For a JSON default, pass its text: \`default: JSON.stringify(value)\`.`,
7063
- obj
7855
+ `The \`default\` at ${sdkLocation(obj2, stringified.path, owner)} ` + (cast ? `was stored as ${JSON.stringify(stringified.text)} \u2014 a field's default is TEXT (a string, number or boolean), and an object, Map, Set or class instance passed there through a cast is stringified into that. ` : `is the comma-joined text ${JSON.stringify(stringified.text)}, which is what an array passed through a cast becomes \u2014 a field's default is ONE text value (a string, number or boolean), stored as written, even on an \`array: true\` field. If you typed that text, it is stored as-is. `) + `For a JSON default, pass its text: \`default: JSON.stringify(value)\`.`,
7856
+ obj2
7064
7857
  );
7065
7858
  }
7066
- for (const off of findEnumDefaultsOffList(obj)) {
7859
+ for (const off of findEnumDefaultsOffList(obj2)) {
7067
7860
  bag.warn(
7068
7861
  "field.enum-default-not-a-value",
7069
- `The \`default\` at ${sdkLocation(obj, off.path, owner)} is ${JSON.stringify(off.text)}, which is not one of the enum's values (${off.values.map((v) => JSON.stringify(v)).join(", ")}) \u2014 a value no request can send back. Use one of them, or add it to the values.`,
7070
- obj
7862
+ `The \`default\` at ${sdkLocation(obj2, off.path, owner)} is ${JSON.stringify(off.text)}, which is not one of the enum's values (${off.values.map((v) => JSON.stringify(v)).join(", ")}) \u2014 a value no request can send back. Use one of them, or add it to the values.`,
7863
+ obj2
7071
7864
  );
7072
7865
  }
7073
- for (const off of findEmailDefaultsMalformed(obj)) {
7866
+ for (const off of findEmailDefaultsMalformed(obj2)) {
7074
7867
  bag.warn(
7075
7868
  "field.email-default-invalid",
7076
- `The \`default\` at ${sdkLocation(obj, off.path, owner)} is ${JSON.stringify(off.text)}, which is not an email address \u2014 every insert or request that leaves the field out is refused "Invalid email format.". Use an address, or no default.`,
7077
- obj
7869
+ `The \`default\` at ${sdkLocation(obj2, off.path, owner)} is ${JSON.stringify(off.text)}, which is not an email address \u2014 every insert or request that leaves the field out is refused "Invalid email format.". Use an address, or no default.`,
7870
+ obj2
7078
7871
  );
7079
7872
  }
7080
7873
  if (payloadKey !== "dbo") {
7081
- for (const off of findInputDefaultsRefused(obj)) {
7874
+ for (const off of findInputDefaultsRefused(obj2)) {
7082
7875
  bag.warn(
7083
7876
  "field.input-default-invalid",
7084
- `The \`default\` at ${sdkLocation(obj, off.path, owner)} is ${JSON.stringify(off.text)}, which ${off.why} \u2014 every request that leaves the input out is refused. Use ${off.want}, or no default.`,
7085
- obj
7877
+ `The \`default\` at ${sdkLocation(obj2, off.path, owner)} is ${JSON.stringify(off.text)}, which ${off.why} \u2014 every request that leaves the input out is refused. Use ${off.want}, or no default.`,
7878
+ obj2
7086
7879
  );
7087
7880
  }
7088
- for (const off of payloadKey === "trigger" ? [] : findRequiredInputDefaults(obj)) {
7881
+ for (const off of payloadKey === "trigger" ? [] : findNeverOmittableInputs(obj2)) {
7882
+ bag.warn(
7883
+ "field.input-never-omittable",
7884
+ `${owner}, input "${off.name}" is optional, but it can never be omitted: an omitted input binds ${off.binds}, and ${off.why}, so every request that leaves it out is refused with a 400. ${off.fix}`,
7885
+ obj2
7886
+ );
7887
+ }
7888
+ for (const off of payloadKey === "trigger" ? [] : findListInputDefaults(obj2)) {
7889
+ bag.warn(
7890
+ "field.list-default-ignored",
7891
+ `The \`default\` at ${owner}, input "${off.name}" is ${JSON.stringify(off.text)}, but the input is a list, and the engine replaces any default on a list input with \`[]\`: an omitted list binds \`[]\`, not this. Drop the \`default\` and fill the list in the stack when it arrives empty.`,
7892
+ obj2
7893
+ );
7894
+ }
7895
+ for (const off of payloadKey === "trigger" ? [] : findRequiredInputDefaults(obj2)) {
7089
7896
  bag.warn(
7090
7897
  "field.input-required-default-ignored",
7091
7898
  `The \`default\` at ${owner}, input "${off.name}" is ${JSON.stringify(off.text)}, but the input is \`required: true\` \u2014 the engine refuses a request that leaves a required input out ("Missing param") before it reads the default, so the default is never applied. Drop \`required\` to use the default, or drop the \`default\`.`,
7092
- obj
7899
+ obj2
7093
7900
  );
7094
7901
  }
7095
7902
  }
7096
- const found = findNonJson(obj);
7903
+ for (const off of findListBoundsOnScalars(obj2, payloadKey === "dbo" ? "schema" : "input")) {
7904
+ bag.warn(
7905
+ "field.list-bounds-on-scalar",
7906
+ `${owner}, ${payloadKey === "dbo" ? "column" : "input"} "${off}" sets \`list\`, but it is a single value: \`list\` is the length BOUNDS of a list and does not make the field one, so it is ignored. For a list, use ${payloadKey === "dbo" ? "`array: true`" : "`input.list(...)` or `array: true`"}; otherwise drop \`list\`.`,
7907
+ obj2
7908
+ );
7909
+ }
7910
+ const found = findNonJson(obj2);
7097
7911
  if (found === void 0) continue;
7098
7912
  bag.error(
7099
7913
  typeof found.value === "function" ? "bundle.function-value" : "bundle.non-json-value",
7100
- nonJsonMessage(owner, sdkLocation(obj, found.path, owner), found.value)
7914
+ nonJsonMessage(owner, sdkLocation(obj2, found.path, owner), found.value)
7101
7915
  );
7102
7916
  }
7103
7917
  }
@@ -7131,6 +7945,62 @@ function findEmailDefaultsMalformed(root) {
7131
7945
  });
7132
7946
  return hits;
7133
7947
  }
7948
+ function findNeverOmittableInputs(root) {
7949
+ const hits = [];
7950
+ const inputs = root?.input;
7951
+ if (!Array.isArray(inputs)) return hits;
7952
+ const passFix = "Mark it `required: true`, or give it a `default` that passes.";
7953
+ for (const node of inputs) {
7954
+ const field = node;
7955
+ if (typeof field?.name !== "string" || field.required === true) continue;
7956
+ const name = field.name;
7957
+ if (field.style?.type === "list") {
7958
+ const min = Number(field.list?.min);
7959
+ if (field.list?.min !== "" && field.list?.min !== void 0 && Number.isFinite(min) && min >= 1) {
7960
+ hits.push({ name, binds: "`[]`", why: `its \`list.min\` is ${min}`, fix: "Mark it `required: true`, or drop `list.min` (a default on a list is replaced by `[]`)." });
7961
+ }
7962
+ continue;
7963
+ }
7964
+ if (field.type === "obj") {
7965
+ const child = Array.isArray(field.children) ? field.children.find((c2) => c2?.required === true) : void 0;
7966
+ if (child !== void 0) {
7967
+ hits.push({ name, binds: "an empty object", why: `its child "${String(child.name)}" is \`required: true\` ("Missing param")`, fix: "Mark it `required: true`, or make its children optional." });
7968
+ }
7969
+ continue;
7970
+ }
7971
+ if (field.nullable === true || (field.default ?? "") !== "" || !Array.isArray(field.methods)) continue;
7972
+ const method = (m) => {
7973
+ const found = field.methods.find((x) => x.name === m && x.disabled !== true);
7974
+ return found === void 0 ? void 0 : Array.isArray(found.arg) ? found.arg : [];
7975
+ };
7976
+ const num = (m) => {
7977
+ const v = method(m)?.[0];
7978
+ return v === void 0 || v === "" || !Number.isFinite(Number(v)) ? void 0 : Number(v);
7979
+ };
7980
+ if (field.type === "text") {
7981
+ const min = num("min");
7982
+ const prefix = method("startsWith")?.[0];
7983
+ const pattern = method("pattern")?.[0];
7984
+ if (min !== void 0 && min > 0) hits.push({ name, binds: '`""`', why: `its \`min\` length is ${min}`, fix: passFix });
7985
+ else if (typeof prefix === "string" && prefix !== "") hits.push({ name, binds: '`""`', why: `its \`startsWith\` is ${JSON.stringify(prefix)}`, fix: passFix });
7986
+ else if (typeof pattern === "string" && !matchesEmpty(pattern)) hits.push({ name, binds: '`""`', why: `its \`pattern\` does not match ""`, fix: passFix });
7987
+ } else if (field.type === "int" || field.type === "decimal") {
7988
+ const [min, max] = [num("min"), num("max")];
7989
+ if (min !== void 0 && min > 0) hits.push({ name, binds: "`0`", why: `its \`min\` is ${min}`, fix: passFix });
7990
+ else if (max !== void 0 && max < 0) hits.push({ name, binds: "`0`", why: `its \`max\` is ${max}`, fix: passFix });
7991
+ }
7992
+ }
7993
+ return hits;
7994
+ }
7995
+ function matchesEmpty(pattern) {
7996
+ const m = /^([^\w\s\\])([\s\S]*)\1([a-zA-Z]*)$/.exec(pattern);
7997
+ if (m === null) return true;
7998
+ try {
7999
+ return new RegExp(m[2], (m[3] ?? "").replace(/[^imsu]/g, "")).test("");
8000
+ } catch {
8001
+ return true;
8002
+ }
8003
+ }
7134
8004
  function findInputDefaultsRefused(root) {
7135
8005
  const hits = [];
7136
8006
  walkPaths(root, (node, path) => {
@@ -7173,6 +8043,39 @@ function findInputDefaultsRefused(root) {
7173
8043
  });
7174
8044
  return hits;
7175
8045
  }
8046
+ function findListBoundsOnScalars(root, key) {
8047
+ const hits = [];
8048
+ const visit = (fields, prefix) => {
8049
+ if (!Array.isArray(fields)) return;
8050
+ for (const node of fields) {
8051
+ const field = node;
8052
+ if (typeof field?.name !== "string") continue;
8053
+ const name = `${prefix}${field.name}`;
8054
+ const list = field.list;
8055
+ const blank = list === void 0 || list === "" || typeof list === "object" && list !== null && Object.keys(list).length === 2 && list.min === "" && list.max === "";
8056
+ if (field.style?.type === "single" && !blank) hits.push(name);
8057
+ visit(field.children, `${name}.`);
8058
+ }
8059
+ };
8060
+ visit(root?.[key], "");
8061
+ return hits;
8062
+ }
8063
+ function findListInputDefaults(root) {
8064
+ const hits = [];
8065
+ const visit = (fields, prefix) => {
8066
+ if (!Array.isArray(fields)) return;
8067
+ for (const node of fields) {
8068
+ const field = node;
8069
+ if (typeof field?.name !== "string") continue;
8070
+ const name = `${prefix}${field.name}`;
8071
+ const text = typeof field.default === "string" || typeof field.default === "number" ? String(field.default) : "";
8072
+ if (field.style?.type === "list" && text !== "") hits.push({ name, text });
8073
+ visit(field.children, `${name}.`);
8074
+ }
8075
+ };
8076
+ visit(root?.input, "");
8077
+ return hits;
8078
+ }
7176
8079
  function findRequiredInputDefaults(root) {
7177
8080
  const hits = [];
7178
8081
  const visit = (fields, prefix) => {
@@ -7227,19 +8130,19 @@ function checkReferences(bundleType, sections, workspaceGuid, bag) {
7227
8130
  const known = /* @__PURE__ */ new Set();
7228
8131
  if (typeof workspaceGuid === "string") known.add(workspaceGuid);
7229
8132
  for (const arr of Object.values(sections)) {
7230
- for (const obj of arr ?? []) {
7231
- const guid = obj?.guid;
8133
+ for (const obj2 of arr ?? []) {
8134
+ const guid = obj2?.guid;
7232
8135
  if (typeof guid === "string") known.add(guid);
7233
8136
  }
7234
8137
  }
7235
8138
  const dangling = [];
7236
8139
  for (const [payloadKey, arr] of Object.entries(sections)) {
7237
8140
  if (payloadKey === "vault") continue;
7238
- for (const obj of arr ?? []) {
7239
- if (!obj || typeof obj !== "object") continue;
7240
- const name = obj.name;
7241
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
7242
- collectDanglingRefs(obj, "$", owner, known, dangling);
8141
+ for (const obj2 of arr ?? []) {
8142
+ if (!obj2 || typeof obj2 !== "object") continue;
8143
+ const name = obj2.name;
8144
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
8145
+ collectDanglingRefs(obj2, "$", owner, known, dangling);
7243
8146
  }
7244
8147
  }
7245
8148
  const byGuid = /* @__PURE__ */ new Map();
@@ -7273,15 +8176,15 @@ function checkMicroserviceReferences(bundleType, sections, bag) {
7273
8176
  );
7274
8177
  const missing = /* @__PURE__ */ new Map();
7275
8178
  for (const [payloadKey, arr] of Object.entries(sections)) {
7276
- for (const obj of arr ?? []) {
7277
- if (!obj || typeof obj !== "object") continue;
8179
+ for (const obj2 of arr ?? []) {
8180
+ if (!obj2 || typeof obj2 !== "object") continue;
7278
8181
  const statements = [];
7279
- collectStatements(obj, statements);
8182
+ collectStatements(obj2, statements);
7280
8183
  for (const st of statements) {
7281
8184
  const target = microserviceHandleName(st);
7282
8185
  if (target === void 0 || registered.has(target)) continue;
7283
- const name = obj.name;
7284
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
8186
+ const name = obj2.name;
8187
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
7285
8188
  const owners = missing.get(target) ?? /* @__PURE__ */ new Set();
7286
8189
  owners.add(owner);
7287
8190
  missing.set(target, owners);
@@ -7323,11 +8226,11 @@ function operandFilterNames(operand, out) {
7323
8226
  function checkSearchOperandFilters(sections, bag) {
7324
8227
  if (REQUEST_ONLY_TIME_FILTERS.size === 0) return;
7325
8228
  for (const [payloadKey, arr] of Object.entries(sections)) {
7326
- for (const obj of arr ?? []) {
7327
- if (!obj || typeof obj !== "object") continue;
7328
- const name = obj.name;
7329
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
7330
- walkNodes(obj, (record) => {
8229
+ for (const obj2 of arr ?? []) {
8230
+ if (!obj2 || typeof obj2 !== "object") continue;
8231
+ const name = obj2.name;
8232
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
8233
+ walkNodes(obj2, (record) => {
7331
8234
  const context = record.context;
7332
8235
  if (!context || typeof context.search !== "object" || context.search === null) return;
7333
8236
  const found = [];
@@ -7342,7 +8245,7 @@ function checkSearchOperandFilters(sections, bag) {
7342
8245
  bag.warn(
7343
8246
  "search.request-only-filter",
7344
8247
  `${owner} pipes a search operand through \`${filter2}\`, which evaluates only in the request. A \`where\` is compiled into SQL, where that filter has no form \u2014 the endpoint deploys clean and then fails the request with a bare fatal naming nothing. Either use the SQL-side spelling (\`epochms_add_day\`, \`epochms_sub_month\`, and the rest of that family) or compute the value in an earlier \`s.set_var\` and reference it with \`ref()\` in the \`where\`.`,
7345
- obj
8248
+ obj2
7346
8249
  );
7347
8250
  }
7348
8251
  });
@@ -7351,11 +8254,11 @@ function checkSearchOperandFilters(sections, bag) {
7351
8254
  }
7352
8255
  function checkSwitchFallthrough(sections, bag) {
7353
8256
  for (const [payloadKey, arr] of Object.entries(sections)) {
7354
- for (const obj of arr ?? []) {
7355
- if (!obj || typeof obj !== "object") continue;
7356
- const name = obj.name;
7357
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
7358
- walkNodes(obj, (node) => {
8257
+ for (const obj2 of arr ?? []) {
8258
+ if (!obj2 || typeof obj2 !== "object") continue;
8259
+ const name = obj2.name;
8260
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
8261
+ walkNodes(obj2, (node) => {
7359
8262
  if (node.name !== "mvp:switch") return;
7360
8263
  const context = node.context;
7361
8264
  const cases = context?.elif?.run;
@@ -7373,7 +8276,7 @@ function checkSwitchFallthrough(sections, bag) {
7373
8276
  bag.warn(
7374
8277
  "switch.missing-break",
7375
8278
  `${owner} has a \`s.switch\` whose case ${i + 1} omits \`break: true\`, so a match there FALLS THROUGH and also runs ${target}. The engine's default is fallthrough, not stop \u2014 every statement in the later bodies runs as well, which duplicates whatever they write. Add \`break: true\` to that case. If the cascade IS deliberate, accept it on the def with \`diagnostics: { allow: ["switch.missing-break"] }\`.`,
7376
- obj
8279
+ obj2
7377
8280
  );
7378
8281
  });
7379
8282
  });
@@ -7382,11 +8285,11 @@ function checkSwitchFallthrough(sections, bag) {
7382
8285
  }
7383
8286
  function checkLoopControl(sections, bag) {
7384
8287
  for (const [payloadKey, arr] of Object.entries(sections)) {
7385
- for (const obj of arr ?? []) {
7386
- if (!obj || typeof obj !== "object") continue;
7387
- const name = obj.name;
7388
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
7389
- walkLoopDepth(obj, 0, owner, bag, obj);
8288
+ for (const obj2 of arr ?? []) {
8289
+ if (!obj2 || typeof obj2 !== "object") continue;
8290
+ const name = obj2.name;
8291
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
8292
+ walkLoopDepth(obj2, 0, owner, bag, obj2);
7390
8293
  }
7391
8294
  }
7392
8295
  }
@@ -7535,8 +8438,8 @@ function checkLiveDatasourceTests(sections, bag) {
7535
8438
  }
7536
8439
  for (const [payloadKey, arr] of Object.entries(sections)) {
7537
8440
  if (payloadKey === "workflow_test") continue;
7538
- for (const obj of arr ?? []) {
7539
- const record = obj;
8441
+ for (const obj2 of arr ?? []) {
8442
+ const record = obj2;
7540
8443
  if (!record || typeof record !== "object" || !Array.isArray(record.test)) continue;
7541
8444
  const live = record.test.filter(
7542
8445
  (t) => typeof t?.datasource === "string" && isLiveDatasource(t.datasource)
@@ -7551,15 +8454,37 @@ function checkLiveDatasourceTests(sections, bag) {
7551
8454
  }
7552
8455
  }
7553
8456
  }
8457
+ function checkUncheckedWorkflowTestCalls(sections, bag) {
8458
+ const tests = (sections.workflow_test ?? []).filter((t) => !!t && typeof t === "object");
8459
+ const nameOf = (guid) => {
8460
+ const hit = tests.find((t) => t.guid === guid);
8461
+ return typeof hit?.name === "string" ? `"${hit.name}"` : "a child";
8462
+ };
8463
+ for (const test of tests) {
8464
+ const statements = [];
8465
+ collectStatements(test, statements);
8466
+ for (const st of statements) {
8467
+ if (st.name !== "mvp:workspace_run_workflow_test" || st.disabled === true) continue;
8468
+ const as = typeof st.as === "string" ? st.as : "";
8469
+ if (as !== "" && statementsRead(test, as, st)) continue;
8470
+ const bind = as === "" ? 'add `as: "child"`, then ' : "";
8471
+ bag.warn(
8472
+ "workflow-test.unchecked-child",
8473
+ `workflowTest "${typeof test.name === "string" ? test.name : "?"}": \`s.workflow_test.call\` runs ${nameOf(st.context?.id)} and nothing reads its result. A failing child does NOT fail this test: it binds its \`{ code, message }\` error to \`as\` (a passing child binds \`null\`) and this test runs on to PASS. To make the child count, ${bind}assert on it: \`s.expect.to_be_null({ expr: ref("${as || "child"}") })\`.`,
8474
+ test
8475
+ );
8476
+ }
8477
+ }
8478
+ }
7554
8479
  function checkRunFamilyHosts(sections, bag) {
7555
8480
  for (const [payloadKey, arr] of Object.entries(sections)) {
7556
8481
  if (payloadKey === "workflow_test") continue;
7557
- for (const obj of arr ?? []) {
7558
- if (!obj || typeof obj !== "object") continue;
7559
- const objName = obj.name;
7560
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof objName === "string" ? objName : "?"}"`;
8482
+ for (const obj2 of arr ?? []) {
8483
+ if (!obj2 || typeof obj2 !== "object") continue;
8484
+ const objName = obj2.name;
8485
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof objName === "string" ? objName : "?"}"`;
7561
8486
  const statements = [];
7562
- collectStatements(obj, statements);
8487
+ collectStatements(obj2, statements);
7563
8488
  const found = new Set(
7564
8489
  statements.map((s) => s.name).filter((name) => Object.hasOwn(RUN_FAMILY, name) && !RUNS_OUTSIDE_A_WORKFLOW_TEST.has(name))
7565
8490
  );
@@ -7576,9 +8501,9 @@ function checkRunFamilyHosts(sections, bag) {
7576
8501
  function checkAssertionsOutsideTests(sections, bag) {
7577
8502
  for (const [payloadKey, arr] of Object.entries(sections)) {
7578
8503
  if (payloadKey === "workflow_test") continue;
7579
- for (const obj of arr ?? []) {
7580
- if (!obj || typeof obj !== "object") continue;
7581
- const run = obj.run;
8504
+ for (const obj2 of arr ?? []) {
8505
+ if (!obj2 || typeof obj2 !== "object") continue;
8506
+ const run = obj2.run;
7582
8507
  if (!Array.isArray(run)) continue;
7583
8508
  const statements = [];
7584
8509
  collectStatements(run, statements);
@@ -7590,8 +8515,8 @@ function checkAssertionsOutsideTests(sections, bag) {
7590
8515
  if (found.length === 0) continue;
7591
8516
  bag.warn(
7592
8517
  "stack.expect-outside-test",
7593
- `${sdkSubject(payloadKey, obj)} runs ${proseList(found.map((f) => `\`${f}\``), "and")} in its stack. An assertion is not inert outside a workflow test: a failing one aborts the stack, so the request fails (HTTP 500 with the assertion's message). Move it into a \`workflowTest({ \u2026 })\` that calls this object, or check the value with \`s.precondition\` if the stack should refuse it.`,
7594
- obj
8518
+ `${sdkSubject(payloadKey, obj2)} runs ${proseList(found.map((f) => `\`${f}\``), "and")} in its stack. An assertion is not inert outside a workflow test: a failing one aborts the stack, so the request fails (HTTP 500 with the assertion's message). Move it into a \`workflowTest({ \u2026 })\` that calls this object, or check the value with \`s.precondition\` if the stack should refuse it.`,
8519
+ obj2
7595
8520
  );
7596
8521
  }
7597
8522
  }
@@ -7663,9 +8588,9 @@ function checkToolAuthIdentity(sections, bag) {
7663
8588
  const guid = t.guid;
7664
8589
  if (typeof guid === "string" && guid !== "") byGuid.set(guid, t);
7665
8590
  }
7666
- for (const obj of sections.toolset ?? []) {
7667
- if (!obj || typeof obj !== "object") continue;
7668
- const set = obj;
8591
+ for (const obj2 of sections.toolset ?? []) {
8592
+ if (!obj2 || typeof obj2 !== "object") continue;
8593
+ const set = obj2;
7669
8594
  if (!Array.isArray(set.tool)) continue;
7670
8595
  const setName = typeof set.name === "string" ? set.name : "?";
7671
8596
  const kind = set.type === "agent" ? "agent" : "mcp server";
@@ -7679,10 +8604,11 @@ function checkToolAuthIdentity(sections, bag) {
7679
8604
  if (tool === void 0) continue;
7680
8605
  if (!readsAuth(tool)) continue;
7681
8606
  const toolName = typeof tool.name === "string" ? tool.name : "?";
8607
+ const symptom = kind === "agent" ? `so the model reads a successful tool result and reports success while nothing is written` : `so \`tools/call\` answers an \`isError\` tool error with the generic text "Unable to get successful response from executing tool" (never null, never the write)`;
7682
8608
  bag.warn(
7683
8609
  "toolset.tool-reads-auth-ungated",
7684
- `${kind} "${setName}": tool "${toolName}" reads \`auth()\`, but its entry names no auth table, so the tool runs with no caller. \`auth()\` there does not return null \u2014 the call answers a normal result carrying \`{"code":"ERROR_FATAL","message":""}\`, so the model reads a successful tool result and reports success while nothing is written. A caller token does not rescue it; the entry is the gate. Wrap the entry with the auth table: \`{ tool: <the ${toolName} handle>, auth: <auth table> }\`.`,
7685
- obj
8610
+ `${kind} "${setName}": tool "${toolName}" reads \`auth()\`, but its entry names no auth table, so the tool runs with no caller. \`auth()\` there does not return null \u2014 the call binds \`{"code":"ERROR_FATAL","message":""}\`, ${symptom}. A caller token does not rescue it; the entry is the gate. Wrap the entry with the auth table: \`{ tool: <the ${toolName} handle>, auth: <auth table> }\`.`,
8611
+ obj2
7686
8612
  );
7687
8613
  }
7688
8614
  }
@@ -7690,10 +8616,10 @@ function checkToolAuthIdentity(sections, bag) {
7690
8616
  function checkPrimitiveAuthIdentity(sections, bag) {
7691
8617
  for (const kind of ["prompt", "resource"]) {
7692
8618
  const byGuid = /* @__PURE__ */ new Map();
7693
- for (const obj of sections[kind] ?? []) {
7694
- if (!obj || typeof obj !== "object") continue;
7695
- const guid = obj.guid;
7696
- if (typeof guid === "string" && guid !== "") byGuid.set(guid, obj);
8619
+ for (const obj2 of sections[kind] ?? []) {
8620
+ if (!obj2 || typeof obj2 !== "object") continue;
8621
+ const guid = obj2.guid;
8622
+ if (typeof guid === "string" && guid !== "") byGuid.set(guid, obj2);
7697
8623
  }
7698
8624
  if (byGuid.size === 0) continue;
7699
8625
  const call = kind === "prompt" ? "prompts/get" : "resources/read";
@@ -7722,9 +8648,9 @@ function checkStackAuthRatelimit(sections, bag) {
7722
8648
  ["task", "a task is scheduled/background and never has a request identity", "key it off a fixed value"]
7723
8649
  ];
7724
8650
  for (const [kind, reason, remedy] of hosts) {
7725
- for (const obj of sections[kind] ?? []) {
7726
- if (!obj || typeof obj !== "object") continue;
7727
- const host = obj;
8651
+ for (const obj2 of sections[kind] ?? []) {
8652
+ if (!obj2 || typeof obj2 !== "object") continue;
8653
+ const host = obj2;
7728
8654
  if (kind === "query" && host.auth) continue;
7729
8655
  let hit = false;
7730
8656
  walkNodes(host.run, (record) => {
@@ -7734,7 +8660,7 @@ function checkStackAuthRatelimit(sections, bag) {
7734
8660
  bag.warn(
7735
8661
  "stack.auth-null-host",
7736
8662
  `${kind} "${String(host.name)}": an \`s.redis.ratelimit\` in its stack keys off auth(), where ${reason}. auth() cannot resolve there and the request FAILS (403) rather than degrading to a shared key \u2014 ${remedy}.`,
7737
- obj
8663
+ obj2
7738
8664
  );
7739
8665
  }
7740
8666
  }
@@ -7759,40 +8685,49 @@ function statementsRead(root, name, except) {
7759
8685
  }
7760
8686
  function checkRatelimitWithoutError(sections, bag) {
7761
8687
  for (const [kind, objs] of Object.entries(sections)) {
7762
- for (const obj of objs ?? []) {
7763
- if (!obj || typeof obj !== "object") continue;
8688
+ for (const obj2 of objs ?? []) {
8689
+ if (!obj2 || typeof obj2 !== "object") continue;
7764
8690
  const bound = [];
7765
8691
  let unbound = false;
7766
- walkNodes(obj, (record) => {
8692
+ walkNodes(obj2, (record) => {
7767
8693
  if (record.name !== "mvp:redis_ratelimit" || !Array.isArray(record.input)) return;
7768
8694
  const error = record.input.find((e) => e?.name === "error");
7769
8695
  const set = error !== void 0 && !(error.tag === "const" && (error.value === "" || error.value === void 0));
7770
8696
  if (set) return;
7771
8697
  if (typeof record.as === "string" && record.as !== "") {
7772
- if (!statementsRead(obj, record.as, record)) bound.push(record.as);
8698
+ if (!statementsRead(obj2, record.as, record)) bound.push(record.as);
7773
8699
  } else unbound = true;
7774
8700
  });
7775
8701
  if (bound.length === 0 && !unbound) continue;
7776
8702
  const binds = bound.length > 0 ? `only binds \`false\` to ${bound.map((a) => `"${a}"`).join(", ")} and the request carries on` : "binds nothing (no `as`) and the request carries on";
7777
8703
  bag.warn(
7778
8704
  "redis.ratelimit-no-error",
7779
- `${kind} "${String(obj.name)}": an \`s.redis.ratelimit\` has no \`error\`, so it never stops a request \u2014 over \`max\` it ${binds}. Pass \`error: c.text("Too many requests.")\` to answer 429 once the limit is hit, or branch on the bound value.`,
7780
- obj
8705
+ `${kind} "${String(obj2.name)}": an \`s.redis.ratelimit\` has no \`error\`, so it never stops a request \u2014 over \`max\` it ${binds}. Pass \`error: c.text("Too many requests.")\` to answer 429 once the limit is hit, or branch on the bound value.`,
8706
+ obj2
7781
8707
  );
7782
8708
  }
7783
8709
  }
7784
8710
  }
7785
8711
  function checkAuthNoCaller(sections, bag) {
7786
8712
  const RT = 'read the client\'s identity from `t.client("permissions.row_id")` or `s.realtime.get_session`';
8713
+ const functions = /* @__PURE__ */ new Map();
8714
+ for (const fn of sections.function ?? []) {
8715
+ const guid = fn?.guid;
8716
+ if (typeof guid === "string") functions.set(guid, fn);
8717
+ }
7787
8718
  const hosts = [
7788
- ["query", "it names no auth table, so no caller is ever resolved", "name an auth table on the query (`auth: <table>`)"],
8719
+ [
8720
+ "query",
8721
+ "it names no auth table, so no caller is ever resolved: every request is refused with HTTP 403 and an empty message",
8722
+ "name an auth table on the query (`auth: <table>`)"
8723
+ ],
7789
8724
  ["task", "a task runs on a schedule with no caller", "carry the user id in the data the task reads"],
7790
8725
  ["trigger", "a realtime lifecycle trigger establishes no auth (it reads 0)", RT]
7791
8726
  ];
7792
8727
  for (const [kind, reason, remedy] of hosts) {
7793
- for (const obj of sections[kind] ?? []) {
7794
- if (!obj || typeof obj !== "object") continue;
7795
- const host = obj;
8728
+ for (const obj2 of sections[kind] ?? []) {
8729
+ if (!obj2 || typeof obj2 !== "object") continue;
8730
+ const host = obj2;
7796
8731
  if (kind === "query" && host.auth) continue;
7797
8732
  if (kind === "trigger") {
7798
8733
  const t = host.obj_type;
@@ -7803,15 +8738,171 @@ function checkAuthNoCaller(sections, bag) {
7803
8738
  walkNodes(host, (record) => {
7804
8739
  if (record.name === "mvp:redis_ratelimit" && readsAuth(record)) ratelimit = true;
7805
8740
  });
7806
- if (ratelimit || !readsAuth(host)) continue;
8741
+ if (ratelimit) continue;
8742
+ if (readsAuth(host)) {
8743
+ bag.warn(
8744
+ "stack.auth-no-caller",
8745
+ kind === "query" ? `query "${String(host.name)}" reads \`auth()\`, but ${reason}. Fix: ${remedy}.` : `${kind} "${String(host.name)}" reads \`auth()\`, but ${reason}: it deploys clean and never holds the caller's identity. Fix: ${remedy}.`,
8746
+ obj2
8747
+ );
8748
+ continue;
8749
+ }
8750
+ const reached = kind === "query" ? authReadingCallee(host, functions) : void 0;
8751
+ if (reached === void 0) continue;
8752
+ const why = reached.async ? "it names no auth table, so no caller is ever resolved: the request answers 2xx with the job id, and the background job fails ACCESS_DENIED" : reason;
7807
8753
  bag.warn(
7808
8754
  "stack.auth-no-caller",
7809
- `${kind} "${String(host.name)}" reads \`auth()\`, but ${reason}: it deploys clean and never holds the caller's identity. Fix: ${remedy}.`,
7810
- obj
8755
+ `query "${String(host.name)}" runs ${reached.chain}, which reads \`auth()\`, but the query ${why}. A function inherits its caller's identity, and this caller has none. Fix: ${remedy}.`,
8756
+ obj2
7811
8757
  );
7812
8758
  }
7813
8759
  }
7814
8760
  }
8761
+ function authReadingCallee(host, functions) {
8762
+ const seen = /* @__PURE__ */ new Set();
8763
+ const visit = (node, chain, viaAsync) => {
8764
+ const targets = [];
8765
+ walkNodes(node, (record) => {
8766
+ if (record.name !== "mvp:function" && record.name !== "mvp:workspace_run_function") return;
8767
+ const mode = record.runtime?.mode;
8768
+ const ctx = record.context;
8769
+ const id = record.name === "mvp:function" ? ctx?.function?.id : ctx?.id;
8770
+ if (typeof id === "string") targets.push({ id, async: typeof mode === "string" && mode.startsWith("async") });
8771
+ });
8772
+ for (const target of targets) {
8773
+ if (seen.has(target.id)) continue;
8774
+ seen.add(target.id);
8775
+ const fn = functions.get(target.id);
8776
+ if (fn === void 0) continue;
8777
+ const async = viaAsync || target.async;
8778
+ const here = `${chain}${chain === "" ? "" : " \u2192 "}function "${String(fn.name)}"${target.async ? " (async)" : ""}`;
8779
+ if (readsAuth(fn)) return { chain: here, async };
8780
+ const deeper = visit(fn, here, async);
8781
+ if (deeper !== void 0) return deeper;
8782
+ }
8783
+ return void 0;
8784
+ };
8785
+ return visit(host, "", false);
8786
+ }
8787
+ function checkToolCallReadsAuth(sections, bag) {
8788
+ const tools = /* @__PURE__ */ new Map();
8789
+ for (const t of sections.tool ?? []) {
8790
+ const guid = t?.guid;
8791
+ if (typeof guid === "string") tools.set(guid, t);
8792
+ }
8793
+ if (tools.size === 0) return;
8794
+ const functions = /* @__PURE__ */ new Map();
8795
+ for (const fn of sections.function ?? []) {
8796
+ const guid = fn?.guid;
8797
+ if (typeof guid === "string") functions.set(guid, fn);
8798
+ }
8799
+ for (const [kind, arr] of Object.entries(sections)) {
8800
+ for (const obj2 of arr ?? []) {
8801
+ if (!obj2 || typeof obj2 !== "object") continue;
8802
+ const named = /* @__PURE__ */ new Set();
8803
+ walkNodes(obj2, (record) => {
8804
+ if (record.name !== "mvp:workspace_run_tool") return;
8805
+ const id = record.context?.id;
8806
+ const target = typeof id === "string" ? tools.get(id) : void 0;
8807
+ if (target === void 0) return;
8808
+ const via = readsAuth(target) ? "" : authReadingCallee(target, functions)?.chain;
8809
+ if (via === void 0) return;
8810
+ named.add(`"${String(target.name)}"${via === "" ? "" : ` (through ${via})`}`);
8811
+ });
8812
+ if (named.size === 0) continue;
8813
+ const list = [...named].join(", ");
8814
+ bag.warn(
8815
+ "stack.tool-call-reads-auth",
8816
+ `${sdkKindName(kind, obj2)} "${String(obj2.name ?? "?")}": \`s.tool.call\` runs tool ${list} with NO caller, even from an authenticated query: its \`auth()\` fails ACCESS_DENIED, the failure is bound to \`as\`, and the request answers 200. Put the logic in a \`defineFunction\` that takes the user id as an input, and call it from both the tool and this stack.`,
8817
+ obj2
8818
+ );
8819
+ }
8820
+ }
8821
+ }
8822
+ function checkPatchRawInput(sections, bag) {
8823
+ for (const [kind, arr] of Object.entries(sections)) {
8824
+ for (const obj2 of arr ?? []) {
8825
+ if (!obj2 || typeof obj2 !== "object") continue;
8826
+ const inputs = /* @__PURE__ */ new Set();
8827
+ walkNodes(obj2, (record) => {
8828
+ if (record.name !== "mvp:dbo_patch" || !Array.isArray(record.input)) return;
8829
+ const item = record.input.find(
8830
+ (e) => e?.name === "item"
8831
+ );
8832
+ if (item?.tag === "input" && typeof item.value === "string" && (item.filters?.length ?? 0) === 0) inputs.add(item.value);
8833
+ });
8834
+ for (const name of inputs) {
8835
+ bag.warn(
8836
+ "db.patch-raw-input",
8837
+ `${sdkKindName(kind, obj2)} "${String(obj2.name ?? "?")}": \`s.db.patch\` writes \`inp("${name}")\` as sent, so the caller can set ANY column, the primary key included (\`{"id": 50}\` renumbers the row). Name the writable keys: \`data: withFilters(inp("${name}"), fl.pick("title,body"))\`.`,
8838
+ obj2
8839
+ );
8840
+ }
8841
+ }
8842
+ }
8843
+ }
8844
+ function checkEditOptionalInput(sections, bag) {
8845
+ const EDITS = { "mvp:dbo_editby": "s.db.edit", "mvp:dbo_addoreditby": "s.db.add_or_edit" };
8846
+ for (const [kind, arr] of Object.entries(sections)) {
8847
+ for (const obj2 of arr ?? []) {
8848
+ if (!obj2 || typeof obj2 !== "object") continue;
8849
+ const declared = obj2.input;
8850
+ if (!Array.isArray(declared)) continue;
8851
+ const risky = /* @__PURE__ */ new Set();
8852
+ for (const d of declared) {
8853
+ if (typeof d?.name === "string" && d.required !== true && d.nullable !== true && (d.default ?? "") === "") risky.add(d.name);
8854
+ }
8855
+ if (risky.size === 0) continue;
8856
+ const hits = /* @__PURE__ */ new Map();
8857
+ walkNodes(obj2, (record) => {
8858
+ const surface = typeof record.name === "string" ? EDITS[record.name] : void 0;
8859
+ if (surface === void 0 || !Array.isArray(record.input)) return;
8860
+ for (const e of record.input) {
8861
+ if (e?.ignore === true || e.name === "field_name" || e.name === "field_value") continue;
8862
+ if (e.tag !== "input" || typeof e.value !== "string" || (e.filters?.length ?? 0) > 0 || !risky.has(e.value)) continue;
8863
+ (hits.get(surface) ?? hits.set(surface, /* @__PURE__ */ new Set()).get(surface)).add(`${String(e.name)}: inp("${e.value}")`);
8864
+ }
8865
+ });
8866
+ for (const [surface, cells] of hits) {
8867
+ const list = [...cells];
8868
+ bag.warn(
8869
+ "db.edit-optional-input",
8870
+ `${sdkKindName(kind, obj2)} "${String(obj2.name ?? "?")}": \`${surface}\` writes ${list.join(", ")} from optional, non-nullable ${list.length === 1 ? "input" : "inputs"}. An omitted one binds its empty value ("" or 0) and the edit WRITES it, blanking the stored column. For a partial update, declare the inputs \`nullable: true\` and write \`s.db.patch({ data: withFilters(obj({ \u2026 }), fl.filter_null()) })\`, which writes only the keys that arrived.`,
8871
+ obj2
8872
+ );
8873
+ }
8874
+ }
8875
+ }
8876
+ }
8877
+ function checkAuthTokenOptionalExpiration(sections, bag) {
8878
+ for (const [kind, arr] of Object.entries(sections)) {
8879
+ for (const obj2 of arr ?? []) {
8880
+ if (!obj2 || typeof obj2 !== "object") continue;
8881
+ const declared = obj2.input;
8882
+ if (!Array.isArray(declared)) continue;
8883
+ const risky = /* @__PURE__ */ new Set();
8884
+ for (const d of declared) {
8885
+ if (typeof d?.name === "string" && d.required !== true && d.nullable !== true && (d.default ?? "") === "") risky.add(d.name);
8886
+ }
8887
+ if (risky.size === 0) continue;
8888
+ const hits = /* @__PURE__ */ new Set();
8889
+ walkNodes(obj2, (record) => {
8890
+ if (record.name !== "mvp:create_auth" || !Array.isArray(record.input)) return;
8891
+ const e = record.input.find(
8892
+ (x) => x?.name === "expiration"
8893
+ );
8894
+ if (e?.tag === "input" && typeof e.value === "string" && (e.filters?.length ?? 0) === 0 && risky.has(e.value)) hits.add(e.value);
8895
+ });
8896
+ for (const name of hits) {
8897
+ bag.warn(
8898
+ "stack.auth-token-optional-expiration",
8899
+ `${sdkKindName(kind, obj2)} "${String(obj2.name ?? "?")}": \`s.security.create_auth_token\` takes \`expiration\` from \`inp("${name}")\`, an optional, non-nullable input with no default. An omitted one binds 0, and \`expiration: 0\` mints a token that NEVER expires. Declare \`input.int({ default: 86400 })\`, or mark it \`required: true\`.`,
8900
+ obj2
8901
+ );
8902
+ }
8903
+ }
8904
+ }
8905
+ }
7815
8906
  function readsAuth(tool) {
7816
8907
  let found = false;
7817
8908
  walkNodes(tool, (record) => {
@@ -7844,8 +8935,8 @@ function looksLikeSecret(value) {
7844
8935
  return value.length >= 32 && /^[A-Za-z0-9_\-.]+$/.test(value) && /[A-Za-z]/.test(value) && /\d/.test(value);
7845
8936
  }
7846
8937
  function checkAgentApiKeys(sections, bag) {
7847
- for (const obj of sections.toolset ?? []) {
7848
- const t = obj ?? {};
8938
+ for (const obj2 of sections.toolset ?? []) {
8939
+ const t = obj2 ?? {};
7849
8940
  if (t.type !== "agent") continue;
7850
8941
  const settings = t.agent_settings;
7851
8942
  const provider = typeof settings?.type === "string" ? settings.type : "";
@@ -7857,7 +8948,7 @@ function checkAgentApiKeys(sections, bag) {
7857
8948
  bag.error(
7858
8949
  "agent.literal-api-key",
7859
8950
  `agent "${name}" spells its \`llm.apiKey\` literally. That value is a secret and this is committed source. Read it from the workspace env instead: \`apiKey: "{{ $env.${envName} }}"\`, with \`${envName}\` declared in \`workspaceConfig({ env })\` and its value in \`xano/.env\`. If this key has already been committed, treat it as disclosed and rotate it.`,
7860
- obj
8951
+ obj2
7861
8952
  );
7862
8953
  }
7863
8954
  }
@@ -7934,13 +9025,13 @@ function elicitWrite(statement) {
7934
9025
  }
7935
9026
  function checkWriteBeforeElicit(sections, bag) {
7936
9027
  for (const [payloadKey, arr] of Object.entries(sections)) {
7937
- for (const obj of arr ?? []) {
7938
- if (!obj || typeof obj !== "object") continue;
9028
+ for (const obj2 of arr ?? []) {
9029
+ if (!obj2 || typeof obj2 !== "object") continue;
7939
9030
  const statements = [];
7940
- collectStatements(obj.run, statements);
9031
+ collectStatements(obj2.run, statements);
7941
9032
  if (!statements.some((st) => st.name === "mvp:mcp_elicit")) continue;
7942
- const objName = obj.name;
7943
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof objName === "string" ? objName : "?"}"`;
9033
+ const objName = obj2.name;
9034
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof objName === "string" ? objName : "?"}"`;
7944
9035
  let writes = [];
7945
9036
  for (const st of statements) {
7946
9037
  if (st.name === "mvp:mcp_elicit") {
@@ -7949,7 +9040,7 @@ function checkWriteBeforeElicit(sections, bag) {
7949
9040
  bag.warn(
7950
9041
  "mcp.write-before-elicit",
7951
9042
  `${owner}: ${proseList([...new Set(writes)].map((w) => `\`${w}\``), "and")} runs before \`s.mcp.elicit\`${typeof key === "string" && key !== "" ? ` "${key}"` : ""}. When the client answers, the whole stack runs again from the top, so that write runs once per round trip (a row added before a confirmation is added twice). Ask first, then act: move the elicit above the write. If the write is idempotent or meant to repeat, accept it with \`diagnostics: { allow: ["mcp.write-before-elicit"] }\`.`,
7952
- obj
9043
+ obj2
7953
9044
  );
7954
9045
  }
7955
9046
  writes = [];
@@ -7976,22 +9067,22 @@ function checkMcpStackHazards(sections, bag) {
7976
9067
  );
7977
9068
  }
7978
9069
  for (const [payloadKey, arr] of Object.entries(sections)) {
7979
- for (const obj of arr ?? []) {
7980
- if (!obj || typeof obj !== "object") continue;
9070
+ for (const obj2 of arr ?? []) {
9071
+ if (!obj2 || typeof obj2 !== "object") continue;
7981
9072
  const statements = [];
7982
- collectStatements(obj.run, statements);
9073
+ collectStatements(obj2.run, statements);
7983
9074
  const elicits = statements.filter((st) => st.name === "mvp:mcp_elicit");
7984
9075
  if (elicits.length === 0) continue;
7985
- const owner = sdkSubject(payloadKey, obj);
9076
+ const owner = sdkSubject(payloadKey, obj2);
7986
9077
  if (NO_MCP_CALLER.has(payloadKey)) {
7987
9078
  bag.warn(
7988
9079
  "mcp.elicit-outside-mcp",
7989
9080
  `${owner}: \`s.mcp.elicit\` runs in a ${sdkKindName(payloadKey)} stack, which no MCP client calls, so there is nobody to ask and it answers \`{ action: "cancel" }\` every time. Elicit from a tool, prompt or resource stack.`,
7990
- obj
9081
+ obj2
7991
9082
  );
7992
9083
  }
7993
9084
  const byKey = /* @__PURE__ */ new Map();
7994
- for (const placed of placedElicits(obj.run)) {
9085
+ for (const placed of placedElicits(obj2.run)) {
7995
9086
  const key = statementInput(placed.statement, "key");
7996
9087
  if (key?.tag !== "const" || typeof key.value !== "string") continue;
7997
9088
  if (Array.isArray(key.filters) && key.filters.length > 0) continue;
@@ -8008,14 +9099,14 @@ function checkMcpStackHazards(sections, bag) {
8008
9099
  bag.warn(
8009
9100
  "mcp.elicit-duplicate-key",
8010
9101
  `${owner}: ${keys(repeated)} ${repeated.length === 1 ? "is the `key` of" : "are each the `key` of"} more than one \`s.mcp.elicit\` that can run in one call. The key is how the re-run after an answer finds that answer, so the later elicit reads the earlier one's and never asks. Give each elicit its own key.`,
8011
- obj
9102
+ obj2
8012
9103
  );
8013
9104
  }
8014
9105
  if (looped.length > 0) {
8015
9106
  bag.warn(
8016
9107
  "mcp.elicit-duplicate-key",
8017
9108
  `${owner}: the \`s.mcp.elicit\` keyed ${keys(looped)} runs inside a loop, so every pass after the first reads the first pass's answer by that key and never asks. Elicit once before the loop, or build the key from the loop variable.`,
8018
- obj
9109
+ obj2
8019
9110
  );
8020
9111
  }
8021
9112
  }
@@ -8154,8 +9245,8 @@ function roleCheckOf(st) {
8154
9245
  return void 0;
8155
9246
  }
8156
9247
  function checkToolOutputSchema(sections, bag) {
8157
- for (const obj of sections.tool ?? []) {
8158
- const t = obj ?? {};
9248
+ for (const obj2 of sections.tool ?? []) {
9249
+ const t = obj2 ?? {};
8159
9250
  if (!Array.isArray(t.output_schema) || t.output_schema.length === 0) continue;
8160
9251
  if (!Array.isArray(t.result) || t.result.length === 0) continue;
8161
9252
  const keys = t.result.map((e) => e?.name);
@@ -8173,7 +9264,19 @@ function checkToolOutputSchema(sections, bag) {
8173
9264
  bag.warn(
8174
9265
  "tool.output-mismatch",
8175
9266
  `tool "${String(t.name)}": its \`response\` ${parts.join("; ")}. The \`output\` schema declares ${names.map((n) => `\`${n}\``).join(", ")}` + (missing.length > 0 ? `, and a result missing a required key fails the client's output check on every call` : `, which the response leaves unset`) + `. Return the keys \`output\` declares, or change \`output\`.`,
8176
- obj
9267
+ obj2
9268
+ );
9269
+ }
9270
+ }
9271
+ function checkToolDescriptionShadowed(sections, bag) {
9272
+ for (const obj2 of sections.tool ?? []) {
9273
+ const t = obj2 ?? {};
9274
+ const set = (v) => typeof v === "string" && v.trim() !== "";
9275
+ if (!set(t.description) || !set(t.instructions)) continue;
9276
+ bag.warn(
9277
+ "tool.description-shadowed",
9278
+ `tool "${String(t.name)}" sets both \`description\` and \`instructions\`. A set \`instructions\` is what MCP clients and the model see as the tool's description (\`tools/list\`, agent tools, connection triggers), so the \`description\` is never shown. Put the text clients should see in \`instructions\`, or drop \`instructions\` to let \`description\` through.`,
9279
+ obj2
8177
9280
  );
8178
9281
  }
8179
9282
  }
@@ -8286,10 +9389,13 @@ function checkAgentToolsOff(sections, bag) {
8286
9389
  if (withTools.size === 0) return;
8287
9390
  forEachAgentRun(sections, (st, toolsetId, owner, host) => {
8288
9391
  const name = withTools.get(toolsetId);
8289
- if (name === void 0 || statementInput(st, "allow_tool_execution") !== void 0) return;
9392
+ if (name === void 0) return;
9393
+ const flag = statementInput(st, "allow_tool_execution");
9394
+ const literalFalse = flag?.tag === "const:bool" && flag.value === "false" && (!Array.isArray(flag.filters) || flag.filters.length === 0);
9395
+ if (!literalFalse) return;
8290
9396
  bag.warn(
8291
9397
  "stack.agent-tools-off",
8292
- `${owner}: \`s.ai.agent.run\` of agent "${name}" leaves \`allowToolExecution\` unset, so the agent runs with its tools off: it sees them but never calls one, and answers as if it had no data. Pass \`allowToolExecution: c.bool(true)\`, or \`c.bool(false)\` to keep tools off on purpose.`,
9398
+ `${owner}: \`s.ai.agent.run\` of agent "${name}" sets \`allowToolExecution: c.bool(false)\`. The agent still sees its tools and the model still emits a tool call, but the call never executes, so the run usually ends with an empty \`result\` at 200. Leave \`allowToolExecution\` unset (it defaults to true), or run an agent with no tools when it must answer without them.`,
8293
9399
  host
8294
9400
  );
8295
9401
  });
@@ -8380,6 +9486,13 @@ export {
8380
9486
  checkIntRange,
8381
9487
  checkZeroBasedObjects,
8382
9488
  checkRegexOperandOrder,
9489
+ checkUnboundPredicates,
9490
+ checkConstantArrayKeys,
9491
+ checkPredicateIndexReads,
9492
+ checkPreconditionBareErrors,
9493
+ checkReturnedStreams,
9494
+ checkReturnedIncludeMeta,
9495
+ checkReturnsOutsideInferredType,
8383
9496
  isKnownTimezone,
8384
9497
  checkTimezoneArgs,
8385
9498
  checkSeed,
@@ -8398,10 +9511,12 @@ export {
8398
9511
  checkRealtimeSilentShapes,
8399
9512
  checkRealtimeJoinDeliver,
8400
9513
  checkRealtimeDeliver,
9514
+ UPDATE_VAR_FACTORIES,
8401
9515
  checkUnboundVarRefs,
8402
9516
  checkPasswordInputHashing,
8403
9517
  checkZipPasswordKeys,
8404
9518
  checkToThrowScope,
9519
+ checkConditionallyBoundVars,
8405
9520
  checkSafeRefMatchArgs,
8406
9521
  checkNullMatchArgs,
8407
9522
  checkPathSegmentCandidates,
@@ -8409,6 +9524,8 @@ export {
8409
9524
  checkRouteShadowing,
8410
9525
  checkRealtimePublish,
8411
9526
  checkTriggerBindings,
9527
+ checkTriggerAbsentSideReads,
9528
+ checkMcpTriggerResponseKeys,
8412
9529
  checkDecodeOnlyStatements,
8413
9530
  checkNonJsonValues,
8414
9531
  checkReferences,
@@ -8419,6 +9536,7 @@ export {
8419
9536
  checkMicroserviceSecrets,
8420
9537
  checkMicroserviceBlocks,
8421
9538
  checkLiveDatasourceTests,
9539
+ checkUncheckedWorkflowTestCalls,
8422
9540
  checkRunFamilyHosts,
8423
9541
  checkAssertionsOutsideTests,
8424
9542
  checkKnowledge,
@@ -8427,6 +9545,10 @@ export {
8427
9545
  checkStackAuthRatelimit,
8428
9546
  checkRatelimitWithoutError,
8429
9547
  checkAuthNoCaller,
9548
+ checkToolCallReadsAuth,
9549
+ checkPatchRawInput,
9550
+ checkEditOptionalInput,
9551
+ checkAuthTokenOptionalExpiration,
8430
9552
  checkDocumentationTokens,
8431
9553
  looksLikeSecret,
8432
9554
  checkAgentApiKeys,
@@ -8436,7 +9558,8 @@ export {
8436
9558
  checkMcpResourceUris,
8437
9559
  checkGuardRoleColumns,
8438
9560
  checkToolOutputSchema,
9561
+ checkToolDescriptionShadowed,
8439
9562
  checkAgentArgPlaceholders,
8440
9563
  checkAgentToolsOff
8441
9564
  };
8442
- //# sourceMappingURL=chunk-SH4RY6QX.js.map
9565
+ //# sourceMappingURL=chunk-HXPQXCOZ.js.map