@koda-sl/baker-cli 0.466.0 → 0.467.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -1
- package/dist/account-2VTEV5C3.js +79 -0
- package/dist/account-2VTEV5C3.js.map +1 -0
- package/dist/account-HZC6X2PH.js +49 -0
- package/dist/account-MLX2MQTO.js +80 -0
- package/dist/account-reads-FCETXYI7.js +218 -0
- package/dist/account-writes-UNVXSLMV.js +66 -0
- package/dist/accounts-4P54UY6F.js +115 -0
- package/dist/accounts-6UNBLIUH.js +75 -0
- package/dist/accounts-GVTZN4VE.js +114 -0
- package/dist/accounts-PSNCMJLI.js +611 -0
- package/dist/accounts-PSNCMJLI.js.map +1 -0
- package/dist/accounts-XVQVPFDG.js +77 -0
- package/dist/accounts-XVQVPFDG.js.map +1 -0
- package/dist/actions-MEKXFKDN.js +55 -0
- package/dist/active-entities-UGHMVRWH.js +103 -0
- package/dist/activities-2J7FTZMN.js +74 -0
- package/dist/ad-group-writes-2YEZNT5Q.js +170 -0
- package/dist/ad-groups-YXVIPI7B.js +68 -0
- package/dist/ad-writes-HBNG55VT.js +174 -0
- package/dist/add-2FHPLALV.js +105 -0
- package/dist/add-JEMGWBRH.js +104 -0
- package/dist/add-JEMGWBRH.js.map +1 -0
- package/dist/add-JP76KCCY.js +97 -0
- package/dist/add-OZIORHYQ.js +302 -0
- package/dist/add-OZIORHYQ.js.map +1 -0
- package/dist/add-accounts-M5Y4DQFM.js +91 -0
- package/dist/ads-DB5NDHX5.js +128 -0
- package/dist/ads-NDV3GOIW.js +40 -0
- package/dist/ads-QBXR7IPO.js +77 -0
- package/dist/ads-W2IPUWHQ.js +113 -0
- package/dist/adsets-PY5ZKGBO.js +176 -0
- package/dist/advertisers-7BN7X2IH.js +120 -0
- package/dist/advertisers-7BN7X2IH.js.map +1 -0
- package/dist/advertisers-BVAZ4XUX.js +125 -0
- package/dist/analytics-CQMJG7S4.js +1976 -0
- package/dist/analytics-CQMJG7S4.js.map +1 -0
- package/dist/analytics-S6P7FO7Z.js +433 -0
- package/dist/analytics-S6P7FO7Z.js.map +1 -0
- package/dist/animate-QEHFEQHZ.js +480 -0
- package/dist/assign-NNI5YU4M.js +77 -0
- package/dist/assign-NNI5YU4M.js.map +1 -0
- package/dist/audience-size-BCKF7ETB.js +94 -0
- package/dist/audience-size-BCKF7ETB.js.map +1 -0
- package/dist/audiences-NTT3HZN7.js +85 -0
- package/dist/audiences-QWJ34WIW.js +268 -0
- package/dist/audiences-UUIYQFS6.js +78 -0
- package/dist/audit-3IEVQLR4.js +151 -0
- package/dist/audit-3IEVQLR4.js.map +1 -0
- package/dist/audit-OWXTLQC4.js +88 -0
- package/dist/autocomplete-5PN6N7DQ.js +111 -0
- package/dist/autocomplete-5PN6N7DQ.js.map +1 -0
- package/dist/avatars-3PC7FTU3.js +38 -0
- package/dist/bid-pricing-S5IU2BQW.js +99 -0
- package/dist/bid-pricing-S5IU2BQW.js.map +1 -0
- package/dist/brand-XVXQ7VAU.js +22 -0
- package/dist/brief-SZSPXGG4.js +490 -0
- package/dist/businesses-ZH67AXR6.js +53 -0
- package/dist/campaign-groups-SBUN3CVL.js +95 -0
- package/dist/campaign-groups-SBUN3CVL.js.map +1 -0
- package/dist/campaign-writes-2LMGW7FW.js +165 -0
- package/dist/campaign-writes-2LMGW7FW.js.map +1 -0
- package/dist/campaign-writes-4N3LQJL2.js +170 -0
- package/dist/campaigns-5FH5THMS.js +76 -0
- package/dist/campaigns-66OOGMDW.js +110 -0
- package/dist/campaigns-CYPLOBK3.js +109 -0
- package/dist/campaigns-CYPLOBK3.js.map +1 -0
- package/dist/campaigns-QUQQYMIO.js +107 -0
- package/dist/canvas-3GSDOZTI.js +46 -0
- package/dist/canvas-3GSDOZTI.js.map +1 -0
- package/dist/capabilities-UP52NQJ7.js +144 -0
- package/dist/capabilities-UP52NQJ7.js.map +1 -0
- package/dist/cards-RSMTBND3.js +85 -0
- package/dist/catalog-YDDBFPRO.js +64 -0
- package/dist/catalog-YDDBFPRO.js.map +1 -0
- package/dist/catalogs-3IYC53GK.js +128 -0
- package/dist/changes-U263PWVD.js +135 -0
- package/dist/chatgpt-O64OJE6R.js +47 -0
- package/dist/chats-FP44JQYE.js +262 -0
- package/dist/chats-FP44JQYE.js.map +1 -0
- package/dist/chunk-35ENAFJX.js +46 -0
- package/dist/chunk-3KIH22M7.js +207 -0
- package/dist/chunk-4DM6OAQ6.js +2065 -0
- package/dist/chunk-4DM6OAQ6.js.map +1 -0
- package/dist/chunk-4FCLXJYW.js +1442 -0
- package/dist/chunk-4OSBBGG5.js +304 -0
- package/dist/chunk-57UECM77.js +98 -0
- package/dist/chunk-5Q3XCLMS.js +455 -0
- package/dist/chunk-65BQAJMH.js +136 -0
- package/dist/chunk-6GFJFTG6.js +75 -0
- package/dist/chunk-6GKC2PBR.js +160 -0
- package/dist/chunk-6HPIWZHS.js +76 -0
- package/dist/chunk-73B3RQJC.js +610 -0
- package/dist/chunk-7MQVCSA7.js +310 -0
- package/dist/chunk-7NTION5F.js +26 -0
- package/dist/chunk-A3VUXG5G.js +1079 -0
- package/dist/chunk-A3VUXG5G.js.map +1 -0
- package/dist/chunk-AQ4HEXUH.js +1830 -0
- package/dist/chunk-AUWN3C2K.js +474 -0
- package/dist/chunk-B3SPFCKC.js +494 -0
- package/dist/chunk-CBCGVPHB.js +125 -0
- package/dist/chunk-CECS3DHZ.js +333 -0
- package/dist/chunk-CHFKTRB5.js +665 -0
- package/dist/chunk-D24DJ7DB.js +67 -0
- package/dist/chunk-D5MF337I.js +97 -0
- package/dist/chunk-DL2W4N7J.js +52 -0
- package/dist/chunk-DL2W4N7J.js.map +1 -0
- package/dist/chunk-DLUWHZCE.js +225 -0
- package/dist/chunk-ECBHE5S6.js +51 -0
- package/dist/chunk-EXZ2NIKX.js +111 -0
- package/dist/chunk-F3FSD6BO.js +96 -0
- package/dist/chunk-F5XU546T.js +23 -0
- package/dist/chunk-G3KO2HFZ.js +35 -0
- package/dist/chunk-GIWHHCD6.js +145 -0
- package/dist/chunk-GIWHHCD6.js.map +1 -0
- package/dist/chunk-GKXMIXEV.js +166 -0
- package/dist/chunk-GT4UFORX.js +296 -0
- package/dist/chunk-GWM4DCAK.js +4410 -0
- package/dist/chunk-GZ6YS7TG.js +106 -0
- package/dist/chunk-H7JOVRHO.js +106 -0
- package/dist/chunk-HF5V7TWU.js +592 -0
- package/dist/chunk-HM25R6XJ.js +433 -0
- package/dist/chunk-HWSUW5PX.js +169 -0
- package/dist/chunk-I7R3YSZF.js +346 -0
- package/dist/chunk-IJDF7D4U.js +139 -0
- package/dist/chunk-IK2S7QGF.js +363 -0
- package/dist/chunk-INI7U2SZ.js +188 -0
- package/dist/chunk-INJHF7AF.js +172 -0
- package/dist/chunk-J2QOKD2F.js +76 -0
- package/dist/chunk-J57EXXFU.js +175 -0
- package/dist/chunk-JE5NMVRX.js +274 -0
- package/dist/chunk-JHLGXB6K.js +45 -0
- package/dist/chunk-JSEPE5EP.js +23992 -0
- package/dist/chunk-JSKBCXI5.js +3151 -0
- package/dist/chunk-JSKBCXI5.js.map +1 -0
- package/dist/chunk-KB5HBQEK.js +25 -0
- package/dist/chunk-KB5XJHQX.js +216 -0
- package/dist/chunk-KB5XJHQX.js.map +1 -0
- package/dist/chunk-KCCWCK6L.js +6667 -0
- package/dist/chunk-KTL2D7NT.js +96 -0
- package/dist/chunk-KWTKAYCG.js +1599 -0
- package/dist/chunk-LHNL6JM2.js +309 -0
- package/dist/chunk-MPXDQWYI.js +57 -0
- package/dist/chunk-NAMEFVWL.js +1743 -0
- package/dist/chunk-NAMEFVWL.js.map +1 -0
- package/dist/chunk-NBYP5N4X.js +509 -0
- package/dist/chunk-NOSWSBLW.js +382 -0
- package/dist/chunk-O3LHCQ7Q.js +136 -0
- package/dist/chunk-P5H2BL4J.js +92 -0
- package/dist/chunk-P66JWKAL.js +533 -0
- package/dist/chunk-PA5MYVQY.js +66 -0
- package/dist/chunk-Q676JHJA.js +58 -0
- package/dist/chunk-QDOVBGKZ.js +149 -0
- package/dist/chunk-QN5VAYER.js +622 -0
- package/dist/chunk-QNEX7FEC.js +174 -0
- package/dist/chunk-QTL4NJ5I.js +65 -0
- package/dist/chunk-QXDEZKAR.js +455 -0
- package/dist/chunk-QXDEZKAR.js.map +1 -0
- package/dist/chunk-R3GZRH43.js +98 -0
- package/dist/chunk-R7CQCE3E.js +103 -0
- package/dist/chunk-RFJ3S47F.js +172 -0
- package/dist/chunk-RV67UWHI.js +5187 -0
- package/dist/chunk-RV67UWHI.js.map +1 -0
- package/dist/chunk-TMQ5LHZ3.js +159 -0
- package/dist/chunk-TRLVH7T3.js +846 -0
- package/dist/chunk-UUBFYAVE.js +337 -0
- package/dist/chunk-UXTZ5MBE.js +56 -0
- package/dist/chunk-V43RLLZE.js +55 -0
- package/dist/chunk-V4UFNEHE.js +541 -0
- package/dist/chunk-V5L5QD7R.js +60 -0
- package/dist/chunk-VAYFVC5B.js +297 -0
- package/dist/chunk-VFSLIDXA.js +42 -0
- package/dist/chunk-VHMNSO2B.js +84 -0
- package/dist/chunk-VOH2QWVG.js +275 -0
- package/dist/chunk-WESRVXFS.js +133 -0
- package/dist/chunk-WILN7TD6.js +84 -0
- package/dist/chunk-WXC3I4CT.js +6188 -0
- package/dist/chunk-X4DLIDFW.js +197 -0
- package/dist/chunk-XUMMI5WJ.js +817 -0
- package/dist/chunk-XUMMI5WJ.js.map +1 -0
- package/dist/chunk-YONSWWCF.js +215 -0
- package/dist/chunk-YONSWWCF.js.map +1 -0
- package/dist/chunk-YT74ZEVP.js +206 -0
- package/dist/chunk-Z5KBRTB2.js +191 -0
- package/dist/chunk-ZBKBTTHD.js +74 -0
- package/dist/chunk-ZFIYN7KP.js +19 -0
- package/dist/chunk-ZLU5QDLU.js +486 -0
- package/dist/chunk-ZNNC6B75.js +94 -0
- package/dist/chunk-ZO2YLHRW.js +74 -0
- package/dist/chunk-ZPJE6D7W.js +74 -0
- package/dist/claim-Y5HNMIGT.js +197 -0
- package/dist/claim-Y5HNMIGT.js.map +1 -0
- package/dist/cli.js +40 -37
- package/dist/cli.js.map +1 -1
- package/dist/client-LY2JCQS2.js +19 -0
- package/dist/code-7CBNYUPU.js +76 -0
- package/dist/companies-KXL2F27Q.js +195 -0
- package/dist/companies-KXL2F27Q.js.map +1 -0
- package/dist/complete-Y47RTEZU.js +81 -0
- package/dist/complete-Y47RTEZU.js.map +1 -0
- package/dist/config-7COTFJWK.js +88 -0
- package/dist/connect-VOCZSB3W.js +42 -0
- package/dist/content-OXMONMHJ.js +85 -0
- package/dist/conversation-DJLUJC2V.js +93 -0
- package/dist/conversation-DJLUJC2V.js.map +1 -0
- package/dist/conversion-report-ZRNV7X7D.js +125 -0
- package/dist/conversion-upload-command-IMHHSGYU.js +438 -0
- package/dist/conversion-writes-7N5UDQGH.js +120 -0
- package/dist/conversions-CRRH74GZ.js +135 -0
- package/dist/conversions-CRRH74GZ.js.map +1 -0
- package/dist/conversions-QOXRO26I.js +76 -0
- package/dist/countries-UXAUGSBR.js +82 -0
- package/dist/create-4HHYBOZF.js +59 -0
- package/dist/create-4HHYBOZF.js.map +1 -0
- package/dist/create-FVIVHA37.js +207 -0
- package/dist/create-FVIVHA37.js.map +1 -0
- package/dist/create-XSXCJ2IS.js +235 -0
- package/dist/create-XSXCJ2IS.js.map +1 -0
- package/dist/create-YTCXQUUX.js +130 -0
- package/dist/create-YTCXQUUX.js.map +1 -0
- package/dist/creatives-6DJPLVV7.js +182 -0
- package/dist/creatives-6DJPLVV7.js.map +1 -0
- package/dist/creatives-F26GDJG2.js +51 -0
- package/dist/creatives-ONKKGW5T.js +87 -0
- package/dist/credentials-6W4YNIWY.js +287 -0
- package/dist/credentials-6W4YNIWY.js.map +1 -0
- package/dist/critique-EFZPHFIS.js +213 -0
- package/dist/critique-EFZPHFIS.js.map +1 -0
- package/dist/critique-JNWRNCVW.js +1449 -0
- package/dist/critique-JNWRNCVW.js.map +1 -0
- package/dist/crm-E3BPZUW3.js +224 -0
- package/dist/crm-E3BPZUW3.js.map +1 -0
- package/dist/crm-MAZU2GZR.js +318 -0
- package/dist/crm-MAZU2GZR.js.map +1 -0
- package/dist/crop-3ZV5BFCA.js +113 -0
- package/dist/currency-PGLGLRKU.js +88 -0
- package/dist/custom-conversions-TV23XQHW.js +125 -0
- package/dist/customers-I2EHMEX3.js +56 -0
- package/dist/decide-EGQ3CRHI.js +199 -0
- package/dist/decide-EGQ3CRHI.js.map +1 -0
- package/dist/delete-A5NP6I7U.js +54 -0
- package/dist/delete-A5NP6I7U.js.map +1 -0
- package/dist/delete-MN6GZAZH.js +66 -0
- package/dist/delete-MN6GZAZH.js.map +1 -0
- package/dist/delete-MUPTLWHI.js +71 -0
- package/dist/delete-QMIJ5Z3V.js +63 -0
- package/dist/delete-QMIJ5Z3V.js.map +1 -0
- package/dist/delete-R2SEUSLV.js +69 -0
- package/dist/delete-ZGBBWFAW.js +71 -0
- package/dist/demographics-3DHCGMUR.js +138 -0
- package/dist/demographics-3DHCGMUR.js.map +1 -0
- package/dist/describe-4O3VCV6L.js +97 -0
- package/dist/describe-FCTM53MM.js +97 -0
- package/dist/dimensions-AD4VS5AH.js +101 -0
- package/dist/discard-7QUFDYVK.js +66 -0
- package/dist/discard-7QUFDYVK.js.map +1 -0
- package/dist/discover-6XSPNZYE.js +172 -0
- package/dist/discover-UQXQUPNO.js +93 -0
- package/dist/domain-NRPTYLT2.js +98 -0
- package/dist/domain-NRPTYLT2.js.map +1 -0
- package/dist/download-IE6XLFHM.js +299 -0
- package/dist/draft-24B2O3SG.js +217 -0
- package/dist/draft-24B2O3SG.js.map +1 -0
- package/dist/draft-ENA7S4Y7.js +103 -0
- package/dist/draft-FGPMNIZK.js +306 -0
- package/dist/draft-FGPMNIZK.js.map +1 -0
- package/dist/draft-MGKJ5RYI.js +100 -0
- package/dist/draft-PPRDQDGW.js +307 -0
- package/dist/draft-R5RZ72PS.js +328 -0
- package/dist/draft-R5RZ72PS.js.map +1 -0
- package/dist/draft-S6VPKZYY.js +233 -0
- package/dist/draft-VVDI2OR3.js +281 -0
- package/dist/engine/index.js +12 -13
- package/dist/env-YLOVBOAE.js +43 -0
- package/dist/experiment-PHFP6IBM.js +1397 -0
- package/dist/export-R2IMUCQO.js +168 -0
- package/dist/extract-OQP3TSQG.js +113 -0
- package/dist/facets-HFX6SZT6.js +114 -0
- package/dist/facets-HFX6SZT6.js.map +1 -0
- package/dist/favorites-NS73FDG5.js +178 -0
- package/dist/feed-SQPOB7SP.js +177 -0
- package/dist/feedback-XHSJBBEJ.js +66 -0
- package/dist/feedback-record-Z7Z4AW2L.js +175 -0
- package/dist/feedback-record-Z7Z4AW2L.js.map +1 -0
- package/dist/fetch-PQ3NOPIE.js +139 -0
- package/dist/fetch-TPRDJJGI.js +176 -0
- package/dist/fetch-TPRDJJGI.js.map +1 -0
- package/dist/find-Y22AANDE.js +134 -0
- package/dist/fit-XJPM6573.js +45 -0
- package/dist/flows-NF3IHOVV.js +247 -0
- package/dist/flows-NF3IHOVV.js.map +1 -0
- package/dist/follow-N3DQZV7M.js +94 -0
- package/dist/follow-competitors-BZPCBGIB.js +112 -0
- package/dist/following-KESWTEBR.js +113 -0
- package/dist/fonts-3FX3OYEQ.js +34 -0
- package/dist/forecast-CYSEUIS4.js +168 -0
- package/dist/forecast-MO4PAKTH.js +104 -0
- package/dist/forecast-MO4PAKTH.js.map +1 -0
- package/dist/funding-G6S4UVU5.js +85 -0
- package/dist/funnel-MM4AXAE7.js +394 -0
- package/dist/funnel-MM4AXAE7.js.map +1 -0
- package/dist/ga4-2QHOA4RO.js +55 -0
- package/dist/generate-F4FDRDAW.js +262 -0
- package/dist/get-3P2EQLP3.js +63 -0
- package/dist/get-FJB3X44Z.js +61 -0
- package/dist/get-HV2VIJYO.js +78 -0
- package/dist/get-HV2VIJYO.js.map +1 -0
- package/dist/get-LHL6CGOR.js +56 -0
- package/dist/get-LHL6CGOR.js.map +1 -0
- package/dist/get-MBGO4VJD.js +63 -0
- package/dist/get-NOKSZPIV.js +59 -0
- package/dist/get-WHC4SRYK.js +92 -0
- package/dist/gif-SFYVDLCU.js +94 -0
- package/dist/google-MY45TUC4.js +3190 -0
- package/dist/google-XRAMIES5.js +136 -0
- package/dist/google-ads-DMOYC7OY.js +195 -0
- package/dist/google-ads-DMOYC7OY.js.map +1 -0
- package/dist/group-6RDJTWVN.js +43 -0
- package/dist/group-TZJCKHKS.js +43 -0
- package/dist/gsc-HD6UFRYM.js +30 -0
- package/dist/history-2WBZRPPE.js +67 -0
- package/dist/history-PY5BYL7T.js +133 -0
- package/dist/history-PY5BYL7T.js.map +1 -0
- package/dist/hubspot-WQ6P3TZL.js +779 -0
- package/dist/hubspot-WQ6P3TZL.js.map +1 -0
- package/dist/icon-BMCDFGMN.js +137 -0
- package/dist/ideas-VLHUTFHP.js +32 -0
- package/dist/images-C4TBUPXM.js +90 -0
- package/dist/improve-P6F2HXYQ.js +86 -0
- package/dist/ingest-SXT33KE6.js +23 -0
- package/dist/ingest-V42IQ2FN.js +107 -0
- package/dist/ingest-V42IQ2FN.js.map +1 -0
- package/dist/insights-DI4W3D2Y.js +423 -0
- package/dist/insights-X75LRPS3.js +122 -0
- package/dist/inspect-YO5ER5OK.js +189 -0
- package/dist/inspect-YO5ER5OK.js.map +1 -0
- package/dist/inspiration-MDCCU2CF.js +53 -0
- package/dist/intent-A4SOIFKK.js +95 -0
- package/dist/job-QDLPQFIT.js +202 -0
- package/dist/job-create-6XKD5GEC.js +109 -0
- package/dist/job-status-MH7CGLWC.js +74 -0
- package/dist/keep-42SLV4CR.js +78 -0
- package/dist/keyword-gap-D4P2CC2L.js +130 -0
- package/dist/keyword-metrics-JLTZ4533.js +197 -0
- package/dist/keyword-metrics-JLTZ4533.js.map +1 -0
- package/dist/keywords-for-site-UCUPPHVX.js +128 -0
- package/dist/keywords-for-site-UCUPPHVX.js.map +1 -0
- package/dist/landing-JWD3U2K5.js +28 -0
- package/dist/landings-5IYXHA5Z.js +151 -0
- package/dist/languages-HX4FD3GX.js +40 -0
- package/dist/languages-SRFGW6Z3.js +55 -0
- package/dist/launches-7U4TPNO3.js +108 -0
- package/dist/layerize-U672AXED.js +190 -0
- package/dist/leads-MXUQISOC.js +293 -0
- package/dist/leads-WMKTJWW5.js +90 -0
- package/dist/leads-WMKTJWW5.js.map +1 -0
- package/dist/learn-C4AJ2JDS.js +203 -0
- package/dist/learn-C4AJ2JDS.js.map +1 -0
- package/dist/library-RPFXNER4.js +109 -0
- package/dist/lighthouse-SJ4QNLUS.js +75 -0
- package/dist/line-item-writes-N5XUSGEM.js +208 -0
- package/dist/line-item-writes-N5XUSGEM.js.map +1 -0
- package/dist/line-items-QIBNOEOH.js +103 -0
- package/dist/link-ZC6MH7AP.js +64 -0
- package/dist/link-ZC6MH7AP.js.map +1 -0
- package/dist/linkedin-MIEUUP4J.js +1008 -0
- package/dist/linkedin-MIEUUP4J.js.map +1 -0
- package/dist/list-GQ65MC2N.js +65 -0
- package/dist/list-HT4HZWF4.js +63 -0
- package/dist/list-HT4HZWF4.js.map +1 -0
- package/dist/list-K56J7FZW.js +51 -0
- package/dist/list-LLBBUXTM.js +151 -0
- package/dist/list-LLBBUXTM.js.map +1 -0
- package/dist/list-LYRCC67M.js +303 -0
- package/dist/list-LYRCC67M.js.map +1 -0
- package/dist/list-M4Z3WYPM.js +76 -0
- package/dist/list-SXYVDDMU.js +57 -0
- package/dist/list-XFIOXFB2.js +50 -0
- package/dist/locations-PQWB7EGC.js +40 -0
- package/dist/locations-WNSET6RM.js +67 -0
- package/dist/log-SXXIU7ZP.js +92 -0
- package/dist/log-SXXIU7ZP.js.map +1 -0
- package/dist/logo-4JOWGJ5A.js +18 -0
- package/dist/lookup-QGGSAHOO.js +22 -0
- package/dist/make-6OQBIYWC.js +633 -0
- package/dist/map-YMFE54VT.js +404 -0
- package/dist/map-YMFE54VT.js.map +1 -0
- package/dist/mcp-QAZ4XLMN.js +463 -0
- package/dist/mcp-QAZ4XLMN.js.map +1 -0
- package/dist/media-2SWDJDA6.js +15 -0
- package/dist/media-O5L7GO72.js +89 -0
- package/dist/media-sources-LF6I6AYP.js +32 -0
- package/dist/members-RGK6FRVY.js +44 -0
- package/dist/members-RGK6FRVY.js.map +1 -0
- package/dist/meta-37L6QBOZ.js +69 -0
- package/dist/metrics-WVG3IUMH.js +152 -0
- package/dist/models-5QWYGJ7Y.js +155 -0
- package/dist/normalize-5G6MMOAB.js +141 -0
- package/dist/normalize-5G6MMOAB.js.map +1 -0
- package/dist/normalize-P5Q3F7FU.js +806 -0
- package/dist/options-TYQL4KRW.js +121 -0
- package/dist/options-TYQL4KRW.js.map +1 -0
- package/dist/output-ZL62UZHQ.js +24 -0
- package/dist/page-FZ7IZ5CV.js +105 -0
- package/dist/pages-SS7TZTHV.js +66 -0
- package/dist/performance-2K425XAN.js +24 -0
- package/dist/pinterest-UETS7U7U.js +96 -0
- package/dist/pixels-D73GQFGM.js +60 -0
- package/dist/pixels-LCTMLKGP.js +108 -0
- package/dist/plan-4HLITU3A.js +207 -0
- package/dist/preview-RU54Z4EM.js +169 -0
- package/dist/profile-NQOIBLJL.js +150 -0
- package/dist/promoted-tweet-writes-YIZGFYZO.js +180 -0
- package/dist/promoted-tweet-writes-YIZGFYZO.js.map +1 -0
- package/dist/promoted-tweets-D5NKZ3FS.js +119 -0
- package/dist/properties-ZUDQH3LE.js +101 -0
- package/dist/publish-WDHGUTNP.js +322 -0
- package/dist/publish-WDHGUTNP.js.map +1 -0
- package/dist/query-26T7XATH.js +236 -0
- package/dist/query-IJVVSB54.js +61 -0
- package/dist/query-SHUOHXTO.js +247 -0
- package/dist/questionnaire-7AEVHZDR.js +93 -0
- package/dist/read-UYSQAXRV.js +141 -0
- package/dist/reddit-YBEYPDZP.js +26 -0
- package/dist/refresh-NKBJT47F.js +94 -0
- package/dist/refresh-NKBJT47F.js.map +1 -0
- package/dist/release-4UPLYFTE.js +60 -0
- package/dist/release-4UPLYFTE.js.map +1 -0
- package/dist/relevant-pages-OI7GTPOK.js +99 -0
- package/dist/remove-2KACTXKP.js +48 -0
- package/dist/remove-HEL2YO3Q.js +50 -0
- package/dist/remove-HEL2YO3Q.js.map +1 -0
- package/dist/reopen-3RWFCQU2.js +63 -0
- package/dist/reopen-3RWFCQU2.js.map +1 -0
- package/dist/rerun-LM52CBPS.js +84 -0
- package/dist/research-547KDC54.js +62 -0
- package/dist/research-VW37GQ5K.js +262 -0
- package/dist/research-VW37GQ5K.js.map +1 -0
- package/dist/reset-LHQJDSVK.js +54 -0
- package/dist/reset-LHQJDSVK.js.map +1 -0
- package/dist/reset-OIRUQHMS.js +54 -0
- package/dist/reset-OIRUQHMS.js.map +1 -0
- package/dist/resolve-2N35OI2Y.js +121 -0
- package/dist/resolve-2N35OI2Y.js.map +1 -0
- package/dist/retry-EZRMUB4I.js +62 -0
- package/dist/retry-EZRMUB4I.js.map +1 -0
- package/dist/retry-GXH7SCNK.js +60 -0
- package/dist/retry-GXH7SCNK.js.map +1 -0
- package/dist/retry-failed-NWLH6WHK.js +45 -0
- package/dist/run-DWR24LCU.js +65 -0
- package/dist/run-DWR24LCU.js.map +1 -0
- package/dist/run-PLUL33QX.js +59 -0
- package/dist/scaffold-ad-W4RZXLDX.js +1548 -0
- package/dist/scaffold-static-ad-IPJYRAOT.js +971 -0
- package/dist/scaffold-video-XBII4YLS.js +872 -0
- package/dist/schedule-QZPDYWHK.js +61 -0
- package/dist/schedule-QZPDYWHK.js.map +1 -0
- package/dist/schedule-S547HPUT.js +66 -0
- package/dist/scheduled-agents-DWSVPMZP.js +49 -0
- package/dist/schema-O4JTYZEY.js +132 -0
- package/dist/schema-O4JTYZEY.js.map +1 -0
- package/dist/schema-SQIP75WG.js +63 -0
- package/dist/scrape-TI6S2W7I.js +2241 -0
- package/dist/screenshot-XFAYY4WW.js +102 -0
- package/dist/search-4HIOKYFR.js +26 -0
- package/dist/search-D2IV7KFJ.js +92 -0
- package/dist/search-IZPDHRJ4.js +224 -0
- package/dist/search-KFDL2IGG.js +91 -0
- package/dist/search-L3RYKE3G.js +174 -0
- package/dist/search-L3RYKE3G.js.map +1 -0
- package/dist/search-copy-QZXCAGK4.js +168 -0
- package/dist/seeds-VUNZMHZH.js +101 -0
- package/dist/select-IAHFSSDX.js +94 -0
- package/dist/select-IAHFSSDX.js.map +1 -0
- package/dist/sends-UT4WXVOS.js +309 -0
- package/dist/sequences-5RAGZE7L.js +146 -0
- package/dist/set-prompt-WVQ4AI66.js +185 -0
- package/dist/setup-links-DFGWE4CV.js +141 -0
- package/dist/setup-links-DFGWE4CV.js.map +1 -0
- package/dist/shared-3CGGKICB.js +31 -0
- package/dist/site-4XF273BE.js +177 -0
- package/dist/site-4XF273BE.js.map +1 -0
- package/dist/sitemaps-3WDYQHYR.js +87 -0
- package/dist/sites-G4DQ2Z2X.js +101 -0
- package/dist/skills-PA26HXEP.js +47 -0
- package/dist/sources-M46IYW42.js +421 -0
- package/dist/sources-M46IYW42.js.map +1 -0
- package/dist/sources-PZXOSE4S.js +30 -0
- package/dist/stale-M64FB7J3.js +63 -0
- package/dist/stale-M64FB7J3.js.map +1 -0
- package/dist/stats-6DPPYSP3.js +34 -0
- package/dist/status-C6UZ45WO.js +62 -0
- package/dist/status-C6UZ45WO.js.map +1 -0
- package/dist/sticker-MC2IAIQB.js +94 -0
- package/dist/stock-B7LKMKUK.js +179 -0
- package/dist/studio-EQ2L6OBJ.js +49 -0
- package/dist/sync-CLZDZL5F.js +54 -0
- package/dist/sync-V26UBMAN.js +265 -0
- package/dist/sync-VYOJ7G6S.js +54 -0
- package/dist/sync-VYOJ7G6S.js.map +1 -0
- package/dist/sync-definition-2SGGHSKR.js +52 -0
- package/dist/tag-manager-KIHXVFMF.js +43 -0
- package/dist/tags-6RGJF4GS.js +20 -0
- package/dist/tags-6RGJF4GS.js.map +1 -0
- package/dist/tags-FGCZJZWK.js +20 -0
- package/dist/tags-FGCZJZWK.js.map +1 -0
- package/dist/tags-JN475JPP.js +26 -0
- package/dist/tags-ODT4WI57.js +20 -0
- package/dist/tags-ODT4WI57.js.map +1 -0
- package/dist/tags-SURC65KF.js +224 -0
- package/dist/tags-SURC65KF.js.map +1 -0
- package/dist/targeting-constants-6Y5J2PPZ.js +118 -0
- package/dist/targeting-criteria-NMZD3CK6.js +113 -0
- package/dist/targets-L4M53NRI.js +102 -0
- package/dist/targets-L4M53NRI.js.map +1 -0
- package/dist/templates-5AC4336C.js +178 -0
- package/dist/templates-5AC4336C.js.map +1 -0
- package/dist/testimonials-YN2AB7U7.js +32 -0
- package/dist/themes-BYRMCXYR.js +94 -0
- package/dist/top-companies-X75ZLN4Y.js +108 -0
- package/dist/top-companies-X75ZLN4Y.js.map +1 -0
- package/dist/translate-YPVSDMH6.js +598 -0
- package/dist/translate-YPVSDMH6.js.map +1 -0
- package/dist/triggers-GBKVEQZF.js +141 -0
- package/dist/triggers-GBKVEQZF.js.map +1 -0
- package/dist/tweets-KTM7HX5R.js +123 -0
- package/dist/unfollow-WBBTVEHE.js +46 -0
- package/dist/unlink-ORHXBQKH.js +67 -0
- package/dist/unlink-ORHXBQKH.js.map +1 -0
- package/dist/unstage-2R23KGQG.js +84 -0
- package/dist/unstage-2R23KGQG.js.map +1 -0
- package/dist/unstage-GYBJZWCZ.js +95 -0
- package/dist/update-2VOYUTLV.js +155 -0
- package/dist/update-2VOYUTLV.js.map +1 -0
- package/dist/update-JTFWVXRB.js +142 -0
- package/dist/update-JTFWVXRB.js.map +1 -0
- package/dist/update-VKPYJXNK.js +63 -0
- package/dist/update-VKPYJXNK.js.map +1 -0
- package/dist/update-YTDA3XJ3.js +98 -0
- package/dist/update-YTDA3XJ3.js.map +1 -0
- package/dist/upload-NA62W5RS.js +150 -0
- package/dist/upload-V42RNE7Q.js +126 -0
- package/dist/upload-V42RNE7Q.js.map +1 -0
- package/dist/upscale-RXJUBHXN.js +109 -0
- package/dist/url-options-LZIHCPP4.js +130 -0
- package/dist/url-params-5SRJGPT6.js +98 -0
- package/dist/url-params-5SRJGPT6.js.map +1 -0
- package/dist/use-MHPNS4V4.js +95 -0
- package/dist/validate-IIOV3YJK.js +88 -0
- package/dist/variant-ZFCWILPG.js +338 -0
- package/dist/videos-MIHTMO3G.js +39 -0
- package/dist/view-PYCGDGT2.js +121 -0
- package/dist/viewer-check-65TIGVAJ.js +68 -0
- package/dist/web-2ACSE34L.js +140 -0
- package/dist/web-2ACSE34L.js.map +1 -0
- package/dist/winners-AI4PVSOI.js +113 -0
- package/dist/winning-ads-2ZOUOAYM.js +84 -0
- package/dist/winning-ads-2ZOUOAYM.js.map +1 -0
- package/dist/write-commands-34L5LJIB.js +713 -0
- package/dist/write-commands-5TJ3LQ5F.js +737 -0
- package/dist/write-commands-GLIDTGI3.js +1015 -0
- package/dist/write-commands-GLIDTGI3.js.map +1 -0
- package/dist/write-commands-R3UCCBUI.js +206 -0
- package/dist/x-V7V47E4N.js +47 -0
- package/package.json +1 -1
- package/dist/account-7IPMMAWC.js +0 -49
- package/dist/account-OG2O3MUX.js +0 -80
- package/dist/account-YDCLWYJP.js +0 -78
- package/dist/account-YDCLWYJP.js.map +0 -1
- package/dist/account-reads-32G6NU63.js +0 -218
- package/dist/account-writes-UHUNPVS6.js +0 -66
- package/dist/accounts-56PIQMBS.js +0 -610
- package/dist/accounts-56PIQMBS.js.map +0 -1
- package/dist/accounts-7RXXXS2Y.js +0 -76
- package/dist/accounts-7RXXXS2Y.js.map +0 -1
- package/dist/accounts-CX46D2TB.js +0 -115
- package/dist/accounts-L2EPDW2W.js +0 -114
- package/dist/accounts-NS7L5EZX.js +0 -75
- package/dist/actions-JM4A4NEL.js +0 -55
- package/dist/active-entities-6W5YOGNN.js +0 -103
- package/dist/activities-52LTJRU4.js +0 -74
- package/dist/ad-group-writes-MABCQHMC.js +0 -170
- package/dist/ad-groups-I3DBQZTM.js +0 -68
- package/dist/ad-writes-E4R3IK4N.js +0 -174
- package/dist/add-3D7VASJ2.js +0 -105
- package/dist/add-DFIEIEQ6.js +0 -103
- package/dist/add-DFIEIEQ6.js.map +0 -1
- package/dist/add-I7KEQNHQ.js +0 -301
- package/dist/add-I7KEQNHQ.js.map +0 -1
- package/dist/add-OLDNWEK7.js +0 -97
- package/dist/add-accounts-EVOMXIHE.js +0 -91
- package/dist/ads-DKQGSCGF.js +0 -77
- package/dist/ads-FBOR4DMY.js +0 -113
- package/dist/ads-N2AHRG74.js +0 -128
- package/dist/ads-XT454DCT.js +0 -40
- package/dist/adsets-7F5VJB7A.js +0 -176
- package/dist/advertisers-E6MP4MEZ.js +0 -119
- package/dist/advertisers-E6MP4MEZ.js.map +0 -1
- package/dist/advertisers-ZTK74NII.js +0 -125
- package/dist/analytics-AOZI432K.js +0 -432
- package/dist/analytics-AOZI432K.js.map +0 -1
- package/dist/analytics-UOEIZKGO.js +0 -1975
- package/dist/analytics-UOEIZKGO.js.map +0 -1
- package/dist/animate-32L3BPTL.js +0 -480
- package/dist/assign-CTFY7SLH.js +0 -76
- package/dist/assign-CTFY7SLH.js.map +0 -1
- package/dist/audience-size-JKKG6NII.js +0 -93
- package/dist/audience-size-JKKG6NII.js.map +0 -1
- package/dist/audiences-5KVPPV5T.js +0 -268
- package/dist/audiences-M2O5NS4O.js +0 -78
- package/dist/audiences-YQZHWY2K.js +0 -85
- package/dist/audit-JTISKWXM.js +0 -88
- package/dist/audit-WXPT7Z7X.js +0 -150
- package/dist/audit-WXPT7Z7X.js.map +0 -1
- package/dist/autocomplete-6JHOENES.js +0 -110
- package/dist/autocomplete-6JHOENES.js.map +0 -1
- package/dist/avatars-GU3Y4XOC.js +0 -38
- package/dist/bid-pricing-YX7KBO4X.js +0 -98
- package/dist/bid-pricing-YX7KBO4X.js.map +0 -1
- package/dist/brand-BSHSRHJQ.js +0 -22
- package/dist/brief-FLTD3CLU.js +0 -490
- package/dist/businesses-FBQ6IUKN.js +0 -53
- package/dist/campaign-groups-RJGITKJK.js +0 -94
- package/dist/campaign-groups-RJGITKJK.js.map +0 -1
- package/dist/campaign-writes-I5RHB3RP.js +0 -164
- package/dist/campaign-writes-I5RHB3RP.js.map +0 -1
- package/dist/campaign-writes-QK7MURJO.js +0 -170
- package/dist/campaigns-45E622KG.js +0 -108
- package/dist/campaigns-45E622KG.js.map +0 -1
- package/dist/campaigns-BXUZBNMA.js +0 -107
- package/dist/campaigns-DPM2OYUO.js +0 -76
- package/dist/campaigns-U7PKWQ4D.js +0 -110
- package/dist/canvas-DYPGE54A.js +0 -46
- package/dist/canvas-DYPGE54A.js.map +0 -1
- package/dist/capabilities-636HORHD.js +0 -143
- package/dist/capabilities-636HORHD.js.map +0 -1
- package/dist/cards-7Z2DWU5I.js +0 -85
- package/dist/catalog-CHJ2Q2PJ.js +0 -65
- package/dist/catalog-CHJ2Q2PJ.js.map +0 -1
- package/dist/catalogs-3BOYSNNA.js +0 -128
- package/dist/changes-IZQBOFYT.js +0 -135
- package/dist/chatgpt-FEWVJAX7.js +0 -47
- package/dist/chats-7DB3YXZI.js +0 -261
- package/dist/chats-7DB3YXZI.js.map +0 -1
- package/dist/chunk-2ALS4WHZ.js +0 -19
- package/dist/chunk-2EXHUVZR.js +0 -75
- package/dist/chunk-2FPJPDMF.js +0 -133
- package/dist/chunk-2JWNUPSQ.js +0 -74
- package/dist/chunk-2PADYR7B.js +0 -25
- package/dist/chunk-2QITB55L.js +0 -382
- package/dist/chunk-2UKGYHQ7.js +0 -592
- package/dist/chunk-2V3ITJHT.js +0 -337
- package/dist/chunk-3QLACKNX.js +0 -310
- package/dist/chunk-3V6GGH2A.js +0 -23
- package/dist/chunk-42NVYJLD.js +0 -1711
- package/dist/chunk-42NVYJLD.js.map +0 -1
- package/dist/chunk-4LIZR7ZU.js +0 -103
- package/dist/chunk-57AIBUS5.js +0 -541
- package/dist/chunk-63LJAQ4E.js +0 -197
- package/dist/chunk-6B7YNXNH.js +0 -106
- package/dist/chunk-7H6TNG52.js +0 -74
- package/dist/chunk-7JB56IVP.js +0 -215
- package/dist/chunk-7JB56IVP.js.map +0 -1
- package/dist/chunk-7MF7QI7M.js +0 -1830
- package/dist/chunk-A3DD32YL.js +0 -166
- package/dist/chunk-AA5SMYM5.js +0 -66
- package/dist/chunk-ADUQKLUO.js +0 -622
- package/dist/chunk-AGPC6VQW.js +0 -486
- package/dist/chunk-AHZTZWGL.js +0 -42
- package/dist/chunk-APWZR7EN.js +0 -4410
- package/dist/chunk-BH3B2E7H.js +0 -296
- package/dist/chunk-BOCJWQAZ.js +0 -23992
- package/dist/chunk-BQHFH3SY.js +0 -76
- package/dist/chunk-BTXO66MR.js +0 -172
- package/dist/chunk-C26QSQXP.js +0 -57
- package/dist/chunk-C5USYCM2.js +0 -97
- package/dist/chunk-CBSPF5D5.js +0 -96
- package/dist/chunk-CKAW37VB.js +0 -188
- package/dist/chunk-CKI377AO.js +0 -1442
- package/dist/chunk-CT4JJID6.js +0 -275
- package/dist/chunk-DFWBCUKH.js +0 -136
- package/dist/chunk-DLHGITJE.js +0 -56
- package/dist/chunk-DS4RB7DZ.js +0 -274
- package/dist/chunk-E2LFVEXF.js +0 -6667
- package/dist/chunk-EGOVBOSI.js +0 -172
- package/dist/chunk-F3L7HWPC.js +0 -474
- package/dist/chunk-FHZ3NNIF.js +0 -1599
- package/dist/chunk-FSLHYTEK.js +0 -225
- package/dist/chunk-GBEKM22P.js +0 -98
- package/dist/chunk-GKKZOYMM.js +0 -51
- package/dist/chunk-GQBXGF5Y.js +0 -26
- package/dist/chunk-GRUGYDLA.js +0 -106
- package/dist/chunk-HHLEPWHB.js +0 -433
- package/dist/chunk-HPRAIQC4.js +0 -363
- package/dist/chunk-IEFMPAUE.js +0 -533
- package/dist/chunk-IHKFFI5N.js +0 -67
- package/dist/chunk-ILOSW2RZ.js +0 -96
- package/dist/chunk-ISHQJJME.js +0 -160
- package/dist/chunk-IUIL2GS5.js +0 -191
- package/dist/chunk-JA7HGQEZ.js +0 -304
- package/dist/chunk-JM6XT33N.js +0 -1079
- package/dist/chunk-JM6XT33N.js.map +0 -1
- package/dist/chunk-JPHEN5YK.js +0 -5189
- package/dist/chunk-JPHEN5YK.js.map +0 -1
- package/dist/chunk-KUVDKRO5.js +0 -45
- package/dist/chunk-L4BUFJJ2.js +0 -149
- package/dist/chunk-L5EUPFB2.js +0 -819
- package/dist/chunk-L5EUPFB2.js.map +0 -1
- package/dist/chunk-LVWAXZT7.js +0 -494
- package/dist/chunk-M6IGLMHM.js +0 -125
- package/dist/chunk-MEBOQXW3.js +0 -2063
- package/dist/chunk-MEBOQXW3.js.map +0 -1
- package/dist/chunk-NGQ42WMB.js +0 -207
- package/dist/chunk-NHIZMRX6.js +0 -346
- package/dist/chunk-NUEKCA56.js +0 -92
- package/dist/chunk-OG36TTW5.js +0 -31
- package/dist/chunk-OG36TTW5.js.map +0 -1
- package/dist/chunk-OON5SC7P.js +0 -94
- package/dist/chunk-OQCDLFGJ.js +0 -84
- package/dist/chunk-OXXAZEQI.js +0 -84
- package/dist/chunk-P5NYZ236.js +0 -214
- package/dist/chunk-P5NYZ236.js.map +0 -1
- package/dist/chunk-PFYZBCA4.js +0 -55
- package/dist/chunk-PL5MOERB.js +0 -58
- package/dist/chunk-PM7ZSDKG.js +0 -98
- package/dist/chunk-PUG75EC5.js +0 -35
- package/dist/chunk-QFDHEXRF.js +0 -455
- package/dist/chunk-R7DHZDYT.js +0 -333
- package/dist/chunk-RADMQU7S.js +0 -74
- package/dist/chunk-SD5GDVDI.js +0 -309
- package/dist/chunk-TFWB4PS5.js +0 -175
- package/dist/chunk-UBNR5S46.js +0 -665
- package/dist/chunk-UFHU3TFN.js +0 -46
- package/dist/chunk-UYMOAPIT.js +0 -297
- package/dist/chunk-VU2WGGWL.js +0 -509
- package/dist/chunk-WDXL7PXC.js +0 -610
- package/dist/chunk-WIKXOHJD.js +0 -174
- package/dist/chunk-WJZSPX6Z.js +0 -60
- package/dist/chunk-WRJZTAKV.js +0 -65
- package/dist/chunk-X3L462AI.js +0 -111
- package/dist/chunk-X5WZXHYF.js +0 -139
- package/dist/chunk-X7ZODEXJ.js +0 -36
- package/dist/chunk-X7ZODEXJ.js.map +0 -1
- package/dist/chunk-XGTOFEH6.js +0 -76
- package/dist/chunk-XMS5K54U.js +0 -454
- package/dist/chunk-XMS5K54U.js.map +0 -1
- package/dist/chunk-XX5DXKEI.js +0 -206
- package/dist/chunk-YY42OVVE.js +0 -846
- package/dist/chunk-YYFPOCNK.js +0 -3153
- package/dist/chunk-YYFPOCNK.js.map +0 -1
- package/dist/chunk-ZEJ6UCGE.js +0 -169
- package/dist/chunk-ZJVHZHYP.js +0 -6188
- package/dist/chunk-ZOC5FS5U.js +0 -159
- package/dist/chunk-ZVWLMEJQ.js +0 -136
- package/dist/claim-YCD6YDF7.js +0 -196
- package/dist/claim-YCD6YDF7.js.map +0 -1
- package/dist/client-BXYW3T2E.js +0 -19
- package/dist/code-YKSM3KES.js +0 -76
- package/dist/companies-KSO3LCFR.js +0 -194
- package/dist/companies-KSO3LCFR.js.map +0 -1
- package/dist/complete-CZZYXJP6.js +0 -80
- package/dist/complete-CZZYXJP6.js.map +0 -1
- package/dist/config-A2TUVNCZ.js +0 -88
- package/dist/connect-X3KSG72E.js +0 -41
- package/dist/content-LYWIFOUV.js +0 -85
- package/dist/conversation-VLP6APUN.js +0 -92
- package/dist/conversation-VLP6APUN.js.map +0 -1
- package/dist/conversion-report-QV4BSEIK.js +0 -125
- package/dist/conversion-upload-command-QZWA525U.js +0 -438
- package/dist/conversion-writes-EPEKU44W.js +0 -120
- package/dist/conversions-A473X2GF.js +0 -76
- package/dist/conversions-DAEDLIAC.js +0 -134
- package/dist/conversions-DAEDLIAC.js.map +0 -1
- package/dist/countries-AVHXOUE3.js +0 -82
- package/dist/create-FLULHZK6.js +0 -234
- package/dist/create-FLULHZK6.js.map +0 -1
- package/dist/create-HNNKT3MX.js +0 -129
- package/dist/create-HNNKT3MX.js.map +0 -1
- package/dist/create-PIFBLBNC.js +0 -58
- package/dist/create-PIFBLBNC.js.map +0 -1
- package/dist/create-ZN5VDZ2B.js +0 -206
- package/dist/create-ZN5VDZ2B.js.map +0 -1
- package/dist/creatives-7HNRUPTV.js +0 -87
- package/dist/creatives-KAOWBTJL.js +0 -51
- package/dist/creatives-Y44TWEDT.js +0 -181
- package/dist/creatives-Y44TWEDT.js.map +0 -1
- package/dist/credentials-3ASHHQ2Y.js +0 -286
- package/dist/credentials-3ASHHQ2Y.js.map +0 -1
- package/dist/critique-Q2UC7WJR.js +0 -1448
- package/dist/critique-Q2UC7WJR.js.map +0 -1
- package/dist/critique-XKJ3EH2Z.js +0 -212
- package/dist/critique-XKJ3EH2Z.js.map +0 -1
- package/dist/crm-HEMYBFZJ.js +0 -317
- package/dist/crm-HEMYBFZJ.js.map +0 -1
- package/dist/crm-NPA3DAE5.js +0 -223
- package/dist/crm-NPA3DAE5.js.map +0 -1
- package/dist/crop-KEEGCMCE.js +0 -113
- package/dist/currency-XUW72I27.js +0 -88
- package/dist/custom-conversions-VN7Q5YUE.js +0 -125
- package/dist/customers-3GJY3SIW.js +0 -55
- package/dist/delete-2DBJID6M.js +0 -62
- package/dist/delete-2DBJID6M.js.map +0 -1
- package/dist/delete-7DVBDHCH.js +0 -53
- package/dist/delete-7DVBDHCH.js.map +0 -1
- package/dist/delete-BHQPYWZW.js +0 -71
- package/dist/delete-DNYYWG7S.js +0 -71
- package/dist/delete-IE2DCBO5.js +0 -69
- package/dist/delete-L572W4QM.js +0 -65
- package/dist/delete-L572W4QM.js.map +0 -1
- package/dist/demographics-O4CAQOI7.js +0 -137
- package/dist/demographics-O4CAQOI7.js.map +0 -1
- package/dist/describe-H3IQIO4V.js +0 -97
- package/dist/describe-ODA4NHF4.js +0 -97
- package/dist/dimensions-N43FKZX5.js +0 -101
- package/dist/discard-UX3IUCMG.js +0 -65
- package/dist/discard-UX3IUCMG.js.map +0 -1
- package/dist/discover-2AT6L4NZ.js +0 -93
- package/dist/discover-O5UOLCAD.js +0 -172
- package/dist/domain-5S5FGZJQ.js +0 -97
- package/dist/domain-5S5FGZJQ.js.map +0 -1
- package/dist/download-CUZEM54U.js +0 -299
- package/dist/draft-7LJJT4AU.js +0 -307
- package/dist/draft-HKCTL5LG.js +0 -216
- package/dist/draft-HKCTL5LG.js.map +0 -1
- package/dist/draft-JFZUQDZB.js +0 -305
- package/dist/draft-JFZUQDZB.js.map +0 -1
- package/dist/draft-L5W4U4G3.js +0 -281
- package/dist/draft-QVCJ6HEN.js +0 -103
- package/dist/draft-SM2UDAQP.js +0 -100
- package/dist/draft-YIFSGRVM.js +0 -233
- package/dist/draft-YIJSDK6G.js +0 -327
- package/dist/draft-YIJSDK6G.js.map +0 -1
- package/dist/env-KSXDUMV4.js +0 -43
- package/dist/experiment-I7PFP6NQ.js +0 -1397
- package/dist/export-VDG47LTK.js +0 -168
- package/dist/extract-CHQICMI3.js +0 -113
- package/dist/facets-JUN7Y6CV.js +0 -113
- package/dist/facets-JUN7Y6CV.js.map +0 -1
- package/dist/favorites-UC7TPXXK.js +0 -178
- package/dist/feed-HDP37IX5.js +0 -177
- package/dist/feedback-V4GWOQ4N.js +0 -66
- package/dist/feedback-record-DEFSVMB4.js +0 -174
- package/dist/feedback-record-DEFSVMB4.js.map +0 -1
- package/dist/fetch-6ZSWMQVO.js +0 -139
- package/dist/fetch-PA2CB4CF.js +0 -175
- package/dist/fetch-PA2CB4CF.js.map +0 -1
- package/dist/find-WZNJQH6H.js +0 -134
- package/dist/fit-57N46PVZ.js +0 -45
- package/dist/flows-W5FFVCQH.js +0 -246
- package/dist/flows-W5FFVCQH.js.map +0 -1
- package/dist/follow-VHC5W6JQ.js +0 -94
- package/dist/follow-competitors-4BB4SYX6.js +0 -112
- package/dist/following-4OW7BFMR.js +0 -113
- package/dist/fonts-DBSTYF25.js +0 -33
- package/dist/forecast-HB45NEE6.js +0 -168
- package/dist/forecast-THYRAGYA.js +0 -103
- package/dist/forecast-THYRAGYA.js.map +0 -1
- package/dist/funding-O7EO6BXX.js +0 -85
- package/dist/funnel-HUXMDVGQ.js +0 -393
- package/dist/funnel-HUXMDVGQ.js.map +0 -1
- package/dist/ga4-QSZJBPYT.js +0 -55
- package/dist/generate-MW3LCEZA.js +0 -262
- package/dist/get-2TFUDEXB.js +0 -61
- package/dist/get-3WRPM3ZH.js +0 -92
- package/dist/get-FEJ4JSTW.js +0 -55
- package/dist/get-FEJ4JSTW.js.map +0 -1
- package/dist/get-GYV6VBQ4.js +0 -77
- package/dist/get-GYV6VBQ4.js.map +0 -1
- package/dist/get-RA46XQ4O.js +0 -59
- package/dist/get-RPPCUPLR.js +0 -63
- package/dist/get-RXC5LHHX.js +0 -63
- package/dist/gif-UTHNVWGB.js +0 -94
- package/dist/google-7M6QFGYK.js +0 -3190
- package/dist/google-A4PE52FJ.js +0 -136
- package/dist/google-ads-WWIZU2YR.js +0 -194
- package/dist/google-ads-WWIZU2YR.js.map +0 -1
- package/dist/group-ENDPRS2F.js +0 -43
- package/dist/group-QTPCHG4J.js +0 -43
- package/dist/gsc-4256M4IF.js +0 -30
- package/dist/history-BET6WSKX.js +0 -67
- package/dist/history-RBND7B7U.js +0 -132
- package/dist/history-RBND7B7U.js.map +0 -1
- package/dist/hubspot-62XB7FRY.js +0 -778
- package/dist/hubspot-62XB7FRY.js.map +0 -1
- package/dist/icon-6A6LUSTL.js +0 -137
- package/dist/ideas-FDZWVTRA.js +0 -31
- package/dist/images-OG37OSCH.js +0 -90
- package/dist/improve-2GF6J5PW.js +0 -86
- package/dist/ingest-FU5MWL4F.js +0 -106
- package/dist/ingest-FU5MWL4F.js.map +0 -1
- package/dist/ingest-MMKVJOJC.js +0 -22
- package/dist/insights-DL5WUM75.js +0 -423
- package/dist/insights-MXMJVTHU.js +0 -122
- package/dist/inspect-XTQIQYKU.js +0 -188
- package/dist/inspect-XTQIQYKU.js.map +0 -1
- package/dist/inspiration-JEVOJQ3L.js +0 -53
- package/dist/intent-Z4DGVPFT.js +0 -95
- package/dist/job-IM47QNLP.js +0 -202
- package/dist/job-create-A3ZCZHTF.js +0 -109
- package/dist/job-status-TE7AVTFZ.js +0 -74
- package/dist/keep-GJW7UPZG.js +0 -78
- package/dist/keyword-gap-6VUCYWBG.js +0 -130
- package/dist/keyword-metrics-GZYE6KU6.js +0 -196
- package/dist/keyword-metrics-GZYE6KU6.js.map +0 -1
- package/dist/keywords-for-site-Z3LDMGDW.js +0 -127
- package/dist/keywords-for-site-Z3LDMGDW.js.map +0 -1
- package/dist/landing-FNE5I73U.js +0 -28
- package/dist/landings-U3DAXGGO.js +0 -151
- package/dist/languages-KEB6NUWX.js +0 -55
- package/dist/languages-R2GM7DRZ.js +0 -40
- package/dist/launches-DWNIU67A.js +0 -108
- package/dist/layerize-4BG3ROAK.js +0 -190
- package/dist/leads-NC6XYOVL.js +0 -89
- package/dist/leads-NC6XYOVL.js.map +0 -1
- package/dist/leads-NR4B5TWO.js +0 -293
- package/dist/learn-K7RCNMUR.js +0 -202
- package/dist/learn-K7RCNMUR.js.map +0 -1
- package/dist/library-CZQAZMTR.js +0 -109
- package/dist/lighthouse-TKIDZ6FU.js +0 -75
- package/dist/line-item-writes-J4DHCNFB.js +0 -207
- package/dist/line-item-writes-J4DHCNFB.js.map +0 -1
- package/dist/line-items-JLVCJNNN.js +0 -103
- package/dist/link-MAQIE3NL.js +0 -63
- package/dist/link-MAQIE3NL.js.map +0 -1
- package/dist/linkedin-A5H5FYH5.js +0 -1007
- package/dist/linkedin-A5H5FYH5.js.map +0 -1
- package/dist/list-5MOWKPJL.js +0 -62
- package/dist/list-5MOWKPJL.js.map +0 -1
- package/dist/list-5WOBVJI5.js +0 -50
- package/dist/list-HZVLV22J.js +0 -76
- package/dist/list-MKU4LM6C.js +0 -65
- package/dist/list-NGYIN633.js +0 -57
- package/dist/list-PMZEGLOB.js +0 -302
- package/dist/list-PMZEGLOB.js.map +0 -1
- package/dist/list-PO6WU7IE.js +0 -150
- package/dist/list-PO6WU7IE.js.map +0 -1
- package/dist/list-Q6X5QJGP.js +0 -51
- package/dist/locations-GOBN3Z6I.js +0 -67
- package/dist/locations-V5XI33WW.js +0 -40
- package/dist/log-OTN4AQVV.js +0 -91
- package/dist/log-OTN4AQVV.js.map +0 -1
- package/dist/logo-B3BROQTR.js +0 -18
- package/dist/lookup-ELKCXYYH.js +0 -22
- package/dist/make-7PBN4XH5.js +0 -633
- package/dist/map-4OMNZZCB.js +0 -403
- package/dist/map-4OMNZZCB.js.map +0 -1
- package/dist/mcp-2APSGDW2.js +0 -462
- package/dist/mcp-2APSGDW2.js.map +0 -1
- package/dist/media-HQQAIZ7Z.js +0 -89
- package/dist/media-MQEFN2X4.js +0 -15
- package/dist/media-sources-RC3M2GXS.js +0 -32
- package/dist/members-QFSX6C7J.js +0 -43
- package/dist/members-QFSX6C7J.js.map +0 -1
- package/dist/meta-VNSOJT2K.js +0 -69
- package/dist/metrics-I7DWALMY.js +0 -152
- package/dist/models-RA2AG5BF.js +0 -155
- package/dist/normalize-2NVCXQ37.js +0 -140
- package/dist/normalize-2NVCXQ37.js.map +0 -1
- package/dist/normalize-A4QEXI4A.js +0 -806
- package/dist/options-HWSPFDQS.js +0 -120
- package/dist/options-HWSPFDQS.js.map +0 -1
- package/dist/output-K3YC2VGS.js +0 -24
- package/dist/page-XIJYCQK7.js +0 -105
- package/dist/pages-TNSVU5UF.js +0 -66
- package/dist/performance-6UNRPB4I.js +0 -23
- package/dist/pinterest-TLIBSYI5.js +0 -96
- package/dist/pixels-5B54NNYI.js +0 -108
- package/dist/pixels-D6RDUTYK.js +0 -60
- package/dist/plan-D5TFL44K.js +0 -207
- package/dist/preview-26CQNU3Z.js +0 -169
- package/dist/profile-RMQLPWMA.js +0 -150
- package/dist/promoted-tweet-writes-VROU5LWA.js +0 -179
- package/dist/promoted-tweet-writes-VROU5LWA.js.map +0 -1
- package/dist/promoted-tweets-S5JU3YEQ.js +0 -119
- package/dist/properties-F4NOIWYV.js +0 -101
- package/dist/publish-VA7XYF53.js +0 -321
- package/dist/publish-VA7XYF53.js.map +0 -1
- package/dist/query-3OPJCQFR.js +0 -61
- package/dist/query-LGNJDNPQ.js +0 -236
- package/dist/query-P4NMXUCE.js +0 -247
- package/dist/questionnaire-VXOGMJPP.js +0 -93
- package/dist/read-S3IS5ELE.js +0 -141
- package/dist/reddit-UTK4I4ZR.js +0 -25
- package/dist/refresh-NHFO5K3S.js +0 -93
- package/dist/refresh-NHFO5K3S.js.map +0 -1
- package/dist/release-EDEXWTQW.js +0 -59
- package/dist/release-EDEXWTQW.js.map +0 -1
- package/dist/relevant-pages-U5TXNLRY.js +0 -99
- package/dist/remove-QKOA7OVP.js +0 -49
- package/dist/remove-QKOA7OVP.js.map +0 -1
- package/dist/remove-WLRCQ74R.js +0 -48
- package/dist/reopen-54LSJFEI.js +0 -62
- package/dist/reopen-54LSJFEI.js.map +0 -1
- package/dist/rerun-ERLTGGT7.js +0 -84
- package/dist/research-4L5YDUDW.js +0 -62
- package/dist/research-X6IMXIEY.js +0 -261
- package/dist/research-X6IMXIEY.js.map +0 -1
- package/dist/reset-FU3GHUVJ.js +0 -53
- package/dist/reset-FU3GHUVJ.js.map +0 -1
- package/dist/reset-W4A2IMMX.js +0 -53
- package/dist/reset-W4A2IMMX.js.map +0 -1
- package/dist/resolve-3CTFESC5.js +0 -120
- package/dist/resolve-3CTFESC5.js.map +0 -1
- package/dist/retry-MYFWCIBM.js +0 -61
- package/dist/retry-MYFWCIBM.js.map +0 -1
- package/dist/retry-OWIEZTYH.js +0 -59
- package/dist/retry-OWIEZTYH.js.map +0 -1
- package/dist/retry-failed-3SLSEM4Z.js +0 -45
- package/dist/run-OST3DNFM.js +0 -64
- package/dist/run-OST3DNFM.js.map +0 -1
- package/dist/run-ZS7PLDOC.js +0 -59
- package/dist/scaffold-ad-TYJYCYNZ.js +0 -1548
- package/dist/scaffold-static-ad-JDFQZQJZ.js +0 -971
- package/dist/scaffold-video-KWVKJ3HA.js +0 -872
- package/dist/schedule-QAHB3Y2O.js +0 -66
- package/dist/schedule-URRPR56A.js +0 -60
- package/dist/schedule-URRPR56A.js.map +0 -1
- package/dist/scheduled-agents-INTHKJBU.js +0 -49
- package/dist/schema-LT2KTCFM.js +0 -63
- package/dist/schema-VKBHCQL2.js +0 -131
- package/dist/schema-VKBHCQL2.js.map +0 -1
- package/dist/scrape-F5T4K3MK.js +0 -2241
- package/dist/screenshot-3JZC7Z67.js +0 -102
- package/dist/search-2WC3UPL5.js +0 -92
- package/dist/search-4SGU4GCP.js +0 -26
- package/dist/search-EITER7HD.js +0 -91
- package/dist/search-GYGMCTB4.js +0 -224
- package/dist/search-HTLQTVXW.js +0 -173
- package/dist/search-HTLQTVXW.js.map +0 -1
- package/dist/search-copy-JIO572AF.js +0 -168
- package/dist/seeds-474K2XDK.js +0 -101
- package/dist/select-DNRMPKZP.js +0 -93
- package/dist/select-DNRMPKZP.js.map +0 -1
- package/dist/sends-IWIJVLGL.js +0 -309
- package/dist/sequences-DEIQSLPE.js +0 -146
- package/dist/set-prompt-BX37FBPT.js +0 -185
- package/dist/setup-links-JSL4UTBN.js +0 -140
- package/dist/setup-links-JSL4UTBN.js.map +0 -1
- package/dist/shared-OISI2KXV.js +0 -31
- package/dist/site-5MNVXSQK.js +0 -176
- package/dist/site-5MNVXSQK.js.map +0 -1
- package/dist/sitemaps-UMN746L7.js +0 -87
- package/dist/sites-YWCNJKWH.js +0 -101
- package/dist/skills-L3MZYGPS.js +0 -47
- package/dist/sources-2N5AKUOK.js +0 -420
- package/dist/sources-2N5AKUOK.js.map +0 -1
- package/dist/sources-ZSTG7NBI.js +0 -30
- package/dist/stale-DZCKGBFJ.js +0 -62
- package/dist/stale-DZCKGBFJ.js.map +0 -1
- package/dist/stats-7PNJ7SKK.js +0 -34
- package/dist/status-DG3X3JBU.js +0 -61
- package/dist/status-DG3X3JBU.js.map +0 -1
- package/dist/sticker-KA4OXYBO.js +0 -94
- package/dist/stock-LGSP7IXN.js +0 -179
- package/dist/studio-B5FDSSQE.js +0 -49
- package/dist/sync-APSFLJNV.js +0 -265
- package/dist/sync-ELM5NIQC.js +0 -53
- package/dist/sync-ELM5NIQC.js.map +0 -1
- package/dist/sync-EZUU5CS6.js +0 -54
- package/dist/sync-definition-LWUPVL2B.js +0 -52
- package/dist/tag-manager-4MPS25IR.js +0 -43
- package/dist/tags-AZCP34VZ.js +0 -19
- package/dist/tags-AZCP34VZ.js.map +0 -1
- package/dist/tags-FNN6L76N.js +0 -19
- package/dist/tags-FNN6L76N.js.map +0 -1
- package/dist/tags-I7F2EAXC.js +0 -19
- package/dist/tags-I7F2EAXC.js.map +0 -1
- package/dist/tags-PCROPKPP.js +0 -26
- package/dist/tags-VX2RZFI4.js +0 -223
- package/dist/tags-VX2RZFI4.js.map +0 -1
- package/dist/targeting-constants-SVN4QBNE.js +0 -118
- package/dist/targeting-criteria-QRVVJOJ4.js +0 -113
- package/dist/targets-RL4CMEEK.js +0 -101
- package/dist/targets-RL4CMEEK.js.map +0 -1
- package/dist/templates-5D3V4CXO.js +0 -177
- package/dist/templates-5D3V4CXO.js.map +0 -1
- package/dist/testimonials-KVV2NRB5.js +0 -32
- package/dist/themes-2W6UGTJY.js +0 -94
- package/dist/top-companies-CAN7RF7D.js +0 -107
- package/dist/top-companies-CAN7RF7D.js.map +0 -1
- package/dist/translate-NWFA5WJN.js +0 -597
- package/dist/translate-NWFA5WJN.js.map +0 -1
- package/dist/triggers-ANT3DGS4.js +0 -140
- package/dist/triggers-ANT3DGS4.js.map +0 -1
- package/dist/tweets-ADMGPZRH.js +0 -123
- package/dist/unfollow-TYUSXUQQ.js +0 -46
- package/dist/unlink-MI6QLZUD.js +0 -66
- package/dist/unlink-MI6QLZUD.js.map +0 -1
- package/dist/unstage-OFOWKW64.js +0 -95
- package/dist/unstage-RR6QKT22.js +0 -83
- package/dist/unstage-RR6QKT22.js.map +0 -1
- package/dist/update-6EDQKTT2.js +0 -97
- package/dist/update-6EDQKTT2.js.map +0 -1
- package/dist/update-IG7FMLB4.js +0 -141
- package/dist/update-IG7FMLB4.js.map +0 -1
- package/dist/update-MJJI7XUK.js +0 -62
- package/dist/update-MJJI7XUK.js.map +0 -1
- package/dist/update-YYOHKJFX.js +0 -154
- package/dist/update-YYOHKJFX.js.map +0 -1
- package/dist/upload-ENXZGIAJ.js +0 -150
- package/dist/upload-KG55HYJK.js +0 -125
- package/dist/upload-KG55HYJK.js.map +0 -1
- package/dist/upscale-BCSYBSCB.js +0 -109
- package/dist/url-options-E5Q2WWRL.js +0 -130
- package/dist/url-params-I2DUA2FO.js +0 -97
- package/dist/url-params-I2DUA2FO.js.map +0 -1
- package/dist/use-7GBWO7MR.js +0 -95
- package/dist/validate-R7GH6M2W.js +0 -88
- package/dist/variant-2MOZ3ADI.js +0 -338
- package/dist/videos-SNZVL5VK.js +0 -39
- package/dist/view-SI4E4SPJ.js +0 -121
- package/dist/viewer-check-YHWBQRQ7.js +0 -69
- package/dist/web-IU5Y5RGZ.js +0 -139
- package/dist/web-IU5Y5RGZ.js.map +0 -1
- package/dist/winners-WJVKPYEK.js +0 -113
- package/dist/winning-ads-D73T7RFL.js +0 -84
- package/dist/winning-ads-D73T7RFL.js.map +0 -1
- package/dist/write-commands-3IORA667.js +0 -737
- package/dist/write-commands-D6SE24DE.js +0 -206
- package/dist/write-commands-MQ3SX7DK.js +0 -1014
- package/dist/write-commands-MQ3SX7DK.js.map +0 -1
- package/dist/write-commands-VXSFTWJU.js +0 -713
- package/dist/x-PFPOXRTL.js +0 -47
- /package/dist/{account-7IPMMAWC.js.map → account-HZC6X2PH.js.map} +0 -0
- /package/dist/{account-OG2O3MUX.js.map → account-MLX2MQTO.js.map} +0 -0
- /package/dist/{account-reads-32G6NU63.js.map → account-reads-FCETXYI7.js.map} +0 -0
- /package/dist/{account-writes-UHUNPVS6.js.map → account-writes-UNVXSLMV.js.map} +0 -0
- /package/dist/{accounts-CX46D2TB.js.map → accounts-4P54UY6F.js.map} +0 -0
- /package/dist/{accounts-NS7L5EZX.js.map → accounts-6UNBLIUH.js.map} +0 -0
- /package/dist/{accounts-L2EPDW2W.js.map → accounts-GVTZN4VE.js.map} +0 -0
- /package/dist/{actions-JM4A4NEL.js.map → actions-MEKXFKDN.js.map} +0 -0
- /package/dist/{active-entities-6W5YOGNN.js.map → active-entities-UGHMVRWH.js.map} +0 -0
- /package/dist/{activities-52LTJRU4.js.map → activities-2J7FTZMN.js.map} +0 -0
- /package/dist/{ad-group-writes-MABCQHMC.js.map → ad-group-writes-2YEZNT5Q.js.map} +0 -0
- /package/dist/{ad-groups-I3DBQZTM.js.map → ad-groups-YXVIPI7B.js.map} +0 -0
- /package/dist/{ad-writes-E4R3IK4N.js.map → ad-writes-HBNG55VT.js.map} +0 -0
- /package/dist/{add-3D7VASJ2.js.map → add-2FHPLALV.js.map} +0 -0
- /package/dist/{add-OLDNWEK7.js.map → add-JP76KCCY.js.map} +0 -0
- /package/dist/{add-accounts-EVOMXIHE.js.map → add-accounts-M5Y4DQFM.js.map} +0 -0
- /package/dist/{ads-N2AHRG74.js.map → ads-DB5NDHX5.js.map} +0 -0
- /package/dist/{ads-XT454DCT.js.map → ads-NDV3GOIW.js.map} +0 -0
- /package/dist/{ads-DKQGSCGF.js.map → ads-QBXR7IPO.js.map} +0 -0
- /package/dist/{ads-FBOR4DMY.js.map → ads-W2IPUWHQ.js.map} +0 -0
- /package/dist/{adsets-7F5VJB7A.js.map → adsets-PY5ZKGBO.js.map} +0 -0
- /package/dist/{advertisers-ZTK74NII.js.map → advertisers-BVAZ4XUX.js.map} +0 -0
- /package/dist/{animate-32L3BPTL.js.map → animate-QEHFEQHZ.js.map} +0 -0
- /package/dist/{audiences-YQZHWY2K.js.map → audiences-NTT3HZN7.js.map} +0 -0
- /package/dist/{audiences-5KVPPV5T.js.map → audiences-QWJ34WIW.js.map} +0 -0
- /package/dist/{audiences-M2O5NS4O.js.map → audiences-UUIYQFS6.js.map} +0 -0
- /package/dist/{audit-JTISKWXM.js.map → audit-OWXTLQC4.js.map} +0 -0
- /package/dist/{avatars-GU3Y4XOC.js.map → avatars-3PC7FTU3.js.map} +0 -0
- /package/dist/{brand-BSHSRHJQ.js.map → brand-XVXQ7VAU.js.map} +0 -0
- /package/dist/{brief-FLTD3CLU.js.map → brief-SZSPXGG4.js.map} +0 -0
- /package/dist/{businesses-FBQ6IUKN.js.map → businesses-ZH67AXR6.js.map} +0 -0
- /package/dist/{campaign-writes-QK7MURJO.js.map → campaign-writes-4N3LQJL2.js.map} +0 -0
- /package/dist/{campaigns-DPM2OYUO.js.map → campaigns-5FH5THMS.js.map} +0 -0
- /package/dist/{campaigns-U7PKWQ4D.js.map → campaigns-66OOGMDW.js.map} +0 -0
- /package/dist/{campaigns-BXUZBNMA.js.map → campaigns-QUQQYMIO.js.map} +0 -0
- /package/dist/{cards-7Z2DWU5I.js.map → cards-RSMTBND3.js.map} +0 -0
- /package/dist/{catalogs-3BOYSNNA.js.map → catalogs-3IYC53GK.js.map} +0 -0
- /package/dist/{changes-IZQBOFYT.js.map → changes-U263PWVD.js.map} +0 -0
- /package/dist/{chatgpt-FEWVJAX7.js.map → chatgpt-O64OJE6R.js.map} +0 -0
- /package/dist/{chunk-UFHU3TFN.js.map → chunk-35ENAFJX.js.map} +0 -0
- /package/dist/{chunk-NGQ42WMB.js.map → chunk-3KIH22M7.js.map} +0 -0
- /package/dist/{chunk-CKI377AO.js.map → chunk-4FCLXJYW.js.map} +0 -0
- /package/dist/{chunk-JA7HGQEZ.js.map → chunk-4OSBBGG5.js.map} +0 -0
- /package/dist/{chunk-PM7ZSDKG.js.map → chunk-57UECM77.js.map} +0 -0
- /package/dist/{chunk-QFDHEXRF.js.map → chunk-5Q3XCLMS.js.map} +0 -0
- /package/dist/{chunk-DFWBCUKH.js.map → chunk-65BQAJMH.js.map} +0 -0
- /package/dist/{chunk-2EXHUVZR.js.map → chunk-6GFJFTG6.js.map} +0 -0
- /package/dist/{chunk-ISHQJJME.js.map → chunk-6GKC2PBR.js.map} +0 -0
- /package/dist/{chunk-XGTOFEH6.js.map → chunk-6HPIWZHS.js.map} +0 -0
- /package/dist/{chunk-WDXL7PXC.js.map → chunk-73B3RQJC.js.map} +0 -0
- /package/dist/{chunk-3QLACKNX.js.map → chunk-7MQVCSA7.js.map} +0 -0
- /package/dist/{chunk-GQBXGF5Y.js.map → chunk-7NTION5F.js.map} +0 -0
- /package/dist/{chunk-7MF7QI7M.js.map → chunk-AQ4HEXUH.js.map} +0 -0
- /package/dist/{chunk-F3L7HWPC.js.map → chunk-AUWN3C2K.js.map} +0 -0
- /package/dist/{chunk-LVWAXZT7.js.map → chunk-B3SPFCKC.js.map} +0 -0
- /package/dist/{chunk-M6IGLMHM.js.map → chunk-CBCGVPHB.js.map} +0 -0
- /package/dist/{chunk-R7DHZDYT.js.map → chunk-CECS3DHZ.js.map} +0 -0
- /package/dist/{chunk-UBNR5S46.js.map → chunk-CHFKTRB5.js.map} +0 -0
- /package/dist/{chunk-IHKFFI5N.js.map → chunk-D24DJ7DB.js.map} +0 -0
- /package/dist/{chunk-C5USYCM2.js.map → chunk-D5MF337I.js.map} +0 -0
- /package/dist/{chunk-FSLHYTEK.js.map → chunk-DLUWHZCE.js.map} +0 -0
- /package/dist/{chunk-GKKZOYMM.js.map → chunk-ECBHE5S6.js.map} +0 -0
- /package/dist/{chunk-X3L462AI.js.map → chunk-EXZ2NIKX.js.map} +0 -0
- /package/dist/{chunk-ILOSW2RZ.js.map → chunk-F3FSD6BO.js.map} +0 -0
- /package/dist/{chunk-3V6GGH2A.js.map → chunk-F5XU546T.js.map} +0 -0
- /package/dist/{chunk-PUG75EC5.js.map → chunk-G3KO2HFZ.js.map} +0 -0
- /package/dist/{chunk-A3DD32YL.js.map → chunk-GKXMIXEV.js.map} +0 -0
- /package/dist/{chunk-BH3B2E7H.js.map → chunk-GT4UFORX.js.map} +0 -0
- /package/dist/{chunk-APWZR7EN.js.map → chunk-GWM4DCAK.js.map} +0 -0
- /package/dist/{chunk-6B7YNXNH.js.map → chunk-GZ6YS7TG.js.map} +0 -0
- /package/dist/{chunk-GRUGYDLA.js.map → chunk-H7JOVRHO.js.map} +0 -0
- /package/dist/{chunk-2UKGYHQ7.js.map → chunk-HF5V7TWU.js.map} +0 -0
- /package/dist/{chunk-HHLEPWHB.js.map → chunk-HM25R6XJ.js.map} +0 -0
- /package/dist/{chunk-ZEJ6UCGE.js.map → chunk-HWSUW5PX.js.map} +0 -0
- /package/dist/{chunk-NHIZMRX6.js.map → chunk-I7R3YSZF.js.map} +0 -0
- /package/dist/{chunk-X5WZXHYF.js.map → chunk-IJDF7D4U.js.map} +0 -0
- /package/dist/{chunk-HPRAIQC4.js.map → chunk-IK2S7QGF.js.map} +0 -0
- /package/dist/{chunk-CKAW37VB.js.map → chunk-INI7U2SZ.js.map} +0 -0
- /package/dist/{chunk-BTXO66MR.js.map → chunk-INJHF7AF.js.map} +0 -0
- /package/dist/{chunk-BQHFH3SY.js.map → chunk-J2QOKD2F.js.map} +0 -0
- /package/dist/{chunk-TFWB4PS5.js.map → chunk-J57EXXFU.js.map} +0 -0
- /package/dist/{chunk-DS4RB7DZ.js.map → chunk-JE5NMVRX.js.map} +0 -0
- /package/dist/{chunk-KUVDKRO5.js.map → chunk-JHLGXB6K.js.map} +0 -0
- /package/dist/{chunk-BOCJWQAZ.js.map → chunk-JSEPE5EP.js.map} +0 -0
- /package/dist/{chunk-2PADYR7B.js.map → chunk-KB5HBQEK.js.map} +0 -0
- /package/dist/{chunk-E2LFVEXF.js.map → chunk-KCCWCK6L.js.map} +0 -0
- /package/dist/{chunk-CBSPF5D5.js.map → chunk-KTL2D7NT.js.map} +0 -0
- /package/dist/{chunk-FHZ3NNIF.js.map → chunk-KWTKAYCG.js.map} +0 -0
- /package/dist/{chunk-SD5GDVDI.js.map → chunk-LHNL6JM2.js.map} +0 -0
- /package/dist/{chunk-C26QSQXP.js.map → chunk-MPXDQWYI.js.map} +0 -0
- /package/dist/{chunk-VU2WGGWL.js.map → chunk-NBYP5N4X.js.map} +0 -0
- /package/dist/{chunk-2QITB55L.js.map → chunk-NOSWSBLW.js.map} +0 -0
- /package/dist/{chunk-ZVWLMEJQ.js.map → chunk-O3LHCQ7Q.js.map} +0 -0
- /package/dist/{chunk-NUEKCA56.js.map → chunk-P5H2BL4J.js.map} +0 -0
- /package/dist/{chunk-IEFMPAUE.js.map → chunk-P66JWKAL.js.map} +0 -0
- /package/dist/{chunk-AA5SMYM5.js.map → chunk-PA5MYVQY.js.map} +0 -0
- /package/dist/{chunk-PL5MOERB.js.map → chunk-Q676JHJA.js.map} +0 -0
- /package/dist/{chunk-L4BUFJJ2.js.map → chunk-QDOVBGKZ.js.map} +0 -0
- /package/dist/{chunk-ADUQKLUO.js.map → chunk-QN5VAYER.js.map} +0 -0
- /package/dist/{chunk-WIKXOHJD.js.map → chunk-QNEX7FEC.js.map} +0 -0
- /package/dist/{chunk-WRJZTAKV.js.map → chunk-QTL4NJ5I.js.map} +0 -0
- /package/dist/{chunk-GBEKM22P.js.map → chunk-R3GZRH43.js.map} +0 -0
- /package/dist/{chunk-4LIZR7ZU.js.map → chunk-R7CQCE3E.js.map} +0 -0
- /package/dist/{chunk-EGOVBOSI.js.map → chunk-RFJ3S47F.js.map} +0 -0
- /package/dist/{chunk-ZOC5FS5U.js.map → chunk-TMQ5LHZ3.js.map} +0 -0
- /package/dist/{chunk-YY42OVVE.js.map → chunk-TRLVH7T3.js.map} +0 -0
- /package/dist/{chunk-2V3ITJHT.js.map → chunk-UUBFYAVE.js.map} +0 -0
- /package/dist/{chunk-DLHGITJE.js.map → chunk-UXTZ5MBE.js.map} +0 -0
- /package/dist/{chunk-PFYZBCA4.js.map → chunk-V43RLLZE.js.map} +0 -0
- /package/dist/{chunk-57AIBUS5.js.map → chunk-V4UFNEHE.js.map} +0 -0
- /package/dist/{chunk-WJZSPX6Z.js.map → chunk-V5L5QD7R.js.map} +0 -0
- /package/dist/{chunk-UYMOAPIT.js.map → chunk-VAYFVC5B.js.map} +0 -0
- /package/dist/{chunk-AHZTZWGL.js.map → chunk-VFSLIDXA.js.map} +0 -0
- /package/dist/{chunk-OQCDLFGJ.js.map → chunk-VHMNSO2B.js.map} +0 -0
- /package/dist/{chunk-CT4JJID6.js.map → chunk-VOH2QWVG.js.map} +0 -0
- /package/dist/{chunk-2FPJPDMF.js.map → chunk-WESRVXFS.js.map} +0 -0
- /package/dist/{chunk-OXXAZEQI.js.map → chunk-WILN7TD6.js.map} +0 -0
- /package/dist/{chunk-ZJVHZHYP.js.map → chunk-WXC3I4CT.js.map} +0 -0
- /package/dist/{chunk-63LJAQ4E.js.map → chunk-X4DLIDFW.js.map} +0 -0
- /package/dist/{chunk-XX5DXKEI.js.map → chunk-YT74ZEVP.js.map} +0 -0
- /package/dist/{chunk-IUIL2GS5.js.map → chunk-Z5KBRTB2.js.map} +0 -0
- /package/dist/{chunk-RADMQU7S.js.map → chunk-ZBKBTTHD.js.map} +0 -0
- /package/dist/{chunk-2ALS4WHZ.js.map → chunk-ZFIYN7KP.js.map} +0 -0
- /package/dist/{chunk-AGPC6VQW.js.map → chunk-ZLU5QDLU.js.map} +0 -0
- /package/dist/{chunk-OON5SC7P.js.map → chunk-ZNNC6B75.js.map} +0 -0
- /package/dist/{chunk-2JWNUPSQ.js.map → chunk-ZO2YLHRW.js.map} +0 -0
- /package/dist/{chunk-7H6TNG52.js.map → chunk-ZPJE6D7W.js.map} +0 -0
- /package/dist/{client-BXYW3T2E.js.map → client-LY2JCQS2.js.map} +0 -0
- /package/dist/{code-YKSM3KES.js.map → code-7CBNYUPU.js.map} +0 -0
- /package/dist/{config-A2TUVNCZ.js.map → config-7COTFJWK.js.map} +0 -0
- /package/dist/{connect-X3KSG72E.js.map → connect-VOCZSB3W.js.map} +0 -0
- /package/dist/{content-LYWIFOUV.js.map → content-OXMONMHJ.js.map} +0 -0
- /package/dist/{conversion-report-QV4BSEIK.js.map → conversion-report-ZRNV7X7D.js.map} +0 -0
- /package/dist/{conversion-upload-command-QZWA525U.js.map → conversion-upload-command-IMHHSGYU.js.map} +0 -0
- /package/dist/{conversion-writes-EPEKU44W.js.map → conversion-writes-7N5UDQGH.js.map} +0 -0
- /package/dist/{conversions-A473X2GF.js.map → conversions-QOXRO26I.js.map} +0 -0
- /package/dist/{countries-AVHXOUE3.js.map → countries-UXAUGSBR.js.map} +0 -0
- /package/dist/{creatives-KAOWBTJL.js.map → creatives-F26GDJG2.js.map} +0 -0
- /package/dist/{creatives-7HNRUPTV.js.map → creatives-ONKKGW5T.js.map} +0 -0
- /package/dist/{crop-KEEGCMCE.js.map → crop-3ZV5BFCA.js.map} +0 -0
- /package/dist/{currency-XUW72I27.js.map → currency-PGLGLRKU.js.map} +0 -0
- /package/dist/{custom-conversions-VN7Q5YUE.js.map → custom-conversions-TV23XQHW.js.map} +0 -0
- /package/dist/{customers-3GJY3SIW.js.map → customers-I2EHMEX3.js.map} +0 -0
- /package/dist/{delete-BHQPYWZW.js.map → delete-MUPTLWHI.js.map} +0 -0
- /package/dist/{delete-IE2DCBO5.js.map → delete-R2SEUSLV.js.map} +0 -0
- /package/dist/{delete-DNYYWG7S.js.map → delete-ZGBBWFAW.js.map} +0 -0
- /package/dist/{describe-H3IQIO4V.js.map → describe-4O3VCV6L.js.map} +0 -0
- /package/dist/{describe-ODA4NHF4.js.map → describe-FCTM53MM.js.map} +0 -0
- /package/dist/{dimensions-N43FKZX5.js.map → dimensions-AD4VS5AH.js.map} +0 -0
- /package/dist/{discover-O5UOLCAD.js.map → discover-6XSPNZYE.js.map} +0 -0
- /package/dist/{discover-2AT6L4NZ.js.map → discover-UQXQUPNO.js.map} +0 -0
- /package/dist/{download-CUZEM54U.js.map → download-IE6XLFHM.js.map} +0 -0
- /package/dist/{draft-QVCJ6HEN.js.map → draft-ENA7S4Y7.js.map} +0 -0
- /package/dist/{draft-SM2UDAQP.js.map → draft-MGKJ5RYI.js.map} +0 -0
- /package/dist/{draft-7LJJT4AU.js.map → draft-PPRDQDGW.js.map} +0 -0
- /package/dist/{draft-YIFSGRVM.js.map → draft-S6VPKZYY.js.map} +0 -0
- /package/dist/{draft-L5W4U4G3.js.map → draft-VVDI2OR3.js.map} +0 -0
- /package/dist/{env-KSXDUMV4.js.map → env-YLOVBOAE.js.map} +0 -0
- /package/dist/{experiment-I7PFP6NQ.js.map → experiment-PHFP6IBM.js.map} +0 -0
- /package/dist/{export-VDG47LTK.js.map → export-R2IMUCQO.js.map} +0 -0
- /package/dist/{extract-CHQICMI3.js.map → extract-OQP3TSQG.js.map} +0 -0
- /package/dist/{favorites-UC7TPXXK.js.map → favorites-NS73FDG5.js.map} +0 -0
- /package/dist/{feed-HDP37IX5.js.map → feed-SQPOB7SP.js.map} +0 -0
- /package/dist/{feedback-V4GWOQ4N.js.map → feedback-XHSJBBEJ.js.map} +0 -0
- /package/dist/{fetch-6ZSWMQVO.js.map → fetch-PQ3NOPIE.js.map} +0 -0
- /package/dist/{find-WZNJQH6H.js.map → find-Y22AANDE.js.map} +0 -0
- /package/dist/{fit-57N46PVZ.js.map → fit-XJPM6573.js.map} +0 -0
- /package/dist/{follow-VHC5W6JQ.js.map → follow-N3DQZV7M.js.map} +0 -0
- /package/dist/{follow-competitors-4BB4SYX6.js.map → follow-competitors-BZPCBGIB.js.map} +0 -0
- /package/dist/{following-4OW7BFMR.js.map → following-KESWTEBR.js.map} +0 -0
- /package/dist/{fonts-DBSTYF25.js.map → fonts-3FX3OYEQ.js.map} +0 -0
- /package/dist/{forecast-HB45NEE6.js.map → forecast-CYSEUIS4.js.map} +0 -0
- /package/dist/{funding-O7EO6BXX.js.map → funding-G6S4UVU5.js.map} +0 -0
- /package/dist/{ga4-QSZJBPYT.js.map → ga4-2QHOA4RO.js.map} +0 -0
- /package/dist/{generate-MW3LCEZA.js.map → generate-F4FDRDAW.js.map} +0 -0
- /package/dist/{get-RPPCUPLR.js.map → get-3P2EQLP3.js.map} +0 -0
- /package/dist/{get-2TFUDEXB.js.map → get-FJB3X44Z.js.map} +0 -0
- /package/dist/{get-RXC5LHHX.js.map → get-MBGO4VJD.js.map} +0 -0
- /package/dist/{get-RA46XQ4O.js.map → get-NOKSZPIV.js.map} +0 -0
- /package/dist/{get-3WRPM3ZH.js.map → get-WHC4SRYK.js.map} +0 -0
- /package/dist/{gif-UTHNVWGB.js.map → gif-SFYVDLCU.js.map} +0 -0
- /package/dist/{google-7M6QFGYK.js.map → google-MY45TUC4.js.map} +0 -0
- /package/dist/{google-A4PE52FJ.js.map → google-XRAMIES5.js.map} +0 -0
- /package/dist/{group-ENDPRS2F.js.map → group-6RDJTWVN.js.map} +0 -0
- /package/dist/{group-QTPCHG4J.js.map → group-TZJCKHKS.js.map} +0 -0
- /package/dist/{gsc-4256M4IF.js.map → gsc-HD6UFRYM.js.map} +0 -0
- /package/dist/{history-BET6WSKX.js.map → history-2WBZRPPE.js.map} +0 -0
- /package/dist/{icon-6A6LUSTL.js.map → icon-BMCDFGMN.js.map} +0 -0
- /package/dist/{ideas-FDZWVTRA.js.map → ideas-VLHUTFHP.js.map} +0 -0
- /package/dist/{images-OG37OSCH.js.map → images-C4TBUPXM.js.map} +0 -0
- /package/dist/{improve-2GF6J5PW.js.map → improve-P6F2HXYQ.js.map} +0 -0
- /package/dist/{ingest-MMKVJOJC.js.map → ingest-SXT33KE6.js.map} +0 -0
- /package/dist/{insights-DL5WUM75.js.map → insights-DI4W3D2Y.js.map} +0 -0
- /package/dist/{insights-MXMJVTHU.js.map → insights-X75LRPS3.js.map} +0 -0
- /package/dist/{inspiration-JEVOJQ3L.js.map → inspiration-MDCCU2CF.js.map} +0 -0
- /package/dist/{intent-Z4DGVPFT.js.map → intent-A4SOIFKK.js.map} +0 -0
- /package/dist/{job-IM47QNLP.js.map → job-QDLPQFIT.js.map} +0 -0
- /package/dist/{job-create-A3ZCZHTF.js.map → job-create-6XKD5GEC.js.map} +0 -0
- /package/dist/{job-status-TE7AVTFZ.js.map → job-status-MH7CGLWC.js.map} +0 -0
- /package/dist/{keep-GJW7UPZG.js.map → keep-42SLV4CR.js.map} +0 -0
- /package/dist/{keyword-gap-6VUCYWBG.js.map → keyword-gap-D4P2CC2L.js.map} +0 -0
- /package/dist/{landing-FNE5I73U.js.map → landing-JWD3U2K5.js.map} +0 -0
- /package/dist/{landings-U3DAXGGO.js.map → landings-5IYXHA5Z.js.map} +0 -0
- /package/dist/{languages-R2GM7DRZ.js.map → languages-HX4FD3GX.js.map} +0 -0
- /package/dist/{languages-KEB6NUWX.js.map → languages-SRFGW6Z3.js.map} +0 -0
- /package/dist/{launches-DWNIU67A.js.map → launches-7U4TPNO3.js.map} +0 -0
- /package/dist/{layerize-4BG3ROAK.js.map → layerize-U672AXED.js.map} +0 -0
- /package/dist/{leads-NR4B5TWO.js.map → leads-MXUQISOC.js.map} +0 -0
- /package/dist/{library-CZQAZMTR.js.map → library-RPFXNER4.js.map} +0 -0
- /package/dist/{lighthouse-TKIDZ6FU.js.map → lighthouse-SJ4QNLUS.js.map} +0 -0
- /package/dist/{line-items-JLVCJNNN.js.map → line-items-QIBNOEOH.js.map} +0 -0
- /package/dist/{list-MKU4LM6C.js.map → list-GQ65MC2N.js.map} +0 -0
- /package/dist/{list-Q6X5QJGP.js.map → list-K56J7FZW.js.map} +0 -0
- /package/dist/{list-HZVLV22J.js.map → list-M4Z3WYPM.js.map} +0 -0
- /package/dist/{list-NGYIN633.js.map → list-SXYVDDMU.js.map} +0 -0
- /package/dist/{list-5WOBVJI5.js.map → list-XFIOXFB2.js.map} +0 -0
- /package/dist/{locations-V5XI33WW.js.map → locations-PQWB7EGC.js.map} +0 -0
- /package/dist/{locations-GOBN3Z6I.js.map → locations-WNSET6RM.js.map} +0 -0
- /package/dist/{logo-B3BROQTR.js.map → logo-4JOWGJ5A.js.map} +0 -0
- /package/dist/{lookup-ELKCXYYH.js.map → lookup-QGGSAHOO.js.map} +0 -0
- /package/dist/{make-7PBN4XH5.js.map → make-6OQBIYWC.js.map} +0 -0
- /package/dist/{media-MQEFN2X4.js.map → media-2SWDJDA6.js.map} +0 -0
- /package/dist/{media-HQQAIZ7Z.js.map → media-O5L7GO72.js.map} +0 -0
- /package/dist/{media-sources-RC3M2GXS.js.map → media-sources-LF6I6AYP.js.map} +0 -0
- /package/dist/{meta-VNSOJT2K.js.map → meta-37L6QBOZ.js.map} +0 -0
- /package/dist/{metrics-I7DWALMY.js.map → metrics-WVG3IUMH.js.map} +0 -0
- /package/dist/{models-RA2AG5BF.js.map → models-5QWYGJ7Y.js.map} +0 -0
- /package/dist/{normalize-A4QEXI4A.js.map → normalize-P5Q3F7FU.js.map} +0 -0
- /package/dist/{output-K3YC2VGS.js.map → output-ZL62UZHQ.js.map} +0 -0
- /package/dist/{page-XIJYCQK7.js.map → page-FZ7IZ5CV.js.map} +0 -0
- /package/dist/{pages-TNSVU5UF.js.map → pages-SS7TZTHV.js.map} +0 -0
- /package/dist/{performance-6UNRPB4I.js.map → performance-2K425XAN.js.map} +0 -0
- /package/dist/{pinterest-TLIBSYI5.js.map → pinterest-UETS7U7U.js.map} +0 -0
- /package/dist/{pixels-D6RDUTYK.js.map → pixels-D73GQFGM.js.map} +0 -0
- /package/dist/{pixels-5B54NNYI.js.map → pixels-LCTMLKGP.js.map} +0 -0
- /package/dist/{plan-D5TFL44K.js.map → plan-4HLITU3A.js.map} +0 -0
- /package/dist/{preview-26CQNU3Z.js.map → preview-RU54Z4EM.js.map} +0 -0
- /package/dist/{profile-RMQLPWMA.js.map → profile-NQOIBLJL.js.map} +0 -0
- /package/dist/{promoted-tweets-S5JU3YEQ.js.map → promoted-tweets-D5NKZ3FS.js.map} +0 -0
- /package/dist/{properties-F4NOIWYV.js.map → properties-ZUDQH3LE.js.map} +0 -0
- /package/dist/{query-LGNJDNPQ.js.map → query-26T7XATH.js.map} +0 -0
- /package/dist/{query-3OPJCQFR.js.map → query-IJVVSB54.js.map} +0 -0
- /package/dist/{query-P4NMXUCE.js.map → query-SHUOHXTO.js.map} +0 -0
- /package/dist/{questionnaire-VXOGMJPP.js.map → questionnaire-7AEVHZDR.js.map} +0 -0
- /package/dist/{read-S3IS5ELE.js.map → read-UYSQAXRV.js.map} +0 -0
- /package/dist/{reddit-UTK4I4ZR.js.map → reddit-YBEYPDZP.js.map} +0 -0
- /package/dist/{relevant-pages-U5TXNLRY.js.map → relevant-pages-OI7GTPOK.js.map} +0 -0
- /package/dist/{remove-WLRCQ74R.js.map → remove-2KACTXKP.js.map} +0 -0
- /package/dist/{rerun-ERLTGGT7.js.map → rerun-LM52CBPS.js.map} +0 -0
- /package/dist/{research-4L5YDUDW.js.map → research-547KDC54.js.map} +0 -0
- /package/dist/{retry-failed-3SLSEM4Z.js.map → retry-failed-NWLH6WHK.js.map} +0 -0
- /package/dist/{run-ZS7PLDOC.js.map → run-PLUL33QX.js.map} +0 -0
- /package/dist/{scaffold-ad-TYJYCYNZ.js.map → scaffold-ad-W4RZXLDX.js.map} +0 -0
- /package/dist/{scaffold-static-ad-JDFQZQJZ.js.map → scaffold-static-ad-IPJYRAOT.js.map} +0 -0
- /package/dist/{scaffold-video-KWVKJ3HA.js.map → scaffold-video-XBII4YLS.js.map} +0 -0
- /package/dist/{schedule-QAHB3Y2O.js.map → schedule-S547HPUT.js.map} +0 -0
- /package/dist/{scheduled-agents-INTHKJBU.js.map → scheduled-agents-DWSVPMZP.js.map} +0 -0
- /package/dist/{schema-LT2KTCFM.js.map → schema-SQIP75WG.js.map} +0 -0
- /package/dist/{scrape-F5T4K3MK.js.map → scrape-TI6S2W7I.js.map} +0 -0
- /package/dist/{screenshot-3JZC7Z67.js.map → screenshot-XFAYY4WW.js.map} +0 -0
- /package/dist/{search-4SGU4GCP.js.map → search-4HIOKYFR.js.map} +0 -0
- /package/dist/{search-2WC3UPL5.js.map → search-D2IV7KFJ.js.map} +0 -0
- /package/dist/{search-GYGMCTB4.js.map → search-IZPDHRJ4.js.map} +0 -0
- /package/dist/{search-EITER7HD.js.map → search-KFDL2IGG.js.map} +0 -0
- /package/dist/{search-copy-JIO572AF.js.map → search-copy-QZXCAGK4.js.map} +0 -0
- /package/dist/{seeds-474K2XDK.js.map → seeds-VUNZMHZH.js.map} +0 -0
- /package/dist/{sends-IWIJVLGL.js.map → sends-UT4WXVOS.js.map} +0 -0
- /package/dist/{sequences-DEIQSLPE.js.map → sequences-5RAGZE7L.js.map} +0 -0
- /package/dist/{set-prompt-BX37FBPT.js.map → set-prompt-WVQ4AI66.js.map} +0 -0
- /package/dist/{shared-OISI2KXV.js.map → shared-3CGGKICB.js.map} +0 -0
- /package/dist/{sitemaps-UMN746L7.js.map → sitemaps-3WDYQHYR.js.map} +0 -0
- /package/dist/{sites-YWCNJKWH.js.map → sites-G4DQ2Z2X.js.map} +0 -0
- /package/dist/{skills-L3MZYGPS.js.map → skills-PA26HXEP.js.map} +0 -0
- /package/dist/{sources-ZSTG7NBI.js.map → sources-PZXOSE4S.js.map} +0 -0
- /package/dist/{stats-7PNJ7SKK.js.map → stats-6DPPYSP3.js.map} +0 -0
- /package/dist/{sticker-KA4OXYBO.js.map → sticker-MC2IAIQB.js.map} +0 -0
- /package/dist/{stock-LGSP7IXN.js.map → stock-B7LKMKUK.js.map} +0 -0
- /package/dist/{studio-B5FDSSQE.js.map → studio-EQ2L6OBJ.js.map} +0 -0
- /package/dist/{sync-EZUU5CS6.js.map → sync-CLZDZL5F.js.map} +0 -0
- /package/dist/{sync-APSFLJNV.js.map → sync-V26UBMAN.js.map} +0 -0
- /package/dist/{sync-definition-LWUPVL2B.js.map → sync-definition-2SGGHSKR.js.map} +0 -0
- /package/dist/{tag-manager-4MPS25IR.js.map → tag-manager-KIHXVFMF.js.map} +0 -0
- /package/dist/{tags-PCROPKPP.js.map → tags-JN475JPP.js.map} +0 -0
- /package/dist/{targeting-constants-SVN4QBNE.js.map → targeting-constants-6Y5J2PPZ.js.map} +0 -0
- /package/dist/{targeting-criteria-QRVVJOJ4.js.map → targeting-criteria-NMZD3CK6.js.map} +0 -0
- /package/dist/{testimonials-KVV2NRB5.js.map → testimonials-YN2AB7U7.js.map} +0 -0
- /package/dist/{themes-2W6UGTJY.js.map → themes-BYRMCXYR.js.map} +0 -0
- /package/dist/{tweets-ADMGPZRH.js.map → tweets-KTM7HX5R.js.map} +0 -0
- /package/dist/{unfollow-TYUSXUQQ.js.map → unfollow-WBBTVEHE.js.map} +0 -0
- /package/dist/{unstage-OFOWKW64.js.map → unstage-GYBJZWCZ.js.map} +0 -0
- /package/dist/{upload-ENXZGIAJ.js.map → upload-NA62W5RS.js.map} +0 -0
- /package/dist/{upscale-BCSYBSCB.js.map → upscale-RXJUBHXN.js.map} +0 -0
- /package/dist/{url-options-E5Q2WWRL.js.map → url-options-LZIHCPP4.js.map} +0 -0
- /package/dist/{use-7GBWO7MR.js.map → use-MHPNS4V4.js.map} +0 -0
- /package/dist/{validate-R7GH6M2W.js.map → validate-IIOV3YJK.js.map} +0 -0
- /package/dist/{variant-2MOZ3ADI.js.map → variant-ZFCWILPG.js.map} +0 -0
- /package/dist/{videos-SNZVL5VK.js.map → videos-MIHTMO3G.js.map} +0 -0
- /package/dist/{view-SI4E4SPJ.js.map → view-PYCGDGT2.js.map} +0 -0
- /package/dist/{viewer-check-YHWBQRQ7.js.map → viewer-check-65TIGVAJ.js.map} +0 -0
- /package/dist/{winners-WJVKPYEK.js.map → winners-AI4PVSOI.js.map} +0 -0
- /package/dist/{write-commands-VXSFTWJU.js.map → write-commands-34L5LJIB.js.map} +0 -0
- /package/dist/{write-commands-3IORA667.js.map → write-commands-5TJ3LQ5F.js.map} +0 -0
- /package/dist/{write-commands-D6SE24DE.js.map → write-commands-R3UCCBUI.js.map} +0 -0
- /package/dist/{x-PFPOXRTL.js.map → x-V7V47E4N.js.map} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/canvas/run.ts","../src/commands/canvas/run-progress.ts","../src/commands/canvas/run-retention.ts","../src/commands/canvas/run-resume.ts","../src/commands/canvas/run-snapshot.ts","../src/engine/scaffold/static-history.ts","../src/commands/canvas/named-people-read.ts","../src/commands/avatars/namedPerson.ts","../src/commands/canvas/slug-restore.ts","../src/commands/canvas/series-run.ts","../src/commands/canvas/static-edit.ts","../src/commands/canvas/static-autofix.ts","../src/commands/canvas/shown-version.ts","../src/commands/canvas/static-run-review.ts","../src/commands/canvas/glance-check.ts","../src/commands/canvas/static-spec-repair.ts"],"sourcesContent":["import { readFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { VIEWER_CHECK_MODEL } from \"@baker/canvas-contract\";\nimport { defineCommand } from \"citty\";\nimport { optionalChatId, optionalTurnId } from \"../../env.ts\";\nimport { BackendClient } from \"../../engine/client/backend-client.ts\";\nimport { requireCredentialsFromEnv } from \"../../engine/client/env.ts\";\nimport {\n describeFailureReason,\n LayerExecutionError,\n RunAbortedError,\n runFailureCode,\n} from \"../../engine/engine/errors.ts\";\nimport { resolveConcurrency } from \"../../engine/lib/concurrency.ts\";\nimport { createEngineFromEnv, ValidationError } from \"../../engine/index.ts\";\nimport { sha256Hex } from \"../../engine/storage/sha256.ts\";\nimport { advanceDefinitionStatus } from \"./definition-status.ts\";\nimport { canvasOutputsRoot, describeRewrites, findWorkspaceRoot } from \"./normalize-paths.ts\";\nimport { outputRatioWarningsFor } from \"./output-ratio.ts\";\nimport { CanvasPrepareError, exitOnPrepareError, type PreparedCanvas, prepareCanvas } from \"./prepare-canvas.ts\";\nimport {\n clearLegacyDirtyMarker,\n readRenderState,\n recordRenderAttempt,\n recordSeriesLeadRun,\n recordReviewOutcome,\n recordRendered,\n recordSnapshot,\n} from \"./render-state.ts\";\nimport { computeSourceSha } from \"./source-version.ts\";\nimport { RunProgressTracker, RunRecordPoster } from \"./run-progress.ts\";\nimport {\n buildFailedRunRecord,\n buildInitialRunRecord,\n buildRunRecord,\n creativeSlugFromCanvasPath,\n finalFiles,\n finalOutputLabelsFromCanvas,\n type RunRecordPayload,\n} from \"./run-record.ts\";\nimport { pruneOldRuns } from \"./run-retention.ts\";\nimport { canvasBusyElsewhere, clearRunMarker, markCanvasBusy, markRunInFlight, resolveRunId } from \"./run-resume.ts\";\nimport { uploadRunGraph, uploadRunSnapshot } from \"./run-snapshot.ts\";\nimport { isStaticAdCanvas } from \"./static-ad-canvas.ts\";\nimport { isNativeCanvas } from \"../../engine/scaffold/static-native-graph.ts\";\nimport { fixStaticAd, rederiveFromVariant } from \"../../engine/scaffold/staticAd.ts\";\nimport {\n type GrownCanvas,\n type Growth,\n growFromVersion,\n madeThisRun,\n makesSameVariants,\n variantFiles,\n} from \"../../engine/scaffold/static-history.ts\";\nimport type { Canvas } from \"../../engine/schema/canvas.ts\";\nimport { nodesWithRole, regenerateTargets, rolesById, STATIC_ADAPT_FORMAT_ROLE } from \"../../engine/scaffold/static-topology.ts\";\nimport { findBrandRoot, readStaticPromptJson, wireNamedPeople, wireProofBadges } from \"./static-copy-projection.ts\";\nimport { jevCitationJudge } from \"../../engine/scaffold/review-platforms.ts\";\nimport { peopleReader } from \"./named-people-read.ts\";\nimport { avatarOfNamedPerson } from \"../avatars/namedPerson.ts\";\nimport { fetchBrandLogo } from \"../images/logo.ts\";\nimport { readStaticBrandKit } from \"../../engine/scaffold/static-brand.ts\";\nimport { canvasForSlug, SlugRestoreError } from \"./slug-restore.ts\";\nimport {\n seriesLeadsAbove,\n seriesMembers,\n seriesRunHints,\n writeSeriesMemberCanvas,\n} from \"./series-member.ts\";\nimport { runSeries, seriesEnvelope } from \"./series-run.ts\";\nimport { runBaker } from \"../baker-child.ts\";\nimport { formatOfAdaptId } from \"../../engine/scaffold/static-adapt-briefs.ts\";\nimport { seriesOf } from \"../../engine/scaffold/static-render-briefs.ts\";\nimport {\n AUTO_FIX_ROUNDS,\n type Attempt,\n type AutoFixStep,\n autoFixStep,\n correctFrom,\n paidFor,\n rendersNewPicture,\n withRelayEdit,\n placedTooFar,\n withDeliveredSizes,\n withExtendedSizes,\n withRelayNote,\n withSizesFollowingFix,\n} from \"./static-autofix.ts\";\nimport { fixMemoryOf, persistingDefects, repeatsFailedFix, specEditInstruction } from \"./static-edit.ts\";\nimport {\n correctedPicture,\n ingestedNow,\n keepsChosen,\n pictureRecord,\n previousAdImage,\n previousDelivered,\n relaysSizesOnly,\n variantImage,\n versionRun,\n} from \"./static-fix.ts\";\nimport { shownVersion } from \"./shown-version.ts\";\nimport { prefilterSpend, reviewStaticRun, runCostHint, staticReviewTargets } from \"./static-run-review.ts\";\nimport { repairSpec } from \"./static-spec-repair.ts\";\nimport { holdUnbilledSpend, holdWhenSettled, sendBillingSpend, takeUnbilledSpend } from \"./unbilled-spend.ts\";\nimport { gatewayViewerModel, jevReadJudge, liveViewerLookups, viewerCheckBeforeRender, viewerCheckSkip } from \"./viewer-check.ts\";\nimport {\n mayBeCorrection,\n readTurnRenders,\n recordTurnRender,\n roundFitsTurn,\n recordViewerFail,\n turnRenderRefusal,\n viewerChecksSpent,\n updateTurnRenders,\n} from \"./turn-renders.ts\";\nimport {\n RENDER_REVIEW_UNAVAILABLE,\n type RenderFinding,\n type ReviewUsage,\n reviewContextBeside,\n reviewRenderedVideo,\n sceneWindowsBeside,\n videoPathFromOutput,\n} from \"../../engine/nodes/local/lib/render-review.ts\";\n\n// Operator-only flags: kept working for scripts and debugging, but citty cannot hide an\n// argument from `--help`, so their descriptions say so and the agent-facing docs leave\n// them out.\nconst OPERATOR = \"Operator only, agents never need it.\";\n\nexport const runCommand = defineCommand({\n meta: {\n name: \"run\",\n description:\n \"Validate and execute a canvas. Pass the canvas file, or `--slug <slug>` to run a creative by name: its canvas in this workspace, or, when this workspace does not have it (a fresh workspace, another chat's creative), its files restored from its latest recorded run first. A run that was interrupted resumes; a finished one re-renders from the cache.\",\n },\n args: {\n file: { type: \"positional\", required: false, description: \"Path to canvas JSON (or use --slug)\" },\n slug: {\n type: \"string\",\n description:\n \"Run the creative src/creatives/<slug>/ by name instead of passing its file. Restores its files from run history when they are not in this workspace; local files are never overwritten unless you pass --force-remote.\",\n },\n series: {\n type: \"string\",\n description:\n \"Render every ad of the series this lead ad leads, all at once (`baker creatives make <idea> --series <lead>` made them): each is the lead's ready version with its own words, reviewed and corrected on its own. An ad already ready from the lead's current version is not rendered again. Start here for several messages in one style: baker canvas run --series spring-offer\",\n },\n \"force-remote\": {\n type: \"boolean\",\n default: false,\n description: \"With --slug: restore the recorded files even over local ones, replacing those that differ\",\n },\n until: {\n type: \"string\",\n description:\n \"Stop before the expensive half and leave the run resumable. `frames` settles the pictures and stops on the doorstep of the clips, so the look can be checked for the price of a few images instead of a whole ad. Continue with `baker canvas run <file> --run-id <the same id>` — everything already done is cached and is not paid for twice.\",\n },\n brief: {\n type: \"string\",\n description:\n \"What the person asked for, IN THEIR OWN WORDS — paste their message, do not summarise it. The review compares the finished video against this and reports what they asked for that is missing or contradicted. Without it the review can only say whether the video is well made, not whether it is the one they wanted: every other check grades the render against the spec, and a spec that misread the request agrees with itself.\",\n },\n \"run-id\": { type: \"string\", description: \"Override run id (also resumes that run, re-attaching its in-flight jobs)\" },\n fix: {\n type: \"string\",\n description:\n \"Static ad only: correct a finished version instead of rendering a new one. One render takes that version as its first reference and changes only what you say here (\\\"the CTA sits in the Stories band: move it up\\\", \\\"'Analitica' is missing its accent\\\"), keeping the picture, layout and every other word. It is added on top of that version: its options, pick and earlier corrections are kept as they were made (free), the edit after them. Every size is made again from it (each other size re-laid out from it, one request each) and the review follows as usual. The version is the creative's last render, or --from <run_id>.\",\n },\n from: {\n type: \"string\",\n description: \"With --fix, --use-variant or a --regenerate of sizes only: the run id of the version (default: the one the creative shows, its last render here, or in a new chat the version chosen, else its newest)\",\n },\n \"use-variant\": {\n type: \"string\",\n description:\n \"Static ad only: the person asked in the chat for another of a version's variants over the judge's pick. Give its sha256 (the picture's, never the option's number): every size is made again from that picture, the judge's pick replaced. The only requests re-lay out each other size from that picture (one per size). The version is --from <run_id>, else the creative's last render.\",\n },\n autofix: {\n type: \"boolean\",\n default: true,\n description: `Static ad: when the review finds a blocking defect, the run corrects it itself before it reports (up to ${AUTO_FIX_ROUNDS} more renders: the chosen picture fixed, or only the size at fault laid out again). --no-autofix reports after the first render.`,\n },\n \"skip-viewer-check\": {\n type: \"boolean\",\n default: false,\n description:\n \"Static ad only: render without the viewer check (see `baker canvas viewer-check`). Only when the person has heard what the viewer missed and asked for this copy as it is.\",\n },\n fresh: {\n type: \"boolean\",\n default: false,\n description: \"Ignore any interrupted-run marker and start a new run id instead of resuming\",\n },\n \"cache-policy\": { type: \"string\", description: \"read_write | bypass | read_only\" },\n regenerate: {\n type: \"string\",\n description:\n \"Comma-separated node ids or roles to force fresh THIS run (e.g. --regenerate pick,adapt; on a static ad --regenerate static_variants, or its id gen, renders the variants again, --regenerate adapt_9x16 lays out the 9:16 again from the picture the last version shows, its --fix correction or chosen variant included, and --regenerate static_adapt_format every re-laid-out size), bypassing the content cache for just those nodes + everything downstream. For a persistent re-render, bump a node's `regenerate` field in the canvas JSON instead.\",\n },\n concurrency: {\n type: \"string\",\n description: \"Max nodes running at once (default 8; env BAKER_CANVAS_CONCURRENCY)\",\n },\n parallel: {\n type: \"string\",\n description:\n \"Alias for --concurrency: independent clips (and every other same-layer node) already fan out in parallel up to this bound\",\n },\n // citty consumes any `--no-<flag>` as a negation of `<flag>`, so the\n // opt-out spelling `--no-record` requires the flag to be named `record`\n // (a literal \"no-record\" arg would never receive a value).\n record: {\n type: \"boolean\",\n default: true,\n description: \"Post the durable run-history record to Baker (disable with --no-record)\",\n },\n \"cache-dir\": { type: \"string\", description: `${OPERATOR} Cache root (default <workspace root>/canvas/.cache)` },\n \"outputs-dir\": { type: \"string\", description: `${OPERATOR} Per-run outputs root (default <workspace root>/canvas)` },\n \"keep-runs\": {\n type: \"string\",\n description: `${OPERATOR} After the run, prune old r_* run dirs, keeping the N newest (off by default)`,\n },\n \"remote-cache\": {\n type: \"string\",\n description: `${OPERATOR} on | off: company-scoped remote cache + durable asset persistence (default on; env BAKER_CANVAS_REMOTE_CACHE)`,\n },\n },\n async run({ args }) {\n if (args.series) {\n await executeSeriesRun(String(args.series));\n return;\n }\n await executeCanvasRun({\n file: args.file ? String(args.file) : undefined,\n slug: args.slug ? String(args.slug) : undefined,\n forceRemote: args[\"force-remote\"] === true,\n cacheDir: args[\"cache-dir\"] ? String(args[\"cache-dir\"]) : undefined,\n outputsDir: args[\"outputs-dir\"] ? String(args[\"outputs-dir\"]) : undefined,\n runId: args[\"run-id\"] ? String(args[\"run-id\"]) : undefined,\n fresh: args.fresh === true,\n fix: args.fix ? String(args.fix) : undefined,\n from: args.from ? String(args.from) : undefined,\n useVariant: args[\"use-variant\"] ? String(args[\"use-variant\"]) : undefined,\n skipViewerCheck: args[\"skip-viewer-check\"] === true,\n autoFix: args.autofix !== false,\n brief: args.brief ? String(args.brief) : undefined,\n until: args.until ? String(args.until) : undefined,\n cachePolicy: args[\"cache-policy\"] ? String(args[\"cache-policy\"]) : undefined,\n regenerate: args.regenerate !== undefined ? String(args.regenerate) : undefined,\n // --concurrency wins; --parallel is the discoverable alias for the same bound.\n concurrency: (args.concurrency ?? args.parallel) !== undefined ? String(args.concurrency ?? args.parallel) : undefined,\n keepRuns: args[\"keep-runs\"] !== undefined ? Number(args[\"keep-runs\"]) : undefined,\n remoteCache: args[\"remote-cache\"] !== undefined ? String(args[\"remote-cache\"]) !== \"off\" : undefined,\n record: args.record !== false,\n });\n },\n});\n\nexport type CanvasRunOptions = {\n /** The canvas file. One of `file` or `slug` is required; `file` wins when both are given. */\n file?: string;\n /** Run a creative by name (see `--slug`). */\n slug?: string;\n /** With `slug`: restore recorded files even over local ones. */\n forceRemote?: boolean;\n cacheDir?: string;\n outputsDir?: string;\n runId?: string;\n fresh?: boolean;\n /** Static ad: correct the previous version with this instruction instead of rendering anew. */\n fix?: string;\n /** With `fix` or `useVariant`: the run id of the version. */\n from?: string;\n /** Static ad: re-make every size from the variant with this sha256 (a person's choice), rendering nothing. */\n useVariant?: string;\n /** Static ad: render without asking the viewer first (`viewer-check.ts`). */\n skipViewerCheck?: boolean;\n /** Static ad: correct a blocking defect the review finds with another render (default true; `static-autofix.ts`). */\n autoFix?: boolean;\n /** Which automatic correction this run is (0 for the run the person asked for). */\n autoFixRound?: number;\n /** When the run the person asked for started (epoch ms): its correction rounds share its time in the turn. */\n autoFixStartedAt?: number;\n /** What the automatic corrections before this run did, said with its result. */\n autoFixed?: string[];\n /** The kind of the automatic correction this run is: a correction that left its defect is followed by a new picture. */\n autoFixKind?: AutoFixStep[\"kind\"];\n /** The person chose the picture these corrections started from (`--use-variant`): they correct it, never replace it. */\n autoFixKeepPicture?: boolean;\n /** With `regenerate`: what the last layout or picture got wrong, added to the briefs of what is made again. */\n relayNote?: string;\n /** With `regenerate` of re-laid sizes: each size (by node id) made as an edit of its last layout in run `from`, changing this. */\n relayEdits?: Record<string, string>;\n /** What the last round already asked of each re-laid size: said again as not taken. */\n relayAsked?: Record<string, string[]>;\n /** With `fix`: what each re-laid size (by node id) must change too, as it is made again from the corrected picture. */\n relayAlso?: Record<string, string>;\n /** With `fix`: these sizes (by format) delivered as run `from` had them, nothing in them made again. */\n keepSizes?: string[];\n /** Static ad: these sizes placed inside their band by code and their margins painted, after they are made (`withExtendedSizes`). */\n extendSizes?: string[];\n /** With `extendSizes`: every size starts from what run `from` delivered, nothing upstream made again. */\n extendOnly?: boolean;\n /** An autofix round: the review of the round before it (run `from`), kept on every size this round does not touch. */\n settledReview?: RenderFinding[];\n /** An autofix round: every render of this correction so far and what its review found (`correctFrom`). */\n autoFixAttempts?: Attempt[];\n cachePolicy?: string;\n regenerate?: string;\n concurrency?: string;\n keepRuns?: number;\n remoteCache?: boolean;\n /** Post run-history records (default true). */\n record?: boolean;\n /** What the person asked for, in their own words — see the `--brief` flag. */\n brief?: string;\n /** Where to stop and leave the run resumable — see the `--until` flag. */\n until?: string;\n};\n\n/**\n * The node types a `--until` checkpoint stops before.\n *\n * `frames` is the only stop worth having so far, and it is where the money is: the pictures\n * are a fraction of the clips, so stopping here buys a look at the ad for a fraction of its\n * price. An unknown word stops nothing rather than guessing — a typo that silently halted a\n * paid run would be worse than one that ran it.\n */\nexport function stopBeforeKinds(until: string | undefined): ReadonlySet<string> | null {\n if (until?.trim() === \"frames\") return new Set([\"video_generate\"]);\n return null;\n}\n\nfunction failPreflight(code: string, message: string, fix?: string): never {\n process.stderr.write(`${JSON.stringify({ ok: false, error: { code, message, ...(fix ? { fix } : {}) } }, null, 2)}\\n`);\n process.exit(2);\n}\n\n/**\n * The canvas file a run is for: the file given, or the creative named by `--slug`. A\n * creative restored from run history also names the unfinished run it came from, when\n * that run may be continued.\n */\nasync function canvasFileFor(opts: CanvasRunOptions): Promise<{ canvasPath: string; adoptRunId?: string }> {\n if (opts.file) return { canvasPath: path.resolve(opts.file) };\n if (!opts.slug) failPreflight(\"missing_canvas\", \"Pass the canvas file, or --slug <slug> to run a creative by name.\");\n const cwd = process.cwd();\n try {\n return await canvasForSlug(opts.slug, {\n workspaceRoot: findWorkspaceRoot(cwd) ?? cwd,\n forceRemote: opts.forceRemote === true,\n client: buildBackendClient,\n log: (line) => process.stdout.write(`${line}\\n`),\n });\n } catch (e) {\n if (e instanceof SlugRestoreError) failPreflight(e.code, e.message, e.fix);\n throw e;\n }\n}\n\n/** `--series <lead>`: every ad of the series at once, one `canvas run --slug` each (`series-run.ts`). */\nasync function executeSeriesRun(lead: string): Promise<void> {\n const root = findWorkspaceRoot(process.cwd()) ?? process.cwd();\n const members = await seriesMembers(root, lead);\n if (members.length === 0) {\n failPreflight(\n \"no_series_ads\",\n `No ad names \"${lead}\" as its lead (\\`series: ${lead}\\` in its _definition.md).`,\n `Make each other message as an ad of the series first (baker creatives make <idea> --series ${lead}), or each language (baker creatives translate --slug ${lead} --to es-MX,de).`,\n );\n }\n const canvasRoot = path.join(root, \"canvas\");\n process.stdout.write(`[series] rendering ${members.length} ads of ${lead} at once: ${members.join(\", \")}\\n`);\n const results = await runSeries(members, {\n plan: async (slug) => {\n // The series run is where the lead's design is carried to every ad, an ad's own edits to it included.\n const made = await writeSeriesMemberCanvas(root, slug, { takeLeadDesign: true });\n if (made === null) return { refused: { code: \"not_in_series\", message: `${slug} is no ad of this series.`, fix: \"\" } };\n if (\"refused\" in made) return made;\n if (made.designFromLead) process.stdout.write(`[series] ${slug} takes the lead's design, its own words kept\\n`);\n try {\n const prepared = await prepareCanvas(made.canvasPath, { write: false });\n const state = await readRenderState(canvasRoot, slug);\n const fresh = state.rendered?.sourceSha === prepared.sourceSha && (state.blocking ?? []).length === 0;\n return fresh ? { run: false, runId: state.rendered?.runId } : { run: true };\n } catch (e) {\n const envelope = e instanceof CanvasPrepareError ? e.toEnvelope().error : null;\n return {\n refused: {\n code: String(envelope?.code ?? \"prepare_failed\"),\n message: String(envelope?.message ?? (e instanceof Error ? e.message : e)),\n fix: String(envelope?.fix ?? \"\"),\n },\n };\n }\n },\n run: (slug) => runBaker([\"canvas\", \"run\", \"--slug\", slug]),\n });\n process.stdout.write(`${JSON.stringify(seriesEnvelope(lead, results), null, 2)}\\n`);\n}\n\n/**\n * An ad of a series is the lead's ready version with its own words: its canvas is written again\n * from the lead's before every run, so a new version of the lead reaches every ad of the series.\n * Refused before anything bills while the lead is not ready or the words are still the lead's.\n */\nasync function refreshSeriesAd(opts: CanvasRunOptions): Promise<boolean> {\n const slug = opts.slug ?? (opts.file ? creativeSlugFromCanvasPath(path.resolve(opts.file)) : null);\n if (!slug) return false;\n const root = findWorkspaceRoot(opts.file ? path.dirname(path.resolve(opts.file)) : process.cwd());\n if (!root) return false;\n const made = await writeSeriesMemberCanvas(root, slug);\n if (made === null) return false;\n if (\"refused\" in made) failPreflight(made.refused.code, made.refused.message, made.refused.fix);\n process.stdout.write(\n `[series] ${slug} is the lead ${made.lead}'s version ${made.leadRunId} with this ad's words${made.written ? \" (canvas written)\" : \"\"}\\n`,\n );\n return made.newLeadVersion;\n}\n\n/**\n * The whole `baker canvas run` flow, callable programmatically (the deprecated\n * `baker canvas rerun` delegates here). Exits the process on failure — this IS the\n * command body, not a library seam.\n */\n/** This process holds its canvas (`markCanvasBusy`): set by the first round, kept by the correction rounds. */\nlet canvasHeld = false;\n\nexport async function executeCanvasRun(opts: CanvasRunOptions): Promise<void> {\n const startedAt = opts.autoFixStartedAt ?? Date.now();\n const newAsk = (opts.autoFixRound ?? 0) === 0 ? await refreshSeriesAd(opts) : false;\n const { canvasPath: filePath, adoptRunId } = await canvasFileFor(opts);\n // Outputs, cache and markers belong to the workspace the canvas lives in, not to wherever the\n // command was started — the same canvas must land in the same `canvas/` from any directory.\n const canvasRoot = canvasOutputsRoot(filePath);\n const creativeSlug = creativeSlugFromCanvasPath(filePath) ?? undefined;\n if (creativeSlug) await clearLegacyDirtyMarker(canvasRoot, creativeSlug);\n const turnId = optionalTurnId();\n const turnCache = opts.cacheDir ?? path.join(canvasRoot, \".cache\");\n // An ad already ready in this turn gets no new render, only a correction of the version shown;\n // and none once rendered twice in it (turn-renders.ts). Refused before anything below is read or\n // billed when the run cannot be a correction; else once the correction is known, further down.\n const refuseTurnRender = async (correction: boolean): Promise<void> => {\n if (!creativeSlug || (opts.autoFixRound ?? 0) > 0) return;\n const refusal = turnRenderRefusal(await readTurnRenders(turnCache), turnId, creativeSlug, { correction });\n if (!refusal) return;\n process.stderr.write(\n `${JSON.stringify({ ok: false, error: { code: refusal.code, message: refusal.message, fix: refusal.fix } }, null, 2)}\\n`,\n );\n process.exit(2);\n };\n // The version shown: this workspace's last render, else (a new chat's Runtime) the one the run history shows.\n const shown = creativeSlug ? await shownVersion(canvasRoot, creativeSlug) : {};\n const promptOnDisk = await readFile(path.join(path.dirname(filePath), \"prompt.json\"), \"utf8\")\n .then((text): unknown => JSON.parse(text))\n .catch(() => null);\n await refuseTurnRender(mayBeCorrection(opts, shown.prompt, promptOnDisk));\n\n // The one preflight every canvas command shares: heal absolute paths (a hand-filled [TODO]\n // slot) and a URL in an ingest `path`, project the blueprint (prompt.json, scenes/*.json,\n // the derived spec files) into the graph and WRITE it back, so the file on disk is exactly\n // what renders, then refuse unfilled asset slots BEFORE anything bills.\n // A line citing a review platform gets that platform's real badge before the preflight's proof\n // gate reads prompt.json (D3); a lookup that fails leaves the gate to say what to do.\n const citing: ReviewUsage[] = [];\n await wireProofBadges(\n path.join(path.dirname(filePath), \"prompt.json\"),\n fetchBrandLogo,\n (line) => process.stderr.write(`${line}\\n`),\n jevCitationJudge((u) => citing.push(u)),\n );\n await holdUnbilledSpend(turnCache, citing);\n // A real person the copy names is shown as themselves, from their own photos, never invented.\n // Asked once per run: an autofix round would only ask again about someone already found or missed.\n if ((opts.autoFixRound ?? 0) === 0) {\n const reading: ReviewUsage[] = [];\n await wireNamedPeople(\n path.join(path.dirname(filePath), \"prompt.json\"),\n avatarOfNamedPerson,\n (line) => process.stderr.write(`${line}\\n`),\n peopleReader(turnCache, (u) => reading.push(u)),\n );\n await holdUnbilledSpend(turnCache, reading);\n }\n let prepared: PreparedCanvas;\n try {\n prepared = await prepareCanvas(filePath, {\n requireSuppliedAssets: true,\n gate: true,\n log: (line) => process.stderr.write(`${line}\\n`),\n });\n } catch (e) {\n // A render of this source was attempted, so the Stop hook stops asking for one until\n // the source moves again: a canvas that fails its preflight must not loop the agent.\n if (creativeSlug) await recordRenderAttempt(canvasRoot, creativeSlug, await computeSourceSha(filePath));\n exitOnPrepareError(e);\n }\n if (creativeSlug) await recordRenderAttempt(canvasRoot, creativeSlug, prepared.sourceSha);\n if (prepared.rewrites.length > 0) {\n process.stderr.write(\n `[canvas] rewrote ${prepared.rewrites.length} asset reference(s) in the canvas file so it says what runs (absolute paths → canvas-relative, a URL in an ingest path → source \"url\", a path into canvas/ → the durable URL of the same bytes):\\n${describeRewrites(prepared.rewrites)}\\n`,\n );\n }\n let parsed = prepared.canvas;\n // A prompt.json changed only in its words, their places or its colours since the version shown\n // renders as an edit of that version, at one render (static-edit.ts); asking for new options\n // is explicit (`--regenerate static_variants`). With no picture of that version left, it renders\n // as usual.\n const promptNow = isStaticAdCanvas(parsed) ? await readStaticPromptJson(parsed).catch(() => null) : null;\n // A native screen is drawn exactly from prompt.json on every run: there is no picture to edit.\n const native = isNativeCanvas(parsed);\n if (native && (opts.fix !== undefined || opts.useVariant !== undefined)) {\n process.stderr.write(\n `${JSON.stringify(\n {\n ok: false,\n error: {\n code: \"nothing_to_fix\",\n message: \"This ad is a native screen drawn exactly from prompt.json, not a painted picture: there is nothing to correct by --fix or to pick by --use-variant.\",\n fix: \"Edit prompt.json's `native` block (its words, people, photos, frame) and run again: nothing renders but a photo whose description changed. A photo with a defect: `--regenerate photo_<n>`.\",\n },\n },\n null,\n 2,\n )}\\n`,\n );\n process.exit(2);\n }\n const asEdit =\n !native &&\n opts.fix === undefined &&\n opts.useVariant === undefined && opts.regenerate === undefined && opts.from === undefined && shown.rendered\n ? specEditInstruction(shown.prompt, promptNow)\n : null;\n const editOf =\n asEdit && shown.rendered ? await previousAdImage(canvasRoot, shown.rendered.runId, undefined, rolesById(parsed)) : null;\n const editInstruction = editOf ? asEdit : null;\n if (editInstruction) {\n process.stdout.write(`[edit] only the words or colours changed: editing the version of run ${shown.rendered?.runId}: ${editInstruction}\\n`);\n }\n const fixInstruction = opts.fix ?? editInstruction ?? undefined;\n const requested = opts.regenerate?.split(\",\").map((id) => id.trim()) ?? [];\n await refuseTurnRender(\n fixInstruction !== undefined ||\n (requested.length > 0 && isStaticAdCanvas(parsed) && relaysSizesOnly(parsed, regenerateTargets(parsed, requested).ids)),\n );\n // The version this run starts from, and what a fix of it is measured against (only the one shown is remembered).\n const fromRun = opts.from ?? shown.rendered?.runId;\n const memory = fixMemoryOf(shown, opts.from);\n // The same correction after it left its defect in place would pay again for the same miss.\n if (opts.fix !== undefined && repeatsFailedFix(memory.lastFix, opts.fix)) {\n const left = memory.lastFix?.blocking ?? [];\n process.stderr.write(\n `${JSON.stringify(\n {\n ok: false,\n error: {\n code: \"no_progress\",\n message: `Not rendered: this exact fix already ran and left ${left.length === 1 ? \"this\" : \"these\"} in place: ${left.join(\" | \")}`,\n fix: \"Do not ask for the same correction again. Change the approach: edit prompt.json so the problem cannot happen (shorter words, a line moved or dropped, a different position), re-lay out just the size at fault with `--regenerate adapt_<size>`, or ask for new options with `--regenerate static_variants`.\",\n },\n },\n null,\n 2,\n )}\\n`,\n );\n process.exit(2);\n }\n // A correction, a chosen variant or a size laid out again grows on top of the version it starts\n // from (static-history.ts): that version's own graph runs again, every render in it kept as it was\n // made (pinned: never re-billed, never re-rolled), the change appended. The canvas file itself is\n // untouched; the run's record and manifest keep the grown graph (`graphUrl`), and the next run grows\n // on it, here or from another workspace (a plain run too, while nothing its variants are made from changed).\n // A version whose graph was never kept is corrected from its picture by URL (fixStaticAd, rederiveFromVariant).\n let grown: GrownCanvas | null = null;\n const growOn = async (from: string, growth: Growth): Promise<GrownCanvas | null> => {\n const version = await versionRun(canvasRoot, from);\n return version ? growFromVersion(parsed as Canvas, version, growth) : null;\n };\n if (fixInstruction !== undefined) {\n const instruction = fixInstruction.trim();\n const from = opts.from ?? shown.rendered?.runId;\n const previous = editOf ?? (from ? await previousAdImage(canvasRoot, from, undefined, rolesById(parsed)) : null);\n if (!instruction || !isStaticAdCanvas(parsed) || !from || !previous) {\n const message = !instruction\n ? \"--fix needs the correction in words.\"\n : !isStaticAdCanvas(parsed)\n ? \"--fix corrects a static ad; this canvas is not one.\"\n : !from\n ? \"--fix needs a version to correct: this creative has no recorded render here. Pass --from <run_id>.\"\n : `--fix could not find the finished ad of run ${from}: pass --from with a run that rendered one.`;\n process.stderr.write(`${JSON.stringify({ ok: false, error: { code: \"nothing_to_fix\", message } }, null, 2)}\\n`);\n process.exit(2);\n }\n grown = await growOn(from, { kind: \"edit\", instruction, promptJson: promptNow });\n parsed = grown ? grown.canvas : fixStaticAd(parsed, { instruction, previous, promptJson: promptNow });\n // Every re-laid size follows the corrected picture as an edit of its own last layout, keeping the\n // fixes earlier rounds made to it; one with none to edit is laid out again, told what it must change.\n const labels = finalOutputLabelsFromCanvas(parsed);\n const delivered = await previousDelivered(canvasRoot, from, labels?.nodeId ?? \"final\", labels?.labels ?? [], {\n prefer: \"url\",\n });\n const last = Object.fromEntries(\n nodesWithRole(parsed, STATIC_ADAPT_FORMAT_ROLE).flatMap((n) => {\n const path = delivered.find((d) => d.format === formatOfAdaptId(n.id))?.path;\n return path ? [[n.id, path]] : [];\n }),\n );\n parsed = withSizesFollowingFix(parsed, {\n last,\n change: instruction.replace(/^Change only this: /, \"\"),\n ...(opts.relayAlso ? { also: opts.relayAlso } : {}),\n }) as typeof parsed;\n // A size the review found nothing blocking on is the last version's own file: nothing in it is made again.\n const kept = delivered.filter((d) => opts.keepSizes?.includes(d.format));\n if (kept.length > 0) {\n parsed = withDeliveredSizes(parsed, Object.fromEntries(kept.map((d) => [d.format, d.path]))) as typeof parsed;\n process.stdout.write(`[fix] keeping ${kept.map((d) => d.format).join(\", \")} as it was: nothing blocking on it\\n`);\n }\n if (!editInstruction) process.stdout.write(`[fix] correcting the version of run ${from}: ${instruction}\\n`);\n }\n // A person chose another variant of a version: every size is made again from that picture\n // (found by its sha256 among the run's variants); the only requests re-lay out the other sizes.\n if (opts.useVariant !== undefined && opts.fix === undefined) {\n const sha = opts.useVariant.trim();\n const from = opts.from ?? shown.rendered?.runId;\n grown = from && isStaticAdCanvas(parsed) ? await growOn(from, { kind: \"variant\", sha256: sha }) : null;\n const url =\n from && !grown && isStaticAdCanvas(parsed) ? await variantImage(canvasRoot, from, sha, undefined, rolesById(parsed)) : null;\n if (!from || (!grown && !url)) {\n const message = !isStaticAdCanvas(parsed)\n ? \"--use-variant re-makes the sizes of a static ad; this canvas is not one.\"\n : !from\n ? \"--use-variant needs the version the variant belongs to: this creative has no recorded render here. Pass --from <run_id>.\"\n : `--use-variant found no variant ${sha} in run ${from}: pass the sha256 \\`baker creatives feedback --slug <slug>\\` prints, and --from with that version's run.`;\n process.stderr.write(`${JSON.stringify({ ok: false, error: { code: \"no_such_variant\", message } }, null, 2)}\\n`);\n process.exit(2);\n }\n if (grown) parsed = grown.canvas;\n else if (url) parsed = rederiveFromVariant(parsed, { url });\n process.stdout.write(`[variant] making every size of run ${from} again from the chosen variant ${sha.slice(0, 12)}\\n`);\n }\n // A size re-laid out on its own starts from the picture the version shows: grown on that\n // version, its picture kept. Else, after a --fix or a --use-variant that picture is not the\n // scaffolded graph's own pick, whose cache would bring back the uncorrected picture (or, with\n // prompt.json edited since, three new variants): it is passed by URL.\n let relaidFrom: string | undefined;\n if (opts.regenerate !== undefined && opts.fix === undefined && opts.useVariant === undefined && isStaticAdCanvas(parsed)) {\n const requested = opts.regenerate.split(\",\").map((id) => id.trim());\n const from = opts.from ?? shown.rendered?.runId;\n const sizesOnly = relaysSizesOnly(parsed, regenerateTargets(parsed, requested).ids);\n grown = from && sizesOnly ? await growOn(from, { kind: \"keep\" }) : null;\n // A new picture an autofix round drew (told what to avoid) is no pick the scaffolded graph makes again either.\n const url =\n from && sizesOnly && !grown\n ? ((await correctedPicture(canvasRoot, from)) ??\n (shown.picture?.redrawn && shown.picture.runId === from\n ? await previousAdImage(canvasRoot, from, undefined, rolesById(parsed))\n : null))\n : null;\n if (from && grown) {\n parsed = grown.canvas;\n relaidFrom = from;\n process.stdout.write(`[regenerate] re-laying out from the picture run ${from} shows, kept as it was made\\n`);\n } else if (from && url) {\n parsed = rederiveFromVariant(parsed, { url });\n relaidFrom = from;\n process.stdout.write(`[regenerate] re-laying out from the picture run ${from} shows (its correction or the person's choice)\\n`);\n }\n }\n // A plain run that changes nothing the variants are made from (their briefs, models, references and\n // the files those are made from) keeps the picture of the version shown: its regeneration, its\n // correction or the variant chosen, in this chat or a new one. The scaffold would draw its own\n // pick, whose cache holds the variants from before any of those. A new size, a logo placed again\n // or a size's words are made from that picture; anything that changes the variants renders them.\n const plain =\n fixInstruction === undefined &&\n opts.useVariant === undefined &&\n opts.regenerate === undefined &&\n (opts.extendSizes?.length ?? 0) === 0;\n if (plain && fromRun && !native && isStaticAdCanvas(parsed) && !seriesOf(parsed)) {\n const version = await versionRun(canvasRoot, fromRun);\n const same =\n version &&\n makesSameVariants(parsed as Canvas, version, await ingestedNow(variantFiles(parsed as Canvas), path.dirname(filePath)));\n grown = version && same ? growFromVersion(parsed as Canvas, version, { kind: \"keep\" }) : null;\n if (grown) {\n parsed = grown.canvas;\n relaidFrom = fromRun;\n process.stdout.write(`[version] nothing the variants are made from changed: keeping the picture of run ${fromRun}\\n`);\n }\n }\n if (grown) {\n const kept = Object.keys(grown.pinned);\n process.stdout.write(`[version] built on top of the version before: ${kept.join(\", \")} kept as they were made (free)\\n`);\n }\n // The canvas as it now stands on disk. `canvasSha` names these exact bytes (the snapshot\n // describes itself by it); resuming and staleness go by `prepared.sourceSha`, which also\n // covers the scenes, compositions and formats the canvas bytes do not.\n const canvasText = prepared.text;\n\n // Resolve --regenerate against the canvas' real node ids so a typo fails loudly\n // BEFORE billing, instead of silently regenerating nothing.\n let regenerate: Set<string> | undefined;\n if (opts.regenerate !== undefined) {\n const requested = opts.regenerate\n .split(\",\")\n .map((id) => id.trim())\n .filter((id) => id.length > 0);\n const known = new Set(canvasNodeIds(parsed));\n // A role (`static_variants`) or an older static graph's id names the nodes that now do that job.\n const { ids: resolved, unknown } = regenerateTargets(parsed, requested);\n if (unknown.length > 0) {\n process.stderr.write(\n `${JSON.stringify(\n {\n ok: false,\n error: {\n code: \"unknown_regenerate_node\",\n message: `--regenerate names node id(s) not in this canvas: ${unknown.join(\", \")}. Known ids: ${[...known].join(\", \")}`,\n },\n },\n null,\n 2,\n )}\\n`,\n );\n process.exit(2);\n }\n if (resolved.length > 0) {\n regenerate = new Set(resolved);\n process.stdout.write(`[regenerate] forcing fresh this run: ${[...regenerate].join(\", \")} (+ downstream)\\n`);\n if (opts.relayNote) parsed = withRelayNote(parsed, resolved, opts.relayNote) as typeof parsed;\n // A re-laid size is edited from its own last layout, told what to change (static-autofix.ts).\n const editFrom = opts.from ?? shown.rendered?.runId;\n if (opts.relayEdits && editFrom) {\n const labels = finalOutputLabelsFromCanvas(parsed);\n const delivered = await previousDelivered(canvasRoot, editFrom, labels?.nodeId ?? \"final\", labels?.labels ?? [], {\n prefer: \"url\",\n });\n for (const [id, instruction] of Object.entries(opts.relayEdits)) {\n if (!resolved.includes(id)) continue;\n const last = delivered.find((d) => d.format === formatOfAdaptId(id))?.path;\n parsed = (\n last\n ? withRelayEdit(parsed, id, { previous: last, instruction, asked: opts.relayAsked?.[id] ?? [] })\n : withRelayNote(parsed, [id], instruction)\n ) as typeof parsed;\n }\n // Every other size is delivered as the last version had it: a placing an earlier round made stays.\n const relaid = resolved.flatMap((id) => formatOfAdaptId(id) ?? []);\n parsed = withDeliveredSizes(\n parsed,\n Object.fromEntries(delivered.filter((d) => !relaid.includes(d.format)).map((d) => [d.format, d.path])),\n ) as typeof parsed;\n }\n }\n }\n\n // Sizes an interface covers or the frame cuts: placed by code, their margins painted (static-autofix.ts).\n if (opts.extendSizes && opts.extendSizes.length > 0 && isStaticAdCanvas(parsed)) {\n const from = opts.from ?? shown.rendered?.runId;\n if (opts.extendOnly && from) {\n const labels = finalOutputLabelsFromCanvas(parsed);\n const delivered = await previousDelivered(canvasRoot, from, labels?.nodeId ?? \"final\", labels?.labels ?? [], {\n prefer: \"url\",\n });\n parsed = withDeliveredSizes(parsed, Object.fromEntries(delivered.map((d) => [d.format, d.path]))) as typeof parsed;\n }\n parsed = withExtendedSizes(parsed, opts.extendSizes) as typeof parsed;\n process.stdout.write(`[extend] placing ${opts.extendSizes.join(\", \")} clear of what covers or cuts it, its margins painted\\n`);\n }\n\n const cacheDir = opts.cacheDir ?? path.join(canvasRoot, \".cache\");\n const engine = createEngineFromEnv({\n cacheDir,\n outputsDir: opts.outputsDir ?? canvasRoot,\n log: (line) => process.stdout.write(`${line}\\n`),\n remoteCache: opts.remoteCache,\n });\n // Deep-validate BEFORE resuming/registering anything: a validation failure\n // is not a run (nothing executed or billed), so it must not touch the\n // resume marker or leave a `running` row in run history. engine.run\n // re-validates internally; the deep pass is local-only and cheap next to a\n // billed render.\n const validation = await engine.validateDeep(parsed);\n if (!validation.ok) {\n process.stderr.write(\n `${JSON.stringify({ ok: false, error: { code: \"validation\", issues: validation.issues } }, null, 2)}\\n`,\n );\n process.exit(2);\n }\n // Advisories are the last chance to catch a legal-but-wrong graph BEFORE it bills\n // (per-ratio duplicate renders). `validate` prints them; a run that skips straight here\n // must see them too. An orphan is skipped and the run says so (`[prune]`): an autofix\n // round's graph keeps the first render's steps, and 18 lines a round said they would bill.\n const advisories = (validation.warnings ?? []).filter((w) => w.code !== \"ORPHAN_NODE\");\n for (const w of [...advisories, ...(await outputRatioWarningsFor(parsed, filePath))]) {\n process.stdout.write(`[warn] ${w.code}: ${w.message}\\n`);\n }\n const canvasSha = sha256Hex(Buffer.from(canvasText));\n const sourceSha = prepared.sourceSha;\n const client = opts.record === false ? null : buildBackendClient();\n // Pre-generate the run id so a FAILED run still posts an attributable\n // history record (engine.run only surfaces the id on success). When a prior\n // render of this canvas was killed mid-flight (session end / sandbox\n // timeout), an in-flight marker survives — reuse its run id so still-running\n // billed jobs RE-ATTACH (idempotency key `<runId>:<cacheKey>`) instead of\n // being abandoned and re-billed. A NEW sandbox with no marker asks the\n // backend for a resumable run of this exact SOURCE (canvas, prompt.json,\n // scenes, compositions, formats) and adopts its id when the backend says it\n // may. `--run-id` / `--fresh` override both tiers.\n const outputsDir = opts.outputsDir ? path.resolve(opts.outputsDir) : canvasRoot;\n const { runId, resumed, source, sameSource, concurrentRunId, rendering } = await resolveRunId({\n explicitRunId: opts.runId,\n adoptedRunId: adoptRunId,\n fresh: opts.fresh === true || fixInstruction !== undefined || opts.useVariant !== undefined || relaidFrom !== undefined,\n outputsDir,\n canvasPath: filePath,\n sourceSha,\n remote:\n client && creativeSlug && sourceSha\n ? { creativeSlug, sourceSha, getActiveRun: (slug, sha) => client.getActiveRun(slug, sha) }\n : undefined,\n });\n // Another command on this canvas still rendering, reviewing or correcting: its rounds would replace what this one delivers.\n const holder = rendering ?? (await canvasBusyElsewhere(outputsDir, filePath));\n if (holder) {\n process.stderr.write(\n `${JSON.stringify(\n {\n ok: false,\n error: {\n code: \"CONFLICT\",\n message: `This canvas is already rendering in another process (run ${holder.runId}, pid ${holder.pid}).`,\n fix: \"Wait for that render to finish and use its result instead of starting a second one: two renders of one canvas share a run and overwrite each other. If you started it in the background, read its output when it completes.\",\n },\n },\n null,\n 2,\n )}\\n`,\n );\n process.exit(2);\n }\n // A static ad is checked against the viewer it reaches before it spends a render\n // (viewer-check.ts): a viewer who would not understand it stops the run here, exit 2.\n const viewerUsage: ReviewUsage[] = [];\n const viewerCheck =\n creativeSlug && isStaticAdCanvas(parsed)\n ? await viewerCheckBeforeRender({\n creativeDir: path.dirname(filePath),\n cacheDir,\n slug: creativeSlug,\n skip: viewerCheckSkip({\n fix: opts.fix !== undefined,\n useVariant: opts.useVariant !== undefined,\n relaid: relaidFrom !== undefined,\n autoFixRound: opts.autoFixRound ?? 0,\n resumed: resumed && sameSource === true,\n asked: opts.skipViewerCheck === true,\n }),\n spent: viewerChecksSpent(await readTurnRenders(turnCache), turnId, creativeSlug),\n lookups: liveViewerLookups(path.dirname(canvasRoot)),\n model: VIEWER_CHECK_MODEL,\n ask: gatewayViewerModel(VIEWER_CHECK_MODEL, (usage) => viewerUsage.push(usage)),\n judge: jevReadJudge((usage) => viewerUsage.push(usage)),\n })\n : null;\n for (const line of viewerCheck?.lines ?? []) process.stdout.write(`${line}\\n`);\n // The check is billed on a run record. A refusal stops before any record exists, so its\n // spend waits in the workspace; the next record this workspace posts carries it.\n await holdUnbilledSpend(cacheDir, viewerUsage);\n if (viewerCheck?.failure) {\n if (creativeSlug && turnId && viewerCheck.failure.error.code === \"viewer_check_failed\") {\n await updateTurnRenders(turnCache, (ledger) => recordViewerFail(ledger, turnId, creativeSlug));\n }\n process.stderr.write(`${JSON.stringify(viewerCheck.failure, null, 2)}\\n`);\n process.exit(2);\n }\n if (resumed) {\n process.stdout.write(\n `[resume] continuing interrupted run ${runId}${source === \"remote\" ? \" (adopted from run history)\" : \"\"} — in-flight jobs re-attach, cached nodes skip\\n`,\n );\n }\n if (concurrentRunId) {\n process.stderr.write(\n `[concurrent] this canvas appears to be running elsewhere right now (run ${concurrentRunId}) — starting a separate run; pass --run-id ${concurrentRunId} to adopt it instead\\n`,\n );\n }\n // Graceful abort: the FIRST SIGINT/SIGTERM stops dispatching new nodes\n // (in-flight requests abort; billed async jobs keep running server-side),\n // flushes a resumable `interrupted` snapshot, and PRESERVES the resume\n // marker. A second signal force-kills via the default handler — the marker\n // survives that too.\n const abort = new AbortController();\n let abortedBy: \"SIGINT\" | \"SIGTERM\" | null = null;\n for (const signalName of [\"SIGINT\", \"SIGTERM\"] as const) {\n process.once(signalName, () => {\n abortedBy = signalName;\n process.stderr.write(`[interrupt] ${signalName} received — flushing a resumable snapshot (repeat to force-quit)\\n`);\n abort.abort(new Error(`aborted by ${signalName}`));\n });\n }\n const inFlight = await markRunInFlight(outputsDir, filePath, runId, sourceSha);\n // Held until this process ends, through the review and every correction round (each runs in it).\n if (!canvasHeld) {\n const held = await markCanvasBusy(outputsDir, filePath, runId);\n canvasHeld = true;\n process.once(\"exit\", held.release);\n }\n // Only this run's own marker is ever cleared: a newer run of the same canvas keeps its own.\n const clearMarker = () => {\n inFlight.stop();\n return clearRunMarker(outputsDir, filePath, inFlight.token);\n };\n // Portable snapshot: upload the canvas + its local file refs so ANY\n // sandbox can `baker canvas run --slug <slug>` this exact run — an unpublished\n // creative's files otherwise live only on this chat's never-pushed branch.\n // Nothing is sent twice: the same files as the last upload reuse its manifest.\n const snapshot =\n client && creativeSlug\n ? await uploadRunSnapshot(client, {\n canvasPath: filePath,\n raw: canvasText,\n creativeSlug,\n parsed,\n previous: (await readRenderState(canvasRoot, creativeSlug)).snapshot,\n })\n : null;\n if (snapshot && creativeSlug) await recordSnapshot(canvasRoot, creativeSlug, snapshot);\n // The graph as it runs (grown on a version, or the scaffold's): a correction made in another\n // workspace grows on this version from it (static-fix.ts `versionRun`). Only a static ad grows.\n const graphUrl = client && creativeSlug && isStaticAdCanvas(parsed) ? await uploadRunGraph(client, parsed) : null;\n const recordMeta = {\n creativeSlug,\n canvasPath: path.relative(path.dirname(canvasRoot), filePath) || undefined,\n canvasSha,\n // The fingerprint the dashboard compares against the current source to flag\n // \"edited since last render\": the same `computeSourceSha` the edit-sync posts,\n // taken after the preflight wrote the projected graph, so the two are comparable.\n sourceSha,\n chatId: optionalChatId(),\n canvasSnapshotUrl: snapshot?.url,\n ...(graphUrl ? { graphUrl } : {}),\n ...(newAsk ? { newAsk: true } : {}),\n };\n // Register the run BEFORE layer 1 executes: this row is the Convex-side\n // in-flight marker — the reconcile sweep and cross-sandbox resume key off\n // it — so unlike the fire-and-forget progress stream it is awaited with\n // retries. A dead backend still never blocks a paid render.\n if (client) {\n const registered = await postInitialRunRecord(client, buildInitialRunRecord(runId, recordMeta));\n if (!registered) {\n process.stderr.write(\n \"[warn] run start not registered — this run stays invisible to the dashboard until a later progress post lands, and cannot be resumed from another workspace\\n\",\n );\n }\n }\n // The lead version this run was asked from, kept whether or not it finishes: a retry after a\n // failure is the same ask (`newAsk` is not sent twice for one new version of the lead).\n const leadRun = seriesOf(parsed)?.run_id;\n if (creativeSlug && leadRun) await recordSeriesLeadRun(canvasRoot, creativeSlug, leadRun);\n // Posts that throw: progress posts are best-effort inside the poster, and the terminal one\n // has to know whether it landed, because it carries the spend to bill.\n const record = client ? (payload: RunRecordPayload) => client.recordRun(payload) : null;\n // Live progress: every engine event folds into a full-record snapshot and\n // streams to the backend (serialized, latest-wins) so the dashboard's\n // workflow graph updates in real time as nodes complete. Purely an\n // observer — a dead backend degrades to the terminal record only.\n // Variant identity for collect-terminated canvases: each final carries its\n // branch/scene label into the run record so the dashboard can pair grid\n // tiles (and per-output selection) back to the producing branch.\n const finalLabels = finalOutputLabelsFromCanvas(parsed) ?? undefined;\n const progress = record ? new RunProgressTracker(runId, recordMeta, finalLabels) : null;\n const poster = record ? new RunRecordPoster(record) : null;\n // The terminal record bills the spend it carries; one that never lands holds it again for the\n // next and warns, and the run's exit code stays what the render earned.\n const flushBilled = async (p: RunRecordPoster, payload: RunRecordPayload) => {\n const failure = await sendBillingSpend(cacheDir, payload.reviewUsage ?? [], () => p.flush(payload));\n if (failure !== null) process.stderr.write(`[warn] run record not persisted (${failure})\\n`);\n };\n // Heartbeat: re-post the latest snapshot every ~60s even without node events\n // so the backend can tell a live run from a frozen one (its orchestrating\n // CLI died). Item 2 removes the 9-min clip ceiling, so a single video clip\n // can poll for minutes with no intervening node events.\n if (progress && poster) {\n poster.startKeepalive(() => (progress.hasPlan() ? progress.snapshot() : null));\n }\n // Collected as they settle rather than read back from disk: at a checkpoint the run is\n // unwinding, and these urls are the only thing the caller has to show.\n const frameUrls: string[] = [];\n // The box readers inside the graph (variant checks, 9:16 safe fit) are billed as they settle,\n // so a run that fails or is stopped after them still carries their spend.\n // The automatic correction that follows a run the review found blocking defects in.\n let next: CanvasRunOptions | null = null;\n // What this run makes, for the readers that report on it: a grown version's kept steps are the version's.\n const madeHere = grown ? madeThisRun({ canvas: parsed as Canvas, pinned: grown.pinned }) : parsed;\n const readerSpend = holdWhenSettled(cacheDir, (run, outputs) => prefilterSpend(madeHere, { [run.node_id]: outputs }, [run]));\n const isFrameNode = (id: string): boolean =>\n (parsed as { nodes?: { id: string; type: string }[] }).nodes?.find((n) => n.id === id)?.type === \"image_generate\";\n try {\n const policy = (opts.cachePolicy ?? \"read_write\") as \"read_write\" | \"bypass\" | \"read_only\";\n const result = await engine.run(parsed, {\n run_id: runId,\n signal: abort.signal,\n cache_policy: policy,\n ...(stopBeforeKinds(opts.until) ? { stop_before_kinds: stopBeforeKinds(opts.until) as ReadonlySet<string> } : {}),\n concurrency: resolveConcurrency(opts.concurrency, process.env.BAKER_CANVAS_CONCURRENCY),\n regenerate,\n ...(grown ? { pinned: grown.pinned } : {}),\n // Always set, because the frame collector has to run whether or not this run is\n // reporting progress to a backend — without it a checkpoint stops with nothing to\n // show, which is the only thing a checkpoint is for.\n onProgress: (event) => {\n if (event.kind === \"node_settled\") readerSpend.settled(event.run, event.outputs);\n if (event.kind === \"node_settled\" && isFrameNode(event.run.node_id)) {\n for (const out of Object.values(event.outputs ?? {})) {\n const url = (out as { url?: string } | undefined)?.url;\n if (url) frameUrls.push(url);\n }\n }\n if (progress && poster) {\n progress.apply(event);\n if (progress.hasPlan()) poster.enqueue(progress.snapshot());\n }\n },\n });\n // Clean completion — drop the resume marker so the next run of this\n // canvas starts a fresh generation rather than resuming this one, and record\n // what this workspace's preview now shows (see render-state.ts).\n await clearMarker();\n // The attempt before this one, read before this run is recorded: the review says when a\n // retry delivered the same picture again.\n const beforeRunId = shown.rendered?.runId;\n if (creativeSlug) {\n await recordRendered(canvasRoot, creativeSlug, sourceSha, result.run_id, {\n ...(promptNow ? { prompt: promptNow } : {}),\n ...(seriesOf(parsed)?.run_id ? { seriesLeadRun: seriesOf(parsed)?.run_id } : {}),\n picture: pictureRecord(result.run_id, {\n chose: opts.useVariant !== undefined,\n of: shown.picture,\n from: fromRun,\n keeps: fixInstruction !== undefined || relaidFrom !== undefined,\n redrawn: opts.autoFixKind === \"regenerate\",\n }),\n });\n }\n // The record is flushed AFTER the review, so the findings travel with the run they\n // describe instead of living only in this process's stdout.\n const keepRuns = opts.keepRuns;\n if (keepRuns !== undefined && Number.isFinite(keepRuns)) {\n await pruneOldRuns(outputsDir, keepRuns, result.run_id, (line) => process.stdout.write(`${line}\\n`));\n }\n // Watch what was just made. Nothing else in the run ever opens a generated\n // clip — the composition gate reads the HTML, the validators read the graph —\n // so until this ran, \"the render succeeded\" and \"the render is usable\" were\n // the same sentence. They are not: a finished ad shipped with a panel being\n // drilled through its glass, five different men playing one customer, no\n // brand mark and no ending, and every check in the run was green.\n //\n // Never blocking. The clips are already paid for; the findings are the work\n // to do next, and a review that could not run says so rather than staying\n // silent, because silence is what let the last one through.\n const reviewable = videoPathFromOutput(result.output);\n // The review calls the gateway from the Runtime, because that is where the finished\n // video is. Nothing upstream sees the call, so what it cost rides home on the run\n // record below — the gateway's own `usage.cost`, relayed rather than computed, and\n // recorded like every other provider call the run made.\n // The viewer check's and the box readers' spend (this run's, and any a refused, failed or standalone\n // run left behind) rides with it.\n await readerSpend.drained();\n const reviewUsage: ReviewUsage[] = poster ? await takeUnbilledSpend(cacheDir) : [];\n // The market, the advertiser and the script, read off the blueprint beside the\n // canvas. Every whole-reel question is relative to one of them — the accent to a\n // market, the cast to a script — and without them the watch pass asked \"does the\n // speaker's accent belong there?\" against nothing, while still grading the answer\n // as blocking. See `reviewContextBeside`.\n const review = reviewable\n ? await reviewRenderedVideo({\n video: reviewable,\n windows: await sceneWindowsBeside(filePath),\n ...(await reviewContextBeside(filePath)),\n brief: opts.brief?.trim() || undefined,\n onSpend: (usage) => reviewUsage.push(usage),\n })\n : null;\n // A static ad is read back the same way: the judge's scores for the candidates, and the\n // delivered formats checked for their shape, their words, the logo and the safe zones.\n // The brand's name and wordmark, as the workspace states them: a spec that names none\n // still has its logo read as the logo, never as words nobody asked for.\n const brandKit = reviewable\n ? null\n : await readStaticBrandKit((await findBrandRoot(path.dirname(filePath))) ?? process.cwd());\n const runShape = {\n fix: fixInstruction !== undefined,\n useVariant: opts.useVariant !== undefined,\n sizesOnly:\n relaidFrom !== undefined ||\n opts.extendOnly === true ||\n (regenerate !== undefined && relaysSizesOnly(parsed, [...regenerate])),\n };\n const staticReview = reviewable\n ? null\n : await reviewStaticRun({\n parsed: madeHere,\n output: result.output,\n outputsByNode: result.outputs_by_node,\n onSpend: (usage) => reviewUsage.push(usage),\n viewer: viewerCheck?.viewer ?? null,\n ...(brandKit?.name ? { brandName: brandKit.name } : {}),\n ...(brandKit?.lockup ? { lockup: brandKit.lockup } : {}),\n // Only a new picture is compared with the last one: an edit, a fix, a chosen option or a\n // re-layout keeps it on purpose, and would read as \"this retry changed nothing\".\n ...(beforeRunId &&\n beforeRunId !== result.run_id &&\n rendersNewPicture(runShape)\n ? { previous: await previousDelivered(canvasRoot, beforeRunId, finalLabels?.nodeId ?? \"final\", finalLabels?.labels ?? []) }\n : {}),\n // A size this round did not touch keeps the last round's verdict: the review's second look at it is no defect of the round.\n ...(opts.settledReview && opts.from\n ? {\n settled: {\n review: opts.settledReview,\n images: await previousDelivered(canvasRoot, opts.from, finalLabels?.nodeId ?? \"final\", finalLabels?.labels ?? []),\n },\n }\n : {}),\n });\n // What a fix left in place: recorded so the same fix is refused, and said now so the next\n // step changes the approach instead of repeating it.\n const blockingNow = (staticReview?.review ?? []).filter((f) => f.severity === \"blocking\").map((f) => f.what);\n const stillThere = fixInstruction !== undefined && staticReview?.review ? persistingDefects(memory.blocking, staticReview.review) : [];\n if (creativeSlug && staticReview) {\n await recordReviewOutcome(canvasRoot, creativeSlug, {\n blocking: blockingNow,\n ...(fixInstruction !== undefined ? { lastFix: { instruction: fixInstruction.trim(), blocking: stillThere } } : {}),\n });\n }\n const costHint = staticReview\n ? runCostHint(result.stats, paidFor(runShape))\n : null;\n const corrected = opts.autoFixed ?? [];\n const seriesRoot = creativeSlug && staticReview ? findWorkspaceRoot(path.dirname(filePath)) : null;\n const seriesHints =\n seriesRoot && creativeSlug\n ? seriesRunHints(creativeSlug, {\n leads: await seriesLeadsAbove(seriesRoot, creativeSlug),\n members: await seriesMembers(seriesRoot, creativeSlug),\n })\n : [];\n const hints = staticReview\n ? [\n ...(corrected.length > 0\n ? [\n `Corrected automatically before this result, ${corrected.length} more render${corrected.length === 1 ? \"\" : \"s\"}: ${corrected.join(\" Then \")} What follows is the review of the corrected version.`,\n ]\n : []),\n ...staticReview.hints,\n ...(costHint ? [costHint] : []),\n ...seriesHints,\n ...(stillThere.length > 0\n ? [\n `The fix did not remove ${stillThere.length === 1 ? \"this\" : \"these\"}: ${stillThere.join(\" | \")}. The same instruction will not run again; change the approach (edit prompt.json so it cannot happen, or re-lay out only that size).`,\n ]\n : []),\n ]\n : reviewable\n ? review === null\n ? [RENDER_REVIEW_UNAVAILABLE]\n : review.length === 0\n ? [\"Reviewed the finished video frame by frame — nothing to report.\"]\n : [\n `Reviewed the finished video and found ${review.length} thing${review.length === 1 ? \"\" : \"s\"} to fix. ` +\n \"Show the user what is wrong before you show them the ad.\",\n ...review.map((f) => `${f.severity === \"blocking\" ? \"Must fix\" : \"Should fix\"} — ${f.what}`),\n ...(review.some((f) => f.scene)\n ? [\n \"Anything about the mark or the closing card is a composition fix, not a re-render: \" +\n \"both are drawn as HTML by the caption composition, so editing it and re-running \" +\n \"re-renders only that pass — the clips are cached and no generation is paid for again. \" +\n \"Fix them, then re-run: edit the `show` of the scene files named above — a shot with a person \" +\n \"handling equipment is where limbs and objects go wrong, so widen it, move the hands out of \" +\n \"frame, or drop the person from that beat. Re-running re-renders only the scenes you edited; \" +\n `everything else comes from the cache (this run: ${result.stats?.cached_nodes ?? 0} of ` +\n `${result.stats?.total_nodes ?? 0} nodes were cached).`,\n ]\n : []),\n ]\n : [];\n const findings = staticReview ? staticReview.review : review;\n // The lifecycle field moves with what happened, never by hand: a render the review\n // calls ready (with or without notes) makes the creative `rendered`.\n const ready = staticReview\n ? staticReview.verdict === \"ready\" || staticReview.verdict === \"ready_with_notes\"\n : review !== null && !review.some((f) => f.severity === \"blocking\");\n const definitionStatus =\n ready && creativeSlug\n ? await advanceDefinitionStatus(path.join(path.dirname(filePath), \"_definition.md\"), \"rendered\")\n : null;\n if (poster) {\n await flushBilled(poster, \n // `review` is null only when nobody looked (no key, no ffmpeg, unreadable video);\n // an empty array is a render that was reviewed and came back clean. The record\n // has to keep those apart.\n buildRunRecord(\n result,\n {\n ...recordMeta,\n ...(findings ? { review: findings } : {}),\n ...(reviewUsage.length > 0 ? { reviewUsage } : {}),\n // A static ad that failed a check is never shown as a version (the backend reads both).\n ...(staticReview\n ? { verdict: staticReview.verdict, presentable: staticReview.verdict !== \"needs_fixes\" }\n : {}),\n },\n progress?.planInfo(),\n finalLabels,\n ),\n );\n }\n // A blocking defect is corrected by the run itself, before anyone sees the ad (static-autofix.ts).\n const round = opts.autoFixRound ?? 0;\n // A picture the person chose stays theirs through every correction and re-layout of it.\n const keepPicture =\n opts.useVariant !== undefined ||\n opts.autoFixKeepPicture === true ||\n ((fixInstruction !== undefined || relaidFrom !== undefined) && keepsChosen(shown.picture, fromRun));\n // Every render of this correction so far: the next one starts from the best, never a worse one.\n const attempts: Attempt[] = staticReview?.review\n ? [...(opts.autoFixAttempts ?? []), { runId: result.run_id, review: staticReview.review }]\n : [];\n const base = attempts.length > 0 ? correctFrom(attempts as [Attempt, ...Attempt[]]) : null;\n const reverted = base !== null && base.runId !== result.run_id;\n let step =\n staticReview && base && opts.autoFix !== false\n ? // The graph the next round re-prepares (the file's), never this run's rewrite of it: a fix or a\n // re-layout takes the variants out of `parsed`, and only the file's graph can draw a new picture.\n autoFixStep(prepared.canvas, base.review, {\n round,\n keepPicture,\n // Gone back to an earlier attempt: what this round did and left is no longer the picture's.\n ...(!reverted && opts.autoFixKind ? { previous: opts.autoFixKind } : {}),\n ...(!reverted && fixInstruction !== undefined\n ? { lastFix: { instruction: fixInstruction.trim(), blocking: stillThere } }\n : {}),\n tooFar: reverted ? [] : placedTooFar(parsed, result.outputs_by_node),\n fixedBefore: base.fixedBefore,\n })\n : null;\n if (step && reverted && base) {\n process.stdout.write(\n `[autofix] run ${result.run_id} came out worse than run ${base.runId}: the next correction starts from run ${base.runId}\\n`,\n );\n }\n // A round past the ad's time in this turn is not started: the ad is shown as it stands (turn-renders.ts).\n const outOfTime =\n step !== null && !roundFitsTurn(await readTurnRenders(turnCache), turnId, creativeSlug, Date.now() - startedAt, step.kind);\n if (outOfTime) {\n process.stdout.write(\n `[autofix] not started: this ad has had its time in this turn (${Math.round((Date.now() - startedAt) / 60_000)} min in this render). It stands as it is.\\n`,\n );\n hints.unshift(\n \"Out of time for this ad in this turn: no further correction or render. Show this version as it stands and say in one plain sentence what is left; the person's next message says what changes.\",\n );\n step = null;\n }\n // Corrections stopped on an attempt worse than an earlier one: the next correction starts from the better one.\n if (!step && reverted && base) {\n hints.unshift(\n `Run ${base.runId} has fewer problems than this one: correct that one, never this one (add \\`--from ${base.runId}\\` to a --fix).`,\n );\n }\n // A defect the spec caused is corrected in the spec (prompt.json) before the ad is drawn again from it.\n let respecced: string | null = null;\n const briefFindings = step?.kind === \"respec\" ? step.findings : step?.kind === \"regenerate\" ? (step.brief ?? []) : [];\n if (briefFindings.length > 0) {\n const target = staticReviewTargets(parsed, result.output);\n const spent: ReviewUsage[] = [];\n respecced = target\n ? await repairSpec({\n promptPath: target.promptPath,\n findings: briefFindings,\n ...(target.images[0] ? { image: target.images[0].path } : {}),\n onSpend: (usage) => spent.push(usage),\n })\n : null;\n // Billed with the next run's record, as the box readers' spend is.\n if (spent.length > 0) await holdUnbilledSpend(cacheDir, spent);\n // A native screen has nothing to correct but its spec: no correction written, nothing to run.\n if (step?.kind === \"respec\" && respecced === null) step = null;\n }\n if (step) {\n const did =\n step.kind === \"respec\"\n ? `The spec was corrected: ${respecced}`\n : step.kind === \"fix\"\n ? `The picture was corrected for: ${step.instruction.replace(/^[^:]*: /, \"\")}`\n : step.kind === \"regenerate\"\n ? `${respecced ? `The spec was corrected (${respecced}) and a` : \"A\"} new picture was made, avoiding: ${step.note.replace(/^[^:]*: /, \"\")}`\n : step.kind === \"extend\"\n ? `The ${step.sizes.join(\" and \")} ${step.sizes.length === 1 ? \"was\" : \"were\"} placed clear of what covers or cuts ${step.sizes.length === 1 ? \"it\" : \"them\"}, the margins painted to match.`\n : `The ${step.ids.map((id) => id.replace(/^adapt_/, \"\").replace(\"x\", \":\")).join(\" and \")} was edited: ${Object.values(step.edits).join(\" \")}`;\n // Said before the correction runs: if it fails, this version (rendered and paid for) stands.\n const files = finalFiles(result.output, finalLabels?.labels);\n process.stdout.write(\n `[autofix] round ${round + 1} of ${AUTO_FIX_ROUNDS}: run ${result.run_id} needs fixes. ${did} If the correction fails, run ${result.run_id} stands as the latest version: ${JSON.stringify(files)}\\n`,\n );\n next = {\n file: filePath,\n cacheDir: opts.cacheDir,\n outputsDir: opts.outputsDir,\n concurrency: opts.concurrency,\n keepRuns: opts.keepRuns,\n remoteCache: opts.remoteCache,\n record: opts.record,\n brief: opts.brief,\n cachePolicy: opts.cachePolicy,\n fresh: true,\n from: base?.runId ?? result.run_id,\n autoFixRound: round + 1,\n autoFixAttempts: attempts,\n autoFixStartedAt: startedAt,\n autoFixed: [...corrected, did],\n autoFixKind: step.kind,\n ...(base ? { settledReview: [...base.review] } : {}),\n ...(keepPicture ? { autoFixKeepPicture: true } : {}),\n ...(step.kind === \"fix\"\n ? {\n fix: step.instruction,\n ...(step.relay ? { relayAlso: step.relay } : {}),\n ...(step.keep ? { keepSizes: step.keep } : {}),\n ...(step.extend ? { extendSizes: step.extend } : {}),\n }\n : step.kind === \"extend\"\n ? { extendSizes: step.sizes, extendOnly: true }\n : step.kind === \"relayout\"\n ? {\n ...(step.extend ? { extendSizes: step.extend } : {}),\n regenerate: step.ids.join(\",\"),\n relayEdits: step.edits,\n // A second edit of a size is told what the first asked for.\n ...(opts.autoFixKind === \"relayout\" && opts.relayEdits\n ? { relayAsked: Object.fromEntries(Object.entries(opts.relayEdits).map(([id, asked]) => [id, [asked]])) }\n : {}),\n }\n : step.kind === \"regenerate\"\n ? { regenerate: step.ids.join(\",\"), relayNote: step.note, ...(step.extend ? { extendSizes: step.extend } : {}) }\n : {}),\n };\n } else {\n if (creativeSlug && turnId && staticReview) {\n const tookMs = Date.now() - startedAt;\n await updateTurnRenders(turnCache, (ledger) =>\n recordTurnRender(ledger, turnId, creativeSlug, staticReview.verdict, tookMs),\n );\n }\n process.stdout.write(\n `${JSON.stringify(\n {\n ok: true,\n outputs_dir: result.outputs_dir,\n output: result.output,\n stats: result.stats,\n // The agent reads a finding's words; the review model's typed fields are the correction's.\n ...(findings ? { review: findings.map(({ kind: _kind, ...finding }) => finding) } : {}),\n ...(staticReview?.judge?.length ? { judge: staticReview.judge } : {}),\n ...(definitionStatus === \"updated\" ? { definition_status: \"rendered\" } : {}),\n ...(hints.length ? { hints } : {}),\n // Last, so a `| tail` keeps them: production agents cut them off and re-ran to get them back.\n // A static ad whose review found a blocking problem is finished but NOT ready.\n ...(staticReview ? { verdict: staticReview.verdict } : {}),\n run_id: result.run_id,\n files: finalFiles(result.output, finalLabels?.labels),\n },\n null,\n 2,\n )}\\n`,\n );\n }\n } catch (e) {\n // A failed run keeps its per-node progress (which nodes completed, which\n // died) when the plan landed; pre-plan failures fall back to the bare record.\n // Any terminal record bills the held spend: a render that fails after the viewer check\n // passed, or after the box readers ran, has paid for them all the same.\n const failedPayload = async (message: string) => {\n await readerSpend.drained();\n const payload = progress?.hasPlan() ? progress.failedSnapshot(message) : buildFailedRunRecord(runId, message, recordMeta);\n const held = await takeUnbilledSpend(cacheDir);\n return held.length > 0 ? { ...payload, reviewUsage: held } : payload;\n };\n if (e instanceof RunAbortedError && e.reason === \"signal\") {\n // Deliberate abort: KEEP the resume marker — the next run of this\n // canvas reuses this run id, re-attaching in-flight billed jobs — and\n // mark the record interrupted so the backend keeps the row adoptable.\n const message = `Interrupted${abortedBy ? ` by ${abortedBy}` : \"\"} — re-run \\`baker canvas run\\` to resume; in-flight jobs re-attach, completed nodes come from the cache.`;\n if (poster) await flushBilled(poster, { ...(await failedPayload(message)), interrupted: true });\n process.stderr.write(`${JSON.stringify({ ok: false, error: { code: \"interrupted\", message } }, null, 2)}\\n`);\n process.exit(abortedBy === \"SIGTERM\" ? 143 : 130);\n }\n if (e instanceof RunAbortedError && e.reason === \"checkpoint\") {\n // A checkpoint is a SUCCESS with work left, not a failure: the pictures asked for are\n // done, and reporting them as an error would leave the agent with nothing to show and\n // a run it thinks it has to start over. The frame urls are the whole point — they are\n // what the agent checks before the clips are paid for.\n await clearMarker();\n // Flushed like every other terminal path, as its own state: `awaiting_approval` is\n // neither a failure nor an interruption. The row stays resumable (resuming this run\n // id supersedes it) and the reconcile sweep, which only reads `running` rows, never\n // force-fails it. The agent normally reviews and resumes immediately; an explicit\n // storyboard-only or review request may leave it here for a later turn.\n if (poster) {\n await flushBilled(poster, {\n ...(await failedPayload(`Frames ready to review before the clips. Resume with --run-id ${runId}.`)),\n status: \"awaiting_approval\",\n });\n }\n const frames = frameUrls;\n process.stdout.write(\n `${JSON.stringify(\n {\n ok: true,\n data: { stopped: \"frames\", runId, frames },\n hints: [\n `${e.message}`,\n frames.length > 0\n ? `Review these ${frames.length} frames against the brief and Brand, fix any defects, then resume immediately with the same run id. Wait for the user only when they explicitly requested storyboards only or a review before continuing; do not ask them to choose a version.`\n : \"No frame outputs were captured — carry on rather than blocking on nothing.\",\n `Carry on with: baker canvas run ${filePath} --run-id ${runId}`,\n ],\n },\n null,\n 2,\n )}\\n`,\n );\n process.exit(0);\n }\n // A handled failure is terminal (no jobs left running) — clear the marker\n // so the retry starts fresh; completed nodes still come from the cache.\n // Only an actual process kill (or the graceful abort above) skips this\n // and leaves the marker to resume.\n await clearMarker();\n if (e instanceof ValidationError) {\n // Nothing executed or billed — a validation failure is not a run.\n // (Normally unreachable: run() deep-validates before registering.)\n process.stderr.write(\n `${JSON.stringify({ ok: false, error: { code: \"validation\", issues: e.issues } }, null, 2)}\\n`,\n );\n process.exit(2);\n }\n if (e instanceof LayerExecutionError) {\n const failures = e.failures.map((f) => ({ node_id: f.nodeId, message: describeFailureReason(f.reason) }));\n if (poster) await flushBilled(poster, await failedPayload(e.message));\n process.stderr.write(\n `${JSON.stringify({ ok: false, error: { code: runFailureCode(e), message: e.message, failures } }, null, 2)}\\n`,\n );\n process.exit(1);\n }\n const msg = e instanceof Error ? e.message : String(e);\n if (poster) await flushBilled(poster, await failedPayload(msg));\n process.stderr.write(`${JSON.stringify({ ok: false, error: { code: runFailureCode(e), message: msg } }, null, 2)}\\n`);\n process.exit(1);\n }\n if (next) await executeCanvasRun(next);\n}\n\n/** Best-effort node-id extraction from a not-yet-validated canvas, for --regenerate checks. */\nfunction canvasNodeIds(parsed: unknown): string[] {\n const nodes = (parsed as { nodes?: unknown })?.nodes;\n if (!Array.isArray(nodes)) return [];\n return nodes\n .map((node) => (node as { id?: unknown })?.id)\n .filter((id): id is string => typeof id === \"string\");\n}\n\n/** One shared backend client for run history + resume lookup; null (with a warning) when credentials are absent. */\nexport function buildBackendClient(): BackendClient | null {\n try {\n const creds = requireCredentialsFromEnv();\n return new BackendClient({ baseUrl: creds.url, apiKey: creds.apiKey });\n } catch (e) {\n const msg = e instanceof Error ? e.message : String(e);\n process.stderr.write(`[warn] run history disabled (${msg})\\n`);\n return null;\n }\n}\n\nconst sleep = (ms: number): Promise<void> => new Promise((resolve) => setTimeout(resolve, ms));\n\n/**\n * The initial `running` record must actually land (it is what makes the run\n * visible to the reconcile sweep and adoptable by another sandbox), so it gets\n * bounded retries — but a dead backend still degrades to a warning, never\n * blocks the render. Safe to retry: the POST upserts on (companyId, runId).\n */\nasync function postInitialRunRecord(client: BackendClient, payload: RunRecordPayload): Promise<boolean> {\n for (let attempt = 0; attempt < 3; attempt++) {\n try {\n await client.recordRun(payload);\n return true;\n } catch {\n if (attempt < 2) await sleep(500 * 2 ** attempt);\n }\n }\n return false;\n}\n","// Live run-history streaming: RunProgressTracker folds engine progress events\n// into a full run-record snapshot (status \"running\"), and RunRecordPoster\n// serializes best-effort POSTs of those snapshots so the dashboard's workflow\n// graph lights up node by node. Everything here is an observer of the run —\n// a lost snapshot or a dead backend must never change the run's outcome.\n\nimport type { NodeRunRecord, RunProgressEvent } from \"../../engine/engine/executor.ts\";\nimport { nodeParamsPreview } from \"./node-preview.ts\";\nimport {\n type FinalOutputLabels,\n nodeOutputsToRecord,\n type RunNodeError,\n type RunPlanInfo,\n type RunRecordMeta,\n type RunRecordNode,\n type RunRecordPayload,\n} from \"./run-record.ts\";\n\n/** Backend caps the node error message at 2000 chars; clamp here so an oversized upstream body can't 400 the whole record. */\nfunction clampNodeError(error: RunNodeError): RunNodeError {\n return { ...error, message: error.message.slice(0, 2000) };\n}\n\nexport class RunProgressTracker {\n private readonly runId: string;\n private readonly meta: RunRecordMeta;\n private readonly startedAt: number;\n private readonly nodes = new Map<string, RunRecordNode>();\n private readonly finalLabels?: FinalOutputLabels;\n private planned = false;\n\n constructor(runId: string, meta: RunRecordMeta, finalLabels?: FinalOutputLabels) {\n this.runId = runId;\n this.meta = meta;\n this.finalLabels = finalLabels;\n this.startedAt = Date.now();\n }\n\n apply(event: RunProgressEvent): void {\n if (event.kind === \"plan\") {\n for (const node of event.nodes) {\n this.nodes.set(node.node_id, {\n nodeId: node.node_id,\n nodeType: node.node_type,\n cached: false,\n credits: 0,\n durationMs: 0,\n outputs: [],\n deps: node.deps,\n status: \"pending\",\n paramsPreview: nodeParamsPreview(node.params, node.deps),\n ...(node.role !== undefined ? { role: node.role } : {}),\n });\n }\n this.planned = true;\n return;\n }\n if (event.kind === \"node_start\") {\n this.patchNode(event.node_id, { status: \"running\" });\n return;\n }\n if (event.kind === \"node_settled\") {\n this.patchNode(event.run.node_id, {\n status: \"completed\",\n cached: event.run.cached,\n credits: event.run.credits,\n durationMs: event.run.duration_ms,\n outputs: nodeOutputsToRecord(\n event.outputs,\n event.run.node_id === this.finalLabels?.nodeId ? this.finalLabels.labels : undefined,\n ),\n });\n return;\n }\n this.patchNode(event.node_id, { status: \"failed\", error: clampNodeError(event.error) });\n }\n\n /** True once the plan event landed — before that there is nothing worth posting. */\n hasPlan(): boolean {\n return this.planned;\n }\n\n /** Plan facts (deps + params preview) for stamping the terminal record's nodes. */\n planInfo(): RunPlanInfo {\n const info: RunPlanInfo = new Map();\n for (const node of this.nodes.values()) {\n info.set(node.nodeId, {\n deps: node.deps ?? [],\n paramsPreview: node.paramsPreview,\n ...(node.role !== undefined ? { role: node.role } : {}),\n });\n }\n return info;\n }\n\n /** The current in-flight state as a postable full record. */\n snapshot(): RunRecordPayload {\n const nodes = [...this.nodes.values()];\n return {\n runId: this.runId,\n ...this.meta,\n status: \"running\",\n stats: {\n totalNodes: nodes.length,\n cachedNodes: nodes.filter((n) => n.cached).length,\n totalCredits: nodes.reduce((sum, n) => sum + n.credits, 0),\n durationMs: Date.now() - this.startedAt,\n },\n nodes,\n };\n }\n\n /**\n * Terminal record for a failed run, preserving what each node got to —\n * completed nodes keep their outputs so the graph shows exactly where the\n * run died instead of an empty husk.\n */\n failedSnapshot(errorMessage: string): RunRecordPayload {\n const snapshot = this.snapshot();\n return {\n ...snapshot,\n status: \"failed\",\n errorMessage: errorMessage.slice(0, 2000),\n stats: { ...snapshot.stats, durationMs: Date.now() - this.startedAt },\n };\n }\n\n private patchNode(nodeId: string, patch: Partial<RunRecordNode>): void {\n const existing = this.nodes.get(nodeId);\n if (!existing) return;\n this.nodes.set(nodeId, { ...existing, ...patch, status: patch.status ?? existing.status });\n }\n}\n\n/**\n * Serialized, latest-wins snapshot poster. At most one POST is in flight; new\n * snapshots arriving mid-flight collapse into a single trailing post (each\n * snapshot is the full state, so intermediates are droppable). `flush` drains\n * the queue and then posts the terminal record, awaiting it — the terminal\n * record must be the last write so a slow progress POST can't clobber it\n * server-side (terminal rows are immutable there as a second line of defense).\n */\nexport class RunRecordPoster {\n private readonly post: (payload: RunRecordPayload) => Promise<void>;\n private latest: RunRecordPayload | null = null;\n private inflight: Promise<void> | null = null;\n private warned = false;\n private keepaliveTimer: ReturnType<typeof setInterval> | null = null;\n\n constructor(post: (payload: RunRecordPayload) => Promise<void>) {\n this.post = post;\n }\n\n /** Queue a progress snapshot; returns immediately. */\n enqueue(payload: RunRecordPayload): void {\n this.latest = payload;\n if (!this.inflight) this.inflight = this.pump();\n }\n\n /**\n * Re-post the latest snapshot on an interval even with no new node events, so\n * the backend's `canvasRuns.updatedAt` heartbeat stays fresh during a long\n * single-clip poll (a video_generate clip can run minutes with no\n * intervening node events). When this process dies the keepalive stops → the\n * run's `updatedAt` goes stale → the backend reconciliation sweep force-fails\n * it as interrupted and surfaces the clips that finished. `produce` returns\n * null before the plan lands (nothing worth posting yet).\n */\n startKeepalive(produce: () => RunRecordPayload | null, intervalMs = 60_000): void {\n if (this.keepaliveTimer) return;\n this.keepaliveTimer = setInterval(() => {\n const snapshot = produce();\n if (snapshot) this.enqueue(snapshot);\n }, intervalMs);\n // Never let a background heartbeat keep the process alive on its own.\n this.keepaliveTimer.unref?.();\n }\n\n private stopKeepalive(): void {\n if (this.keepaliveTimer) {\n clearInterval(this.keepaliveTimer);\n this.keepaliveTimer = null;\n }\n }\n\n /**\n * Post the terminal record (awaited, errors surfaced to the caller). Any\n * queued progress snapshot is superseded — the terminal record is the full\n * state — but an in-flight POST is awaited first so it can't land after.\n */\n async flush(terminal: RunRecordPayload): Promise<void> {\n this.stopKeepalive();\n this.latest = null;\n if (this.inflight) await this.inflight;\n await this.post(terminal);\n }\n\n private async pump(): Promise<void> {\n while (this.latest) {\n const payload = this.latest;\n this.latest = null;\n try {\n await this.post(payload);\n } catch (e) {\n if (!this.warned) {\n this.warned = true;\n const msg = e instanceof Error ? e.message : String(e);\n process.stderr.write(`[warn] live run progress not streaming (${msg})\\n`);\n }\n }\n }\n this.inflight = null;\n }\n}\n","import { rm } from \"node:fs/promises\";\nimport path from \"node:path\";\n\n/**\n * Which `r_*` run dirs to prune, keeping the `keep` newest. Run ids are ULIDs, which\n * sort chronologically, so a lexicographic sort is oldest→newest. The current run is\n * always protected. Pure — unit-tested without the filesystem.\n */\nexport function runDirsToPrune(entries: string[], keep: number, currentRunId: string): string[] {\n const runs = entries\n .filter((e) => /^r_[0-9A-Za-z]+$/.test(e) && e !== currentRunId)\n .sort(); // oldest first\n if (keep <= 0) return runs;\n return runs.slice(0, Math.max(0, runs.length - keep));\n}\n\n/**\n * Delete old `r_*` run dirs under `outputsDir`, keeping the `keep` newest plus the\n * current run. Best-effort: a failed delete logs and is skipped rather than failing\n * the run (the outputs already shipped). Materialization hardlinks from the cache, so\n * pruning frees the dir entries without touching the content-addressed store.\n */\nexport async function pruneOldRuns(\n outputsDir: string,\n keep: number,\n currentRunId: string,\n log: (line: string) => void,\n): Promise<void> {\n const { readdir } = await import(\"node:fs/promises\");\n let entries: string[];\n try {\n entries = await readdir(outputsDir);\n } catch {\n return;\n }\n const toPrune = runDirsToPrune(entries, keep, currentRunId);\n if (toPrune.length === 0) return;\n for (const dir of toPrune) {\n await rm(path.join(outputsDir, dir), { recursive: true, force: true }).catch((e) =>\n log(`[prune ] could not remove ${dir}: ${(e as Error).message}`),\n );\n }\n log(`[prune ] removed ${toPrune.length} old run dir(s), kept the ${keep} newest`);\n}\n","import { randomUUID } from \"node:crypto\";\nimport { rmSync } from \"node:fs\";\nimport { mkdir, readFile, rm, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { ulid } from \"../../engine/lib/ulid.ts\";\nimport { sha256Hex } from \"../../engine/storage/sha256.ts\";\nimport { creativeSlugFromCanvasPath } from \"./run-record.ts\";\n\n// Resume support for interrupted renders.\n//\n// `baker canvas run` orchestrates the whole DAG in-process. If the sandbox is\n// paused/killed mid-render (session end, 20-min E2B timeout), the process dies\n// with billed video jobs still running server-side. Because the exec\n// idempotency key is `<runId>:<cacheKey>`, a fresh run id on the next attempt\n// misses those in-flight jobs and RE-BILLS them.\n//\n// Two layers of resume identity:\n// - LOCAL (fast path): an in-flight marker under the gitignored outputs dir,\n// dropped at run start and removed on clean completion or handled failure.\n// Only a process kill (or a graceful signal abort) leaves it behind. The\n// sandbox preserves it across a pause.\n// - REMOTE (cross-sandbox): the run's own row in the backend run history. A NEW\n// sandbox (fresh clone, no local marker) asks `GET /api/canvas/runs/active`\n// for the newest run of the creative with the same SOURCE fingerprint\n// (`computeSourceSha`: canvas, prompt.json, scenes, compositions, formats), and\n// adopts it when the backend says it can be: an interrupted run, one stopped at a\n// checkpoint, or a `running` row whose keepalive is older than the backend's one\n// staleness threshold (`STALE_RUN_MS`, runReconcile.ts). Matching the source, not\n// the canvas bytes, is what keeps an edited scene or composition from adopting a\n// run that rendered something else.\n\n/**\n * Marker identity: the creative slug when the canvas lives under\n * `src/creatives/<slug>/` (stable across sandboxes, clones, and mount points),\n * else the canvas path relative to the working directory. Never the absolute\n * path: a workspace restored at a different absolute path would silently miss\n * its own marker and re-bill in-flight jobs. (The pre-slug absolute-path key is\n * no longer read: it was retired in July 2026, a marker only lives as long as\n * its sandbox, and a render that old has long settled, its nodes in the cache.)\n */\nfunction markerKey(canvasPath: string): string {\n const slug = creativeSlugFromCanvasPath(canvasPath);\n const identity = slug ?? path.relative(process.cwd(), path.resolve(canvasPath));\n return sha256Hex(Buffer.from(identity)).slice(0, 32);\n}\n\nfunction markerFile(outputsDir: string, canvasPath: string): string {\n return path.join(outputsDir, \".inflight\", `${markerKey(canvasPath)}.json`);\n}\n\n/** What a marker holds. `token` names the process that wrote it; `heartbeatAt` proves it still runs. */\nexport type RunMarker = {\n runId: string;\n pid?: number;\n token?: string;\n startedAt?: number;\n heartbeatAt?: number;\n /** The source fingerprint the run started on (`computeSourceSha`). */\n sourceSha?: string;\n};\n\nexport type ResolvedRunId = {\n runId: string;\n resumed: boolean;\n /** Where a resumed id came from: the local marker or backend run-history adoption. */\n source?: \"local\" | \"remote\";\n /** A resumed run renders the source it started on: a marker from another source (edited since) is false. */\n sameSource?: boolean;\n /** Set when the backend reports a LIVE run for this exact source by someone else: we start fresh and warn. */\n concurrentRunId?: string;\n /**\n * Set when the local marker belongs to a render still running in another\n * process of this sandbox (a backgrounded `baker canvas run`, or a subagent's).\n * The caller must refuse: two processes on one marker share its run id and\n * run directory, and the first to finish clears the other's marker.\n */\n rendering?: { runId: string; pid: number };\n};\n\n/** A run as `GET /api/canvas/runs/active` reports it. `adoptable` is the backend's staleness verdict. */\nexport type RemoteRun = {\n runId: string;\n status: string;\n interrupted?: boolean;\n adoptable?: boolean;\n updatedAt?: number;\n};\n\n/** Everything the remote adoption tier needs; only consulted for slug-attributed canvases. */\nexport type RemoteResumeSource = {\n creativeSlug: string;\n sourceSha: string;\n getActiveRun: (creativeSlug: string, sourceSha: string) => Promise<RemoteRun | null>;\n};\n\n/**\n * Adoption policy for a backend-reported run (pure, unit-tested). The backend owns the\n * staleness threshold and says `adoptable`; this only reads the verdict. Interrupted runs\n * and runs stopped at a checkpoint are always resumable; a `running` row the backend does\n * not call adoptable belongs to a live concurrent run.\n */\nexport function classifyRemoteRun(run: RemoteRun): \"adopt\" | \"concurrent\" | \"ignore\" {\n if (run.interrupted === true || run.status === \"awaiting_approval\") return \"adopt\";\n if (run.status !== \"running\") return \"ignore\";\n return run.adoptable === true ? \"adopt\" : \"concurrent\";\n}\n\n// The live render rewrites its marker every HEARTBEAT_MS. A marker whose heartbeat is\n// older than this belongs to a process that stopped, whatever now holds its pid.\nconst HEARTBEAT_MS = 20_000;\nexport const MARKER_LIVE_MS = 90_000;\n\n/**\n * Whether a marker's render is still running: its pid is alive (`kill(pid, 0)`, which\n * works on Linux and macOS alike) AND its heartbeat is fresh. The heartbeat is what makes\n * a reused pid harmless: after a sandbox restart the pid may belong to anything, but\n * nothing else rewrites this marker.\n */\nexport function isLiveRender(marker: RunMarker, now: number = Date.now()): boolean {\n if (marker.pid === undefined) return false;\n const beat = marker.heartbeatAt ?? marker.startedAt;\n if (beat === undefined || now - beat > MARKER_LIVE_MS) return false;\n try {\n process.kill(marker.pid, 0);\n return true;\n } catch (e) {\n return (e as NodeJS.ErrnoException).code === \"EPERM\";\n }\n}\n\n/**\n * Decide the run id: an explicit `--run-id` always wins; otherwise resume an\n * interrupted run's id when a local marker survives; otherwise continue the run a\n * creative was just restored from; otherwise (for creative canvases) adopt the\n * backend's resumable run for the same source fingerprint.\n * `fresh` skips both resume tiers. The remote tier is strictly best-effort: a\n * dead backend degrades to a fresh id with a warning.\n */\nexport async function resolveRunId(opts: {\n explicitRunId?: string;\n /** The unfinished run a creative was just restored from (`run --slug`), already vetted by the backend. */\n adoptedRunId?: string;\n fresh?: boolean;\n outputsDir: string;\n canvasPath: string;\n remote?: RemoteResumeSource;\n /** The source this run renders, compared with the marker's. */\n sourceSha?: string;\n isRendering?: (marker: RunMarker) => boolean;\n}): Promise<ResolvedRunId> {\n // Checked before any run id is chosen, `--run-id` included: resuming a run\n // that is still rendering is the same collision as starting a second one.\n const existing = await readMarker(opts.outputsDir, opts.canvasPath);\n if (\n existing?.pid !== undefined &&\n existing.pid !== process.pid &&\n (opts.isRendering ?? ((marker) => isLiveRender(marker)))(existing)\n ) {\n return { runId: existing.runId, resumed: false, rendering: { runId: existing.runId, pid: existing.pid } };\n }\n if (opts.explicitRunId) return { runId: opts.explicitRunId, resumed: false };\n if (!opts.fresh) {\n if (existing) {\n const sameSource = existing.sourceSha !== undefined && existing.sourceSha === opts.sourceSha;\n return { runId: existing.runId, resumed: true, source: \"local\", sameSource };\n }\n // A restored creative's source is the run's own snapshot, and adoption is keyed by the fingerprint.\n if (opts.adoptedRunId) return { runId: opts.adoptedRunId, resumed: true, source: \"remote\", sameSource: true };\n if (opts.remote) {\n try {\n const active = await opts.remote.getActiveRun(opts.remote.creativeSlug, opts.remote.sourceSha);\n if (active) {\n const decision = classifyRemoteRun(active);\n if (decision === \"adopt\") return { runId: active.runId, resumed: true, source: \"remote\", sameSource: true };\n if (decision === \"concurrent\") {\n return { runId: `r_${ulid()}`, resumed: false, concurrentRunId: active.runId };\n }\n }\n } catch (e) {\n const msg = e instanceof Error ? e.message : String(e);\n process.stderr.write(`[warn] resumable-run lookup failed (${msg}) — starting a fresh run\\n`);\n }\n }\n }\n return { runId: `r_${ulid()}`, resumed: false };\n}\n\nasync function readMarker(outputsDir: string, canvasPath: string): Promise<RunMarker | null> {\n try {\n const parsed = JSON.parse(await readFile(markerFile(outputsDir, canvasPath), \"utf8\")) as Record<string, unknown>;\n if (typeof parsed.runId !== \"string\" || parsed.runId.length === 0) return null;\n const num = (value: unknown) => (typeof value === \"number\" && Number.isFinite(value) ? value : undefined);\n return {\n runId: parsed.runId,\n ...(Number.isInteger(parsed.pid) ? { pid: parsed.pid as number } : {}),\n ...(typeof parsed.token === \"string\" ? { token: parsed.token } : {}),\n ...(num(parsed.startedAt) !== undefined ? { startedAt: num(parsed.startedAt) } : {}),\n ...(num(parsed.heartbeatAt) !== undefined ? { heartbeatAt: num(parsed.heartbeatAt) } : {}),\n ...(typeof parsed.sourceSha === \"string\" ? { sourceSha: parsed.sourceSha } : {}),\n };\n } catch {\n return null;\n }\n}\n\n/** The marker this process owns: its token, and the heartbeat to stop when the run ends. */\nexport type InFlightRun = { token: string; stop: () => void };\n\n/**\n * Drop the in-flight marker and keep its heartbeat going until `stop()`. Best-effort:\n * resume is an optimization, and a run never fails over a marker.\n */\nexport async function markRunInFlight(\n outputsDir: string,\n canvasPath: string,\n runId: string,\n sourceSha?: string,\n): Promise<InFlightRun> {\n const file = markerFile(outputsDir, canvasPath);\n const token = randomUUID();\n const startedAt = Date.now();\n const write = (heartbeatAt: number) =>\n writeFile(\n file,\n JSON.stringify({\n runId,\n pid: process.pid,\n token,\n canvasPath: path.resolve(canvasPath),\n startedAt,\n heartbeatAt,\n ...(sourceSha ? { sourceSha } : {}),\n }),\n );\n try {\n await mkdir(path.dirname(file), { recursive: true });\n await write(startedAt);\n } catch {\n // Best-effort.\n }\n const timer = setInterval(() => {\n // Only this process's marker is refreshed: if another run took the marker over, leave it.\n void readMarker(outputsDir, canvasPath)\n .then((marker) => (marker?.token === token ? write(Date.now()) : undefined))\n .catch(() => undefined);\n }, HEARTBEAT_MS);\n timer.unref();\n return { token, stop: () => clearInterval(timer) };\n}\n\nfunction busyFile(outputsDir: string, canvasPath: string): string {\n return path.join(outputsDir, \".inflight\", `${markerKey(canvasPath)}.busy.json`);\n}\n\n/**\n * Hold the canvas for one whole `canvas run` command: its render, its review and every\n * correction round. The run marker covers only a render, so a second command started while\n * the first reviewed would render too, and the first one's corrections would then replace\n * what the second delivered. `release` drops it; a killed process leaves it to go stale.\n */\nexport async function markCanvasBusy(\n outputsDir: string,\n canvasPath: string,\n runId: string,\n pid: number = process.pid,\n): Promise<{ release: () => void }> {\n const file = busyFile(outputsDir, canvasPath);\n const write = () => writeFile(file, JSON.stringify({ runId, pid, heartbeatAt: Date.now() }));\n try {\n await mkdir(path.dirname(file), { recursive: true });\n await write();\n } catch {\n // Best-effort, as the run marker.\n }\n const timer = setInterval(() => void write().catch(() => undefined), HEARTBEAT_MS);\n timer.unref();\n let released = false;\n const release = () => {\n if (released) return;\n released = true;\n clearInterval(timer);\n try {\n rmSync(file, { force: true });\n } catch {\n // Gone already.\n }\n };\n return { release };\n}\n\n/** Another live command holding the canvas (`markCanvasBusy`), or null. */\nexport async function canvasBusyElsewhere(\n outputsDir: string,\n canvasPath: string,\n now: number = Date.now(),\n): Promise<{ runId: string; pid: number } | null> {\n try {\n const held = JSON.parse(await readFile(busyFile(outputsDir, canvasPath), \"utf8\")) as RunMarker;\n if (typeof held.runId !== \"string\" || held.pid === undefined || held.pid === process.pid) return null;\n return isLiveRender(held, now) ? { runId: held.runId, pid: held.pid } : null;\n } catch {\n return null;\n }\n}\n\n/**\n * Remove the marker. With a `token`, only a marker this process wrote is removed, so a\n * run that finishes never clears the marker of a newer run of the same canvas.\n */\nexport async function clearRunMarker(outputsDir: string, canvasPath: string, token?: string): Promise<void> {\n try {\n if (token !== undefined) {\n const marker = await readMarker(outputsDir, canvasPath);\n if (marker?.token !== undefined && marker.token !== token) return;\n }\n await rm(markerFile(outputsDir, canvasPath), { force: true });\n } catch {\n // Ignore: a stale marker at worst triggers one harmless resume next time.\n }\n}\n","import { existsSync } from \"node:fs\";\nimport { mkdir, readdir, readFile, stat, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport type { BackendClient } from \"../../engine/client/backend-client.ts\";\nimport { sha256Hex } from \"../../engine/storage/sha256.ts\";\nimport { listSceneFiles, REBUILD_FILE } from \"./scene-files.ts\";\nimport { localPathParam } from \"./resolve-paths.ts\";\n\n// Portable run snapshots. An unpublished creative's canvas (and the sibling\n// files it ingests by path) exists only on its chat's never-pushed branch — a\n// different chat/sandbox cannot re-run it. At run start the CLI uploads the\n// canvas JSON plus every local file the canvas references to the\n// content-addressed R2 store and records a manifest URL on the run\n// (`canvasSnapshotUrl`), so `baker canvas run --slug <slug>` can reconstruct\n// `src/creatives/<slug>/` anywhere. Nothing is sent twice: a snapshot whose\n// files are exactly the last one uploaded for the creative reuses its manifest\n// without a request, and a file the store already holds (a HEAD on its public\n// URL) is not PUT again. Everything is best-effort: a failed snapshot warns and\n// never blocks the render.\n\nexport const SNAPSHOT_SCHEMA = \"baker-canvas-snapshot/1\";\n\nexport type SnapshotEntry = {\n /** Posix path relative to the canvas file's directory. */\n path: string;\n sha256: string;\n url: string;\n};\n\nexport type SnapshotManifest = {\n schema: typeof SNAPSHOT_SCHEMA;\n creativeSlug: string;\n /** Sha of the canvas JSON itself — must match the run record's canvasSha. */\n canvasSha: string;\n canvas: SnapshotEntry;\n files: SnapshotEntry[];\n skipped?: Array<{ path: string; reason: string }>;\n};\n\n// Definition files (canvas, prompt blueprints, composition HTML/CSS, small\n// reference images) are tens of KB to a few MB. Anything larger is either\n// already durable in R2 (video sources ingest by URL) or does not belong in a\n// snapshot — it is listed as `skipped` so a rerun elsewhere reports a precise\n// missing file instead of a mystery.\nconst MAX_SNAPSHOT_FILE_BYTES = 32 * 1024 * 1024;\n\nconst EXT_TO_MIME: Record<string, string> = {\n json: \"application/json\",\n html: \"text/html\",\n css: \"text/css\",\n js: \"text/javascript\",\n txt: \"text/plain\",\n md: \"text/markdown\",\n png: \"image/png\",\n jpg: \"image/jpeg\",\n jpeg: \"image/jpeg\",\n webp: \"image/webp\",\n gif: \"image/gif\",\n avif: \"image/avif\",\n mp3: \"audio/mpeg\",\n wav: \"audio/wav\",\n mp4: \"video/mp4\",\n webm: \"video/webm\",\n mov: \"video/quicktime\",\n ttf: \"font/ttf\",\n otf: \"font/otf\",\n woff: \"font/woff\",\n woff2: \"font/woff2\",\n};\n\nfunction mimeForFile(filePath: string): string {\n const ext = path.extname(filePath).slice(1).toLowerCase();\n return EXT_TO_MIME[ext] ?? \"application/octet-stream\";\n}\n\nfunction toPosix(p: string): string {\n return p.split(path.sep).join(\"/\");\n}\n\n/** Is `target` the directory itself or something under it? */\nfunction isInside(dir: string, target: string): boolean {\n const rel = path.relative(dir, target);\n return !rel.startsWith(\"..\") && !path.isAbsolute(rel);\n}\n\n/**\n * Every local filesystem reference a raw (not yet path-resolved) canvas\n * carries — the params `localPathParam` names, which are exactly the ones\n * `resolveRelativeCanvasPaths` resolves. Unfilled `[TODO …]` placeholders are excluded (the placeholder\n * gate owns those).\n */\nexport function localPathRefsFromCanvas(parsed: unknown): string[] {\n const nodes = (parsed as { nodes?: unknown })?.nodes;\n if (!Array.isArray(nodes)) return [];\n const refs = new Set<string>();\n for (const node of nodes) {\n const n = node as { type?: unknown; params?: Record<string, unknown> };\n const params = n.params;\n if (!params || typeof params !== \"object\") continue;\n const key = localPathParam(n);\n const value = key ? params[key] : undefined;\n if (isSnapshotablePath(value)) refs.add(value);\n }\n return [...refs];\n}\n\nfunction isSnapshotablePath(value: unknown): value is string {\n return typeof value === \"string\" && value.length > 0 && !value.includes(\"[TODO\");\n}\n\n/** Sibling files the source fingerprint reads beyond the canvas, its scenes and its compositions. */\nconst FINGERPRINTED_FILES = [\"prompt.json\", \"_definition.md\"] as const;\n\n/**\n * Every editable source file a rerun elsewhere needs: the canvas' own local\n * references (`localPathRefsFromCanvas`) plus a video creative's split blueprint —\n * each `scenes/sNN.json` and the frozen `prompt.rebuild.json` the sync re-flows\n * scene prompts from. These are not carried as canvas node params (scene prompts\n * are inlined into the graph at scaffold time), so they must be added explicitly.\n * `prompt.json` and `_definition.md` ride along when present: the source\n * fingerprint (`computeSourceSha`) reads them, and a restore that fingerprints\n * differently can never adopt the run it came from.\n * All are relative to the canvas dir; missing ones (e.g. a static ad with no\n * `scenes/`) are recorded as `skipped` by the caller's stat.\n */\nasync function sourceRefsToSnapshot(canvasDir: string, parsed: unknown): Promise<string[]> {\n const refs = new Set(localPathRefsFromCanvas(parsed));\n for (const sceneFile of await listSceneFiles(canvasDir)) {\n refs.add(toPosix(path.relative(canvasDir, sceneFile)));\n }\n refs.add(REBUILD_FILE);\n for (const fingerprinted of FINGERPRINTED_FILES) {\n if (existsSync(path.join(canvasDir, fingerprinted))) refs.add(fingerprinted);\n }\n return [...refs];\n}\n\n/** A snapshot as uploaded: its manifest URL and the identity of the files it holds. */\nexport type UploadedSnapshot = { identity: string; url: string };\n\ntype PlannedEntry = { path: string; bytes: Buffer; sha256: string; mime: string };\n\n/**\n * Upload the canvas + its local file references and return the manifest's public URL and\n * the snapshot's identity (every file's path and sha), or null on any failure (warned,\n * never fatal: the run itself must not depend on snapshot plumbing). When `previous` has\n * the same identity nothing is uploaded and it is returned as is.\n */\nexport async function uploadRunSnapshot(\n client: BackendClient,\n opts: {\n canvasPath: string;\n raw: string;\n creativeSlug: string;\n parsed: unknown;\n previous?: UploadedSnapshot;\n signal?: AbortSignal;\n },\n): Promise<UploadedSnapshot | null> {\n try {\n const canvasDir = path.dirname(opts.canvasPath);\n const canvasBytes = Buffer.from(opts.raw);\n const canvasEntry: PlannedEntry = {\n path: path.basename(opts.canvasPath),\n bytes: canvasBytes,\n sha256: sha256Hex(canvasBytes),\n mime: \"application/json\",\n };\n\n const files: PlannedEntry[] = [];\n const skipped: Array<{ path: string; reason: string }> = [];\n for (const refPath of await sourceRefsToSnapshot(canvasDir, opts.parsed)) {\n const abs = path.isAbsolute(refPath) ? refPath : path.resolve(canvasDir, refPath);\n // A reference outside the creative folder — the brand logo at `../../brand/logos`, or an\n // absolute path — cannot be carried in this manifest: every entry is anchored at the\n // creative dir, and `restoreRunSnapshot` rejects an escaping entry outright, which would\n // abort the ENTIRE restore rather than lose one file. A rerun happens in another sandbox of\n // the SAME company workspace, where a committed asset is already on disk, so record the\n // omission and keep the snapshot restorable.\n if (!isInside(canvasDir, abs)) {\n skipped.push({\n path: toPosix(path.relative(canvasDir, abs)),\n reason: \"outside the creative folder — read from the workspace on rerun\",\n });\n continue;\n }\n let st: Awaited<ReturnType<typeof stat>>;\n try {\n st = await stat(abs);\n } catch {\n skipped.push({ path: toPosix(path.relative(canvasDir, abs)), reason: \"missing\" });\n continue;\n }\n const fileList = st.isDirectory() ? await listFilesRecursive(abs) : [abs];\n for (const file of fileList) {\n const rel = toPosix(path.relative(canvasDir, file));\n const size = (await stat(file)).size;\n if (size > MAX_SNAPSHOT_FILE_BYTES) {\n skipped.push({ path: rel, reason: `too large (${size} bytes)` });\n continue;\n }\n const bytes = await readFile(file);\n files.push({ path: rel, bytes, sha256: sha256Hex(bytes), mime: mimeForFile(file) });\n }\n }\n\n const identity = sha256Hex(\n Buffer.from(\n JSON.stringify({\n creativeSlug: opts.creativeSlug,\n entries: [canvasEntry, ...files].map((entry) => [entry.path, entry.sha256]),\n skipped,\n }),\n ),\n );\n if (opts.previous?.identity === identity) return opts.previous;\n\n const put = (bytes: Buffer, mime: string) => putContentAddressed(client, bytes, mime, opts.signal);\n const canvasUpload = await put(canvasEntry.bytes, canvasEntry.mime);\n const uploaded: SnapshotEntry[] = [];\n for (const file of files) {\n const upload = await put(file.bytes, file.mime);\n uploaded.push({ path: file.path, sha256: upload.sha256, url: upload.url });\n }\n\n const manifest: SnapshotManifest = {\n schema: SNAPSHOT_SCHEMA,\n creativeSlug: opts.creativeSlug,\n canvasSha: canvasUpload.sha256,\n canvas: { path: canvasEntry.path, sha256: canvasUpload.sha256, url: canvasUpload.url },\n files: uploaded,\n skipped: skipped.length > 0 ? skipped : undefined,\n };\n const manifestUpload = await put(Buffer.from(JSON.stringify(manifest)), \"application/json\");\n return { identity, url: manifestUpload.url };\n } catch (e) {\n const msg = e instanceof Error ? e.message : String(e);\n process.stderr.write(`[warn] canvas snapshot not uploaded (${msg}) — this run cannot be re-run from another workspace\\n`);\n return null;\n }\n}\n\n/** A graph bigger than this is not kept: a correction elsewhere then corrects the picture by URL. */\nconst MAX_GRAPH_BYTES = 4 * 1024 * 1024;\n\n/**\n * Keep the graph a run executes (every node's declaration, a version grown on top of another\n * included) in the content-addressed store, and return its URL for the run record (`graphUrl`), so\n * a correction made in another workspace grows on this version (`versionRun`). Null when it is\n * too large or the upload fails (warned, never fatal).\n */\nexport async function uploadRunGraph(client: BackendClient, graph: unknown, signal?: AbortSignal): Promise<string | null> {\n try {\n const bytes = Buffer.from(JSON.stringify(graph));\n if (bytes.length > MAX_GRAPH_BYTES) return null;\n return (await putContentAddressed(client, bytes, \"application/json\", signal)).url;\n } catch (e) {\n const msg = e instanceof Error ? e.message : String(e);\n process.stderr.write(`[warn] run graph not kept (${msg}) — a correction from another workspace starts from its picture\\n`);\n return null;\n }\n}\n\n/**\n * Put `bytes` into the content-addressed store unless it is already there. The presign is\n * always asked for (it is what registers the object with the store's garbage collection);\n * the upload itself is skipped when a HEAD on the public URL finds the object.\n */\nasync function putContentAddressed(\n client: BackendClient,\n bytes: Buffer,\n mime: string,\n signal?: AbortSignal,\n): Promise<{ sha256: string; url: string }> {\n const sha256 = sha256Hex(bytes);\n const { putUrl, publicUrl } = await client.presignAssetUpload(sha256, mime, signal, \"blueprint\");\n const held = await fetch(publicUrl, { method: \"HEAD\", signal }).then(\n (res) => res.ok,\n () => false,\n );\n if (held) return { sha256, url: publicUrl };\n const res = await fetch(putUrl, {\n method: \"PUT\",\n body: new Uint8Array(bytes),\n headers: { \"Content-Type\": mime },\n signal,\n });\n if (!res.ok) throw new Error(`snapshot PUT failed ${res.status} ${res.statusText}`);\n return { sha256, url: publicUrl };\n}\n\nasync function listFilesRecursive(dir: string): Promise<string[]> {\n const entries = await readdir(dir, { recursive: true, withFileTypes: true });\n return entries.filter((d) => d.isFile()).map((d) => path.join(d.parentPath, d.name));\n}\n\n/** Local files whose content differs from the snapshot — overwriting needs an explicit `--force-remote`. */\nexport class SnapshotConflictError extends Error {\n conflicts: string[];\n constructor(conflicts: string[]) {\n super(`local files differ from the recorded snapshot: ${conflicts.join(\", \")}`);\n this.name = \"SnapshotConflictError\";\n this.conflicts = conflicts;\n }\n}\n\nexport type RestoreResult = {\n /** Absolute path of the restored canvas file — the thing to run. */\n canvasPath: string;\n restored: string[];\n upToDate: string[];\n};\n\n/**\n * Materialize a snapshot into `targetDir` (the creative's directory). Every\n * write stays INSIDE the target dir (escaping paths are rejected), every\n * download is sha-verified, files already matching the snapshot are left\n * untouched, and differing local files throw `SnapshotConflictError` unless\n * `force` — never silently clobber someone's local edits.\n */\nexport async function restoreRunSnapshot(\n manifest: SnapshotManifest,\n targetDir: string,\n opts: { force?: boolean } = {},\n): Promise<RestoreResult> {\n const entries = [manifest.canvas, ...manifest.files];\n const resolvedTarget = path.resolve(targetDir);\n\n const planned: Array<{ entry: SnapshotEntry; target: string }> = [];\n const conflicts: string[] = [];\n const upToDate: string[] = [];\n for (const entry of entries) {\n if (path.isAbsolute(entry.path) || entry.path.split(\"/\").includes(\"..\")) {\n throw new Error(`snapshot entry escapes the creative directory: ${entry.path}`);\n }\n const target = path.resolve(resolvedTarget, entry.path);\n if (target !== resolvedTarget && !target.startsWith(resolvedTarget + path.sep)) {\n throw new Error(`snapshot entry escapes the creative directory: ${entry.path}`);\n }\n const existing = await readFile(target).catch(() => null);\n if (existing) {\n if (sha256Hex(existing) === entry.sha256) {\n upToDate.push(entry.path);\n continue;\n }\n if (!opts.force) {\n conflicts.push(entry.path);\n continue;\n }\n }\n planned.push({ entry, target });\n }\n if (conflicts.length > 0) throw new SnapshotConflictError(conflicts);\n\n const restored: string[] = [];\n for (const { entry, target } of planned) {\n const res = await fetch(entry.url);\n if (!res.ok) throw new Error(`snapshot download failed for ${entry.path}: ${res.status} ${res.statusText}`);\n const bytes = Buffer.from(await res.arrayBuffer());\n if (sha256Hex(bytes) !== entry.sha256) {\n throw new Error(`snapshot download for ${entry.path} does not match its recorded sha256`);\n }\n await mkdir(path.dirname(target), { recursive: true });\n await writeFile(target, bytes);\n restored.push(entry.path);\n }\n return { canvasPath: path.resolve(resolvedTarget, manifest.canvas.path), restored, upToDate };\n}\n","/**\n * A static ad's next version grown on top of the one before it, rather than in place of it.\n *\n * Production, Oct 2026 (Service Club): every correction ran as a new, small graph (an ingest of the\n * last picture, one render, the sizes), so the version the dashboard showed had lost the three\n * generations and the pick it came from, and each correction read as a new ad. Now a version made\n * from another one runs that version's own graph, every render in it kept exactly as it was made,\n * with the change appended on top:\n *\n * gen_1..3 → gen → prefilter → edit_1 → edit_1_frame → master → sizes\n * edit_2 → edit_2_frame → master … (a second correction)\n * gen_1..3 → gen → chosen → chosen_frame → master → sizes (another variant chosen)\n *\n * The kept nodes are *pinned*: the engine passes on the outputs that version recorded and never\n * executes them (`RunOptions.pinned`), so nothing is re-billed or re-rolled, however prompt.json\n * changed since (a words edit re-projects every brief, which would miss the cache).\n *\n * Pure: the current canvas (the file's, as prepared) and the version's run in, the grown canvas\n * and its pinned outputs out; nothing is written.\n */\nimport { canonicalize } from \"@baker/canvas-contract\";\nimport type { Canvas, NodeDecl } from \"../schema/canvas.ts\";\nimport { fixBriefNode } from \"./static-render-briefs.ts\";\nimport {\n SERIES_LEAD_ROLE,\n STATIC_FIX_ROLE,\n STATIC_MASTER_ROLE,\n STATIC_PICK_ROLE,\n STATIC_VARIANT_CALL_ROLE,\n STATIC_VARIANTS_ROLE,\n staticMasterFormat,\n VARIANT_PREFILTER_ROLE,\n} from \"./static-topology.ts\";\n\n/** A finished run of a static ad, as its manifest keeps it: the graph that ran and every node's outputs. */\nexport type VersionRun = { canvas: { nodes: NodeDecl[] }; outputs: Readonly<Record<string, Record<string, unknown>>> };\n\n/** What the new version adds on top of the one before it. */\nexport type Growth =\n /** A correction of the picture the version shows (`--fix`, or prompt.json's words or colours edited). */\n | { kind: \"edit\"; instruction: string; promptJson: unknown }\n /** Another of the version's variants, by its sha256 (or a unique prefix), in place of the pick. */\n | { kind: \"variant\"; sha256: string }\n /** Nothing: the same picture, its sizes made again (a size laid out again on its own). */\n | { kind: \"keep\" };\n\nexport type GrownCanvas = { canvas: Canvas; pinned: Record<string, Record<string, unknown>> };\n\n/** The roles of the nodes that make the picture every size is made from. */\nconst PICTURE_ROLES: ReadonlySet<string> = new Set([\n STATIC_VARIANT_CALL_ROLE,\n STATIC_VARIANTS_ROLE,\n VARIANT_PREFILTER_ROLE,\n STATIC_PICK_ROLE,\n STATIC_FIX_ROLE,\n SERIES_LEAD_ROLE,\n]);\n\nconst EDIT_ID = /^edit_(\\d+)$/;\n\n/** The node a `$ref:` names. */\nfunction refNode(ref: unknown): string | null {\n return typeof ref === \"string\" ? (ref.match(/^\\$ref:([a-z][a-z0-9_]*)\\./)?.[1] ?? null) : null;\n}\n\n/** Every node id a node reads, through any `$ref:` in its inputs or params. */\nfunction depsOf(node: NodeDecl): string[] {\n const found: string[] = [];\n const walk = (v: unknown): void => {\n if (typeof v === \"string\") {\n const id = refNode(v);\n if (id) found.push(id);\n } else if (Array.isArray(v)) v.forEach(walk);\n else if (v && typeof v === \"object\") Object.values(v).forEach(walk);\n };\n walk(node.inputs);\n walk(node.params);\n return found;\n}\n\n/** `id` and every node it reads, transitively, in the canvas's order. */\nfunction ancestors(nodes: readonly NodeDecl[], id: string): NodeDecl[] {\n const byId = new Map(nodes.map((n) => [n.id, n] as const));\n const seen = new Set<string>();\n const visit = (at: string): void => {\n const n = byId.get(at);\n if (!n || seen.has(at)) return;\n seen.add(at);\n for (const dep of depsOf(n)) visit(dep);\n };\n visit(id);\n return nodes.filter((n) => seen.has(n.id));\n}\n\nconst isPicture = (n: NodeDecl): boolean => PICTURE_ROLES.has(n.tags?.role ?? \"\");\n\n/** The prefilter that frames the current graph's picture for its master, when it has one. */\nfunction framingPrefilter(nodes: readonly NodeDecl[], master: NodeDecl): NodeDecl | undefined {\n const reads = JSON.stringify(master.inputs ?? {});\n return nodes.find((n) => n.tags?.role === VARIANT_PREFILTER_ROLE && reads.includes(`$ref:${n.id}.`));\n}\n\n/**\n * The node that frames `image` for the master as the current graph frames a variant: its prefilter,\n * checked against the current prompt.json, never asking the judge about one picture. None on a graph\n * without one (the master reads the picture itself).\n */\nfunction frameNode(prefilter: NodeDecl | undefined, id: string, image: string): NodeDecl | null {\n if (!prefilter) return null;\n const { judge_model: _judge, judge_prompt: _prompt, ...params } = prefilter.params ?? {};\n return { ...prefilter, id, inputs: { ...prefilter.inputs, images: [image] }, params };\n}\n\n/** The `#index` of the variant whose sha256 starts with `sha` in the variants node's `images`, or null. */\nfunction variantIndex(outputs: Record<string, unknown> | undefined, sha: string): number | null {\n const images = Array.isArray(outputs?.images) ? (outputs.images as Array<{ sha256?: unknown }>) : [];\n const want = sha.trim().toLowerCase();\n if (!/^[0-9a-f]{8,64}$/.test(want)) return null;\n const hits = images.flatMap((img, i) => (typeof img?.sha256 === \"string\" && img.sha256.startsWith(want) ? [i] : []));\n return hits.length === 1 ? (hits[0] ?? null) : null;\n}\n\n/** Each variant render of `nodes` and everything it reads: what the variants are made from. */\nfunction variantSources(nodes: readonly NodeDecl[]): NodeDecl[] {\n const calls = nodes.filter((n) => n.tags?.role === STATIC_VARIANT_CALL_ROLE);\n const ids = new Set(calls.flatMap((call) => ancestors(nodes, call.id).map((n) => n.id)));\n return nodes.filter((n) => ids.has(n.id));\n}\n\n/** A file of the workspace an ingest node reads, by its path relative to the canvas. */\nexport type VariantFile = { id: string; path: string; expect: string };\n\n/** The workspace files the variants are made from: their bytes can change under the same declaration. */\nexport function variantFiles(canvas: Canvas): VariantFile[] {\n return variantSources(canvas.nodes).flatMap((n) => {\n const { source, path, expect } = n.params ?? {};\n return n.type === \"ingest\" && source === \"path\" && typeof path === \"string\"\n ? [{ id: n.id, path, expect: String(expect ?? \"\") }]\n : [];\n });\n}\n\n/** A node as declared; a workspace file by everything but where it sits, which differs between checkouts (its bytes are compared instead). */\nfunction declared(n: NodeDecl): string {\n const { path: _where, ...params } = n.params ?? {};\n const own = n.type === \"ingest\" && n.params?.source === \"path\" ? params : (n.params ?? {});\n return canonicalize({ type: n.type, inputs: n.inputs ?? {}, params: own });\n}\n\n/**\n * Whether `current` would make the variants `version` made: every node they are made from (the\n * briefs, the models, the references and what those are made from) declared as the version\n * declared it, and every workspace file among them ingested as the same bytes. `ingested` holds,\n * by node id, what each of `variantFiles(current)` ingests as now (its sha256, and the sha256 of\n * the picture it is made into, where that differs). Then the version's picture still stands, and\n * a run that changes nothing it is made from builds on it (`growFromVersion` with `keep`) rather\n * than drawing the scaffold's own, whose cache holds the variants from before a regeneration.\n */\nexport function makesSameVariants(\n current: Canvas,\n version: VersionRun,\n ingested: Readonly<Record<string, readonly string[]>>,\n): boolean {\n const sources = variantSources(current.nodes);\n if (sources.length === 0) return false;\n const was = new Map(version.canvas.nodes.map((n) => [n.id, n] as const));\n const sameDeclaration = sources.every((n) => {\n const before = was.get(n.id);\n return before !== undefined && declared(before) === declared(n);\n });\n return (\n sameDeclaration &&\n variantFiles(current).every((file) => {\n const asset = version.outputs[file.id]?.asset as { sha256?: unknown } | undefined;\n return typeof asset?.sha256 === \"string\" && (ingested[file.id] ?? []).includes(asset.sha256);\n })\n );\n}\n\n/**\n * The part of a grown canvas this run makes, for the readers that report on the run (the review,\n * the variant checks' spend): every node but the kept ones, except the kept picture the master\n * reads when the run adds none (a size laid out again), so its checks still say where it sits.\n */\nexport function madeThisRun(grown: GrownCanvas): Canvas {\n const master = grown.canvas.nodes.find((n) => n.tags?.role === STATIC_MASTER_ROLE);\n const head = refNode(master?.inputs?.image);\n const nodes = grown.canvas.nodes.filter((n) => !(n.id in grown.pinned) || n.id === head);\n return { ...grown.canvas, nodes };\n}\n\n/**\n * The current canvas grown from `version` by `growth`, and the outputs of every node kept from\n * that version; null when the version cannot be grown (no master, a kept node without recorded\n * outputs, an unknown variant): the caller falls back to correcting the version's picture by URL.\n */\nexport function growFromVersion(current: Canvas, version: VersionRun, growth: Growth): GrownCanvas | null {\n const master = current.nodes.find((n) => n.tags?.role === STATIC_MASTER_ROLE);\n const history = master ? versionHistory(current, version, growth) : null;\n if (!master || !history) return null;\n const { kept, pinned } = history;\n const keptIds = new Set(kept.map((n) => n.id));\n // The current graph's own way to its picture gives way; a series ad's lead sizes stay with the sizes.\n const stage = new Set(\n ancestors(current.nodes, master.id)\n .filter((n) => n.id !== master.id && isPicture(n))\n .map((n) => n.id),\n );\n const rest = current.nodes.filter((n) => !stage.has(n.id) && !keptIds.has(n.id));\n const top = stepsOnTop({ current, master, kept, rest }, history.picture, growth);\n if (!top) return null;\n const at = rest.findIndex((n) => n.id === master.id);\n const nodes = rest.map((n) => (n.id === master.id ? { ...n, inputs: { ...n.inputs, image: top.picture } } : n));\n return {\n canvas: { ...current, nodes: [...nodes.slice(0, at), ...kept, ...top.added, ...nodes.slice(at)] },\n pinned,\n };\n}\n\n/**\n * What of `version` the new one keeps, each with the outputs it recorded, and the `$ref:` of the\n * picture to grow from: the picture the version shows, or the variant chosen among its own. Null\n * when the version has no master, the variant is unknown, or a kept step recorded no outputs.\n */\nfunction versionHistory(\n current: Canvas,\n version: VersionRun,\n growth: Growth,\n): { kept: NodeDecl[]; pinned: Record<string, Record<string, unknown>>; picture: string } | null {\n const was = version.canvas.nodes;\n const image = was.find((n) => n.tags?.role === STATIC_MASTER_ROLE)?.inputs?.image;\n if (typeof image !== \"string\") return null;\n let picture = image;\n let from = refNode(image) ?? \"\";\n if (growth.kind === \"variant\") {\n const variants = was.find((n) => n.tags?.role === STATIC_VARIANTS_ROLE);\n const at = variants ? variantIndex(version.outputs[variants.id], growth.sha256) : null;\n if (!variants || at === null) return null;\n picture = `$ref:${variants.id}.images#${at}`;\n from = variants.id;\n }\n // The version's inputs the current graph still has (its prompt.json, logo, type) stay the current ones.\n const own = new Set(current.nodes.map((n) => n.id));\n const kept = ancestors(was, from).filter((n) => isPicture(n) || !own.has(n.id));\n const pinned: Record<string, Record<string, unknown>> = {};\n for (const n of kept) {\n const outputs = version.outputs[n.id];\n if (!outputs) return null;\n pinned[n.id] = outputs;\n }\n return { kept, pinned, picture };\n}\n\ntype Grafting = { current: Canvas; master: NodeDecl; kept: NodeDecl[]; rest: NodeDecl[] };\n\n/** The steps the new version adds after what it keeps, and the `$ref:` of the picture its master reads. */\nfunction stepsOnTop(at: Grafting, picture: string, growth: Growth): { added: NodeDecl[]; picture: string } | null {\n if (growth.kind === \"keep\") return { added: [], picture };\n const prefilter = framingPrefilter(at.current.nodes, at.master);\n const step = growth.kind === \"edit\" ? editStep(at, picture, growth) : chosenStep(picture);\n if (!step) return null;\n const frame = frameNode(prefilter, `${step.id}_frame`, `$ref:${step.id}.images#0`);\n return frame\n ? { added: [step, frame], picture: `$ref:${frame.id}.image` }\n : { added: [step], picture: `$ref:${step.id}.images#0` };\n}\n\n/** The next correction, `edit_<n>`: one render that edits `picture`, briefed from the current prompt.json. */\nfunction editStep(at: Grafting, picture: string, growth: Extract<Growth, { kind: \"edit\" }>): NodeDecl | null {\n const n = 1 + Math.max(0, ...at.kept.map((k) => Number(k.id.match(EDIT_ID)?.[1] ?? 0)));\n const template = at.current.nodes.find(\n (v) => v.type === \"image_generate\" && [STATIC_VARIANT_CALL_ROLE, STATIC_VARIANTS_ROLE].includes(v.tags?.role ?? \"\"),\n );\n if (!template) return null;\n const masterFormat = staticMasterFormat(at.current);\n const brief = fixBriefNode({ nodes: [...at.kept, ...at.rest] }, template, growth.promptJson, {\n instruction: growth.instruction,\n previous: picture,\n ...(masterFormat ? { format: masterFormat } : {}),\n });\n const { n: _n, ...params } = brief.params ?? {};\n return {\n id: `edit_${n}`,\n type: brief.type,\n ...(brief.inputs ? { inputs: brief.inputs } : {}),\n params,\n tags: { role: STATIC_FIX_ROLE },\n };\n}\n\n/** The variant chosen among the version's own, passed on as its pick. */\nfunction chosenStep(picture: string): NodeDecl {\n return { id: \"chosen\", type: \"collect\", inputs: { images: [picture] }, tags: { role: STATIC_PICK_ROLE } };\n}\n","/**\n * Who a static ad's copy names, read by the text model the claim gate reads with (`claim-check.ts`\n * `CLAIMS_MODEL`): a fast extraction pinned to one provider at temperature 0, so the same copy\n * reads the same, and kept in the workspace's cache by the copy, the model and the prompt. The\n * answer is checked against the copy (`readPeople`); a reading that fails is null, and the caller\n * casts nobody rather than guess. Measured on 2026-10-07 (scripts/named-people-evals): see\n * docs/decision-model.md.\n */\nimport { createHash } from \"node:crypto\";\nimport { mkdir, readFile, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { askAboutText, type ReviewUsage } from \"../../engine/nodes/local/lib/render-review.ts\";\nimport {\n type NamedPerson,\n PEOPLE_PROMPT_VERSION,\n type PeopleReader,\n peoplePrompt,\n readPeople,\n} from \"../../engine/scaffold/static-named-people.ts\";\nimport { CLAIMS_MODEL, CLAIMS_REQUEST } from \"./claim-check.ts\";\n\nconst PEOPLE_TIMEOUT_MS = 30_000;\n\n/** The real reader: each copy read once and kept in `cacheDir`, the spend of every call made going to `spent`. */\nexport function peopleReader(cacheDir: string, spent: (usage: ReviewUsage) => void): PeopleReader {\n const dir = path.join(cacheDir, \"named-people\");\n return async (lines) => {\n const said = lines.filter((l) => l.trim());\n if (said.length === 0) return [];\n const key = createHash(\"sha256\")\n .update(JSON.stringify([PEOPLE_PROMPT_VERSION, CLAIMS_MODEL, said]))\n .digest(\"hex\");\n const file = path.join(dir, `${key}.json`);\n const cached = await readFile(file, \"utf8\")\n .then((text) => readPeople(JSON.parse(text), said))\n .catch(() => null);\n if (cached) return cached;\n const answer = await askAboutText(CLAIMS_MODEL, peoplePrompt(said), spent, {\n timeoutMs: PEOPLE_TIMEOUT_MS,\n request: CLAIMS_REQUEST,\n });\n const people: NamedPerson[] | null = readPeople(answer, said);\n if (people) {\n await mkdir(dir, { recursive: true });\n await writeFile(file, JSON.stringify(answer), \"utf8\");\n }\n return people;\n };\n}\n","import type { AvatarSummary, AvatarsResearchResponse } from \"@baker/api\";\nimport type { FoundAvatar } from \"../../engine/scaffold/static-named-people.ts\";\nimport { readAvatars, writeAvatars } from \"./transport.ts\";\nimport { waitForSheet } from \"./wait.ts\";\n\n/** One research can read several profiles and photos: the route's own budget. */\nconst RESEARCH_TIMEOUT_MS = 180_000;\n\n/**\n * The avatar of a real person the copy names, ready to ground a render on: the one the company\n * has, else found from their public photos and built (`baker avatars research --create`), waited\n * on until its identity sheet settles. Null when they cannot be found, or no sheet came of it.\n */\nexport async function avatarOfNamedPerson(who: string): Promise<FoundAvatar | null> {\n const research = await writeAvatars<AvatarsResearchResponse>(\n \"/api/avatars/research\",\n { who, create: true },\n { timeoutMs: RESEARCH_TIMEOUT_MS },\n );\n const handle = research.avatar?.handle;\n if (research.status !== \"found\" || !handle) return null;\n const read = () => readAvatars<AvatarSummary>(\"/api/avatars/get\", { handle });\n const avatar = await waitForSheet(await read(), read);\n return avatar.sheetUrl ? { handle, sheetUrl: avatar.sheetUrl } : null;\n}\n","import { existsSync } from \"node:fs\";\nimport path from \"node:path\";\nimport type { BackendClient } from \"../../engine/client/backend-client.ts\";\nimport { restoreRunSnapshot, SNAPSHOT_SCHEMA, SnapshotConflictError, type SnapshotManifest } from \"./run-snapshot.ts\";\n\n// Mirrors the backend slug contract (creatives/slug.ts): an invalid slug would 400\n// server-side anyway; failing here gives a clearer message.\nconst SLUG_PATTERN = /^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/;\n\n/** Why a creative could not be found or restored by name. Nothing ran, nothing was billed. */\nexport class SlugRestoreError extends Error {\n readonly code: string;\n readonly fix: string | undefined;\n constructor(code: string, message: string, fix?: string) {\n super(message);\n this.name = \"SlugRestoreError\";\n this.code = code;\n this.fix = fix;\n }\n}\n\n/**\n * The canvas to run for `baker canvas run --slug <slug>`.\n *\n * The creative's own canvas in this workspace when it is here: running a creative by name\n * never overwrites local work. When it is not (a fresh workspace, a creative another chat\n * made and never published), its files are restored from the newest run that recorded a\n * portable snapshot, into `src/creatives/<slug>/`. `forceRemote` restores even over local\n * files, replacing the ones that differ from the snapshot.\n *\n * A restore brings back exactly the files that run rendered. When that run did not finish\n * (interrupted, or stopped at a checkpoint) and the backend says it may be taken over,\n * `adoptRunId` names it, so the caller continues it under the same id: its billed jobs\n * re-attach instead of being paid for again.\n */\nexport async function canvasForSlug(\n slug: string,\n opts: {\n workspaceRoot: string;\n forceRemote: boolean;\n /** Built only when a restore is needed, so a local run never asks for credentials. */\n client: () => BackendClient | null;\n log: (line: string) => void;\n },\n): Promise<{ canvasPath: string; adoptRunId?: string }> {\n if (!SLUG_PATTERN.test(slug)) {\n throw new SlugRestoreError(\"invalid_slug\", `\"${slug}\" is not a valid creative slug`);\n }\n const targetDir = path.join(opts.workspaceRoot, \"src\", \"creatives\", slug);\n const local = path.join(targetDir, `${slug}.canvas.json`);\n if (!opts.forceRemote && existsSync(local)) return { canvasPath: local };\n\n const client = opts.client();\n if (!client) {\n throw new SlugRestoreError(\n \"missing_credentials\",\n `\"${slug}\" is not in this workspace, and restoring it from run history needs Baker credentials (BAKER_API_URL / BAKER_API_KEY).`,\n );\n }\n const latest = await client.getLatestSnapshotRun(slug);\n if (!latest) {\n throw new SlugRestoreError(\n \"no_snapshot_run\",\n `No creative \"${slug}\" in this workspace, and no recorded run of it to restore from.`,\n \"Check the slug against `ls src/creatives`, or scaffold the creative first.\",\n );\n }\n\n const manifest = await fetchManifest(latest.canvasSnapshotUrl);\n if (latest.canvasSha && manifest.canvasSha !== latest.canvasSha) {\n throw new SlugRestoreError(\"snapshot_mismatch\", `the snapshot of run ${latest.runId} does not match its recorded canvas`);\n }\n try {\n const restore = await restoreRunSnapshot(manifest, targetDir, { force: opts.forceRemote });\n opts.log(\n restore.restored.length > 0\n ? `[restore] ${restore.restored.length} file(s) from run ${latest.runId}: ${restore.restored.join(\", \")}`\n : `[restore] local files already match run ${latest.runId}, nothing downloaded`,\n );\n for (const skipped of manifest.skipped ?? []) {\n opts.log(`[warn] snapshot omitted ${skipped.path} (${skipped.reason}); supply it locally if the run needs it fresh`);\n }\n return { canvasPath: restore.canvasPath, adoptRunId: await adoptableRun(client, slug, latest.runId) };\n } catch (e) {\n if (e instanceof SnapshotConflictError) {\n throw new SlugRestoreError(\n \"local_files_differ\",\n `local files differ from the recorded snapshot: ${e.conflicts.join(\", \")}`,\n \"Re-run with --force-remote to overwrite them, or run the local canvas file directly with `baker canvas run <file>`.\",\n );\n }\n throw e;\n }\n}\n\n/** The restored run's id, when the backend says it is unfinished and may be taken over. */\nasync function adoptableRun(client: BackendClient, slug: string, restoredRunId: string): Promise<string | undefined> {\n const active = await client.getActiveRun(slug).catch(() => null);\n return active?.runId === restoredRunId && active.adoptable === true ? restoredRunId : undefined;\n}\n\nasync function fetchManifest(url: string): Promise<SnapshotManifest> {\n const res = await fetch(url);\n if (!res.ok) {\n throw new SlugRestoreError(\"snapshot_unavailable\", `snapshot manifest download failed: ${res.status} ${res.statusText}`);\n }\n const manifest = (await res.json()) as SnapshotManifest;\n if (manifest?.schema !== SNAPSHOT_SCHEMA || typeof manifest.canvas?.path !== \"string\") {\n throw new SlugRestoreError(\"snapshot_invalid\", \"snapshot manifest has an unexpected shape\");\n }\n return manifest;\n}\n","/**\n * `baker canvas run --series <lead>`: every ad of a series rendered at once, each the lead's ready\n * version with its own words (`series-member.ts`). Each ad is its own run (its own review,\n * corrections, verdict and version); they only start together instead of one after another, and\n * an ad already ready from the lead's current version is not rendered again.\n */\n\ntype Failure = { code: string; message: string; fix?: string };\n\n/** What one ad of the series came to. */\nexport type SeriesAdResult = {\n slug: string;\n status: \"ready\" | \"ready_with_notes\" | \"needs_fixes\" | \"up_to_date\" | \"refused\" | \"failed\";\n run_id?: string;\n files?: unknown;\n error?: Failure;\n};\n\n/** Whether an ad renders: refused before anything bills, already up to date, or to run. */\nexport type SeriesPlan = { refused: Failure } | { run: false; runId?: string } | { run: true };\n\n/** Render the ads of a series at once (`run` is one `baker canvas run --slug`), in the order given. */\nexport async function runSeries(\n slugs: readonly string[],\n deps: {\n plan: (slug: string) => Promise<SeriesPlan>;\n run: (slug: string) => Promise<Record<string, unknown>>;\n },\n): Promise<SeriesAdResult[]> {\n return Promise.all(\n slugs.map(async (slug): Promise<SeriesAdResult> => {\n const plan = await deps.plan(slug);\n if (\"refused\" in plan) return { slug, status: \"refused\", error: plan.refused };\n if (!plan.run) return { slug, status: \"up_to_date\", ...(plan.runId ? { run_id: plan.runId } : {}) };\n return resultOf(slug, await deps.run(slug));\n }),\n );\n}\n\nfunction resultOf(slug: string, answer: Record<string, unknown>): SeriesAdResult {\n if (answer.ok !== true) {\n const error = (answer.error ?? {}) as Partial<Failure>;\n return {\n slug,\n status: \"failed\",\n error: {\n code: error.code ?? \"render_failed\",\n message: error.message ?? \"The render did not finish.\",\n ...(error.fix ? { fix: error.fix } : {}),\n },\n };\n }\n const verdict = answer.verdict;\n const status = verdict === \"ready\" || verdict === \"ready_with_notes\" || verdict === \"needs_fixes\" ? verdict : \"ready\";\n return {\n slug,\n status,\n ...(typeof answer.run_id === \"string\" ? { run_id: answer.run_id } : {}),\n ...(answer.files !== undefined ? { files: answer.files } : {}),\n };\n}\n\n/** What `--series` prints: every ad's result, the ones ready to save, and what to do with the rest. Pure. */\nexport function seriesEnvelope(lead: string, results: readonly SeriesAdResult[]) {\n const ready = results.filter((r) => r.status === \"ready\" || r.status === \"ready_with_notes\");\n const fixes = results.filter((r) => r.status === \"needs_fixes\");\n const stopped = results.filter((r) => r.status === \"refused\" || r.status === \"failed\");\n return {\n ok: true as const,\n data: { lead, ready: ready.map((r) => r.slug), ads: results },\n hints: [\n ...ready\n .filter((r) => r.run_id)\n .map((r) => `Save: baker creatives publish --slug ${r.slug} --run-id ${r.run_id} --title \"<title>\" --output <lead size>`),\n ...(fixes.length > 0\n ? [\n `Still needs fixes after its own corrections: ${fixes.map((r) => r.slug).join(\", \")}. Correct each by itself (baker canvas run --slug <slug> --fix \"<what to change>\"); the others stay as they are.`,\n ]\n : []),\n ...stopped.map((r) => `${r.slug}: ${r.error?.message ?? \"not rendered\"}${r.error?.fix ? ` ${r.error.fix}` : \"\"}`),\n `A new version of the lead (${lead}) reaches every ad of the series on the next \\`baker canvas run --series ${lead}\\`.`,\n ],\n };\n}\n","/**\n * Iterating a static ad from the version shown, and never paying twice for the same mistake.\n *\n * Audited Sept 2026: every fix re-rolled three fresh pictures at full price (about 85 credits), so\n * a fix became a new, totally different version, blocking counts random-walked, and the person\n * never saw the same ad improve. So a new render whose prompt.json changed only in its words,\n * their places or the colours is made as an edit of the version shown (one render, the picture\n * kept), with the instruction read off the change (`specEditInstruction`); new options are asked\n * for explicitly (`--regenerate static_variants`). And a fix that left its defect in place is\n * never retried with the same words (`repeatsFailedFix`): the spec or the approach has to change.\n *\n * Pure.\n */\nimport type { RenderFinding } from \"../../engine/nodes/local/lib/render-review.ts\";\nimport { type AdCopyLine, type AdSpec, readAdSpec } from \"../../engine/scaffold/static-ad-spec.ts\";\n\nfunction specOf(raw: unknown): AdSpec | null {\n try {\n return raw ? readAdSpec(raw) : null;\n } catch {\n return null;\n }\n}\n\n/** Everything but the words, their places and looks, and the colours: what an edit cannot change. */\nfunction frame(spec: AdSpec): string {\n const { copy: _copy, colors: _colors, brand, notes: _notes, source: _source, reference: _reference, ...rest } = spec;\n const concept = rest.concept ? { ...rest.concept, transfer_note: undefined } : undefined;\n const brandShape = brand ? { ...brand, ground: undefined, ink: undefined, accent: undefined, cta: undefined, palette: [] } : undefined;\n return JSON.stringify({ ...rest, concept, brand: brandShape });\n}\n\nconst ROLE_WORDS: Record<string, string> = {\n headline: \"the headline\",\n cta: \"the button\",\n button: \"the button\",\n price: \"the price\",\n body: \"body text\",\n caption: \"a caption\",\n label: \"a label\",\n fine_print: \"the fine print\",\n};\n\nfunction copyEdits(before: readonly AdCopyLine[], after: readonly AdCopyLine[]): string[] {\n const out: string[] = [];\n const shared = Math.min(before.length, after.length);\n for (let i = 0; i < shared; i++) {\n const a = before[i] as AdCopyLine;\n const b = after[i] as AdCopyLine;\n if (a.text !== b.text) out.push(`Change the words \"${a.text}\" to exactly \"${b.text}\".`);\n if ((a.position ?? \"\") !== (b.position ?? \"\") && b.position) out.push(`Move \"${b.text}\" to ${b.position}.`);\n if ((a.look ?? \"\") !== (b.look ?? \"\") && b.look) out.push(`Set \"${b.text}\" ${b.look}.`);\n if (a.lettering !== b.lettering || (a.role ?? \"\") !== (b.role ?? \"\") || (a.on ?? \"\") !== (b.on ?? \"\")) {\n out.push(`Set \"${b.text}\" as ${ROLE_WORDS[b.role ?? \"\"] ?? \"it is described\"}${b.on ? `, lettered on ${b.on}` : \"\"}.`);\n }\n }\n for (const added of after.slice(shared)) {\n const role = ROLE_WORDS[added.role ?? \"\"];\n out.push(`Add the words \"${added.text}\"${role ? ` (${role})` : \"\"}${added.position ? `, ${added.position}` : \"\"}.`);\n }\n for (const removed of before.slice(shared)) out.push(`Remove the words \"${removed.text}\".`);\n return out;\n}\n\nfunction colourEdits(before: AdSpec, after: AdSpec): string[] {\n const out: string[] = [];\n for (const use of after.colors) {\n const was = before.colors.find((c) => c.object === use.object);\n if (was && was.name === use.name && was.hex === use.hex) continue;\n out.push(`Make ${use.object} ${use.name}${use.hex ? ` (${use.hex})` : \"\"}.`);\n }\n const roles: Array<[keyof NonNullable<AdSpec[\"brand\"]>, string]> = [\n [\"cta\", \"the button\"],\n [\"ground\", \"the background\"],\n [\"ink\", \"the designed type\"],\n [\"accent\", \"the accent colour\"],\n ];\n for (const [key, object] of roles) {\n const was = before.brand?.[key];\n const now = after.brand?.[key];\n if (typeof now === \"string\" && was !== now) out.push(`Make ${object} ${now}.`);\n }\n return out;\n}\n\n/**\n * The edit a new prompt.json asks of the version made from `previous`, as one instruction, when it\n * changed only the words (added, removed or reworded), their places and looks, or the colours.\n * Null when anything else changed (the scene, the pictures, the concept, the sizes: new pictures\n * are needed), when nothing changed (the cache has it), or when either spec cannot be read.\n */\nexport function specEditInstruction(previous: unknown, next: unknown): string | null {\n const before = specOf(previous);\n const after = specOf(next);\n if (!before || !after || frame(before) !== frame(after)) return null;\n const edits = [...copyEdits(before.copy, after.copy), ...colourEdits(before, after)];\n return edits.length > 0 ? edits.join(\" \") : null;\n}\n\n/** The last fix of a creative and the blocking defects it left. */\nexport type LastFix = { instruction: string; blocking: string[] };\n\nconst normalized = (text: string) => text.trim().toLowerCase().replace(/\\s+/g, \" \");\n\n/** Whether `instruction` is the fix that already ran and left its defects in place. */\nexport function repeatsFailedFix(last: LastFix | undefined, instruction: string): boolean {\n return Boolean(last && last.blocking.length > 0 && normalized(last.instruction) === normalized(instruction));\n}\n\n/**\n * What a fix of the version `from` is measured against: its last fix and the defects its review\n * named. Only the version shown is remembered (`render-state.ts`); a fix of another one (`--from`)\n * starts with nothing to refuse. Pure.\n */\nexport function fixMemoryOf(\n shown: { rendered?: { runId: string }; lastFix?: LastFix; blocking?: string[] },\n from: string | undefined,\n): { lastFix?: LastFix; blocking: string[] } {\n if (from !== undefined && from !== shown.rendered?.runId) return { blocking: [] };\n return { ...(shown.lastFix ? { lastFix: shown.lastFix } : {}), blocking: shown.blocking ?? [] };\n}\n\n/** The blocking defects named before a fix that are still blocking after it. */\nexport function persistingDefects(before: readonly string[], after: readonly RenderFinding[] | null): string[] {\n const now = new Set((after ?? []).filter((f) => f.severity === \"blocking\").map((f) => f.what));\n return before.filter((what) => now.has(what));\n}\n","/**\n * What a static ad's run does on its own when the review finds a blocking defect: one more\n * render that answers it, before anyone sees the ad. Tier 1, Oct 2026: a first render shown as\n * \"needs fixes\" read as failure (\"why doesn't it autofix based on findings until no needs\n * fixes\"), and the agent did not always run the fix the hints named. Pure.\n */\nimport type { FindingKind, RenderFinding } from \"../../engine/nodes/local/lib/render-review.ts\";\nimport { formatOfAdaptId, plannedPlacements } from \"../../engine/scaffold/static-adapt-briefs.ts\";\nimport { adaptPlan } from \"../../engine/scaffold/static-adapt.ts\";\nimport { isNativeCanvas } from \"../../engine/scaffold/static-native-graph.ts\";\nimport { type LastFix, repeatsFailedFix } from \"./static-edit.ts\";\nimport { nearestSupportedAspectRatio } from \"@baker/canvas-contract\";\nimport {\n SERIES_LEAD_ROLE,\n formatSlug,\n nodesWithRole,\n rolesById,\n STATIC_ADAPT_FORMAT_ROLE,\n STATIC_MASTER_ROLE,\n STATIC_PLACE_ROLE,\n STATIC_VARIANT_CALL_ROLE,\n STATIC_VARIANTS_ROLE,\n} from \"../../engine/scaffold/static-topology.ts\";\n\n/** The rounds a run corrects itself before it reports what is left. */\nexport const AUTO_FIX_ROUNDS = 3;\n\nexport type AutoFixStep =\n /**\n * The chosen picture corrected (`--fix`) for its own findings: every size is made again from it,\n * each re-laid size in `relay` told what it must change too, but the sizes in `keep` (nothing\n * blocking on them), delivered as they were.\n */\n | { kind: \"fix\"; instruction: string; relay?: Record<string, string>; keep?: string[]; extend?: string[] }\n /** Only these re-laid-out sizes, each an edit of its last layout (`edits`, by node id) from the same picture. */\n | { kind: \"relayout\"; ids: string[]; edits: Record<string, string>; extend?: string[] }\n /**\n * Only these sizes placed inside their band by code, their margins painted (`withExtendedSizes`).\n * A fix or a re-layout places the sizes in `extend` too, after making them.\n */\n | { kind: \"extend\"; sizes: string[] }\n /** A new picture from the same brief, told what the last one got wrong: every size follows. */\n | { kind: \"regenerate\"; ids: string[]; note: string; brief?: string[]; extend?: string[] }\n /** The spec (prompt.json) corrected for what it caused, and the ad drawn again from it (a native screen: free). */\n | { kind: \"respec\"; findings: string[] };\n\n/**\n * A defect of the picture as a whole, which an edit of it does not mend: subjects that differ\n * where they should be one, a composition or concept that does not read, a ghost or a smear, a\n * face that looks AI-made. Garbled words are erased by an edit (Oct 2026 bench: two new pictures\n * brought them back). Read off the review model's typed fields (`FindingKind`), never its words.\n */\nfunction wholePicture(f: RenderFinding): boolean {\n const kind = f.kind;\n if (!kind) return false;\n return (\n kind.item === \"subject\" ||\n kind.item === \"one_idea\" ||\n kind.item === \"concept\" ||\n ((kind.item === \"picture\" || kind.item === \"native\") && kind.element === \"picture\")\n );\n}\n\n/**\n * A defect the brief asked for: a subject or a concept the spec sets up, a rating it shows with no\n * source, a stranger shown as a real person it names. No edit of the picture mends it, and a new\n * picture from the same brief brings it back: the spec is corrected first (`static-spec-repair.ts`).\n */\nconst BRIEF_ITEMS: ReadonlySet<FindingKind[\"item\"]> = new Set([\"subject\", \"concept\", \"proof\", \"person\"]);\nconst fromBrief = (f: RenderFinding): boolean => f.kind !== undefined && BRIEF_ITEMS.has(f.kind.item);\n\n/** The review's finding that one size does not show the same ad as the others (`static-review.ts` item 12). */\nconst comparesSizes = (f: RenderFinding): boolean => f.kind?.item === \"sizes\";\n\n/** A button, a logo or a line the review saw cut by the frame: placed, never asked to move. */\nconst cutCopy = (f: RenderFinding): boolean =>\n f.kind?.defect === \"cut\" && (f.kind.element === \"logo\" || f.kind.element === \"button\" || f.kind.element === \"copy\");\n\n/** This many blocking defects in one picture say it was rolled badly: a new one is cheaper than three edits. */\nconst MANY_DEFECTS = 3;\n\n/** A finding's own words without the size or sizes it names first (\"9:16: …\", \"4:5, 9:16: …\"). */\nconst withoutSize = (what: string): string =>\n what.replace(/^\\d+(?:\\.\\d+)?:\\d+(?:\\.\\d+)?(?:,\\s*\\d+(?:\\.\\d+)?:\\d+(?:\\.\\d+)?)*:\\s*/, \"\");\n\n/** The sizes a finding names first (\"9:16: …\", \"4:5, 9:16: …\"); none for one about the ad as a whole. */\nconst sizesOf = (what: string): string[] =>\n what.match(/^(\\d+(?:\\.\\d+)?:\\d+(?:\\.\\d+)?(?:,\\s*\\d+(?:\\.\\d+)?:\\d+(?:\\.\\d+)?)*):\\s/)?.[1]?.split(/,\\s*/) ?? [];\n\n/**\n * A round's review with the sizes whose picture did not change (`unchanged`) judged as the last\n * round judged them: a finding about only those sizes is the review's second look at the same\n * pixels, never a defect of the round, so the last round's findings on them stand instead.\n * Oct 2026 bench: an untouched 4:5 handed a new blocking defect in round 2 left three ads unfixed. Pure.\n */\nexport function carryUnchanged(\n now: readonly RenderFinding[],\n prior: readonly RenderFinding[],\n unchanged: readonly string[],\n): RenderFinding[] {\n // A finding comparing the sizes reads the others too, and one of them changed: it is read anew.\n const settled = (f: RenderFinding) => {\n const sizes = sizesOf(f.what);\n return sizes.length > 0 && sizes.every((s) => unchanged.includes(s)) && !comparesSizes(f);\n };\n return [...now.filter((f) => !settled(f)), ...prior.filter(settled)];\n}\n\n/** The share of each edge of a size that an interface covers or the frame trims (`blockingArea`). */\nexport type CoveredEdges = { top: number; bottom: number; left: number; right: number };\n\nconst pct = (share: number): string => `${Math.round(share * 100)}%`;\n\n/** A block past the band, as the review says it (`static-review.ts` `outsideBand`). */\nconst PAST_BAND = /^(.+?) sits? (?:close to )?where (.+?) covers? (?:it|them) \\((.+)\\)\\.?$/;\nconst OFF_EDGE = /^(.+?) runs? off the edge of the picture \\((.+)\\)\\.?$/;\nconst OUTSIDE_SPACE = /^(.+?) sits? outside the space every size keeps clear \\((.+)\\)\\.?$/;\nconst EXTRA_WORDS = /^the picture adds words that aren't in the copy: (.+?)\\. Remove them, or add them to the copy\\.?$/;\nconst SCENE_PRICES = /^the picture shows prices the copy does not hold: (.+?)\\. Make them unreadable\\.?$/;\n/** The review's measured placement findings: where a block sits past the band or the frame. */\nconst PLACED = [PAST_BAND, OFF_EDGE, OUTSIDE_SPACE];\nconst MISREAD = /^Text: (\".+\") reads (\".*\")\\.?$/;\nconst MISSING = /^Text: (\".+\") is missing\\.?$/;\n\n/**\n * How a move fits a full layout: an edit told only to move the button returned the same picture\n * twice, keeping \"everything else exactly\" (Oct 2026 bench).\n */\nconst MAKE_ROOM =\n \"Make the room by moving what is next to it with it and shortening the picture or the gaps, keeping every block in its order.\";\n\n/** How far past the covered band a move aims. */\nconst OVERSHOOT = 0.06;\n\n/** Where a block that crosses `edges` must move so nothing covers it, with the targets `band` gives. */\nfunction moveInto(what: string, edges: string, band?: CoveredEdges): string {\n const at = (edge: string) => edges.includes(edge);\n // Aimed past the band's edge: an edit moves a block less than it is asked (Oct 2026 bench: told\n // \"above 78%\", a button went from 92% to 88%).\n const top = band ? band.top + OVERSHOOT : 0;\n const bottom = band ? band.bottom + OVERSHOOT : 0;\n const vertical = at(\"bottom\") && at(\"top\")\n ? band\n ? `so all of it sits between ${pct(top)} and ${pct(1 - bottom)} of the height`\n : \"into the middle of the frame, away from its top and bottom\"\n : at(\"bottom\") && band ? `up so all of it sits above ${pct(1 - bottom)} of the height, the bottom ${pct(bottom)} showing only the picture`\n : at(\"top\") && band ? `down so all of it sits below ${pct(top)} of the height, the top ${pct(top)} showing only the picture`\n : at(\"bottom\") ? \"up, away from the bottom of the frame\"\n : at(\"top\") ? \"down, away from the top of the frame\"\n : \"\";\n const sides = ([\"right\", \"left\"] as const).filter((e) => at(e === \"right\" ? \"right edge\" : \"left edge\"));\n const side = sides.map((e) => (band ? `at least ${pct(band[e])} in from the ${e} edge` : `away from the ${e} edge`)).join(\" and \");\n if (!vertical) return `Move ${what} ${side}`;\n return side ? `Move ${what} ${vertical}, and ${side}` : `Move ${what} ${vertical}`;\n}\n\n/**\n * One blocking finding as the edit that answers it, with a target where the review measured one:\n * where a block must move (`band`, the size's covered edges), the words to erase, the line to\n * re-letter or add, else the defect to fix in the review's own words. Null for a finding no edit\n * answers (the copy could not be read back). Oct 2026 bench: handed the review's diagnosis, the\n * image model changed nothing in two rounds out of three. Pure.\n */\nexport function correctionOf(finding: string, band?: CoveredEdges, kind?: FindingKind): string | null {\n const what = withoutSize(finding).trim();\n if (/could not be read back/.test(what)) return null;\n const past = what.match(PAST_BAND);\n if (past) {\n const [, block = \"\", surface = \"\", edges = \"\"] = past;\n const covers = band && edges.includes(\"bottom\") && edges.includes(\"top\")\n ? `: ${surface} covers the top ${pct(band.top)} and the bottom ${pct(band.bottom)} of the frame`\n : band && edges.includes(\"bottom\") ? `: ${surface} covers the bottom ${pct(band.bottom)} of the frame`\n : band && edges.includes(\"top\") ? `: ${surface} covers the top ${pct(band.top)} of the frame`\n : \"\";\n return `${moveInto(block, edges, band)}${covers}. ${MAKE_ROOM}`;\n }\n const off = what.match(OFF_EDGE) ?? what.match(OUTSIDE_SPACE);\n if (off) {\n const [, block = \"\", edges = \"\"] = off;\n const named = edges.replace(/the (top|bottom) of the screen/g, \"the $1 edge\").replace(/ and /g, \" and \");\n return `Move ${block} fully inside the frame, with clear space between it and ${named}, smaller if it needs to be.`;\n }\n const extra = what.match(EXTRA_WORDS);\n if (extra) {\n return `Erase these words wherever they appear, leaving the surface they are on blank or with plain lines: ${extra[1]}.`;\n }\n const prices = what.match(SCENE_PRICES);\n if (prices) {\n return `Blur these figures until no digit can be read, keeping the document or screen they are on as it is: ${prices[1]}.`;\n }\n const misread = what.match(MISREAD);\n if (misread) return `Re-letter ${misread[1]} exactly as written, letter for letter (it now reads ${misread[2]}).`;\n const missing = what.match(MISSING);\n if (missing) return `Add the line ${missing[1]}, spelled exactly, where it belongs in the layout.`;\n if (kind?.item === \"sizes\") return FOLLOW_PICTURE;\n const described = what.replace(/\\.$/, \"\");\n return `Fix this: ${described.charAt(0).toLowerCase()}${described.slice(1)}.`;\n}\n\n/**\n * The next automatic step for a reviewed run, or null when there is none: the ad is ready, was\n * not reviewed, is a native screen (drawn from prompt.json, nothing to correct), or the rounds\n * are spent. When every blocking finding is on re-laid-out sizes, only those are laid out again.\n * A picture wrong as a whole (`wholePicture`), wrong in many places, or still wrong after a\n * correction is made again from its brief, told what to avoid; otherwise it is corrected for the\n * blocking findings. A picture the person chose (`keepPicture`, `--use-variant`) is only ever\n * corrected, never replaced. Every size follows the picture.\n */\nexport function autoFixStep(\n canvas: unknown,\n review: readonly RenderFinding[] | null,\n opts: {\n round?: number;\n previous?: AutoFixStep[\"kind\"];\n keepPicture?: boolean;\n lastFix?: LastFix;\n /** Sizes this run's placing passed on unmoved (`placedTooFar`): laid out again, never placed again. */\n tooFar?: readonly string[];\n /** Blocking findings earlier rounds of this correction had and this one no longer has (`fixedSince`). */\n fixedBefore?: readonly string[];\n } = {},\n): AutoFixStep | null {\n if ((opts.round ?? 0) >= AUTO_FIX_ROUNDS) return null;\n const flagged = (review ?? []).filter((f) => f.severity === \"blocking\");\n if (flagged.length === 0) return null;\n // A native screen is typeset from its spec: correcting the spec is the edit, and it redraws for free.\n if (isNativeCanvas(canvas)) return { kind: \"respec\", findings: unique(flagged.map((f) => f.what)) };\n const relaid = relaidSizes(canvas);\n const blocking = onDerivedSizes(flagged, relaid);\n // A re-laid size its placing found too far out: placing it again would pass it on unchanged.\n const unplaceable = new Set((opts.tooFar ?? []).filter((format) => relaid.some((r) => r.format === format)));\n // Words or a logo an interface covers, or the frame cuts: code places the size, the model paints its margins.\n const misplaced = (f: RenderFinding) => {\n const what = withoutSize(f.what);\n const sizes = sizesOf(f.what);\n return (\n sizes.length > 0 &&\n !sizes.every((size) => unplaceable.has(size)) &&\n (PLACED.some((p) => p.test(what)) || cutCopy(f))\n );\n };\n const extend = unique(blocking.filter(misplaced).flatMap((f) => sizesOf(f.what))).filter((size) => !unplaceable.has(size));\n const placing = extend.length > 0 ? { extend } : {};\n const rest = blocking.filter((f) => !misplaced(f));\n const at = (f: RenderFinding) => relaid.find((r) => f.what.startsWith(`${r.format}:`));\n // Each re-laid size's other findings as the edits that answer them.\n const keepRight = keptRules(opts.fixedBefore);\n const edits: Record<string, string> = {};\n for (const r of relaid) {\n const lines = unique(rest.filter((f) => at(f) === r).flatMap((f) => correctionOf(f.what, r.band, f.kind) ?? []));\n if (lines.length > 0) edits[r.id] = [...lines, ...(keepRight ? [keepRight] : [])].join(\" \");\n }\n // Nothing done to the picture itself, or only the sizes: whatever else is wrong with it.\n const sizesOnly = (): AutoFixStep | null => {\n const ids = Object.keys(edits);\n if (ids.length > 0) return { kind: \"relayout\", ids, edits, ...placing };\n return extend.length > 0 ? { kind: \"extend\", sizes: extend } : null;\n };\n // A re-layout or a placing left the picture as it was: what the review now reads into it on one size\n // is the review's own second look, never a defect of the round (Oct 2026 bench). The same defect\n // read on two sizes is in the picture they both show (Dev, Oct 2026: garbled words on an envelope).\n const onSeveralSizes = (f: RenderFinding) => {\n const what = withoutSize(f.what);\n return new Set(rest.filter((g) => withoutSize(g.what) === what).flatMap((g) => sizesOf(g.what))).size >= 2;\n };\n const settledPicture = opts.previous === \"relayout\" || opts.previous === \"extend\";\n const pictureFindings = rest.filter((f) => !at(f) && (!settledPicture || onSeveralSizes(f)));\n const onPicture = unique(pictureFindings.map((f) => withoutSize(f.what)));\n if (onPicture.length === 0) return sizesOnly();\n // A new or corrected picture can bring its words or logo past an edge with no round left to see it:\n // every size is placed after it (a size already inside passes on as it was).\n const every = unique([...extend, ...deliveredSizes(canvas)]);\n const afterNewPicture = every.length > 0 ? { extend: every } : {};\n // Still wrong after a correction: the same defect the correction was asked to mend.\n const persisting = new Set((opts.lastFix?.blocking ?? []).map(withoutSize));\n const stillWrong = opts.previous === \"fix\" && onPicture.some((w) => persisting.has(w));\n const brief = unique(pictureFindings.filter(fromBrief).map((f) => withoutSize(f.what)));\n const rollAgain =\n stillWrong || brief.length > 0 || onPicture.length >= MANY_DEFECTS || pictureFindings.some(wholePicture);\n // A new picture brings new defects: only a round with another after it may draw one (Oct 2026 bench: 4 of 13).\n const last = (opts.round ?? 0) >= AUTO_FIX_ROUNDS - 1;\n // A defect the brief caused is certain to stand otherwise: its correction is worth a new picture even last.\n if (rollAgain && (!last || brief.length > 0) && !opts.keepPicture && nodesWithRole(canvas, STATIC_VARIANTS_ROLE).length > 0) {\n return {\n kind: \"regenerate\",\n ids: [STATIC_VARIANTS_ROLE],\n note: [`The last picture made from this brief had this wrong, so avoid it: ${onPicture.join(\" \")}`, ...(keepRight ? [keepRight] : [])].join(\" \"),\n ...(brief.length > 0 ? { brief } : {}),\n ...afterNewPicture,\n };\n }\n const changes = unique(\n pictureFindings.filter((f) => !fromBrief(f)).flatMap((f) => correctionOf(f.what, undefined, f.kind) ?? []),\n );\n if (changes.length === 0) return sizesOnly();\n // A correction mends what the review saw: a re-laid size it saw nothing blocking on stays as it was.\n const named = new Set(blocking.flatMap((f) => sizesOf(f.what)));\n const keep = relaid.map((r) => r.format).filter((format) => !named.has(format));\n const remade = every.filter((size) => !keep.includes(size));\n const kept = {\n ...(keep.length > 0 ? { keep } : {}),\n ...(remade.length > 0 ? { extend: remade } : {}),\n };\n const asked = `Change only this: ${changes.join(\" \")}`;\n // What the last edit was already asked for and did not take, said as such.\n const again = onPicture.filter((w) => persisting.has(w)).map((w) => w.replace(/\\.$/, \"\"));\n const instruction = [\n again.length > 0\n ? `${asked} The last edit was already asked for this and Image 1 still shows it, so make it clearly: ${again.join(\"; \")}.`\n : asked,\n ...(keepRight ? [keepRight] : []),\n ].join(\" \");\n // The correction that just left these in place would be refused as no progress: this run stands.\n if (repeatsFailedFix(opts.lastFix, asked) || repeatsFailedFix(opts.lastFix, instruction)) return null;\n return { kind: \"fix\", instruction, ...(Object.keys(edits).length > 0 ? { relay: edits } : {}), ...kept };\n}\n\nconst unique = (lines: readonly string[]): string[] => [...new Set(lines)];\n\n/** One render of a correction run: its run and what the review found. */\nexport type Attempt = { runId: string; review: readonly RenderFinding[] };\n\nconst blockingOf = (review: readonly RenderFinding[]): string[] =>\n unique(review.filter((f) => f.severity === \"blocking\").map((f) => f.what));\n\n/**\n * The attempt the next correction starts from, and what the attempts before had wrong that it has\n * right (`keptRules`): the latest, unless a correction left it with more blocking defects than an\n * earlier attempt, which is then corrected instead. A correction never builds on a worse picture.\n * Prod, Oct 2026: logo too low → seam → logo too low → seam, each round correcting the last. Pure.\n */\nexport function correctFrom(attempts: readonly [Attempt, ...Attempt[]]): Attempt & { fixedBefore: string[] } {\n const latest = attempts[attempts.length - 1] as Attempt;\n const fewest = Math.min(...attempts.map((a) => blockingOf(a.review).length));\n const base = blockingOf(latest.review).length > fewest\n ? (attempts.find((a) => blockingOf(a.review).length === fewest) as Attempt)\n : latest;\n const now = new Set(blockingOf(base.review).map(withoutSize));\n const fixedBefore = unique(\n attempts.filter((a) => a !== base).flatMap((a) => blockingOf(a.review)).filter((what) => !now.has(withoutSize(what))),\n );\n return { ...base, fixedBefore };\n}\n\n/**\n * What earlier rounds fixed, said to the next correction so it keeps them right. Prod, Oct 2026:\n * told only the newest defect, 46% of corrections brought a new one (the pill fixed, the brand's\n * name misspelt; the logo moved, a seam). Null when nothing was fixed before. Pure.\n */\nexport function keptRules(fixedBefore: readonly string[] | undefined): string | null {\n const rules = unique((fixedBefore ?? []).map((f) => withoutSize(f).replace(/\\.$/, \"\")));\n return rules.length > 0\n ? `These were wrong in an earlier version and are right now, so keep them right: ${rules.join(\"; \")}.`\n : null;\n}\n\n\n/** What a re-laid size that strayed from the chosen picture is told. */\nconst FOLLOW_PICTURE =\n \"Show exactly what the finished ad (Image 2) shows: its people, products, panels and their order, and nothing it does not show.\";\n\n/**\n * The findings with a sizes mismatch said of the chosen picture moved onto the sizes laid out\n * from it: every size follows the picture, so the one that differs is the one made from it.\n * Dev, Oct 2026: a 9:16 re-layout added a photo, the review said the 4:5 \"drops the image\", and\n * two rounds edited the 4:5 to match. Pure.\n */\nfunction onDerivedSizes(findings: readonly RenderFinding[], relaid: ReadonlyArray<{ format: string }>): RenderFinding[] {\n if (relaid.length === 0) return [...findings];\n return findings.flatMap((f) => {\n const sizes = sizesOf(f.what);\n const onPicture = sizes.length > 0 && sizes.every((size) => !relaid.some((r) => r.format === size));\n if (!onPicture || !comparesSizes(f)) return [f];\n return relaid.map((r) => ({ ...f, what: `${r.format}: ${withoutSize(f.what)}` }));\n });\n}\n\n/** The sizes the canvas delivers, by the final collect's labels. */\nfunction deliveredSizes(canvas: unknown): string[] {\n const nodes = (canvas as { nodes?: GraphNode[] } | null)?.nodes;\n const labels = Array.isArray(nodes) ? nodes.find((n) => n.id === \"final\" && n.type === \"collect\")?.params?.labels : undefined;\n return Array.isArray(labels) ? labels.filter((l): l is string => typeof l === \"string\") : [];\n}\n\n/** The canvas's re-laid-out sizes, each with the edges its frame's interface covers. */\nfunction relaidSizes(canvas: unknown): Array<{ id: string; format: string; band: CoveredEdges }> {\n const nodes = (canvas as { nodes?: unknown } | null)?.nodes;\n const placements = Array.isArray(nodes) ? plannedPlacements(nodes) : undefined;\n return nodesWithRole(canvas, STATIC_ADAPT_FORMAT_ROLE).flatMap((n) => {\n const format = formatOfAdaptId(n.id);\n if (!format) return [];\n const model = String((n as { params?: { model?: unknown } }).params?.model ?? \"\");\n return [{ id: n.id, format, band: adaptPlan(model, format, placements).safe }];\n });\n}\n\n/**\n * The sizes this run's placing (`static_place`) passed on unplaced: their words or logo sat too far\n * past the band for a shrink to clear (`too_far`), or it found them inside it (`inside_band`), so\n * placing again would deliver the same picture. A safe fit's \"too far\" is not one: it stops at\n * `MIN_FIT_SCALE`, and placing paints its margins and shrinks further. Pure.\n */\nexport function placedTooFar(canvas: unknown, outputsByNode: Record<string, Record<string, unknown>>): string[] {\n return nodesWithRole(canvas, STATIC_PLACE_ROLE).flatMap((n) => {\n const format = (n as GraphNode).params?.format;\n // Too far out to clear, or found inside its band while the review blocks it: placing it again repeats it.\n const unmoved = outputsByNode[n.id]?.reason;\n return (unmoved === \"too_far\" || unmoved === \"inside_band\") && typeof format === \"string\" ? [format] : [];\n });\n}\n\n/** What one static run did: a fix of the shown picture, a chosen option, or only sizes laid out again. */\nexport type StaticRunShape = { fix: boolean; useVariant: boolean; sizesOnly: boolean };\n\n/**\n * Whether a run renders a new picture, so it is fairly compared with the last one (a retry that\n * changed nothing is a note): never an edit or a fix of the shown picture, a chosen option, or\n * sizes re-laid out from the same picture, which keep it on purpose.\n */\nexport function rendersNewPicture(run: StaticRunShape): boolean {\n return !run.fix && !run.useVariant && !run.sizesOnly;\n}\n\n/** What a run's credits bought, for the cost line: a chosen option is laid out again at each size. Pure. */\nexport function paidFor(run: StaticRunShape): \"edit\" | \"sizes\" | \"options\" {\n if (run.fix) return \"edit\";\n return run.useVariant || run.sizesOnly ? \"sizes\" : \"options\";\n}\n\n/**\n * The canvas with `note` right after the deliverable of each node in `ids` (a new copy; the file is\n * untouched): what the last picture or layout got wrong, read before the brief's forty lines, not\n * after them (Oct 2026 bench: appended last, it changed nothing).\n */\nexport function withRelayNote(canvas: unknown, ids: readonly string[], note: string): unknown {\n const holder = canvas as { nodes?: Array<{ id?: unknown; params?: Record<string, unknown> }> };\n if (!Array.isArray(holder.nodes)) return canvas;\n return {\n ...holder,\n nodes: holder.nodes.map((n) => {\n if (typeof n.id !== \"string\" || !ids.includes(n.id) || typeof n.params?.prompt !== \"string\") return n;\n const [lead = \"\", ...rest] = n.params.prompt.split(\"\\n\\n\");\n return { ...n, params: { ...n.params, prompt: [lead, note, ...rest].join(\"\\n\\n\") } };\n }),\n };\n}\n\ntype GraphNode = { id?: unknown; type?: unknown; inputs?: Record<string, unknown>; params?: Record<string, unknown> };\n\n/**\n * The canvas with re-laid size `id` made as an edit of its own last layout (`previous`, a URL or a\n * path from the canvas folder) rather than drawn again from the finished ad: that layout leads\n * its pictures as Image 1, the finished ad and the rest follow, and its brief says what to change\n * and to keep the rest. `asked`: what earlier rounds asked that the layout still gets wrong.\n * A new copy; the file is untouched. Pure.\n */\nexport function withRelayEdit(\n canvas: unknown,\n id: string,\n opts: { previous: string; instruction: string; asked?: readonly string[] },\n): unknown {\n const holder = canvas as { nodes?: GraphNode[] };\n if (!Array.isArray(holder.nodes)) return canvas;\n const target = holder.nodes.find((n) => n.id === id);\n const prompt = target?.params?.prompt;\n const refs = target?.inputs?.reference;\n if (!target || typeof prompt !== \"string\" || !Array.isArray(refs)) return canvas;\n const lastId = `last_${id}`;\n const remote = /^(?:https?|data):/.test(opts.previous);\n const last: GraphNode = {\n id: lastId,\n type: \"ingest\",\n params: remote ? { source: \"url\", url: opts.previous, expect: \"image\" } : { source: \"path\", path: opts.previous, expect: \"image\" },\n };\n const again = opts.asked?.includes(opts.instruction)\n ? \"The last edit was asked for this and Image 1 still shows it wrong, so make the change clearly: \"\n : \"\";\n const lead = `Edit: Image 1 is this ad as it was last laid out for this size. ${again}${opts.instruction} Keep the rest of Image 1 as it is: the picture, the colours, the lettering and every word, its layout changed only as much as this needs.`;\n const kept = prompt\n .split(\"\\n\\n\")\n .slice(1)\n // Its scale was asked against the finished ad; the edit keeps the layout's own.\n .filter((p) => !p.startsWith(\"Scale:\"))\n .map((p) => p.replace(/\\bImage (\\d+)\\b/g, (_, n: string) => `Image ${Number(n) + 1}`))\n .map((p) =>\n p.startsWith(\"References:\")\n ? p\n .replace(\"References:\", \"References:\\nImage 1 (THIS SIZE): the last layout of this size, to edit.\")\n .replace(/^Image 2 \\(AD\\):.*$/m, \"Image 2 (AD): the finished ad this size is made from: its words, logo and picture are the ones to keep.\")\n : p,\n );\n // A series ad's size was made from the lead's own size; edited, it follows this ad's own picture.\n const leads = new Set(\n holder.nodes.flatMap((n) => ((n as { tags?: { role?: unknown } }).tags?.role === SERIES_LEAD_ROLE ? [n.id] : [])),\n );\n const own = refs.map((r) => (typeof r === \"string\" && leads.has(r.match(/^\\$ref:([a-z][a-z0-9_]*)\\./)?.[1]) ? \"$ref:master.image\" : r));\n const edited: GraphNode = {\n ...target,\n inputs: { ...target.inputs, reference: [`$ref:${lastId}.asset`, ...own] },\n params: { ...target.params, prompt: [lead, ...kept].join(\"\\n\\n\") },\n };\n const at = holder.nodes.indexOf(target);\n return { ...holder, nodes: [...holder.nodes.slice(0, at), last, edited, ...holder.nodes.slice(at + 1)] };\n}\n\n/**\n * The canvas with every re-laid size following a correction of the picture (`--fix`): each one\n * edited from its own last layout (`last`, by node id) to make the same `change`, and what `also`\n * names for it, rather than laid out again from nothing, which lost the round before's fix of it\n * (Oct 2026 bench: 3 of 13 ads). A size with no last layout is laid out again, told `also`. Pure.\n */\nexport function withSizesFollowingFix(\n canvas: unknown,\n opts: { last: Record<string, string>; change: string; also?: Record<string, string> },\n): unknown {\n let out = canvas;\n for (const n of nodesWithRole(canvas, STATIC_ADAPT_FORMAT_ROLE)) {\n const also = opts.also?.[n.id];\n const previous = opts.last[n.id];\n if (previous) {\n const instruction = `Make the change the finished ad (Image 2) just had: ${opts.change}${also ? ` ${also}` : \"\"}`;\n out = withRelayEdit(out, n.id, { previous, instruction });\n } else if (also) out = withRelayNote(out, [n.id], `This size must also change this: ${also}`);\n }\n return out;\n}\n\n/** What the model that paints a placed size's margins is told. */\nconst EXTEND_PROMPT = [\n \"Deliverable: Image 1 is a finished ad set inside a frame with flat grey margins around it. Paint only the grey: continue the picture outward into it so the whole frame reads as one picture, the scene going on (the wall, the floor, the sky, the room) or, where the ad has no scene, its own plain ground and colours.\",\n \"Keep everything that is not grey exactly where and as it is: every word, the logo, the button, the people, the products. Nothing in it moves, grows or is redrawn.\",\n \"Add nothing in the grey: no words, no letters, no logos, no buttons, no new people or objects, no frames, borders or shadows around the ad. Never repeat any part of the ad in it: no second logo, button, line of text, card or person; the grey is only more of the room, the table, the floor, the sky or the plain ground.\",\n].join(\"\\n\\n\");\n\n/**\n * The canvas with each size in `formats` placed and extended before it is delivered: a\n * `static_place` reads where its words and logo sit and sets the ad inside the size's band, and a\n * `static_extend_merge` has the ad's own model paint the margins that leaves (in its render shape)\n * and lays the ad's pixels back over the painting, delivered in the size's place. A size already\n * inside its band is passed on as it is, with nothing painted.\n * Placed at run time, so it follows whatever the round made of the size (a fix, a re-layout). Pure.\n */\nexport function withExtendedSizes(canvas: unknown, formats: readonly string[]): unknown {\n const holder = canvas as { nodes?: GraphNode[] };\n if (!Array.isArray(holder.nodes)) return canvas;\n const nodes = holder.nodes;\n const final = nodes.find((n) => n.id === \"final\" && n.type === \"collect\");\n const labels = final?.params?.labels;\n const images = final?.inputs?.images;\n if (!final || !Array.isArray(labels) || !Array.isArray(images)) return canvas;\n const painter =\n nodesWithRole(canvas, STATIC_ADAPT_FORMAT_ROLE)[0] ?? nodesWithRole(canvas, STATIC_VARIANT_CALL_ROLE)[0];\n const params = (painter as GraphNode | undefined)?.params ?? {};\n const model = typeof params.model === \"string\" ? params.model : undefined;\n if (!model) return canvas;\n const placements =\n plannedPlacements(nodes) ??\n (nodes.find((n) => n.type === \"static_safe_fit\" && Array.isArray(n.params?.placements))?.params?.placements as\n | string[]\n | undefined);\n const copy = placingCopy(nodes);\n const added: GraphNode[] = [];\n const delivered = [...images];\n for (const format of formats) {\n const at = labels.indexOf(format);\n const source = images[at];\n if (at < 0 || typeof source !== \"string\") continue;\n const slug = formatSlug(format);\n const ratio = nearestSupportedAspectRatio(\"image_generate\", model, format);\n added.push(\n {\n id: `place_${slug}`,\n type: \"static_place\",\n inputs: { image: source },\n params: {\n format,\n render_ratio: ratio,\n ...(placements ? { placements: [...placements] } : {}),\n ...(copy ? { copy } : {}),\n },\n tags: { role: STATIC_PLACE_ROLE },\n } as GraphNode,\n {\n id: `merge_${slug}`,\n type: \"static_extend_merge\",\n inputs: { placed: `$ref:place_${slug}.placed`, shown: `$ref:place_${slug}.shown`, keep: `$ref:place_${slug}.keep` },\n params: {\n render_ratio: ratio,\n paint: {\n model,\n aspect_ratio: ratio,\n ...(params.quality !== undefined ? { quality: params.quality } : {}),\n ...(params.image_size !== undefined ? { image_size: params.image_size } : {}),\n prompt: EXTEND_PROMPT,\n },\n },\n },\n );\n delivered[at] = `$ref:merge_${slug}.image`;\n }\n if (added.length === 0) return canvas;\n const at = nodes.indexOf(final);\n return {\n ...holder,\n nodes: [...nodes.slice(0, at), ...added, { ...final, inputs: { ...final.inputs, images: delivered } }, ...nodes.slice(at + 1)],\n };\n}\n\n/**\n * The ad's copy as the scaffolded steps were told it (`projectPlacementCopy`): a placing step's,\n * else the words a re-lay keeps (no roles). Undefined when the canvas carries neither.\n */\nfunction placingCopy(nodes: readonly GraphNode[]): unknown[] | undefined {\n const told = nodes.find(\n (n) => (n.type === \"static_safe_fit\" || n.type === \"static_place\") && Array.isArray(n.params?.copy),\n )?.params?.copy;\n if (Array.isArray(told)) return told;\n const kept = nodes.find((n) => n.type === \"image_aspect_adapt\" && Array.isArray(n.params?.copy))?.params?.copy;\n return Array.isArray(kept) ? kept.filter((t) => typeof t === \"string\").map((text) => ({ text })) : undefined;\n}\n\n/**\n * The canvas delivering each size from the last version's own file (`last`, by format: a URL, a\n * data URL or a path): a round that only places sizes (`withExtendedSizes`) makes nothing upstream\n * again, and the engine skips what no size reads any more. A size with no file keeps its node. Pure.\n */\nexport function withDeliveredSizes(canvas: unknown, last: Record<string, string>): unknown {\n const holder = canvas as { nodes?: GraphNode[] };\n if (!Array.isArray(holder.nodes)) return canvas;\n const final = holder.nodes.find((n) => n.id === \"final\" && n.type === \"collect\");\n const labels = final?.params?.labels;\n const images = final?.inputs?.images;\n if (!final || !Array.isArray(labels) || !Array.isArray(images)) return canvas;\n const ingests: GraphNode[] = [];\n const roles = rolesById(canvas);\n const delivered = images.map((ref, i) => {\n const format = labels[i];\n const file = typeof format === \"string\" ? last[format] : undefined;\n if (!file || typeof format !== \"string\") return ref;\n const id = `last_${formatSlug(format)}`;\n const remote = /^(?:https?|data):/.test(file);\n // The file that delivered the chosen picture stays it, so a series or translation finds it.\n const from = typeof ref === \"string\" ? /^\\$ref:([^.]+)\\./.exec(ref)?.[1] : undefined;\n const role = from ? roles[from] : undefined;\n ingests.push({\n id,\n type: \"ingest\",\n params: remote ? { source: \"url\", url: file, expect: \"image\" } : { source: \"path\", path: file, expect: \"image\" },\n ...(role === STATIC_MASTER_ROLE ? { tags: { role } } : {}),\n });\n return `$ref:${id}.asset`;\n });\n const at = holder.nodes.indexOf(final);\n return {\n ...holder,\n nodes: [\n ...holder.nodes.slice(0, at),\n ...ingests,\n { ...final, inputs: { ...final.inputs, images: delivered } },\n ...holder.nodes.slice(at + 1),\n ],\n };\n}\n","import { z } from \"zod\";\nimport { apiPost } from \"../../client.ts\";\nimport { type RenderState, readRenderState } from \"./render-state.ts\";\nimport { GLOBAL_PROMPT_FILE } from \"./scene-files.ts\";\n\n/**\n * The version a creative shows, as a render in this workspace starts from it.\n *\n * What a workspace rendered lives in its gitignored `canvas/` (`render-state.ts`), which a chat's\n * Runtime keeps while it is paused but a new chat's Runtime starts without. There the version was\n * unknown: a colour change rendered three new options, a `--fix` had nothing to correct, and a\n * plain run brought back the pictures from before a regeneration. So with no render of its own,\n * the workspace takes the version the company's run history shows (the one chosen, else the\n * newest) and the prompt.json that version drew, from the snapshot its run kept. Never fatal: a\n * history that cannot be reached leaves the workspace's own record as it is.\n */\n\ntype ShownRun = { runId: string; sourceSha?: string; createdAt: number; canvasSnapshotUrl?: string };\n\nexport type ShownSources = {\n /** The run of the version the creative shows, or null when it has none. */\n shown: (slug: string) => Promise<ShownRun | null>;\n /** A JSON file from the durable store. */\n file: (url: string) => Promise<unknown>;\n};\n\nconst ShownResponse = z.object({\n data: z.object({\n runId: z.string(),\n sourceSha: z.string().optional(),\n createdAt: z.number(),\n canvasSnapshotUrl: z.string().optional(),\n }),\n});\n\nconst SnapshotFiles = z.object({ files: z.array(z.object({ path: z.string(), url: z.string() })) });\n\nconst HISTORY: ShownSources = {\n shown: async (slug) => ShownResponse.parse(await apiPost(\"/api/creatives/run\", { slug })).data,\n file: async (url) => {\n const res = await fetch(url);\n return res.ok ? res.json() : null;\n },\n};\n\nexport async function shownVersion(canvasRoot: string, slug: string, sources: ShownSources = HISTORY): Promise<RenderState> {\n const here = await readRenderState(canvasRoot, slug);\n if (here.rendered) return here;\n const run = await sources.shown(slug).catch(() => null);\n if (!run) return here;\n const prompt = run.canvasSnapshotUrl ? await drawnPrompt(run.canvasSnapshotUrl, sources) : undefined;\n return {\n ...here,\n rendered: { sourceSha: run.sourceSha ?? \"\", runId: run.runId, at: run.createdAt },\n ...(prompt !== undefined ? { prompt } : {}),\n };\n}\n\n/** The prompt.json a run drew, from the snapshot of its files; undefined when it kept none. */\nasync function drawnPrompt(manifestUrl: string, sources: ShownSources): Promise<unknown> {\n const manifest = SnapshotFiles.safeParse(await sources.file(manifestUrl).catch(() => null));\n const entry = manifest.success ? manifest.data.files.find((f) => f.path === GLOBAL_PROMPT_FILE) : undefined;\n if (!entry) return undefined;\n return (await sources.file(entry.url).catch(() => null)) ?? undefined;\n}\n","import { readFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport type { ExpectedLine } from \"../../engine/nodes/local/lib/copy-match.ts\";\nimport type { RenderFinding, ReviewUsage } from \"../../engine/nodes/local/lib/render-review.ts\";\nimport {\n type JudgeScore,\n judgeWinner,\n nearIdenticalFindings,\n samePictureSizes,\n parseJudgeScores,\n reviewRenderedStatic,\n type StaticVerdict,\n staticVerdict,\n} from \"../../engine/nodes/local/lib/static-review.ts\";\nimport {\n type InterfaceWords,\n nativeChrome,\n nativeCopy,\n nativeSurfaceName,\n readInterfaceWords,\n} from \"../../engine/scaffold/native-surface.ts\";\nimport { type AdSpec, conceptSummary, readAdSpec } from \"../../engine/scaffold/static-ad-spec.ts\";\nimport { formatOfAdaptId } from \"../../engine/scaffold/static-adapt-briefs.ts\";\nimport { uncastPeople } from \"../../engine/scaffold/static-named-people.ts\";\nimport { peopleReader } from \"./named-people-read.ts\";\nimport { findWorkspaceRoot } from \"./normalize-paths.ts\";\nimport { BRAND_LOGO_ROLE } from \"../../engine/scaffold/static-render-briefs.ts\";\nimport {\n LOGO_COMPOSITE_ROLE,\n nodesWithRole,\n STATIC_ADAPT_FORMAT_ROLE,\n STATIC_ADAPT_ROLE,\n STATIC_FIX_ROLE,\n STATIC_MASTER_ROLE,\n STATIC_PICK_ROLE,\n STATIC_PLACE_ROLE,\n STATIC_SAFE_FIT_ROLE,\n STATIC_SIZE_ROLE,\n STATIC_VARIANT_CALL_ROLE,\n STATIC_VARIANTS_ROLE,\n staticMasterFormat,\n VARIANT_PREFILTER_ROLE,\n} from \"../../engine/scaffold/static-topology.ts\";\nimport { describeMarket, type ViewerProfile } from \"../../viewer-profile.ts\";\nimport { finalOutputLabelsFromCanvas } from \"./run-record.ts\";\nimport { type AskGlanceModel, gatewayGlanceModel, glanceCheck } from \"./glance-check.ts\";\nimport { carryUnchanged } from \"./static-autofix.ts\";\nimport { describeViewer, jevReadJudge, type ViewerIntended } from \"./viewer-check.ts\";\nimport { marketQuery } from \"../creatives/company-offer.ts\";\n\ntype ImageLike = { kind?: unknown; path?: unknown; url?: unknown };\n\nfunction imagesOf(output: unknown): ImageLike[] | null {\n const list = Array.isArray(output) ? output : [output];\n const images = list.filter((o): o is ImageLike => Boolean(o) && typeof o === \"object\");\n return images.length > 0 && images.every((i) => i.kind === \"image\") ? images : null;\n}\n\nfunction promptPathOf(parsed: unknown): string | null {\n const nodes = (parsed as { nodes?: unknown } | null)?.nodes;\n if (!Array.isArray(nodes)) return null;\n const prompt = nodes.find((n) => n?.id === \"prompt\" && n?.type === \"ingest\") as\n | { params?: { source?: unknown; path?: unknown; expect?: unknown } }\n | undefined;\n const p = prompt?.params;\n return p?.source === \"path\" && p.expect === \"json\" && typeof p.path === \"string\" ? p.path : null;\n}\n\n/**\n * What a finished static ad run delivered, for the review: every output image with the\n * format its collect label names, and the prompt.json its copy came from. Null for any run\n * that is not a static ad (a video, a canvas with no blueprint).\n */\nexport function staticReviewTargets(\n parsed: unknown,\n output: unknown,\n): { promptPath: string; images: Array<{ path: string; format: string }> } | null {\n const promptPath = promptPathOf(parsed);\n const images = imagesOf(output);\n if (!promptPath || !images) return null;\n const labels = finalOutputLabelsFromCanvas(parsed)?.labels ?? [];\n return {\n promptPath,\n // A local file when the run downloaded it, else its durable URL.\n images: images.flatMap((image, i) => {\n const source = typeof image.path === \"string\" ? image.path : typeof image.url === \"string\" ? image.url : null;\n return source ? [{ path: source, format: labels[i] ?? \"\" }] : [];\n }),\n };\n}\n\ntype ShapeNode = {\n id?: unknown;\n type?: unknown;\n params?: { n?: unknown; formats?: unknown; judge_model?: unknown };\n inputs?: { reference?: unknown; image?: unknown; images?: unknown };\n tags?: { role?: unknown };\n};\n\nfunction nodesOf(parsed: unknown): ShapeNode[] {\n const nodes = (parsed as { nodes?: unknown } | null)?.nodes;\n return Array.isArray(nodes) ? (nodes as ShapeNode[]) : [];\n}\n\nconst refId = (ref: unknown): string | null =>\n typeof ref === \"string\" ? (ref.match(/^\\$ref:([a-z][a-z0-9_]*)\\./)?.[1] ?? null) : null;\n\nconst hasRole = (n: ShapeNode, role: string) => n.tags?.role === role;\n\n/** How many variants the run rendered: by role on the one-picture graph, by id on an older run's. */\nfunction variantCount(nodes: ShapeNode[]): number {\n const calls = nodes.filter((n) => hasRole(n, STATIC_VARIANT_CALL_ROLE)).length;\n if (calls > 0) return calls;\n const one = nodes.find((n) => hasRole(n, STATIC_VARIANTS_ROLE) && n.type === \"image_generate\");\n if (one) return typeof one.params?.n === \"number\" ? one.params.n : 1;\n if (nodes.some((n) => hasRole(n, STATIC_FIX_ROLE))) return 1;\n return nodes.filter((n) => n.type === \"image_generate\" && /^ad(_[a-z])?$/.test(String(n.id))).length;\n}\n\n/**\n * What a static ad run actually made, read off the canvas that ran (by node role; an older\n * run's graph by its ids): how many variants, whether a judge chose between them, how many\n * sizes were re-laid out, cut or adapted from the chosen picture\n * (or, on an older run, re-laid from it), and whether the brand's real logo file is on the ad.\n */\nexport function staticRunShape(parsed: unknown): {\n candidates: number;\n judged: boolean;\n relays: number;\n cuts: number;\n relaid: number;\n adapted: number;\n logo: boolean;\n} {\n const nodes = nodesOf(parsed);\n const renders = nodes.filter((n) => n.type === \"image_generate\" && typeof n.id === \"string\");\n const candidates = variantCount(nodes);\n const logoIds = new Set(nodes.filter((n) => hasRole(n, BRAND_LOGO_ROLE)).map((n) => String(n.id)));\n const logo =\n nodes.some((n) => hasRole(n, LOGO_COMPOSITE_ROLE)) ||\n renders.some((n) => {\n const refs = n.inputs?.reference;\n return (Array.isArray(refs) ? refs : [refs]).some((r) => logoIds.has(refId(r) ?? \"\"));\n });\n const masterId = nodes.find((n) => hasRole(n, STATIC_MASTER_ROLE))?.id;\n const adapt = nodes.find((n) => hasRole(n, STATIC_ADAPT_ROLE));\n return {\n candidates,\n judged:\n candidates > 1 &&\n nodes.some(\n (n) =>\n (n.type === \"image_select\" && (hasRole(n, STATIC_PICK_ROLE) || n.id === \"pick\")) ||\n (hasRole(n, VARIANT_PREFILTER_ROLE) && typeof n.params?.judge_model === \"string\"),\n ),\n relays: masterId !== undefined ? 0 : Math.max(0, renders.length - candidates),\n cuts: nodes.filter((n) => {\n const from = refId(n.inputs?.image);\n return hasRole(n, STATIC_SIZE_ROLE) && from !== null && from === masterId;\n }).length,\n relaid: nodes.filter((n) => hasRole(n, STATIC_ADAPT_FORMAT_ROLE)).length,\n adapted: Array.isArray(adapt?.params?.formats) ? adapt.params.formats.length : 0,\n logo,\n };\n}\n\n/** The run in one line, so the report states what ran instead of what usually runs. */\nfunction shapeHint(shape: ReturnType<typeof staticRunShape>, copy: number): string {\n const variants = `${shape.candidates} variant${shape.candidates === 1 ? \"\" : \"s\"} rendered${shape.judged ? \", ranked by the checks with a judge on a tie\" : \", no judge\"}`;\n const sizes = [\n ...(shape.relaid > 0\n ? [`${shape.relaid} size${shape.relaid === 1 ? \"\" : \"s\"} re-laid out from the chosen picture (one request each)`]\n : []),\n ...(shape.cuts > 0 ? [`${shape.cuts} size${shape.cuts === 1 ? \"\" : \"s\"} cut from the chosen picture`] : []),\n ...(shape.adapted > 0 ? [`${shape.adapted} adapted from it`] : []),\n ...(shape.relays > 0 ? [`${shape.relays} other format${shape.relays === 1 ? \"\" : \"s\"} re-laid from the winner`] : []),\n ];\n const text = copy === 0 ? \"no copy (the picture is the ad)\" : \"the copy set by the model and read back word for word\";\n return `This run: ${variants}${sizes.length > 0 ? `; ${sizes.join(\"; \")}` : \"\"}; ${text}; ${shape.logo ? \"the brand logo on the ad from its real file\" : \"no logo\"}.`;\n}\n\nconst PAID_FOR = {\n edit: \"one edit of the version shown\",\n sizes: \"only the sizes asked for, laid out again\",\n options: \"new options from scratch, every size made from the one chosen\",\n} as const;\n\n/** What a static run cost and what the credits bought, from the executor's stats. Pure. */\nexport function runCostHint(\n stats: { total_credits: number; total_nodes: number; cached_nodes: number } | undefined,\n kind: keyof typeof PAID_FOR,\n): string | null {\n if (!stats) return null;\n const cached = stats.cached_nodes > 0 ? ` (${stats.cached_nodes} of ${stats.total_nodes} steps came from the cache, free)` : \"\";\n return `This run cost ${Math.round(stats.total_credits)} credits: ${PAID_FOR[kind]}${cached}.`;\n}\n\nasync function textOf(ref: unknown): Promise<string | null> {\n const r = ref as { path?: unknown; url?: unknown } | null;\n try {\n if (typeof r?.path === \"string\") return await readFile(r.path, \"utf8\");\n if (typeof r?.url === \"string\") {\n const res = await fetch(r.url);\n return res.ok ? await res.text() : null;\n }\n } catch {\n return null;\n }\n return null;\n}\n\n/**\n * The fixes, by what went wrong. Every one is an edit to prompt.json and a re-run: the\n * model renders the ad, so there is no layout to nudge and no picture to keep apart from\n * its words. A bad roll of a right prompt is re-rolled, not re-described.\n */\nconst FIX =\n \"One thing wrong in a version that is otherwise right: `baker canvas run … --fix \\\"<what to change>\\\"` edits that version and changes only that, keeping the picture, the layout and the other words (one render). Wrong or missing words: check the lines in prompt.json `copy` are exactly what should be printed, shorten a line the model keeps breaking, and re-run: a change only to copy, positions or colours is made as an edit of the version shown. Wrong picture, colour or subject: edit prompt.json's `scene`, `colors` or `references`. Layout or a logo drawn wrong: say in each line's `position` (and `scene.layout`) where it sits, by what is around it. A right prompt that rolled badly: `baker canvas run … --regenerate static_variants` renders new options (every size follows from the new pick). One size wrong while the chosen picture is right (words cut or too small, the button small, something drawn twice): `baker canvas run … --regenerate adapt_<size>` (for example `adapt_9x16`) lays out that size again from the same picture (one request).\";\n\n/**\n * What the verdict means for the next step, leading the run's hints. Pure.\n *\n * There is no render cap (B2): waste is impossible instead. The same input never bills twice\n * (the cache), a fix edits the version shown at one render, a size problem re-lays only that\n * size, and the same defect after a fix is never retried the same way. A defect a check found\n * is the agent's to fix, never a question for the person: audited Sept 2026, \"Fix what's\n * pending?\" was asked, and the answer recorded as the person's rejection, so every fix became a\n * new version and later chats read the agent's own defects as the company's taste. When a defect\n * cannot be fixed, the best version is shown with what is left, without a question.\n */\nexport function verdictHints(verdict: StaticVerdict): string[] {\n if (verdict === \"needs_fixes\") {\n return [\n \"NOT READY: the finished ad has blocking problems. Do not present it as done, and never ask the person whether to fix them: fix them now, inside this version. A defect in a version that is otherwise right is a `--fix`: it edits the chosen picture only, and every size is made from it again (each re-laid-out size takes one request; a cut is free). The same defect after a fix means the fix does not work: change the spec (prompt.json) or the approach, never the same retry. If it still cannot be fixed, show the person the best version and say in one plain sentence what is left, in their words (\\\"the logo sits where Stories covers it\\\"), without a question; never record your own checks as their feedback.\",\n FIX,\n ];\n }\n if (verdict === \"not_reviewed\") {\n return [\n \"The finished ad was NOT reviewed: no model gateway key here, or the review model did not answer twice. Look at every word of every format yourself before showing it, or re-run the same command (every node comes from the cache) to review it again.\",\n ];\n }\n if (verdict === \"ready\") {\n return [\"Reviewed every format of the finished ad: every word read back exactly, nothing to fix.\", SHOW_IT];\n }\n return verdict === \"ready_with_notes\" ? [SHOW_IT] : [];\n}\n\n/** How a finished version is shown. Live, Oct 2026: ready ads were listed by run id, closing on \"Ready to publish any of these?\". */\nconst SHOW_IT =\n \"Show it as a Version (\\\"Version 2\\\"), never a run id or a file, in one line: the idea's message, who it is for, the customer quote it stands on (or that it is an explore bet), and the finding it answers. Name the versions you would run first; never ask which to keep or whether to publish: the person answers in their own time.\";\n\n/** Words a finished ad may print that are not its copy: what the scene prints, and the other brands' names. */\nexport function allowedSceneWords(spec: Pick<AdSpec, \"scene_text\" | \"third_party_brands\">): string[] {\n return [...new Set([...spec.scene_text, ...spec.third_party_brands.map((b) => b.name)])];\n}\n\n/** Every colour the ad spec names for the brand, the palette the ink of designed type is held to. */\nfunction brandPalette(brand: AdSpec[\"brand\"]): string[] {\n if (!brand) return [];\n const named = [brand.ink, brand.accent, brand.cta, brand.ground, ...brand.palette];\n return [...new Set(named.filter((hex): hex is string => typeof hex === \"string\"))];\n}\n\n/** The ad set's placements for the safe areas; Advantage+ (\"automatic\") is every surface, so the default (Reels) holds. */\nfunction safeAreaPlacements(viewer: ViewerProfile | null | undefined): string[] | undefined {\n const named = (viewer?.placements ?? []).filter((p) => p !== \"automatic\");\n return named.length > 0 && named.length === viewer?.placements.length ? named : undefined;\n}\n\n/** The placements the canvas was laid out for (the variant checks' own), so the review keeps clear of the same interfaces. */\nfunction canvasPlacements(parsed: unknown): string[] | undefined {\n const node = nodesWithRole(parsed, VARIANT_PREFILTER_ROLE)[0] as { params?: { placements?: unknown } } | undefined;\n const placements = node?.params?.placements;\n return Array.isArray(placements) && placements.length > 0 && placements.every((p) => typeof p === \"string\") ? placements : undefined;\n}\n\nexport type StaticRunReview = {\n review: RenderFinding[] | null;\n verdict: StaticVerdict;\n judge: JudgeScore[] | null;\n hints: string[];\n};\n\n/**\n * Review a finished static ad run: read the judge's scores for the candidates, and look\n * at the delivered images. A blocking finding makes the run NOT ready, and the hints say\n * so before anything else, so a broken ad is never reported as a clean completed run.\n */\nexport async function reviewStaticRun(opts: {\n parsed: unknown;\n output: unknown;\n outputsByNode: Record<string, Record<string, unknown>>;\n onSpend?: (usage: ReviewUsage) => void;\n /** Who the ad reaches (`viewer-check.ts`), so the finished ad is read as them; null when unknown. */\n viewer?: ViewerProfile | null;\n /** The brand's name as the workspace states it (`readStaticBrandKit`), for a spec that names none. */\n brandName?: string;\n /** The words the brand's logo prints, as the workspace states them. */\n lockup?: readonly string[];\n /** The sizes the attempt before this one delivered, to say when a retry made the same picture again. */\n previous?: ReadonlyArray<{ path: string; format: string }>;\n /** The glance model (`glance-check.ts`); the gateway unless given, `false` to skip the glance. */\n glance?: AskGlanceModel | false;\n /** The last autofix round's review and delivered sizes: a size it did not touch keeps that verdict (`carryUnchanged`). */\n settled?: { review: readonly RenderFinding[]; images: ReadonlyArray<{ path: string; format: string }> };\n}): Promise<StaticRunReview | null> {\n const targets = staticReviewTargets(opts.parsed, opts.output);\n if (!targets) return null;\n // The judge's ranking: on the prefilter that asked it on a tie, or (an older run) its own node.\n const prefilterId = nodesWithRole(opts.parsed, VARIANT_PREFILTER_ROLE)[0]?.id;\n const tieBreak = prefilterId ? opts.outputsByNode[prefilterId]?.reasoning : undefined;\n const pickId = nodesWithRole(opts.parsed, STATIC_PICK_ROLE)[0]?.id ?? \"pick\";\n const reasoning = typeof tieBreak === \"string\" ? tieBreak : await textOf(opts.outputsByNode[pickId]?.reasoning);\n const judge = reasoning ? parseJudgeScores(reasoning) : null;\n let copy: string[] = [];\n let mechanisms: string[] = [];\n let intended: ViewerIntended & { recognition?: string } = {};\n let expectLogo = false;\n let concept: { mustKeep: string[]; idea?: string } | null = null;\n let uncast: string[] = [];\n let brand: string | undefined = opts.brandName;\n let lockup: string[] = [...(opts.lockup ?? [])];\n let sceneText: string[] = [];\n let lines: ExpectedLine[] = [];\n let native: string | undefined;\n let palette: string[] = [];\n try {\n // An ad spec or an older blueprint, read the one way every reader agrees on.\n const spec = readAdSpec(JSON.parse(await readFile(targets.promptPath, \"utf8\")));\n copy = spec.copy.map((l) => l.text);\n lines = spec.copy.map((l) => ({ text: l.text, lettering: l.lettering, ...(l.role ? { role: l.role } : {}) }));\n if (spec.native) {\n // A native screen prints exactly its own words, and the platform's names and counts around them.\n copy = nativeCopy(spec.native);\n lines = copy.map((text) => ({ text, lettering: \"designed\" as const }));\n native = nativeSurfaceName(spec.native);\n }\n // The platform's own colours on a native screen (a WhatsApp bubble, X's blue) are not off-brand.\n palette = spec.native ? [] : brandPalette(spec.brand);\n mechanisms = spec.mechanism.map((m) => m.device);\n brand = spec.brand?.name ?? opts.brandName;\n // src/creatives/<slug>/prompt.json → the workspace, whose COMPANY.md says what the company sells.\n const sells = marketQuery(\n await readFile(path.resolve(path.dirname(targets.promptPath), \"../../../COMPANY.md\"), \"utf8\").catch(() => \"\"),\n );\n intended = {\n ...(spec.message?.trim() ? { offer: spec.message.trim() } : {}),\n ...(spec.viewer?.who.trim() ? { persona: spec.viewer.who.trim() } : {}),\n ...(spec.recognition?.trim() ? { recognition: spec.recognition.trim() } : {}),\n ...(sells ? { sells } : {}),\n };\n lockup = [...new Set([...(spec.brand?.lockup ?? []), ...lockup])];\n sceneText = [\n ...allowedSceneWords(spec),\n ...(spec.native ? nativeChrome(spec.native, spec.viewer?.market?.language, interfaceWordsOf(opts.parsed)) : []),\n ];\n // A native screen shows the logo where the platform does (every avatar of the brand's posts), and\n // a brand with no logo file gets none drawn (never a stand-in): neither is a missing logo.\n expectLogo = spec.logo && !spec.native && staticRunShape(opts.parsed).logo;\n concept = conceptSummary(spec);\n // Who the copy names, read once per copy and kept in the workspace's cache.\n const cacheDir = path.join(findWorkspaceRoot(path.dirname(targets.promptPath)) ?? path.dirname(targets.promptPath), \"canvas\", \".cache\");\n const people = spec.native ? [] : ((await peopleReader(cacheDir, (u) => opts.onSpend?.(u))(copy)) ?? []);\n uncast = uncastPeople(spec, people);\n } catch {\n copy = [];\n }\n const shape = staticRunShape(opts.parsed);\n const placements = canvasPlacements(opts.parsed) ?? safeAreaPlacements(opts.viewer);\n const masterFormat = staticMasterFormat(opts.parsed) ?? undefined;\n // The glance and the same-picture check need nothing from the review: all three run at once.\n const glancing =\n opts.glance === false\n ? Promise.resolve(null)\n : glanceAtFinished(\n targets.images,\n opts.viewer ?? STRANGER,\n intended,\n opts.glance ?? gatewayGlanceModel(opts.onSpend),\n opts.onSpend,\n ).catch(() => null);\n const comparing = opts.previous\n ? nearIdenticalFindings(targets.images, opts.previous).catch(() => [])\n : Promise.resolve([]);\n // A size an autofix round left byte for byte as it was keeps its last verdict: only what changed is read again.\n const untouched = opts.settled ? await samePictureSizes(targets.images, opts.settled.images) : [];\n const changed = targets.images.filter((i) => !untouched.includes(i.format));\n const review = await reviewRenderedStatic({\n images: changed.length > 0 ? changed : targets.images,\n copy,\n lines,\n palette,\n ...(placements ? { placements } : {}),\n ...(brand ? { brand } : {}),\n ...(lockup.length > 0 ? { lockup } : {}),\n ...(sceneText.length > 0 ? { sceneText } : {}),\n ...(masterFormat ? { masterFormat } : {}),\n ...(expectLogo ? { expectLogo } : {}),\n ...(concept && concept.mustKeep.length > 0 && referenceSource(opts.parsed)\n ? { concept: { ...concept, reference: referenceSource(opts.parsed) as string } }\n : {}),\n logo: shape.logo,\n ...(native ? { native } : {}),\n ...(uncast.length > 0 ? { uncastPeople: uncast } : {}),\n ...(native ? { scrolled: scrolledLines(opts.parsed, opts.outputsByNode) } : {}),\n mechanisms,\n ...(opts.viewer ? { viewer: describeViewer(opts.viewer) } : {}),\n onSpend: opts.onSpend,\n });\n // The finished ad at a glance, as the viewer meets it: counted only once someone looked at it at all.\n const [glanced, compared] = await Promise.all([glancing, comparing]);\n const glance = review === null ? null : glanced;\n const unchanged = review === null ? [] : compared;\n const fresh = review === null ? null : [...review, ...(glance ?? []), ...unchanged];\n const reviewed =\n fresh === null || !opts.settled\n ? fresh\n : carryUnchanged(fresh, opts.settled.review, untouched);\n const verdict = staticVerdict(reviewed);\n const hints = verdictHints(verdict);\n // A defect on re-laid sizes only is answered by laying out those sizes again: said before the list.\n const sizeHints = verdict === \"needs_fixes\" ? sizeFixHints(opts.parsed, reviewed) : [];\n const sizesFirst = sizeHints[0]?.startsWith(\"Do this first\") === true;\n if (sizesFirst) hints.push(...sizeHints);\n for (const f of reviewed ?? []) hints.push(`${f.severity === \"blocking\" ? \"Must fix\" : \"Should fix\"}: ${f.what}`);\n if (review !== null && glance === null && opts.glance !== false) {\n hints.push(\"The finished ad was not shown to a stranger at a glance (the model did not answer): look at the 4:5 at phone size yourself and say what it sells in three seconds.\");\n }\n if (!sizesFirst) hints.push(...sizeHints);\n hints.push(shapeHint(shape, copy.length));\n hints.push(...variantHints(judge, prefilterOutcome(opts.parsed, opts.outputsByNode)));\n return { review: reviewed, verdict, judge, hints };\n}\n\n/** By format, the lines a native chat scrolled off that size (`static_native`'s `scrolled` output). */\nexport function scrolledLines(parsed: unknown, outputsByNode: Record<string, unknown>): Record<string, string[]> {\n return Object.fromEntries(\n nodesOf(parsed).flatMap((n) => {\n const out = typeof n.id === \"string\" ? (outputsByNode[n.id] as { scrolled?: unknown } | undefined) : undefined;\n const format = (n as { params?: { format?: unknown } }).params?.format;\n return n.type === \"static_native\" && typeof format === \"string\" && Array.isArray(out?.scrolled)\n ? [[format, out.scrolled.filter((t): t is string => typeof t === \"string\")]]\n : [];\n }),\n );\n}\n\n/** The reference ad's picture the canvas records (its `original` ingest): a URL, or a path once resolved. */\nfunction referenceSource(parsed: unknown): string | null {\n const original = nodesOf(parsed).find((n) => n.id === \"original\" && n.type === \"ingest\") as\n | { params?: { url?: unknown; path?: unknown } }\n | undefined;\n const source = original?.params?.url ?? original?.params?.path;\n return typeof source === \"string\" && !source.includes(\"[TODO\") ? source : null;\n}\n\n/** The interface's words the canvas's screens were drawn with (`static_native` `interface_words`), when written for the viewer's language. */\nfunction interfaceWordsOf(parsed: unknown): InterfaceWords | undefined {\n const nodes = (parsed as { nodes?: unknown } | null)?.nodes;\n const screen = Array.isArray(nodes)\n ? (nodes as Array<{ type?: unknown; params?: { interface_words?: unknown } }>).find((n) => n?.type === \"static_native\")\n : undefined;\n return readInterfaceWords(screen?.params?.interface_words) ?? undefined;\n}\n\n/** Who sees an ad nobody said who sees: a cold stranger, as `resolveViewer` defaults. */\nconst STRANGER: ViewerProfile = { temperature: \"cold\", knows: [], placements: [\"automatic\"], source: \"knowledge\", reasons: [] };\n\n/** The glance at the delivered 4:5 (the feed's size), else the first size delivered. */\nasync function glanceAtFinished(\n images: ReadonlyArray<{ path: string; format: string }>,\n viewer: ViewerProfile,\n intended: ViewerIntended & { recognition?: string },\n ask: AskGlanceModel,\n onSpend?: (usage: ReviewUsage) => void,\n): Promise<RenderFinding[] | null> {\n const shown = images.find((i) => i.format === \"4:5\") ?? images[0];\n if (!shown) return null;\n return await glanceCheck({\n image: shown.path,\n format: shown.format,\n viewer,\n intended,\n ask,\n judge: jevReadJudge(onSpend),\n ...(viewer.market ? { market: describeMarket(viewer.market) } : {}),\n });\n}\n\n/**\n * One hint per re-laid-out size a blocking finding is on (findings name their size first,\n * \"9:16: …\"): that size alone is laid out again from the same chosen picture, one request,\n * rather than the picture corrected with `--fix` (which makes every size again). A band miss\n * the safe fit could not clear also says the layout has to change. When every blocking finding\n * is on a re-laid size, the first hint says so: that request comes before any `--fix`. Pure.\n */\nexport function sizeFixHints(parsed: unknown, review: RenderFinding[] | null): string[] {\n const relaid = nodesWithRole(parsed, STATIC_ADAPT_FORMAT_ROLE).map(\n (n) => n.id,\n );\n const blocking = (review ?? []).filter((f) => f.severity === \"blocking\");\n const regenerate = relaid.flatMap((id) => {\n const format = formatOfAdaptId(id);\n if (!format || !blocking.some((f) => f.what.startsWith(`${format}:`))) return [];\n return [\n `The ${format} alone needs fixing and the chosen picture is right: \\`baker canvas run … --regenerate ${id}\\` lays out the ${format} again from the same picture (one request). If the chosen picture itself is wrong, \\`--fix\\` it instead: every size follows.`,\n ];\n });\n const relaidFormats = relaid.map(formatOfAdaptId).filter((f): f is string => Boolean(f));\n const sizesOnly =\n regenerate.length > 0 && blocking.every((f) => relaidFormats.some((format) => f.what.startsWith(`${format}:`)));\n const lead = sizesOnly ? regenerate.map((h, i) => (i === 0 ? `Do this first, not a --fix: ${h}` : h)) : regenerate;\n return [...lead, ...safeFitHints(parsed, blocking)];\n}\n\n/** How a finding says an interface covers a word or the logo (`static-review.ts` `outsideBand`). */\nconst COVERED = / sits? where .+? covers? (?:it|them) /;\n\n/**\n * A band miss on a size the safe fit already ran on: small misses are corrected there, for\n * free, so what is left is more than a shrink to 85% clears, and asking the model to move it\n * a few points only loops (it moves about 1%). Pure.\n */\nfunction safeFitHints(parsed: unknown, blocking: readonly RenderFinding[]): string[] {\n return nodesWithRole(parsed, STATIC_SAFE_FIT_ROLE).flatMap((n) => {\n const format = typeof n.params?.format === \"string\" ? n.params.format : formatOfSlug(n.id.replace(/^safe_/, \"\"));\n if (!blocking.some((f) => f.what.startsWith(`${format}:`) && COVERED.test(f.what))) return [];\n return [\n `The ${format} was already shrunk and shifted automatically to clear what the app covers; small misses are corrected that way, so this one is too large for it. Change the layout itself (shorter copy, fewer lines, a smaller block of text) rather than a \\`--fix\\` asking to move it, which moves it only about 1%.`,\n ];\n });\n}\n\n/** A node-id format fragment back to its format: `9x16` → `9:16`, `1_91x1` → `1.91:1`. */\nfunction formatOfSlug(slug: string): string {\n return slug.replace(\"x\", \":\").replace(\"_\", \".\");\n}\n\ntype PrefilterDrop = { index: number; reasons: string[] };\ntype PrefilterOutcome = {\n images?: unknown[];\n /** Which variant each of `images` is, in the order the judge saw them. */\n order?: number[];\n dropped: PrefilterDrop[];\n flagged?: PrefilterDrop;\n usage?: ReviewUsage[];\n};\n\nfunction prefilterNodeId(parsed: unknown): string | null {\n return nodesWithRole(parsed, VARIANT_PREFILTER_ROLE)[0]?.id ?? null;\n}\n\n/** What the variant checks did on this run (`static_prefilter`), null on a run without them. */\nfunction prefilterOutcome(\n parsed: unknown,\n outputsByNode: Record<string, Record<string, unknown>>,\n): PrefilterOutcome | null {\n const id = prefilterNodeId(parsed);\n const out = id ? (outputsByNode[id] as PrefilterOutcome | undefined) : undefined;\n return out && Array.isArray(out.dropped) ? out : null;\n}\n\n/**\n * What the run's box readers cost, for the run record's `reviewUsage`: the variant checks'\n * and each 9:16 safe fit's, as the node reported the gateway's `usage.cost`, and nothing for\n * a node that came from the cache (that call was paid for, and recorded, by the run that made it).\n */\nexport function prefilterSpend(\n parsed: unknown,\n outputsByNode: Record<string, Record<string, unknown>>,\n nodeRuns: ReadonlyArray<{ node_id: string; cached: boolean }>,\n): ReviewUsage[] {\n const cached = (id: string) => nodeRuns.some((r) => r.node_id === id && r.cached);\n const id = prefilterNodeId(parsed);\n const checks = id && !cached(id) ? (prefilterOutcome(parsed, outputsByNode)?.usage ?? []) : [];\n const fits = [...nodesWithRole(parsed, STATIC_SAFE_FIT_ROLE), ...nodesWithRole(parsed, STATIC_PLACE_ROLE)]\n .filter((n) => !cached(n.id))\n .flatMap((n) => {\n const usage = outputsByNode[n.id]?.usage;\n return Array.isArray(usage) ? (usage as ReviewUsage[]) : [];\n });\n return [...checks, ...fits];\n}\n\n/**\n * The variants in the agent's words: which the checks set aside before the judge and why, and\n * which the judge picked. Variants are numbered from 1 as rendered; the judge numbers only the\n * ones it was shown, in the order the checks gave it (`order`; older runs: rendered order less\n * the drops), so its pick is mapped back through that. Pure.\n */\nexport function variantHints(judge: JudgeScore[] | null, prefilter: PrefilterOutcome | null): string[] {\n const hints: string[] = [];\n const dropped = prefilter?.dropped ?? [];\n const kept = Array.isArray(prefilter?.images) ? prefilter.images.length : (judge?.length ?? 0);\n const total = dropped.length + kept;\n if (prefilter?.flagged) {\n hints.push(\n `Every variant failed the checks; variant ${prefilter.flagged.index + 1} had the fewest problems and was kept: ${prefilter.flagged.reasons.join(\" \")}`,\n );\n } else if (dropped.length > 0) {\n const list = dropped.map((d) => `variant ${d.index + 1} (${d.reasons.join(\" \")})`).join(\"; \");\n hints.push(`${dropped.length} of ${total} variants set aside by the checks before the judge: ${list}.`);\n }\n const alone = prefilter?.order?.length === 1 && !prefilter.flagged ? prefilter.order[0] : undefined;\n if (alone !== undefined && dropped.length > 0) {\n hints.push(\n `The checks ranked variant ${alone + 1} best, so no judge was needed; the others stay in this run as options the person can switch to (\\`baker canvas run --use-variant\\`).`,\n );\n }\n const winner = judge ? judgeWinner(judge) : null;\n if (judge && winner) {\n const gone = new Set(dropped.map((d) => d.index));\n const shown = prefilter?.order ?? Array.from({ length: total }, (_, i) => i).filter((i) => !gone.has(i));\n const variant = (shown[winner.image - 1] ?? winner.image - 1) + 1;\n const why =\n winner.of === undefined\n ? `${winner.total}/${Object.keys(winner.scores).length * 5}`\n : `first on ${\n Object.entries(winner.scores)\n .filter(([, beaten]) => beaten === winner.of)\n .map(([criterion]) => criterion.replace(/_/g, \" \"))\n .join(\", \") || \"none of the criteria alone\"\n }`;\n hints.push(\n `The judge picked variant ${variant} of the ${judge.length} it compared (${why}); the others it compared stay in this run as options the person can switch to (\\`baker canvas run --use-variant\\`).`,\n );\n }\n return hints;\n}\n","/**\n * Would a stranger know, in three seconds, what this finished ad is and whether it is for them?\n *\n * The pre-render viewer check (`viewer-check.ts`) reads the copy and a description of the\n * picture, with the brand's name given. A person scrolling gets neither: they see the picture,\n * at phone size, for about three seconds, and the advertiser is a name they have never heard of.\n * Audited Sept 2026: ads that passed every check read, at a glance, as a chat about nothing, a\n * newspaper about another company, a tweet with no product. So the finished ad itself, shrunk\n * to the width a phone shows it, is shown to a model playing that viewer, with no brand and no\n * brief; it says what is sold, who it is for and whether that is them, what it would do next,\n * and what made it stop. The decision model compares that with what the ad means to say, in any\n * language (`misreadings`), and the code grades it (`judgeViewerAnswer`). Blocking: an ad nobody understands in passing is not ready.\n */\nimport { GLANCE_CHECK_MODEL } from \"@baker/canvas-contract\";\nimport sharp from \"sharp\";\nimport { z } from \"zod\";\nimport { askAboutImages, type RenderFinding, type ReviewUsage } from \"../../engine/nodes/local/lib/render-review.ts\";\nimport { bytesOf } from \"../../engine/nodes/local/lib/static-review.ts\";\nimport type { ViewerProfile } from \"../../viewer-profile.ts\";\nimport {\n describeViewer,\n jevReadJudge,\n judgeViewerAnswer,\n misreadings,\n type ReadJudge,\n sureEnough,\n ViewerAnswerSchema,\n type ViewerClarity,\n type ViewerIntended,\n type ViewerMiss,\n type ViewerQuestion,\n} from \"./viewer-check.ts\";\n\n/**\n * The least a glance must reach: the viewer can name what is sold, however sure they say they\n * are (Tier 0, Oct 2026: viewers who named the offer exactly called it a guess). Who it is for and\n * what to do next go into the fix but never fail it: the platform's button carries the next step.\n */\nconst GLANCE_REQUIRED: Readonly<Record<ViewerQuestion, ViewerClarity>> = {\n offer: \"guess\",\n for_whom: \"unclear\",\n next_step: \"unclear\",\n};\n\n/** The width a phone feed shows a static ad at, in CSS pixels, give or take. */\nexport const GLANCE_WIDTH = 400;\n\n/** The glance answer: the viewer check's questions, whether the ad is for them, and what stopped them. */\nexport const GlanceAnswerSchema = ViewerAnswerSchema.extend({\n /** What kind of product or service they take it for (D4). */\n category: z\n .object({ answer: z.string().default(\"\"), clarity: z.enum([\"clear\", \"guess\", \"unclear\"]).default(\"unclear\") })\n .default({ answer: \"\", clarity: \"unclear\" }),\n stopped: z.string().default(\"\"),\n me: z.enum([\"yes\", \"no\", \"unsure\"]).default(\"unsure\"),\n});\nexport type GlanceAnswer = z.infer<typeof GlanceAnswerSchema>;\n\n/** Where the viewer meets the ad, said as they would. */\nfunction wherePhrase(placements: readonly string[]): string {\n const fullScreen = placements.length === 0 || placements.some((p) => /automatic|stor|reel/i.test(p));\n return fullScreen ? \"your Instagram or Facebook feed, Stories or Reels\" : \"your Instagram or Facebook feed\";\n}\n\n/** What the viewer already knows, never the advertiser's name: the ad has to say it. */\nfunction knowledge(viewer: ViewerProfile): string {\n if (!viewer.knows.includes(\"brand\")) return \"You have never heard of the advertiser.\";\n const offer = viewer.knows.includes(\"offer\") ? \" You know roughly what they sell.\" : \"\";\n return `You have come across the advertiser before.${offer}`;\n}\n\n/**\n * The glance prompt: the viewer, the picture and three seconds; the question last and the\n * answer a fixed JSON the code grades. `market` sets who the viewer is when it is known\n * (\"a person in Mexico who speaks Mexican Spanish\"). Pure.\n */\nexport function buildGlancePrompt(input: { viewer: ViewerProfile; market?: string }): string {\n const who = input.market ? `You are ${input.market}. ` : \"\";\n return [\n `${who}You are scrolling ${wherePhrase(input.viewer.placements)} on your phone. ${knowledge(input.viewer)}`,\n \"This ad passes under your thumb and holds you for about three seconds: you take in the picture and read the biggest words, not the small print. The image is shown at the size your phone shows it.\",\n \"Answer as this person, from those three seconds alone. Do not fill gaps with what ads like this usually sell.\",\n 'For each question give your answer in English and how sure you are: \"clear\" when the ad says it outright or you already know it; \"guess\" when you are piecing it together; \"unclear\" when you cannot tell.',\n \"offer: what is being sold or offered?\",\n \"for_whom: who is it for?\",\n \"next_step: what would you do next if you wanted it?\",\n \"category: what kind of product or service is this for (a payroll app, a trade course, a phone)?\",\n 'missing: in one short sentence, what you would need to be told to get it; \"\" when nothing.',\n \"stopped: what made you stop on it, or what nearly made you scroll past, in a few words.\",\n 'me: is this for someone like you? \"yes\", \"no\" or \"unsure\".',\n \"\",\n 'Reply with only this JSON: {\"offer\":{\"answer\":\"\",\"clarity\":\"clear|guess|unclear\"},\"for_whom\":{\"answer\":\"\",\"clarity\":\"clear|guess|unclear\"},\"next_step\":{\"answer\":\"\",\"clarity\":\"clear|guess|unclear\"},\"category\":{\"answer\":\"\",\"clarity\":\"clear|guess|unclear\"},\"missing\":\"\",\"stopped\":\"\",\"me\":\"yes|no|unsure\"}',\n ].join(\"\\n\");\n}\n\nconst QUESTION_WORDS: Record<Exclude<ViewerMiss[\"question\"], \"presumes\">, string> = {\n offer: \"what is offered\",\n for_whom: \"who it is for\",\n next_step: \"what to do next\",\n};\n\nfunction missWords(miss: ViewerMiss): string {\n if (miss.question === \"presumes\") return `it talks to them as a customer already (\"${miss.viewerSaid}\")`;\n const said = miss.viewerSaid.trim() ? `\"${miss.viewerSaid.trim()}\"` : \"nothing\";\n const what = QUESTION_WORDS[miss.question];\n return miss.reason === \"misread\" ? `${what} (they were sure it is ${said})` : `${what} (they said ${said})`;\n}\n\n/** What the decision model said the viewer misread: the offer, and the kind of thing the ad is (`misreadings`). */\nexport type GlanceMisreads = { offer: boolean; category: boolean };\n\n/**\n * The finished ad graded on what a viewer took from three seconds of it: one blocking finding\n * naming what they could not tell, what they said, and what they needed. Pure.\n */\nexport function glanceFindings(\n answer: GlanceAnswer,\n intended: ViewerIntended & { recognition?: string },\n format: string,\n viewer: ViewerProfile,\n misread: GlanceMisreads = { offer: false, category: false },\n): RenderFinding[] {\n // Whether the words presume a past with the brand is the pre-render check's question, asked of the copy.\n const verdict = judgeViewerAnswer({ ...answer, presumes: \"\" }, intended, GLANCE_REQUIRED, misread.offer);\n // D4: what kind of thing a stranger takes it for, against what it is meant to be recognised as.\n // Only a warning: whether they can name what is sold is already the offer's question.\n const category = answer.category.answer.trim();\n const kind: RenderFinding[] =\n intended.recognition && category && misread.category\n ? [\n {\n severity: \"warning\",\n what: `${format}: At a glance, a stranger took it for \"${category}\"; it is meant as ${intended.recognition}.`,\n },\n ]\n : [];\n if (verdict.pass) return kind;\n const needed = answer.missing.trim() ? ` They needed: ${answer.missing.trim().replace(/[.!]+$/, \"\")}.` : \"\";\n const missed = verdict.missed.map(missWords).join(\"; \");\n return [\n {\n severity: \"blocking\",\n what: `${format}: At a glance, ${describeViewer(viewer).replace(/, on .* placements$/, \"\")} could not tell ${missed}.${needed}`,\n },\n ...kind,\n ];\n}\n\n/** Whether the viewer misread the offer and the kind of thing the ad is: one request to the decision model. */\nasync function glanceMisreads(\n answer: GlanceAnswer,\n intended: ViewerIntended & { recognition?: string },\n judge: ReadJudge,\n): Promise<GlanceMisreads> {\n const sure = sureEnough(answer.offer.clarity, GLANCE_REQUIRED.offer);\n const [offer = false, category = false] = await misreadings(\n [\n { said: sure ? answer.offer.answer : \"\", meant: intended.offer, sells: intended.sells },\n { said: answer.category.answer, meant: intended.recognition },\n ],\n judge,\n );\n return { offer, category };\n}\n\n/** The model boundary: the parsed JSON answer about one picture (base64 JPEG), or null when no model answered. */\nexport type AskGlanceModel = (jpeg: string, prompt: string) => Promise<unknown>;\n\n/** The glance model through the gateway, its spend reported to `onSpend`. */\nexport function gatewayGlanceModel(onSpend?: (usage: ReviewUsage) => void): AskGlanceModel {\n return (jpeg, prompt) => askAboutImages(GLANCE_CHECK_MODEL, [jpeg], prompt, onSpend);\n}\n\n/**\n * Show the finished ad, at phone width, to the viewer it reaches, and grade what they took from\n * it. Null when no model answered (twice) or the picture could not be read: the caller says the\n * glance was not checked, never that it passed.\n */\nexport async function glanceCheck(opts: {\n /** The delivered image: a local path or its URL. */\n image: string;\n format: string;\n viewer: ViewerProfile;\n intended: ViewerIntended & { recognition?: string };\n market?: string;\n ask: AskGlanceModel;\n /** Whether the viewer read what the ad means (`misreadings`); the decision model unless given. */\n judge?: ReadJudge;\n}): Promise<RenderFinding[] | null> {\n let jpeg: string;\n try {\n const bytes = await bytesOf(opts.image);\n jpeg = (await sharp(bytes).resize({ width: GLANCE_WIDTH }).jpeg({ quality: 85 }).toBuffer()).toString(\"base64\");\n } catch {\n return null;\n }\n const prompt = buildGlancePrompt({ viewer: opts.viewer, ...(opts.market ? { market: opts.market } : {}) });\n for (let attempt = 0; attempt < 2; attempt++) {\n const parsed = GlanceAnswerSchema.safeParse(await opts.ask(jpeg, prompt));\n if (parsed.success) {\n const misread = await glanceMisreads(parsed.data, opts.intended, opts.judge ?? jevReadJudge());\n return glanceFindings(parsed.data, opts.intended, opts.format, opts.viewer, misread);\n }\n }\n return null;\n}\n","/**\n * The correction of a static ad at the layer that caused its defect: the spec (prompt.json). A\n * defect the spec asks for (an inset of a second dog, stars with no source, a native screen's\n * headline set inside a chat bubble) comes back in every edit and every new picture drawn from it\n * (Oct 2026 bench: 5 of 13 ads), so a model names the spec's fields to replace for those findings\n * alone (the whole spec asked back took 45s, past the call's limit), and the ad is drawn again from it. `acceptRepair` is pure; `repairSpec` reads and writes prompt.json.\n */\nimport { readFile, writeFile } from \"node:fs/promises\";\nimport sharp from \"sharp\";\nimport { z } from \"zod\";\nimport {\n askAboutImages,\n RENDER_REVIEW_MODEL,\n type ReviewUsage,\n} from \"../../engine/nodes/local/lib/render-review.ts\";\nimport { bytesOf } from \"../../engine/nodes/local/lib/static-review.ts\";\nimport { nativeCopy } from \"../../engine/scaffold/native-surface.ts\";\nimport { AdSpecSchema, adSpecJsonSchema, isAdSpec } from \"../../engine/scaffold/static-ad-spec.ts\";\n\nconst Answer = z.object({\n changed: z.string().min(1),\n set: z.array(z.object({ path: z.string().min(1), value: z.unknown() })),\n});\nexport type SpecRepair = { changed: string; spec: Record<string, unknown> };\n\n/** `root` with the value at the dotted `path` (\"scene.layout\", \"copy.2.position\") replaced: a copy, `root` untouched. */\nfunction withValueAt(root: unknown, path: readonly string[], value: unknown): unknown {\n const [key, ...rest] = path;\n if (key === undefined) return value;\n if (Array.isArray(root)) {\n const at = Number(key);\n if (!Number.isInteger(at) || at < 0 || at > root.length) return root;\n const next = [...root];\n next[at] = withValueAt(root[at], rest, value);\n return next;\n }\n const holder = root && typeof root === \"object\" ? (root as Record<string, unknown>) : {};\n return { ...holder, [key]: withValueAt(holder[key], rest, value) };\n}\n\n/** Every printed word of a spec: its copy lines, and a native screen's own. */\nfunction printedWords(spec: z.infer<typeof AdSpecSchema>): string[] {\n return [...spec.copy.map((l) => l.text), ...(spec.native ? nativeCopy(spec.native) : [])];\n}\n\n/**\n * The model's corrected spec, when it is one: a valid ad spec, different from `before`, that\n * keeps every word `before` prints exactly and the intent and brand it was drawn for. A repair\n * can change execution, never the idea to make a defective picture pass. Null otherwise. Pure.\n */\nexport function acceptRepair(before: unknown, answer: unknown): SpecRepair | null {\n const parsed = Answer.safeParse(answer);\n if (!parsed.success || !isAdSpec(before)) return null;\n const spec = parsed.data.set.reduce<unknown>((at, { path, value }) => withValueAt(at, path.split(\".\"), value), before);\n if (!isAdSpec(spec)) return null;\n const was = AdSpecSchema.safeParse(before);\n const now = AdSpecSchema.safeParse(spec);\n if (!was.success || !now.success) return null;\n if (JSON.stringify(was.data) === JSON.stringify(now.data)) return null;\n for (const key of [\"concept\", \"mechanism\", \"message\", \"brand\"] as const) {\n if (JSON.stringify(was.data[key]) !== JSON.stringify(now.data[key])) return null;\n }\n if (was.data.native && was.data.native.surface !== now.data.native?.surface) return null;\n const kept = printedWords(now.data);\n if (!printedWords(was.data).every((text) => kept.includes(text))) return null;\n return { changed: parsed.data.changed, spec: spec as Record<string, unknown> };\n}\n\n/** What the model is asked: the spec, the finished ad, and the defects the spec caused. Pure. */\nexport function buildSpecRepairPrompt(spec: string, findings: readonly string[], schema?: unknown): string {\n return [\n \"This is the spec (prompt.json) a static ad was drawn from, and the image is the ad it gave.\",\n \"A review found these defects in it, and they come from what the spec asks for, so drawing it again or editing the picture brings them back:\",\n ...findings.map((f) => `- ${f}`),\n \"\",\n \"Correct the spec so these defects cannot happen, changing as little as you can:\",\n \"- Drop, replace or reword the element, photo, reference, layout or scene instruction that causes a defect. A second subject the viewer would read as another one (another pet, another person) is dropped, or made unmistakably the same one.\",\n \"- A rating or stars shown with no source: name the source only if the spec already states one anywhere; otherwise drop the stars or the rating. Never invent a source, a number or a claim.\",\n \"- A native screen's layout (where its headline, bubbles or cards sit, what it shows) is changed in its `native` block.\",\n \"- Keep every line of copy word for word: never reword, shorten or drop one. Keep the schema, the brand and everything the defects do not touch.\",\n \"- Preserve `concept`, `mechanism`, `message` and `brand` exactly, including the CTA colour. Fix how the ad executes its idea; never change why it works or remove its load-bearing elements to make a defect pass.\",\n \"- Keep a native screen on the same `native.surface`. Notes stays Notes, a review stays on its review platform. Change its layout or content only; never replace it with a physical document or a generic ad.\",\n \"\",\n 'Reply with only this JSON, naming only the fields you replace, each by its dotted path in the spec (\"scene.layout\", \"references\", \"copy.2.position\", \"native.messages\"), with its whole new value: {\"changed\": \"<one plain sentence a marketer reads: what you changed and why>\", \"set\": [{\"path\": \"<dotted path>\", \"value\": <its new value>}]}',\n \"\",\n \"The spec:\",\n spec,\n // Bench, Oct 2026: without it the model set a field the spec does not have (\"native.layout\").\n ...(schema ? [\"\", \"Its JSON schema: set only fields and values it allows.\", JSON.stringify(schema)] : []),\n ].join(\"\\n\");\n}\n\n/** How long the correction may take: Bench, Oct 2026, a native screen's took 45-60s+ of thought. */\nconst REPAIR_TIMEOUT_MS = 150_000;\n\n/** The width the finished ad is shown at: enough to see what is drawn, cheap to send. */\nconst SHOWN_WIDTH = 768;\n\n/**\n * Ask for the spec at `promptPath` corrected for `findings` (seeing the finished ad `image`), and\n * write it when the answer keeps the copy and changes something. Returns what changed, in one\n * sentence, or null when nothing was written (no answer, or one `acceptRepair` refused).\n */\nexport async function repairSpec(opts: {\n promptPath: string;\n findings: readonly string[];\n image?: string;\n onSpend?: (usage: ReviewUsage) => void;\n}): Promise<string | null> {\n const text = await readFile(opts.promptPath, \"utf8\").catch(() => null);\n if (text === null) return null;\n let before: unknown;\n try {\n before = JSON.parse(text);\n } catch {\n return null;\n }\n const shown = opts.image\n ? await bytesOf(opts.image)\n .then(async (bytes) => (await sharp(bytes).resize({ width: SHOWN_WIDTH }).jpeg({ quality: 85 }).toBuffer()).toString(\"base64\"))\n .catch(() => null)\n : null;\n const prompt = buildSpecRepairPrompt(text, opts.findings, adSpecJsonSchema());\n const repair = acceptRepair(before, await askAboutImages(RENDER_REVIEW_MODEL, shown ? [shown] : [], prompt, opts.onSpend, REPAIR_TIMEOUT_MS));\n if (!repair) return null;\n await writeFile(opts.promptPath, `${JSON.stringify(repair.spec, null, 2)}\\n`, \"utf8\");\n return repair.changed;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAAA,iBAAgB;AACzB,OAAOC,WAAU;AAEjB,SAAS,qBAAqB;;;ACgB9B,SAAS,eAAe,OAAmC;AACzD,SAAO,EAAE,GAAG,OAAO,SAAS,MAAM,QAAQ,MAAM,GAAG,GAAI,EAAE;AAC3D;AAEO,IAAM,qBAAN,MAAyB;AAAA,EACb;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ,oBAAI,IAA2B;AAAA,EACvC;AAAA,EACT,UAAU;AAAA,EAElB,YAAY,OAAe,MAAqB,aAAiC;AAC/E,SAAK,QAAQ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":["readFile","path","readdir","rm","path","path","rm","mkdir","readFile","writeFile","path","path","readFile","res","mkdir","writeFile","path","frame","mkdir","readFile","writeFile","path","path","readFile","mkdir","writeFile","existsSync","path","path","existsSync","at","readFile","path","z","z","readFile","path","id","readFile","writeFile","sharp","z","z","path","readFile","sharp","writeFile","path","readFile","requested"]}
|