@xano/sdk 1.0.14 → 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 +27 -0
  2. package/README.md +33 -37
  3. package/dist/.build-fingerprint +1 -1
  4. package/dist/{agent-file-refresh-3J6YRVFL.js → agent-file-refresh-DBHTEFYM.js} +12 -12
  5. package/dist/{agent-skill-command-VWDMQWCT.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-ISP7RVF2.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-Z3DQ7ULY.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-QKHNJ7LE.js → chunk-3ZV23FVR.js} +5 -5
  20. package/dist/{chunk-HKI5Y5KW.js → chunk-47XIVDJ6.js} +14 -14
  21. package/dist/{chunk-ICK36EGF.js → chunk-4EVDCSEY.js} +2 -2
  22. package/dist/{chunk-FBSGFPZ4.js → chunk-4XGZ325S.js} +3 -3
  23. package/dist/{chunk-EYVIUX2T.js → chunk-4XYXUK5H.js} +76 -33
  24. package/dist/{chunk-MAXDJZQR.js → chunk-4ZBXS7YN.js} +8 -8
  25. package/dist/{chunk-ZMJRAMLA.js → chunk-52QAENY6.js} +14 -14
  26. package/dist/{chunk-2LF734YB.js → chunk-54CJ74BH.js} +4 -4
  27. package/dist/{chunk-3SZ7QRYA.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-HK554MDD.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-2FDHIBEU.js → chunk-AJQFUJEQ.js} +8 -8
  37. package/dist/{chunk-2KOB4QPW.js → chunk-C7AYP4H6.js} +29 -20
  38. package/dist/{chunk-XCFQLP6G.js → chunk-DJMGDCVX.js} +8 -8
  39. package/dist/{chunk-VBSCWV5H.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-QX5XQEYB.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-IHL2O7VY.js → chunk-F3JK5RIY.js} +3 -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-LW7TOIS7.js → chunk-GRZ62LLU.js} +8 -8
  59. package/dist/{chunk-6X73VFCX.js → chunk-GT7PZCTK.js} +2 -2
  60. package/dist/{chunk-HINRE3UM.js → chunk-HXPQXCOZ.js} +1821 -506
  61. package/dist/{chunk-ECQXASG3.js → chunk-IFHFJR5O.js} +2 -2
  62. package/dist/{chunk-P4OWRYE7.js → chunk-IOWNQEMW.js} +31 -31
  63. package/dist/{chunk-SUKO4SZG.js → chunk-ISIZFK5Q.js} +53 -47
  64. package/dist/{chunk-QJ25N4W6.js → chunk-IUJDUFT7.js} +4 -4
  65. package/dist/{chunk-L34DM6QB.js → chunk-JHAZK4RY.js} +3 -3
  66. package/dist/{chunk-YL3WVBR5.js → chunk-KGHJ74HF.js} +6 -6
  67. package/dist/{chunk-NUZXSIEA.js → chunk-L2O5KG5Q.js} +6 -6
  68. package/dist/{chunk-L4WG4BKJ.js → chunk-L3Q2QYIQ.js} +72 -72
  69. package/dist/{chunk-SAEIVQLP.js → chunk-LLBEPJBO.js} +3 -3
  70. package/dist/{chunk-NOW522B4.js → chunk-LWBGPPI5.js} +13 -13
  71. package/dist/{chunk-GOKRKTCX.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-J62TYONQ.js → chunk-NQPPUNWP.js} +3 -3
  78. package/dist/{chunk-LJZIBT75.js → chunk-O7Z3LF44.js} +5 -5
  79. package/dist/{chunk-B7CPSWQX.js → chunk-OLXYZQR7.js} +7 -7
  80. package/dist/{chunk-7F3V6CFP.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-YTQYP7UJ.js → chunk-Q7KXMIR3.js} +3 -3
  85. package/dist/{chunk-IWJ6GFST.js → chunk-QCVH32T2.js} +5 -5
  86. package/dist/{chunk-7FIMUFBP.js → chunk-QDPY7RN3.js} +3 -3
  87. package/dist/{chunk-DLDYQNGP.js → chunk-QIT2GGNB.js} +3 -3
  88. package/dist/{chunk-J3XLCYTQ.js → chunk-QSJH5AFU.js} +244 -173
  89. package/dist/{chunk-DERQSEB5.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-Z4BQPABS.js → chunk-RIT3WBBX.js} +4 -4
  93. package/dist/{chunk-45K2QZBR.js → chunk-RKNCISPM.js} +3 -3
  94. package/dist/{chunk-6LJS4M6P.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-LPQZICYN.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-RPBB7P4Q.js → chunk-SVQMDVND.js} +87 -16
  104. package/dist/{chunk-45ZUMF4E.js → chunk-TPUAXIPR.js} +2 -2
  105. package/dist/{chunk-HMYJOQXT.js → chunk-TXU34ELY.js} +25 -25
  106. package/dist/{chunk-MTBKTGZT.js → chunk-U4UAWGIT.js} +12 -8
  107. package/dist/{chunk-76SBT7KS.js → chunk-U56HK2RG.js} +7 -5
  108. package/dist/{chunk-RV2BDU7V.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-RDZBXTZ3.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-6ILHYSLR.js → chunk-WAP5362D.js} +5 -5
  115. package/dist/{chunk-XY4OBD26.js → chunk-WGKKDGSA.js} +4 -4
  116. package/dist/{chunk-UQ2OD7D4.js → chunk-WVVUE7LU.js} +14 -7
  117. package/dist/{chunk-LB76VK6D.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-BSGU4HS6.js → chunk-XKMZYU5B.js} +96 -65
  122. package/dist/{chunk-OLQN4Z5R.js → chunk-Y3RH35KM.js} +47 -47
  123. package/dist/{chunk-YFQCDLCQ.js → chunk-YHT7TDSH.js} +14 -14
  124. package/dist/{chunk-KDEU5FUJ.js → chunk-YJXJOMXW.js} +3 -3
  125. package/dist/{chunk-N6LGLNAC.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-MYIIBV6A.js → chunk-ZF4LCHCT.js} +5 -5
  129. package/dist/{chunk-GRXX2TOJ.js → chunk-ZHFSIQ6E.js} +2 -2
  130. package/dist/{chunk-CB67GIR3.js → chunk-ZJQFKBX7.js} +7 -7
  131. package/dist/{chunk-ZRXDPCMN.js → chunk-ZYZ7GRX3.js} +2 -2
  132. package/dist/{chunk-5TWLVFYB.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-WESYWFJN.js → deploy-command-PBM3S4ZL.js} +69 -68
  142. package/dist/{deploy-source-ZQQNMDFX.js → deploy-source-JW7DAN75.js} +32 -32
  143. package/dist/{dev-env-sync-4XJT7WOT.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-SK5FS477.js → env-pull-command-FFPNRVWD.js} +52 -52
  149. package/dist/{env-target-TEFSYACA.js → env-target-XHVRZXHX.js} +14 -14
  150. package/dist/{env-var-command-IJHKA2WJ.js → env-var-command-DJS62YRR.js} +41 -41
  151. package/dist/{ephemeral-VLPRDNEJ.js → ephemeral-2DXWP3VK.js} +9 -9
  152. package/dist/{ephemeral-command-WCO5J4SN.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-3WCOUOEQ.js → generate-command-PSDIIOTU.js} +89 -88
  155. package/dist/{gitignore-WYS3GMOX.js → gitignore-PMJ6MFNA.js} +15 -15
  156. package/dist/{guards-PPIBIMFZ.js → guards-YICHJKX3.js} +51 -15
  157. package/dist/{impersonate-command-UMYVQTCG.js → impersonate-command-IKV4KUYA.js} +37 -37
  158. package/dist/{import-T4ZTOTBT.js → import-VJQGIS33.js} +5 -5
  159. package/dist/index.d.ts +653 -222
  160. package/dist/index.js +29 -28
  161. package/dist/init-command-LEQIE6GC.js +143 -0
  162. package/dist/{init-modules-7KALFI5C.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-OVHCIEBG.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-AIHNW4AZ.js → landing-record-JQ7HZDGI.js} +22 -22
  171. package/dist/{live-diff-UMSOGPX3.js → live-diff-KJ2TWWWT.js} +14 -14
  172. package/dist/{local-engine-choice-XDGTATKJ.js → local-engine-choice-DFAMYOIF.js} +35 -35
  173. package/dist/{local-engine-command-VQWNQ7UK.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-AIMNMXQG.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-H3YV2D6M.js → lock-commands-7VO6YWOV.js} +67 -66
  182. package/dist/{login-command-NMM3JNDZ.js → login-command-WTZUBCW6.js} +27 -27
  183. package/dist/{logout-command-7DYC6G32.js → logout-command-5BJUNK3C.js} +17 -17
  184. package/dist/{loop-DJNIHC7O.js → loop-HILLODVH.js} +15 -15
  185. package/dist/{marketplace-command-UCSHDZGO.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-CD3TXQP6.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-2ONIIDRU.js → operation-outcome-WK7UW6PJ.js} +24 -24
  192. package/dist/{output-target-67LHZKCO.js → output-target-5PYRCCK4.js} +16 -16
  193. package/dist/{plan-disclosure-T7DF4SRJ.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-TJ7FURXB.js → preflight-command-3BX2WW3S.js} +75 -74
  198. package/dist/{profile-command-LDPLTJEJ.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-IIRN6NWN.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-YLCQPVH3.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-R3TQRB24.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-PCNAFXNV.js → secrets-file-7XWR7HW3.js} +15 -15
  215. package/dist/{secrets-fill-command-G7NQMRXU.js → secrets-fill-command-NKCGC75L.js} +66 -65
  216. package/dist/{seed-4CD55LB4.js → seed-YKTZDS2Q.js} +13 -13
  217. package/dist/{source-resolve-U4SJR7ZA.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-CD72PXIT.js → status-command-TBMQ3GJP.js} +38 -38
  220. package/dist/{store-AJX4MC7Y.js → store-B63BQV6R.js} +6 -6
  221. package/dist/{store-BM7SQcUt.d.ts → store-in7gSpMS.d.ts} +297 -129
  222. package/dist/sync-baseline-GRS33AB5.js +38 -0
  223. package/dist/{sync-contributions-XK6LHISZ.js → sync-contributions-RKPLZPPO.js} +9 -9
  224. package/dist/{sync-record-NE62ERA3.js → sync-record-AWFCSS4D.js} +15 -15
  225. package/dist/{table-WPRAM4VW.js → table-ONGT3JGE.js} +12 -12
  226. package/dist/{tables-command-NMTKR52H.js → tables-command-UYQ277TJ.js} +41 -41
  227. package/dist/{tenant-IIYECNWO.js → tenant-IXIW3FOI.js} +10 -10
  228. package/dist/{tenant-command-XQAWT46C.js → tenant-command-7LWZUK2V.js} +104 -103
  229. package/dist/{test-command-W4AD4KT4.js → test-command-7KTT5EAF.js} +56 -45
  230. package/dist/{tests-JWQRHFCT.js → tests-N4MMBABH.js} +6 -6
  231. package/dist/{token-P3VQ6ITJ.js → token-3TCMW2AP.js} +13 -13
  232. package/dist/{toolchain-hooks-UAJBPSTC.js → toolchain-hooks-IJWV3ZQS.js} +18 -18
  233. package/dist/{toolchain-modules-S3MPHCUI.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-WWEPNUD5.js → tracked-backend-YDUUQZQF.js} +34 -34
  236. package/dist/update-check-C6KDFGMT.js +141 -0
  237. package/dist/{upgrade-command-J6LRNHYF.js → upgrade-command-ZSBTSMBR.js} +68 -67
  238. package/dist/{whoami-command-KWRP2CII.js → whoami-command-L6ERHR5K.js} +16 -16
  239. package/dist/{workspace-3YNK4XO4.js → workspace-5DPSDM4A.js} +5 -5
  240. package/dist/{workspace-binding-TTDNXHO5.js → workspace-binding-MVOWGNYW.js} +15 -15
  241. package/dist/{workspace-command-W4ANGLCZ.js → workspace-command-PKQ5TDR7.js} +100 -99
  242. package/dist/{workspace-env-6LJGCTZA.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-PNNMZ4SF.js → xanosdk-import-HHMQDK2I.js} +10 -10
  247. package/dist/{xanosdk-project-YW3BQY2E.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 +78 -71
  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 +689 -549
  275. package/llms.txt +120 -137
  276. package/manifest.json +228 -246
  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-75IYFTBS.js +0 -80
  281. package/dist/codegen-command-JWOW6HE5.js +0 -182
  282. package/dist/env-example-refresh-4V2OCDJE.js +0 -135
  283. package/dist/init-command-UR5MSXIH.js +0 -142
  284. package/dist/promote-command-RURHOLNR.js +0 -148
  285. package/dist/pull-command-ITO76ENU.js +0 -170
  286. package/dist/release-command-CVGIUD4M.js +0 -152
  287. package/dist/routes-manifest-file-GYNYFKAH.js +0 -41
  288. package/dist/sync-baseline-BJDKG4F2.js +0 -38
  289. package/dist/update-check-O7QC5TBB.js +0 -140
  290. package/dist/xano-Z3SRHYOR.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-6ILHYSLR.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-UQ2OD7D4.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-L34DM6QB.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,16 +77,20 @@ 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,
83
+ assertBindsAs,
80
84
  encodeStatement,
81
85
  markStatement,
82
86
  readableStatementName,
83
87
  registerStatement,
84
88
  statementLabel,
85
89
  statementMark
86
- } from "./chunk-IHL2O7VY.js";
90
+ } from "./chunk-F3JK5RIY.js";
91
+ import {
92
+ subStacks
93
+ } from "./chunk-EUAU4QKI.js";
87
94
  import {
88
95
  LAMBDA_CODE_FILTERS,
89
96
  assertLambdaStatement,
@@ -99,7 +106,7 @@ import {
99
106
  sys,
100
107
  toPlainValue,
101
108
  withFilters
102
- } from "./chunk-Z6N5N4MN.js";
109
+ } from "./chunk-SIW2HT2H.js";
103
110
  import {
104
111
  maskNonCode
105
112
  } from "./chunk-VAX3UZOY.js";
@@ -107,10 +114,10 @@ import {
107
114
  guidSeedHint,
108
115
  refSpelling,
109
116
  resolveRef
110
- } from "./chunk-LL6ED5IB.js";
117
+ } from "./chunk-FTS42N37.js";
111
118
  import {
112
119
  isListColumn
113
- } from "./chunk-JIKGT7DO.js";
120
+ } from "./chunk-GE3JV5SI.js";
114
121
  import {
115
122
  argsOrEmpty,
116
123
  assertArg,
@@ -122,7 +129,7 @@ import {
122
129
  describeEntry,
123
130
  isRecordArg,
124
131
  isTaggedArg
125
- } from "./chunk-4MIV244X.js";
132
+ } from "./chunk-SGEOXJIH.js";
126
133
  import {
127
134
  withArticle
128
135
  } from "./chunk-36JUQZVQ.js";
@@ -482,16 +489,8 @@ function coerceCell(table, col, cell) {
482
489
  }
483
490
 
484
491
  // src/statements/special/db-search.ts
485
- var CONSTANT_WHERE_TAGS = /* @__PURE__ */ new Set([
486
- "const:bool",
487
- "const:int",
488
- "const:decimal",
489
- "const:null",
490
- "const:epochms"
491
- ]);
492
492
  function encodeSearch(where, additionalWhere, owner = "db search") {
493
493
  const nodes = [];
494
- let raw;
495
494
  for (const [field, w] of [["where", where], ["additionalWhere", additionalWhere]]) {
496
495
  if (!w) continue;
497
496
  if (Array.isArray(w)) {
@@ -505,29 +504,20 @@ function encodeSearch(where, additionalWhere, owner = "db search") {
505
504
  nodes.push(...w);
506
505
  } else if (isGroup(w) || isMixed(w) || isCmpNode(w)) nodes.push(w);
507
506
  else if (isValue(w)) {
508
- if (CONSTANT_WHERE_TAGS.has(w.tag)) {
509
- throw new Error(
510
- `${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.`
511
- );
512
- }
513
- 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
+ );
514
510
  } else {
515
511
  throw new Error(
516
- `${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)}.`}`
517
513
  );
518
514
  }
519
515
  }
520
- if (raw !== void 0 && nodes.length) {
521
- throw new Error(
522
- `${owner}: a raw Value \`where\` cannot be combined with expr()/cmp()/and()/or() clauses \u2014 use one form or the other.`
523
- );
524
- }
525
516
  if (nodes.length) {
526
517
  const encoded = encodeExpression(nodes);
527
518
  assertNoBareRightColumn(encoded);
528
519
  return encoded;
529
520
  }
530
- if (raw !== void 0) return raw;
531
521
  return void 0;
532
522
  }
533
523
  var SORT_DIRS = ["asc", "desc", "rand"];
@@ -612,10 +602,18 @@ function encodeEval(evals) {
612
602
  }))
613
603
  }));
614
604
  }
