@koda-sl/baker-cli 0.531.0 → 0.534.0-dev.911a80433
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 +13 -11
- package/dist/account-BRRFMDXZ.js +82 -0
- package/dist/account-HQD5P3AF.js +139 -0
- package/dist/account-MQI7EZBH.js +82 -0
- package/dist/account-assets-JRMYVXQP.js +290 -0
- package/dist/account-level-PEGLZQTI.js +611 -0
- package/dist/account-reads-K6YDAOHX.js +219 -0
- package/dist/account-users-QS54ZEOD.js +64 -0
- package/dist/account-writes-PGGGP26M.js +68 -0
- package/dist/accounts-H3U7LARM.js +80 -0
- package/dist/accounts-IW62WBX5.js +701 -0
- package/dist/accounts-MQMEOGQD.js +114 -0
- package/dist/accounts-T6SRCZJQ.js +76 -0
- package/dist/accounts-Y2VWI3AA.js +115 -0
- package/dist/actions-2CUQFZNA.js +55 -0
- package/dist/active-entities-BOMM4YDF.js +103 -0
- package/dist/activecampaign-WAMDVBUO.js +938 -0
- package/dist/activities-YH4K4JAI.js +75 -0
- package/dist/ad-group-writes-ROUU6BHU.js +172 -0
- package/dist/ad-groups-Y2BSRLIN.js +70 -0
- package/dist/ad-writes-NF4LCGVP.js +176 -0
- package/dist/add-2L2VQ5MU.js +80 -0
- package/dist/add-4P3CUHAN.js +305 -0
- package/dist/add-PS36Q2S3.js +97 -0
- package/dist/add-RLMXZLLO.js +148 -0
- package/dist/add-UHWRBSFE.js +107 -0
- package/dist/add-Z2OTFSQO.js +81 -0
- package/dist/add-accounts-GXBE4ZR2.js +91 -0
- package/dist/ads-CPMX3L4A.js +79 -0
- package/dist/ads-TDN7OYSU.js +48 -0
- package/dist/ads-WYQYZ44U.js +128 -0
- package/dist/ads-ZEF5AU3D.js +120 -0
- package/dist/adsets-ZRS7AZIK.js +182 -0
- package/dist/advertisers-6CHV5N2V.js +123 -0
- package/dist/advertisers-AAGUUSAX.js +125 -0
- package/dist/analytics-4GTUW42V.js +2437 -0
- package/dist/analytics-MV2RQ6KR.js +447 -0
- package/dist/animate-EOSLSA7F.js +480 -0
- package/dist/approved-LHYBVDXH.js +73 -0
- package/dist/asset-writes-CUF25BLM.js +50 -0
- package/dist/assign-RN5DGDS2.js +80 -0
- package/dist/audience-size-7DYMCXDM.js +76 -0
- package/dist/audience-writes-L7SNU2SB.js +327 -0
- package/dist/audiences-A54MU63W.js +86 -0
- package/dist/audiences-SG2BBM7R.js +85 -0
- package/dist/audiences-VMGB2JZG.js +280 -0
- package/dist/audit-6K5FFV6K.js +88 -0
- package/dist/audit-7U7G2JKS.js +154 -0
- package/dist/autocomplete-E6YHJ3HH.js +114 -0
- package/dist/avatars-6JHVTSXH.js +38 -0
- package/dist/bid-pricing-J3OJK4J3.js +103 -0
- package/dist/brand-3EAQFDYN.js +22 -0
- package/dist/brief-ADGCGC3H.js +543 -0
- package/dist/businesses-GQ5FOZDU.js +54 -0
- package/dist/campaign-groups-GN7D5UXE.js +99 -0
- package/dist/campaign-writes-HKWI6GYU.js +168 -0
- package/dist/campaign-writes-UORRIIWY.js +176 -0
- package/dist/campaigns-5I76AV7F.js +113 -0
- package/dist/campaigns-BEXDLBT3.js +111 -0
- package/dist/campaigns-GONROKTU.js +78 -0
- package/dist/campaigns-VZJMYETG.js +130 -0
- package/dist/canvas-CHV34G62.js +46 -0
- package/dist/capabilities-VKBIQ2BR.js +147 -0
- package/dist/cards-YHZFJ3US.js +85 -0
- package/dist/catalog-VXANSX2O.js +66 -0
- package/dist/catalog-VXANSX2O.js.map +1 -0
- package/dist/catalogs-LXEM7NNC.js +130 -0
- package/dist/catalogs-ZHCLH43A.js +781 -0
- package/dist/changes-4OYC4NMW.js +135 -0
- package/dist/chatgpt-XV6CVKLN.js +47 -0
- package/dist/chats-W35ZPZEW.js +279 -0
- package/dist/check-3D63D4ZT.js +107 -0
- package/dist/chunk-23KN4NL4.js +45 -0
- package/dist/chunk-2PC26XRF.js +592 -0
- package/dist/chunk-2UZHRLLO.js +148 -0
- package/dist/chunk-3JV4T6XW.js +69 -0
- package/dist/chunk-45EERHDB.js +783 -0
- package/dist/chunk-4BTUF2AV.js +69 -0
- package/dist/chunk-4D37LCBS.js +111 -0
- package/dist/chunk-55B4AJY3.js +249 -0
- package/dist/chunk-56UWXQEN.js +392 -0
- package/dist/chunk-5G5QFFJY.js +275 -0
- package/dist/chunk-5GHKZLID.js +438 -0
- package/dist/chunk-5GHKZLID.js.map +1 -0
- package/dist/chunk-5HGAO4ZI.js +89 -0
- package/dist/chunk-5ITB24SC.js +544 -0
- package/dist/chunk-5YN53OAA.js +61 -0
- package/dist/chunk-6CCEEVXJ.js +285 -0
- package/dist/chunk-6CQOHJZW.js +125 -0
- package/dist/chunk-6HGLQJ6A.js +638 -0
- package/dist/chunk-6OIKNJ7G.js +26 -0
- package/dist/chunk-6OXENBTF.js +74 -0
- package/dist/chunk-6QGBBX7F.js +46 -0
- package/dist/chunk-6RTZPBAT.js +19 -0
- package/dist/chunk-7JFVMJZI.js +207 -0
- package/dist/chunk-7MY3QHGA.js +203 -0
- package/dist/chunk-A6VODUO3.js +166 -0
- package/dist/chunk-AGTA5FJX.js +139 -0
- package/dist/chunk-AGU4KGT6.js +84 -0
- package/dist/chunk-AH6TDWYS.js +3510 -0
- package/dist/chunk-AH6TDWYS.js.map +1 -0
- package/dist/chunk-BKOUVU6X.js +547 -0
- package/dist/chunk-C7IOSSI4.js +58 -0
- package/dist/chunk-CBQPKCFE.js +170 -0
- package/dist/chunk-CIW3Q7B2.js +229 -0
- package/dist/chunk-CNPYG4F3.js +75 -0
- package/dist/chunk-CWZ2ODJQ.js +57 -0
- package/dist/chunk-D7Y3UNWO.js +66 -0
- package/dist/chunk-DBPPTM3W.js +24026 -0
- package/dist/chunk-DBPPTM3W.js.map +1 -0
- package/dist/chunk-DGZYZWMK.js +843 -0
- package/dist/chunk-DMA67YC3.js +344 -0
- package/dist/chunk-DT3V5EGL.js +2209 -0
- package/dist/chunk-DT3V5EGL.js.map +1 -0
- package/dist/chunk-DYOUJERF.js +7234 -0
- package/dist/chunk-E34YYDCE.js +35 -0
- package/dist/chunk-E3FMS5DA.js +297 -0
- package/dist/chunk-EIRGJD3Q.js +167 -0
- package/dist/chunk-F3CZFUXZ.js +3187 -0
- package/dist/chunk-F3CZFUXZ.js.map +1 -0
- package/dist/chunk-FESQ5TXU.js +42 -0
- package/dist/chunk-FEUKUZRA.js +106 -0
- package/dist/chunk-G3MEYGXC.js +1518 -0
- package/dist/chunk-G3MN4HIX.js +831 -0
- package/dist/chunk-G53CUQZV.js +207 -0
- package/dist/chunk-GPZVYXJZ.js +455 -0
- package/dist/chunk-GYMZCJX6.js +97 -0
- package/dist/chunk-HGHVNUJT.js +156 -0
- package/dist/chunk-HZPTQRX6.js +2441 -0
- package/dist/chunk-HZPTQRX6.js.map +1 -0
- package/dist/chunk-IQWFJEA3.js +217 -0
- package/dist/chunk-IZABTTW5.js +228 -0
- package/dist/chunk-J3HA4RFY.js +51 -0
- package/dist/chunk-JGOYO7I2.js +103 -0
- package/dist/chunk-JNSRQQDP.js +94 -0
- package/dist/chunk-JUF6Q5X7.js +8954 -0
- package/dist/chunk-KAAYVKBH.js +479 -0
- package/dist/chunk-KGAI4E2I.js +106 -0
- package/dist/chunk-KUM36NSV.js +429 -0
- package/dist/chunk-L763CNKH.js +333 -0
- package/dist/chunk-LO2MZJJP.js +225 -0
- package/dist/chunk-LV7EU6HM.js +324 -0
- package/dist/chunk-LXZ5E6AC.js +84 -0
- package/dist/chunk-LZRZVIEJ.js +191 -0
- package/dist/chunk-MCKYNFPH.js +219 -0
- package/dist/chunk-MHSVWQK6.js +91 -0
- package/dist/chunk-MTV2RSGY.js +63 -0
- package/dist/chunk-MUEJVDHI.js +200 -0
- package/dist/chunk-MUS2UTWU.js +4254 -0
- package/dist/chunk-MUS2UTWU.js.map +1 -0
- package/dist/chunk-N4BK6OKX.js +91 -0
- package/dist/chunk-NCO5NGBN.js +74 -0
- package/dist/chunk-NLW25WW3.js +52 -0
- package/dist/chunk-NP3FPCPN.js +377 -0
- package/dist/chunk-NYAFSC5V.js +287 -0
- package/dist/chunk-O7AMKMII.js +215 -0
- package/dist/chunk-OAXQPLTG.js +604 -0
- package/dist/chunk-OI2CKYAQ.js +846 -0
- package/dist/chunk-OL3QHART.js +188 -0
- package/dist/chunk-OXYWSVOJ.js +100 -0
- package/dist/chunk-PG5R35QY.js +73 -0
- package/dist/chunk-PG5R35QY.js.map +1 -0
- package/dist/chunk-PHZOMTI6.js +97 -0
- package/dist/chunk-PYWIHAVD.js +64 -0
- package/dist/chunk-QPPQXU3U.js +98 -0
- package/dist/chunk-QTKNS2U2.js +149 -0
- package/dist/chunk-QTLIXCVN.js +46 -0
- package/dist/chunk-QUYDMAQN.js +169 -0
- package/dist/chunk-R5LRBDEM.js +136 -0
- package/dist/chunk-RIA5RXPL.js +387 -0
- package/dist/chunk-S556LOAP.js +930 -0
- package/dist/chunk-S556LOAP.js.map +1 -0
- package/dist/chunk-SIKCVWM3.js +76 -0
- package/dist/chunk-SOS4QFLE.js +5471 -0
- package/dist/chunk-SOS4QFLE.js.map +1 -0
- package/dist/chunk-SVNH6P7O.js +1744 -0
- package/dist/chunk-T65Y7N7H.js +225 -0
- package/dist/chunk-T75WL56Z.js +224 -0
- package/dist/chunk-TGCDXZ5X.js +910 -0
- package/dist/chunk-TOUF5ME6.js +1646 -0
- package/dist/chunk-TWCS6FSC.js +191 -0
- package/dist/chunk-ULW4EWAA.js +39 -0
- package/dist/chunk-UPXPBA4W.js +676 -0
- package/dist/chunk-URMAEVZO.js +150 -0
- package/dist/chunk-UUWUJ64R.js +197 -0
- package/dist/chunk-VCOIFNYH.js +714 -0
- package/dist/chunk-VGUGFRWF.js +494 -0
- package/dist/chunk-VPF5A7CM.js +476 -0
- package/dist/chunk-VYJLS64A.js +1902 -0
- package/dist/chunk-VYJLS64A.js.map +1 -0
- package/dist/chunk-WEQZ563U.js +319 -0
- package/dist/chunk-WUCTGDV7.js +163 -0
- package/dist/chunk-XAW5GL6B.js +76 -0
- package/dist/chunk-XCRYRVKK.js +5368 -0
- package/dist/chunk-XJ5TX772.js +131 -0
- package/dist/chunk-XPIBSDG4.js +274 -0
- package/dist/chunk-XRNJRQ6Q.js +26 -0
- package/dist/chunk-Y5GQO6CR.js +56 -0
- package/dist/chunk-Y6MLSN6W.js +1919 -0
- package/dist/chunk-YBFZJ5EB.js +66 -0
- package/dist/chunk-YJYKSMLF.js +296 -0
- package/dist/chunk-YR3OPPUE.js +142 -0
- package/dist/chunk-YXQFCQX2.js +64 -0
- package/dist/chunk-Z3Y67AH6.js +98 -0
- package/dist/chunk-Z6T6VDDA.js +76 -0
- package/dist/chunk-ZKRRYVDG.js +23 -0
- package/dist/chunk-ZOH672S6.js +25 -0
- package/dist/claim-DWGPEVJN.js +200 -0
- package/dist/cli.js +45 -45
- package/dist/client-YUVT3RZN.js +19 -0
- package/dist/code-LOOWLRUL.js +76 -0
- package/dist/companies-3VT7OJAA.js +198 -0
- package/dist/company-XEPW45AT.js +308 -0
- package/dist/complete-AEX34ICU.js +84 -0
- package/dist/config-AOF6ACIP.js +88 -0
- package/dist/connect-TF4FCXDV.js +45 -0
- package/dist/content-NCW5IJFR.js +85 -0
- package/dist/conversation-6WWZMPAB.js +96 -0
- package/dist/conversion-report-I6R2FDCD.js +127 -0
- package/dist/conversion-upload-command-QD6MGLY4.js +439 -0
- package/dist/conversion-writes-H2JOAORW.js +122 -0
- package/dist/conversions-D46PQRWF.js +140 -0
- package/dist/conversions-WGW43FUE.js +78 -0
- package/dist/copy-writes-ONVSSBLJ.js +170 -0
- package/dist/countries-Q6TA42P7.js +82 -0
- package/dist/create-7WV7XWZV.js +62 -0
- package/dist/create-OUZZLPQK.js +210 -0
- package/dist/create-QRT6O5PN.js +135 -0
- package/dist/create-WSEYNFTP.js +239 -0
- package/dist/creatives-BSZY7VDQ.js +223 -0
- package/dist/creatives-DBDFDHX7.js +58 -0
- package/dist/creatives-S3EZCXUT.js +89 -0
- package/dist/credentials-P7GQYIE3.js +290 -0
- package/dist/critique-6F4FWQN5.js +232 -0
- package/dist/critique-X2YDOMON.js +1451 -0
- package/dist/crm-O6YG6777.js +227 -0
- package/dist/crm-VNAUSVC5.js +323 -0
- package/dist/crop-RDP7YCNV.js +113 -0
- package/dist/currency-UVT3HEZT.js +88 -0
- package/dist/custom-conversions-7MZFTHUM.js +128 -0
- package/dist/customers-VJ3TXILQ.js +59 -0
- package/dist/decide-OPCCKAIT.js +199 -0
- package/dist/delete-3H377GOM.js +67 -0
- package/dist/delete-EH3XL26Z.js +57 -0
- package/dist/delete-GKQTDOZF.js +69 -0
- package/dist/delete-KZFI235B.js +85 -0
- package/dist/delete-KZFI235B.js.map +1 -0
- package/dist/delete-QYSOAVP4.js +69 -0
- package/dist/delete-R3LXCKA4.js +71 -0
- package/dist/demographics-GKJZ5PV2.js +141 -0
- package/dist/describe-537PPL7P.js +97 -0
- package/dist/describe-GIG46DT5.js +97 -0
- package/dist/dimensions-UXK7DMTF.js +101 -0
- package/dist/discard-46RALLBO.js +69 -0
- package/dist/discover-C4TG7JP7.js +172 -0
- package/dist/discover-MKFDG6NK.js +93 -0
- package/dist/domain-JNNWJNQE.js +101 -0
- package/dist/download-3R5IHN5F.js +172 -0
- package/dist/download-PRBLR6IQ.js +299 -0
- package/dist/draft-3L4SNDGO.js +283 -0
- package/dist/draft-EADHX7XL.js +335 -0
- package/dist/draft-H5RVDTFD.js +240 -0
- package/dist/draft-TAM7IUPH.js +220 -0
- package/dist/draft-UMPCOCP6.js +100 -0
- package/dist/draft-VSXBSXSX.js +308 -0
- package/dist/draft-XCYSZWA6.js +310 -0
- package/dist/draft-XEUHTUMR.js +103 -0
- package/dist/engine/index.js +15 -14
- package/dist/env-VBSATLEF.js +53 -0
- package/dist/experiment-2XR6MBE2.js +1397 -0
- package/dist/experiments-JVGAKWFA.js +236 -0
- package/dist/export-YCLJG5YP.js +168 -0
- package/dist/extract-E3CMEN5U.js +113 -0
- package/dist/facets-JG44XXAT.js +117 -0
- package/dist/favorites-NSQX6HKB.js +178 -0
- package/dist/feed-TKMMYAEH.js +177 -0
- package/dist/feedback-3JCNU6MT.js +115 -0
- package/dist/feedback-3JCNU6MT.js.map +1 -0
- package/dist/feedback-record-7WXGKXNS.js +269 -0
- package/dist/feedback-record-7WXGKXNS.js.map +1 -0
- package/dist/fetch-EHP2FK6Y.js +139 -0
- package/dist/fetch-SLDDORH4.js +179 -0
- package/dist/find-I7U3THF3.js +143 -0
- package/dist/fit-GNQHRKP7.js +65 -0
- package/dist/flows-NRPABVUJ.js +250 -0
- package/dist/follow-A46RAJEX.js +94 -0
- package/dist/follow-competitors-VU2L3KWF.js +112 -0
- package/dist/following-UOUNSU6P.js +113 -0
- package/dist/fonts-VN2QXPAQ.js +39 -0
- package/dist/forecast-SIX6AAVX.js +121 -0
- package/dist/forecast-ZXOSLITM.js +169 -0
- package/dist/funding-2VROIMLS.js +85 -0
- package/dist/funnel-QEZWKSFR.js +397 -0
- package/dist/ga4-ULHKTF23.js +55 -0
- package/dist/generate-HOMLLUCN.js +263 -0
- package/dist/get-5E4YJKPO.js +66 -0
- package/dist/get-5E4YJKPO.js.map +1 -0
- package/dist/get-ABQZJ2VQ.js +38 -0
- package/dist/get-ASAW6TVF.js +62 -0
- package/dist/get-ASAW6TVF.js.map +1 -0
- package/dist/get-BXMLPLIC.js +82 -0
- package/dist/get-GXVAJZHM.js +56 -0
- package/dist/get-GXVAJZHM.js.map +1 -0
- package/dist/get-IF7KHMSI.js +92 -0
- package/dist/get-NF3SPPVX.js +59 -0
- package/dist/get-ZISAHMTQ.js +59 -0
- package/dist/gif-QLNWBFAH.js +102 -0
- package/dist/google-FDR55RRD.js +136 -0
- package/dist/google-XVSL3XAB.js +3267 -0
- package/dist/google-ads-5NBAMFPB.js +198 -0
- package/dist/group-HAQM6P7M.js +43 -0
- package/dist/group-XVDH2ONO.js +43 -0
- package/dist/gsc-72AFO6B4.js +30 -0
- package/dist/history-2U5OXDV7.js +102 -0
- package/dist/history-A6KMJRPZ.js +69 -0
- package/dist/history-IDVWUSYU.js +136 -0
- package/dist/hubspot-YPBNNVHC.js +782 -0
- package/dist/icon-F7AOOTFI.js +137 -0
- package/dist/ideas-4Q7YBUGC.js +45 -0
- package/dist/images-BRBSRYEX.js +92 -0
- package/dist/improve-LIKOER3S.js +86 -0
- package/dist/ingest-AIOFOAQE.js +27 -0
- package/dist/ingest-HPEBFXCP.js +123 -0
- package/dist/ingest-HPEBFXCP.js.map +1 -0
- package/dist/insights-QNE6XCBA.js +439 -0
- package/dist/insights-TR5EQAMA.js +132 -0
- package/dist/inspect-ITKB2QT3.js +192 -0
- package/dist/inspiration-VXNGKAJV.js +53 -0
- package/dist/instant-experiences-MT2XMQNH.js +260 -0
- package/dist/intent-E6HKRMNE.js +95 -0
- package/dist/job-TS34W4IU.js +202 -0
- package/dist/job-create-FXXDR2EE.js +109 -0
- package/dist/job-status-R2H4HNC5.js +74 -0
- package/dist/keep-YSU3XMW3.js +78 -0
- package/dist/keyword-gap-D4WAEJAH.js +130 -0
- package/dist/keyword-metrics-4UDT5GNW.js +200 -0
- package/dist/keywords-for-site-YQAQQIHJ.js +131 -0
- package/dist/knowledge-L3VLOVLG.js +195 -0
- package/dist/landing-6JAIZH4H.js +28 -0
- package/dist/landings-XTPNPTHN.js +151 -0
- package/dist/languages-AUAZIVL4.js +40 -0
- package/dist/languages-DIKRMAYE.js +55 -0
- package/dist/launches-5R7EUONQ.js +19 -0
- package/dist/layerize-Q2QWDARG.js +190 -0
- package/dist/lead-routes-IXUCGINI.js +733 -0
- package/dist/leads-6XZRTPJL.js +115 -0
- package/dist/leads-UVG6VYAC.js +540 -0
- package/dist/learn-VQGATNB4.js +207 -0
- package/dist/library-G5YAFLTR.js +211 -0
- package/dist/lighthouse-BCBV2XGP.js +75 -0
- package/dist/line-item-writes-TRTDQ55N.js +211 -0
- package/dist/line-items-SC73GQLQ.js +107 -0
- package/dist/link-ODLNZTZC.js +67 -0
- package/dist/linkedin-HPZP4MGS.js +1328 -0
- package/dist/linkedin-person-ELEPEST5.js +139 -0
- package/dist/list-26EOYW37.js +154 -0
- package/dist/list-4SDJZVOL.js +93 -0
- package/dist/list-6YW4I4VG.js +65 -0
- package/dist/list-GLN62MRB.js +67 -0
- package/dist/list-GS42LK5C.js +51 -0
- package/dist/list-HWNHRWGB.js +57 -0
- package/dist/list-QSBEYU45.js +76 -0
- package/dist/list-YLPOXOCI.js +306 -0
- package/dist/list-ZFGOONWL.js +50 -0
- package/dist/locations-D5N75BUK.js +69 -0
- package/dist/locations-P5PTCRSF.js +40 -0
- package/dist/log-66XLWNCD.js +95 -0
- package/dist/logo-ABO4HJRG.js +18 -0
- package/dist/lookup-SPNT3W3W.js +23 -0
- package/dist/make-3ADCSNFC.js +1367 -0
- package/dist/make-3ADCSNFC.js.map +1 -0
- package/dist/map-3SGKGWSY.js +436 -0
- package/dist/mcp-ZSPJE3Y6.js +729 -0
- package/dist/media-CIJW2Q3I.js +89 -0
- package/dist/media-GZKW2PZB.js +18 -0
- package/dist/media-sources-UBQCVRGK.js +35 -0
- package/dist/members-76XFDSMX.js +47 -0
- package/dist/meme-BPWX7YQH.js +100 -0
- package/dist/meta-KVOSCSPJ.js +122 -0
- package/dist/metrics-XCD3IJSM.js +152 -0
- package/dist/models-WNK7Z6TR.js +155 -0
- package/dist/normalize-NMNOJ6Q5.js +806 -0
- package/dist/normalize-VC7HUODA.js +144 -0
- package/dist/options-5BPPM5N3.js +125 -0
- package/dist/organization-PXND43LQ.js +949 -0
- package/dist/output-34QMC3OU.js +24 -0
- package/dist/page-UDF3LJHP.js +105 -0
- package/dist/page-photos-FCBW5UZS.js +118 -0
- package/dist/pages-5W5G4MRB.js +67 -0
- package/dist/performance-DDZOJ5GD.js +5565 -0
- package/dist/performance-Q25RDNM6.js +27 -0
- package/dist/pinterest-IABDXLF5.js +96 -0
- package/dist/pixels-4QAWLSEL.js +109 -0
- package/dist/pixels-KRK2B7M3.js +62 -0
- package/dist/plan-I6EFL7RC.js +208 -0
- package/dist/posts-SXQSLOFV.js +36 -0
- package/dist/preview-7Y5LE24E.js +218 -0
- package/dist/profile-R5VPOOJU.js +159 -0
- package/dist/promoted-tweet-writes-LIFJFF7N.js +183 -0
- package/dist/promoted-tweets-H5RMRQD2.js +119 -0
- package/dist/properties-2D2BIDGC.js +101 -0
- package/dist/publish-LBHYEZW3.js +344 -0
- package/dist/query-A53T6QJF.js +62 -0
- package/dist/query-LB5H7IRK.js +236 -0
- package/dist/query-NDOYOIHL.js +247 -0
- package/dist/questionnaire-U767HYDE.js +94 -0
- package/dist/read-3TCDDALC.js +141 -0
- package/dist/reddit-H4R23K27.js +29 -0
- package/dist/refresh-3QKUSERK.js +97 -0
- package/dist/refresh-GIB6QQZS.js +42 -0
- package/dist/release-JMYTQZLK.js +63 -0
- package/dist/relevant-pages-DOCKQEMZ.js +99 -0
- package/dist/remove-F7GEZMKB.js +53 -0
- package/dist/remove-LZQHDFZF.js +49 -0
- package/dist/reopen-Y557X6IX.js +66 -0
- package/dist/rerun-RWBKQGVF.js +96 -0
- package/dist/rerun-RWBKQGVF.js.map +1 -0
- package/dist/research-3OJ5UZER.js +265 -0
- package/dist/research-AYO522XS.js +72 -0
- package/dist/reset-BL7M4LL7.js +57 -0
- package/dist/reset-PMVUQTYU.js +57 -0
- package/dist/resolve-CSWSGGK6.js +124 -0
- package/dist/retry-MVOPE2O2.js +65 -0
- package/dist/retry-WT46B5SC.js +63 -0
- package/dist/retry-failed-PEAUXGNT.js +45 -0
- package/dist/revenue-ZLE645Z5.js +91 -0
- package/dist/rule-writes-G25O5JZS.js +525 -0
- package/dist/rules-KSOAKEI3.js +217 -0
- package/dist/rules-Q6HWHFVU.js +99 -0
- package/dist/rules-add-7EPXWSQV.js +465 -0
- package/dist/run-4DE5XUVB.js +71 -0
- package/dist/run-PAND6N4V.js +69 -0
- package/dist/scaffold-ad-44INCR5V.js +1513 -0
- package/dist/scaffold-ad-44INCR5V.js.map +1 -0
- package/dist/scaffold-static-ad-ATXP44TE.js +1011 -0
- package/dist/scaffold-static-ad-ATXP44TE.js.map +1 -0
- package/dist/scaffold-video-L4FQWQ5A.js +885 -0
- package/dist/scaffold-video-L4FQWQ5A.js.map +1 -0
- package/dist/schedule-CSE2XFFF.js +64 -0
- package/dist/schedule-TNF6M6UD.js +67 -0
- package/dist/scheduled-agents-NXHXQZBO.js +55 -0
- package/dist/schema-2YQAQVON.js +121 -0
- package/dist/schema-QITMY7ZE.js +135 -0
- package/dist/scrape-FDBYU3TU.js +2241 -0
- package/dist/screenshot-QSRWL4J6.js +102 -0
- package/dist/search-BOCQFUM3.js +51 -0
- package/dist/search-CENPR7GA.js +224 -0
- package/dist/search-GEXDRTAQ.js +26 -0
- package/dist/search-HOYOSX2H.js +177 -0
- package/dist/search-LFTFNDMC.js +91 -0
- package/dist/search-PYLNVZXI.js +92 -0
- package/dist/search-copy-RLRRR3LB.js +168 -0
- package/dist/seeds-E2GLHJ2T.js +101 -0
- package/dist/select-E5TP7JR6.js +110 -0
- package/dist/select-E5TP7JR6.js.map +1 -0
- package/dist/sends-NBTGBZT7.js +349 -0
- package/dist/sequences-UOIHUOD3.js +146 -0
- package/dist/set-prompt-QGV3IUIP.js +199 -0
- package/dist/set-prompt-QGV3IUIP.js.map +1 -0
- package/dist/setup-links-HQ6WVKEP.js +144 -0
- package/dist/shared-IMDHTVSW.js +32 -0
- package/dist/shopify-6MLRXSC2.js +3958 -0
- package/dist/site-5B44TV46.js +180 -0
- package/dist/sitemaps-6A6JFBV4.js +87 -0
- package/dist/sites-PZLE5FFV.js +101 -0
- package/dist/skills-FBIVWINH.js +47 -0
- package/dist/sources-OMINR6RG.js +30 -0
- package/dist/sources-PNEWSEBG.js +457 -0
- package/dist/stale-G2BPCBYZ.js +90 -0
- package/dist/stale-G2BPCBYZ.js.map +1 -0
- package/dist/stats-2NLNQBRY.js +34 -0
- package/dist/status-QNXQNAKH.js +65 -0
- package/dist/sticker-4NKFAGEK.js +94 -0
- package/dist/stock-XOXZGGU3.js +179 -0
- package/dist/studies-C5IINK5Y.js +250 -0
- package/dist/studio-BNYFU6ZH.js +49 -0
- package/dist/study-writes-GJXLMM3D.js +470 -0
- package/dist/suggest-Z553OSYW.js +66 -0
- package/dist/sync-CIRDY55O.js +279 -0
- package/dist/sync-OYOS7HQL.js +57 -0
- package/dist/sync-UBOHNOXB.js +55 -0
- package/dist/sync-definition-2VEFGHYK.js +70 -0
- package/dist/tag-22TFBGDG.js +57 -0
- package/dist/tag-manager-QLZHU6NG.js +43 -0
- package/dist/tags-56H6O7ZL.js +26 -0
- package/dist/tags-CYR2IPEJ.js +23 -0
- package/dist/tags-RBUYBAA6.js +227 -0
- package/dist/tags-WVJNOATS.js +23 -0
- package/dist/tags-ZTVOZOYP.js +23 -0
- package/dist/targeting-GNEBULXU.js +762 -0
- package/dist/targeting-constants-GR6BVM2H.js +118 -0
- package/dist/targeting-criteria-EZNZOUAE.js +113 -0
- package/dist/targets-CU7IUPV2.js +106 -0
- package/dist/terms-LG7FYQOG.js +102 -0
- package/dist/testimonials-THJJYQ42.js +32 -0
- package/dist/themes-TSEMQ4EJ.js +95 -0
- package/dist/top-companies-W6DA3MZQ.js +111 -0
- package/dist/transcript-KZ74PK23.js +165 -0
- package/dist/translate-FQOYDETZ.js +603 -0
- package/dist/translate-FQOYDETZ.js.map +1 -0
- package/dist/triggers-OJKTDJSV.js +144 -0
- package/dist/tweets-IF5FFFTH.js +123 -0
- package/dist/unfollow-CDUOZWM7.js +46 -0
- package/dist/unlink-ZE7464NK.js +70 -0
- package/dist/unstage-OVOZE6DA.js +96 -0
- package/dist/unstage-RGIPGM3E.js +88 -0
- package/dist/update-2VYVJCY2.js +192 -0
- package/dist/update-63MMKPHI.js +155 -0
- package/dist/update-JHWPEJN7.js +66 -0
- package/dist/update-Q3WJ3DQN.js +81 -0
- package/dist/update-WHHAH4IE.js +101 -0
- package/dist/upload-7XG5LU7C.js +130 -0
- package/dist/upload-7XG5LU7C.js.map +1 -0
- package/dist/upload-EAEILUQB.js +150 -0
- package/dist/upscale-HB6L6SZG.js +109 -0
- package/dist/url-options-2BGF2D5E.js +131 -0
- package/dist/url-params-FBDTXQGY.js +101 -0
- package/dist/use-HGX7ZRH5.js +111 -0
- package/dist/use-HGX7ZRH5.js.map +1 -0
- package/dist/validate-Z3SRQKSO.js +125 -0
- package/dist/validate-Z3SRQKSO.js.map +1 -0
- package/dist/variant-O7LXOA2E.js +338 -0
- package/dist/videos-4TLBI3E3.js +41 -0
- package/dist/view-ED636LWD.js +121 -0
- package/dist/viewer-check-ELVSS3DM.js +83 -0
- package/dist/web-LDR6HO5M.js +143 -0
- package/dist/winners-ZG5SHNBS.js +113 -0
- package/dist/winning-ads-7SWUVUDA.js +86 -0
- package/dist/write-commands-24FRMQW4.js +1525 -0
- package/dist/write-commands-AIWR7NBO.js +713 -0
- package/dist/write-commands-UK6MKGHI.js +206 -0
- package/dist/write-commands-W3UN6F4Y.js +1172 -0
- package/dist/x-UOGRWXET.js +47 -0
- package/package.json +1 -1
- package/dist/account-2G3IT7J4.js +0 -82
- package/dist/account-CQJFUII3.js +0 -139
- package/dist/account-ULC5N7SI.js +0 -82
- package/dist/account-assets-IDVG4DGK.js +0 -290
- package/dist/account-level-GK7M2MMQ.js +0 -611
- package/dist/account-reads-FRFI6OHK.js +0 -219
- package/dist/account-users-PINZLBT7.js +0 -64
- package/dist/account-writes-WRGJC7VU.js +0 -68
- package/dist/accounts-2KFG33EX.js +0 -80
- package/dist/accounts-5754XUS3.js +0 -115
- package/dist/accounts-KRW3JNCW.js +0 -76
- package/dist/accounts-MHPNZW3W.js +0 -701
- package/dist/accounts-MTNBMXHD.js +0 -114
- package/dist/actions-33IZOT5C.js +0 -55
- package/dist/active-entities-JR5B32X2.js +0 -103
- package/dist/activecampaign-BV5GZFVR.js +0 -938
- package/dist/activities-2RAJXP3J.js +0 -75
- package/dist/ad-group-writes-W6RCMYLC.js +0 -172
- package/dist/ad-groups-XAI2Z62X.js +0 -70
- package/dist/ad-writes-IGWZRTXY.js +0 -176
- package/dist/add-4PJDIW2M.js +0 -148
- package/dist/add-DBCN33GH.js +0 -107
- package/dist/add-KB7O7NSB.js +0 -97
- package/dist/add-PRU32PQN.js +0 -81
- package/dist/add-UZDOQAJL.js +0 -80
- package/dist/add-WDX66JSM.js +0 -305
- package/dist/add-accounts-ZWXG6HLM.js +0 -91
- package/dist/ads-255V76SZ.js +0 -79
- package/dist/ads-7TEPA4KZ.js +0 -48
- package/dist/ads-I6I4MYQH.js +0 -128
- package/dist/ads-JVBLNTBF.js +0 -120
- package/dist/adsets-FN5ZWSYF.js +0 -182
- package/dist/advertisers-BPJWOY7I.js +0 -125
- package/dist/advertisers-SJO6JYIO.js +0 -123
- package/dist/analytics-TXPEXLPQ.js +0 -447
- package/dist/analytics-XDWBEY57.js +0 -2437
- package/dist/animate-425S4ZXS.js +0 -480
- package/dist/approved-KUVAJ5M7.js +0 -73
- package/dist/asset-writes-SSI3CO2A.js +0 -50
- package/dist/assign-CTV6LDEI.js +0 -80
- package/dist/audience-size-5QYI5PKH.js +0 -76
- package/dist/audience-writes-G64754LR.js +0 -327
- package/dist/audiences-JAVNJ5NC.js +0 -86
- package/dist/audiences-JZ6SCEUC.js +0 -280
- package/dist/audiences-OMLKMHEJ.js +0 -85
- package/dist/audit-2YFDJAKL.js +0 -88
- package/dist/audit-4UE6GFLG.js +0 -154
- package/dist/autocomplete-HTUV2UDS.js +0 -114
- package/dist/avatars-K7RBSMIJ.js +0 -38
- package/dist/bid-pricing-OWP4SZP5.js +0 -103
- package/dist/brand-GBP4OEJI.js +0 -22
- package/dist/brief-SLTB3EPO.js +0 -543
- package/dist/businesses-DXRDQIFP.js +0 -54
- package/dist/campaign-groups-LDOQU65Q.js +0 -99
- package/dist/campaign-writes-SHF3XZXV.js +0 -176
- package/dist/campaign-writes-SK55QLY5.js +0 -168
- package/dist/campaigns-6CAKRANC.js +0 -113
- package/dist/campaigns-EHV7J7PW.js +0 -111
- package/dist/campaigns-GG7LLI4X.js +0 -78
- package/dist/campaigns-GQWFSKGC.js +0 -130
- package/dist/canvas-2VRPGRND.js +0 -46
- package/dist/capabilities-BEZXR2FZ.js +0 -147
- package/dist/cards-J2PGFKEF.js +0 -85
- package/dist/catalog-XECCXRM6.js +0 -65
- package/dist/catalog-XECCXRM6.js.map +0 -1
- package/dist/catalogs-P5KMIMC2.js +0 -130
- package/dist/catalogs-TBRONC2D.js +0 -781
- package/dist/changes-3COSIJLU.js +0 -135
- package/dist/chatgpt-S5EVEKYV.js +0 -47
- package/dist/chats-AN52YVBT.js +0 -279
- package/dist/check-AQO7CMDD.js +0 -107
- package/dist/chunk-2MXDSPUO.js +0 -76
- package/dist/chunk-2SGREP24.js +0 -76
- package/dist/chunk-34FVKJS2.js +0 -64
- package/dist/chunk-364TCROV.js +0 -207
- package/dist/chunk-3H5MJOG2.js +0 -91
- package/dist/chunk-3J3W23S4.js +0 -592
- package/dist/chunk-3KMYOPBI.js +0 -98
- package/dist/chunk-3WSJGYA3.js +0 -148
- package/dist/chunk-44ZRCSR7.js +0 -228
- package/dist/chunk-46YLDIQG.js +0 -4254
- package/dist/chunk-46YLDIQG.js.map +0 -1
- package/dist/chunk-4745PLPI.js +0 -111
- package/dist/chunk-4JS2O2KV.js +0 -89
- package/dist/chunk-4ULRDQVD.js +0 -714
- package/dist/chunk-4VXQAJRU.js +0 -225
- package/dist/chunk-4XXA4WCS.js +0 -207
- package/dist/chunk-52IYZCRS.js +0 -476
- package/dist/chunk-56OEYUJU.js +0 -61
- package/dist/chunk-5CTNSIWY.js +0 -69
- package/dist/chunk-5EF7ZLXA.js +0 -942
- package/dist/chunk-5EF7ZLXA.js.map +0 -1
- package/dist/chunk-62QMJYML.js +0 -167
- package/dist/chunk-6B4KNOJZ.js +0 -75
- package/dist/chunk-6M77QNJ4.js +0 -69
- package/dist/chunk-7HH4F2KX.js +0 -188
- package/dist/chunk-7O4HFODK.js +0 -26
- package/dist/chunk-AFQF6ISC.js +0 -215
- package/dist/chunk-AXTOIHH2.js +0 -74
- package/dist/chunk-B4UVJCJ4.js +0 -229
- package/dist/chunk-BN4TDL5L.js +0 -217
- package/dist/chunk-C5UFKDAX.js +0 -377
- package/dist/chunk-CKTVRR3D.js +0 -57
- package/dist/chunk-CREEY2FS.js +0 -455
- package/dist/chunk-CSCHS3JG.js +0 -8954
- package/dist/chunk-DJWEQDBB.js +0 -98
- package/dist/chunk-DLNADMQV.js +0 -547
- package/dist/chunk-DNWP5DL6.js +0 -42
- package/dist/chunk-DW3OPKXI.js +0 -51
- package/dist/chunk-ECJIMIEJ.js +0 -142
- package/dist/chunk-EHIISZYD.js +0 -296
- package/dist/chunk-ERRTBCDW.js +0 -191
- package/dist/chunk-EZBZU6N7.js +0 -66
- package/dist/chunk-FBG3JDET.js +0 -97
- package/dist/chunk-FOWT6ENH.js +0 -170
- package/dist/chunk-FSGJSREN.js +0 -2437
- package/dist/chunk-FSGJSREN.js.map +0 -1
- package/dist/chunk-FVZL2YC5.js +0 -3868
- package/dist/chunk-FVZL2YC5.js.map +0 -1
- package/dist/chunk-GDQJG4BO.js +0 -91
- package/dist/chunk-GEFZVG4P.js +0 -219
- package/dist/chunk-GLCHD54W.js +0 -74
- package/dist/chunk-GT77XMOG.js +0 -23
- package/dist/chunk-GXPZJ2QN.js +0 -225
- package/dist/chunk-HAJYFRXL.js +0 -224
- package/dist/chunk-HPDGVK6R.js +0 -324
- package/dist/chunk-HVJJEQDQ.js +0 -7234
- package/dist/chunk-I7AYMJZA.js +0 -783
- package/dist/chunk-ILEJXJH2.js +0 -1518
- package/dist/chunk-J4ASA24X.js +0 -203
- package/dist/chunk-JAC6JVCI.js +0 -26
- package/dist/chunk-JCVPZ7CV.js +0 -638
- package/dist/chunk-KG7FPYM2.js +0 -64
- package/dist/chunk-KRQ2AXFW.js +0 -191
- package/dist/chunk-L5IYVZM2.js +0 -39
- package/dist/chunk-LHQ6GXNF.js +0 -46
- package/dist/chunk-LS2KEAYJ.js +0 -66
- package/dist/chunk-LURM3KKS.js +0 -94
- package/dist/chunk-MCJ5I5LR.js +0 -3187
- package/dist/chunk-MCJ5I5LR.js.map +0 -1
- package/dist/chunk-MHH7SGLS.js +0 -106
- package/dist/chunk-MZIYRWXL.js +0 -285
- package/dist/chunk-MZPS46OR.js +0 -76
- package/dist/chunk-NY5VYGTP.js +0 -97
- package/dist/chunk-O37YK4P6.js +0 -136
- package/dist/chunk-OYNBUT5X.js +0 -479
- package/dist/chunk-PGBZ73UZ.js +0 -429
- package/dist/chunk-PN72Z2W2.js +0 -56
- package/dist/chunk-QJ5TU5J6.js +0 -100
- package/dist/chunk-QNLPZOHV.js +0 -84
- package/dist/chunk-QNXDSNOQ.js +0 -544
- package/dist/chunk-QOC3JEUQ.js +0 -363
- package/dist/chunk-QOC3JEUQ.js.map +0 -1
- package/dist/chunk-R44B522K.js +0 -139
- package/dist/chunk-R5GGTLYE.js +0 -846
- package/dist/chunk-R6T25WTZ.js +0 -344
- package/dist/chunk-RUJS2NOA.js +0 -297
- package/dist/chunk-S6VFDNSQ.js +0 -63
- package/dist/chunk-SDQLZYQG.js +0 -843
- package/dist/chunk-SEC6FPWC.js +0 -494
- package/dist/chunk-SG2TDQEE.js +0 -150
- package/dist/chunk-SJAUMPL3.js +0 -46
- package/dist/chunk-SNDHR5QA.js +0 -24026
- package/dist/chunk-SNDHR5QA.js.map +0 -1
- package/dist/chunk-SP5L7EYC.js +0 -125
- package/dist/chunk-SPBNAGIN.js +0 -1646
- package/dist/chunk-SWNCS2OD.js +0 -333
- package/dist/chunk-T37PAZT2.js +0 -274
- package/dist/chunk-T6PTG6VM.js +0 -5368
- package/dist/chunk-TE4ASZSC.js +0 -45
- package/dist/chunk-TEKML2NW.js +0 -35
- package/dist/chunk-TKDOVFO6.js +0 -287
- package/dist/chunk-TRMZQRVV.js +0 -1919
- package/dist/chunk-TTKDFRON.js +0 -149
- package/dist/chunk-U2BPZ27S.js +0 -910
- package/dist/chunk-UBDY5RE4.js +0 -387
- package/dist/chunk-UPDIBQUC.js +0 -106
- package/dist/chunk-V2XEX2YR.js +0 -84
- package/dist/chunk-V62ZWGCL.js +0 -103
- package/dist/chunk-VCUXAPLM.js +0 -169
- package/dist/chunk-VP4PO7FW.js +0 -392
- package/dist/chunk-W7C7HZFJ.js +0 -275
- package/dist/chunk-WPAW6EVY.js +0 -166
- package/dist/chunk-WPSLL3S2.js +0 -604
- package/dist/chunk-WW6JLISJ.js +0 -200
- package/dist/chunk-WWLZ5RRU.js +0 -319
- package/dist/chunk-X3HPRECW.js +0 -52
- package/dist/chunk-XGX2WOV2.js +0 -8914
- package/dist/chunk-XGX2WOV2.js.map +0 -1
- package/dist/chunk-XJHUSJY6.js +0 -156
- package/dist/chunk-XPDUBDPL.js +0 -25
- package/dist/chunk-XRSRHAEU.js +0 -163
- package/dist/chunk-XVHR2NCG.js +0 -249
- package/dist/chunk-XWO6CXNG.js +0 -19
- package/dist/chunk-XZWBLUDV.js +0 -831
- package/dist/chunk-Y25HSPRJ.js +0 -122
- package/dist/chunk-Y25HSPRJ.js.map +0 -1
- package/dist/chunk-YUCGCJKT.js +0 -676
- package/dist/chunk-ZBUIWVF3.js +0 -197
- package/dist/chunk-ZFJ2FQUH.js +0 -131
- package/dist/chunk-ZNXP3WNJ.js +0 -58
- package/dist/chunk-ZVXKWLLE.js +0 -1744
- package/dist/claim-NRNO4XCO.js +0 -200
- package/dist/client-463NKLRT.js +0 -19
- package/dist/code-R4JOQ27J.js +0 -76
- package/dist/companies-4TOBU44J.js +0 -198
- package/dist/company-RK34S3IA.js +0 -308
- package/dist/complete-7BNBQ5AI.js +0 -84
- package/dist/config-GDLHHBJZ.js +0 -88
- package/dist/connect-CRIRSXN3.js +0 -45
- package/dist/content-FCO6MGXW.js +0 -85
- package/dist/conversation-4CQG2B2C.js +0 -96
- package/dist/conversion-report-PDTQTRVB.js +0 -127
- package/dist/conversion-upload-command-MEO4WLZH.js +0 -439
- package/dist/conversion-writes-ZVBOXUIA.js +0 -122
- package/dist/conversions-BND5HYTL.js +0 -78
- package/dist/conversions-POBKTXQF.js +0 -140
- package/dist/copy-writes-EUFEVWDW.js +0 -170
- package/dist/countries-TKL5T5JL.js +0 -82
- package/dist/create-BJ7XBNY5.js +0 -62
- package/dist/create-PYP3QWTL.js +0 -135
- package/dist/create-XN4KVB5U.js +0 -210
- package/dist/create-YSGBH6Q4.js +0 -239
- package/dist/creatives-57XIJAEG.js +0 -223
- package/dist/creatives-6VJDUHEY.js +0 -89
- package/dist/creatives-ANTJUTIE.js +0 -58
- package/dist/credentials-KIH6ICDU.js +0 -290
- package/dist/critique-GWRXVXVG.js +0 -1451
- package/dist/critique-MZUTDK4V.js +0 -232
- package/dist/crm-QSHUYXTW.js +0 -323
- package/dist/crm-Y5QTZAHO.js +0 -227
- package/dist/crop-WKTW3EMP.js +0 -113
- package/dist/currency-PTOI5SPU.js +0 -88
- package/dist/custom-conversions-NDY5RHSM.js +0 -128
- package/dist/customers-2G32E6W7.js +0 -59
- package/dist/decide-X2UAKYXK.js +0 -199
- package/dist/delete-2ZTMTKYD.js +0 -69
- package/dist/delete-3H6YH4YK.js +0 -67
- package/dist/delete-FOSTK2RA.js +0 -71
- package/dist/delete-FOSTK2RA.js.map +0 -1
- package/dist/delete-HIAZHA56.js +0 -57
- package/dist/delete-I43JQH2E.js +0 -69
- package/dist/delete-RF44ILYE.js +0 -71
- package/dist/demographics-2UYQW6II.js +0 -141
- package/dist/describe-M6DYXNQC.js +0 -97
- package/dist/describe-OQ6R3EF7.js +0 -97
- package/dist/dimensions-DGYM5E5P.js +0 -101
- package/dist/discard-NKPQ73UM.js +0 -69
- package/dist/discover-XLIH7RCB.js +0 -93
- package/dist/discover-YKMBVSPF.js +0 -172
- package/dist/domain-LUDUZB3F.js +0 -101
- package/dist/download-LL6DL62N.js +0 -172
- package/dist/download-SFWMT7DL.js +0 -299
- package/dist/draft-374Z4MGY.js +0 -103
- package/dist/draft-736FJJWK.js +0 -310
- package/dist/draft-7LPUJZCF.js +0 -283
- package/dist/draft-G432FJ7N.js +0 -240
- package/dist/draft-MPWR47CG.js +0 -308
- package/dist/draft-R5ND5SWT.js +0 -100
- package/dist/draft-T7TWIFEX.js +0 -335
- package/dist/draft-XAAIGE6Q.js +0 -220
- package/dist/env-DQHY5ODN.js +0 -53
- package/dist/experiment-MO6MT6OJ.js +0 -1397
- package/dist/experiments-OGZV73W6.js +0 -236
- package/dist/export-6Z6QBU6V.js +0 -168
- package/dist/extract-YGOQBOQK.js +0 -113
- package/dist/facets-OLZ7JLFL.js +0 -117
- package/dist/favorites-R3JO4SJJ.js +0 -178
- package/dist/feed-IUMMHM3I.js +0 -177
- package/dist/feedback-TJRYTOR3.js +0 -111
- package/dist/feedback-TJRYTOR3.js.map +0 -1
- package/dist/feedback-record-7IAJI5IY.js +0 -265
- package/dist/feedback-record-7IAJI5IY.js.map +0 -1
- package/dist/fetch-AL44XS4Q.js +0 -139
- package/dist/fetch-K3NRT2L2.js +0 -179
- package/dist/find-ZFIGMRYQ.js +0 -143
- package/dist/fit-5NVXWXZV.js +0 -65
- package/dist/flows-LL5SPPIK.js +0 -250
- package/dist/follow-SS374QUW.js +0 -94
- package/dist/follow-competitors-3LTOTTBY.js +0 -112
- package/dist/following-YMA5O3LF.js +0 -113
- package/dist/fonts-E3CNWPD5.js +0 -39
- package/dist/forecast-KOBF5TKM.js +0 -169
- package/dist/forecast-PWGN4ETP.js +0 -121
- package/dist/funding-KLIZ73SS.js +0 -85
- package/dist/funnel-XIZROHV7.js +0 -397
- package/dist/ga4-XPCE4EK5.js +0 -55
- package/dist/generate-GHIXVLMY.js +0 -263
- package/dist/get-HCGFATFD.js +0 -38
- package/dist/get-JR2KZXW5.js +0 -63
- package/dist/get-JR2KZXW5.js.map +0 -1
- package/dist/get-RDTJSWSA.js +0 -92
- package/dist/get-SGNT4JG2.js +0 -59
- package/dist/get-TGFXZC5S.js +0 -61
- package/dist/get-TGFXZC5S.js.map +0 -1
- package/dist/get-WS744HAO.js +0 -59
- package/dist/get-XPJ4BZGP.js +0 -82
- package/dist/get-YD7GDMDR.js +0 -63
- package/dist/get-YD7GDMDR.js.map +0 -1
- package/dist/gif-YK5HJXRE.js +0 -102
- package/dist/google-5JV7OMOH.js +0 -3267
- package/dist/google-BI45CXMW.js +0 -136
- package/dist/google-ads-DYZGUM6W.js +0 -198
- package/dist/group-7OWIYAKJ.js +0 -43
- package/dist/group-H6ZYRPE6.js +0 -43
- package/dist/gsc-HI2KXDEU.js +0 -30
- package/dist/history-3EQQHYKT.js +0 -69
- package/dist/history-RD2YMNNL.js +0 -102
- package/dist/history-SQPJ7PPE.js +0 -136
- package/dist/hubspot-MYTV36SM.js +0 -782
- package/dist/icon-HLJCWTR3.js +0 -137
- package/dist/ideas-CVXHFVX7.js +0 -45
- package/dist/images-XP4TKE2F.js +0 -92
- package/dist/improve-BRC4R6MW.js +0 -86
- package/dist/ingest-4GNJ2PWL.js +0 -26
- package/dist/ingest-5NYBUZE2.js +0 -110
- package/dist/ingest-5NYBUZE2.js.map +0 -1
- package/dist/insights-CN3GUTT7.js +0 -132
- package/dist/insights-IVW6W5CP.js +0 -439
- package/dist/inspect-25IVRU45.js +0 -192
- package/dist/inspiration-D75DO3MD.js +0 -53
- package/dist/instant-experiences-6F6GXZ67.js +0 -260
- package/dist/intent-3GDLPKKN.js +0 -95
- package/dist/job-2JJNKUHT.js +0 -202
- package/dist/job-create-BNTNZCSP.js +0 -109
- package/dist/job-status-N7RWRDRO.js +0 -74
- package/dist/keep-Z2WH3CKU.js +0 -78
- package/dist/keyword-gap-B2WPVHOB.js +0 -130
- package/dist/keyword-metrics-UDGWN7BO.js +0 -200
- package/dist/keywords-for-site-GEG6AXD3.js +0 -131
- package/dist/knowledge-PKXPN4RV.js +0 -195
- package/dist/landing-O2ZUIUGE.js +0 -28
- package/dist/landings-7QRITXZ2.js +0 -151
- package/dist/languages-RZLMZR57.js +0 -55
- package/dist/languages-UJAOPTV2.js +0 -40
- package/dist/launches-4H6ANGTG.js +0 -19
- package/dist/layerize-P5LFIA4X.js +0 -190
- package/dist/lead-routes-WVXWVG62.js +0 -733
- package/dist/leads-CJKRKB2Q.js +0 -540
- package/dist/leads-MTTOYNPM.js +0 -115
- package/dist/learn-QPXZZIZZ.js +0 -207
- package/dist/library-VW27X75P.js +0 -211
- package/dist/lighthouse-FGUFJRGR.js +0 -75
- package/dist/line-item-writes-RVOAMJ5R.js +0 -211
- package/dist/line-items-POZRAJLC.js +0 -107
- package/dist/link-IXEZKRM7.js +0 -67
- package/dist/linkedin-5PYG5HEM.js +0 -1328
- package/dist/linkedin-person-EMJXEZYR.js +0 -139
- package/dist/list-4KS7WSUG.js +0 -306
- package/dist/list-7GDMM26I.js +0 -93
- package/dist/list-DVVOP6FM.js +0 -50
- package/dist/list-J5KWXHFO.js +0 -76
- package/dist/list-OZCU2T22.js +0 -67
- package/dist/list-PTK2HOUY.js +0 -51
- package/dist/list-Q5LVTPQP.js +0 -57
- package/dist/list-UG4V5AM2.js +0 -65
- package/dist/list-XOYU7UTX.js +0 -154
- package/dist/locations-EISZ6JOT.js +0 -40
- package/dist/locations-VJX64ZZR.js +0 -69
- package/dist/log-2F2N24DT.js +0 -95
- package/dist/logo-H2KHGLYD.js +0 -18
- package/dist/lookup-K57ITJWF.js +0 -23
- package/dist/make-T6HLXIYY.js +0 -1366
- package/dist/make-T6HLXIYY.js.map +0 -1
- package/dist/map-QGJZIC5N.js +0 -436
- package/dist/mcp-RSW7KAWP.js +0 -729
- package/dist/media-HDHZULQ7.js +0 -18
- package/dist/media-K5RJXLTN.js +0 -89
- package/dist/media-sources-7R7FO53Y.js +0 -35
- package/dist/members-B6TKGGT5.js +0 -47
- package/dist/meme-QMCUGXUE.js +0 -100
- package/dist/meta-MOSJVYIE.js +0 -122
- package/dist/metrics-PRIKXVYZ.js +0 -152
- package/dist/models-M3E4YFCT.js +0 -155
- package/dist/normalize-5B4EQLUX.js +0 -144
- package/dist/normalize-5QIGANTK.js +0 -806
- package/dist/options-K33CJOR6.js +0 -125
- package/dist/organization-A4NFWWWI.js +0 -949
- package/dist/output-U5ZV6PST.js +0 -24
- package/dist/page-XVOUD4VV.js +0 -105
- package/dist/page-photos-4JTIKXAW.js +0 -118
- package/dist/pages-BAUS7LQM.js +0 -67
- package/dist/performance-MHJDRLEK.js +0 -5565
- package/dist/performance-NVURSEZ6.js +0 -27
- package/dist/pinterest-NA6HGPMB.js +0 -96
- package/dist/pixels-QOSEYXCP.js +0 -109
- package/dist/pixels-THDQD3RF.js +0 -62
- package/dist/plan-JYSHKPZQ.js +0 -208
- package/dist/posts-ILAFADBW.js +0 -36
- package/dist/preview-X6EJGPAY.js +0 -218
- package/dist/profile-YHI65VGK.js +0 -159
- package/dist/promoted-tweet-writes-MXXVRLVQ.js +0 -183
- package/dist/promoted-tweets-HFLGXWX2.js +0 -119
- package/dist/properties-ZLY6NYVK.js +0 -101
- package/dist/publish-6ZXFUBGP.js +0 -344
- package/dist/query-ELD7WSFR.js +0 -247
- package/dist/query-HFHTLNDN.js +0 -236
- package/dist/query-WMEX73ZB.js +0 -62
- package/dist/questionnaire-Y37I64FO.js +0 -94
- package/dist/read-2HQEZIJW.js +0 -141
- package/dist/reddit-BIHGJPGP.js +0 -29
- package/dist/refresh-4O32S4YR.js +0 -97
- package/dist/refresh-LVV4SPLT.js +0 -42
- package/dist/release-VIPNSPQ5.js +0 -63
- package/dist/relevant-pages-B5SYN575.js +0 -99
- package/dist/remove-2E77743U.js +0 -53
- package/dist/remove-TPOWWFZ6.js +0 -49
- package/dist/reopen-UOBTJBMQ.js +0 -66
- package/dist/rerun-UPDIXTEL.js +0 -95
- package/dist/rerun-UPDIXTEL.js.map +0 -1
- package/dist/research-ELM3KHGE.js +0 -72
- package/dist/research-FOJIDMSE.js +0 -265
- package/dist/reset-FTLWUFZK.js +0 -57
- package/dist/reset-GIXXLPHQ.js +0 -57
- package/dist/resolve-QHR5JJTJ.js +0 -124
- package/dist/retry-HNWXJR5U.js +0 -65
- package/dist/retry-NY5KFEDA.js +0 -63
- package/dist/retry-failed-OAH7JQKD.js +0 -45
- package/dist/revenue-JFMUODJO.js +0 -91
- package/dist/rule-writes-A4BFYHPA.js +0 -525
- package/dist/rules-56E55SGC.js +0 -99
- package/dist/rules-HLREXY2M.js +0 -217
- package/dist/rules-add-ZOPOWJMY.js +0 -465
- package/dist/run-4UIPMCSN.js +0 -69
- package/dist/run-GACZDI6Q.js +0 -70
- package/dist/scaffold-ad-Z2HSN4PE.js +0 -1512
- package/dist/scaffold-ad-Z2HSN4PE.js.map +0 -1
- package/dist/scaffold-static-ad-ODZGTIM5.js +0 -1010
- package/dist/scaffold-static-ad-ODZGTIM5.js.map +0 -1
- package/dist/scaffold-video-EHGAMEEP.js +0 -884
- package/dist/scaffold-video-EHGAMEEP.js.map +0 -1
- package/dist/schedule-OFPSZVZ2.js +0 -67
- package/dist/schedule-ZATNBBWD.js +0 -64
- package/dist/scheduled-agents-4VY4CAA2.js +0 -55
- package/dist/schema-EYGPETLF.js +0 -121
- package/dist/schema-OGP4DUPP.js +0 -135
- package/dist/scrape-ZHL2BHS7.js +0 -2241
- package/dist/screenshot-ADMRDYWN.js +0 -102
- package/dist/search-6W4HXR2S.js +0 -91
- package/dist/search-6ZWI2NML.js +0 -92
- package/dist/search-CQUS7EOM.js +0 -51
- package/dist/search-HF5ECIYW.js +0 -26
- package/dist/search-MKVVMJ2Q.js +0 -224
- package/dist/search-QUF6LHQ5.js +0 -177
- package/dist/search-copy-O6FDX4HT.js +0 -168
- package/dist/seeds-5TM3O3K3.js +0 -101
- package/dist/select-FCQUYBKV.js +0 -106
- package/dist/select-FCQUYBKV.js.map +0 -1
- package/dist/sends-MZKHZZGJ.js +0 -349
- package/dist/sequences-3CEVHGHB.js +0 -146
- package/dist/set-prompt-IBAG6BDA.js +0 -198
- package/dist/set-prompt-IBAG6BDA.js.map +0 -1
- package/dist/setup-links-4STQ5B4P.js +0 -144
- package/dist/shared-I3SB77VH.js +0 -32
- package/dist/shopify-7LDHCWUQ.js +0 -3958
- package/dist/site-I3NFMPJB.js +0 -180
- package/dist/sitemaps-PLAWVXQL.js +0 -87
- package/dist/sites-WX2IBTZT.js +0 -101
- package/dist/skills-O6EQOAMQ.js +0 -47
- package/dist/sources-K2LILGTW.js +0 -30
- package/dist/sources-ZM7LEIMM.js +0 -457
- package/dist/stale-VR5QAYB6.js +0 -76
- package/dist/stale-VR5QAYB6.js.map +0 -1
- package/dist/stats-QQRYOMZA.js +0 -34
- package/dist/status-5OMVGFCH.js +0 -65
- package/dist/sticker-654HS3K2.js +0 -94
- package/dist/stock-35LOO3YN.js +0 -179
- package/dist/studies-IGOCWM7F.js +0 -250
- package/dist/studio-3D42TUJX.js +0 -49
- package/dist/study-writes-Z5P2W7JH.js +0 -470
- package/dist/suggest-JASHCOL5.js +0 -66
- package/dist/sync-6AN67IX3.js +0 -55
- package/dist/sync-RCDODSOD.js +0 -57
- package/dist/sync-URIRLHTS.js +0 -279
- package/dist/sync-definition-MZUJOJYI.js +0 -69
- package/dist/tag-7YMFAZQQ.js +0 -57
- package/dist/tag-manager-LU4GAZ6R.js +0 -43
- package/dist/tags-6A7QOYBI.js +0 -23
- package/dist/tags-JHT3Q6VO.js +0 -227
- package/dist/tags-KSMLT4G2.js +0 -26
- package/dist/tags-MTVZJHCE.js +0 -23
- package/dist/tags-OU32R2SH.js +0 -23
- package/dist/targeting-7HXKBXWY.js +0 -762
- package/dist/targeting-constants-QIB3UZHM.js +0 -118
- package/dist/targeting-criteria-NUXZB7NP.js +0 -113
- package/dist/targets-LQ7HGI73.js +0 -106
- package/dist/terms-X4OJWTQH.js +0 -102
- package/dist/testimonials-Z2KOOMVH.js +0 -32
- package/dist/themes-6KVP3COR.js +0 -95
- package/dist/top-companies-WWNPUJ23.js +0 -111
- package/dist/transcript-P7HKVABU.js +0 -165
- package/dist/translate-II4JY2XW.js +0 -600
- package/dist/translate-II4JY2XW.js.map +0 -1
- package/dist/triggers-Z3LV3KJR.js +0 -144
- package/dist/tweets-X5PTAT6F.js +0 -123
- package/dist/unfollow-S5LHFLGW.js +0 -46
- package/dist/unlink-XTZA474P.js +0 -70
- package/dist/unstage-AVLORZLW.js +0 -96
- package/dist/unstage-QXOL5DXZ.js +0 -88
- package/dist/update-3NA6ABLW.js +0 -101
- package/dist/update-5ZNS2DKP.js +0 -66
- package/dist/update-DDKNKV6M.js +0 -81
- package/dist/update-MDVZ24VQ.js +0 -192
- package/dist/update-UE4XVBKL.js +0 -155
- package/dist/upload-IMP5CUY5.js +0 -129
- package/dist/upload-IMP5CUY5.js.map +0 -1
- package/dist/upload-SYFB2VTJ.js +0 -150
- package/dist/upscale-P5EYUVOZ.js +0 -109
- package/dist/url-options-DJZV3ADK.js +0 -131
- package/dist/url-params-Y5XQSDEF.js +0 -101
- package/dist/use-D3RBWLJO.js +0 -95
- package/dist/use-D3RBWLJO.js.map +0 -1
- package/dist/validate-BCK22BQL.js +0 -122
- package/dist/validate-BCK22BQL.js.map +0 -1
- package/dist/variant-JQVZUUA4.js +0 -338
- package/dist/videos-YCQVOOFE.js +0 -41
- package/dist/view-IKKRJ5YD.js +0 -121
- package/dist/viewer-check-5GREZIVJ.js +0 -83
- package/dist/web-7TPDDBI6.js +0 -143
- package/dist/winners-4PKEVMUC.js +0 -113
- package/dist/winning-ads-7X5EWSJX.js +0 -86
- package/dist/write-commands-CTLF2M6L.js +0 -713
- package/dist/write-commands-CY734U34.js +0 -1172
- package/dist/write-commands-FIS6Y2MN.js +0 -206
- package/dist/write-commands-V77MD5SC.js +0 -1525
- package/dist/x-EMLFCHSG.js +0 -47
- /package/dist/{account-2G3IT7J4.js.map → account-BRRFMDXZ.js.map} +0 -0
- /package/dist/{account-CQJFUII3.js.map → account-HQD5P3AF.js.map} +0 -0
- /package/dist/{account-ULC5N7SI.js.map → account-MQI7EZBH.js.map} +0 -0
- /package/dist/{account-assets-IDVG4DGK.js.map → account-assets-JRMYVXQP.js.map} +0 -0
- /package/dist/{account-level-GK7M2MMQ.js.map → account-level-PEGLZQTI.js.map} +0 -0
- /package/dist/{account-reads-FRFI6OHK.js.map → account-reads-K6YDAOHX.js.map} +0 -0
- /package/dist/{account-users-PINZLBT7.js.map → account-users-QS54ZEOD.js.map} +0 -0
- /package/dist/{account-writes-WRGJC7VU.js.map → account-writes-PGGGP26M.js.map} +0 -0
- /package/dist/{accounts-2KFG33EX.js.map → accounts-H3U7LARM.js.map} +0 -0
- /package/dist/{accounts-MHPNZW3W.js.map → accounts-IW62WBX5.js.map} +0 -0
- /package/dist/{accounts-MTNBMXHD.js.map → accounts-MQMEOGQD.js.map} +0 -0
- /package/dist/{accounts-KRW3JNCW.js.map → accounts-T6SRCZJQ.js.map} +0 -0
- /package/dist/{accounts-5754XUS3.js.map → accounts-Y2VWI3AA.js.map} +0 -0
- /package/dist/{actions-33IZOT5C.js.map → actions-2CUQFZNA.js.map} +0 -0
- /package/dist/{active-entities-JR5B32X2.js.map → active-entities-BOMM4YDF.js.map} +0 -0
- /package/dist/{activecampaign-BV5GZFVR.js.map → activecampaign-WAMDVBUO.js.map} +0 -0
- /package/dist/{activities-2RAJXP3J.js.map → activities-YH4K4JAI.js.map} +0 -0
- /package/dist/{ad-group-writes-W6RCMYLC.js.map → ad-group-writes-ROUU6BHU.js.map} +0 -0
- /package/dist/{ad-groups-XAI2Z62X.js.map → ad-groups-Y2BSRLIN.js.map} +0 -0
- /package/dist/{ad-writes-IGWZRTXY.js.map → ad-writes-NF4LCGVP.js.map} +0 -0
- /package/dist/{add-UZDOQAJL.js.map → add-2L2VQ5MU.js.map} +0 -0
- /package/dist/{add-WDX66JSM.js.map → add-4P3CUHAN.js.map} +0 -0
- /package/dist/{add-KB7O7NSB.js.map → add-PS36Q2S3.js.map} +0 -0
- /package/dist/{add-4PJDIW2M.js.map → add-RLMXZLLO.js.map} +0 -0
- /package/dist/{add-DBCN33GH.js.map → add-UHWRBSFE.js.map} +0 -0
- /package/dist/{add-PRU32PQN.js.map → add-Z2OTFSQO.js.map} +0 -0
- /package/dist/{add-accounts-ZWXG6HLM.js.map → add-accounts-GXBE4ZR2.js.map} +0 -0
- /package/dist/{ads-255V76SZ.js.map → ads-CPMX3L4A.js.map} +0 -0
- /package/dist/{ads-7TEPA4KZ.js.map → ads-TDN7OYSU.js.map} +0 -0
- /package/dist/{ads-I6I4MYQH.js.map → ads-WYQYZ44U.js.map} +0 -0
- /package/dist/{ads-JVBLNTBF.js.map → ads-ZEF5AU3D.js.map} +0 -0
- /package/dist/{adsets-FN5ZWSYF.js.map → adsets-ZRS7AZIK.js.map} +0 -0
- /package/dist/{advertisers-SJO6JYIO.js.map → advertisers-6CHV5N2V.js.map} +0 -0
- /package/dist/{advertisers-BPJWOY7I.js.map → advertisers-AAGUUSAX.js.map} +0 -0
- /package/dist/{analytics-XDWBEY57.js.map → analytics-4GTUW42V.js.map} +0 -0
- /package/dist/{analytics-TXPEXLPQ.js.map → analytics-MV2RQ6KR.js.map} +0 -0
- /package/dist/{animate-425S4ZXS.js.map → animate-EOSLSA7F.js.map} +0 -0
- /package/dist/{approved-KUVAJ5M7.js.map → approved-LHYBVDXH.js.map} +0 -0
- /package/dist/{asset-writes-SSI3CO2A.js.map → asset-writes-CUF25BLM.js.map} +0 -0
- /package/dist/{assign-CTV6LDEI.js.map → assign-RN5DGDS2.js.map} +0 -0
- /package/dist/{audience-size-5QYI5PKH.js.map → audience-size-7DYMCXDM.js.map} +0 -0
- /package/dist/{audience-writes-G64754LR.js.map → audience-writes-L7SNU2SB.js.map} +0 -0
- /package/dist/{audiences-JAVNJ5NC.js.map → audiences-A54MU63W.js.map} +0 -0
- /package/dist/{audiences-OMLKMHEJ.js.map → audiences-SG2BBM7R.js.map} +0 -0
- /package/dist/{audiences-JZ6SCEUC.js.map → audiences-VMGB2JZG.js.map} +0 -0
- /package/dist/{audit-2YFDJAKL.js.map → audit-6K5FFV6K.js.map} +0 -0
- /package/dist/{audit-4UE6GFLG.js.map → audit-7U7G2JKS.js.map} +0 -0
- /package/dist/{autocomplete-HTUV2UDS.js.map → autocomplete-E6YHJ3HH.js.map} +0 -0
- /package/dist/{avatars-K7RBSMIJ.js.map → avatars-6JHVTSXH.js.map} +0 -0
- /package/dist/{bid-pricing-OWP4SZP5.js.map → bid-pricing-J3OJK4J3.js.map} +0 -0
- /package/dist/{brand-GBP4OEJI.js.map → brand-3EAQFDYN.js.map} +0 -0
- /package/dist/{brief-SLTB3EPO.js.map → brief-ADGCGC3H.js.map} +0 -0
- /package/dist/{businesses-DXRDQIFP.js.map → businesses-GQ5FOZDU.js.map} +0 -0
- /package/dist/{campaign-groups-LDOQU65Q.js.map → campaign-groups-GN7D5UXE.js.map} +0 -0
- /package/dist/{campaign-writes-SK55QLY5.js.map → campaign-writes-HKWI6GYU.js.map} +0 -0
- /package/dist/{campaign-writes-SHF3XZXV.js.map → campaign-writes-UORRIIWY.js.map} +0 -0
- /package/dist/{campaigns-6CAKRANC.js.map → campaigns-5I76AV7F.js.map} +0 -0
- /package/dist/{campaigns-EHV7J7PW.js.map → campaigns-BEXDLBT3.js.map} +0 -0
- /package/dist/{campaigns-GG7LLI4X.js.map → campaigns-GONROKTU.js.map} +0 -0
- /package/dist/{campaigns-GQWFSKGC.js.map → campaigns-VZJMYETG.js.map} +0 -0
- /package/dist/{canvas-2VRPGRND.js.map → canvas-CHV34G62.js.map} +0 -0
- /package/dist/{capabilities-BEZXR2FZ.js.map → capabilities-VKBIQ2BR.js.map} +0 -0
- /package/dist/{cards-J2PGFKEF.js.map → cards-YHZFJ3US.js.map} +0 -0
- /package/dist/{catalogs-P5KMIMC2.js.map → catalogs-LXEM7NNC.js.map} +0 -0
- /package/dist/{catalogs-TBRONC2D.js.map → catalogs-ZHCLH43A.js.map} +0 -0
- /package/dist/{changes-3COSIJLU.js.map → changes-4OYC4NMW.js.map} +0 -0
- /package/dist/{chatgpt-S5EVEKYV.js.map → chatgpt-XV6CVKLN.js.map} +0 -0
- /package/dist/{chats-AN52YVBT.js.map → chats-W35ZPZEW.js.map} +0 -0
- /package/dist/{check-AQO7CMDD.js.map → check-3D63D4ZT.js.map} +0 -0
- /package/dist/{chunk-TE4ASZSC.js.map → chunk-23KN4NL4.js.map} +0 -0
- /package/dist/{chunk-3J3W23S4.js.map → chunk-2PC26XRF.js.map} +0 -0
- /package/dist/{chunk-3WSJGYA3.js.map → chunk-2UZHRLLO.js.map} +0 -0
- /package/dist/{chunk-6M77QNJ4.js.map → chunk-3JV4T6XW.js.map} +0 -0
- /package/dist/{chunk-I7AYMJZA.js.map → chunk-45EERHDB.js.map} +0 -0
- /package/dist/{chunk-5CTNSIWY.js.map → chunk-4BTUF2AV.js.map} +0 -0
- /package/dist/{chunk-4745PLPI.js.map → chunk-4D37LCBS.js.map} +0 -0
- /package/dist/{chunk-XVHR2NCG.js.map → chunk-55B4AJY3.js.map} +0 -0
- /package/dist/{chunk-VP4PO7FW.js.map → chunk-56UWXQEN.js.map} +0 -0
- /package/dist/{chunk-W7C7HZFJ.js.map → chunk-5G5QFFJY.js.map} +0 -0
- /package/dist/{chunk-4JS2O2KV.js.map → chunk-5HGAO4ZI.js.map} +0 -0
- /package/dist/{chunk-QNXDSNOQ.js.map → chunk-5ITB24SC.js.map} +0 -0
- /package/dist/{chunk-56OEYUJU.js.map → chunk-5YN53OAA.js.map} +0 -0
- /package/dist/{chunk-MZIYRWXL.js.map → chunk-6CCEEVXJ.js.map} +0 -0
- /package/dist/{chunk-SP5L7EYC.js.map → chunk-6CQOHJZW.js.map} +0 -0
- /package/dist/{chunk-JCVPZ7CV.js.map → chunk-6HGLQJ6A.js.map} +0 -0
- /package/dist/{chunk-JAC6JVCI.js.map → chunk-6OIKNJ7G.js.map} +0 -0
- /package/dist/{chunk-GLCHD54W.js.map → chunk-6OXENBTF.js.map} +0 -0
- /package/dist/{chunk-LHQ6GXNF.js.map → chunk-6QGBBX7F.js.map} +0 -0
- /package/dist/{chunk-XWO6CXNG.js.map → chunk-6RTZPBAT.js.map} +0 -0
- /package/dist/{chunk-4XXA4WCS.js.map → chunk-7JFVMJZI.js.map} +0 -0
- /package/dist/{chunk-J4ASA24X.js.map → chunk-7MY3QHGA.js.map} +0 -0
- /package/dist/{chunk-WPAW6EVY.js.map → chunk-A6VODUO3.js.map} +0 -0
- /package/dist/{chunk-R44B522K.js.map → chunk-AGTA5FJX.js.map} +0 -0
- /package/dist/{chunk-V2XEX2YR.js.map → chunk-AGU4KGT6.js.map} +0 -0
- /package/dist/{chunk-DLNADMQV.js.map → chunk-BKOUVU6X.js.map} +0 -0
- /package/dist/{chunk-ZNXP3WNJ.js.map → chunk-C7IOSSI4.js.map} +0 -0
- /package/dist/{chunk-FOWT6ENH.js.map → chunk-CBQPKCFE.js.map} +0 -0
- /package/dist/{chunk-B4UVJCJ4.js.map → chunk-CIW3Q7B2.js.map} +0 -0
- /package/dist/{chunk-6B4KNOJZ.js.map → chunk-CNPYG4F3.js.map} +0 -0
- /package/dist/{chunk-CKTVRR3D.js.map → chunk-CWZ2ODJQ.js.map} +0 -0
- /package/dist/{chunk-LS2KEAYJ.js.map → chunk-D7Y3UNWO.js.map} +0 -0
- /package/dist/{chunk-SDQLZYQG.js.map → chunk-DGZYZWMK.js.map} +0 -0
- /package/dist/{chunk-R6T25WTZ.js.map → chunk-DMA67YC3.js.map} +0 -0
- /package/dist/{chunk-HVJJEQDQ.js.map → chunk-DYOUJERF.js.map} +0 -0
- /package/dist/{chunk-TEKML2NW.js.map → chunk-E34YYDCE.js.map} +0 -0
- /package/dist/{chunk-RUJS2NOA.js.map → chunk-E3FMS5DA.js.map} +0 -0
- /package/dist/{chunk-62QMJYML.js.map → chunk-EIRGJD3Q.js.map} +0 -0
- /package/dist/{chunk-DNWP5DL6.js.map → chunk-FESQ5TXU.js.map} +0 -0
- /package/dist/{chunk-UPDIBQUC.js.map → chunk-FEUKUZRA.js.map} +0 -0
- /package/dist/{chunk-ILEJXJH2.js.map → chunk-G3MEYGXC.js.map} +0 -0
- /package/dist/{chunk-XZWBLUDV.js.map → chunk-G3MN4HIX.js.map} +0 -0
- /package/dist/{chunk-364TCROV.js.map → chunk-G53CUQZV.js.map} +0 -0
- /package/dist/{chunk-CREEY2FS.js.map → chunk-GPZVYXJZ.js.map} +0 -0
- /package/dist/{chunk-FBG3JDET.js.map → chunk-GYMZCJX6.js.map} +0 -0
- /package/dist/{chunk-XJHUSJY6.js.map → chunk-HGHVNUJT.js.map} +0 -0
- /package/dist/{chunk-BN4TDL5L.js.map → chunk-IQWFJEA3.js.map} +0 -0
- /package/dist/{chunk-44ZRCSR7.js.map → chunk-IZABTTW5.js.map} +0 -0
- /package/dist/{chunk-DW3OPKXI.js.map → chunk-J3HA4RFY.js.map} +0 -0
- /package/dist/{chunk-V62ZWGCL.js.map → chunk-JGOYO7I2.js.map} +0 -0
- /package/dist/{chunk-LURM3KKS.js.map → chunk-JNSRQQDP.js.map} +0 -0
- /package/dist/{chunk-CSCHS3JG.js.map → chunk-JUF6Q5X7.js.map} +0 -0
- /package/dist/{chunk-OYNBUT5X.js.map → chunk-KAAYVKBH.js.map} +0 -0
- /package/dist/{chunk-MHH7SGLS.js.map → chunk-KGAI4E2I.js.map} +0 -0
- /package/dist/{chunk-PGBZ73UZ.js.map → chunk-KUM36NSV.js.map} +0 -0
- /package/dist/{chunk-SWNCS2OD.js.map → chunk-L763CNKH.js.map} +0 -0
- /package/dist/{chunk-4VXQAJRU.js.map → chunk-LO2MZJJP.js.map} +0 -0
- /package/dist/{chunk-HPDGVK6R.js.map → chunk-LV7EU6HM.js.map} +0 -0
- /package/dist/{chunk-QNLPZOHV.js.map → chunk-LXZ5E6AC.js.map} +0 -0
- /package/dist/{chunk-KRQ2AXFW.js.map → chunk-LZRZVIEJ.js.map} +0 -0
- /package/dist/{chunk-GEFZVG4P.js.map → chunk-MCKYNFPH.js.map} +0 -0
- /package/dist/{chunk-GDQJG4BO.js.map → chunk-MHSVWQK6.js.map} +0 -0
- /package/dist/{chunk-S6VFDNSQ.js.map → chunk-MTV2RSGY.js.map} +0 -0
- /package/dist/{chunk-WW6JLISJ.js.map → chunk-MUEJVDHI.js.map} +0 -0
- /package/dist/{chunk-3H5MJOG2.js.map → chunk-N4BK6OKX.js.map} +0 -0
- /package/dist/{chunk-AXTOIHH2.js.map → chunk-NCO5NGBN.js.map} +0 -0
- /package/dist/{chunk-X3HPRECW.js.map → chunk-NLW25WW3.js.map} +0 -0
- /package/dist/{chunk-C5UFKDAX.js.map → chunk-NP3FPCPN.js.map} +0 -0
- /package/dist/{chunk-TKDOVFO6.js.map → chunk-NYAFSC5V.js.map} +0 -0
- /package/dist/{chunk-AFQF6ISC.js.map → chunk-O7AMKMII.js.map} +0 -0
- /package/dist/{chunk-WPSLL3S2.js.map → chunk-OAXQPLTG.js.map} +0 -0
- /package/dist/{chunk-R5GGTLYE.js.map → chunk-OI2CKYAQ.js.map} +0 -0
- /package/dist/{chunk-7HH4F2KX.js.map → chunk-OL3QHART.js.map} +0 -0
- /package/dist/{chunk-QJ5TU5J6.js.map → chunk-OXYWSVOJ.js.map} +0 -0
- /package/dist/{chunk-NY5VYGTP.js.map → chunk-PHZOMTI6.js.map} +0 -0
- /package/dist/{chunk-KG7FPYM2.js.map → chunk-PYWIHAVD.js.map} +0 -0
- /package/dist/{chunk-3KMYOPBI.js.map → chunk-QPPQXU3U.js.map} +0 -0
- /package/dist/{chunk-TTKDFRON.js.map → chunk-QTKNS2U2.js.map} +0 -0
- /package/dist/{chunk-SJAUMPL3.js.map → chunk-QTLIXCVN.js.map} +0 -0
- /package/dist/{chunk-VCUXAPLM.js.map → chunk-QUYDMAQN.js.map} +0 -0
- /package/dist/{chunk-O37YK4P6.js.map → chunk-R5LRBDEM.js.map} +0 -0
- /package/dist/{chunk-UBDY5RE4.js.map → chunk-RIA5RXPL.js.map} +0 -0
- /package/dist/{chunk-MZPS46OR.js.map → chunk-SIKCVWM3.js.map} +0 -0
- /package/dist/{chunk-ZVXKWLLE.js.map → chunk-SVNH6P7O.js.map} +0 -0
- /package/dist/{chunk-GXPZJ2QN.js.map → chunk-T65Y7N7H.js.map} +0 -0
- /package/dist/{chunk-HAJYFRXL.js.map → chunk-T75WL56Z.js.map} +0 -0
- /package/dist/{chunk-U2BPZ27S.js.map → chunk-TGCDXZ5X.js.map} +0 -0
- /package/dist/{chunk-SPBNAGIN.js.map → chunk-TOUF5ME6.js.map} +0 -0
- /package/dist/{chunk-ERRTBCDW.js.map → chunk-TWCS6FSC.js.map} +0 -0
- /package/dist/{chunk-L5IYVZM2.js.map → chunk-ULW4EWAA.js.map} +0 -0
- /package/dist/{chunk-YUCGCJKT.js.map → chunk-UPXPBA4W.js.map} +0 -0
- /package/dist/{chunk-SG2TDQEE.js.map → chunk-URMAEVZO.js.map} +0 -0
- /package/dist/{chunk-ZBUIWVF3.js.map → chunk-UUWUJ64R.js.map} +0 -0
- /package/dist/{chunk-4ULRDQVD.js.map → chunk-VCOIFNYH.js.map} +0 -0
- /package/dist/{chunk-SEC6FPWC.js.map → chunk-VGUGFRWF.js.map} +0 -0
- /package/dist/{chunk-52IYZCRS.js.map → chunk-VPF5A7CM.js.map} +0 -0
- /package/dist/{chunk-WWLZ5RRU.js.map → chunk-WEQZ563U.js.map} +0 -0
- /package/dist/{chunk-XRSRHAEU.js.map → chunk-WUCTGDV7.js.map} +0 -0
- /package/dist/{chunk-2SGREP24.js.map → chunk-XAW5GL6B.js.map} +0 -0
- /package/dist/{chunk-T6PTG6VM.js.map → chunk-XCRYRVKK.js.map} +0 -0
- /package/dist/{chunk-ZFJ2FQUH.js.map → chunk-XJ5TX772.js.map} +0 -0
- /package/dist/{chunk-T37PAZT2.js.map → chunk-XPIBSDG4.js.map} +0 -0
- /package/dist/{chunk-7O4HFODK.js.map → chunk-XRNJRQ6Q.js.map} +0 -0
- /package/dist/{chunk-PN72Z2W2.js.map → chunk-Y5GQO6CR.js.map} +0 -0
- /package/dist/{chunk-TRMZQRVV.js.map → chunk-Y6MLSN6W.js.map} +0 -0
- /package/dist/{chunk-EZBZU6N7.js.map → chunk-YBFZJ5EB.js.map} +0 -0
- /package/dist/{chunk-EHIISZYD.js.map → chunk-YJYKSMLF.js.map} +0 -0
- /package/dist/{chunk-ECJIMIEJ.js.map → chunk-YR3OPPUE.js.map} +0 -0
- /package/dist/{chunk-34FVKJS2.js.map → chunk-YXQFCQX2.js.map} +0 -0
- /package/dist/{chunk-DJWEQDBB.js.map → chunk-Z3Y67AH6.js.map} +0 -0
- /package/dist/{chunk-2MXDSPUO.js.map → chunk-Z6T6VDDA.js.map} +0 -0
- /package/dist/{chunk-GT77XMOG.js.map → chunk-ZKRRYVDG.js.map} +0 -0
- /package/dist/{chunk-XPDUBDPL.js.map → chunk-ZOH672S6.js.map} +0 -0
- /package/dist/{claim-NRNO4XCO.js.map → claim-DWGPEVJN.js.map} +0 -0
- /package/dist/{client-463NKLRT.js.map → client-YUVT3RZN.js.map} +0 -0
- /package/dist/{code-R4JOQ27J.js.map → code-LOOWLRUL.js.map} +0 -0
- /package/dist/{companies-4TOBU44J.js.map → companies-3VT7OJAA.js.map} +0 -0
- /package/dist/{company-RK34S3IA.js.map → company-XEPW45AT.js.map} +0 -0
- /package/dist/{complete-7BNBQ5AI.js.map → complete-AEX34ICU.js.map} +0 -0
- /package/dist/{config-GDLHHBJZ.js.map → config-AOF6ACIP.js.map} +0 -0
- /package/dist/{connect-CRIRSXN3.js.map → connect-TF4FCXDV.js.map} +0 -0
- /package/dist/{content-FCO6MGXW.js.map → content-NCW5IJFR.js.map} +0 -0
- /package/dist/{conversation-4CQG2B2C.js.map → conversation-6WWZMPAB.js.map} +0 -0
- /package/dist/{conversion-report-PDTQTRVB.js.map → conversion-report-I6R2FDCD.js.map} +0 -0
- /package/dist/{conversion-upload-command-MEO4WLZH.js.map → conversion-upload-command-QD6MGLY4.js.map} +0 -0
- /package/dist/{conversion-writes-ZVBOXUIA.js.map → conversion-writes-H2JOAORW.js.map} +0 -0
- /package/dist/{conversions-POBKTXQF.js.map → conversions-D46PQRWF.js.map} +0 -0
- /package/dist/{conversions-BND5HYTL.js.map → conversions-WGW43FUE.js.map} +0 -0
- /package/dist/{copy-writes-EUFEVWDW.js.map → copy-writes-ONVSSBLJ.js.map} +0 -0
- /package/dist/{countries-TKL5T5JL.js.map → countries-Q6TA42P7.js.map} +0 -0
- /package/dist/{create-BJ7XBNY5.js.map → create-7WV7XWZV.js.map} +0 -0
- /package/dist/{create-XN4KVB5U.js.map → create-OUZZLPQK.js.map} +0 -0
- /package/dist/{create-PYP3QWTL.js.map → create-QRT6O5PN.js.map} +0 -0
- /package/dist/{create-YSGBH6Q4.js.map → create-WSEYNFTP.js.map} +0 -0
- /package/dist/{creatives-57XIJAEG.js.map → creatives-BSZY7VDQ.js.map} +0 -0
- /package/dist/{creatives-ANTJUTIE.js.map → creatives-DBDFDHX7.js.map} +0 -0
- /package/dist/{creatives-6VJDUHEY.js.map → creatives-S3EZCXUT.js.map} +0 -0
- /package/dist/{credentials-KIH6ICDU.js.map → credentials-P7GQYIE3.js.map} +0 -0
- /package/dist/{critique-MZUTDK4V.js.map → critique-6F4FWQN5.js.map} +0 -0
- /package/dist/{critique-GWRXVXVG.js.map → critique-X2YDOMON.js.map} +0 -0
- /package/dist/{crm-Y5QTZAHO.js.map → crm-O6YG6777.js.map} +0 -0
- /package/dist/{crm-QSHUYXTW.js.map → crm-VNAUSVC5.js.map} +0 -0
- /package/dist/{crop-WKTW3EMP.js.map → crop-RDP7YCNV.js.map} +0 -0
- /package/dist/{currency-PTOI5SPU.js.map → currency-UVT3HEZT.js.map} +0 -0
- /package/dist/{custom-conversions-NDY5RHSM.js.map → custom-conversions-7MZFTHUM.js.map} +0 -0
- /package/dist/{customers-2G32E6W7.js.map → customers-VJ3TXILQ.js.map} +0 -0
- /package/dist/{decide-X2UAKYXK.js.map → decide-OPCCKAIT.js.map} +0 -0
- /package/dist/{delete-3H6YH4YK.js.map → delete-3H377GOM.js.map} +0 -0
- /package/dist/{delete-HIAZHA56.js.map → delete-EH3XL26Z.js.map} +0 -0
- /package/dist/{delete-2ZTMTKYD.js.map → delete-GKQTDOZF.js.map} +0 -0
- /package/dist/{delete-I43JQH2E.js.map → delete-QYSOAVP4.js.map} +0 -0
- /package/dist/{delete-RF44ILYE.js.map → delete-R3LXCKA4.js.map} +0 -0
- /package/dist/{demographics-2UYQW6II.js.map → demographics-GKJZ5PV2.js.map} +0 -0
- /package/dist/{describe-M6DYXNQC.js.map → describe-537PPL7P.js.map} +0 -0
- /package/dist/{describe-OQ6R3EF7.js.map → describe-GIG46DT5.js.map} +0 -0
- /package/dist/{dimensions-DGYM5E5P.js.map → dimensions-UXK7DMTF.js.map} +0 -0
- /package/dist/{discard-NKPQ73UM.js.map → discard-46RALLBO.js.map} +0 -0
- /package/dist/{discover-YKMBVSPF.js.map → discover-C4TG7JP7.js.map} +0 -0
- /package/dist/{discover-XLIH7RCB.js.map → discover-MKFDG6NK.js.map} +0 -0
- /package/dist/{domain-LUDUZB3F.js.map → domain-JNNWJNQE.js.map} +0 -0
- /package/dist/{download-LL6DL62N.js.map → download-3R5IHN5F.js.map} +0 -0
- /package/dist/{download-SFWMT7DL.js.map → download-PRBLR6IQ.js.map} +0 -0
- /package/dist/{draft-7LPUJZCF.js.map → draft-3L4SNDGO.js.map} +0 -0
- /package/dist/{draft-T7TWIFEX.js.map → draft-EADHX7XL.js.map} +0 -0
- /package/dist/{draft-G432FJ7N.js.map → draft-H5RVDTFD.js.map} +0 -0
- /package/dist/{draft-XAAIGE6Q.js.map → draft-TAM7IUPH.js.map} +0 -0
- /package/dist/{draft-R5ND5SWT.js.map → draft-UMPCOCP6.js.map} +0 -0
- /package/dist/{draft-MPWR47CG.js.map → draft-VSXBSXSX.js.map} +0 -0
- /package/dist/{draft-736FJJWK.js.map → draft-XCYSZWA6.js.map} +0 -0
- /package/dist/{draft-374Z4MGY.js.map → draft-XEUHTUMR.js.map} +0 -0
- /package/dist/{env-DQHY5ODN.js.map → env-VBSATLEF.js.map} +0 -0
- /package/dist/{experiment-MO6MT6OJ.js.map → experiment-2XR6MBE2.js.map} +0 -0
- /package/dist/{experiments-OGZV73W6.js.map → experiments-JVGAKWFA.js.map} +0 -0
- /package/dist/{export-6Z6QBU6V.js.map → export-YCLJG5YP.js.map} +0 -0
- /package/dist/{extract-YGOQBOQK.js.map → extract-E3CMEN5U.js.map} +0 -0
- /package/dist/{facets-OLZ7JLFL.js.map → facets-JG44XXAT.js.map} +0 -0
- /package/dist/{favorites-R3JO4SJJ.js.map → favorites-NSQX6HKB.js.map} +0 -0
- /package/dist/{feed-IUMMHM3I.js.map → feed-TKMMYAEH.js.map} +0 -0
- /package/dist/{fetch-AL44XS4Q.js.map → fetch-EHP2FK6Y.js.map} +0 -0
- /package/dist/{fetch-K3NRT2L2.js.map → fetch-SLDDORH4.js.map} +0 -0
- /package/dist/{find-ZFIGMRYQ.js.map → find-I7U3THF3.js.map} +0 -0
- /package/dist/{fit-5NVXWXZV.js.map → fit-GNQHRKP7.js.map} +0 -0
- /package/dist/{flows-LL5SPPIK.js.map → flows-NRPABVUJ.js.map} +0 -0
- /package/dist/{follow-SS374QUW.js.map → follow-A46RAJEX.js.map} +0 -0
- /package/dist/{follow-competitors-3LTOTTBY.js.map → follow-competitors-VU2L3KWF.js.map} +0 -0
- /package/dist/{following-YMA5O3LF.js.map → following-UOUNSU6P.js.map} +0 -0
- /package/dist/{fonts-E3CNWPD5.js.map → fonts-VN2QXPAQ.js.map} +0 -0
- /package/dist/{forecast-PWGN4ETP.js.map → forecast-SIX6AAVX.js.map} +0 -0
- /package/dist/{forecast-KOBF5TKM.js.map → forecast-ZXOSLITM.js.map} +0 -0
- /package/dist/{funding-KLIZ73SS.js.map → funding-2VROIMLS.js.map} +0 -0
- /package/dist/{funnel-XIZROHV7.js.map → funnel-QEZWKSFR.js.map} +0 -0
- /package/dist/{ga4-XPCE4EK5.js.map → ga4-ULHKTF23.js.map} +0 -0
- /package/dist/{generate-GHIXVLMY.js.map → generate-HOMLLUCN.js.map} +0 -0
- /package/dist/{get-HCGFATFD.js.map → get-ABQZJ2VQ.js.map} +0 -0
- /package/dist/{get-XPJ4BZGP.js.map → get-BXMLPLIC.js.map} +0 -0
- /package/dist/{get-RDTJSWSA.js.map → get-IF7KHMSI.js.map} +0 -0
- /package/dist/{get-WS744HAO.js.map → get-NF3SPPVX.js.map} +0 -0
- /package/dist/{get-SGNT4JG2.js.map → get-ZISAHMTQ.js.map} +0 -0
- /package/dist/{gif-YK5HJXRE.js.map → gif-QLNWBFAH.js.map} +0 -0
- /package/dist/{google-BI45CXMW.js.map → google-FDR55RRD.js.map} +0 -0
- /package/dist/{google-5JV7OMOH.js.map → google-XVSL3XAB.js.map} +0 -0
- /package/dist/{google-ads-DYZGUM6W.js.map → google-ads-5NBAMFPB.js.map} +0 -0
- /package/dist/{group-7OWIYAKJ.js.map → group-HAQM6P7M.js.map} +0 -0
- /package/dist/{group-H6ZYRPE6.js.map → group-XVDH2ONO.js.map} +0 -0
- /package/dist/{gsc-HI2KXDEU.js.map → gsc-72AFO6B4.js.map} +0 -0
- /package/dist/{history-RD2YMNNL.js.map → history-2U5OXDV7.js.map} +0 -0
- /package/dist/{history-3EQQHYKT.js.map → history-A6KMJRPZ.js.map} +0 -0
- /package/dist/{history-SQPJ7PPE.js.map → history-IDVWUSYU.js.map} +0 -0
- /package/dist/{hubspot-MYTV36SM.js.map → hubspot-YPBNNVHC.js.map} +0 -0
- /package/dist/{icon-HLJCWTR3.js.map → icon-F7AOOTFI.js.map} +0 -0
- /package/dist/{ideas-CVXHFVX7.js.map → ideas-4Q7YBUGC.js.map} +0 -0
- /package/dist/{images-XP4TKE2F.js.map → images-BRBSRYEX.js.map} +0 -0
- /package/dist/{improve-BRC4R6MW.js.map → improve-LIKOER3S.js.map} +0 -0
- /package/dist/{ingest-4GNJ2PWL.js.map → ingest-AIOFOAQE.js.map} +0 -0
- /package/dist/{insights-IVW6W5CP.js.map → insights-QNE6XCBA.js.map} +0 -0
- /package/dist/{insights-CN3GUTT7.js.map → insights-TR5EQAMA.js.map} +0 -0
- /package/dist/{inspect-25IVRU45.js.map → inspect-ITKB2QT3.js.map} +0 -0
- /package/dist/{inspiration-D75DO3MD.js.map → inspiration-VXNGKAJV.js.map} +0 -0
- /package/dist/{instant-experiences-6F6GXZ67.js.map → instant-experiences-MT2XMQNH.js.map} +0 -0
- /package/dist/{intent-3GDLPKKN.js.map → intent-E6HKRMNE.js.map} +0 -0
- /package/dist/{job-2JJNKUHT.js.map → job-TS34W4IU.js.map} +0 -0
- /package/dist/{job-create-BNTNZCSP.js.map → job-create-FXXDR2EE.js.map} +0 -0
- /package/dist/{job-status-N7RWRDRO.js.map → job-status-R2H4HNC5.js.map} +0 -0
- /package/dist/{keep-Z2WH3CKU.js.map → keep-YSU3XMW3.js.map} +0 -0
- /package/dist/{keyword-gap-B2WPVHOB.js.map → keyword-gap-D4WAEJAH.js.map} +0 -0
- /package/dist/{keyword-metrics-UDGWN7BO.js.map → keyword-metrics-4UDT5GNW.js.map} +0 -0
- /package/dist/{keywords-for-site-GEG6AXD3.js.map → keywords-for-site-YQAQQIHJ.js.map} +0 -0
- /package/dist/{knowledge-PKXPN4RV.js.map → knowledge-L3VLOVLG.js.map} +0 -0
- /package/dist/{landing-O2ZUIUGE.js.map → landing-6JAIZH4H.js.map} +0 -0
- /package/dist/{landings-7QRITXZ2.js.map → landings-XTPNPTHN.js.map} +0 -0
- /package/dist/{languages-UJAOPTV2.js.map → languages-AUAZIVL4.js.map} +0 -0
- /package/dist/{languages-RZLMZR57.js.map → languages-DIKRMAYE.js.map} +0 -0
- /package/dist/{launches-4H6ANGTG.js.map → launches-5R7EUONQ.js.map} +0 -0
- /package/dist/{layerize-P5LFIA4X.js.map → layerize-Q2QWDARG.js.map} +0 -0
- /package/dist/{lead-routes-WVXWVG62.js.map → lead-routes-IXUCGINI.js.map} +0 -0
- /package/dist/{leads-MTTOYNPM.js.map → leads-6XZRTPJL.js.map} +0 -0
- /package/dist/{leads-CJKRKB2Q.js.map → leads-UVG6VYAC.js.map} +0 -0
- /package/dist/{learn-QPXZZIZZ.js.map → learn-VQGATNB4.js.map} +0 -0
- /package/dist/{library-VW27X75P.js.map → library-G5YAFLTR.js.map} +0 -0
- /package/dist/{lighthouse-FGUFJRGR.js.map → lighthouse-BCBV2XGP.js.map} +0 -0
- /package/dist/{line-item-writes-RVOAMJ5R.js.map → line-item-writes-TRTDQ55N.js.map} +0 -0
- /package/dist/{line-items-POZRAJLC.js.map → line-items-SC73GQLQ.js.map} +0 -0
- /package/dist/{link-IXEZKRM7.js.map → link-ODLNZTZC.js.map} +0 -0
- /package/dist/{linkedin-5PYG5HEM.js.map → linkedin-HPZP4MGS.js.map} +0 -0
- /package/dist/{linkedin-person-EMJXEZYR.js.map → linkedin-person-ELEPEST5.js.map} +0 -0
- /package/dist/{list-XOYU7UTX.js.map → list-26EOYW37.js.map} +0 -0
- /package/dist/{list-7GDMM26I.js.map → list-4SDJZVOL.js.map} +0 -0
- /package/dist/{list-UG4V5AM2.js.map → list-6YW4I4VG.js.map} +0 -0
- /package/dist/{list-OZCU2T22.js.map → list-GLN62MRB.js.map} +0 -0
- /package/dist/{list-PTK2HOUY.js.map → list-GS42LK5C.js.map} +0 -0
- /package/dist/{list-Q5LVTPQP.js.map → list-HWNHRWGB.js.map} +0 -0
- /package/dist/{list-J5KWXHFO.js.map → list-QSBEYU45.js.map} +0 -0
- /package/dist/{list-4KS7WSUG.js.map → list-YLPOXOCI.js.map} +0 -0
- /package/dist/{list-DVVOP6FM.js.map → list-ZFGOONWL.js.map} +0 -0
- /package/dist/{locations-VJX64ZZR.js.map → locations-D5N75BUK.js.map} +0 -0
- /package/dist/{locations-EISZ6JOT.js.map → locations-P5PTCRSF.js.map} +0 -0
- /package/dist/{log-2F2N24DT.js.map → log-66XLWNCD.js.map} +0 -0
- /package/dist/{logo-H2KHGLYD.js.map → logo-ABO4HJRG.js.map} +0 -0
- /package/dist/{lookup-K57ITJWF.js.map → lookup-SPNT3W3W.js.map} +0 -0
- /package/dist/{map-QGJZIC5N.js.map → map-3SGKGWSY.js.map} +0 -0
- /package/dist/{mcp-RSW7KAWP.js.map → mcp-ZSPJE3Y6.js.map} +0 -0
- /package/dist/{media-K5RJXLTN.js.map → media-CIJW2Q3I.js.map} +0 -0
- /package/dist/{media-HDHZULQ7.js.map → media-GZKW2PZB.js.map} +0 -0
- /package/dist/{media-sources-7R7FO53Y.js.map → media-sources-UBQCVRGK.js.map} +0 -0
- /package/dist/{members-B6TKGGT5.js.map → members-76XFDSMX.js.map} +0 -0
- /package/dist/{meme-QMCUGXUE.js.map → meme-BPWX7YQH.js.map} +0 -0
- /package/dist/{meta-MOSJVYIE.js.map → meta-KVOSCSPJ.js.map} +0 -0
- /package/dist/{metrics-PRIKXVYZ.js.map → metrics-XCD3IJSM.js.map} +0 -0
- /package/dist/{models-M3E4YFCT.js.map → models-WNK7Z6TR.js.map} +0 -0
- /package/dist/{normalize-5QIGANTK.js.map → normalize-NMNOJ6Q5.js.map} +0 -0
- /package/dist/{normalize-5B4EQLUX.js.map → normalize-VC7HUODA.js.map} +0 -0
- /package/dist/{options-K33CJOR6.js.map → options-5BPPM5N3.js.map} +0 -0
- /package/dist/{organization-A4NFWWWI.js.map → organization-PXND43LQ.js.map} +0 -0
- /package/dist/{output-U5ZV6PST.js.map → output-34QMC3OU.js.map} +0 -0
- /package/dist/{page-XVOUD4VV.js.map → page-UDF3LJHP.js.map} +0 -0
- /package/dist/{page-photos-4JTIKXAW.js.map → page-photos-FCBW5UZS.js.map} +0 -0
- /package/dist/{pages-BAUS7LQM.js.map → pages-5W5G4MRB.js.map} +0 -0
- /package/dist/{performance-MHJDRLEK.js.map → performance-DDZOJ5GD.js.map} +0 -0
- /package/dist/{performance-NVURSEZ6.js.map → performance-Q25RDNM6.js.map} +0 -0
- /package/dist/{pinterest-NA6HGPMB.js.map → pinterest-IABDXLF5.js.map} +0 -0
- /package/dist/{pixels-QOSEYXCP.js.map → pixels-4QAWLSEL.js.map} +0 -0
- /package/dist/{pixels-THDQD3RF.js.map → pixels-KRK2B7M3.js.map} +0 -0
- /package/dist/{plan-JYSHKPZQ.js.map → plan-I6EFL7RC.js.map} +0 -0
- /package/dist/{posts-ILAFADBW.js.map → posts-SXQSLOFV.js.map} +0 -0
- /package/dist/{preview-X6EJGPAY.js.map → preview-7Y5LE24E.js.map} +0 -0
- /package/dist/{profile-YHI65VGK.js.map → profile-R5VPOOJU.js.map} +0 -0
- /package/dist/{promoted-tweet-writes-MXXVRLVQ.js.map → promoted-tweet-writes-LIFJFF7N.js.map} +0 -0
- /package/dist/{promoted-tweets-HFLGXWX2.js.map → promoted-tweets-H5RMRQD2.js.map} +0 -0
- /package/dist/{properties-ZLY6NYVK.js.map → properties-2D2BIDGC.js.map} +0 -0
- /package/dist/{publish-6ZXFUBGP.js.map → publish-LBHYEZW3.js.map} +0 -0
- /package/dist/{query-WMEX73ZB.js.map → query-A53T6QJF.js.map} +0 -0
- /package/dist/{query-HFHTLNDN.js.map → query-LB5H7IRK.js.map} +0 -0
- /package/dist/{query-ELD7WSFR.js.map → query-NDOYOIHL.js.map} +0 -0
- /package/dist/{questionnaire-Y37I64FO.js.map → questionnaire-U767HYDE.js.map} +0 -0
- /package/dist/{read-2HQEZIJW.js.map → read-3TCDDALC.js.map} +0 -0
- /package/dist/{reddit-BIHGJPGP.js.map → reddit-H4R23K27.js.map} +0 -0
- /package/dist/{refresh-4O32S4YR.js.map → refresh-3QKUSERK.js.map} +0 -0
- /package/dist/{refresh-LVV4SPLT.js.map → refresh-GIB6QQZS.js.map} +0 -0
- /package/dist/{release-VIPNSPQ5.js.map → release-JMYTQZLK.js.map} +0 -0
- /package/dist/{relevant-pages-B5SYN575.js.map → relevant-pages-DOCKQEMZ.js.map} +0 -0
- /package/dist/{remove-2E77743U.js.map → remove-F7GEZMKB.js.map} +0 -0
- /package/dist/{remove-TPOWWFZ6.js.map → remove-LZQHDFZF.js.map} +0 -0
- /package/dist/{reopen-UOBTJBMQ.js.map → reopen-Y557X6IX.js.map} +0 -0
- /package/dist/{research-FOJIDMSE.js.map → research-3OJ5UZER.js.map} +0 -0
- /package/dist/{research-ELM3KHGE.js.map → research-AYO522XS.js.map} +0 -0
- /package/dist/{reset-FTLWUFZK.js.map → reset-BL7M4LL7.js.map} +0 -0
- /package/dist/{reset-GIXXLPHQ.js.map → reset-PMVUQTYU.js.map} +0 -0
- /package/dist/{resolve-QHR5JJTJ.js.map → resolve-CSWSGGK6.js.map} +0 -0
- /package/dist/{retry-HNWXJR5U.js.map → retry-MVOPE2O2.js.map} +0 -0
- /package/dist/{retry-NY5KFEDA.js.map → retry-WT46B5SC.js.map} +0 -0
- /package/dist/{retry-failed-OAH7JQKD.js.map → retry-failed-PEAUXGNT.js.map} +0 -0
- /package/dist/{revenue-JFMUODJO.js.map → revenue-ZLE645Z5.js.map} +0 -0
- /package/dist/{rule-writes-A4BFYHPA.js.map → rule-writes-G25O5JZS.js.map} +0 -0
- /package/dist/{rules-HLREXY2M.js.map → rules-KSOAKEI3.js.map} +0 -0
- /package/dist/{rules-56E55SGC.js.map → rules-Q6HWHFVU.js.map} +0 -0
- /package/dist/{rules-add-ZOPOWJMY.js.map → rules-add-7EPXWSQV.js.map} +0 -0
- /package/dist/{run-GACZDI6Q.js.map → run-4DE5XUVB.js.map} +0 -0
- /package/dist/{run-4UIPMCSN.js.map → run-PAND6N4V.js.map} +0 -0
- /package/dist/{schedule-ZATNBBWD.js.map → schedule-CSE2XFFF.js.map} +0 -0
- /package/dist/{schedule-OFPSZVZ2.js.map → schedule-TNF6M6UD.js.map} +0 -0
- /package/dist/{scheduled-agents-4VY4CAA2.js.map → scheduled-agents-NXHXQZBO.js.map} +0 -0
- /package/dist/{schema-EYGPETLF.js.map → schema-2YQAQVON.js.map} +0 -0
- /package/dist/{schema-OGP4DUPP.js.map → schema-QITMY7ZE.js.map} +0 -0
- /package/dist/{scrape-ZHL2BHS7.js.map → scrape-FDBYU3TU.js.map} +0 -0
- /package/dist/{screenshot-ADMRDYWN.js.map → screenshot-QSRWL4J6.js.map} +0 -0
- /package/dist/{search-CQUS7EOM.js.map → search-BOCQFUM3.js.map} +0 -0
- /package/dist/{search-MKVVMJ2Q.js.map → search-CENPR7GA.js.map} +0 -0
- /package/dist/{search-HF5ECIYW.js.map → search-GEXDRTAQ.js.map} +0 -0
- /package/dist/{search-QUF6LHQ5.js.map → search-HOYOSX2H.js.map} +0 -0
- /package/dist/{search-6W4HXR2S.js.map → search-LFTFNDMC.js.map} +0 -0
- /package/dist/{search-6ZWI2NML.js.map → search-PYLNVZXI.js.map} +0 -0
- /package/dist/{search-copy-O6FDX4HT.js.map → search-copy-RLRRR3LB.js.map} +0 -0
- /package/dist/{seeds-5TM3O3K3.js.map → seeds-E2GLHJ2T.js.map} +0 -0
- /package/dist/{sends-MZKHZZGJ.js.map → sends-NBTGBZT7.js.map} +0 -0
- /package/dist/{sequences-3CEVHGHB.js.map → sequences-UOIHUOD3.js.map} +0 -0
- /package/dist/{setup-links-4STQ5B4P.js.map → setup-links-HQ6WVKEP.js.map} +0 -0
- /package/dist/{shared-I3SB77VH.js.map → shared-IMDHTVSW.js.map} +0 -0
- /package/dist/{shopify-7LDHCWUQ.js.map → shopify-6MLRXSC2.js.map} +0 -0
- /package/dist/{site-I3NFMPJB.js.map → site-5B44TV46.js.map} +0 -0
- /package/dist/{sitemaps-PLAWVXQL.js.map → sitemaps-6A6JFBV4.js.map} +0 -0
- /package/dist/{sites-WX2IBTZT.js.map → sites-PZLE5FFV.js.map} +0 -0
- /package/dist/{skills-O6EQOAMQ.js.map → skills-FBIVWINH.js.map} +0 -0
- /package/dist/{sources-K2LILGTW.js.map → sources-OMINR6RG.js.map} +0 -0
- /package/dist/{sources-ZM7LEIMM.js.map → sources-PNEWSEBG.js.map} +0 -0
- /package/dist/{stats-QQRYOMZA.js.map → stats-2NLNQBRY.js.map} +0 -0
- /package/dist/{status-5OMVGFCH.js.map → status-QNXQNAKH.js.map} +0 -0
- /package/dist/{sticker-654HS3K2.js.map → sticker-4NKFAGEK.js.map} +0 -0
- /package/dist/{stock-35LOO3YN.js.map → stock-XOXZGGU3.js.map} +0 -0
- /package/dist/{studies-IGOCWM7F.js.map → studies-C5IINK5Y.js.map} +0 -0
- /package/dist/{studio-3D42TUJX.js.map → studio-BNYFU6ZH.js.map} +0 -0
- /package/dist/{study-writes-Z5P2W7JH.js.map → study-writes-GJXLMM3D.js.map} +0 -0
- /package/dist/{suggest-JASHCOL5.js.map → suggest-Z553OSYW.js.map} +0 -0
- /package/dist/{sync-URIRLHTS.js.map → sync-CIRDY55O.js.map} +0 -0
- /package/dist/{sync-RCDODSOD.js.map → sync-OYOS7HQL.js.map} +0 -0
- /package/dist/{sync-6AN67IX3.js.map → sync-UBOHNOXB.js.map} +0 -0
- /package/dist/{sync-definition-MZUJOJYI.js.map → sync-definition-2VEFGHYK.js.map} +0 -0
- /package/dist/{tag-7YMFAZQQ.js.map → tag-22TFBGDG.js.map} +0 -0
- /package/dist/{tag-manager-LU4GAZ6R.js.map → tag-manager-QLZHU6NG.js.map} +0 -0
- /package/dist/{tags-KSMLT4G2.js.map → tags-56H6O7ZL.js.map} +0 -0
- /package/dist/{tags-6A7QOYBI.js.map → tags-CYR2IPEJ.js.map} +0 -0
- /package/dist/{tags-JHT3Q6VO.js.map → tags-RBUYBAA6.js.map} +0 -0
- /package/dist/{tags-OU32R2SH.js.map → tags-WVJNOATS.js.map} +0 -0
- /package/dist/{tags-MTVZJHCE.js.map → tags-ZTVOZOYP.js.map} +0 -0
- /package/dist/{targeting-7HXKBXWY.js.map → targeting-GNEBULXU.js.map} +0 -0
- /package/dist/{targeting-constants-QIB3UZHM.js.map → targeting-constants-GR6BVM2H.js.map} +0 -0
- /package/dist/{targeting-criteria-NUXZB7NP.js.map → targeting-criteria-EZNZOUAE.js.map} +0 -0
- /package/dist/{targets-LQ7HGI73.js.map → targets-CU7IUPV2.js.map} +0 -0
- /package/dist/{terms-X4OJWTQH.js.map → terms-LG7FYQOG.js.map} +0 -0
- /package/dist/{testimonials-Z2KOOMVH.js.map → testimonials-THJJYQ42.js.map} +0 -0
- /package/dist/{themes-6KVP3COR.js.map → themes-TSEMQ4EJ.js.map} +0 -0
- /package/dist/{top-companies-WWNPUJ23.js.map → top-companies-W6DA3MZQ.js.map} +0 -0
- /package/dist/{transcript-P7HKVABU.js.map → transcript-KZ74PK23.js.map} +0 -0
- /package/dist/{triggers-Z3LV3KJR.js.map → triggers-OJKTDJSV.js.map} +0 -0
- /package/dist/{tweets-X5PTAT6F.js.map → tweets-IF5FFFTH.js.map} +0 -0
- /package/dist/{unfollow-S5LHFLGW.js.map → unfollow-CDUOZWM7.js.map} +0 -0
- /package/dist/{unlink-XTZA474P.js.map → unlink-ZE7464NK.js.map} +0 -0
- /package/dist/{unstage-AVLORZLW.js.map → unstage-OVOZE6DA.js.map} +0 -0
- /package/dist/{unstage-QXOL5DXZ.js.map → unstage-RGIPGM3E.js.map} +0 -0
- /package/dist/{update-MDVZ24VQ.js.map → update-2VYVJCY2.js.map} +0 -0
- /package/dist/{update-UE4XVBKL.js.map → update-63MMKPHI.js.map} +0 -0
- /package/dist/{update-5ZNS2DKP.js.map → update-JHWPEJN7.js.map} +0 -0
- /package/dist/{update-DDKNKV6M.js.map → update-Q3WJ3DQN.js.map} +0 -0
- /package/dist/{update-3NA6ABLW.js.map → update-WHHAH4IE.js.map} +0 -0
- /package/dist/{upload-SYFB2VTJ.js.map → upload-EAEILUQB.js.map} +0 -0
- /package/dist/{upscale-P5EYUVOZ.js.map → upscale-HB6L6SZG.js.map} +0 -0
- /package/dist/{url-options-DJZV3ADK.js.map → url-options-2BGF2D5E.js.map} +0 -0
- /package/dist/{url-params-Y5XQSDEF.js.map → url-params-FBDTXQGY.js.map} +0 -0
- /package/dist/{variant-JQVZUUA4.js.map → variant-O7LXOA2E.js.map} +0 -0
- /package/dist/{videos-YCQVOOFE.js.map → videos-4TLBI3E3.js.map} +0 -0
- /package/dist/{view-IKKRJ5YD.js.map → view-ED636LWD.js.map} +0 -0
- /package/dist/{viewer-check-5GREZIVJ.js.map → viewer-check-ELVSS3DM.js.map} +0 -0
- /package/dist/{web-7TPDDBI6.js.map → web-LDR6HO5M.js.map} +0 -0
- /package/dist/{winners-4PKEVMUC.js.map → winners-ZG5SHNBS.js.map} +0 -0
- /package/dist/{winning-ads-7X5EWSJX.js.map → winning-ads-7SWUVUDA.js.map} +0 -0
- /package/dist/{write-commands-V77MD5SC.js.map → write-commands-24FRMQW4.js.map} +0 -0
- /package/dist/{write-commands-CTLF2M6L.js.map → write-commands-AIWR7NBO.js.map} +0 -0
- /package/dist/{write-commands-FIS6Y2MN.js.map → write-commands-UK6MKGHI.js.map} +0 -0
- /package/dist/{write-commands-CY734U34.js.map → write-commands-W3UN6F4Y.js.map} +0 -0
- /package/dist/{x-EMLFCHSG.js.map → x-UOGRWXET.js.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
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/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/voice-retake.ts","../src/commands/canvas/static-run-review.ts","../src/commands/canvas/glance-check.ts","../src/commands/canvas/logo-review.ts","../src/engine/nodes/local/lib/logo-match.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 plainRunGrowth,\n variantFiles,\n} from \"../../engine/scaffold/static-history.ts\";\nimport type { Canvas } from \"../../engine/schema/canvas.ts\";\nimport {\n isPlateCanvas,\n nodesWithRole,\n regenerateTargets,\n rolesById,\n STATIC_ADAPT_FORMAT_ROLE,\n} 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 lostVital,\n stopsWithoutRepair,\n formatOfSizeNode,\n correctFrom,\n paidFor,\n rendersNewPicture,\n withRelayEdit,\n placedTooFar,\n withDeliveredSizes,\n withExtendedSizes,\n withRelayNote,\n withSizesFollowingFix,\n} from \"./static-autofix.ts\";\nimport {\n fixMemoryOf,\n frameChanges,\n persistingDefects,\n pictureEdit,\n repeatsFailedFix,\n specEditInstruction,\n} 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 { shownBaseline } from \"./shown-anchor.ts\";\nimport { retakenTalkingScenes } from \"./voice-retake.ts\";\nimport { anchorLines, readIdeaAnchor } from \"../../engine/creative-context/anchor.ts\";\nimport {\n oneSizeFix,\n prefilterSpend,\n reviewStaticRun,\n runCostHint,\n sizeShapeOf,\n staticReviewTargets,\n} from \"./static-run-review.ts\";\nimport { repairSpec } from \"./static-spec-repair.ts\";\nimport { readCaseFile } from \"../../engine/creative-context/case-file.ts\";\nimport { heldRules } from \"./rule-gate.ts\";\nimport { rulesDigest } from \"../../engine/creative-rules/select.ts\";\nimport { reviewAgainstRules } from \"../../engine/nodes/local/lib/rules-review.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/**\n * A creative whose sizes are cut from one picture is changed only on top of the version it shows\n * (`growFromVersion`): when that version's graph is not recorded here or in the run history, its\n * picture cannot be found, and nothing is billed.\n */\nfunction refusePlateVersion(runId: string): never {\n const message = `The version of run ${runId} could not be found with the picture its sizes are cut from, so it cannot be changed on top of. Render the creative again (baker canvas run --slug <slug>), then make the change on that version.`;\n process.stderr.write(`${JSON.stringify({ ok: false, error: { code: \"version_not_found\", message } }, null, 2)}\\n`);\n process.exit(2);\n}\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; on one cut from one picture --regenerate format_9x16 sets the 9:16's words again on the picture the last version shows, its --fix correction or chosen variant included; on one laid out again for each size --regenerate adapt_9x16 lays out the 9:16 again from that picture, 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/**\n * What a run should say before it renders, where the person asked for less than it makes: new pictures\n * for an edit that changed more than the words or colours (Prod, Oct 2026: a change of the button became\n * a new layout), and talking takes made again whose voice is the video model's own. Only a first round of\n * a plain run is told; `--fix`, `--regenerate`, `--use-variant` and `--from` say what they make.\n */\nasync function editScopeNotes(input: {\n opts: CanvasRunOptions;\n asEdit: string | null;\n native: boolean;\n shown: Awaited<ReturnType<typeof shownVersion>>;\n promptNow: unknown;\n canvas: unknown;\n canvasRoot: string;\n}): Promise<string[]> {\n const { opts, shown } = input;\n const plain =\n (opts.autoFixRound ?? 0) === 0 &&\n opts.fix === undefined &&\n opts.regenerate === undefined &&\n opts.useVariant === undefined &&\n opts.from === undefined;\n if (!plain || !shown.rendered) return [];\n const notes: string[] = [];\n const changed = !input.native && input.asEdit === null && shown.prompt ? frameChanges(shown.prompt, input.promptNow) : [];\n if (changed.length > 0) {\n notes.push(\n `[scope] this run changes ${changed.join(\", \")} since the version shown: new pictures are made. If the person asked only for words, colours or one element, put the rest back (or use --fix).`,\n );\n }\n const local = { record: async () => null, graph: async () => null };\n const previous = await versionRun(input.canvasRoot, shown.rendered.runId, local);\n for (const clip of previous ? retakenTalkingScenes(previous.canvas, input.canvas) : []) {\n notes.push(\n `[voice] the take ${clip} is said again by the video model: it may not sound like the other takes; listen to it before you show it.`,\n );\n }\n return notes;\n}\n\n/** This process holds its canvas (`markCanvasBusy`): set by the first round, kept by the correction rounds. */\nlet canvasHeld = false;\n\n/** The rule ids a run record names at most (the backend's cap); the digest covers them all. */\nconst RECORDED_RULE_IDS = 100;\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 // The company's rules this creative is held to, read once as they stand now: its corrections, its\n // review and its run record (which names them, so a later rejection is traced to the rules in force).\n const held = creativeSlug ? await heldRules(path.dirname(filePath)) : { rules: [] };\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 // The node one size is made again with is its shape's: read off the canvas as it is on disk.\n const onDisk = await readFile(filePath, \"utf8\")\n .then((text): unknown => JSON.parse(text))\n .catch(() => null);\n const shape = sizeShapeOf(onDisk);\n const refusal = turnRenderRefusal(await readTurnRenders(turnCache), turnId, creativeSlug, { correction, shape });\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 // The idea this run is held to: what the person saw when this turn started. Correction rounds are never held.\n const ideaHeld =\n creativeSlug && (opts.autoFixRound ?? 0) === 0\n ? (\n await shownBaseline({\n canvasRoot,\n slug: creativeSlug,\n creativeDir: path.dirname(filePath),\n turnId,\n shown,\n record: true,\n })\n ).baseline\n : undefined;\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 ...(ideaHeld ? { baseline: ideaHeld } : {}),\n firstRender: creativeSlug !== undefined && !shown.rendered && (opts.autoFixRound ?? 0) === 0,\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 // On one picture a change of the designed words is a plain run (the pictures and the choice kept, the words set again):\n // only a change of the picture's own colours, or of the words lettered in its scene, edits the picture.\n const asEdit =\n !native &&\n opts.fix === undefined &&\n opts.useVariant === undefined && opts.regenerate === undefined && opts.from === undefined && shown.rendered\n ? isPlateCanvas(parsed)\n ? pictureEdit(shown.prompt, promptNow)\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 // Notes for the agent before anything renders, repeated in the run's hints (soft: nothing is refused).\n const runNotes = await editScopeNotes({\n opts,\n asEdit,\n native,\n shown,\n promptNow,\n canvas: parsed,\n canvasRoot,\n });\n for (const note of runNotes) process.stderr.write(`${note}\\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), make just the size at fault again (${oneSizeFix(sizeShapeOf(parsed))}), 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 // What the person rejected in this ad before: a correction never brings it back.\n const rejected = creativeSlug ? await readCaseFile(creativeSlug) : [];\n // And the company's rules, as the renders of a run are told them.\n const { rules } = held;\n grown = await growOn(from, { kind: \"edit\", instruction, promptJson: promptNow, rejected, rules });\n if (!grown && isPlateCanvas(parsed)) refusePlateVersion(from);\n parsed = grown\n ? grown.canvas\n : fixStaticAd(parsed, { instruction, previous, promptJson: promptNow, rejected, rules });\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 && isPlateCanvas(parsed)) refusePlateVersion(from);\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 && !isPlateCanvas(parsed)) {\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 !== null &&\n makesSameVariants(parsed as Canvas, version, await ingestedNow(variantFiles(parsed as Canvas), path.dirname(filePath)));\n // An approved creative made before plates, moved onto one picture because that was asked for, keeps its approved size (`plainRunGrowth`).\n const growth = version\n ? plainRunGrowth(parsed as Canvas, version, {\n sameVariants: same,\n frameChanged: shown.prompt !== undefined && frameChanges(shown.prompt, promptNow).length > 0,\n wordsChanged: shown.prompt !== undefined && specEditInstruction(shown.prompt, promptNow) !== null,\n pictureChanged: shown.prompt !== undefined && pictureEdit(shown.prompt, promptNow) !== null,\n })\n : null;\n grown = version && growth ? growFromVersion(parsed as Canvas, version, growth) : 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 === formatOfSizeNode(parsed, 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) => formatOfSizeNode(parsed, 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 ...(creativeSlug ? { rules: { digest: rulesDigest(held.rules), ids: held.rules.slice(0, RECORDED_RULE_IDS).map((r) => r.id) } } : {}),\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 // The idea this render drew: what the next edit of it keeps (`idea-gate.ts`).\n const idea = await readIdeaAnchor(path.dirname(filePath));\n await recordRendered(canvasRoot, creativeSlug, sourceSha, result.run_id, {\n ...(promptNow ? { prompt: promptNow } : {}),\n ...(idea ? { anchor: idea.anchor, idea: anchorLines(idea.view) } : {}),\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 // The company's rules this video is held to, read as they stand now.\n const videoRules = held.rules;\n const review = reviewable\n ? await reviewRenderedVideo({\n video: reviewable,\n windows: await sceneWindowsBeside(filePath),\n ...(await reviewContextBeside(filePath)),\n rules: videoRules,\n checkStills: (stills, labels) =>\n reviewAgainstRules({ stills, formats: labels, rules: videoRules, onSpend: (usage) => reviewUsage.push(usage) }),\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 reviewHints = 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 make only that size again with \\`--regenerate\\` on its size node).`,\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 hints = [...runNotes, ...reviewHints];\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 // What made the proven ad win, gone from a size: the repair restores it as the concept declares it.\n const lost = [...new Set((base?.review ?? []).filter(lostVital).flatMap((f) => (f.kind?.job ? [f.kind.job] : [])))];\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 rejected: creativeSlug ? await readCaseFile(creativeSlug) : [],\n held,\n ...(lost.length > 0 ? { restore: lost } : {}),\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 // Nothing restored it in the plan: a picture drawn again from it comes back without it, so the run stops here.\n if (step && stopsWithoutRepair(base?.review ?? [], briefFindings, respecced !== null)) {\n process.stdout.write(\n \"[autofix] stopped: what made the proven ad win is gone and no correction of prompt.json may restore it\\n\",\n );\n hints.unshift(\n \"The automatic correction stopped: what made the proven ad win is gone and no correction of prompt.json may restore it, so a new picture from the same plan would come back without it.\",\n );\n 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\" && relaysSizesOnly(parsed, regenerateTargets(parsed, step.ids).ids)\n ? `The ${step.ids.join(\" and \")} ${step.ids.length === 1 ? \"was\" : \"were\"} made again from the same chosen picture, avoiding: ${step.note.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) => formatOfSizeNode(parsed, id) ?? id).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 withFacts,\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 ...withFacts(event.outputs),\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 * 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\";\nimport { isWordsObject } from \"../../engine/scaffold/static-format-briefs.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/**\n * The parts of the ad a new prompt.json changed beyond its words, their places and the colours (the\n * scene, the references, the concept, the sizes…): what makes a run draw new pictures instead of\n * editing the version shown. Empty when either spec cannot be read. Pure.\n */\nexport function frameChanges(previous: unknown, next: unknown): string[] {\n const before = specOf(previous);\n const after = specOf(next);\n if (!before || !after) return [];\n const was = JSON.parse(frame(before)) as Record<string, unknown>;\n const now = JSON.parse(frame(after)) as Record<string, unknown>;\n return [...new Set([...Object.keys(was), ...Object.keys(now)])].filter(\n (key) => JSON.stringify(was[key]) !== JSON.stringify(now[key]),\n );\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\nconst onSurface = (line: AdCopyLine) => (line.on ? ` on ${line.on}` : \"\");\n\n/**\n * The words lettered in the picture itself (`in_scene`: a label, a sign) that changed, as edits of\n * the picture: no size sets them again, so a picture kept as it was keeps the old words.\n */\nfunction inSceneEdits(before: readonly AdCopyLine[], after: readonly AdCopyLine[]): string[] {\n const was = before.filter((line) => line.lettering === \"in_scene\");\n const now = after.filter((line) => line.lettering === \"in_scene\");\n const out: string[] = [];\n for (let i = 0; i < Math.min(was.length, now.length); i++) {\n const a = was[i] as AdCopyLine;\n const b = now[i] as AdCopyLine;\n if (a.text !== b.text) out.push(`Change the words \"${a.text}\"${onSurface(a)} to exactly \"${b.text}\".`);\n if ((a.on ?? \"\") !== (b.on ?? \"\") && b.on)\n out.push(`Letter \"${b.text}\" on ${b.on}${a.on ? ` instead of ${a.on}` : \"\"}.`);\n }\n for (const added of now.slice(was.length)) out.push(`Letter the words \"${added.text}\"${onSurface(added)}.`);\n for (const removed of was.slice(now.length)) out.push(`Remove the words \"${removed.text}\" from the picture.`);\n return out;\n}\n\n/**\n * On one picture (`plate`), the edit a new prompt.json asks of the version's picture itself: the\n * colours of what the picture shows (a wall, the background) and the words lettered in it (a label,\n * a sign), as one instruction. Its designed words, their colours and what carries them are set again\n * on every size from prompt.json, never edited into the picture. Null when nothing the picture shows\n * changed, or anything beyond the words and the colours did (new pictures are needed). Pure.\n */\nexport function pictureEdit(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 changed = after.colors.filter((use) => {\n const was = before.colors.find((c) => c.object === use.object);\n return !isWordsObject(use.object) && !(was && was.name === use.name && was.hex === use.hex);\n });\n const ground = after.brand?.ground;\n const edits = [\n ...inSceneEdits(before.copy, after.copy),\n ...changed.map((use) => `Make ${use.object} ${use.name}${use.hex ? ` (${use.hex})` : \"\"}.`),\n ...(typeof ground === \"string\" && before.brand?.ground !== ground ? [`Make the background ${ground}.`] : []),\n ];\n return edits.length > 0 ? edits.join(\" \") : null;\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 LOGO_COMPOSITE_ROLE,\n nodesWithRole,\n rolesById,\n STATIC_ADAPT_FORMAT_ROLE,\n STATIC_FORMAT_ROLE,\n STATIC_MASTER_ROLE,\n STATIC_PLACE_ROLE,\n STATIC_PLATE_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.item === \"rule\") && 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 =>\n f.kind !== undefined && (BRIEF_ITEMS.has(f.kind.item) || (f.kind.item === \"rule\" && f.kind.element === \"picture\"));\n\n/**\n * A company rule the ad's words break: the agent's to rewrite in prompt.json. An edit of the picture\n * keeps every word, and a repair may not reword one, so no automatic round mends it.\n */\nconst wordsBreakRule = (f: RenderFinding): boolean => f.kind?.item === \"rule\" && f.kind.element === \"copy\";\n\n/** A size that lost what stopped the scroll or the proof of the proven ad (`vitalFindings`). */\nexport const lostVital = (f: RenderFinding): boolean =>\n f.severity === \"blocking\" && f.kind?.item === \"concept\" && f.kind.job !== undefined;\n\n/**\n * What the agent is told when a size lost what made its proven ad win: restore it as the plan\n * decided, or build the idea on another proven ad when nothing of ours may carry it; never shown as\n * done. Owner, Oct 2026: a meme ad without its reaction faces would have shipped. Null when nothing\n * of the kind was lost. Pure.\n */\nexport function keptLostHint(review: readonly RenderFinding[], idea?: string): string | null {\n const lost = unique(review.filter(lostVital).map((f) => f.what.replace(/\\.$/, \"\")));\n if (lost.length === 0) return null;\n return `Not done: what made the proven ad win is gone (${lost.join(\"; \")}). Never show this version as done: restore it as the plan decided it (its line under \"What survives and what changes\" and prompt.json's \\`concept.load_bearing\\`, carried in the scene, the references and the lines' \\`look\\`) and run again; if nothing of ours may carry it, build the idea on another proven ad (\\`baker winning-ads fit <adId>\\` on the next candidates, then \\`baker creatives make ${idea ?? \"<idea>\"} --slug <new slug> --reference <adId>\\`) and tell the person why, in one line.`;\n}\n\n/**\n * Whether a run's corrections stop: the plan was asked to restore what made its proven ad win (`brief`,\n * the findings handed to the spec repair) and no repair was written (refused, as a stranger cast in its\n * place, or not answered), so a picture drawn again from the same plan would come back without it. A\n * round that restores it some other way (a size laid out again from a lead that has it) goes on. Pure.\n */\nexport function stopsWithoutRepair(\n review: readonly RenderFinding[],\n brief: readonly string[],\n repaired: boolean,\n): boolean {\n return !repaired && review.some((f) => lostVital(f) && brief.includes(withoutSize(f.what)));\n}\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/**\n * A finding about the words a size's words call set (`static_format`): a line misread, missing or\n * added, a block under an interface or cut by the frame, or the copy, button or logo as the review\n * typed it. A size cut from one picture sets only these again; a defect of the picture is the picture's.\n */\nfunction aboutWords(f: RenderFinding): boolean {\n const what = withoutSize(f.what);\n return (\n PLACED.some((p) => p.test(what)) ||\n MISREAD.test(what) ||\n MISSING.test(what) ||\n EXTRA_WORDS.test(what) ||\n cutCopy(f) ||\n (f.kind !== undefined && [\"copy\", \"button\", \"logo\"].includes(f.kind.element))\n );\n}\n\n/** How the review says a size's words came with a patch of redrawn picture (`static_format` `words_misaligned`). */\nexport const PATCHED_WORDS = \"the words came with a patch of redrawn picture around them\";\n\n/** How the review says where a size's words sit could not be read (`static_format` `words_not_read`). */\nexport const UNREAD_WORDS = \"where the words sit could not be read\";\n\n/** What the words layer leaves on a picture: a halo, a seam, a patch, box or scrim behind the words, a smear beside them. */\nconst ARTIFACT =\n /\\b(?:halos?|glow|seams?|smears?|smudges?|blotch(?:es)?|patch(?:es)?|box(?:es)?|rectangles?|scrims?|backings?|ghost(?:ed|ing|s)?)\\b/i;\n/** The words a finding about the words layer names them by. */\nconst WORDS = /\\b(?:words?|text|copy|headline|lines?|lettering|type|quote|caption|label|button|pill|cta|logo)\\b/i;\n\n/**\n * A defect the words call left on a size cut from one picture (dev, Oct 2026: halos, boxes behind the\n * copy, a seam round the text block, a smear beside the button), which the review may type as one of\n * the picture. The picture under it is right: that size's words are set again, never new pictures drawn.\n */\nconst wordsArtifact = (f: RenderFinding): boolean => {\n const what = withoutSize(f.what);\n return ARTIFACT.test(what) && WORDS.test(what);\n};\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\" && !wordsBreakRule(f));\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 size cut from a picture painted wider differs from the main size only where it was painted: that is painted again.\n const painted = paintedPlates(canvas);\n const onPainted = (f: RenderFinding) =>\n comparesSizes(f) && sizesOf(f.what).length > 0 && sizesOf(f.what).every((size) => painted.has(size));\n // Words whose call moved the picture left a patch: an edit of that render keeps the move, so they are set again from scratch.\n const cutSizes = new Map(relaid.filter((r) => r.words).map((r) => [r.format, r.id] as const));\n // What the proven ad won on, gone, is never the words layer's patch: the plan is repaired toward it.\n const patched = (f: RenderFinding) =>\n !lostVital(f) &&\n ([PATCHED_WORDS, UNREAD_WORDS].some((said) => withoutSize(f.what).startsWith(said)) || wordsArtifact(f)) &&\n sizesOf(f.what).length > 0 &&\n sizesOf(f.what).every((size) => cutSizes.has(size));\n // A size whose words left a box or a halo has its words set again; a misread line beside it is set again with them.\n const wordsOnly = (f: RenderFinding) =>\n patched(f) || (aboutWords(f) && sizesOf(f.what).length > 0 && sizesOf(f.what).every((size) => cutSizes.has(size)));\n if (blocking.length > 0 && blocking.some(patched) && blocking.every(wordsOnly)) {\n return {\n kind: \"regenerate\",\n ids: unique(blocking.flatMap((f) => sizesOf(f.what).flatMap((size) => cutSizes.get(size) ?? []))),\n note: unique(blocking.map((f) => withoutSize(f.what))).join(\" \"),\n };\n }\n if (blocking.length > 0 && blocking.every(onPainted)) {\n return {\n kind: \"regenerate\",\n ids: unique(blocking.flatMap((f) => sizesOf(f.what).flatMap((size) => painted.get(size) ?? []))),\n note: `The last picture painted from the chosen one had this wrong, so avoid it: ${unique(blocking.map((f) => withoutSize(f.what))).join(\" \")}`,\n };\n }\n // A re-laid size its placing found too far out: placing it again would pass it on unchanged. A size\n // cut from one picture is never placed: its words are set again instead.\n const worded = relaid.filter((r) => r.words).map((r) => r.format);\n const unplaceable = new Set([\n ...(opts.tooFar ?? []).filter((format) => relaid.some((r) => r.format === format)),\n ...worded,\n ]);\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}:`) && (!r.words || aboutWords(f)));\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 // The words layer's own box or halo on a size cut from the picture is no defect of the picture: its words follow the picture.\n const pictureFindings = rest.filter((f) => !at(f) && !patched(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)]).filter((size) => !worded.includes(size));\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 // A size cut from the corrected picture is set again on it: none keeps the picture before.\n const keep = relaid.filter((r) => !r.words).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 // A size cut from the corrected picture has its words set on it from scratch: its edit waits for the next round.\n const relay = Object.fromEntries(Object.entries(edits).filter(([id]) => relaid.some((r) => r.id === id && !r.words)));\n return { kind: \"fix\", instruction, ...(Object.keys(relay).length > 0 ? { relay } : {}), ...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/**\n * The canvas's sizes made apart from the chosen picture, each with the edges its frame's interface\n * covers: re-laid out from it (`static_adapt_format`), or cut from one picture with their words set\n * for them (`static_format`, `words`: only their words are made again).\n */\nfunction relaidSizes(canvas: unknown): Array<{ id: string; format: string; band: CoveredEdges; words: boolean }> {\n const nodes = (canvas as { nodes?: unknown } | null)?.nodes;\n const placements = Array.isArray(nodes) ? plannedPlacements(nodes) : undefined;\n const relaid = 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, words: false }];\n });\n const cut = nodesWithRole(canvas, STATIC_FORMAT_ROLE).flatMap((n) => {\n const format = n.params?.format;\n if (typeof format !== \"string\") return [];\n const model = String((n.params?.words as { model?: unknown } | undefined)?.model ?? \"\");\n const own = Array.isArray(n.params?.placements) ? (n.params.placements as string[]) : placements;\n return [{ id: n.id, format, band: adaptPlan(model, format, own).safe, words: true }];\n });\n return [...relaid, ...cut];\n}\n\n/** By format, the picture painted from the chosen one (`static_plate`) a size is cut from. */\nfunction paintedPlates(canvas: unknown): Map<string, string> {\n const plates = new Set(nodesWithRole(canvas, STATIC_PLATE_ROLE).map((n) => n.id));\n return new Map(\n nodesWithRole(canvas, STATIC_FORMAT_ROLE).flatMap((n): Array<[string, string]> => {\n const plate = String((n.inputs as { plate?: unknown } | undefined)?.plate ?? \"\").match(/^\\$ref:([a-z][a-z0-9_]*)\\./)?.[1];\n const format = n.params?.format;\n return plate && plates.has(plate) && typeof format === \"string\" ? [[format, plate]] : [];\n }),\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 const placed = 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 // A size cut from one picture whose words sat too far past its band for code to move them (`static_format` facts).\n const cut = nodesWithRole(canvas, STATIC_FORMAT_ROLE).flatMap((n) => {\n const format = (n as GraphNode).params?.format;\n const facts = outputsByNode[n.id]?.facts as { reason?: unknown } | undefined;\n return facts?.reason === \"band_too_far\" && typeof format === \"string\" ? [format] : [];\n });\n return [...placed, ...cut];\n}\n\n/** The format a size node delivers: a re-lay's by its id, a size cut from one picture by its params; null for any other node. Pure. */\nexport function formatOfSizeNode(canvas: unknown, id: string): string | null {\n const relaid = formatOfAdaptId(id);\n if (relaid) return relaid;\n const node = nodesWithRole(canvas, STATIC_FORMAT_ROLE).find((n) => n.id === id);\n const format = (node as GraphNode | undefined)?.params?.format;\n return typeof format === \"string\" ? format : null;\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)) return n;\n // A picture painted from the chosen one: the note joins what its painting is told.\n const paint = n.params?.paint as { prompt?: unknown } | undefined;\n if (paint && typeof paint === \"object\") {\n const prompt = [typeof paint.prompt === \"string\" ? paint.prompt : \"\", note].filter(Boolean).join(\"\\n\\n\");\n return { ...n, params: { ...n.params, paint: { ...paint, prompt } } };\n }\n if (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 = {\n id?: unknown;\n type?: unknown;\n inputs?: Record<string, unknown>;\n params?: Record<string, unknown>;\n tags?: { role?: unknown };\n};\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 if (target?.type === \"static_format\") return withWordsEdit({ nodes: holder.nodes, holder }, target, opts);\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/** An ingest of a file by URL (or data URL) or by path from the canvas folder. */\nfunction lastFile(id: string, file: string): GraphNode {\n const remote = /^(?:https?|data):/.test(file);\n return {\n id,\n type: \"ingest\",\n params: remote ? { source: \"url\", url: file, expect: \"image\" } : { source: \"path\", path: file, expect: \"image\" },\n };\n}\n\n/**\n * A size cut from one picture (`static_format`) with its words set as an edit of their last setting\n * (`previous`) on the same picture: that size leads the words call as Image 1 and its brief's pictures\n * move up one; the picture is never redrawn, only its words. Pure.\n */\nfunction withWordsEdit(\n at: { nodes: GraphNode[]; holder: { nodes?: GraphNode[] } },\n target: GraphNode,\n opts: { previous: string; instruction: string; asked?: readonly string[] },\n): unknown {\n const words = target.params?.words as { prompt?: unknown } | undefined;\n if (typeof words?.prompt !== \"string\") return at.holder;\n const lastId = `last_${String(target.id)}`;\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 instruction = `Image 1 is this size as its words were last set. ${again}${opts.instruction} Keep the rest of Image 1's words as they are: the lines, the type, the colours and what carries them, moved only as much as this needs. The picture is Image 2's, unchanged.`;\n const prompt = words.prompt\n .replace(/\\bImage (\\d+)\\b/g, (_, n: string) => `Image ${Number(n) + 1}`)\n .replace(\"References:\", \"References:\\nImage 1 (THIS SIZE): this size as its words were last set, to edit.\");\n const edited: GraphNode = {\n ...target,\n inputs: { ...target.inputs, previous: `$ref:${lastId}.asset` },\n params: { ...target.params, words: { ...words, prompt, edit: { instruction } } },\n };\n const index = at.nodes.indexOf(target);\n return {\n ...at.holder,\n nodes: [...at.nodes.slice(0, index), lastFile(lastId, opts.previous), edited, ...at.nodes.slice(index + 1)],\n };\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 // The logo file placed on a size is placed last again, on the size as it is placed.\n const logoOn = new Map<string, GraphNode>();\n // A size cut from one picture keeps its words inside its band itself: it is never placed and painted.\n const cut = new Set(nodesWithRole(canvas, STATIC_FORMAT_ROLE).map((n) => `$ref:${n.id}.image`));\n for (const format of formats) {\n const at = labels.indexOf(format);\n const reads = images[at];\n const composite = nodes.find(\n (n) => typeof reads === \"string\" && reads === `$ref:${String(n.id)}.image` && n.tags?.role === LOGO_COMPOSITE_ROLE,\n );\n const source = composite ? composite.inputs?.image : reads;\n if (at < 0 || typeof source !== \"string\" || cut.has(source)) 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 if (composite) logoOn.set(String(composite.id), { ...composite, inputs: { ...composite.inputs, image: `$ref:merge_${slug}.image` } });\n else delivered[at] = `$ref:merge_${slug}.image`;\n }\n if (added.length === 0) return canvas;\n const kept = nodes.filter((n) => n !== final && !logoOn.has(String(n.id)));\n return {\n ...holder,\n nodes: [...kept, ...added, ...logoOn.values(), { ...final, inputs: { ...final.inputs, images: delivered } }],\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 */\n/** The role of the node a size is delivered from, through the logo file placed on it (which reads the size under it). */\nfunction deliveredRole(ref: unknown, nodes: readonly GraphNode[], roles: Record<string, string>): string | undefined {\n const idOf = (r: unknown) => (typeof r === \"string\" ? /^\\$ref:([^.]+)\\./.exec(r)?.[1] : undefined);\n const read = idOf(ref);\n const composite = read && roles[read] === LOGO_COMPOSITE_ROLE ? nodes.find((n) => n.id === read) : undefined;\n const from = composite ? idOf(composite.inputs?.image) : read;\n return from ? roles[from] : undefined;\n}\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 role = deliveredRole(ref, holder.nodes ?? [], roles);\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","/**\n * A take whose voice is the video model's own (an Avatar on camera: `keepRenderedVoice`) sounds like\n * whatever that generation made. Production, Oct 2026: a re-rendered take came back with another\n * accent or language than the takes beside it. Keeping the voice across takes is its own work (convert\n * later takes onto the first take of the speaker); until then a run says which takes are made again,\n * so they are listened to before they are shown. Pure.\n */\n\ntype Node = { id?: unknown; type?: unknown; tags?: unknown; inputs?: unknown; params?: unknown };\n\nconst nodesOf = (graph: unknown): Node[] => {\n const nodes = (graph as { nodes?: unknown } | null)?.nodes;\n return Array.isArray(nodes) ? (nodes as Node[]) : [];\n};\n\n/** Every node id a value refers to (`$ref:<id>.<output>`), however deep. */\nfunction refsIn(value: unknown): string[] {\n if (typeof value === \"string\") {\n const id = /^\\$ref:([^.]+)\\./.exec(value)?.[1];\n return id ? [id] : [];\n }\n if (Array.isArray(value)) return value.flatMap(refsIn);\n if (value && typeof value === \"object\") return Object.values(value).flatMap(refsIn);\n return [];\n}\n\n/** The clips whose rendered voice ships as it is: everything a kept on-camera voice track reads. */\nfunction keptVoiceClips(graph: unknown): Node[] {\n const nodes = nodesOf(graph);\n const byId = new Map(nodes.flatMap((n) => (typeof n.id === \"string\" ? [[n.id, n] as const] : [])));\n const tracks = nodes.filter((n) => {\n const tags = (n.tags ?? {}) as { role?: unknown; on_camera?: unknown };\n return n.type === \"audio_timeline\" && tags.role === \"voice\" && tags.on_camera === true;\n });\n const seen = new Set<string>();\n const queue = tracks.flatMap((t) => refsIn(t.inputs));\n while (queue.length > 0) {\n const id = queue.pop() as string;\n if (seen.has(id)) continue;\n seen.add(id);\n queue.push(...refsIn(byId.get(id)?.inputs));\n }\n return [...seen].flatMap((id) => {\n const node = byId.get(id);\n return node?.type === \"video_generate\" ? [node] : [];\n });\n}\n\nconst promptOf = (node: Node | undefined): string =>\n JSON.stringify((node?.params as { prompt?: unknown } | undefined)?.prompt ?? null);\n\n/** The talking takes (clip node ids) `canvas` makes again with another prompt than `previous` drew, whose voice is kept. */\nexport function retakenTalkingScenes(previous: unknown, canvas: unknown): string[] {\n const before = new Map(nodesOf(previous).map((n) => [n.id, n]));\n return keptVoiceClips(canvas)\n .filter((clip) => before.has(clip.id) && promptOf(before.get(clip.id)) !== promptOf(clip))\n .map((clip) => String(clip.id));\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 { FindingKind, 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 { castsNobody } from \"../../engine/scaffold/static-brief.ts\";\nimport { uncastPeople } from \"../../engine/scaffold/static-named-people.ts\";\nimport { peopleReader } from \"./named-people-read.ts\";\nimport { findWorkspaceRoot } from \"./normalize-paths.ts\";\nimport { heldRules } from \"./rule-gate.ts\";\nimport { BRAND_LOGO_ROLE } from \"../../engine/scaffold/static-render-briefs.ts\";\nimport {\n isPlateCanvas,\n LOGO_COMPOSITE_ROLE,\n nodesWithRole,\n STATIC_ADAPT_FORMAT_ROLE,\n STATIC_ADAPT_ROLE,\n STATIC_FIX_ROLE,\n STATIC_FORMAT_ROLE,\n STATIC_LEAD_ROLE,\n STATIC_MASTER_ROLE,\n STATIC_PICK_ROLE,\n STATIC_PLACE_ROLE,\n STATIC_PLATE_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 { compareSizes, sizeDifferenceFinding } from \"../../engine/nodes/local/lib/size-consistency.ts\";\nimport { MISALIGNED } from \"../../engine/nodes/local/staticFormat.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 { deliveredLogoFindings, logoPlacementFindings } from \"./logo-review.ts\";\nimport { carryUnchanged, formatOfSizeNode, keptLostHint, PATCHED_WORDS, UNREAD_WORDS } from \"./static-autofix.ts\";\nimport { frontmatterOf } from \"../creatives/ideas-model.ts\";\nimport { describeViewer, jevReadJudge, type ViewerIntended } from \"./viewer-check.ts\";\nimport { readCompanyReading } from \"../../engine/creative-context/company.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; logo?: 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 /** Master shape `plate`: the pictures drawn (one per variant), and the sizes cut from the chosen one with their words set. */\n plates: number;\n worded: 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 // On one picture each size's words call places the logo file.\n nodes.some((n) => n.type === \"static_format\" && logoIds.has(refId(n.inputs?.logo) ?? \"\"));\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 plates: nodes.some((n) => hasRole(n, STATIC_LEAD_ROLE))\n ? nodes.filter((n) => hasRole(n, STATIC_VARIANT_CALL_ROLE)).length\n : 0,\n // The lead the master delivers is the chosen option's own words, replayed: not a size set again.\n worded: nodes.filter((n) => hasRole(n, STATIC_FORMAT_ROLE) && n.id !== masterReads(nodes)).length,\n logo,\n };\n}\n\n/** The node the master is made from. */\nfunction masterReads(nodes: ShapeNode[]): string | null {\n return refId(nodes.find((n) => hasRole(n, STATIC_MASTER_ROLE))?.inputs?.image);\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 drawn = shape.plates > 0 ? \" (a picture each without the ad's words, the lead size's words set on it)\" : \"\";\n const variants = `${shape.candidates} variant${shape.candidates === 1 ? \"\" : \"s\"} rendered${drawn}${shape.judged ? \", ranked by the checks with a judge on a tie\" : \", no judge\"}`;\n const sizes = [\n ...(shape.worded > 0\n ? [`${shape.worded} size${shape.worded === 1 ? \"\" : \"s\"} cut from the chosen picture with ${shape.worded === 1 ? \"its\" : \"their\"} words set for ${shape.worded === 1 ? \"it\" : \"them\"} (one request each)`]\n : []),\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/** How a static ad's sizes are made: cut from one picture (`format_<size>`), or each laid out again (`adapt_<size>`). */\nexport type SizeShape = \"plate\" | \"relayout\";\n\n/** The shape a static canvas's sizes are made on, as its size nodes show it. Pure. */\nexport function sizeShapeOf(canvas: unknown): SizeShape {\n return isPlateCanvas(canvas) ? \"plate\" : \"relayout\";\n}\n\n/** The one call that makes a single size again on `shape`, while the chosen picture is right. Pure. */\nexport function oneSizeFix(shape: SizeShape): string {\n return shape === \"plate\"\n ? \"`baker canvas run … --regenerate format_<size>` (for example `format_9x16`) sets that size's words again on the same picture (one request)\"\n : \"`baker canvas run … --regenerate adapt_<size>` (for example `adapt_9x16`) lays out that size again from the same picture (one request)\";\n}\n\n/**\n * The fixes, by what went wrong. Every one is an edit to prompt.json and a re-run, or a correction\n * of the chosen picture: the model draws the picture, so there is no layout to nudge. A bad roll of\n * a right prompt is re-rolled, not re-described; one size wrong is made again by the node its shape\n * makes it with.\n */\nfunction fixHint(shape: SizeShape): string {\n return `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): ${oneSizeFix(shape)}.`;\n}\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, shape: SizeShape = \"plate\"): string[] {\n if (verdict === \"needs_fixes\") {\n const cost =\n shape === \"plate\" ? \"each size's words take one request\" : \"each re-laid-out size takes one request; a cut is free\";\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 (${cost}). 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 fixHint(shape),\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: ReturnType<typeof conceptSummary> = null;\n let uncast: string[] = [];\n let nobody = false;\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 reading says what it sells.\n const sells = (await readCompanyReading(path.resolve(path.dirname(targets.promptPath), \"../../..\")))?.sells;\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 // A native screen's avatars are the platform's; any other ad that casts nobody must show nobody.\n nobody = !spec.native && castsNobody(spec);\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 // Each size a model drew apart from the main one, held to it: the same people and product, once, unstretched.\n const leadFormat = masterFormat ?? targets.images[0]?.format ?? \"\";\n const lead = targets.images.find((i) => i.format === leadFormat);\n const drawn = native || !lead ? [] : drawnSizes(opts.parsed, targets.images.map((i) => i.format), leadFormat);\n const matching =\n lead && drawn.length > 0\n ? compareSizes(\n lead,\n targets.images.filter((i) => drawn.includes(i.format)),\n { ...(opts.onSpend ? { onSpend: opts.onSpend } : {}) },\n ).catch(() => drawn.map((format) => ({ format, compared: false, differences: [] })))\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 // The company's rules this ad is held to, read as they stand now: checked on the finished ad beside the review.\n const held = await heldRules(path.dirname(targets.promptPath)).catch(() => ({ rules: [] }));\n const review = await reviewRenderedStatic({\n images: changed.length > 0 ? changed : targets.images,\n rules: held.rules,\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 ...(nobody ? { castsNobody: true } : {}),\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, matched] = await Promise.all([glancing, comparing, matching]);\n const glance = review === null ? null : glanced;\n const unchanged = review === null ? [] : compared;\n const sized = sizeFactFindings(opts.parsed, opts.outputsByNode);\n // The logo is the brand's file as it is, and it and the headline sit wholly inside the frame and its safe area.\n const logoChecked = expectLogo && review !== null;\n const placedLogo = logoChecked ? logoPlacementFindings(opts.parsed, opts.outputsByNode) : [];\n const deliveredLogo = logoChecked\n ? await deliveredLogoFindings(opts.parsed, opts.outputsByNode, changed.length > 0 ? changed : targets.images, [\n ...new Set([...palette, \"#FFFFFF\", \"#000000\"]),\n ]).catch(() => [])\n : [];\n const differing = matched.flatMap((m) => (m.differences.length > 0 ? [sizeDifferenceFinding(m.format, m.differences)] : []));\n const fresh =\n review === null\n ? null\n : [...review, ...(glance ?? []), ...unchanged, ...sized, ...placedLogo, ...deliveredLogo, ...differing];\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, sizeShapeOf(opts.parsed));\n // What made the proven ad win, gone from a size: restored as the plan decided, or built on another proven ad.\n const lost = keptLostHint(reviewed ?? [], await ideaOf(targets.promptPath));\n if (lost) hints.push(lost);\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 ((reviewed ?? []).some((f) => f.severity === \"blocking\" && f.kind?.item === \"rule\" && f.kind.element === \"copy\")) {\n hints.push(\n 'A company rule the words break is yours to rewrite in prompt.json\\'s `copy` (no automatic round changes the words); only when the person asked for those words, keep them and add `\"waive\": [{\"rule\": \"<id>\", \"why\": \"<their ask>\"}]`.',\n );\n }\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 const unmatched = review === null ? [] : matched.filter((m) => !m.compared).map((m) => m.format);\n if (unmatched.length > 0) {\n hints.push(\n `The ${unmatched.join(\" and \")} could not be compared with the ${leadFormat} (the model did not answer): look at them side by side yourself, for the same people and product, shown once, unstretched.`,\n );\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 idea a creative carries (`idea:` in the `_definition.md` beside its prompt.json); undefined when none. */\nasync function ideaOf(promptPath: string): Promise<string | undefined> {\n const definition = await readFile(path.join(path.dirname(promptPath), \"_definition.md\"), \"utf8\").catch(() => \"\");\n const idea = frontmatterOf(definition)?.idea;\n return typeof idea === \"string\" && idea.trim() ? idea.trim() : undefined;\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 cut = new Set(nodesWithRole(parsed, STATIC_FORMAT_ROLE).map((n) => n.id));\n const relaid = [...nodesWithRole(parsed, STATIC_ADAPT_FORMAT_ROLE).map((n) => n.id), ...cut];\n const blocking = (review ?? []).filter((f) => f.severity === \"blocking\");\n const regenerate = relaid.flatMap((id) => {\n const format = formatOfSizeNode(parsed, id);\n if (!format || !blocking.some((f) => f.what.startsWith(`${format}:`))) return [];\n return [\n cut.has(id)\n ? `The ${format}'s words alone need fixing and the picture is right: \\`baker canvas run … --regenerate ${id}\\` sets the ${format}'s words again on the same picture (one request). If the picture itself is wrong, \\`--fix\\` it instead: every size's words are set again on the corrected picture.`\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((id) => formatOfSizeNode(parsed, id)).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/** What a size's facts name beside its reason. */\ntype SizeFacts = { covered?: string[] };\n\n/** What a size cut from one picture could not do with its words or its cut (`static_format` facts), said as the review says it. */\nconst SIZE_FACT_FINDING: Record<string, { what: (format: string, facts: SizeFacts) => string; kind: FindingKind }> = {\n band_too_far: {\n what: (format) =>\n `${format}: the words reach too far past the part of the frame the app leaves clear to be moved inside it; set them inside it.`,\n kind: { item: \"safe_zone\", element: \"copy\", defect: \"other\", edges: [] },\n },\n words_over_face: {\n what: (format) => `${format}: the words were set over a face; set them where no face is.`,\n kind: { item: \"layout\", element: \"copy\", defect: \"other\", edges: [] },\n },\n words_misaligned: {\n what: (format) =>\n `${format}: ${PATCHED_WORDS}, which shows as a box; set them again on the same picture.`,\n kind: { item: \"layout\", element: \"copy\", defect: \"other\", edges: [] },\n },\n words_not_read: {\n what: (format) =>\n `${format}: ${UNREAD_WORDS}, so the picture around them may have been redrawn; set them again on the same picture.`,\n kind: { item: \"layout\", element: \"copy\", defect: \"other\", edges: [] },\n },\n subject_covered: {\n what: (format, facts) =>\n `${format}: the words hide ${(facts.covered ?? [\"the product\"]).join(\" and \")}, which the other sizes show; set them where it stays in view.`,\n kind: { item: \"layout\", element: \"copy\", defect: \"other\", edges: [] },\n },\n subject_cut: {\n what: (format) => `${format}: no cut of the picture keeps every person and product whole in this size.`,\n kind: { item: \"picture\", element: \"picture\", defect: \"cut\", edges: [] },\n },\n};\n\n/** The products a size's facts say its words hide; null when the size recorded no facts. */\nfunction coveredIn(facts: unknown): string[] | null {\n if (facts === undefined || facts === null || typeof facts !== \"object\") return null;\n const covered = (facts as { covered?: unknown }).covered;\n return Array.isArray(covered) ? covered.filter((c): c is string => typeof c === \"string\") : [];\n}\n\n/**\n * A product a size's words hide that every size's words hide (each size recorded): no size shows it\n * to be held to, so it is noted once, on the first size that hides it, never blocked. Pure.\n */\nfunction hiddenEverywhere(\n sizes: ReadonlyArray<{ id: string; format: string | null }>,\n outputsByNode: Record<string, Record<string, unknown>>,\n): { labels: Set<string>; notes: RenderFinding[] } {\n const lists = sizes.map((s) => ({ ...s, covered: coveredIn(outputsByNode[s.id]?.facts) }));\n const labels = new Set(\n (lists[0]?.covered ?? []).filter((label) => lists.length > 1 && lists.every((s) => s.covered?.includes(label))),\n );\n const first = lists.find((s) => s.format && s.covered?.some((label) => labels.has(label)));\n const notes: RenderFinding[] =\n first?.format && labels.size > 0\n ? [\n {\n severity: \"warning\",\n what: `${first.format}: the words hide ${[...labels].join(\" and \")} in every size; set them where it stays in view if it is what the ad sells.`,\n kind: { item: \"layout\", element: \"copy\", defect: \"other\", edges: [] },\n },\n ]\n : [];\n return { labels, notes };\n}\n\n/**\n * Blocking findings from what each size cut from one picture recorded (`facts.reason`): words too far\n * past the band for code to move, words over a face, or a picture this size cannot be cut from. In\n * the canvas's order. Pure.\n */\nexport function sizeFactFindings(\n parsed: unknown,\n outputsByNode: Record<string, Record<string, unknown>>,\n): RenderFinding[] {\n const added = paintedAdditions(parsed, outputsByNode);\n const sizes = nodesWithRole(parsed, STATIC_FORMAT_ROLE);\n const everywhere = hiddenEverywhere(\n sizes.map((n) => ({ id: n.id, format: formatOfSizeNode(parsed, n.id) })),\n outputsByNode,\n );\n const found = sizes.flatMap((n) => {\n const format = formatOfSizeNode(parsed, n.id);\n const facts = (outputsByNode[n.id]?.facts ?? {}) as {\n reason?: unknown;\n covered?: unknown;\n residual?: unknown;\n words_mode?: unknown;\n };\n const shownElsewhere = (coveredIn(facts) ?? []).some((label) => !everywhere.labels.has(label));\n const said =\n typeof facts.reason === \"string\" && (facts.reason !== \"subject_covered\" || shownElsewhere)\n ? SIZE_FACT_FINDING[facts.reason]\n : undefined;\n // Only one reason is recorded; a render that sat this far from the picture left a patch whatever it\n // was, unless the size is that render taken whole (a band laid over the picture sits far from it by design).\n const patched =\n facts.reason !== \"words_misaligned\" &&\n facts.words_mode !== \"whole\" &&\n typeof facts.residual === \"number\" &&\n facts.residual > MISALIGNED\n ? SIZE_FACT_FINDING.words_misaligned\n : undefined;\n const covered = (coveredIn(facts) ?? []).filter((label) => !everywhere.labels.has(label));\n const fromPlate = refId((n.inputs as { plate?: unknown } | undefined)?.plate);\n const extra = fromPlate ? added.get(fromPlate) : undefined;\n if (!format) return [];\n return [\n ...[said, patched].flatMap((f) =>\n f ? [{ severity: \"blocking\" as const, what: f.what(format, covered.length > 0 ? { covered } : {}), kind: f.kind }] : [],\n ),\n ...(extra\n ? [\n {\n severity: \"blocking\" as const,\n what: `${format}: the picture painted wider from the chosen one shows ${extra.join(\", \")}, which the other sizes do not. It must show the main size's people and product, once each.`,\n kind: { item: \"sizes\" as const, element: \"picture\" as const, defect: \"other\" as const, edges: [] },\n },\n ]\n : []),\n ];\n });\n return [...found, ...everywhere.notes];\n}\n\n/** By plate node, what its painting added (`static_plate` facts `subject_added`). Pure. */\nfunction paintedAdditions(\n parsed: unknown,\n outputsByNode: Record<string, Record<string, unknown>>,\n): Map<string, string[]> {\n return new Map(\n nodesWithRole(parsed, STATIC_PLATE_ROLE).flatMap((n): Array<[string, string[]]> => {\n const facts = outputsByNode[n.id]?.facts as { reason?: unknown; added?: unknown } | undefined;\n const added = Array.isArray(facts?.added) ? facts.added.filter((a): a is string => typeof a === \"string\") : [];\n return facts?.reason === \"subject_added\" && added.length > 0 ? [[n.id, added]] : [];\n }),\n );\n}\n\n/**\n * The delivered sizes a model drew apart from the main size (`masterFormat`), each compared with it\n * after the run (`size-consistency.ts`): on a re-laid-out run every other size; on one picture only a\n * size cut from a picture painted from it (`static_plate`), since a cut of the chosen picture keeps\n * its people and products pixel for pixel. Pure.\n */\nexport function drawnSizes(parsed: unknown, delivered: readonly string[], masterFormat: string): string[] {\n const others = delivered.filter((format) => format && format !== masterFormat);\n const cut = nodesWithRole(parsed, STATIC_FORMAT_ROLE);\n if (cut.length === 0) return others;\n const painted = new Set(nodesWithRole(parsed, STATIC_PLATE_ROLE).map((n) => n.id));\n const fromPainted = new Set(\n cut.flatMap((n) => {\n const plate = refId((n.inputs as { plate?: unknown } | undefined)?.plate);\n const format = formatOfSizeNode(parsed, n.id);\n return plate && painted.has(plate) && format ? [format] : [];\n }),\n );\n return others.filter((format) => fromPainted.has(format));\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 = [\n ...nodesWithRole(parsed, STATIC_SAFE_FIT_ROLE),\n ...nodesWithRole(parsed, STATIC_PLACE_ROLE),\n // A size cut from one picture reads its subjects and its words; a widened picture its subjects.\n ...nodesWithRole(parsed, STATIC_LEAD_ROLE),\n ...nodesWithRole(parsed, STATIC_FORMAT_ROLE),\n ...nodesWithRole(parsed, STATIC_PLATE_ROLE),\n // The logo's composite reads the size's words for its check.\n ...nodesWithRole(parsed, LOGO_COMPOSITE_ROLE),\n ]\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 finished ad's logo, checked on the pixels: the brand's file is on every size exactly as it is,\n * wholly inside the frame and the part of it the app leaves clear, and the headline too.\n *\n * Two readings. Where the logo was placed from its file (`static_logo`), its own facts say where\n * and what its check found (`logoPlacementFindings`), and the delivered size is compared with the\n * file at that box (`deliveredLogoFindings`). Where a model drew it (a creative not yet moved onto\n * the file), the logo is found on each size by its shape and compared there: Red Points' \"POIПTS\"\n * drawn as \"POINTS\" passed the review model (Oct 2026); it does not pass this.\n */\nimport sharp from \"sharp\";\nimport { DRAWN_LOGO_MATCH, LOGO_MATCH, locateLogo, logoAgreement, type Rgba } from \"../../engine/nodes/local/lib/logo-match.ts\";\nimport { fitArtwork, logoArtwork, textColourSource, usesTextColour } from \"../../engine/nodes/local/lib/logo-raster.ts\";\nimport type { FindingKind, RenderFinding } from \"../../engine/nodes/local/lib/render-review.ts\";\nimport { bytesOf } from \"../../engine/nodes/local/lib/static-review.ts\";\nimport { LogoFacts } from \"../../engine/nodes/local/staticLogo.ts\";\nimport {\n logoCornerWords,\n type PlacementProblem,\n placementProblems,\n slotPosition,\n} from \"../../engine/scaffold/static-logo.ts\";\nimport { deliveredSize } from \"../../engine/scaffold/static-sizes.ts\";\nimport { formatSlug, LOGO_COMPOSITE_ROLE, nodesWithRole } from \"../../engine/scaffold/static-topology.ts\";\n\ntype Node = { id?: unknown; type?: unknown; inputs?: Record<string, unknown>; tags?: { role?: unknown } };\n\nconst nodesOf = (parsed: unknown): Node[] => {\n const nodes = (parsed as { nodes?: unknown } | null)?.nodes;\n return Array.isArray(nodes) ? (nodes as Node[]) : [];\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 edgesSaid = (edges: readonly string[]) => edges.join(\" and \") || \"edge\";\n\n/** The size's id in `--regenerate`, as its nodes spell it: `4:5` is `4x5`, `1.91:1` is `1_91x1`. */\nconst sizeId = formatSlug;\n\n/**\n * The node that set a size's words, read up the composite's picture: its `static_format`, or the\n * render that laid the size out again (an `image_generate`); null for the chosen picture itself\n * (a re-laid-out ad's lead, after `static_prefilter`), which only a `--fix` changes;\n * `format_<size>` when none is found.\n */\nfunction wordsNodeOf(nodes: readonly Node[], composite: Node | undefined, format: string): string | null {\n let ref = composite?.inputs?.image;\n for (let hops = 0; hops < 12; hops++) {\n const n = nodes.find((m) => m.id === refId(ref));\n if (!n) break;\n if (n.type === \"static_format\" || n.type === \"image_generate\") return String(n.id);\n if (n.type === \"static_prefilter\") return null;\n ref = n.inputs?.image;\n }\n return `format_${sizeId(format)}`;\n}\n\n/** A logo with no room on its size, or lost on the ground under it: what to run, and what to keep clear. */\nfunction saidOfRoom(\n format: string,\n defect: \"no_room\" | \"illegible\",\n corner: string,\n words: string | null = `format_${sizeId(format)}`,\n): RenderFinding {\n const kind: FindingKind = { item: \"logo\", element: \"logo\", defect: \"other\", edges: [] };\n const room =\n words === null\n ? `keep the ${corner} plain for the logo, with no word, button or card in it (a \\`--fix\\` of the chosen picture).`\n : `run \\`baker canvas run … --regenerate ${words}\\` and keep the ${corner} clear for the logo.`;\n const what =\n defect === \"no_room\"\n ? `${format}: there is no room for the logo, not even on a small plate; ${room}`\n : `${format}: the logo is lost on the picture under it; run \\`--regenerate logo_${sizeId(format)}\\` so it is set on a plate.`;\n return { severity: \"blocking\", what, kind };\n}\n\n/** One problem a composite's check found, as the review says it, and what it is. */\nfunction said(\n format: string,\n p: PlacementProblem,\n corner = logoCornerWords(undefined),\n words?: string | null,\n): RenderFinding {\n if (p.defect === \"no_room\" || p.defect === \"illegible\") return saidOfRoom(format, p.defect, corner, words);\n const kind = (\n item: FindingKind[\"item\"],\n element: FindingKind[\"element\"],\n defect: FindingKind[\"defect\"],\n ): FindingKind => ({\n item,\n element,\n defect,\n edges: p.defect === \"cut\" ? [...p.edges] : [],\n });\n const blocking = (what: string, k: FindingKind): RenderFinding => ({\n severity: \"blocking\",\n what: `${format}: ${what}`,\n kind: k,\n });\n if (p.element === \"logo\") {\n return p.defect === \"cut\"\n ? blocking(\n `the frame cuts the logo at its ${edgesSaid(p.edges)}; place it again inside the frame.`,\n kind(\"logo\", \"logo\", \"cut\"),\n )\n : blocking(\n `the logo reaches past the ${edgesSaid(p.edges)} of the part of the frame the app leaves clear; place it again inside it.`,\n kind(\"safe_zone\", \"logo\", \"other\"),\n );\n }\n if (p.defect === \"under_logo\") {\n const what = p.element === \"headline\" ? \"the headline\" : \"a line of the copy\";\n return blocking(\n `the logo covers ${what}; set the words again clear of the logo's corner.`,\n kind(\"layout\", \"copy\", \"other\"),\n );\n }\n return p.defect === \"cut\"\n ? blocking(\n `the frame cuts the headline at its ${edgesSaid(p.edges)}; set the words again inside the frame.`,\n kind(\"layout\", \"copy\", \"cut\"),\n )\n : blocking(\n `the headline reaches past the ${edgesSaid(p.edges)} of the part of the frame the app leaves clear; set the words again inside it.`,\n kind(\"safe_zone\", \"copy\", \"other\"),\n );\n}\n\n/** What each composite's own check found (`static_logo` `facts.problems`), blocking, in the canvas's order. Pure. */\nexport function logoPlacementFindings(\n parsed: unknown,\n outputsByNode: Record<string, Record<string, unknown>>,\n): RenderFinding[] {\n return nodesWithRole(parsed, LOGO_COMPOSITE_ROLE).flatMap((n) => {\n const facts = LogoFacts.safeParse(outputsByNode[n.id]?.facts);\n if (!facts.success) return [];\n // With no room, the corner the size kept for the logo (its slot), which the words are set again around.\n const { format, slot, problems } = facts.data;\n const kept = problems.some((p) => p.defect === \"no_room\") ? slotPosition(slot, deliveredSize(format)) : undefined;\n const corner = logoCornerWords(kept ?? (n as { params?: { position?: unknown } }).params?.position);\n const words = wordsNodeOf(nodesOf(parsed), n as Node, facts.data.format);\n return facts.data.problems.map((p) => said(facts.data.format, p, corner, words));\n });\n}\n\nasync function rgbaOf(bytes: Buffer): Promise<Rgba> {\n const { data, info } = await sharp(bytes).ensureAlpha().raw().toBuffer({ resolveWithObject: true });\n return { data, width: info.width, height: info.height };\n}\n\n/** The bytes of the picture an ingest delivered (`$ref:<id>.asset`), when the run recorded it. */\nasync function ingestBytes(\n ref: unknown,\n outputsByNode: Record<string, Record<string, unknown>>,\n): Promise<Buffer | null> {\n const id = refId(ref);\n const asset = id\n ? (outputsByNode[id]?.asset as { path?: unknown; url?: unknown; metadata?: unknown } | undefined)\n : undefined;\n const source = await textColourSource(asset?.metadata);\n if (source) return source;\n const at = typeof asset?.path === \"string\" ? asset.path : typeof asset?.url === \"string\" ? asset.url : null;\n return at ? await bytesOf(at).catch(() => null) : null;\n}\n\n/** A logo the model drew is found when its shape fits this well: the brand's own (Red Points: 0.83-0.90), never a stray mark (under 0.5). */\nconst LOGO_FOUND = 0.6;\n\nconst pct = (v: number) => `${Math.round(v * 100)}%`;\n\nfunction mismatch(format: string, agreement: number): RenderFinding {\n return {\n severity: \"blocking\",\n what: `${format}: the logo is not the brand's file as it is (redrawn or altered: ${pct(agreement)} of it matches the file); run it again so the file itself is placed.`,\n kind: { item: \"logo\", element: \"logo\", defect: \"other\", edges: [] },\n };\n}\n\n/** A logo the model drew far from the brand's: drawn again, it is drawn from the file, which is never pasted. */\nfunction drawnMismatch(format: string, agreement: number): RenderFinding {\n return {\n severity: \"blocking\",\n what: `${format}: the logo drawn is not the brand's logo (only ${pct(agreement)} of it matches the file); draw this size again with the brand's logo copied exactly from the logo file, letter for letter.`,\n kind: { item: \"logo\", element: \"logo\", defect: \"other\", edges: [] },\n };\n}\n\n/** The widths a drawn logo is looked for at: from 8% to 45% of the frame, 4% apart. */\nfunction searchWidths(frameWidth: number): number[] {\n const widths: number[] = [];\n for (let w = frameWidth * 0.08; w <= frameWidth * 0.45; w *= 1.04) widths.push(Math.round(w));\n return widths;\n}\n\ntype Image = { path: string; format: string };\ntype Outputs = Record<string, Record<string, unknown>>;\n\n/** A size the logo was placed on from its file: its pixels at the composite's box held to the file. */\nasync function placedLogoFinding(n: Node, outputsByNode: Outputs, images: readonly Image[]): Promise<RenderFinding[]> {\n const facts = LogoFacts.safeParse(outputsByNode[String(n.id)]?.facts);\n // No room: nothing was stamped, and the size's own finding sends its words back.\n if (!facts.success || facts.data.problems.some((p) => p.defect === \"no_room\")) return [];\n const { format, box, variant, ink } = facts.data;\n const image = images.find((i) => i.format === format);\n const logos = Array.isArray(n.inputs?.logos) ? n.inputs.logos : [];\n const [ad, file] = await Promise.all([\n image ? bytesOf(image.path).catch(() => null) : null,\n ingestBytes(logos[variant], outputsByNode),\n ]);\n if (!ad || !file) return [];\n const placed = await fitArtwork(await logoArtwork(file, ink ? { currentColor: ink } : {}), box);\n const agreement = logoAgreement(await rgbaOf(ad), placed, box);\n return agreement < LOGO_MATCH ? [mismatch(format, agreement)] : [];\n}\n\ntype DrawnLogo = { agreement: number; box: { x: number; y: number; width: number; height: number }; score: number };\n\n/** The logo a model drew on `picture`, found by its shape among the file's colourways (`arts`); null when none fits. */\nasync function drawnLogoOn(picture: Rgba, arts: ReadonlyArray<Rgba | null>): Promise<DrawnLogo | null> {\n let best: DrawnLogo | null = null;\n for (const art of arts) {\n if (!art) continue;\n const templates = await Promise.all(\n searchWidths(picture.width).map((w) => fitArtwork(art, { width: w, height: picture.height })),\n );\n const at = locateLogo(picture, templates);\n if (!at || at.score < LOGO_FOUND || (best && best.score >= at.score)) continue;\n best = { agreement: logoAgreement(picture, templates[at.template] as Rgba, at), box: at, score: at.score };\n }\n return best;\n}\n\nconst NO_MARGIN = { top: 0, bottom: 0, left: 0, right: 0 };\n\n/** A logo file's artwork as it can be drawn: as it is, or once per colour when it is inked in the text colour. */\nasync function artworksOf(file: Buffer, inks: readonly string[]): Promise<Array<Rgba | null>> {\n const colours = usesTextColour(file) ? inks : [undefined];\n return await Promise.all(colours.map((ink) => logoArtwork(file, ink ? { currentColor: ink } : {}).catch(() => null)));\n}\n\n/** A size a model drew the logo on: blocking when the frame cuts it, or it is clearly not the brand's logo (`DRAWN_LOGO_MATCH`). */\nasync function drawnLogoFinding(image: Image, arts: ReadonlyArray<Rgba | null>): Promise<RenderFinding[]> {\n const ad = await bytesOf(image.path).catch(() => null);\n if (!ad) return [];\n const picture = await rgbaOf(ad);\n const drawn = await drawnLogoOn(picture, arts);\n if (!drawn) return [];\n const frame = { width: picture.width, height: picture.height };\n const cut = placementProblems({ frame, safe: NO_MARGIN, logo: drawn.box });\n if (cut.length > 0) return cut.map((p) => said(image.format, p));\n return drawn.agreement < DRAWN_LOGO_MATCH ? [drawnMismatch(image.format, drawn.agreement)] : [];\n}\n\n/**\n * The delivered logo held to its file, on each delivered size (`images`, by format). Placed from the\n * file: the size's pixels at the composite's box are the file's (`LOGO_MATCH`), else blocking. Drawn by\n * a model: the logo is found by its shape among the file's colourways, and blocking when the frame\n * cuts it or it is clearly another logo (`DRAWN_LOGO_MATCH`); a drawn logo is never the file exactly. A size delivered as it was approved (an ingest) is the\n * person's and is not read. A logo that cannot be read or found says nothing here.\n */\nexport async function deliveredLogoFindings(\n parsed: unknown,\n outputsByNode: Outputs,\n images: readonly Image[],\n /** The colours a logo inked in the text colour is looked for in (the brand's, and white). */\n inks: readonly string[] = [\"#000000\", \"#FFFFFF\"],\n): Promise<RenderFinding[]> {\n const nodes = nodesOf(parsed);\n const composites = nodes.filter((n) => n.tags?.role === LOGO_COMPOSITE_ROLE && n.type === \"static_logo\");\n if (composites.length > 0) {\n return (await Promise.all(composites.map((n) => placedLogoFinding(n, outputsByNode, images)))).flat();\n }\n const logos = nodes.filter((n) => n.type === \"ingest\" && /^brand_logo/.test(String(n.tags?.role ?? \"\")));\n const files = await Promise.all(logos.map((n) => ingestBytes(`$ref:${String(n.id)}.asset`, outputsByNode)));\n const arts = (await Promise.all(files.map((f) => (f ? artworksOf(f, inks) : [])))).flat();\n if (!arts.some((a) => a !== null)) return [];\n const asIs = deliveredAsIs(nodes);\n const drawn = images.filter((i) => !asIs.has(i.format));\n return (await Promise.all(drawn.map((image) => drawnLogoFinding(image, arts)))).flat();\n}\n\n/** The formats the final collect delivers straight from an ingest: an approved size, or a round's last file, as it was. */\nfunction deliveredAsIs(nodes: readonly Node[]): Set<string> {\n const final = nodes.find((n) => n.id === \"final\" && n.type === \"collect\") as\n | (Node & { params?: { labels?: unknown } })\n | undefined;\n const labels = final?.params?.labels;\n const images = final?.inputs?.images;\n if (!Array.isArray(labels) || !Array.isArray(images)) return new Set();\n return new Set(\n labels.filter((label, i): label is string => {\n const from = nodes.find((n) => n.id === refId(images[i]));\n return typeof label === \"string\" && from?.type === \"ingest\";\n }),\n );\n}\n","/**\n * Whether the logo on a delivered ad is the brand's file, measured on the pixels.\n *\n * An image model handed a logo redraws it: Red Points' stylised lowercase-n \"POIПTS\" came back\n * as a plain \"POINTS\" (Oct 2026), close enough that the review model passed it. A logo\n * composited from the file is the file pixel for pixel, so the check is exact where the box is\n * known (`logoAgreement`), and found by its shape where the model drew it (`locateLogo`).\n *\n * Pure: RGBA pixels in, numbers out.\n */\n\n/** Pixels, four channels each (RGBA), row by row. */\nexport type Rgba = { data: Uint8Array | Buffer; width: number; height: number };\n\n/** A logo pixel counts as drawn when it is at least this opaque. */\nconst SOLID = 250;\n/** How far (RGB distance) a delivered pixel may sit from the file's and still be the file's: resampling, not redrawing. */\nconst SAME_COLOUR = 60;\n/**\n * The share of the file's solid pixels the ad must show as they are for its logo to be the file.\n * Measured on Red Points (Oct 2026): the file composited reads 1.000; the logo the model drew from\n * the file, at its best fit, 0.91-0.96 (a redrawn letter, a mark's proportions).\n */\nexport const LOGO_MATCH = 0.98;\n/**\n * The share a logo the model drew must show to be the brand's logo at all. A drawn logo is never\n * the file pixel for pixel: Red Points read 0.91-0.96 and Zernio 0.93-0.97 (Oct 2026), and a redraw\n * reads the same again, so holding it to `LOGO_MATCH` blocked every ad and no round converged.\n * Under this it is another mark, letters out of order or most of it missing.\n */\nexport const DRAWN_LOGO_MATCH = 0.9;\n\n/** Where the logo was found on an ad: its box in the ad's pixels (it may reach past the frame), which size of it, how well it fits (0-1). */\ntype LogoFound = { x: number; y: number; width: number; height: number; template: number; score: number };\n\n/** The width the first, coarse search reads the ad at. */\nconst COARSE_WIDTH = 180;\n/** A logo is looked for with at least this share of it inside the frame: a cut logo is still found. */\nconst MIN_SHOWN = 0.4;\n/** The logo's colours: a quantised colour holding at least this share of its solid pixels. */\nconst MAIN_COLOUR = 0.12;\n/** A pixel is in one of the logo's colours within this RGB distance, for the search. */\nconst INK_NEAR = 90;\n\ntype Map01 = { map: Uint8Array; width: number; height: number };\n\n/** The logo's main colours: the means of the quantised colours that hold a fair share of its solid pixels. */\nfunction inkColours(logo: Rgba): Array<[number, number, number]> {\n const bins = new Map<number, { n: number; r: number; g: number; b: number }>();\n let total = 0;\n for (let i = 0; i < logo.width * logo.height; i++) {\n if ((logo.data[i * 4 + 3] ?? 0) < SOLID) continue;\n const r = logo.data[i * 4] ?? 0;\n const g = logo.data[i * 4 + 1] ?? 0;\n const b = logo.data[i * 4 + 2] ?? 0;\n const key = ((r >> 5) << 6) | ((g >> 5) << 3) | (b >> 5);\n const bin = bins.get(key) ?? { n: 0, r: 0, g: 0, b: 0 };\n bins.set(key, { n: bin.n + 1, r: bin.r + r, g: bin.g + g, b: bin.b + b });\n total++;\n }\n return [...bins.values()].filter((b) => b.n >= MAIN_COLOUR * total).map((b) => [b.r / b.n, b.g / b.n, b.b / b.n]);\n}\n\n/** `test` per pixel, averaged down by `f`: a cell is on when at least half its pixels are. */\nfunction mapOf(img: Rgba, f: number, test: (i: number) => boolean): Map01 {\n const width = Math.max(1, Math.floor(img.width / f));\n const height = Math.max(1, Math.floor(img.height / f));\n const map = new Uint8Array(width * height);\n for (let y = 0; y < height; y++) {\n for (let x = 0; x < width; x++) map[y * width + x] = cellOn(img.width, f, x * f, y * f, test) ? 1 : 0;\n }\n return { map, width, height };\n}\n\n/** Whether at least half the `f`×`f` pixels from (x0, y0) of a picture `width` wide pass `test`. */\nfunction cellOn(width: number, f: number, x0: number, y0: number, test: (i: number) => boolean): boolean {\n let on = 0;\n for (let j = 0; j < f; j++) {\n for (let i = 0; i < f; i++) on += test((y0 + j) * width + x0 + i) ? 1 : 0;\n }\n return on * 2 >= f * f;\n}\n\nfunction inkMapOf(image: Rgba, colours: ReadonlyArray<[number, number, number]>, f: number): Map01 {\n return mapOf(image, f, (i) => colours.some((c) => distance(image.data, i * 4, c, 0) < INK_NEAR));\n}\n\nconst maskOf = (logo: Rgba, f: number): Map01 => mapOf(logo, f, (i) => (logo.data[i * 4 + 3] ?? 0) >= 128);\n\n/** A map with its summed-area table: the ink under any rectangle in four reads. */\ntype Summed = Map01 & { sum: Int32Array };\n\nfunction summed(m: Map01): Summed {\n const w = m.width + 1;\n const sum = new Int32Array(w * (m.height + 1));\n for (let y = 0; y < m.height; y++) {\n let row = 0;\n for (let x = 0; x < m.width; x++) {\n row += m.map[y * m.width + x] ?? 0;\n sum[(y + 1) * w + x + 1] = (sum[y * w + x + 1] ?? 0) + row;\n }\n }\n return { ...m, sum };\n}\n\n/** The ink of `m` inside [x0, x1) × [y0, y1), clamped to it. */\nfunction inkIn(m: Summed, x0: number, y0: number, x1: number, y1: number): number {\n const w = m.width + 1;\n const [a, b] = [Math.max(0, x0), Math.min(m.width, x1)];\n const [c, d] = [Math.max(0, y0), Math.min(m.height, y1)];\n if (a >= b || c >= d) return 0;\n return (m.sum[d * w + b] ?? 0) - (m.sum[c * w + b] ?? 0) - (m.sum[d * w + a] ?? 0) + (m.sum[c * w + a] ?? 0);\n}\n\n/**\n * A mask as its rows' runs of solid cells (`row`, from `x0` to before `x1`), with its own\n * summed-area table: how much of it a frame shows in four reads.\n */\ntype Cells = {\n rows: Int32Array;\n x0s: Int32Array;\n x1s: Int32Array;\n mask: Summed;\n area: number;\n width: number;\n height: number;\n};\n\nfunction cellsOf(m: Map01): Cells {\n const rows: number[] = [];\n const x0s: number[] = [];\n const x1s: number[] = [];\n for (let y = 0; y < m.height; y++) {\n for (let x = 0; x < m.width; x++) {\n if (!m.map[y * m.width + x]) continue;\n const start = x;\n while (x < m.width && m.map[y * m.width + x]) x++;\n rows.push(y);\n x0s.push(start);\n x1s.push(x);\n }\n }\n const mask = summed(m);\n return {\n rows: Int32Array.from(rows),\n x0s: Int32Array.from(x0s),\n x1s: Int32Array.from(x1s),\n mask,\n area: inkIn(mask, 0, 0, m.width, m.height),\n width: m.width,\n height: m.height,\n };\n}\n\n/** The overlap over the union, weighed down by the share of the mask outside the frame. */\nconst fitScore = (inter: number, inside: number, win: number, area: number) =>\n (inter / (inside + win - inter)) * Math.sqrt(inside / area);\n\n/**\n * How well a mask (`cells`) fits `ink` with its top-left at (x, y): the overlap over the union, on\n * the part of the mask inside the frame, weighed down by how much of it lies outside. 0 when it\n * cannot beat `floor`: the overlap is at most the lesser of the mask shown and the ink under it, and\n * the score grows with it, so a place whose best case is no better is never counted cell by cell.\n */\nfunction fitAt(ink: Summed, cells: Cells, x: number, y: number, floor = 0): number {\n const inside = inkIn(cells.mask, -x, -y, ink.width - x, ink.height - y);\n if (inside < MIN_SHOWN * cells.area) return 0;\n const win = inkIn(ink, x, y, x + cells.width, y + cells.height);\n if (fitScore(Math.min(inside, win), inside, win, cells.area) <= floor) return 0;\n let inter = 0;\n for (let k = 0; k < cells.rows.length; k++) {\n const v = y + (cells.rows[k] ?? 0);\n inter += inkIn(ink, x + (cells.x0s[k] ?? 0), v, x + (cells.x1s[k] ?? 0), v + 1);\n }\n return fitScore(inter, inside, win, cells.area);\n}\n\n/** The best fit of `cells` on `ink` over the places in `xs` × `ys`, `step` apart, the first place of the best score. */\nfunction bestFit(ink: Summed, cells: Cells, xs: [number, number], ys: [number, number], step = 1) {\n let best = { x: 0, y: 0, score: 0 };\n if (cells.area === 0) return best;\n for (let y = ys[0]; y <= ys[1]; y += step) {\n for (let x = xs[0]; x <= xs[1]; x += step) {\n const score = fitAt(ink, cells, x, y, best.score);\n if (score > best.score) best = { x, y, score };\n }\n }\n return best;\n}\n\n/**\n * Where on `image` the logo sits and at what size, among `templates` (the logo file rasterised at\n * a range of widths, smallest first): found by its shape in its own colours, read coarse (every\n * other size) and then at full size around the best place and its neighbouring sizes. A logo the\n * frame cuts is found past the edge (its box reaches outside the frame). Null when nothing of the\n * logo's shape is on the ad. Pure.\n */\nexport function locateLogo(image: Rgba, templates: readonly Rgba[]): LogoFound | null {\n const first = templates[0];\n if (!first) return null;\n const colours = inkColours(templates[templates.length - 1] ?? first);\n if (colours.length === 0) return null;\n const f = Math.max(1, Math.round(image.width / COARSE_WIDTH));\n const found = coarseFind(summed(inkMapOf(image, colours, f)), templates, f);\n if (!found || found.score === 0) return null;\n if (f === 1) {\n const t = templates[found.template] as Rgba;\n return { x: found.x, y: found.y, width: t.width, height: t.height, template: found.template, score: found.score };\n }\n return fineFind(summed(inkMapOf(image, colours, 1)), templates, found, f);\n}\n\ntype Found = { template: number; x: number; y: number; score: number };\n\n/** The best size and place over the whole ad read `f` times smaller, a logo reaching past its edge included. */\nfunction coarseFind(coarse: Summed, templates: readonly Rgba[], f: number): Found | null {\n let found: Found | null = null;\n templates.forEach((t, k) => {\n const cells = cellsOf(maskOf(t, f));\n const reachX = Math.round(cells.width * (1 - MIN_SHOWN));\n const reachY = Math.round(cells.height * (1 - MIN_SHOWN));\n const fit = bestFit(\n coarse,\n cells,\n [-reachX, coarse.width - cells.width + reachX],\n [-reachY, coarse.height - cells.height + reachY],\n );\n if (!found || fit.score > found.score) found = { template: k, ...fit };\n });\n return found;\n}\n\n/** The coarse find read again at full size: its neighbouring sizes, around its place. */\nfunction fineFind(full: Summed, templates: readonly Rgba[], found: Found, f: number): LogoFound | null {\n let fine: LogoFound | null = null;\n const [cx, cy] = [found.x * f, found.y * f];\n for (const k of [-2, -1, 0, 1, 2].map((d) => found.template + d)) {\n const t = templates[k];\n if (!t) continue;\n const cells = cellsOf(maskOf(t, 1));\n const near = bestFit(full, cells, [cx - 2 * f, cx + 2 * f], [cy - 2 * f, cy + 2 * f], 3);\n const fit = bestFit(full, cells, [near.x - 2, near.x + 2], [near.y - 2, near.y + 2]);\n if (!fine || fit.score > fine.score)\n fine = { x: fit.x, y: fit.y, width: t.width, height: t.height, template: k, score: fit.score };\n }\n return fine;\n}\n\nconst distance = (a: ArrayLike<number>, i: number, b: ArrayLike<number>, j: number) =>\n Math.hypot((a[i] ?? 0) - (b[j] ?? 0), (a[i + 1] ?? 0) - (b[j + 1] ?? 0), (a[i + 2] ?? 0) - (b[j + 2] ?? 0));\n\n/**\n * The share of the logo file's solid pixels (`logo`, rasterised at the size it sits at) that the\n * delivered `image` shows in the file's colour with the logo's top-left at `at`. A pixel past the\n * frame's edge is a pixel the ad lost. 1 for the file composited; well under `LOGO_MATCH` for a\n * logo redrawn, recoloured, covered or cut. Pure.\n */\nexport function logoAgreement(image: Rgba, logo: Rgba, at: { x: number; y: number }): number {\n let solid = 0;\n let same = 0;\n for (let j = 0; j < logo.height; j++) {\n for (let i = 0; i < logo.width; i++) {\n const s = (j * logo.width + i) * 4;\n if ((logo.data[s + 3] ?? 0) < SOLID) continue;\n solid++;\n const u = at.x + i;\n const v = at.y + j;\n if (u < 0 || v < 0 || u >= image.width || v >= image.height) continue;\n if (distance(image.data, (v * image.width + u) * 4, logo.data, s) < SAME_COLOUR) same++;\n }\n }\n return solid === 0 ? 0 : same / solid;\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 { ruleTells } from \"../../engine/copy-tells/rule-tells.ts\";\nimport type { CreativeRule } from \"../../engine/creative-rules/schema.ts\";\nimport { nativeCopy } from \"../../engine/scaffold/native-surface.ts\";\nimport {\n AdSpecSchema,\n adSpecJsonSchema,\n decisionOf,\n isAdSpec,\n isMemeTemplate,\n isVital,\n type VitalJob,\n} from \"../../engine/scaffold/static-ad-spec.ts\";\nimport { castsNobody } from \"../../engine/scaffold/static-brief.ts\";\nimport { castHandles } from \"../creatives/cast-decision.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/** The Avatars the concept declares carry what stops the scroll or the proof (`ours: \"@dana-reyes …\"`). Pure. */\nfunction declaredAvatars(spec: z.infer<typeof AdSpecSchema>): Set<string> {\n return new Set((spec.concept?.load_bearing ?? []).filter(isVital).flatMap((l) => castHandles(l.ours ?? \"\")));\n}\n\n/** The Avatars a spec's people are grounded on. Pure. */\nfunction groundedAvatars(spec: z.infer<typeof AdSpecSchema>): Set<string> {\n return new Set(spec.references.flatMap((r) => (r.avatar ? [r.avatar.toLowerCase()] : [])));\n}\n\n/** Whether every person a spec grounds is one of `avatars`, and it grounds one. Pure. */\nfunction castsOnly(spec: z.infer<typeof AdSpecSchema>, avatars: ReadonlySet<string>): boolean {\n const people = spec.references.filter((r) => r.id.startsWith(\"PERSON_\"));\n return people.length > 0 && people.every((r) => r.avatar !== undefined && avatars.has(r.avatar.toLowerCase()));\n}\n\n/**\n * Whether a repair keeps who appears as the definition decided it: never a stranger cast in an ad that\n * casts nobody (the Avatar the concept declares in place of what stopped the scroll is no stranger),\n * and never that Avatar taken away once it is grounded. Pure.\n */\nfunction keepsCast(was: z.infer<typeof AdSpecSchema>, now: z.infer<typeof AdSpecSchema>): boolean {\n const declared = declaredAvatars(was);\n if (castsNobody(was) && !castsNobody(now) && !castsOnly(now, declared)) return false;\n const before = groundedAvatars(was);\n const after = groundedAvatars(now);\n return ![...declared].some((handle) => before.has(handle) && !after.has(handle));\n}\n\ntype SpecReference = z.infer<typeof AdSpecSchema>[\"references\"][number];\n\n/**\n * The references that are a real meme template: the picture comes from Imgflip, or the reference\n * says it is a meme. A correction keeps each exactly (Owner, Oct 2026: round 5 of a meme ad redrew\n * Michael Scott and a code block once the references that grounded them were replaced). Pure.\n */\nfunction memeTemplateReferences(spec: z.infer<typeof AdSpecSchema>): SpecReference[] {\n return spec.references.filter(isMemeTemplate);\n}\n\n/** Whether every meme template `was` is grounded on is in `now`, the same picture and the same use. Pure. */\nfunction keepsMemeTemplates(was: z.infer<typeof AdSpecSchema>, now: z.infer<typeof AdSpecSchema>): boolean {\n return memeTemplateReferences(was).every((t) =>\n now.references.some((r) => r.id === t.id && r.role === t.role && r.image === t.image && r.what === t.what && r.keep === t.keep),\n );\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, and never prints words the\n * company's rules forbid. Null otherwise. Pure.\n */\nexport function acceptRepair(\n before: unknown,\n answer: unknown,\n /** The company's rules for this ad, and its language: a repair never prints words they forbid. */\n held: { rules: readonly CreativeRule[]; language?: string } = { rules: [] },\n): 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\", \"viewer\"] 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 if (!keepsCast(was.data, now.data) || !keepsMemeTemplates(was.data, now.data)) return null;\n const kept = printedWords(now.data);\n const said = printedWords(was.data);\n if (!said.every((text) => kept.includes(text))) return null;\n // A native screen draws its own words, never the copy lines: each must survive on the screen itself.\n if (was.data.native) {\n const shown = now.data.native ? nativeCopy(now.data.native) : [];\n if (!nativeCopy(was.data.native).every((text) => shown.includes(text))) return null;\n }\n const added = kept.filter((text) => !said.includes(text));\n // Words a rule bans in a line the repair added; what a rule requires the kept lines already say.\n if (ruleTells(added, held.rules, held.language).some((t) => t.kind === \"forbidden\")) return null;\n return { changed: parsed.data.changed, spec: spec as Record<string, unknown> };\n}\n\n/** The meme templates a spec text is grounded on, each as \"PROP_1 (what it is)\". Pure. */\nfunction memeTemplatesOf(spec: string): string[] {\n let raw: unknown;\n try {\n raw = JSON.parse(spec);\n } catch {\n return [];\n }\n const parsed = AdSpecSchema.safeParse(raw);\n return parsed.success ? memeTemplateReferences(parsed.data).map((r) => `${r.id} (${r.what})`) : [];\n}\n\n/** What the model is asked: the spec, the finished ad, and the defects the spec caused. Pure. */\nexport function buildSpecRepairPrompt(\n spec: string,\n findings: readonly string[],\n schema?: unknown,\n /** What the person rejected in earlier versions of this ad, in their words (`readCaseFile`). */\n rejected: readonly string[] = [],\n /** What stops the scroll or the proof the ad lost, each with what of ours the concept declares carries it (`restoreLines`). */\n restore: readonly string[] = [],\n): string {\n const templates = memeTemplatesOf(spec);\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 ...(restore.length > 0\n ? [\n \"\",\n \"Restore what made the proven ad win, as the concept declares it: put each of these back in the scene, the references and the lines' `look`, carried by exactly what of ours the concept names; never drop it or put anything the concept does not declare in its place.\",\n ...restore.map((r) => `- ${r}`),\n ]\n : []),\n ...(rejected.length > 0\n ? [\n \"\",\n \"What the person rejected in earlier versions of this ad, in their words: never bring back any of it, in the scene, the references or the layout.\",\n ...rejected.map((r) => `- ${r}`),\n ]\n : []),\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 (never what the concept keeps of the proven ad). 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 ...(templates.length > 0\n ? [\n `- These references are real meme templates, grounded on their real pictures: ${templates.join(\"; \")}. Keep each exactly as it is (id, role, image and use) and keep the scene using it as the picture; never drop, replace or redraw one, and never describe its people or faces in the scene for the image model to draw.`,\n ]\n : []),\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/**\n * What stops the scroll or the proof of `jobs` in a spec's concept, each with what of ours carries it,\n * as a repair restoring it is told (`buildSpecRepairPrompt`). None for a spec that names neither. Pure.\n */\nexport function restoreLines(spec: unknown, jobs: readonly VitalJob[]): string[] {\n const parsed = AdSpecSchema.safeParse(spec);\n if (!parsed.success || jobs.length === 0) return [];\n return (parsed.data.concept?.load_bearing ?? [])\n .filter((l) => isVital(l) && l.job !== undefined && jobs.includes(l.job as VitalJob))\n .map((l) => {\n const carried =\n decisionOf(l) === \"keep\" ? \"kept as in the proven ad\" : `carried by ${l.ours?.trim() || \"what of ours the concept names\"}`;\n return `${l.job === \"stop\" ? \"what stops the scroll\" : \"the proof\"}, \"${l.element}\": ${carried}`;\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 /** What the person rejected in earlier versions of this ad (`readCaseFile`). */\n rejected?: readonly string[];\n /** The company's rules this ad is held to, and its language (`acceptRepair`). */\n held?: { rules: readonly CreativeRule[]; language?: string };\n /** What the finished ad lost of its proven ad (`lostVital`): restored as the concept declares it. */\n restore?: readonly VitalJob[];\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(\n text,\n opts.findings,\n adSpecJsonSchema(),\n opts.rejected,\n restoreLines(before, opts.restore ?? []),\n );\n const repair = acceptRepair(\n before,\n await askAboutImages(RENDER_REVIEW_MODEL, shown ? [shown] : [], prompt, opts.onSpend, REPAIR_TIMEOUT_MS),\n opts.held,\n );\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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ChB;AACA,MAAI,KAAM,OAAM,iBAAiB,IAAI;AACvC;AAGA,SAAS,cAAc,QAA2B;AAChD,QAAM,QAAS,QAAgC;AAC/C,MAAI,CAAC,MAAM,QAAQ,KAAK,EAAG,QAAO,CAAC;AACnC,SAAO,MACJ,IAAI,CAAC,SAAU,MAA2B,EAAE,EAC5C,OAAO,CAAC,OAAqB,OAAO,OAAO,QAAQ;AACxD;AAGO,SAAS,qBAA2C;AACzD,MAAI;AACF,UAAM,QAAQ,0BAA0B;AACxC,WAAO,IAAI,cAAc,EAAE,SAAS,MAAM,KAAK,QAAQ,MAAM,OAAO,CAAC;AAAA,EACvE,SAAS,GAAG;AACV,UAAM,MAAM,aAAa,QAAQ,EAAE,UAAU,OAAO,CAAC;AACrD,YAAQ,OAAO,MAAM,gCAAgC,GAAG;AAAA,CAAK;AAC7D,WAAO;AAAA,EACT;AACF;AAEA,IAAM,QAAQ,CAAC,OAA8B,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,EAAE,CAAC;AAQ7F,eAAe,qBAAqB,QAAuB,SAA6C;AACtG,WAAS,UAAU,GAAG,UAAU,GAAG,WAAW;AAC5C,QAAI;AACF,YAAM,OAAO,UAAU,OAAO;AAC9B,aAAO;AAAA,IACT,QAAQ;AACN,UAAI,UAAU,EAAG,OAAM,MAAM,MAAM,KAAK,OAAO;AAAA,IACjD;AAAA,EACF;AACA,SAAO;AACT;","names":["readFile","path","readdir","rm","path","path","rm","mkdir","readFile","writeFile","path","path","readFile","res","mkdir","writeFile","mkdir","readFile","writeFile","path","path","said","readFile","mkdir","writeFile","existsSync","path","path","existsSync","said","readFile","path","said","sharp","nodesOf","sharp","pct","frame","nodesOf","refId","readFile","path","said","id","readFile","writeFile","sharp","z","z","path","said","readFile","sharp","writeFile","path","readFile","requested","held"]}
|