615
- 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) {
616
613
  if (!evals?.length) return evals;
617
614
  return evals.map((e) => {
618
- 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;
619
617
  if (!/^[^.]+\.[^.].*$/.test(name)) {
620
618
  throw new Error(
621
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.`
@@ -974,7 +972,7 @@ function expandRow(table, row, op, statement) {
974
972
  return cols.map((col) => {
975
973
  const cell = Object.hasOwn(row, col.name) ? row[col.name] : void 0;
976
974
  const supplied = cell !== void 0;
977
- 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;
978
976
  if (supplied) assertCellShape(statement, col.name, cell);
979
977
  if (supplied && isNestedCell(cell)) {
980
978
  return { name: col.name, value: c.text(""), ignore, children: nestedFields(cell, statement, col.name) };
@@ -1472,11 +1470,23 @@ function assertNoEvalShadow(table, evals) {
1472
1470
  }
1473
1471
  }
1474
1472
  }
1475
- 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) {
1476
1486
  const block = {
1477
1487
  sort: encodeSort(agg?.sort, "s.db.query", "aggregate.sort"),
1478
- eval: encodeEval(qualifyAggregateEvals(agg?.eval, primaryAlias, "eval")) ?? [],
1479
- 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)) ?? []
1480
1490
  };
1481
1491
  if (agg?.paging) {
1482
1492
  block.paging = {
@@ -1507,9 +1517,9 @@ function normalizeReturnType(raw) {
1507
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.`
1508
1518
  );
1509
1519
  }
1510
- function encodeReturn(returnType, sort, paging, forceEnabled = false, distinct = "auto", aggregate, primaryAlias = "") {
1520
+ function encodeReturn(returnType, sort, paging, forceEnabled = false, distinct = "auto", aggregate, primaryAlias = "", scope) {
1511
1521
  const sortEls = encodeSort(sort);
1512
- if (returnType === "aggregate") return encodeAggregate(aggregate, primaryAlias);
1522
+ if (returnType === "aggregate") return encodeAggregate(aggregate, primaryAlias, scope);
1513
1523
  if (returnType === "count" || returnType === "exists") return { type: returnType };
1514
1524
  if (returnType === "single") return { type: "single", single: { sort: sortEls } };
1515
1525
  const enabled = pagingEnabled(paging, forceEnabled);
@@ -1563,6 +1573,18 @@ var DB_QUERY_KEYS = Object.keys({
1563
1573
  var DB_BIND_KEYS = Object.keys(
1564
1574
  { table: 1, expand: 1, as: 1, join: 1, where: 1 }
1565
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
+ }
1566
1588
  function dbQuery(args) {
1567
1589
  args = argsOrEmpty(args);
1568
1590
  if (args.return !== void 0) {
@@ -1581,12 +1603,20 @@ function dbQuery(args) {
1581
1603
  const returnType = normalizeReturnType(args.returnType);
1582
1604
  const tableName = args.table === null ? "" : typeof args.table === "string" ? args.table : args.table.name;
1583
1605
  const primaryAlias = args.tableAlias ?? tableName;
1584
- const aggregateAddsQualifier = returnType === "aggregate" && tableName !== "" && [...args.aggregate?.group ?? [], ...args.aggregate?.eval ?? []].some(
1585
- (e) => !e.name.includes(".")
1606
+ const bindAliasNames = (args.bind ?? []).map(
1607
+ (b) => b.as ?? (typeof b.table === "string" ? b.table : b.table?.name ?? "")
1586
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));
1587
1617
  const evalAddsQualifier = tableName !== "" && (args.eval ?? []).some((e) => !e.name.includes("."));
1588
1618
  const joinedRowQuery = (returnType === "list" || returnType === "stream") && tableName !== "" && (args.bind?.length ?? 0) > 0;
1589
- const evalAliases = new Set((args.eval ?? []).map((e) => e.as));
1619
+ const evalAliases = queryEvalAliases;
1590
1620
  const qualifiesSort = (entry2) => entry2.qualify !== false && typeof entry2.sortBy === "string" && entry2.sortBy !== "" && !entry2.sortBy.includes(".") && !evalAliases.has(entry2.sortBy);
1591
1621
  const sortAddsQualifier = joinedRowQuery && (args.sort ?? []).some(qualifiesSort);
1592
1622
  const emittedAlias = args.tableAlias ?? (aggregateAddsQualifier || evalAddsQualifier || sortAddsQualifier ? tableName : void 0);
@@ -1622,14 +1652,15 @@ function dbQuery(args) {
1622
1652
  const encodedEvals = encodeEval(evals);
1623
1653
  if (encodedEvals) context.eval = encodedEvals;
1624
1654
  const lock = optionalFlag("s.db.query", "lock", args.lock);
1655
+ if (args.lock === true) assertLockable(returnType, args.paging);
1625
1656
  if (lock !== void 0) context.lock = lock;
1626
1657
  const simpleExternal = encodeSimpleExternal(args.paging);
1627
1658
  if (args.external !== void 0 && args.external !== null) {
1628
- 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);
1629
1660
  context.external = encodeExternal(args.external);
1630
1661
  if (simpleExternal) context.simpleExternal = simpleExternal;
1631
1662
  } else {
1632
- 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);
1633
1664
  if (simpleExternal) context.simpleExternal = simpleExternal;
1634
1665
  }
1635
1666
  const usesPagingEnvelope = returnType === "list" && pagingEnabled(args.paging, args.external !== void 0 && args.external !== null) && (args.paging?.metadata ?? true);
@@ -1767,9 +1798,9 @@ function nestedValueFields(v) {
1767
1798
  function pickDefined(o) {
1768
1799
  return Object.fromEntries(Object.entries(o).filter(([, v]) => v !== void 0));
1769
1800
  }
1770
- function setPath(obj, path, value) {
1801
+ function setPath(obj2, path, value) {
1771
1802
  const parts = path.split(".");
1772
- let cur = obj;
1803
+ let cur = obj2;
1773
1804
  for (let i = 0; i < parts.length - 1; i++) {
1774
1805
  const key = parts[i];
1775
1806
  if (typeof cur[key] !== "object" || cur[key] === null) cur[key] = {};
@@ -1799,6 +1830,13 @@ function specLabel(spec) {
1799
1830
  return spec.factory ?? readableStatementName(spec.name);
1800
1831
  }
1801
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
+ }
1802
1840
  function encodeFromSpec(spec, authored) {
1803
1841
  authored ??= {};
1804
1842
  const label = specLabel(spec);
@@ -1838,6 +1876,7 @@ function encodeFromSpec(spec, authored) {
1838
1876
  break;
1839
1877
  case "context-plain":
1840
1878
  assertIgnorable(label, rule.field, provided);
1879
+ if (rule.type === "number") assertWholeNumber(label, rule, provided);
1841
1880
  setPath(context, rule.route.path, provided);
1842
1881
  break;
1843
1882
  case "context-spread":
@@ -1899,6 +1938,7 @@ function encodeFromSpec(spec, authored) {
1899
1938
  });
1900
1939
  if (env?.settingsRegistry) stmt.settings_registry = [];
1901
1940
  if (spec.output) {
1941
+ if (authoredOut && hasOutputContent(authoredOut)) assertBindsAs(stmt, "output");
1902
1942
  const base = env?.richOutput ? { customize: false, filters: [], items: [] } : { filters: [] };
1903
1943
  const fromAnnotate = stmt.output ?? {};
1904
1944
  stmt.output = { ...base, ...fromAnnotate, ...authoredOut ? pickDefined(authoredOut) : {} };
@@ -1906,6 +1946,9 @@ function encodeFromSpec(spec, authored) {
1906
1946
  if (env?.addon) stmt.addon = [];
1907
1947
  return stmt;
1908
1948
  }
1949
+ function hasOutputContent(out) {
1950
+ return out.customize === true || (out.items?.length ?? 0) > 0 || (out.filters?.length ?? 0) > 0;
1951
+ }
1909
1952
  function registerSpec(spec) {
1910
1953
  const factory = (authored) => encodeFromSpec(spec, authored);
1911
1954
  registerStatement(spec.name, factory, spec.factory);
@@ -1924,32 +1967,32 @@ var GENERATED_SPECS = [
1924
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" } }] },
1925
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" } }] },
1926
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" } }] },
1927
- { "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 } },
1928
- { "name": "mvp:array_difference", "factory": "s.array.difference", "rules": [{ "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "expr", "type": "value", "optional": true, "default": "null", "route": { "kind": "context-nest", "path": "left" } }, { "field": "value", "type": "value", "optional": true, "default": "[]", "route": { "kind": "context-nest", "path": "right" } }, { "field": "by", "type": "value", "optional": true, "default": "null", "route": { "kind": "context-nest", "path": "transform_value" } }] },
1929
- { "name": "mvp:array_every", "factory": "s.array.every", "output": true, "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "null", "route": { "kind": "context-nest", "path": "array" } }, { "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "if", "type": "comparison", "optional": true, "default": "null", "route": { "kind": "context-compare", "path": "expr" } }] },
1930
- { "name": "mvp:array_filter", "factory": "s.array.filter", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "null", "route": { "kind": "context-nest", "path": "array" } }, { "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "if", "type": "comparison", "optional": true, "default": "null", "route": { "kind": "context-compare", "path": "expr" } }] },
1931
- { "name": "mvp:array_filter_count", "factory": "s.array.filter_count", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "null", "route": { "kind": "context-nest", "path": "array" } }, { "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "if", "type": "comparison", "optional": true, "default": "null", "route": { "kind": "context-compare", "path": "expr" } }] },
1932
- { "name": "mvp:array_find", "factory": "s.array.find", "output": true, "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "null", "route": { "kind": "context-nest", "path": "array" } }, { "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "if", "type": "comparison", "optional": true, "default": "null", "route": { "kind": "context-compare", "path": "expr" } }] },
1933
- { "name": "mvp:array_find_index", "factory": "s.array.find_index", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "null", "route": { "kind": "context-nest", "path": "array" } }, { "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "if", "type": "comparison", "optional": true, "default": "null", "route": { "kind": "context-compare", "path": "expr" } }] },
1934
- { "name": "mvp:array_group_by", "factory": "s.array.group_by", "rules": [{ "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "expr", "type": "value", "optional": true, "default": "null", "route": { "kind": "context-nest", "path": "collection" } }, { "field": "by", "type": "value", "optional": true, "default": "null", "route": { "kind": "context-nest", "path": "transform_value" } }] },
1935
- { "name": "mvp:array_has", "factory": "s.array.has", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "null", "route": { "kind": "context-nest", "path": "array" } }, { "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "if", "type": "comparison", "optional": true, "default": "null", "route": { "kind": "context-compare", "path": "expr" } }] },
1936
- { "name": "mvp:array_intersection", "factory": "s.array.intersection", "rules": [{ "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "expr", "type": "value", "optional": true, "default": "null", "route": { "kind": "context-nest", "path": "left" } }, { "field": "value", "type": "value", "optional": true, "default": "[]", "route": { "kind": "context-nest", "path": "right" } }, { "field": "by", "type": "value", "optional": true, "route": { "kind": "context-nest", "path": "transform_value" } }] },
1937
- { "name": "mvp:array_merge", "factory": "s.array.merge", "argNameIsVar": true, "output": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": true, "route": { "kind": "context-spread" } }] },
1938
- { "name": "mvp:array_partition", "factory": "s.array.partition", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "null", "route": { "kind": "context-nest", "path": "array" } }, { "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "if", "type": "comparison", "optional": true, "default": "null", "route": { "kind": "context-compare", "path": "expr" } }] },
1939
- { "name": "mvp:array_pop", "factory": "s.array.pop", "argNameIsVar": true, "output": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }] },
1940
- { "name": "mvp:array_push", "factory": "s.array.push", "argNameIsVar": true, "output": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
1941
- { "name": "mvp:array_shift", "factory": "s.array.shift", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }] },
1942
- { "name": "mvp:array_unshift", "factory": "s.array.unshift", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
1943
- { "name": "mvp:async_function_await", "factory": "s.await", "rules": [{ "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "ids", "type": "value", "optional": true, "default": "[]", "route": { "kind": "input", "name": "ids" } }, { "field": "timeout", "type": "value", "optional": true, "default": "10", "route": { "kind": "input", "name": "timeout" } }] },
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 } },
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" } }] },
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" } }] },
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" } }] },
1974
+ { "name": "mvp:array_filter_count", "factory": "s.array.filter_count", "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" } }] },
1975
+ { "name": "mvp:array_find", "factory": "s.array.find", "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" } }] },
1976
+ { "name": "mvp:array_find_index", "factory": "s.array.find_index", "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" } }] },
1977
+ { "name": "mvp:array_group_by", "factory": "s.array.group_by", "rules": [{ "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "expr", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "collection" } }, { "field": "by", "type": "value", "optional": true, "default": "null", "route": { "kind": "context-nest", "path": "transform_value" } }] },
1978
+ { "name": "mvp:array_has", "factory": "s.array.has", "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" } }] },
1979
+ { "name": "mvp:array_intersection", "factory": "s.array.intersection", "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, "route": { "kind": "context-nest", "path": "transform_value" } }] },
1980
+ { "name": "mvp:array_merge", "factory": "s.array.merge", "argNameIsVar": true, "output": true, "rules": [{ "field": "name", "type": "string", "optional": false, "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
1981
+ { "name": "mvp:array_partition", "factory": "s.array.partition", "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" } }] },
1982
+ { "name": "mvp:array_pop", "factory": "s.array.pop", "argNameIsVar": true, "output": true, "rules": [{ "field": "name", "type": "string", "optional": false, "route": { "kind": "context-plain", "path": "name" } }, { "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }] },
1983
+ { "name": "mvp:array_push", "factory": "s.array.push", "argNameIsVar": true, "output": true, "rules": [{ "field": "name", "type": "string", "optional": false, "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
1984
+ { "name": "mvp:array_shift", "factory": "s.array.shift", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": false, "route": { "kind": "context-plain", "path": "name" } }, { "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }] },
1985
+ { "name": "mvp:array_unshift", "factory": "s.array.unshift", "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" } }] },
1986
+ { "name": "mvp:async_function_await", "factory": "s.await", "rules": [{ "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "ids", "type": "value", "optional": true, "default": "[]", "route": { "kind": "input", "name": "ids" } }, { "field": "timeout", "type": "value", "optional": true, "default": "10", "route": { "kind": "input", "name": "timeout" } }, { "field": "terminate", "type": "value", "optional": true, "route": { "kind": "input", "name": "terminate" } }] },
1944
1987
  { "name": "mvp:azure_blob_storage_create_var_from_file_resource", "factory": "s.cloud.azure.storage.read_file", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "account_name", "type": "value", "optional": false, "route": { "kind": "input", "name": "account_name" } }, { "field": "account_key", "type": "value", "optional": false, "route": { "kind": "input", "name": "account_key" } }, { "field": "container_name", "type": "value", "optional": false, "route": { "kind": "input", "name": "container_name" } }, { "field": "filePath", "type": "value", "optional": false, "route": { "kind": "input", "name": "filePath" } }] },
1945
1988
  { "name": "mvp:azure_blob_storage_delete_file", "factory": "s.cloud.azure.storage.delete_file", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "account_name", "type": "value", "optional": false, "route": { "kind": "input", "name": "account_name" } }, { "field": "account_key", "type": "value", "optional": false, "route": { "kind": "input", "name": "account_key" } }, { "field": "container_name", "type": "value", "optional": false, "route": { "kind": "input", "name": "container_name" } }, { "field": "filePath", "type": "value", "optional": false, "route": { "kind": "input", "name": "filePath" } }] },
1946
1989
  { "name": "mvp:azure_blob_storage_get_file_metadata", "factory": "s.cloud.azure.storage.get_file_info", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "account_name", "type": "value", "optional": false, "route": { "kind": "input", "name": "account_name" } }, { "field": "account_key", "type": "value", "optional": false, "route": { "kind": "input", "name": "account_key" } }, { "field": "container_name", "type": "value", "optional": false, "route": { "kind": "input", "name": "container_name" } }, { "field": "filePath", "type": "value", "optional": false, "route": { "kind": "input", "name": "filePath" } }] },
1947
1990
  { "name": "mvp:azure_blob_storage_list_directory", "factory": "s.cloud.azure.storage.list_directory", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "account_name", "type": "value", "optional": false, "route": { "kind": "input", "name": "account_name" } }, { "field": "account_key", "type": "value", "optional": false, "route": { "kind": "input", "name": "account_key" } }, { "field": "container_name", "type": "value", "optional": false, "route": { "kind": "input", "name": "container_name" } }, { "field": "path", "type": "value", "optional": true, "route": { "kind": "input", "name": "path" } }] },
1948
1991
  { "name": "mvp:azure_blob_storage_signed_url", "factory": "s.cloud.azure.storage.sign_url", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "account_name", "type": "value", "optional": false, "route": { "kind": "input", "name": "account_name" } }, { "field": "account_key", "type": "value", "optional": false, "route": { "kind": "input", "name": "account_key" } }, { "field": "container_name", "type": "value", "optional": false, "route": { "kind": "input", "name": "container_name" } }, { "field": "path", "type": "value", "optional": false, "route": { "kind": "input", "name": "path" } }, { "field": "ttl", "type": "value", "optional": true, "route": { "kind": "input", "name": "ttl" } }] },
1949
1992
  { "name": "mvp:azure_blob_storage_upload_file", "factory": "s.cloud.azure.storage.upload_file", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "account_name", "type": "value", "optional": false, "route": { "kind": "input", "name": "account_name" } }, { "field": "account_key", "type": "value", "optional": false, "route": { "kind": "input", "name": "account_key" } }, { "field": "container_name", "type": "value", "optional": false, "route": { "kind": "input", "name": "container_name" } }, { "field": "filePath", "type": "value", "optional": false, "route": { "kind": "input", "name": "filePath" } }, { "field": "file", "type": "value", "optional": false, "route": { "kind": "input", "name": "file" } }, { "field": "metadata", "type": "value", "optional": true, "route": { "kind": "input", "name": "metadata" } }] },
1950
- { "name": "mvp:bitwise_and", "factory": "s.math.bitwise.and", "argNameIsVar": true, "output": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
1951
- { "name": "mvp:bitwise_or", "factory": "s.math.bitwise.or", "argNameIsVar": true, "output": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
1952
- { "name": "mvp:bitwise_xor", "factory": "s.math.bitwise.xor", "argNameIsVar": true, "output": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
1993
+ { "name": "mvp:bitwise_and", "factory": "s.math.bitwise.and", "argNameIsVar": true, "output": true, "rules": [{ "field": "name", "type": "string", "optional": false, "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
1994
+ { "name": "mvp:bitwise_or", "factory": "s.math.bitwise.or", "argNameIsVar": true, "output": true, "rules": [{ "field": "name", "type": "string", "optional": false, "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
1995
+ { "name": "mvp:bitwise_xor", "factory": "s.math.bitwise.xor", "argNameIsVar": true, "output": true, "rules": [{ "field": "name", "type": "string", "optional": false, "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
1953
1996
  { "name": "mvp:calculate_geo_distance", "factory": "s.util.geo_distance", "rules": [{ "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "latitude_1", "type": "value", "optional": false, "route": { "kind": "input", "name": "latitude_1" } }, { "field": "longitude_1", "type": "value", "optional": false, "route": { "kind": "input", "name": "longitude_1" } }, { "field": "latitude_2", "type": "value", "optional": false, "route": { "kind": "input", "name": "latitude_2" } }, { "field": "longitude_2", "type": "value", "optional": false, "route": { "kind": "input", "name": "longitude_2" } }] },
1954
1997
  { "name": "mvp:check_pass", "factory": "s.security.check_password", "output": true, "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "text_password", "type": "value", "optional": false, "route": { "kind": "input", "name": "text_password" } }, { "field": "hash_password", "type": "value", "optional": false, "route": { "kind": "input", "name": "hash_password" } }], "envelope": { "inputFull": true, "description": true, "settingsRegistry": true, "addon": true, "richOutput": true } },
1955
1998
  { "name": "mvp:connect_webflow_api_request", "factory": "s.webflow.request", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "path", "type": "value", "optional": false, "route": { "kind": "input", "name": "path" } }, { "field": "method", "type": "value", "optional": true, "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" } }] },
@@ -1993,11 +2036,11 @@ var GENERATED_SPECS = [
1993
2036
  { "name": "mvp:ipaddress_lookup", "factory": "s.util.ip_lookup", "rules": [{ "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "input", "name": "ip" } }] },
1994
2037
  { "name": "mvp:jsonl_stream", "factory": "s.stream.from_jsonl", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
1995
2038
  { "name": "mvp:lambda", "factory": "s.lambda", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "code", "type": "value", "optional": false, "route": { "kind": "input", "name": "code" } }, { "field": "timeout", "type": "value", "optional": true, "route": { "kind": "input", "name": "timeout" } }] },
1996
- { "name": "mvp:math_add", "factory": "s.math.add", "argNameIsVar": true, "output": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
1997
- { "name": "mvp:math_div", "factory": "s.math.div", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
1998
- { "name": "mvp:math_mod", "factory": "s.math.mod", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
1999
- { "name": "mvp:math_mul", "factory": "s.math.mul", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
2000
- { "name": "mvp:math_sub", "factory": "s.math.sub", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
2039
+ { "name": "mvp:math_add", "factory": "s.math.add", "argNameIsVar": true, "output": true, "rules": [{ "field": "name", "type": "string", "optional": false, "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
2040
+ { "name": "mvp:math_div", "factory": "s.math.div", "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" } }] },
2041
+ { "name": "mvp:math_mod", "factory": "s.math.mod", "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" } }] },
2042
+ { "name": "mvp:math_mul", "factory": "s.math.mul", "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" } }] },
2043
+ { "name": "mvp:math_sub", "factory": "s.math.sub", "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" } }] },
2001
2044
  { "name": "mvp:mcp_call_tool", "factory": "s.ai.external.mcp.tool.run", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "url", "type": "value", "optional": false, "route": { "kind": "input", "name": "url" } }, { "field": "bearer_token", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "bearer_token" } }, { "field": "connection_type", "type": "value", "optional": true, "default": "sse", "enum": ["sse", "stream"], "route": { "kind": "input", "name": "connection_type" } }, { "field": "tool", "type": "value", "optional": false, "route": { "kind": "input", "name": "tool_name" } }, { "field": "args", "type": "value", "optional": true, "route": { "kind": "input", "name": "args" } }] },
2002
2045
  { "name": "mvp:mcp_list_tools", "factory": "s.ai.external.mcp.tool.list", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "url", "type": "value", "optional": false, "route": { "kind": "input", "name": "url" } }, { "field": "bearer_token", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "bearer_token" } }, { "field": "connection_type", "type": "value", "optional": true, "default": "sse", "enum": ["sse", "stream"], "route": { "kind": "input", "name": "connection_type" } }] },
2003
2046
  { "name": "mvp:mcp_oauth_complete", "factory": "s.mcp.oauth.complete", "rules": [{ "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "request", "type": "value", "optional": false, "route": { "kind": "input", "name": "request" } }, { "field": "decision", "type": "value", "optional": false, "enum": ["approve", "deny"], "route": { "kind": "input", "name": "decision" } }, { "field": "unsafe_user_id", "type": "value", "optional": true, "route": { "kind": "input", "name": "unsafe_user_id" } }] },
@@ -2006,10 +2049,10 @@ var GENERATED_SPECS = [
2006
2049
  { "name": "mvp:mcp_progress", "factory": "s.mcp.progress", "rules": [{ "field": "progress", "type": "value", "optional": false, "route": { "kind": "input", "name": "progress" } }, { "field": "total", "type": "value", "optional": true, "route": { "kind": "input", "name": "total" } }, { "field": "message", "type": "value", "optional": true, "route": { "kind": "input", "name": "message" } }] },
2007
2050
  { "name": "mvp:mcp_server_details", "factory": "s.ai.external.mcp.server_details", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "url", "type": "value", "optional": false, "route": { "kind": "input", "name": "url" } }, { "field": "bearer_token", "type": "value", "optional": true, "default": "", "route": { "kind": "input", "name": "bearer_token" } }, { "field": "connection_type", "type": "value", "optional": true, "default": "sse", "enum": ["sse", "stream"], "route": { "kind": "input", "name": "connection_type" } }] },
2008
2051
  { "name": "mvp:microservice_request", "factory": "s.microservice.request", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "host", "type": "value", "optional": false, "route": { "kind": "input", "name": "host" } }, { "field": "path", "type": "value", "optional": false, "route": { "kind": "input", "name": "path" } }, { "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": false, "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" } }] },
2009
- { "name": "mvp:object_entries", "factory": "s.object.entries", "output": true, "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "value", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "object" } }] },
2010
- { "name": "mvp:object_keys", "factory": "s.object.keys", "output": true, "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "value", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "object" } }] },
2011
- { "name": "mvp:object_values", "factory": "s.object.values", "output": true, "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "value", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "object" } }] },
2012
- { "name": "mvp:precondition", "factory": "s.precondition", "rules": [{ "field": "expr", "type": "comparison", "optional": true, "default": "null", "route": { "kind": "context-compare", "path": "expr" } }, { "field": "error_type", "type": "string", "optional": true, "default": "standard", "route": { "kind": "context-plain", "path": "error_type" } }, { "field": "error", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "error" } }, { "field": "payload", "type": "value", "optional": true, "route": { "kind": "context-nest", "path": "payload" } }] },
2052
+ { "name": "mvp:object_entries", "factory": "s.object.entries", "output": true, "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "object" } }] },
2053
+ { "name": "mvp:object_keys", "factory": "s.object.keys", "output": true, "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "object" } }] },
2054
+ { "name": "mvp:object_values", "factory": "s.object.values", "output": true, "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "object" } }] },
2055
+ { "name": "mvp:precondition", "factory": "s.precondition", "rules": [{ "field": "expr", "type": "comparison", "optional": false, "route": { "kind": "context-compare", "path": "expr" } }, { "field": "error_type", "type": "string", "optional": true, "default": "standard", "route": { "kind": "context-plain", "path": "error_type" } }, { "field": "error", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "error" } }, { "field": "payload", "type": "value", "optional": true, "route": { "kind": "context-nest", "path": "payload" } }] },
2013
2056
  { "name": "mvp:rand", "factory": "s.security.random_number", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "min", "type": "value", "optional": true, "route": { "kind": "input", "name": "min" } }, { "field": "max", "type": "value", "optional": true, "route": { "kind": "input", "name": "max" } }] },
2014
2057
  { "name": "mvp:random_bytes", "factory": "s.security.random_bytes", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "length", "type": "value", "optional": true, "route": { "kind": "input", "name": "length" } }] },
2015
2058
  { "name": "mvp:redis_countlist", "factory": "s.redis.count", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }, { "field": "key", "type": "value", "optional": false, "route": { "kind": "input", "name": "key" } }] },
@@ -2034,36 +2077,36 @@ var GENERATED_SPECS = [
2034
2077
  { "name": "mvp:streaming_api_request", "factory": "s.stream.from_request", "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, "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" } }] },
2035
2078
  { "name": "mvp:streaming_api_response", "factory": "s.api.stream", "rules": [{ "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
2036
2079
  { "name": "mvp:template_string", "factory": "s.util.template_engine", "rules": [{ "field": "as", "type": "string", "optional": true, "default": "", "route": { "kind": "as" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "input", "name": "template" } }] },
2037
- { "name": "mvp:test_expect_to_be_defined", "factory": "s.expect.to_be_defined", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }] },
2038
- { "name": "mvp:test_expect_to_be_empty", "factory": "s.expect.to_be_empty", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }] },
2039
- { "name": "mvp:test_expect_to_be_false", "factory": "s.expect.to_be_false", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }] },
2040
- { "name": "mvp:test_expect_to_be_greater_than", "factory": "s.expect.to_be_greater_than", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }, { "field": "value", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value2" } }] },
2041
- { "name": "mvp:test_expect_to_be_in_the_future", "factory": "s.expect.to_be_in_the_future", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }] },
2042
- { "name": "mvp:test_expect_to_be_in_the_past", "factory": "s.expect.to_be_in_the_past", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }] },
2043
- { "name": "mvp:test_expect_to_be_less_than", "factory": "s.expect.to_be_less_than", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }, { "field": "value", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value2" } }] },
2044
- { "name": "mvp:test_expect_to_be_null", "factory": "s.expect.to_be_null", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }] },
2045
- { "name": "mvp:test_expect_to_be_true", "factory": "s.expect.to_be_true", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }] },
2046
- { "name": "mvp:test_expect_to_be_within", "factory": "s.expect.to_be_within", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }, { "field": "min", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value2" } }, { "field": "max", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value3" } }] },
2047
- { "name": "mvp:test_expect_to_contain", "factory": "s.expect.to_contain", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }, { "field": "value", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value2" } }] },
2048
- { "name": "mvp:test_expect_to_end_with", "factory": "s.expect.to_end_with", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }, { "field": "value", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value2" } }] },
2049
- { "name": "mvp:test_expect_to_equal", "factory": "s.expect.to_equal", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }, { "field": "value", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value2" } }] },
2050
- { "name": "mvp:test_expect_to_match", "factory": "s.expect.to_match", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }, { "field": "value", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value2" } }] },
2051
- { "name": "mvp:test_expect_to_not_be_defined", "factory": "s.expect.to_not_be_defined", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }] },
2052
- { "name": "mvp:test_expect_to_not_be_null", "factory": "s.expect.to_not_be_null", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }] },
2053
- { "name": "mvp:test_expect_to_not_equal", "factory": "s.expect.to_not_equal", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }, { "field": "value", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value2" } }] },
2054
- { "name": "mvp:test_expect_to_start_with", "factory": "s.expect.to_start_with", "rules": [{ "field": "expr", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value1" } }, { "field": "value", "type": "value", "optional": true, "default": "", "route": { "kind": "context-nest", "path": "value2" } }] },
2055
- { "name": "mvp:text_append", "factory": "s.text.append", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
2056
- { "name": "mvp:text_contains", "factory": "s.text.contains", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "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" } }] },
2057
- { "name": "mvp:text_ends_with", "factory": "s.text.ends_with", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "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" } }] },
2058
- { "name": "mvp:text_icontains", "factory": "s.text.icontains", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "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" } }] },
2059
- { "name": "mvp:text_iends_with", "factory": "s.text.iends_with", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "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" } }] },
2060
- { "name": "mvp:text_istarts_with", "factory": "s.text.istarts_with", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "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" } }] },
2061
- { "name": "mvp:text_ltrim", "factory": "s.text.ltrim", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
2062
- { "name": "mvp:text_prepend", "factory": "s.text.prepend", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
2063
- { "name": "mvp:text_rtrim", "factory": "s.text.rtrim", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
2064
- { "name": "mvp:text_starts_with", "factory": "s.text.starts_with", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "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" } }] },
2065
- { "name": "mvp:text_trim", "factory": "s.text.trim", "argNameIsVar": true, "rules": [{ "field": "name", "type": "string", "optional": true, "default": "", "route": { "kind": "context-plain", "path": "name" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-spread" } }] },
2066
- { "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" } }] },
2080
+ { "name": "mvp:test_expect_to_be_defined", "factory": "s.expect.to_be_defined", "rules": [{ "field": "expr", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "value1" } }] },
2081
+ { "name": "mvp:test_expect_to_be_empty", "factory": "s.expect.to_be_empty", "rules": [{ "field": "expr", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "value1" } }] },
2082
+ { "name": "mvp:test_expect_to_be_false", "factory": "s.expect.to_be_false", "rules": [{ "field": "expr", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "value1" } }] },
2083
+ { "name": "mvp:test_expect_to_be_greater_than", "factory": "s.expect.to_be_greater_than", "rules": [{ "field": "expr", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "value1" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "value2" } }] },
2084
+ { "name": "mvp:test_expect_to_be_in_the_future", "factory": "s.expect.to_be_in_the_future", "rules": [{ "field": "expr", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "value1" } }] },
2085
+ { "name": "mvp:test_expect_to_be_in_the_past", "factory": "s.expect.to_be_in_the_past", "rules": [{ "field": "expr", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "value1" } }] },
2086
+ { "name": "mvp:test_expect_to_be_less_than", "factory": "s.expect.to_be_less_than", "rules": [{ "field": "expr", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "value1" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "value2" } }] },
2087
+ { "name": "mvp:test_expect_to_be_null", "factory": "s.expect.to_be_null", "rules": [{ "field": "expr", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "value1" } }] },
2088
+ { "name": "mvp:test_expect_to_be_true", "factory": "s.expect.to_be_true", "rules": [{ "field": "expr", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "value1" } }] },
2089
+ { "name": "mvp:test_expect_to_be_within", "factory": "s.expect.to_be_within", "rules": [{ "field": "expr", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "value1" } }, { "field": "min", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "value2" } }, { "field": "max", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "value3" } }] },
2090
+ { "name": "mvp:test_expect_to_contain", "factory": "s.expect.to_contain", "rules": [{ "field": "expr", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "value1" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "value2" } }] },
2091
+ { "name": "mvp:test_expect_to_end_with", "factory": "s.expect.to_end_with", "rules": [{ "field": "expr", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "value1" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "value2" } }] },
2092
+ { "name": "mvp:test_expect_to_equal", "factory": "s.expect.to_equal", "rules": [{ "field": "expr", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "value1" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "value2" } }] },
2093
+ { "name": "mvp:test_expect_to_match", "factory": "s.expect.to_match", "rules": [{ "field": "expr", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "value1" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "value2" } }] },
2094
+ { "name": "mvp:test_expect_to_not_be_defined", "factory": "s.expect.to_not_be_defined", "rules": [{ "field": "expr", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "value1" } }] },
2095
+ { "name": "mvp:test_expect_to_not_be_null", "factory": "s.expect.to_not_be_null", "rules": [{ "field": "expr", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "value1" } }] },
2096
+ { "name": "mvp:test_expect_to_not_equal", "factory": "s.expect.to_not_equal", "rules": [{ "field": "expr", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "value1" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "value2" } }] },
2097
+ { "name": "mvp:test_expect_to_start_with", "factory": "s.expect.to_start_with", "rules": [{ "field": "expr", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "value1" } }, { "field": "value", "type": "value", "optional": false, "route": { "kind": "context-nest", "path": "value2" } }] },
2098
+ { "name": "mvp:text_append", "factory": "s.text.append", "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" } }] },
2099
+ { "name": "mvp:text_contains", "factory": "s.text.contains", "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" } }] },
2100
+ { "name": "mvp:text_ends_with", "factory": "s.text.ends_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" } }] },
2101
+ { "name": "mvp:text_icontains", "factory": "s.text.icontains", "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" } }] },
2102
+ { "name": "mvp:text_iends_with", "factory": "s.text.iends_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" } }] },
2103
+ { "name": "mvp:text_istarts_with", "factory": "s.text.istarts_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" } }] },
2104
+ { "name": "mvp:text_ltrim", "factory": "s.text.ltrim", "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" } }] },
2105
+ { "name": "mvp:text_prepend", "factory": "s.text.prepend", "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" } }] },
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" } }] },
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" } }] },
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" } }] },
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" } }] },
2067
2110
  { "name": "mvp:uuid4", "factory": "s.security.create_uuid", "rules": [{ "field": "as", "type": "string", "optional": true, "route": { "kind": "as" } }] },
2068
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" } }] },
2069
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" } }] },
@@ -2110,51 +2153,51 @@ var generated = {
2110
2153
  array: {
2111
2154
  difference: (
2112
2155
  /** `mvp:array_difference` — fields: as, expr, value, by */
2113
- (a = {}) => fromSpec("mvp:array_difference", a)
2156
+ (a) => fromSpec("mvp:array_difference", a)
2114
2157
  ),
2115
2158
  every: (
2116
2159
  /** `mvp:array_every` — fields: expr, as, if */
2117
- (a = {}) => fromSpec("mvp:array_every", a)
2160
+ (a) => fromSpec("mvp:array_every", a)
2118
2161
  ),
2119
2162
  filter: (
2120
2163
  /** `mvp:array_filter` — fields: expr, as, if */
2121
- (a = {}) => fromSpec("mvp:array_filter", a)
2164
+ (a) => fromSpec("mvp:array_filter", a)
2122
2165
  ),
2123
2166
  filter_count: (
2124
2167
  /** `mvp:array_filter_count` — fields: expr, as, if */
2125
- (a = {}) => fromSpec("mvp:array_filter_count", a)
2168
+ (a) => fromSpec("mvp:array_filter_count", a)
2126
2169
  ),
2127
2170
  find: (
2128
2171
  /** `mvp:array_find` — fields: expr, as, if */
2129
- (a = {}) => fromSpec("mvp:array_find", a)
2172
+ (a) => fromSpec("mvp:array_find", a)
2130
2173
  ),
2131
2174
  find_index: (
2132
2175
  /** `mvp:array_find_index` — fields: expr, as, if */
2133
- (a = {}) => fromSpec("mvp:array_find_index", a)
2176
+ (a) => fromSpec("mvp:array_find_index", a)
2134
2177
  ),
2135
2178
  group_by: (
2136
2179
  /** `mvp:array_group_by` — fields: as, expr, by */
2137
- (a = {}) => fromSpec("mvp:array_group_by", a)
2180
+ (a) => fromSpec("mvp:array_group_by", a)
2138
2181
  ),
2139
2182
  has: (
2140
2183
  /** `mvp:array_has` — fields: expr, as, if */
2141
- (a = {}) => fromSpec("mvp:array_has", a)
2184
+ (a) => fromSpec("mvp:array_has", a)
2142
2185
  ),
2143
2186
  intersection: (
2144
2187
  /** `mvp:array_intersection` — fields: as, expr, value, by */
2145
- (a = {}) => fromSpec("mvp:array_intersection", a)
2188
+ (a) => fromSpec("mvp:array_intersection", a)
2146
2189
  ),
2147
2190
  merge: (
2148
2191
  /** `mvp:array_merge` — fields: name, value */
2149
- (a = {}) => fromSpec("mvp:array_merge", a)
2192
+ (a) => fromSpec("mvp:array_merge", a)
2150
2193
  ),
2151
2194
  partition: (
2152
2195
  /** `mvp:array_partition` — fields: expr, as, if */
2153
- (a = {}) => fromSpec("mvp:array_partition", a)
2196
+ (a) => fromSpec("mvp:array_partition", a)
2154
2197
  ),
2155
2198
  pop: (
2156
2199
  /** `mvp:array_pop` — fields: name, as */
2157
- (a = {}) => fromSpec("mvp:array_pop", a)
2200
+ (a) => fromSpec("mvp:array_pop", a)
2158
2201
  ),
2159
2202
  push: (
2160
2203
  /** `mvp:array_push` — fields: name, value */
@@ -2162,7 +2205,7 @@ var generated = {
2162
2205
  ),
2163
2206
  shift: (
2164
2207
  /** `mvp:array_shift` — fields: name, as */
2165
- (a = {}) => fromSpec("mvp:array_shift", a)
2208
+ (a) => fromSpec("mvp:array_shift", a)
2166
2209
  ),
2167
2210
  unshift: (
2168
2211
  /** `mvp:array_unshift` — fields: name, value */
@@ -2170,7 +2213,7 @@ var generated = {
2170
2213
  )
2171
2214
  },
2172
2215
  await: (
2173
- /** `mvp:async_function_await` — fields: as, ids, timeout */
2216
+ /** `mvp:async_function_await` — fields: as, ids, timeout, terminate */
2174
2217
  (a = {}) => fromSpec("mvp:async_function_await", a)
2175
2218
  ),
2176
2219
  cloud: {
@@ -2330,75 +2373,75 @@ var generated = {
2330
2373
  expect: {
2331
2374
  to_be_defined: (
2332
2375
  /** `mvp:test_expect_to_be_defined` — fields: expr */
2333
- (a = {}) => fromSpec("mvp:test_expect_to_be_defined", a)
2376
+ (a) => fromSpec("mvp:test_expect_to_be_defined", a)
2334
2377
  ),
2335
2378
  to_be_empty: (
2336
2379
  /** `mvp:test_expect_to_be_empty` — fields: expr */
2337
- (a = {}) => fromSpec("mvp:test_expect_to_be_empty", a)
2380
+ (a) => fromSpec("mvp:test_expect_to_be_empty", a)
2338
2381
  ),
2339
2382
  to_be_false: (
2340
2383
  /** `mvp:test_expect_to_be_false` — fields: expr */
2341
- (a = {}) => fromSpec("mvp:test_expect_to_be_false", a)
2384
+ (a) => fromSpec("mvp:test_expect_to_be_false", a)
2342
2385
  ),
2343
2386
  to_be_greater_than: (
2344
2387
  /** `mvp:test_expect_to_be_greater_than` — fields: expr, value */
2345
- (a = {}) => fromSpec("mvp:test_expect_to_be_greater_than", a)
2388
+ (a) => fromSpec("mvp:test_expect_to_be_greater_than", a)
2346
2389
  ),
2347
2390
  to_be_in_the_future: (
2348
2391
  /** `mvp:test_expect_to_be_in_the_future` — fields: expr */
2349
- (a = {}) => fromSpec("mvp:test_expect_to_be_in_the_future", a)
2392
+ (a) => fromSpec("mvp:test_expect_to_be_in_the_future", a)
2350
2393
  ),
2351
2394
  to_be_in_the_past: (
2352
2395
  /** `mvp:test_expect_to_be_in_the_past` — fields: expr */
2353
- (a = {}) => fromSpec("mvp:test_expect_to_be_in_the_past", a)
2396
+ (a) => fromSpec("mvp:test_expect_to_be_in_the_past", a)
2354
2397
  ),
2355
2398
  to_be_less_than: (
2356
2399
  /** `mvp:test_expect_to_be_less_than` — fields: expr, value */
2357
- (a = {}) => fromSpec("mvp:test_expect_to_be_less_than", a)
2400
+ (a) => fromSpec("mvp:test_expect_to_be_less_than", a)
2358
2401
  ),
2359
2402
  to_be_null: (
2360
2403
  /** `mvp:test_expect_to_be_null` — fields: expr */
2361
- (a = {}) => fromSpec("mvp:test_expect_to_be_null", a)
2404
+ (a) => fromSpec("mvp:test_expect_to_be_null", a)
2362
2405
  ),
2363
2406
  to_be_true: (
2364
2407
  /** `mvp:test_expect_to_be_true` — fields: expr */
2365
- (a = {}) => fromSpec("mvp:test_expect_to_be_true", a)
2408
+ (a) => fromSpec("mvp:test_expect_to_be_true", a)
2366
2409
  ),
2367
2410
  to_be_within: (
2368
2411
  /** `mvp:test_expect_to_be_within` — fields: expr, min, max */
2369
- (a = {}) => fromSpec("mvp:test_expect_to_be_within", a)
2412
+ (a) => fromSpec("mvp:test_expect_to_be_within", a)
2370
2413
  ),
2371
2414
  to_contain: (
2372
2415
  /** `mvp:test_expect_to_contain` — fields: expr, value */
2373
- (a = {}) => fromSpec("mvp:test_expect_to_contain", a)
2416
+ (a) => fromSpec("mvp:test_expect_to_contain", a)
2374
2417
  ),
2375
2418
  to_end_with: (
2376
2419
  /** `mvp:test_expect_to_end_with` — fields: expr, value */
2377
- (a = {}) => fromSpec("mvp:test_expect_to_end_with", a)
2420
+ (a) => fromSpec("mvp:test_expect_to_end_with", a)
2378
2421
  ),
2379
2422
  to_equal: (
2380
2423
  /** `mvp:test_expect_to_equal` — fields: expr, value */
2381
- (a = {}) => fromSpec("mvp:test_expect_to_equal", a)
2424
+ (a) => fromSpec("mvp:test_expect_to_equal", a)
2382
2425
  ),
2383
2426
  to_match: (
2384
2427
  /** `mvp:test_expect_to_match` — fields: expr, value */
2385
- (a = {}) => fromSpec("mvp:test_expect_to_match", a)
2428
+ (a) => fromSpec("mvp:test_expect_to_match", a)
2386
2429
  ),
2387
2430
  to_not_be_defined: (
2388
2431
  /** `mvp:test_expect_to_not_be_defined` — fields: expr */
2389
- (a = {}) => fromSpec("mvp:test_expect_to_not_be_defined", a)
2432
+ (a) => fromSpec("mvp:test_expect_to_not_be_defined", a)
2390
2433
  ),
2391
2434
  to_not_be_null: (
2392
2435
  /** `mvp:test_expect_to_not_be_null` — fields: expr */
2393
- (a = {}) => fromSpec("mvp:test_expect_to_not_be_null", a)
2436
+ (a) => fromSpec("mvp:test_expect_to_not_be_null", a)
2394
2437
  ),
2395
2438
  to_not_equal: (
2396
2439
  /** `mvp:test_expect_to_not_equal` — fields: expr, value */
2397
- (a = {}) => fromSpec("mvp:test_expect_to_not_equal", a)
2440
+ (a) => fromSpec("mvp:test_expect_to_not_equal", a)
2398
2441
  ),
2399
2442
  to_start_with: (
2400
2443
  /** `mvp:test_expect_to_start_with` — fields: expr, value */
2401
- (a = {}) => fromSpec("mvp:test_expect_to_start_with", a)
2444
+ (a) => fromSpec("mvp:test_expect_to_start_with", a)
2402
2445
  )
2403
2446
  },
2404
2447
  lambda: (
@@ -2470,20 +2513,20 @@ var generated = {
2470
2513
  object: {
2471
2514
  entries: (
2472
2515
  /** `mvp:object_entries` — fields: as, value */
2473
- (a = {}) => fromSpec("mvp:object_entries", a)
2516
+ (a) => fromSpec("mvp:object_entries", a)
2474
2517
  ),
2475
2518
  keys: (
2476
2519
  /** `mvp:object_keys` — fields: as, value */
2477
- (a = {}) => fromSpec("mvp:object_keys", a)
2520
+ (a) => fromSpec("mvp:object_keys", a)
2478
2521
  ),
2479
2522
  values: (
2480
2523
  /** `mvp:object_values` — fields: as, value */
2481
- (a = {}) => fromSpec("mvp:object_values", a)
2524
+ (a) => fromSpec("mvp:object_values", a)
2482
2525
  )
2483
2526
  },
2484
2527
  precondition: (
2485
2528
  /** `mvp:precondition` — fields: expr, error_type, error, payload */
2486
- (a = {}) => fromSpec("mvp:precondition", a)
2529
+ (a) => fromSpec("mvp:precondition", a)
2487
2530
  ),
2488
2531
  realtime: {
2489
2532
  get_session: (
@@ -2706,7 +2749,7 @@ var generated = {
2706
2749
  )
2707
2750
  },
2708
2751
  throw: (
2709
- /** `mvp:throw_error` — fields: name, value */
2752
+ /** `mvp:throw_error` — fields: name, value, status */
2710
2753
  (a) => fromSpec("mvp:throw_error", a)
2711
2754
  ),
2712
2755
  util: {
@@ -2867,9 +2910,11 @@ var cond = {
2867
2910
  between: (value, lo, hi) => and(expr(value, ">=", lo), expr(value, "<=", hi)),
2868
2911
  /**
2869
2912
  * The object at `value` has something at `path` — the engine's `has` filter,
2870
- * 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.
2871
2916
  */
2872
- 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),
2873
2918
  /**
2874
2919
  * `value` (an array or object) has exactly `n` entries.
2875
2920
  *
@@ -3049,7 +3094,7 @@ var guard = {
3049
3094
  var DECODE_ONLY_STATEMENTS = /* @__PURE__ */ new Map([
3050
3095
  [
3051
3096
  "mvp:placeholder",
3052
- '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'
3053
3098
  ]
3054
3099
  ]);
3055
3100
 
@@ -3060,6 +3105,134 @@ var READ_UNCONDITIONALLY = {
3060
3105
  "mvp:zip_extract_file_resource": ["password"],
3061
3106
  "mvp:zip_view_contents": ["password"]
3062
3107
  };
3108
+ var CLASS_REQUIRED = {
3109
+ "mvp:lambda": ["code"],
3110
+ "mvp:api_request": ["url"],
3111
+ "mvp:streaming_api_request": ["url"],
3112
+ "mvp:connect_webflow_api_request": ["path"],
3113
+ // Keyed on the STORED name: this statement authors `tool` and stores
3114
+ // `tool_name`, and matching the authoring name is the mistake `findInput`
3115
+ // exists to make impossible.
3116
+ "mvp:mcp_call_tool": ["url", "tool_name"],
3117
+ "mvp:mcp_list_tools": ["url"],
3118
+ "mvp:mcp_server_details": ["url"],
3119
+ "mvp:crypto_encrypt": ["data", "key", "iv"],
3120
+ "mvp:crypto_decrypt": ["data", "key", "iv"],
3121
+ "mvp:crypto_jwe_encode3": ["key"],
3122
+ "mvp:crypto_jws_encode2": ["key"],
3123
+ "mvp:crypto_jwe_decode2": ["token", "key"],
3124
+ "mvp:crypto_jws_decode2": ["token", "key"],
3125
+ "mvp:datadog_log": ["message"],
3126
+ "mvp:datadog_metric": ["metric"],
3127
+ "mvp:check_pass": ["text_password", "hash_password"],
3128
+ "mvp:calculate_geo_distance": ["latitude_1", "longitude_1", "latitude_2", "longitude_2"],
3129
+ // The search family. See "The search family" above for what these rest on and
3130
+ // why eight sibling fields are deliberately NOT here.
3131
+ "mvp:amazon_opensearch_request": ["key_id", "access_key", "region", "url", "query"],
3132
+ "mvp:elasticsearch_request": ["key_id", "access_key", "url", "payload"],
3133
+ "mvp:amazon_opensearch_query": ["key_id", "access_key", "region", "base_url", "index", "payload"],
3134
+ "mvp:elasticsearch_query": ["key_id", "access_key", "base_url", "index", "payload"],
3135
+ "mvp:amazon_opensearch_document": ["key_id", "access_key", "region", "index", "doc_id", "doc"],
3136
+ // ## Context-routed, 2026-10-17
3137
+ //
3138
+ // The first CONTEXT corrections: `spec-drift` compared context routes for
3139
+ // the first time that day. Each one meets the same bar as the input ones above:
3140
+ // 1. Class: declared bare, and read without a fallback.
3141
+ // 2. Engine history: introduced bare and never loosened (`name` since 2020,
3142
+ // `precondition.expr` since 2020, the array/object fields since their
3143
+ // classes existed; a 2026 refactor into shared base classes moved them
3144
+ // verbatim).
3145
+ // 3. Stored bytes: a 187-workspace sweep found NO real instance omitting any
3146
+ // of them. Every omission came from editor placeholders: one dev workspace
3147
+ // storing these statements with `context: {}`, and two all-empty stubs.
3148
+ // And measured live (`scripts/probe-absent-context-field.ts`): absent `name`
3149
+ // is `500 Missing var entry`, absent `array`/`left`/`right`/`collection` is
3150
+ // `500 Unable to locate input`, absent condition is `500 Missing conditional
3151
+ // statements`, and absent `object` returns `[]` at HTTP 200, a silent wrong
3152
+ // answer.
3153
+ //
3154
+ // The update-var family: the variable to update.
3155
+ ...Object.fromEntries(
3156
+ [
3157
+ "math_add",
3158
+ "math_sub",
3159
+ "math_mul",
3160
+ "math_div",
3161
+ "math_mod",
3162
+ "text_append",
3163
+ "text_prepend",
3164
+ "text_trim",
3165
+ "text_ltrim",
3166
+ "text_rtrim",
3167
+ "text_contains",
3168
+ "text_icontains",
3169
+ "text_starts_with",
3170
+ "text_istarts_with",
3171
+ "text_ends_with",
3172
+ "text_iends_with",
3173
+ "array_push",
3174
+ "array_pop",
3175
+ "array_shift",
3176
+ "array_unshift",
3177
+ "array_merge",
3178
+ "bitwise_and",
3179
+ "bitwise_or",
3180
+ "bitwise_xor"
3181
+ ].map((n) => [`mvp:${n}`, ["name"]])
3182
+ ),
3183
+ // The array predicates: the list (authored `expr`) and the condition (authored `if`).
3184
+ ...Object.fromEntries(
3185
+ ["array_find", "array_filter", "array_every", "array_has", "array_partition", "array_find_index", "array_filter_count"].map(
3186
+ (n) => [`mvp:${n}`, ["array", "expr"]]
3187
+ )
3188
+ ),
3189
+ // `value` too: every sibling update-var spec already requires it, and this one
3190
+ // alone did not. Absent is `500 Variable is not an array.` (live).
3191
+ "mvp:array_merge": ["name", "value"],
3192
+ "mvp:array_difference": ["left", "right"],
3193
+ "mvp:array_intersection": ["left", "right"],
3194
+ "mvp:array_group_by": ["collection"],
3195
+ "mvp:object_keys": ["object"],
3196
+ "mvp:object_values": ["object"],
3197
+ "mvp:object_entries": ["object"],
3198
+ "mvp:precondition": ["expr"],
3199
+ // ## The `test_expect_*` operands, 2026-10-17
3200
+ //
3201
+ // The class builds its schema in a loop (`value1` … `valueN`), which
3202
+ // `spec-drift` could not read until that day. The corpus is DARK on the family
3203
+ // (no stored instance in 187 workspaces), so this rests on the class and the
3204
+ // runtime. Live (`scripts/probe-absent-expect-operand.ts`): an absent operand
3205
+ // is SUBSTITUTED with `0`, the declared `tag?=const:int` default, and the
3206
+ // assertion runs against it. 4 of 6 deliberately FAILING assertions then
3207
+ // PASSED (`to_be_null`, `to_equal` either side, `to_be_greater_than`). An
3208
+ // assertion that passes on an operand nobody wrote is the worst answer a
3209
+ // test can give.
3210
+ ...Object.fromEntries(
3211
+ [
3212
+ ["to_be_defined", 1],
3213
+ ["to_be_empty", 1],
3214
+ ["to_be_false", 1],
3215
+ ["to_be_true", 1],
3216
+ ["to_be_null", 1],
3217
+ ["to_not_be_null", 1],
3218
+ ["to_not_be_defined", 1],
3219
+ ["to_be_in_the_future", 1],
3220
+ ["to_be_in_the_past", 1],
3221
+ ["to_equal", 2],
3222
+ ["to_not_equal", 2],
3223
+ ["to_be_greater_than", 2],
3224
+ ["to_be_less_than", 2],
3225
+ ["to_contain", 2],
3226
+ ["to_start_with", 2],
3227
+ ["to_end_with", 2],
3228
+ ["to_match", 2],
3229
+ ["to_be_within", 3]
3230
+ ].map(([n, count]) => [
3231
+ `mvp:test_expect_${n}`,
3232
+ Array.from({ length: count }, (_, i) => `value${i + 1}`)
3233
+ ])
3234
+ )
3235
+ };
3063
3236
  var ADJUDICATED_ORDER = {
3064
3237
  "mvp:send_email": "the class declares `service_provider` before `api_key`; upstream's transform and all 12 stored instances in the 177-workspace corpus lead with `api_key`. `input[]` binds by name, so the order is cosmetic to execution and the stored order is the one worth reproducing."
3065
3238
  };
@@ -3070,6 +3243,65 @@ var SEARCH_FAMILY = {
3070
3243
  "mvp:amazon_opensearch_query": ["auth_type", "key_id", "access_key", "region", "base_url", "index", "payload", "size", "from", "included_fields[]", "return_type", "expression[]", "sort[]"],
3071
3244
  "mvp:amazon_opensearch_document": ["auth_type", "key_id", "access_key", "region", "base_url", "method", "index", "doc_id", "doc"]
3072
3245
  };
3246
+ var ADJUDICATED_OPTIONAL = {
3247
+ "mvp:api_request": {
3248
+ headers: "a bare LIST (`headers[]`) \u2014 a list's absent state is the empty list. 146 of 147 stored instances carry it EMPTY and one omits it, so requiring it would refuse the call every real workspace already makes"
3249
+ },
3250
+ "mvp:streaming_api_request": {
3251
+ headers: "the same `headers[]` list, inherited from the same declaration as `api_request`'s"
3252
+ },
3253
+ "mvp:generate_pass": {
3254
+ require_symbol: "three sibling flags of the same kind \u2014 `require_lowercase`, `require_uppercase`, `require_digit` \u2014 all declare `?=true` and this one does not. Four booleans, three defaulted: the shape of an upstream oversight, not a fourth flag the caller must supply",
3255
+ symbol_whitelist: "declared bare beside `require_symbol` and stored EMPTY in both corpus instances, so the engine supplies its own symbol set. Requiring it would make an author invent one to generate a password"
3256
+ },
3257
+ "mvp:elasticsearch_query": {
3258
+ expression: "a bare LIST (`expression[]`) \u2014 absent means no filter, not a missing argument",
3259
+ sort: "a bare LIST (`sort[]`) \u2014 absent means unsorted",
3260
+ included_fields: "a bare LIST (`included_fields[]`) \u2014 absent means all fields",
3261
+ from: "the second half of a paging pair whose first half declares `size?=null`. One of the two got a default and the other did not; page-from-zero is the meaning of absent"
3262
+ },
3263
+ "mvp:amazon_opensearch_query": {
3264
+ expression: "a bare LIST (`expression[]`) \u2014 absent means no filter, not a missing argument",
3265
+ sort: "a bare LIST (`sort[]`) \u2014 absent means unsorted",
3266
+ included_fields: "a bare LIST (`included_fields[]`) \u2014 absent means all fields",
3267
+ from: "the same `size?=null` / `from` paging pair as the Elasticsearch surface"
3268
+ },
3269
+ // Context-routed, 2026-10-17: the half of that day's findings that did NOT
3270
+ // meet the bar (see the context block of CLASS_REQUIRED).
3271
+ ...Object.fromEntries(
3272
+ ["array_difference", "array_intersection", "array_group_by"].map((n) => [
3273
+ `mvp:${n}`,
3274
+ {
3275
+ transform_value: 'every member of the declared block carries a default (`value?="$this"`, `tag?=var`), so absent is the identity transform: the same reading the hand-authored `array_map` / `array_union` audit records'
3276
+ }
3277
+ ])
3278
+ ),
3279
+ "mvp:precondition": {
3280
+ error: 'an empty or absent error falls back to the fixed message "Precondition failed." (live: `scripts/probe-absent-context-field.ts`). 12 of 1093 real instances omit it and 22 store it empty',
3281
+ payload: "read only once the condition has failed, and absent attaches no payload. 1068 of 1093 real instances omit it"
3282
+ },
3283
+ "mvp:throw_error": {
3284
+ name: 'read as `?? ""`: the error code is optional. 2 of 9 real instances store it empty'
3285
+ },
3286
+ ...Object.fromEntries(
3287
+ ["create_image", "create_audio", "create_video", "create_attachment"].map((n) => [
3288
+ `mvp:${n}`,
3289
+ {
3290
+ filename: "read inside a try/catch, and an empty name falls back to the uploaded file's own. 49 of 53 real `create_image` instances omit it"
3291
+ }
3292
+ ])
3293
+ ),
3294
+ ...Object.fromEntries(
3295
+ ["zip_add_file_resource", "zip_delete_file_resource", "zip_extract_file_resource", "zip_view_contents"].map((n) => [
3296
+ `mvp:${n}`,
3297
+ { password: "passed through a default-password helper: absent means an unencrypted archive" }
3298
+ ])
3299
+ ),
3300
+ "mvp:zip_add_file_resource": {
3301
+ password: "passed through a default-password helper: absent means an unencrypted archive",
3302
+ password_encryption: "passed through the matching default helper, and only meaningful beside a password. Both are already filled empty when absent (READ_UNCONDITIONALLY)"
3303
+ }
3304
+ };
3073
3305
  var EDITOR_INDEX_MAP = "the EDITOR writes the bytes, and its shared query component carries a per-platform positional index map that the engine class does not follow; the editor's order is the one every stored statement has";
3074
3306
  var SEARCH_FAMILY_ORDER_REASON = {
3075
3307
  "mvp:amazon_opensearch_query": `${EDITOR_INDEX_MAP} \u2014 it stores \`expression\`/\`sort\` last, where the class declares them mid-schema`,
@@ -4108,19 +4340,19 @@ function statementTableGuid(statement) {
4108
4340
  function checkBlankTableBindings(sections, bag) {
4109
4341
  if (!bag.strict) return;
4110
4342
  for (const [payloadKey, arr] of Object.entries(sections)) {
4111
- for (const obj of arr ?? []) {
4112
- if (!obj || typeof obj !== "object") continue;
4343
+ for (const obj2 of arr ?? []) {
4344
+ if (!obj2 || typeof obj2 !== "object") continue;
4113
4345
  const statements = [];
4114
- collectStatements(obj, statements);
4346
+ collectStatements(obj2, statements);
4115
4347
  const blank = statements.filter((st) => statementTableGuid(st) === "");
4116
4348
  if (blank.length === 0) continue;
4117
- const name = obj.name;
4118
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
4349
+ const name = obj2.name;
4350
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
4119
4351
  const which = [...new Set(blank.map((st) => `\`${statementLabel(st.name)}\``))].join(", ");
4120
4352
  bag.warn(
4121
4353
  "stack.blank-table",
4122
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"}.`,
4123
- obj
4355
+ obj2
4124
4356
  );
4125
4357
  }
4126
4358
  }
@@ -4293,9 +4525,9 @@ function checkInputScope(sections, bag) {
4293
4525
  }
4294
4526
  for (const [payloadKey, arr] of Object.entries(sections)) {
4295
4527
  if (payloadKey === "middleware") continue;
4296
- for (const obj of arr ?? []) {
4297
- if (!obj || typeof obj !== "object") continue;
4298
- const record = obj;
4528
+ for (const obj2 of arr ?? []) {
4529
+ if (!obj2 || typeof obj2 !== "object") continue;
4530
+ const record = obj2;
4299
4531
  const addon = payloadKey === "addon";
4300
4532
  if (!Array.isArray(record.run) && !addon) continue;
4301
4533
  const declared = declaredInputNames(record, tableColumns2);
@@ -4318,13 +4550,13 @@ function checkInputScope(sections, bag) {
4318
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}")\`.` : "";
4319
4551
  const near = didYouMean(missing[0], declared);
4320
4552
  const links = new Set(
4321
- record.input.flatMap(
4553
+ (record.input ?? []).flatMap(
4322
4554
  (e) => typeof e?.type === "string" && e.type.endsWith("_mvpschema") && typeof e.name === "string" ? [e.name] : []
4323
4555
  )
4324
4556
  );
4325
4557
  const link = missing.find((m) => links.has(m));
4326
4558
  const linkNote = link ? ` \`${link}\` is an \`input.dbLink\`: its columns bind as the inputs, so read one by its own name (\`inp("<column>")\`).` : "";
4327
- 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\`.`;
4328
4560
  bag.warn(
4329
4561
  "stack.inp-undeclared",
4330
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,
@@ -4335,9 +4567,9 @@ function checkInputScope(sections, bag) {
4335
4567
  }
4336
4568
  function checkColumnScope(sections, bag) {
4337
4569
  for (const [payloadKey, arr] of Object.entries(sections)) {
4338
- for (const obj of arr ?? []) {
4339
- if (!obj || typeof obj !== "object") continue;
4340
- const record = obj;
4570
+ for (const obj2 of arr ?? []) {
4571
+ if (!obj2 || typeof obj2 !== "object") continue;
4572
+ const record = obj2;
4341
4573
  if (!Array.isArray(record.run) && !Array.isArray(record.result)) continue;
4342
4574
  const reads = [];
4343
4575
  const pending = [[record.result, void 0], [record.run, void 0]];
@@ -4440,12 +4672,77 @@ function envReads(record) {
4440
4672
  const seen = /* @__PURE__ */ new Set();
4441
4673
  return read.filter((r) => seen.has(r.name) ? false : (seen.add(r.name), true));
4442
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
+ }
4443
4740
  function envNamesRead(sections) {
4444
4741
  const names = /* @__PURE__ */ new Set();
4445
4742
  for (const [payloadKey, arr] of Object.entries(sections)) {
4446
- for (const obj of arr ?? []) {
4447
- if (!obj || typeof obj !== "object") continue;
4448
- 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)) {
4449
4746
  if (!isSysSettingName(payloadKey, r.name)) names.add(r.name);
4450
4747
  }
4451
4748
  }
@@ -4469,9 +4766,9 @@ function checkEnvNames(workspaceConfig, sections, bag, envSource) {
4469
4766
  return;
4470
4767
  }
4471
4768
  for (const [payloadKey, arr] of Object.entries(sections)) {
4472
- for (const obj of arr ?? []) {
4473
- if (!obj || typeof obj !== "object") continue;
4474
- const record = obj;
4769
+ for (const obj2 of arr ?? []) {
4770
+ if (!obj2 || typeof obj2 !== "object") continue;
4771
+ const record = obj2;
4475
4772
  const missing = envReads(record).filter((r) => !declared.has(r.name) && !isSysSettingName(payloadKey, r.name));
4476
4773
  if (missing.length === 0) continue;
4477
4774
  const name = typeof record.name === "string" ? record.name : "?";
@@ -4491,9 +4788,9 @@ function isSysSettingName(payloadKey, name) {
4491
4788
  }
4492
4789
  function checkEnvSysNames(declared, sections, bag) {
4493
4790
  for (const [payloadKey, arr] of Object.entries(sections)) {
4494
- for (const obj of arr ?? []) {
4495
- if (!obj || typeof obj !== "object") continue;
4496
- const record = obj;
4791
+ for (const obj2 of arr ?? []) {
4792
+ if (!obj2 || typeof obj2 !== "object") continue;
4793
+ const record = obj2;
4497
4794
  const seen = /* @__PURE__ */ new Set();
4498
4795
  for (const r of envReads(record)) {
4499
4796
  if (declared.has(r.name) || seen.has(r.name) || !isSysSettingName(payloadKey, r.name)) continue;
@@ -4512,9 +4809,9 @@ function checkEnvAttached(sections, bag, envSource) {
4512
4809
  const where = [];
4513
4810
  const readers = [];
4514
4811
  for (const [payloadKey, arr] of Object.entries(sections)) {
4515
- for (const obj of arr ?? []) {
4516
- if (!obj || typeof obj !== "object") continue;
4517
- const record = obj;
4812
+ for (const obj2 of arr ?? []) {
4813
+ if (!obj2 || typeof obj2 !== "object") continue;
4814
+ const record = obj2;
4518
4815
  const read = envReads(record).filter((r) => !isSysSettingName(payloadKey, r.name));
4519
4816
  if (read.length === 0) continue;
4520
4817
  const at = `${sdkKindName(payloadKey, record)} "${typeof record.name === "string" ? record.name : "?"}"`;
@@ -4610,6 +4907,58 @@ function checkPostMergeOnList(sections, bag, workspaceConfig = {}) {
4610
4907
  );
4611
4908
  }
4612
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
+ }
4613
4962
  function wholeResponse(result) {
4614
4963
  if (!Array.isArray(result) || result.length !== 1) return void 0;
4615
4964
  const whole = result[0];
@@ -4702,24 +5051,24 @@ function storedFileInputs(inputs, prefix = "", out = /* @__PURE__ */ new Map(),
4702
5051
  var STORE_UPLOAD = /* @__PURE__ */ new Set(["mvp:create_image", "mvp:create_video", "mvp:create_audio", "mvp:create_attachment"]);
4703
5052
  function checkStoreFromStoredFileInput(sections, bag) {
4704
5053
  for (const [payloadKey, arr] of Object.entries(sections)) {
4705
- for (const obj of arr ?? []) {
4706
- if (!obj || typeof obj !== "object") continue;
4707
- const inputs = obj.input;
5054
+ for (const obj2 of arr ?? []) {
5055
+ if (!obj2 || typeof obj2 !== "object") continue;
5056
+ const inputs = obj2.input;
4708
5057
  if (!Array.isArray(inputs)) continue;
4709
5058
  const stored = storedFileInputs(inputs);
4710
5059
  if (stored.size === 0) continue;
4711
5060
  const statements = [];
4712
- collectStatements(obj.run, statements);
5061
+ collectStatements(obj2.run, statements);
4713
5062
  for (const st of statements) {
4714
5063
  if (!STORE_UPLOAD.has(String(st.name))) continue;
4715
5064
  const source = inputBehind(st.context ?? {}, statements, 0);
4716
5065
  if (source === void 0 || !stored.has(source)) continue;
4717
5066
  const kind = stored.get(source) === "blob" ? "attachment" : stored.get(source).replace(/^blob_(img)?/, (_m, img) => img ? "image" : "");
4718
- const name = obj.name;
5067
+ const name = obj2.name;
4719
5068
  bag.warn(
4720
5069
  "storage.stored-file-input",
4721
- `${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()\`.`,
4722
- 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
4723
5072
  );
4724
5073
  }
4725
5074
  }
@@ -4873,12 +5222,27 @@ function checkRowSelection(statement, owner, subject, selected, prefix, tables,
4873
5222
  if (!columns) return;
4874
5223
  const known = new Set(columns);
4875
5224
  const aliases = /* @__PURE__ */ new Set();
4876
- 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()) {
4877
5227
  for (const e of Array.isArray(list) ? list : []) {
4878
5228
  const as = e?.as;
4879
5229
  if (typeof as !== "string") continue;
4880
5230
  known.add(as);
4881
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
+ );
4882
5246
  }
4883
5247
  }
4884
5248
  const joined = /* @__PURE__ */ new Set();
@@ -4913,17 +5277,17 @@ function checkRowSelection(statement, owner, subject, selected, prefix, tables,
4913
5277
  function checkPagedOutputRoot(sections, bag) {
4914
5278
  const tables = rowTablesOf(sections);
4915
5279
  for (const [payloadKey, arr] of Object.entries(sections)) {
4916
- for (const obj of arr ?? []) {
4917
- if (!obj || typeof obj !== "object") continue;
4918
- const name = obj.name;
4919
- 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 : "?"}"`;
4920
5284
  const statements = [];
4921
- collectStatements(obj, statements);
5285
+ collectStatements(obj2, statements);
4922
5286
  for (const statement of statements) {
4923
5287
  const roots = outputColumns(statement);
4924
5288
  if (roots === void 0 || roots.size === 0) continue;
4925
5289
  if (ROW_OUTPUT_STATEMENTS.has(String(statement.name))) {
4926
- checkRowSelection(statement, owner, obj, statement.output.items, "", tables, bag);
5290
+ checkRowSelection(statement, owner, obj2, statement.output.items, "", tables, bag);
4927
5291
  continue;
4928
5292
  }
4929
5293
  if (statement.name !== DB_QUERY) continue;
@@ -4931,20 +5295,20 @@ function checkPagedOutputRoot(sections, bag) {
4931
5295
  if (!paging || paging.enabled !== true || paging.metadata !== true) {
4932
5296
  const type = statement.context?.return?.type;
4933
5297
  if (type === void 0 || type === "list" || type === "single" || type === "stream") {
4934
- checkRowSelection(statement, owner, obj, statement.output.items, "", tables, bag);
5298
+ checkRowSelection(statement, owner, obj2, statement.output.items, "", tables, bag);
4935
5299
  }
4936
5300
  continue;
4937
5301
  }
4938
5302
  const envelope2 = [...roots].filter((root) => PAGING_ENVELOPE_ROOTS.includes(root));
4939
5303
  if (envelope2.length > 0) {
4940
- checkEnvelopeSelection(statement, owner, obj, envelope2, [...roots], paging, tables, bag);
5304
+ checkEnvelopeSelection(statement, owner, obj2, envelope2, [...roots], paging, tables, bag);
4941
5305
  continue;
4942
5306
  }
4943
5307
  const cols = [...roots];
4944
5308
  bag.warn(
4945
5309
  "db.query-output-not-envelope-rooted",
4946
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.`,
4947
- obj
5311
+ obj2
4948
5312
  );
4949
5313
  }
4950
5314
  }
@@ -4953,10 +5317,10 @@ function checkPagedOutputRoot(sections, bag) {
4953
5317
  function checkUnpagedEnvelopeReads(sections, bag) {
4954
5318
  const roots = PAGING_ENVELOPE_ROOTS;
4955
5319
  for (const [payloadKey, arr] of Object.entries(sections)) {
4956
- for (const obj of arr ?? []) {
4957
- if (!obj || typeof obj !== "object") continue;
5320
+ for (const obj2 of arr ?? []) {
5321
+ if (!obj2 || typeof obj2 !== "object") continue;
4958
5322
  const statements = [];
4959
- collectStatements(obj, statements);
5323
+ collectStatements(obj2, statements);
4960
5324
  const rowsOnly = /* @__PURE__ */ new Set();
4961
5325
  const other = /* @__PURE__ */ new Set();
4962
5326
  const metadataOff = /* @__PURE__ */ new Set();
@@ -4975,18 +5339,18 @@ function checkUnpagedEnvelopeReads(sections, bag) {
4975
5339
  }
4976
5340
  if (rowsOnly.size === 0) continue;
4977
5341
  const refs = [];
4978
- collectVarRefs(obj, refs);
5342
+ collectVarRefs(obj2, refs);
4979
5343
  const reported = /* @__PURE__ */ new Set();
4980
5344
  for (const path of refs) {
4981
5345
  const [base, field] = path.split(".");
4982
5346
  if (!base || !field || !rowsOnly.has(base) || other.has(base) || !roots.includes(field)) continue;
4983
5347
  if (reported.has(path)) continue;
4984
5348
  reported.add(path);
4985
- const name = obj.name;
5349
+ const name = obj2.name;
4986
5350
  bag.warn(
4987
5351
  "db.query-envelope-read-unpaged",
4988
- `${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 }\`.`),
4989
- 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
4990
5354
  );
4991
5355
  }
4992
5356
  }
@@ -4994,8 +5358,8 @@ function checkUnpagedEnvelopeReads(sections, bag) {
4994
5358
  }
4995
5359
  function checkTriggerSearchColumns(sections, bag) {
4996
5360
  const columnsByGuid = tableColumnsOf(sections);
4997
- for (const obj of sections.trigger ?? []) {
4998
- const record = obj;
5361
+ for (const obj2 of sections.trigger ?? []) {
5362
+ const record = obj2;
4999
5363
  const search = record?.meta?.database?.search;
5000
5364
  if (search === void 0) continue;
5001
5365
  const bare = /* @__PURE__ */ new Map();
@@ -5029,10 +5393,10 @@ function checkTriggerSearchColumns(sections, bag) {
5029
5393
  function checkMixedJoins(sections, bag) {
5030
5394
  for (const [payloadKey, arr] of Object.entries(sections)) {
5031
5395
  if (payloadKey === "dbo" || payloadKey === "addon") continue;
5032
- for (const obj of arr ?? []) {
5033
- if (!obj || typeof obj !== "object") continue;
5396
+ for (const obj2 of arr ?? []) {
5397
+ if (!obj2 || typeof obj2 !== "object") continue;
5034
5398
  let found = false;
5035
- walkNodes(obj, (node) => {
5399
+ walkNodes(obj2, (node) => {
5036
5400
  const terms = node.expression;
5037
5401
  if (found || !Array.isArray(terms) || terms.length < 3) return;
5038
5402
  const joins = new Set(
@@ -5041,7 +5405,7 @@ function checkMixedJoins(sections, bag) {
5041
5405
  if (joins.size > 1 && terms.every((t) => typeof t?.type === "string")) found = true;
5042
5406
  });
5043
5407
  if (!found) continue;
5044
- const record = obj;
5408
+ const record = obj2;
5045
5409
  bag.warn(
5046
5410
  "condition.mixed",
5047
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.`,
@@ -5108,10 +5472,13 @@ function checkTableViews(sections, bag) {
5108
5472
  function checkStacks(tables, sections, bag, workspaceConfig = {}, envSource = "authored") {
5109
5473
  checkMiddleware(sections, bag, workspaceConfig);
5110
5474
  checkPostMergeOnList(sections, bag, workspaceConfig);
5475
+ checkPreReplaceDropsInput(sections, bag, workspaceConfig);
5111
5476
  checkStoreFromStoredFileInput(sections, bag);
5112
5477
  checkInputScope(sections, bag);
5113
5478
  checkColumnScope(sections, bag);
5114
5479
  checkEnvNames(workspaceConfig, sections, bag, envSource);
5480
+ checkEnvSecretResponse(sections, bag);
5481
+ checkCryptoWeakDefaults(sections, bag);
5115
5482
  checkPagedOutputRoot(sections, bag);
5116
5483
  checkUnpagedEnvelopeReads(sections, bag);
5117
5484
  checkApiGroupCors(sections, bag);
@@ -5123,19 +5490,19 @@ function checkStacks(tables, sections, bag, workspaceConfig = {}, envSource = "a
5123
5490
  const tablesByGuid = /* @__PURE__ */ new Map();
5124
5491
  for (const def of tables) tablesByGuid.set(resolveRef("dbo", def), def);
5125
5492
  for (const [payloadKey, arr] of Object.entries(sections)) {
5126
- for (const obj of arr ?? []) {
5127
- if (!obj || typeof obj !== "object") continue;
5128
- const name = obj.name;
5129
- 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 : "?"}"`;
5130
5497
  const statements = [];
5131
- collectStatements(obj, statements);
5498
+ collectStatements(obj2, statements);
5132
5499
  if (statements.length === 0) continue;
5133
5500
  for (const statement of statements) {
5134
5501
  if (statement.name === BULK_UPDATE) {
5135
- checkBulkUpdate(statement, owner, obj, tablesByGuid, bag);
5502
+ checkBulkUpdate(statement, owner, obj2, tablesByGuid, bag);
5136
5503
  }
5137
5504
  }
5138
- checkInternalColumnReads(statements, owner, obj, tablesByGuid, bag);
5505
+ checkInternalColumnReads(statements, owner, obj2, tablesByGuid, bag);
5139
5506
  }
5140
5507
  }
5141
5508
  }
@@ -5158,14 +5525,14 @@ function checkIgnoreEmptyOperand(node, owner, host, bag) {
5158
5525
  }
5159
5526
  function checkExpressionOperands(sections, bag) {
5160
5527
  for (const [payloadKey, arr] of Object.entries(sections)) {
5161
- for (const obj of arr ?? []) {
5162
- if (!obj || typeof obj !== "object") continue;
5163
- const name = obj.name;
5164
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
5165
- 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) => {
5166
5533
  const statement = record.statement;
5167
5534
  if (statement && typeof statement === "object" && "op" in statement) {
5168
- checkIgnoreEmptyOperand(statement, owner, obj, bag);
5535
+ checkIgnoreEmptyOperand(statement, owner, obj2, bag);
5169
5536
  }
5170
5537
  });
5171
5538
  }
@@ -5174,11 +5541,11 @@ function checkExpressionOperands(sections, bag) {
5174
5541
  var INTERPOLATED_OBJECT = "[object Object]";
5175
5542
  function checkInterpolatedValues(sections, bag) {
5176
5543
  for (const [payloadKey, arr] of Object.entries(sections)) {
5177
- for (const obj of arr ?? []) {
5178
- if (!obj || typeof obj !== "object") continue;
5179
- const name = obj.name;
5544
+ for (const obj2 of arr ?? []) {
5545
+ if (!obj2 || typeof obj2 !== "object") continue;
5546
+ const name = obj2.name;
5180
5547
  const samples = [];
5181
- walkNodes(obj, (record) => {
5548
+ walkNodes(obj2, (record) => {
5182
5549
  if (typeof record.tag !== "string" || typeof record.value !== "string") return;
5183
5550
  if (!record.value.includes(INTERPOLATED_OBJECT)) return;
5184
5551
  if (samples.length < 2) {
@@ -5187,11 +5554,11 @@ function checkInterpolatedValues(sections, bag) {
5187
5554
  }
5188
5555
  });
5189
5556
  if (samples.length === 0) continue;
5190
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
5557
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
5191
5558
  bag.warn(
5192
5559
  "value.interpolated-object",
5193
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\`.`,
5194
- obj
5561
+ obj2
5195
5562
  );
5196
5563
  }
5197
5564
  }
@@ -5216,10 +5583,10 @@ var INT64_MIN = -(2n ** 63n);
5216
5583
  var INT64_MAX = 2n ** 63n - 1n;
5217
5584
  function checkIntRange(sections, bag) {
5218
5585
  for (const [payloadKey, arr] of Object.entries(sections)) {
5219
- for (const obj of arr ?? []) {
5220
- if (!obj || typeof obj !== "object") continue;
5586
+ for (const obj2 of arr ?? []) {
5587
+ if (!obj2 || typeof obj2 !== "object") continue;
5221
5588
  const out = [];
5222
- walkNodes(obj, (record) => {
5589
+ walkNodes(obj2, (record) => {
5223
5590
  if (record.tag !== "const:int") return;
5224
5591
  const raw = typeof record.value === "string" ? record.value : typeof record.operand === "string" ? record.operand : void 0;
5225
5592
  if (raw === void 0 || !/^[+-]?\d+$/.test(raw)) return;
@@ -5227,42 +5594,42 @@ function checkIntRange(sections, bag) {
5227
5594
  if ((n < INT64_MIN || n > INT64_MAX) && !out.includes(raw)) out.push(raw);
5228
5595
  });
5229
5596
  if (out.length === 0) continue;
5230
- const name = obj.name;
5597
+ const name = obj2.name;
5231
5598
  bag.warn(
5232
5599
  "value.int-out-of-range",
5233
- `${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.`,
5234
- 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
5235
5602
  );
5236
5603
  }
5237
5604
  }
5238
5605
  }
5239
5606
  function checkZeroBasedObjects(sections, bag) {
5240
5607
  for (const [payloadKey, arr] of Object.entries(sections)) {
5241
- for (const obj of arr ?? []) {
5242
- if (!obj || typeof obj !== "object") continue;
5608
+ for (const obj2 of arr ?? []) {
5609
+ if (!obj2 || typeof obj2 !== "object") continue;
5243
5610
  const samples = [];
5244
- walkNodes(obj, (record) => {
5611
+ walkNodes(obj2, (record) => {
5245
5612
  const keys = indexRunKeys(record);
5246
5613
  if (keys !== null && samples.length < 2) samples.push(`{${keys.map((k) => `${JSON.stringify(k)}: \u2026`).join(", ")}}`);
5247
5614
  });
5248
5615
  if (samples.length === 0) continue;
5249
- const name = obj.name;
5250
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
5616
+ const name = obj2.name;
5617
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
5251
5618
  bag.warn(
5252
5619
  "value.obj-zero-based-numeric-keys",
5253
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.`,
5254
- obj
5621
+ obj2
5255
5622
  );
5256
5623
  }
5257
5624
  }
5258
5625
  }
5259
5626
  function checkRegexOperandOrder(sections, bag) {
5260
5627
  for (const [payloadKey, arr] of Object.entries(sections)) {
5261
- for (const obj of arr ?? []) {
5262
- if (!obj || typeof obj !== "object") continue;
5263
- const name = obj.name;
5628
+ for (const obj2 of arr ?? []) {
5629
+ if (!obj2 || typeof obj2 !== "object") continue;
5630
+ const name = obj2.name;
5264
5631
  const seen = /* @__PURE__ */ new Set();
5265
- walkNodes(obj, (record) => {
5632
+ walkNodes(obj2, (record) => {
5266
5633
  if (typeof record.tag !== "string" || typeof record.value !== "string") return;
5267
5634
  if (!Array.isArray(record.filters)) return;
5268
5635
  const reversed = reversedRegexOperands(record);
@@ -5270,11 +5637,265 @@ function checkRegexOperandOrder(sections, bag) {
5270
5637
  seen.add(`\`${reversed.filter}\` (pattern ${JSON.stringify(reversed.subject)})`);
5271
5638
  });
5272
5639
  if (seen.size === 0) continue;
5273
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
5640
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
5274
5641
  bag.warn(
5275
5642
  "value.regex-operands-reversed",
5276
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))\`.`,
5277
- 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
5278
5899
  );
5279
5900
  }
5280
5901
  }
@@ -5313,10 +5934,10 @@ function etcZoneFor(tz) {
5313
5934
  }
5314
5935
  function checkTimezoneArgs(sections, bag) {
5315
5936
  for (const [payloadKey, arr] of Object.entries(sections)) {
5316
- for (const obj of arr ?? []) {
5317
- if (!obj || typeof obj !== "object") continue;
5937
+ for (const obj2 of arr ?? []) {
5938
+ if (!obj2 || typeof obj2 !== "object") continue;
5318
5939
  const seen = /* @__PURE__ */ new Map();
5319
- walkNodes(obj, (record) => {
5940
+ walkNodes(obj2, (record) => {
5320
5941
  const at = typeof record.name === "string" && Array.isArray(record.arg) ? TIMEZONE_ARG[record.name] : void 0;
5321
5942
  if (at === void 0) return;
5322
5943
  const tz = record.arg[at];
@@ -5330,8 +5951,8 @@ function checkTimezoneArgs(sections, bag) {
5330
5951
  for (const [call, near] of seen) {
5331
5952
  bag.warn(
5332
5953
  "value.timezone-unknown",
5333
- `${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".`),
5334
- 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
5335
5956
  );
5336
5957
  }
5337
5958
  }
@@ -5393,14 +6014,14 @@ function checkReservedColumnNames(tables, bag) {
5393
6014
  }
5394
6015
  function checkCacheTtl(sections, bag) {
5395
6016
  for (const key of ["query", "function"]) {
5396
- for (const obj of sections[key] ?? []) {
5397
- const o = obj;
6017
+ for (const obj2 of sections[key] ?? []) {
6018
+ const o = obj2;
5398
6019
  const ttl = o?.cache?.ttl;
5399
6020
  if (o?.cache?.active !== true || Number.isInteger(ttl) && ttl > 0) continue;
5400
6021
  bag.warn(
5401
6022
  "cache.ttl-not-positive",
5402
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.`,
5403
- obj
6024
+ obj2
5404
6025
  );
5405
6026
  }
5406
6027
  }
@@ -5434,12 +6055,12 @@ function checkReservedInputNames(sections, bag) {
5434
6055
  }
5435
6056
  }
5436
6057
  for (const [payloadKey, arr] of Object.entries(sections)) {
5437
- for (const obj of arr ?? []) {
5438
- if (!obj || typeof obj !== "object") continue;
5439
- const objName = obj.name;
5440
- 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 : "?"}"`;
5441
6062
  const statements = [];
5442
- collectStatements(obj, statements);
6063
+ collectStatements(obj2, statements);
5443
6064
  for (const statement of statements) {
5444
6065
  const factory = callsWithInput[statement.name];
5445
6066
  if (factory === void 0) continue;
@@ -5448,7 +6069,7 @@ function checkReservedInputNames(sections, bag) {
5448
6069
  bag.warn(
5449
6070
  "statement.reserved-input-name",
5450
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)}`,
5451
- obj
6072
+ obj2
5452
6073
  );
5453
6074
  }
5454
6075
  }
@@ -5474,10 +6095,10 @@ function enabledFunctionRuns(root) {
5474
6095
  }
5475
6096
  return out;
5476
6097
  }
5477
- function sdkSubject(payloadKey, obj) {
5478
- const name = typeof obj.name === "string" ? obj.name : "?";
5479
- const verb = payloadKey === "query" && typeof obj.verb === "string" && obj.verb !== "" ? `${obj.verb} ` : "";
5480
- 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}"`;
5481
6102
  }
5482
6103
  var RAW_REQUEST_HOSTS = /* @__PURE__ */ new Set(["query", "tool", "prompt"]);
5483
6104
  function callableInputNames(record, section, tableColumns2) {
@@ -5498,14 +6119,14 @@ function checkOmittedCallInputs(sections, bag) {
5498
6119
  });
5499
6120
  }
5500
6121
  for (const [payloadKey, arr] of Object.entries(sections)) {
5501
- for (const obj of arr ?? []) {
5502
- if (!obj || typeof obj !== "object") continue;
5503
- const own = declaredInputNames(obj, tableColumns2);
6122
+ for (const obj2 of arr ?? []) {
6123
+ if (!obj2 || typeof obj2 !== "object") continue;
6124
+ const own = declaredInputNames(obj2, tableColumns2);
5504
6125
  if (own === null) continue;
5505
6126
  const raw = own.size === 0 && RAW_REQUEST_HOSTS.has(payloadKey);
5506
6127
  if (own.size === 0 && !raw) continue;
5507
- const owner = sdkSubject(payloadKey, obj);
5508
- for (const statement of enabledFunctionRuns(obj)) {
6128
+ const owner = sdkSubject(payloadKey, obj2);
6129
+ for (const statement of enabledFunctionRuns(obj2)) {
5509
6130
  const id = statement.context?.function?.id;
5510
6131
  const target = typeof id === "string" ? declared.get(id) : void 0;
5511
6132
  if (target === void 0) continue;
@@ -5519,7 +6140,7 @@ function checkOmittedCallInputs(sections, bag) {
5519
6140
  bag.warn(
5520
6141
  "statement.omitted-input",
5521
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"] }\`.`,
5522
- obj
6143
+ obj2
5523
6144
  );
5524
6145
  }
5525
6146
  }
@@ -5540,8 +6161,8 @@ function checkUnknownCallInputs(sections, bag) {
5540
6161
  let hit = targets.get(section);
5541
6162
  if (hit !== void 0) return hit;
5542
6163
  hit = /* @__PURE__ */ new Map();
5543
- for (const obj of sections[section] ?? []) {
5544
- const record = obj ?? {};
6164
+ for (const obj2 of sections[section] ?? []) {
6165
+ const record = obj2 ?? {};
5545
6166
  if (typeof record.guid !== "string") continue;
5546
6167
  const inputs = declaredInputNames(record, tableColumns2);
5547
6168
  const name = typeof record.name === "string" ? record.name : "?";
@@ -5555,11 +6176,11 @@ function checkUnknownCallInputs(sections, bag) {
5555
6176
  return hit;
5556
6177
  };
5557
6178
  for (const [payloadKey, arr] of Object.entries(sections)) {
5558
- for (const obj of arr ?? []) {
5559
- if (!obj || typeof obj !== "object") continue;
5560
- const owner = sdkSubject(payloadKey, obj);
6179
+ for (const obj2 of arr ?? []) {
6180
+ if (!obj2 || typeof obj2 !== "object") continue;
6181
+ const owner = sdkSubject(payloadKey, obj2);
5561
6182
  const statements = [];
5562
- collectStatements(obj, statements);
6183
+ collectStatements(obj2, statements);
5563
6184
  for (const statement of statements) {
5564
6185
  if (statement.disabled === true) continue;
5565
6186
  const shape = NAMED_INPUT_CALLS[statement.name];
@@ -5577,7 +6198,7 @@ function checkUnknownCallInputs(sections, bag) {
5577
6198
  bag.warn(
5578
6199
  "statement.unknown-input",
5579
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")}.`),
5580
- obj
6201
+ obj2
5581
6202
  );
5582
6203
  }
5583
6204
  }
@@ -5588,8 +6209,8 @@ function checkUnitTests(sections, bag) {
5588
6209
  const tableColumns2 = tableColumnsOf(sections);
5589
6210
  for (const [payloadKey, arr] of Object.entries(sections)) {
5590
6211
  if (payloadKey === "workflow_test") continue;
5591
- for (const obj of arr ?? []) {
5592
- const record = obj;
6212
+ for (const obj2 of arr ?? []) {
6213
+ const record = obj2;
5593
6214
  if (!record || typeof record !== "object" || !Array.isArray(record.test)) continue;
5594
6215
  const owner = sdkSubject(payloadKey, record);
5595
6216
  const declared = declaredInputNames(record, tableColumns2);
@@ -5629,8 +6250,8 @@ function checkAddonAliases(owner, attached, subject, bag) {
5629
6250
  }
5630
6251
  function checkAddonOutput(sections, bag) {
5631
6252
  const tables = rowTablesOf(sections);
5632
- for (const obj of sections.addon ?? []) {
5633
- const record = obj;
6253
+ for (const obj2 of sections.addon ?? []) {
6254
+ const record = obj2;
5634
6255
  if (!record || typeof record !== "object") continue;
5635
6256
  const output = record.output;
5636
6257
  if (output?.customize !== true || !Array.isArray(output.items)) continue;
@@ -5659,15 +6280,15 @@ function checkAddonAttachments(sections, bag) {
5659
6280
  return typeof id === "string" ? id : void 0;
5660
6281
  };
5661
6282
  for (const [payloadKey, arr] of Object.entries(sections)) {
5662
- for (const obj of arr ?? []) {
5663
- if (!obj || typeof obj !== "object") continue;
5664
- const owner = sdkSubject(payloadKey, obj);
6283
+ for (const obj2 of arr ?? []) {
6284
+ if (!obj2 || typeof obj2 !== "object") continue;
6285
+ const owner = sdkSubject(payloadKey, obj2);
5665
6286
  const statements = [];
5666
- collectStatements(obj, statements);
6287
+ collectStatements(obj2, statements);
5667
6288
  for (const statement of statements) {
5668
6289
  const attached = statement.addon;
5669
6290
  if (!Array.isArray(attached) || attached.length === 0) continue;
5670
- checkAddonAliases(owner, attached, obj, bag);
6291
+ checkAddonAliases(owner, attached, obj2, bag);
5671
6292
  const derived = hasDerivedColumns(statement.context);
5672
6293
  const pending = attached.map((spec) => ({
5673
6294
  spec,
@@ -5690,7 +6311,7 @@ function checkAddonAttachments(sections, bag) {
5690
6311
  bag.warn(
5691
6312
  "db.addon-unknown-input",
5692
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")}.`),
5693
- obj
6314
+ obj2
5694
6315
  );
5695
6316
  }
5696
6317
  if (columns !== void 0 && e.tag === "output" && typeof e.value === "string" && e.value !== "") {
@@ -5700,12 +6321,12 @@ function checkAddonAttachments(sections, bag) {
5700
6321
  bag.warn(
5701
6322
  "db.addon-unknown-column",
5702
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")}.`),
5703
- obj
6324
+ obj2
5704
6325
  );
5705
6326
  }
5706
6327
  }
5707
6328
  if (Array.isArray(a.children)) {
5708
- checkAddonAliases(owner, a.children, obj, bag);
6329
+ checkAddonAliases(owner, a.children, obj2, bag);
5709
6330
  const childTable = target === void 0 ? void 0 : tableOf(target.context);
5710
6331
  for (const child of a.children) {
5711
6332
  pending.push({ spec: child, rowTable: childTable, derived: target === void 0 || hasDerivedColumns(target.context) });
@@ -5721,9 +6342,9 @@ var GATING_ACTIONS = {
5721
6342
  channel: ["join"]
5722
6343
  };
5723
6344
  function checkRealtimeGates(sections, bag) {
5724
- for (const obj of sections.trigger ?? []) {
5725
- if (!obj || typeof obj !== "object") continue;
5726
- const t = obj;
6345
+ for (const obj2 of sections.trigger ?? []) {
6346
+ if (!obj2 || typeof obj2 !== "object") continue;
6347
+ const t = obj2;
5727
6348
  if (Array.isArray(t.result) && t.result.length > 0) {
5728
6349
  checkGateAllowedLiteral(t, bag);
5729
6350
  continue;
@@ -5739,7 +6360,7 @@ function checkRealtimeGates(sections, bag) {
5739
6360
  bag.warn(
5740
6361
  "realtime.gate-denies-everyone",
5741
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") })\`.`,
5742
- obj
6363
+ obj2
5743
6364
  );
5744
6365
  }
5745
6366
  }
@@ -5848,16 +6469,16 @@ function checkGateAllowedLiteral(t, bag) {
5848
6469
  );
5849
6470
  }
5850
6471
  function checkNonNullVectorColumns(sections, bag) {
5851
- for (const obj of sections.dbo ?? []) {
5852
- if (!obj || typeof obj !== "object") continue;
5853
- const table = obj;
6472
+ for (const obj2 of sections.dbo ?? []) {
6473
+ if (!obj2 || typeof obj2 !== "object") continue;
6474
+ const table = obj2;
5854
6475
  for (const col of Array.isArray(table.schema) ? table.schema : []) {
5855
6476
  const field = col;
5856
6477
  if (field?.type !== "vector" || field.nullable !== false || (field.default ?? "") !== "") continue;
5857
6478
  bag.warn(
5858
6479
  "field.vector-not-nullable",
5859
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).`,
5860
- obj
6481
+ obj2
5861
6482
  );
5862
6483
  }
5863
6484
  }
@@ -5865,22 +6486,22 @@ function checkNonNullVectorColumns(sections, bag) {
5865
6486
  function checkRealtimeSilentShapes(sections, bag) {
5866
6487
  const nameOf = (o) => typeof o.name === "string" ? o.name : "?";
5867
6488
  const channelsOn = /* @__PURE__ */ new Map();
5868
- for (const obj of sections.channel ?? []) {
5869
- if (!obj || typeof obj !== "object") continue;
5870
- const ch = obj;
6489
+ for (const obj2 of sections.channel ?? []) {
6490
+ if (!obj2 || typeof obj2 !== "object") continue;
6491
+ const ch = obj2;
5871
6492
  const server = ch.server?.id;
5872
6493
  if (typeof server === "string") channelsOn.set(server, (channelsOn.get(server) ?? 0) + 1);
5873
6494
  if (ch.conversation?.enabled === true && Number(ch.conversation.limit ?? 0) === 0) {
5874
6495
  bag.warn(
5875
6496
  "realtime.conversation-no-limit",
5876
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 }\`).`,
5877
- obj
6498
+ obj2
5878
6499
  );
5879
6500
  }
5880
6501
  }
5881
- for (const obj of sections.realtime_server ?? []) {
5882
- if (!obj || typeof obj !== "object") continue;
5883
- const server = obj;
6502
+ for (const obj2 of sections.realtime_server ?? []) {
6503
+ if (!obj2 || typeof obj2 !== "object") continue;
6504
+ const server = obj2;
5884
6505
  const count = typeof server.guid === "string" ? channelsOn.get(server.guid) ?? 0 : 0;
5885
6506
  if (server.enabled === true || count === 0) continue;
5886
6507
  bag.warn(
@@ -5889,19 +6510,30 @@ function checkRealtimeSilentShapes(sections, bag) {
5889
6510
  server
5890
6511
  );
5891
6512
  }
5892
- for (const obj of sections.message ?? []) {
5893
- if (!obj || typeof obj !== "object") continue;
5894
- const msg = obj;
6513
+ for (const obj2 of sections.message ?? []) {
6514
+ if (!obj2 || typeof obj2 !== "object") continue;
6515
+ const msg = obj2;
5895
6516
  if (msg.deliver_to !== "explicit") continue;
5896
6517
  bag.warn(
5897
6518
  "realtime.deliver-explicit",
5898
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"\`.`,
5899
- obj
6520
+ obj2
6521
+ );
6522
+ }
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
5900
6532
  );
5901
6533
  }
5902
- for (const obj of sections.trigger ?? []) {
5903
- if (!obj || typeof obj !== "object") continue;
5904
- const t = obj;
6534
+ for (const obj2 of sections.trigger ?? []) {
6535
+ if (!obj2 || typeof obj2 !== "object") continue;
6536
+ const t = obj2;
5905
6537
  if (t.obj_type !== "channel" || t.active === false || !Array.isArray(t.result) || t.result.length !== 1) continue;
5906
6538
  const actions = t.meta?.channel?.action;
5907
6539
  if (actions?.deliver !== true) continue;
@@ -5912,14 +6544,14 @@ function checkRealtimeSilentShapes(sections, bag) {
5912
6544
  bag.warn(
5913
6545
  "realtime.deliver-falsy-return",
5914
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.`,
5915
- obj
6547
+ obj2
5916
6548
  );
5917
6549
  }
5918
6550
  }
5919
6551
  function checkRealtimeJoinDeliver(sections, bag) {
5920
- for (const obj of sections.trigger ?? []) {
5921
- if (!obj || typeof obj !== "object") continue;
5922
- const t = obj;
6552
+ for (const obj2 of sections.trigger ?? []) {
6553
+ if (!obj2 || typeof obj2 !== "object") continue;
6554
+ const t = obj2;
5923
6555
  if (t.obj_type !== "channel" || t.active === false || !Array.isArray(t.result)) continue;
5924
6556
  const actions = t.meta?.channel?.action;
5925
6557
  if (actions?.join !== true || actions?.deliver !== true) continue;
@@ -5928,7 +6560,7 @@ function checkRealtimeJoinDeliver(sections, bag) {
5928
6560
  bag.warn(
5929
6561
  "realtime.join-deliver-object-response",
5930
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).`,
5931
- obj
6563
+ obj2
5932
6564
  );
5933
6565
  }
5934
6566
  }
@@ -5947,20 +6579,20 @@ function checkRealtimeDeliver(bundleType, sections, bag) {
5947
6579
  return;
5948
6580
  }
5949
6581
  const channels = /* @__PURE__ */ new Map();
5950
- for (const obj of sections.channel ?? []) {
5951
- if (!obj || typeof obj !== "object") continue;
5952
- const ch = obj;
6582
+ for (const obj2 of sections.channel ?? []) {
6583
+ if (!obj2 || typeof obj2 !== "object") continue;
6584
+ const ch = obj2;
5953
6585
  if (typeof ch.guid !== "string" || ch.guid === "") continue;
5954
6586
  channels.set(ch.guid, {
5955
6587
  name: typeof ch.name === "string" ? ch.name : "?",
5956
6588
  perRecipient: ch.delivery?.per_recipient === true,
5957
- obj
6589
+ obj: obj2
5958
6590
  });
5959
6591
  }
5960
6592
  const delivered = /* @__PURE__ */ new Set();
5961
- for (const obj of sections.trigger ?? []) {
5962
- if (!obj || typeof obj !== "object") continue;
5963
- const t = obj;
6593
+ for (const obj2 of sections.trigger ?? []) {
6594
+ if (!obj2 || typeof obj2 !== "object") continue;
6595
+ const t = obj2;
5964
6596
  if (t.obj_type !== "channel" || t.active === false) continue;
5965
6597
  const actions = t.meta?.channel?.action;
5966
6598
  if (actions?.deliver !== true) continue;
@@ -5973,7 +6605,7 @@ function checkRealtimeDeliver(bundleType, sections, bag) {
5973
6605
  bag.warn(
5974
6606
  "realtime.deliver-without-per-recipient",
5975
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.`,
5976
- obj
6608
+ obj2
5977
6609
  );
5978
6610
  }
5979
6611
  for (const [guid, channel] of channels) {
@@ -6007,16 +6639,60 @@ function tail(path) {
6007
6639
  const dot = path.indexOf(".");
6008
6640
  return dot === -1 ? "" : path.slice(dot + 1);
6009
6641
  }
6010
- 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) {
6011
6675
  const bound = /* @__PURE__ */ new Set();
6012
6676
  for (const statement of statements) {
6013
6677
  if (typeof statement.as === "string" && statement.as !== "") bound.add(statement.as);
6014
6678
  const context = statement.context;
6015
6679
  if (typeof context?.as === "string" && context.as !== "") bound.add(context.as);
6680
+ if (declarationsOnly && MUTATES_EXISTING_VAR.has(statement.name)) continue;
6016
6681
  if (typeof context?.name === "string" && context.name !== "") bound.add(context.name);
6017
6682
  }
6018
6683
  return bound;
6019
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
+ }
6020
6696
  function editDistance(a, b) {
6021
6697
  const rows = [Array.from({ length: b.length + 1 }, (_, j) => j)];
6022
6698
  for (let i = 1; i <= a.length; i++) {
@@ -6050,24 +6726,37 @@ function sysAccessorFor(name) {
6050
6726
  sysAccessors ??= new Map(Object.entries(sys).map(([key, read]) => [read().value, key]));
6051
6727
  return sysAccessors.get(name);
6052
6728
  }
6729
+ var UPDATE_VAR_FACTORIES = MUTATES_EXISTING_VAR_FACTORY;
6053
6730
  function checkUnboundVarRefs(sections, bag) {
6054
6731
  for (const [payloadKey, arr] of Object.entries(sections)) {
6055
- for (const obj of arr ?? []) {
6056
- if (!obj || typeof obj !== "object") continue;
6057
- const name = obj.name;
6058
- 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 : "?"}"`;
6059
6736
  const statements = [];
6060
- collectStatements(obj, statements);
6061
- const bound = collectBindings(statements);
6737
+ collectStatements(obj2, statements);
6738
+ const bound = collectBindings(statements, true);
6062
6739
  const subjects = existenceSubjects(statements);
6063
6740
  const refs = [];
6064
- collectVarRefs(obj, refs, new Set(subjects.keys()));
6741
+ collectVarRefs(obj2, refs, new Set(subjects.keys()));
6065
6742
  const assertedOnly = [];
6066
6743
  for (const [subject, role] of subjects) {
6067
6744
  const value = subject.value;
6068
6745
  if (role === "never-bound" && typeof value === "string") assertedOnly.push(value);
6069
6746
  }
6070
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
+ }
6071
6760
  const reads = [
6072
6761
  ...refs.map((path) => ({ path, asserted: false })),
6073
6762
  ...assertedOnly.map((path) => ({ path, asserted: true }))
@@ -6083,18 +6772,18 @@ function checkUnboundVarRefs(sections, bag) {
6083
6772
  bag.warn(
6084
6773
  "stack.unbound-var",
6085
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}()\`.`,
6086
- obj
6775
+ obj2
6087
6776
  );
6088
6777
  }
6089
6778
  continue;
6090
6779
  }
6091
6780
  reported.add(base);
6092
- 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;
6093
6782
  if (reserved) {
6094
6783
  (statements.length > 0 ? bag.error.bind(bag) : bag.warn.bind(bag))(
6095
6784
  "stack.reserved-var-namespace",
6096
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.)`,
6097
- obj
6786
+ obj2
6098
6787
  );
6099
6788
  continue;
6100
6789
  }
@@ -6102,7 +6791,7 @@ function checkUnboundVarRefs(sections, bag) {
6102
6791
  bag.warn(
6103
6792
  "stack.unbound-var",
6104
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.`,
6105
- obj
6794
+ obj2
6106
6795
  );
6107
6796
  continue;
6108
6797
  }
@@ -6110,7 +6799,7 @@ function checkUnboundVarRefs(sections, bag) {
6110
6799
  bag.warn(
6111
6800
  "stack.unbound-var",
6112
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\`.`,
6113
- obj
6802
+ obj2
6114
6803
  );
6115
6804
  }
6116
6805
  }
@@ -6118,9 +6807,9 @@ function checkUnboundVarRefs(sections, bag) {
6118
6807
  }
6119
6808
  function checkPasswordInputHashing(sections, bag) {
6120
6809
  for (const [payloadKey, arr] of Object.entries(sections)) {
6121
- for (const obj of arr ?? []) {
6122
- if (!obj || typeof obj !== "object") continue;
6123
- const record = obj;
6810
+ for (const obj2 of arr ?? []) {
6811
+ if (!obj2 || typeof obj2 !== "object") continue;
6812
+ const record = obj2;
6124
6813
  if (!Array.isArray(record.input)) continue;
6125
6814
  const passwordInputs = /* @__PURE__ */ new Set();
6126
6815
  for (const entry2 of record.input) {
@@ -6131,9 +6820,9 @@ function checkPasswordInputHashing(sections, bag) {
6131
6820
  }
6132
6821
  if (passwordInputs.size === 0) continue;
6133
6822
  const name = record.name;
6134
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
6823
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
6135
6824
  const statements = [];
6136
- collectStatements(obj, statements);
6825
+ collectStatements(obj2, statements);
6137
6826
  const reported = /* @__PURE__ */ new Set();
6138
6827
  for (const statement of statements) {
6139
6828
  if (statement.name !== "mvp:check_pass") continue;
@@ -6146,7 +6835,7 @@ function checkPasswordInputHashing(sections, bag) {
6146
6835
  bag.warn(
6147
6836
  "stack.password-input-double-hash",
6148
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.`,
6149
- obj
6838
+ obj2
6150
6839
  );
6151
6840
  }
6152
6841
  }
@@ -6154,10 +6843,10 @@ function checkPasswordInputHashing(sections, bag) {
6154
6843
  }
6155
6844
  function checkZipPasswordKeys(sections, bag) {
6156
6845
  for (const [payloadKey, arr] of Object.entries(sections)) {
6157
- for (const obj of arr ?? []) {
6158
- if (!obj || typeof obj !== "object") continue;
6846
+ for (const obj2 of arr ?? []) {
6847
+ if (!obj2 || typeof obj2 !== "object") continue;
6159
6848
  const statements = [];
6160
- collectStatements(obj, statements);
6849
+ collectStatements(obj2, statements);
6161
6850
  let owner;
6162
6851
  for (const statement of statements) {
6163
6852
  const fields = READ_UNCONDITIONALLY[statement.name];
@@ -6166,13 +6855,13 @@ function checkZipPasswordKeys(sections, bag) {
6166
6855
  const record = context && typeof context === "object" ? context : {};
6167
6856
  const missing = fields.filter((field) => record[field] === void 0);
6168
6857
  if (missing.length === 0) continue;
6169
- const name = obj.name;
6170
- owner ??= `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
6858
+ const name = obj2.name;
6859
+ owner ??= `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
6171
6860
  const list = missing.map((field) => `\`${field}\``).join(" and ");
6172
6861
  bag.warn(
6173
6862
  "stack.zip-password-absent",
6174
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.`,
6175
- obj
6864
+ obj2
6176
6865
  );
6177
6866
  }
6178
6867
  }
@@ -6180,12 +6869,12 @@ function checkZipPasswordKeys(sections, bag) {
6180
6869
  }
6181
6870
  function checkToThrowScope(sections, bag) {
6182
6871
  for (const [payloadKey, arr] of Object.entries(sections)) {
6183
- for (const obj of arr ?? []) {
6184
- if (!obj || typeof obj !== "object") continue;
6185
- const name = obj.name;
6186
- 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 : "?"}"`;
6187
6876
  const all = [];
6188
- collectStatements(obj, all);
6877
+ collectStatements(obj2, all);
6189
6878
  const toThrows = all.filter((st) => st.name === "mvp:test_expect_to_throw");
6190
6879
  if (toThrows.length === 0) continue;
6191
6880
  const boundAnywhere = collectBindings(all);
@@ -6210,13 +6899,254 @@ function checkToThrowScope(sections, bag) {
6210
6899
  bag.warn(
6211
6900
  "stack.to-throw-isolated-var",
6212
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.`,
6213
- obj
6902
+ obj2
6214
6903
  );
6215
6904
  }
6216
6905
  }
6217
6906
  }
6218
6907
  }
6219
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
+ }
6220
7150
  var DB_MATCH_ARG = {
6221
7151
  "mvp:dbo_getby": "field_value",
6222
7152
  "mvp:dbo_delby": "field_value",
@@ -6238,12 +7168,12 @@ function isNullSafeDrill(cell) {
6238
7168
  }
6239
7169
  function checkSafeRefMatchArgs(sections, bag) {
6240
7170
  for (const [payloadKey, arr] of Object.entries(sections)) {
6241
- for (const obj of arr ?? []) {
6242
- if (!obj || typeof obj !== "object") continue;
6243
- const name = obj.name;
6244
- 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 : "?"}"`;
6245
7175
  const statements = [];
6246
- collectStatements(obj, statements);
7176
+ collectStatements(obj2, statements);
6247
7177
  for (const statement of statements) {
6248
7178
  const matchArg = Object.hasOwn(DB_MATCH_ARG, statement.name) ? DB_MATCH_ARG[statement.name] : void 0;
6249
7179
  if (matchArg === void 0 || !Array.isArray(statement.input)) continue;
@@ -6256,7 +7186,7 @@ function checkSafeRefMatchArgs(sections, bag) {
6256
7186
  bag.warn(
6257
7187
  "db.safe-ref-match-arg",
6258
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.`,
6259
- obj
7189
+ obj2
6260
7190
  );
6261
7191
  }
6262
7192
  }
@@ -6265,12 +7195,12 @@ function checkSafeRefMatchArgs(sections, bag) {
6265
7195
  }
6266
7196
  function checkNullMatchArgs(sections, bag) {
6267
7197
  for (const [payloadKey, arr] of Object.entries(sections)) {
6268
- for (const obj of arr ?? []) {
6269
- if (!obj || typeof obj !== "object") continue;
6270
- const name = obj.name;
6271
- 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 : "?"}"`;
6272
7202
  const statements = [];
6273
- collectStatements(obj, statements);
7203
+ collectStatements(obj2, statements);
6274
7204
  for (const statement of statements) {
6275
7205
  const matchArg = Object.hasOwn(DB_MATCH_ARG, statement.name) ? DB_MATCH_ARG[statement.name] : void 0;
6276
7206
  if (matchArg === void 0 || !Array.isArray(statement.input)) continue;
@@ -6283,7 +7213,7 @@ function checkNullMatchArgs(sections, bag) {
6283
7213
  bag.warn(
6284
7214
  "db.null-match-arg",
6285
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.`,
6286
- obj
7216
+ obj2
6287
7217
  );
6288
7218
  }
6289
7219
  }
@@ -6367,9 +7297,9 @@ function checkPathSegmentCandidates(sections, bag) {
6367
7297
  const t = table;
6368
7298
  if (typeof t?.guid === "string") columns.set(t.guid, fieldsByName(t.schema));
6369
7299
  }
6370
- for (const obj of sections["query"] ?? []) {
6371
- if (!obj || typeof obj !== "object") continue;
6372
- const query = obj;
7300
+ for (const obj2 of sections["query"] ?? []) {
7301
+ if (!obj2 || typeof obj2 !== "object") continue;
7302
+ const query = obj2;
6373
7303
  const name = typeof query.name === "string" ? query.name : "";
6374
7304
  const verb = typeof query.verb === "string" ? query.verb : "";
6375
7305
  if (!URL_ONLY_VERBS.has(verb)) continue;
@@ -6381,11 +7311,11 @@ function checkPathSegmentCandidates(sections, bag) {
6381
7311
  bag.warn(
6382
7312
  "query.input-name-mangled",
6383
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 "-".`,
6384
- obj
7314
+ obj2
6385
7315
  );
6386
7316
  }
6387
7317
  const statements = [];
6388
- collectStatements(obj, statements);
7318
+ collectStatements(obj2, statements);
6389
7319
  const addressing = /* @__PURE__ */ new Set();
6390
7320
  for (const statement of statements) {
6391
7321
  const matchArg = Object.hasOwn(DB_MATCH_ARG, statement.name) ? DB_MATCH_ARG[statement.name] : void 0;
@@ -6406,7 +7336,7 @@ function checkPathSegmentCandidates(sections, bag) {
6406
7336
  bag.warn(
6407
7337
  "query.path-segment-candidate",
6408
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"] }\`.`,
6409
- obj
7339
+ obj2
6410
7340
  );
6411
7341
  }
6412
7342
  }
@@ -6416,15 +7346,15 @@ function checkSameNameSiblings(sections, bag) {
6416
7346
  for (const [payloadKey, arr] of Object.entries(sections)) {
6417
7347
  const guidsByName = /* @__PURE__ */ new Map();
6418
7348
  const kindsByName = /* @__PURE__ */ new Map();
6419
- for (const obj of arr ?? []) {
6420
- if (!obj || typeof obj !== "object") continue;
6421
- const { name, guid } = obj;
7349
+ for (const obj2 of arr ?? []) {
7350
+ if (!obj2 || typeof obj2 !== "object") continue;
7351
+ const { name, guid } = obj2;
6422
7352
  if (typeof name !== "string" || name === "" || typeof guid !== "string") continue;
6423
- const identity = lockNameForObject(payloadKey, obj, appNames);
7353
+ const identity = lockNameForObject(payloadKey, obj2, appNames);
6424
7354
  const guids = guidsByName.get(identity) ?? /* @__PURE__ */ new Set();
6425
7355
  guids.add(guid);
6426
7356
  guidsByName.set(identity, guids);
6427
- 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)));
6428
7358
  }
6429
7359
  for (const [name, guids] of guidsByName) {
6430
7360
  if (guids.size < 2) continue;
@@ -6508,9 +7438,9 @@ function segmentOverlap(a, b) {
6508
7438
  function checkRouteShadowing(sections, bag) {
6509
7439
  const appNames = appNamesByGuid(sections["app"]);
6510
7440
  const byGroupVerb = /* @__PURE__ */ new Map();
6511
- for (const obj of sections["query"] ?? []) {
6512
- if (!obj || typeof obj !== "object") continue;
6513
- const query = obj;
7441
+ for (const obj2 of sections["query"] ?? []) {
7442
+ if (!obj2 || typeof obj2 !== "object") continue;
7443
+ const query = obj2;
6514
7444
  if (typeof query.name !== "string" || query.name === "") continue;
6515
7445
  const verb = typeof query.verb === "string" ? query.verb : "";
6516
7446
  const narrowed = /* @__PURE__ */ new Map();
@@ -6528,7 +7458,7 @@ function checkRouteShadowing(sections, bag) {
6528
7458
  name: query.name,
6529
7459
  verb,
6530
7460
  segments: query.name.split("/").map((segment) => compileSegment(segment, narrowed)),
6531
- record: obj
7461
+ record: obj2
6532
7462
  });
6533
7463
  byGroupVerb.set(key, routes);
6534
7464
  }
@@ -6580,8 +7510,8 @@ function checkRealtimePublish(bundleType, sections, bag) {
6580
7510
  bag.skipped("realtime.publish-unknown-channel");
6581
7511
  return;
6582
7512
  }
6583
- const objName = (obj) => {
6584
- const name = obj?.name;
7513
+ const objName = (obj2) => {
7514
+ const name = obj2?.name;
6585
7515
  return typeof name === "string" ? name : void 0;
6586
7516
  };
6587
7517
  const servers = (sections.realtime_server ?? []).map(objName).filter((n) => n !== void 0);
@@ -6595,11 +7525,11 @@ function checkRealtimePublish(bundleType, sections, bag) {
6595
7525
  });
6596
7526
  const channels = channelRows.map((c2) => c2.name);
6597
7527
  for (const [payloadKey, arr] of Object.entries(sections)) {
6598
- for (const obj of arr ?? []) {
6599
- if (!obj || typeof obj !== "object") continue;
6600
- const owner = `${payloadKey} "${objName(obj) ?? "?"}"`;
7528
+ for (const obj2 of arr ?? []) {
7529
+ if (!obj2 || typeof obj2 !== "object") continue;
7530
+ const owner = `${payloadKey} "${objName(obj2) ?? "?"}"`;
6601
7531
  const statements = [];
6602
- collectStatements(obj, statements);
7532
+ collectStatements(obj2, statements);
6603
7533
  for (const statement of statements) {
6604
7534
  if (statement.name !== REALTIME_PUBLISH) continue;
6605
7535
  const context = statement.context ?? {};
@@ -6608,7 +7538,7 @@ function checkRealtimePublish(bundleType, sections, bag) {
6608
7538
  bag.warn(
6609
7539
  "realtime.publish-unknown-server",
6610
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(", ")}.` : ""}`,
6611
- obj
7541
+ obj2
6612
7542
  );
6613
7543
  }
6614
7544
  const channel = constantCell(context.channel);
@@ -6618,13 +7548,13 @@ function checkRealtimePublish(bundleType, sections, bag) {
6618
7548
  bag.warn(
6619
7549
  "realtime.publish-unknown-channel",
6620
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(", ")}.` : ""),
6621
- obj
7551
+ obj2
6622
7552
  );
6623
7553
  } else if (channel !== void 0 && holders.length === 0) {
6624
7554
  bag.warn(
6625
7555
  "realtime.publish-unknown-channel",
6626
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(", ")}.` : ""}`,
6627
- obj
7557
+ obj2
6628
7558
  );
6629
7559
  }
6630
7560
  }
@@ -6638,16 +7568,16 @@ var TRIGGER_BINDINGS = {
6638
7568
  toolset: "mcpServer` / `agent"
6639
7569
  };
6640
7570
  function checkTriggerBindings(sections, bag) {
6641
- for (const obj of sections.trigger ?? []) {
6642
- if (!obj || typeof obj !== "object") continue;
6643
- const t = obj;
7571
+ for (const obj2 of sections.trigger ?? []) {
7572
+ if (!obj2 || typeof obj2 !== "object") continue;
7573
+ const t = obj2;
6644
7574
  const objType = typeof t.obj_type === "string" ? t.obj_type : "";
6645
7575
  const flags = t.meta?.[objType]?.action;
6646
7576
  if (t.active !== false && objType !== "toolset" && flags && Object.values(flags).every((v) => v !== true)) {
6647
7577
  bag.warn(
6648
7578
  "trigger.no-action",
6649
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(", ")}.`,
6650
- obj
7580
+ obj2
6651
7581
  );
6652
7582
  }
6653
7583
  const arg = Object.hasOwn(TRIGGER_BINDINGS, objType) ? TRIGGER_BINDINGS[objType] : void 0;
@@ -6657,18 +7587,73 @@ function checkTriggerBindings(sections, bag) {
6657
7587
  bag.warn(
6658
7588
  "trigger.unbound",
6659
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.`,
6660
- 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
6661
7646
  );
6662
7647
  }
6663
7648
  }
6664
7649
  function checkDecodeOnlyStatements(sections, bag) {
6665
7650
  for (const [payloadKey, arr] of Object.entries(sections)) {
6666
- for (const obj of arr ?? []) {
6667
- if (!obj || typeof obj !== "object") continue;
6668
- const objName = obj.name;
6669
- 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 : "?"}"`;
6670
7655
  const statements = [];
6671
- collectStatements(obj, statements);
7656
+ collectStatements(obj2, statements);
6672
7657
  const found = new Set(
6673
7658
  statements.map((s) => s.name).filter((name) => DECODE_ONLY_STATEMENTS.has(name))
6674
7659
  );
@@ -6856,56 +7841,77 @@ function collectDanglingRefs(node, path, owner, known, out, embeddedOnly = false
6856
7841
  }
6857
7842
  function checkNonJsonValues(sections, bag, workspaceConfig) {
6858
7843
  const objects = Object.entries(sections).flatMap(
6859
- ([key, arr]) => (arr ?? []).map((obj) => [key, obj])
7844
+ ([key, arr]) => (arr ?? []).map((obj2) => [key, obj2])
6860
7845
  );
6861
7846
  if (workspaceConfig !== void 0) objects.push(["workspace", workspaceConfig]);
6862
- for (const [payloadKey, obj] of objects) {
6863
- if (!obj || typeof obj !== "object") continue;
6864
- const name = obj.name;
6865
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
6866
- 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)) {
6867
7852
  const cast = stringified.text.startsWith("[object ");
6868
7853
  bag.warn(
6869
7854
  "field.default-not-text",
6870
- `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)\`.`,
6871
- 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
6872
7857
  );
6873
7858
  }
6874
- for (const off of findEnumDefaultsOffList(obj)) {
7859
+ for (const off of findEnumDefaultsOffList(obj2)) {
6875
7860
  bag.warn(
6876
7861
  "field.enum-default-not-a-value",
6877
- `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.`,
6878
- 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
6879
7864
  );
6880
7865
  }
6881
- for (const off of findEmailDefaultsMalformed(obj)) {
7866
+ for (const off of findEmailDefaultsMalformed(obj2)) {
6882
7867
  bag.warn(
6883
7868
  "field.email-default-invalid",
6884
- `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.`,
6885
- 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
6886
7871
  );
6887
7872
  }
6888
7873
  if (payloadKey !== "dbo") {
6889
- for (const off of findInputDefaultsRefused(obj)) {
7874
+ for (const off of findInputDefaultsRefused(obj2)) {
6890
7875
  bag.warn(
6891
7876
  "field.input-default-invalid",
6892
- `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.`,
6893
- 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
7879
+ );
7880
+ }
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
6894
7893
  );
6895
7894
  }
6896
- for (const off of payloadKey === "trigger" ? [] : findRequiredInputDefaults(obj)) {
7895
+ for (const off of payloadKey === "trigger" ? [] : findRequiredInputDefaults(obj2)) {
6897
7896
  bag.warn(
6898
7897
  "field.input-required-default-ignored",
6899
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\`.`,
6900
- obj
7899
+ obj2
6901
7900
  );
6902
7901
  }
6903
7902
  }
6904
- 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);
6905
7911
  if (found === void 0) continue;
6906
7912
  bag.error(
6907
7913
  typeof found.value === "function" ? "bundle.function-value" : "bundle.non-json-value",
6908
- nonJsonMessage(owner, sdkLocation(obj, found.path, owner), found.value)
7914
+ nonJsonMessage(owner, sdkLocation(obj2, found.path, owner), found.value)
6909
7915
  );
6910
7916
  }
6911
7917
  }
@@ -6939,6 +7945,62 @@ function findEmailDefaultsMalformed(root) {
6939
7945
  });
6940
7946
  return hits;
6941
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
+ }
6942
8004
  function findInputDefaultsRefused(root) {
6943
8005
  const hits = [];
6944
8006
  walkPaths(root, (node, path) => {
@@ -6981,6 +8043,39 @@ function findInputDefaultsRefused(root) {
6981
8043
  });
6982
8044
  return hits;
6983
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
+ }
6984
8079
  function findRequiredInputDefaults(root) {
6985
8080
  const hits = [];
6986
8081
  const visit = (fields, prefix) => {
@@ -7035,19 +8130,19 @@ function checkReferences(bundleType, sections, workspaceGuid, bag) {
7035
8130
  const known = /* @__PURE__ */ new Set();
7036
8131
  if (typeof workspaceGuid === "string") known.add(workspaceGuid);
7037
8132
  for (const arr of Object.values(sections)) {
7038
- for (const obj of arr ?? []) {
7039
- const guid = obj?.guid;
8133
+ for (const obj2 of arr ?? []) {
8134
+ const guid = obj2?.guid;
7040
8135
  if (typeof guid === "string") known.add(guid);
7041
8136
  }
7042
8137
  }
7043
8138
  const dangling = [];
7044
8139
  for (const [payloadKey, arr] of Object.entries(sections)) {
7045
8140
  if (payloadKey === "vault") continue;
7046
- for (const obj of arr ?? []) {
7047
- if (!obj || typeof obj !== "object") continue;
7048
- const name = obj.name;
7049
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
7050
- 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);
7051
8146
  }
7052
8147
  }
7053
8148
  const byGuid = /* @__PURE__ */ new Map();
@@ -7081,15 +8176,15 @@ function checkMicroserviceReferences(bundleType, sections, bag) {
7081
8176
  );
7082
8177
  const missing = /* @__PURE__ */ new Map();
7083
8178
  for (const [payloadKey, arr] of Object.entries(sections)) {
7084
- for (const obj of arr ?? []) {
7085
- if (!obj || typeof obj !== "object") continue;
8179
+ for (const obj2 of arr ?? []) {
8180
+ if (!obj2 || typeof obj2 !== "object") continue;
7086
8181
  const statements = [];
7087
- collectStatements(obj, statements);
8182
+ collectStatements(obj2, statements);
7088
8183
  for (const st of statements) {
7089
8184
  const target = microserviceHandleName(st);
7090
8185
  if (target === void 0 || registered.has(target)) continue;
7091
- const name = obj.name;
7092
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
8186
+ const name = obj2.name;
8187
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof name === "string" ? name : "?"}"`;
7093
8188
  const owners = missing.get(target) ?? /* @__PURE__ */ new Set();
7094
8189
  owners.add(owner);
7095
8190
  missing.set(target, owners);
@@ -7131,11 +8226,11 @@ function operandFilterNames(operand, out) {
7131
8226
  function checkSearchOperandFilters(sections, bag) {
7132
8227
  if (REQUEST_ONLY_TIME_FILTERS.size === 0) return;
7133
8228
  for (const [payloadKey, arr] of Object.entries(sections)) {
7134
- for (const obj of arr ?? []) {
7135
- if (!obj || typeof obj !== "object") continue;
7136
- const name = obj.name;
7137
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
7138
- 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) => {
7139
8234
  const context = record.context;
7140
8235
  if (!context || typeof context.search !== "object" || context.search === null) return;
7141
8236
  const found = [];
@@ -7150,7 +8245,7 @@ function checkSearchOperandFilters(sections, bag) {
7150
8245
  bag.warn(
7151
8246
  "search.request-only-filter",
7152
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\`.`,
7153
- obj
8248
+ obj2
7154
8249
  );
7155
8250
  }
7156
8251
  });
@@ -7159,11 +8254,11 @@ function checkSearchOperandFilters(sections, bag) {
7159
8254
  }
7160
8255
  function checkSwitchFallthrough(sections, bag) {
7161
8256
  for (const [payloadKey, arr] of Object.entries(sections)) {
7162
- for (const obj of arr ?? []) {
7163
- if (!obj || typeof obj !== "object") continue;
7164
- const name = obj.name;
7165
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
7166
- 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) => {
7167
8262
  if (node.name !== "mvp:switch") return;
7168
8263
  const context = node.context;
7169
8264
  const cases = context?.elif?.run;
@@ -7181,7 +8276,7 @@ function checkSwitchFallthrough(sections, bag) {
7181
8276
  bag.warn(
7182
8277
  "switch.missing-break",
7183
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"] }\`.`,
7184
- obj
8279
+ obj2
7185
8280
  );
7186
8281
  });
7187
8282
  });
@@ -7190,11 +8285,11 @@ function checkSwitchFallthrough(sections, bag) {
7190
8285
  }
7191
8286
  function checkLoopControl(sections, bag) {
7192
8287
  for (const [payloadKey, arr] of Object.entries(sections)) {
7193
- for (const obj of arr ?? []) {
7194
- if (!obj || typeof obj !== "object") continue;
7195
- const name = obj.name;
7196
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof name === "string" ? name : "?"}"`;
7197
- 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);
7198
8293
  }
7199
8294
  }
7200
8295
  }
@@ -7343,8 +8438,8 @@ function checkLiveDatasourceTests(sections, bag) {
7343
8438
  }
7344
8439
  for (const [payloadKey, arr] of Object.entries(sections)) {
7345
8440
  if (payloadKey === "workflow_test") continue;
7346
- for (const obj of arr ?? []) {
7347
- const record = obj;
8441
+ for (const obj2 of arr ?? []) {
8442
+ const record = obj2;
7348
8443
  if (!record || typeof record !== "object" || !Array.isArray(record.test)) continue;
7349
8444
  const live = record.test.filter(
7350
8445
  (t) => typeof t?.datasource === "string" && isLiveDatasource(t.datasource)
@@ -7359,15 +8454,37 @@ function checkLiveDatasourceTests(sections, bag) {
7359
8454
  }
7360
8455
  }
7361
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
+ }
7362
8479
  function checkRunFamilyHosts(sections, bag) {
7363
8480
  for (const [payloadKey, arr] of Object.entries(sections)) {
7364
8481
  if (payloadKey === "workflow_test") continue;
7365
- for (const obj of arr ?? []) {
7366
- if (!obj || typeof obj !== "object") continue;
7367
- const objName = obj.name;
7368
- 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 : "?"}"`;
7369
8486
  const statements = [];
7370
- collectStatements(obj, statements);
8487
+ collectStatements(obj2, statements);
7371
8488
  const found = new Set(
7372
8489
  statements.map((s) => s.name).filter((name) => Object.hasOwn(RUN_FAMILY, name) && !RUNS_OUTSIDE_A_WORKFLOW_TEST.has(name))
7373
8490
  );
@@ -7384,9 +8501,9 @@ function checkRunFamilyHosts(sections, bag) {
7384
8501
  function checkAssertionsOutsideTests(sections, bag) {
7385
8502
  for (const [payloadKey, arr] of Object.entries(sections)) {
7386
8503
  if (payloadKey === "workflow_test") continue;
7387
- for (const obj of arr ?? []) {
7388
- if (!obj || typeof obj !== "object") continue;
7389
- const run = obj.run;
8504
+ for (const obj2 of arr ?? []) {
8505
+ if (!obj2 || typeof obj2 !== "object") continue;
8506
+ const run = obj2.run;
7390
8507
  if (!Array.isArray(run)) continue;
7391
8508
  const statements = [];
7392
8509
  collectStatements(run, statements);
@@ -7398,8 +8515,8 @@ function checkAssertionsOutsideTests(sections, bag) {
7398
8515
  if (found.length === 0) continue;
7399
8516
  bag.warn(
7400
8517
  "stack.expect-outside-test",
7401
- `${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.`,
7402
- 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
7403
8520
  );
7404
8521
  }
7405
8522
  }
@@ -7471,9 +8588,9 @@ function checkToolAuthIdentity(sections, bag) {
7471
8588
  const guid = t.guid;
7472
8589
  if (typeof guid === "string" && guid !== "") byGuid.set(guid, t);
7473
8590
  }
7474
- for (const obj of sections.toolset ?? []) {
7475
- if (!obj || typeof obj !== "object") continue;
7476
- const set = obj;
8591
+ for (const obj2 of sections.toolset ?? []) {
8592
+ if (!obj2 || typeof obj2 !== "object") continue;
8593
+ const set = obj2;
7477
8594
  if (!Array.isArray(set.tool)) continue;
7478
8595
  const setName = typeof set.name === "string" ? set.name : "?";
7479
8596
  const kind = set.type === "agent" ? "agent" : "mcp server";
@@ -7487,10 +8604,11 @@ function checkToolAuthIdentity(sections, bag) {
7487
8604
  if (tool === void 0) continue;
7488
8605
  if (!readsAuth(tool)) continue;
7489
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)`;
7490
8608
  bag.warn(
7491
8609
  "toolset.tool-reads-auth-ungated",
7492
- `${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> }\`.`,
7493
- 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
7494
8612
  );
7495
8613
  }
7496
8614
  }
@@ -7498,10 +8616,10 @@ function checkToolAuthIdentity(sections, bag) {
7498
8616
  function checkPrimitiveAuthIdentity(sections, bag) {
7499
8617
  for (const kind of ["prompt", "resource"]) {
7500
8618
  const byGuid = /* @__PURE__ */ new Map();
7501
- for (const obj of sections[kind] ?? []) {
7502
- if (!obj || typeof obj !== "object") continue;
7503
- const guid = obj.guid;
7504
- 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);
7505
8623
  }
7506
8624
  if (byGuid.size === 0) continue;
7507
8625
  const call = kind === "prompt" ? "prompts/get" : "resources/read";
@@ -7530,9 +8648,9 @@ function checkStackAuthRatelimit(sections, bag) {
7530
8648
  ["task", "a task is scheduled/background and never has a request identity", "key it off a fixed value"]
7531
8649
  ];
7532
8650
  for (const [kind, reason, remedy] of hosts) {
7533
- for (const obj of sections[kind] ?? []) {
7534
- if (!obj || typeof obj !== "object") continue;
7535
- const host = obj;
8651
+ for (const obj2 of sections[kind] ?? []) {
8652
+ if (!obj2 || typeof obj2 !== "object") continue;
8653
+ const host = obj2;
7536
8654
  if (kind === "query" && host.auth) continue;
7537
8655
  let hit = false;
7538
8656
  walkNodes(host.run, (record) => {
@@ -7542,7 +8660,7 @@ function checkStackAuthRatelimit(sections, bag) {
7542
8660
  bag.warn(
7543
8661
  "stack.auth-null-host",
7544
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}.`,
7545
- obj
8663
+ obj2
7546
8664
  );
7547
8665
  }
7548
8666
  }
@@ -7567,40 +8685,49 @@ function statementsRead(root, name, except) {
7567
8685
  }
7568
8686
  function checkRatelimitWithoutError(sections, bag) {
7569
8687
  for (const [kind, objs] of Object.entries(sections)) {
7570
- for (const obj of objs ?? []) {
7571
- if (!obj || typeof obj !== "object") continue;
8688
+ for (const obj2 of objs ?? []) {
8689
+ if (!obj2 || typeof obj2 !== "object") continue;
7572
8690
  const bound = [];
7573
8691
  let unbound = false;
7574
- walkNodes(obj, (record) => {
8692
+ walkNodes(obj2, (record) => {
7575
8693
  if (record.name !== "mvp:redis_ratelimit" || !Array.isArray(record.input)) return;
7576
8694
  const error = record.input.find((e) => e?.name === "error");
7577
8695
  const set = error !== void 0 && !(error.tag === "const" && (error.value === "" || error.value === void 0));
7578
8696
  if (set) return;
7579
8697
  if (typeof record.as === "string" && record.as !== "") {
7580
- if (!statementsRead(obj, record.as, record)) bound.push(record.as);
8698
+ if (!statementsRead(obj2, record.as, record)) bound.push(record.as);
7581
8699
  } else unbound = true;
7582
8700
  });
7583
8701
  if (bound.length === 0 && !unbound) continue;
7584
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";
7585
8703
  bag.warn(
7586
8704
  "redis.ratelimit-no-error",
7587
- `${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.`,
7588
- 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
7589
8707
  );
7590
8708
  }
7591
8709
  }
7592
8710
  }
7593
8711
  function checkAuthNoCaller(sections, bag) {
7594
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
+ }
7595
8718
  const hosts = [
7596
- ["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
+ ],
7597
8724
  ["task", "a task runs on a schedule with no caller", "carry the user id in the data the task reads"],
7598
8725
  ["trigger", "a realtime lifecycle trigger establishes no auth (it reads 0)", RT]
7599
8726
  ];
7600
8727
  for (const [kind, reason, remedy] of hosts) {
7601
- for (const obj of sections[kind] ?? []) {
7602
- if (!obj || typeof obj !== "object") continue;
7603
- const host = obj;
8728
+ for (const obj2 of sections[kind] ?? []) {
8729
+ if (!obj2 || typeof obj2 !== "object") continue;
8730
+ const host = obj2;
7604
8731
  if (kind === "query" && host.auth) continue;
7605
8732
  if (kind === "trigger") {
7606
8733
  const t = host.obj_type;
@@ -7611,15 +8738,171 @@ function checkAuthNoCaller(sections, bag) {
7611
8738
  walkNodes(host, (record) => {
7612
8739
  if (record.name === "mvp:redis_ratelimit" && readsAuth(record)) ratelimit = true;
7613
8740
  });
7614
- 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;
7615
8753
  bag.warn(
7616
8754
  "stack.auth-no-caller",
7617
- `${kind} "${String(host.name)}" reads \`auth()\`, but ${reason}: it deploys clean and never holds the caller's identity. Fix: ${remedy}.`,
7618
- 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
7619
8757
  );
7620
8758
  }
7621
8759
  }
7622
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
+ }
7623
8906
  function readsAuth(tool) {
7624
8907
  let found = false;
7625
8908
  walkNodes(tool, (record) => {
@@ -7652,8 +8935,8 @@ function looksLikeSecret(value) {
7652
8935
  return value.length >= 32 && /^[A-Za-z0-9_\-.]+$/.test(value) && /[A-Za-z]/.test(value) && /\d/.test(value);
7653
8936
  }
7654
8937
  function checkAgentApiKeys(sections, bag) {
7655
- for (const obj of sections.toolset ?? []) {
7656
- const t = obj ?? {};
8938
+ for (const obj2 of sections.toolset ?? []) {
8939
+ const t = obj2 ?? {};
7657
8940
  if (t.type !== "agent") continue;
7658
8941
  const settings = t.agent_settings;
7659
8942
  const provider = typeof settings?.type === "string" ? settings.type : "";
@@ -7665,7 +8948,7 @@ function checkAgentApiKeys(sections, bag) {
7665
8948
  bag.error(
7666
8949
  "agent.literal-api-key",
7667
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.`,
7668
- obj
8951
+ obj2
7669
8952
  );
7670
8953
  }
7671
8954
  }
@@ -7742,13 +9025,13 @@ function elicitWrite(statement) {
7742
9025
  }
7743
9026
  function checkWriteBeforeElicit(sections, bag) {
7744
9027
  for (const [payloadKey, arr] of Object.entries(sections)) {
7745
- for (const obj of arr ?? []) {
7746
- if (!obj || typeof obj !== "object") continue;
9028
+ for (const obj2 of arr ?? []) {
9029
+ if (!obj2 || typeof obj2 !== "object") continue;
7747
9030
  const statements = [];
7748
- collectStatements(obj.run, statements);
9031
+ collectStatements(obj2.run, statements);
7749
9032
  if (!statements.some((st) => st.name === "mvp:mcp_elicit")) continue;
7750
- const objName = obj.name;
7751
- const owner = `${sdkKindName(payloadKey, obj)} "${typeof objName === "string" ? objName : "?"}"`;
9033
+ const objName = obj2.name;
9034
+ const owner = `${sdkKindName(payloadKey, obj2)} "${typeof objName === "string" ? objName : "?"}"`;
7752
9035
  let writes = [];
7753
9036
  for (const st of statements) {
7754
9037
  if (st.name === "mvp:mcp_elicit") {
@@ -7757,7 +9040,7 @@ function checkWriteBeforeElicit(sections, bag) {
7757
9040
  bag.warn(
7758
9041
  "mcp.write-before-elicit",
7759
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"] }\`.`,
7760
- obj
9043
+ obj2
7761
9044
  );
7762
9045
  }
7763
9046
  writes = [];
@@ -7784,22 +9067,22 @@ function checkMcpStackHazards(sections, bag) {
7784
9067
  );
7785
9068
  }
7786
9069
  for (const [payloadKey, arr] of Object.entries(sections)) {
7787
- for (const obj of arr ?? []) {
7788
- if (!obj || typeof obj !== "object") continue;
9070
+ for (const obj2 of arr ?? []) {
9071
+ if (!obj2 || typeof obj2 !== "object") continue;
7789
9072
  const statements = [];
7790
- collectStatements(obj.run, statements);
9073
+ collectStatements(obj2.run, statements);
7791
9074
  const elicits = statements.filter((st) => st.name === "mvp:mcp_elicit");
7792
9075
  if (elicits.length === 0) continue;
7793
- const owner = sdkSubject(payloadKey, obj);
9076
+ const owner = sdkSubject(payloadKey, obj2);
7794
9077
  if (NO_MCP_CALLER.has(payloadKey)) {
7795
9078
  bag.warn(
7796
9079
  "mcp.elicit-outside-mcp",
7797
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.`,
7798
- obj
9081
+ obj2
7799
9082
  );
7800
9083
  }
7801
9084
  const byKey = /* @__PURE__ */ new Map();
7802
- for (const placed of placedElicits(obj.run)) {
9085
+ for (const placed of placedElicits(obj2.run)) {
7803
9086
  const key = statementInput(placed.statement, "key");
7804
9087
  if (key?.tag !== "const" || typeof key.value !== "string") continue;
7805
9088
  if (Array.isArray(key.filters) && key.filters.length > 0) continue;
@@ -7816,14 +9099,14 @@ function checkMcpStackHazards(sections, bag) {
7816
9099
  bag.warn(
7817
9100
  "mcp.elicit-duplicate-key",
7818
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.`,
7819
- obj
9102
+ obj2
7820
9103
  );
7821
9104
  }
7822
9105
  if (looped.length > 0) {
7823
9106
  bag.warn(
7824
9107
  "mcp.elicit-duplicate-key",
7825
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.`,
7826
- obj
9109
+ obj2
7827
9110
  );
7828
9111
  }
7829
9112
  }
@@ -7962,8 +9245,8 @@ function roleCheckOf(st) {
7962
9245
  return void 0;
7963
9246
  }
7964
9247
  function checkToolOutputSchema(sections, bag) {
7965
- for (const obj of sections.tool ?? []) {
7966
- const t = obj ?? {};
9248
+ for (const obj2 of sections.tool ?? []) {
9249
+ const t = obj2 ?? {};
7967
9250
  if (!Array.isArray(t.output_schema) || t.output_schema.length === 0) continue;
7968
9251
  if (!Array.isArray(t.result) || t.result.length === 0) continue;
7969
9252
  const keys = t.result.map((e) => e?.name);
@@ -7981,7 +9264,19 @@ function checkToolOutputSchema(sections, bag) {
7981
9264
  bag.warn(
7982
9265
  "tool.output-mismatch",
7983
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\`.`,
7984
- 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
7985
9280
  );
7986
9281
  }
7987
9282
  }
@@ -8094,10 +9389,13 @@ function checkAgentToolsOff(sections, bag) {
8094
9389
  if (withTools.size === 0) return;
8095
9390
  forEachAgentRun(sections, (st, toolsetId, owner, host) => {
8096
9391
  const name = withTools.get(toolsetId);
8097
- 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;
8098
9396
  bag.warn(
8099
9397
  "stack.agent-tools-off",
8100
- `${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.`,
8101
9399
  host
8102
9400
  );
8103
9401
  });
@@ -8188,6 +9486,13 @@ export {
8188
9486
  checkIntRange,
8189
9487
  checkZeroBasedObjects,
8190
9488
  checkRegexOperandOrder,
9489
+ checkUnboundPredicates,
9490
+ checkConstantArrayKeys,
9491
+ checkPredicateIndexReads,
9492
+ checkPreconditionBareErrors,
9493
+ checkReturnedStreams,
9494
+ checkReturnedIncludeMeta,
9495
+ checkReturnsOutsideInferredType,
8191
9496
  isKnownTimezone,
8192
9497
  checkTimezoneArgs,
8193
9498
  checkSeed,
@@ -8206,10 +9511,12 @@ export {
8206
9511
  checkRealtimeSilentShapes,
8207
9512
  checkRealtimeJoinDeliver,
8208
9513
  checkRealtimeDeliver,
9514
+ UPDATE_VAR_FACTORIES,
8209
9515
  checkUnboundVarRefs,
8210
9516
  checkPasswordInputHashing,
8211
9517
  checkZipPasswordKeys,
8212
9518
  checkToThrowScope,
9519
+ checkConditionallyBoundVars,
8213
9520
  checkSafeRefMatchArgs,
8214
9521
  checkNullMatchArgs,
8215
9522
  checkPathSegmentCandidates,
@@ -8217,6 +9524,8 @@ export {
8217
9524
  checkRouteShadowing,
8218
9525
  checkRealtimePublish,
8219
9526
  checkTriggerBindings,
9527
+ checkTriggerAbsentSideReads,
9528
+ checkMcpTriggerResponseKeys,
8220
9529
  checkDecodeOnlyStatements,
8221
9530
  checkNonJsonValues,
8222
9531
  checkReferences,
@@ -8227,6 +9536,7 @@ export {
8227
9536
  checkMicroserviceSecrets,
8228
9537
  checkMicroserviceBlocks,
8229
9538
  checkLiveDatasourceTests,
9539
+ checkUncheckedWorkflowTestCalls,
8230
9540
  checkRunFamilyHosts,
8231
9541
  checkAssertionsOutsideTests,
8232
9542
  checkKnowledge,
@@ -8235,6 +9545,10 @@ export {
8235
9545
  checkStackAuthRatelimit,
8236
9546
  checkRatelimitWithoutError,
8237
9547
  checkAuthNoCaller,
9548
+ checkToolCallReadsAuth,
9549
+ checkPatchRawInput,
9550
+ checkEditOptionalInput,
9551
+ checkAuthTokenOptionalExpiration,
8238
9552
  checkDocumentationTokens,
8239
9553
  looksLikeSecret,
8240
9554
  checkAgentApiKeys,
@@ -8244,7 +9558,8 @@ export {
8244
9558
  checkMcpResourceUris,
8245
9559
  checkGuardRoleColumns,
8246
9560
  checkToolOutputSchema,
9561
+ checkToolDescriptionShadowed,
8247
9562
  checkAgentArgPlaceholders,
8248
9563
  checkAgentToolsOff
8249
9564
  };
8250
- //# sourceMappingURL=chunk-HINRE3UM.js.map
9565
+ //# sourceMappingURL=chunk-HXPQXCOZ.js.map