@koda-sl/baker-cli 0.570.0 → 0.571.0-dev.6a3439a0a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/account-EXGRZIXS.js +82 -0
- package/dist/account-JVDP5ERG.js +82 -0
- package/dist/account-reads-Z467VAL4.js +219 -0
- package/dist/account-users-342OZALE.js +64 -0
- package/dist/account-writes-KEXINJ5D.js +68 -0
- package/dist/accounts-QESGQJGZ.js +713 -0
- package/dist/accounts-QR6OQ3GC.js +119 -0
- package/dist/accounts-UWC2TT6R.js +80 -0
- package/dist/actions-NT3HXFFA.js +55 -0
- package/dist/activecampaign-EYRHDSXY.js +938 -0
- package/dist/ad-group-writes-SVR4RCKB.js +172 -0
- package/dist/ad-groups-C726HUXS.js +70 -0
- package/dist/ad-writes-RWJIWGEL.js +176 -0
- package/dist/add-EPOHDTUO.js +305 -0
- package/dist/add-NSW26HIM.js +107 -0
- package/dist/ads-3KK7VQPU.js +79 -0
- package/dist/ads-EWZGIC4T.js +48 -0
- package/dist/advertisers-AHOWL3YL.js +123 -0
- package/dist/analytics-7H6NDVUQ.js +447 -0
- package/dist/analytics-GFFXCMLV.js +2437 -0
- package/dist/animate-GTUI7XX4.js +480 -0
- package/dist/assign-SDPPWP3Q.js +80 -0
- package/dist/audience-size-LKDDHKED.js +76 -0
- package/dist/audiences-6L43K2T2.js +280 -0
- package/dist/audit-TSZIQTUB.js +154 -0
- package/dist/autocomplete-5BSAOAMZ.js +114 -0
- package/dist/avatars-S6RRD7M3.js +38 -0
- package/dist/bid-pricing-5KUAINH4.js +103 -0
- package/dist/brand-KFK2MQWW.js +22 -0
- package/dist/brief-6DV2PKAU.js +543 -0
- package/dist/campaign-groups-5RPZPDNW.js +99 -0
- package/dist/campaign-writes-FUIGN5OR.js +176 -0
- package/dist/campaign-writes-XMYBEVZF.js +168 -0
- package/dist/campaigns-5A3IE735.js +111 -0
- package/dist/campaigns-JNP3VDZK.js +113 -0
- package/dist/campaigns-N2SWSBYT.js +78 -0
- package/dist/canvas-CHFNQTLY.js +46 -0
- package/dist/capabilities-2W3SRZ2I.js +147 -0
- package/dist/catalog-6BER3SF7.js +66 -0
- package/dist/catalogs-G5NOKL4L.js +130 -0
- package/dist/changes-AS4RVEAL.js +167 -0
- package/dist/chatgpt-O6EEAYLF.js +47 -0
- package/dist/chats-4JLWMUAC.js +584 -0
- package/dist/check-BOKLY5WG.js +107 -0
- package/dist/chunk-3KUNRKNV.js +430 -0
- package/dist/chunk-3UNMVVSI.js +917 -0
- package/dist/chunk-3UNMVVSI.js.map +1 -0
- package/dist/chunk-4INBMXUS.js +930 -0
- package/dist/chunk-5NMKNHJI.js +46 -0
- package/dist/chunk-6D7WTUF3.js +98 -0
- package/dist/chunk-6DSPB6YA.js +7904 -0
- package/dist/chunk-6DSPB6YA.js.map +1 -0
- package/dist/chunk-6FQ7CJEX.js +57 -0
- package/dist/chunk-6OIKNJ7G.js +26 -0
- package/dist/chunk-6OZDN2FI.js +19 -0
- package/dist/chunk-75OGTGC4.js +89 -0
- package/dist/chunk-AXLKR3E4.js +66 -0
- package/dist/chunk-BEZEZHQ6.js +455 -0
- package/dist/chunk-BMK4F4CU.js +169 -0
- package/dist/chunk-C52Q3L4C.js +51 -0
- package/dist/chunk-CST52ZME.js +142 -0
- package/dist/chunk-CUTTTFAU.js +783 -0
- package/dist/chunk-D32EWSMB.js +150 -0
- package/dist/chunk-DW3H2XQA.js +91 -0
- package/dist/chunk-EAA273XW.js +2250 -0
- package/dist/chunk-EAA273XW.js.map +1 -0
- package/dist/chunk-EM5R3BYC.js +131 -0
- package/dist/chunk-EMR5KGNY.js +685 -0
- package/dist/chunk-EONUZOJV.js +962 -0
- package/dist/chunk-F3CZFUXZ.js +3187 -0
- package/dist/chunk-F3CZFUXZ.js.map +1 -0
- package/dist/chunk-GRX3JXSR.js +843 -0
- package/dist/chunk-H4RHZJ65.js +207 -0
- package/dist/chunk-HFIHXIYY.js +547 -0
- package/dist/chunk-HOA74TOS.js +249 -0
- package/dist/chunk-HQDNDKNR.js +5471 -0
- package/dist/chunk-HXSYWXLH.js +709 -0
- package/dist/chunk-I3QLWGKS.js +64 -0
- package/dist/chunk-IMS53EQU.js +4277 -0
- package/dist/chunk-IMS53EQU.js.map +1 -0
- package/dist/chunk-J4AWNWKN.js +1919 -0
- package/dist/chunk-JAK5VDSG.js +103 -0
- package/dist/chunk-JGSEHX2Q.js +3107 -0
- package/dist/chunk-JGSEHX2Q.js.map +1 -0
- package/dist/chunk-JLAFNORO.js +285 -0
- package/dist/chunk-KG5VNPKU.js +91 -0
- package/dist/chunk-KJHG2DWS.js +170 -0
- package/dist/chunk-LAMSUL26.js +1518 -0
- package/dist/chunk-LLTHDEM2.js +479 -0
- package/dist/chunk-M5PZ6QQB.js +312 -0
- package/dist/chunk-MFGUR5OD.js +334 -0
- package/dist/chunk-MZLPOYCC.js +10058 -0
- package/dist/chunk-MZLPOYCC.js.map +1 -0
- package/dist/chunk-NOCBNING.js +638 -0
- package/dist/chunk-NWLK5RPA.js +197 -0
- package/dist/chunk-PR5OPERY.js +167 -0
- package/dist/chunk-QGAUDVMR.js +148 -0
- package/dist/chunk-QRRAMUKV.js +468 -0
- package/dist/chunk-QZ4YHQLW.js +63 -0
- package/dist/chunk-RGLTITIH.js +494 -0
- package/dist/chunk-RIVQ4PQQ.js +225 -0
- package/dist/chunk-RLLPY62L.js +163 -0
- package/dist/chunk-RQHXWPET.js +61 -0
- package/dist/chunk-RULW4627.js +23 -0
- package/dist/chunk-S4RCF3YT.js +156 -0
- package/dist/chunk-SIKCVWM3.js +76 -0
- package/dist/chunk-TCLJRWST.js +831 -0
- package/dist/chunk-UVUY6FLV.js +1254 -0
- package/dist/chunk-V4HS5JRL.js +1320 -0
- package/dist/chunk-WTOBG3YL.js +392 -0
- package/dist/chunk-WYMX3F47.js +399 -0
- package/dist/chunk-WZXMZFVB.js +238 -0
- package/dist/chunk-X5YHMGAT.js +224 -0
- package/dist/chunk-X7USE7IA.js +24026 -0
- package/dist/chunk-X7USE7IA.js.map +1 -0
- package/dist/chunk-XA7JN7YE.js +297 -0
- package/dist/chunk-XHAGX4J4.js +604 -0
- package/dist/chunk-XY7W6MQN.js +274 -0
- package/dist/chunk-YAINUFSC.js +203 -0
- package/dist/chunk-Z5BG47PO.js +5752 -0
- package/dist/chunk-Z5BG47PO.js.map +1 -0
- package/dist/chunk-Z7ICQKC2.js +344 -0
- package/dist/chunk-ZBXV2KOQ.js +220 -0
- package/dist/chunk-ZMNRSTNV.js +454 -0
- package/dist/claim-L4WLCVUL.js +200 -0
- package/dist/cli.js +32 -32
- package/dist/companies-HW46BRQG.js +198 -0
- package/dist/company-KCIDE7SL.js +308 -0
- package/dist/complete-JXM25FVW.js +84 -0
- package/dist/connect-7TX7AAM5.js +45 -0
- package/dist/conversation-YIDUB6GL.js +96 -0
- package/dist/conversion-report-33SG7SHU.js +127 -0
- package/dist/conversion-upload-command-N3OMLLF2.js +439 -0
- package/dist/conversion-writes-XGGTBML5.js +122 -0
- package/dist/conversions-F4OZYUCT.js +140 -0
- package/dist/conversions-PPP4QK7U.js +78 -0
- package/dist/create-6EAKNERA.js +239 -0
- package/dist/create-772LZHZR.js +218 -0
- package/dist/create-FDNMIVFX.js +62 -0
- package/dist/create-X2QM7GA7.js +135 -0
- package/dist/creatives-K2AAW6EL.js +58 -0
- package/dist/creatives-SNYN4KIM.js +229 -0
- package/dist/credentials-KZZVBO42.js +290 -0
- package/dist/critique-G5QXRHPF.js +1451 -0
- package/dist/critique-PUHOJI7V.js +232 -0
- package/dist/crm-4LZZVT4N.js +229 -0
- package/dist/crm-M6NXDU5B.js +323 -0
- package/dist/currency-HK2ZW2VW.js +88 -0
- package/dist/customers-V5NT4W7X.js +65 -0
- package/dist/delete-GQIKNO53.js +57 -0
- package/dist/delete-LFZIPQEO.js +69 -0
- package/dist/delete-YOEI63OT.js +67 -0
- package/dist/demographics-CEQ74O74.js +141 -0
- package/dist/discard-5GDF3TP3.js +69 -0
- package/dist/discover-Q5PAOIQQ.js +172 -0
- package/dist/domain-PKOUPHHF.js +101 -0
- package/dist/download-2WNTN7JQ.js +172 -0
- package/dist/draft-CF4XNJG5.js +578 -0
- package/dist/draft-F4CVSL2I.js +332 -0
- package/dist/draft-L2NXCIYT.js +315 -0
- package/dist/draft-RZCTAOI2.js +374 -0
- package/dist/draft-UEVBUNKV.js +220 -0
- package/dist/engine/index.js +8 -8
- package/dist/experiments-DWC6L72S.js +236 -0
- package/dist/extract-6HJXSOZW.js +143 -0
- package/dist/facets-TBOXGYJT.js +117 -0
- package/dist/feedback-MSMFYAEY.js +114 -0
- package/dist/feedback-WAC6S42V.js +115 -0
- package/dist/feedback-record-XRQ2R2WD.js +269 -0
- package/dist/fetch-LGX7B3IC.js +204 -0
- package/dist/fit-RVWPRBNO.js +65 -0
- package/dist/flows-LA6EYMLS.js +340 -0
- package/dist/fonts-WRC34VSV.js +39 -0
- package/dist/forecast-6VHRGBJG.js +121 -0
- package/dist/forecast-OVKXBLJB.js +169 -0
- package/dist/funnel-U3GQIGND.js +397 -0
- package/dist/generate-Y4NJEYIH.js +263 -0
- package/dist/get-AHI247JG.js +82 -0
- package/dist/get-PF3HGECD.js +62 -0
- package/dist/google-BMUJKAUO.js +3300 -0
- package/dist/google-ZVAIFXQZ.js +163 -0
- package/dist/google-ads-6Z7P3SCD.js +198 -0
- package/dist/history-4QUV45ZJ.js +102 -0
- package/dist/history-PD7FCTDD.js +153 -0
- package/dist/history-VKRYKQ4C.js +69 -0
- package/dist/hubspot-WEFAFKVJ.js +814 -0
- package/dist/ideas-SMSEXKIA.js +45 -0
- package/dist/images-KAT4BPYV.js +92 -0
- package/dist/ingest-IHKTSJ4H.js +28 -0
- package/dist/ingest-TOHQ6MZA.js +131 -0
- package/dist/insights-3IPSEBYW.js +132 -0
- package/dist/inspect-5MZBPDYS.js +192 -0
- package/dist/intent-ZM4K623V.js +95 -0
- package/dist/keyword-gap-FAAF2I6V.js +130 -0
- package/dist/keyword-metrics-EXNJRJBY.js +200 -0
- package/dist/keywords-for-site-5LW77QWF.js +131 -0
- package/dist/landing-ZH4SD3DW.js +28 -0
- package/dist/languages-ZGDTERIQ.js +40 -0
- package/dist/leads-736RILZN.js +115 -0
- package/dist/learn-BESXWXEN.js +207 -0
- package/dist/line-item-writes-FA72DHNQ.js +211 -0
- package/dist/line-items-XVYE3IYT.js +107 -0
- package/dist/link-6FPKFVC3.js +67 -0
- package/dist/linkedin-TE6P4RYN.js +1344 -0
- package/dist/linkedin-person-TZJ6VEXE.js +139 -0
- package/dist/list-4R5EMKUQ.js +154 -0
- package/dist/list-MN2FPF3T.js +306 -0
- package/dist/list-ORO4WDF4.js +67 -0
- package/dist/locations-A65MFB7Q.js +69 -0
- package/dist/locations-WN6B3IJK.js +40 -0
- package/dist/log-ABBZLPRU.js +95 -0
- package/dist/make-QAFKU6WO.js +1367 -0
- package/dist/map-52P35OKE.js +445 -0
- package/dist/mcp-PZ3VBIF4.js +729 -0
- package/dist/media-sources-TT374PLN.js +35 -0
- package/dist/members-CF6VG6ZW.js +47 -0
- package/dist/metrics-3U3ZO2RF.js +152 -0
- package/dist/models-VOSJJFO2.js +155 -0
- package/dist/normalize-4LZCLMTQ.js +144 -0
- package/dist/options-6IRL7CL6.js +125 -0
- package/dist/organization-WMLLJE66.js +949 -0
- package/dist/performance-A7CYFBW2.js +5565 -0
- package/dist/performance-HYSTXLTS.js +27 -0
- package/dist/pixels-U6UA662G.js +62 -0
- package/dist/preview-76ZP2QA3.js +101 -0
- package/dist/promoted-tweet-writes-I5G4IDL5.js +183 -0
- package/dist/promoted-tweets-X5XNO7IT.js +119 -0
- package/dist/publish-S2Z4EF4H.js +350 -0
- package/dist/query-SAQADBM2.js +62 -0
- package/dist/reddit-S2L5WDY7.js +29 -0
- package/dist/refresh-K2YTJSH3.js +97 -0
- package/dist/release-FX76IIVN.js +63 -0
- package/dist/relevant-pages-KTSODNNW.js +99 -0
- package/dist/remove-LOVWPLDO.js +53 -0
- package/dist/reopen-DXV2Y6Z3.js +66 -0
- package/dist/rerun-TFQCRRFK.js +97 -0
- package/dist/research-7PGDAKC7.js +265 -0
- package/dist/research-HY5PSUCC.js +75 -0
- package/dist/reset-MEHUQJA4.js +57 -0
- package/dist/reset-Y5VZJRDQ.js +57 -0
- package/dist/resolve-FAVABEJW.js +124 -0
- package/dist/retry-5IY4MNDW.js +65 -0
- package/dist/retry-OMJ3C3AX.js +63 -0
- package/dist/revenue-S4KFZCOI.js +91 -0
- package/dist/rules-66IGR2KA.js +99 -0
- package/dist/rules-add-G7YGOYZJ.js +465 -0
- package/dist/run-LJVBH3JS.js +72 -0
- package/dist/run-XJBWDWN6.js +69 -0
- package/dist/scaffold-ad-GNMCB3QY.js +1513 -0
- package/dist/scaffold-static-ad-QIWKWURL.js +1013 -0
- package/dist/scaffold-static-ad-QIWKWURL.js.map +1 -0
- package/dist/scaffold-video-G6G2NPUF.js +885 -0
- package/dist/schedule-OX5XHXLH.js +64 -0
- package/dist/scheduled-agents-A5ZFQB5X.js +55 -0
- package/dist/schema-NTGHAPR2.js +135 -0
- package/dist/search-WCXQBMMM.js +177 -0
- package/dist/select-5ZD7FVBT.js +110 -0
- package/dist/set-prompt-NGCVMQIQ.js +199 -0
- package/dist/setup-links-4HCSF55G.js +144 -0
- package/dist/shopify-GDR5WGHH.js +4009 -0
- package/dist/site-B7LT6KAO.js +180 -0
- package/dist/sources-6DPUEROC.js +30 -0
- package/dist/sources-OSUXCLID.js +457 -0
- package/dist/stale-YKFKPPOH.js +90 -0
- package/dist/status-KIC3P5JV.js +65 -0
- package/dist/stock-VWFUFRYV.js +212 -0
- package/dist/studio-XLC37YGX.js +49 -0
- package/dist/sync-QBW4XH2H.js +57 -0
- package/dist/sync-definition-4KMJK46H.js +70 -0
- package/dist/tags-4F5UBPYG.js +227 -0
- package/dist/tags-4O5FPEEY.js +26 -0
- package/dist/tags-7RKKCQ4X.js +23 -0
- package/dist/tags-CB4MWI3A.js +23 -0
- package/dist/tags-QZJIP4LJ.js +23 -0
- package/dist/targeting-criteria-65UU7EYD.js +113 -0
- package/dist/targets-T742OPQI.js +106 -0
- package/dist/testimonials-HKJJXONO.js +32 -0
- package/dist/themes-Q6LVMEMF.js +95 -0
- package/dist/top-companies-T6AMU4C6.js +111 -0
- package/dist/transcript-DOUYMZAP.js +165 -0
- package/dist/translate-WKOXFZTQ.js +603 -0
- package/dist/triggers-EYY4GSUL.js +144 -0
- package/dist/unlink-JNM4WRZK.js +70 -0
- package/dist/unstage-QF4JT5YP.js +88 -0
- package/dist/update-6V3RBRIE.js +101 -0
- package/dist/update-J4DURR4K.js +192 -0
- package/dist/update-J7Y6LZC5.js +155 -0
- package/dist/update-MQ4NYIU6.js +66 -0
- package/dist/upload-CEIYYPID.js +137 -0
- package/dist/url-options-6WC2XQKB.js +131 -0
- package/dist/url-params-OVBIP6UA.js +101 -0
- package/dist/validate-UHXI2ESE.js +135 -0
- package/dist/videos-Z72RXCRB.js +41 -0
- package/dist/viewer-check-655BZRML.js +83 -0
- package/dist/web-4QN6QB7L.js +173 -0
- package/dist/winning-ads-2J2RIOLR.js +86 -0
- package/dist/write-commands-V7B4FBMX.js +1524 -0
- package/dist/x-7KXNCWTJ.js +47 -0
- package/package.json +1 -1
- package/dist/account-52WDLW4Z.js +0 -82
- package/dist/account-7KZ7MHMN.js +0 -82
- package/dist/account-reads-RXF37O4N.js +0 -219
- package/dist/account-users-NUI3ILRE.js +0 -64
- package/dist/account-writes-3BJSUM2V.js +0 -68
- package/dist/accounts-FLKNFDIE.js +0 -713
- package/dist/accounts-I2ZLR76R.js +0 -80
- package/dist/accounts-ZV4IXOF5.js +0 -119
- package/dist/actions-IR47GVZ6.js +0 -55
- package/dist/activecampaign-MNJYIWJL.js +0 -938
- package/dist/ad-group-writes-KU4QMQZP.js +0 -172
- package/dist/ad-groups-NMW2G32A.js +0 -70
- package/dist/ad-writes-7NOFTOM4.js +0 -176
- package/dist/add-4I25INAO.js +0 -107
- package/dist/add-QMTD6EGI.js +0 -305
- package/dist/ads-BT2DF3XN.js +0 -48
- package/dist/ads-P4Z3MLKS.js +0 -79
- package/dist/advertisers-LOIXTTGP.js +0 -123
- package/dist/analytics-6AHC3J4L.js +0 -447
- package/dist/analytics-NL2KGDLK.js +0 -2437
- package/dist/animate-VX7E7KJE.js +0 -480
- package/dist/assign-NKHIHVGI.js +0 -80
- package/dist/audience-size-WEOM6XIL.js +0 -76
- package/dist/audiences-P3SPTAJT.js +0 -280
- package/dist/audit-4RIBJ7BR.js +0 -154
- package/dist/autocomplete-FMTJDXTL.js +0 -114
- package/dist/avatars-LY5SFMWO.js +0 -38
- package/dist/bid-pricing-MQ7WLV5U.js +0 -103
- package/dist/brand-LR5IXW3W.js +0 -22
- package/dist/brief-4DSXIX3F.js +0 -543
- package/dist/campaign-groups-EZYLKMO2.js +0 -99
- package/dist/campaign-writes-P5XPFTRK.js +0 -176
- package/dist/campaign-writes-UMENYMKO.js +0 -168
- package/dist/campaigns-PP2DQMJE.js +0 -113
- package/dist/campaigns-SWZJVE2T.js +0 -78
- package/dist/campaigns-TAFDM242.js +0 -111
- package/dist/canvas-RKR3ZB4E.js +0 -46
- package/dist/capabilities-45RZ6E6W.js +0 -147
- package/dist/catalog-TOHUVBEU.js +0 -66
- package/dist/catalogs-V7PTEJBO.js +0 -130
- package/dist/changes-5OW3UYMF.js +0 -167
- package/dist/chatgpt-JBMYNVJB.js +0 -47
- package/dist/chats-VOLBYA3R.js +0 -584
- package/dist/check-4DI73QX4.js +0 -107
- package/dist/chunk-22RM3UOO.js +0 -63
- package/dist/chunk-2N7TB346.js +0 -5368
- package/dist/chunk-2N7TB346.js.map +0 -1
- package/dist/chunk-2Q7K4F4H.js +0 -7899
- package/dist/chunk-2Q7K4F4H.js.map +0 -1
- package/dist/chunk-2TS2ITSG.js +0 -392
- package/dist/chunk-2YXTXSYG.js +0 -454
- package/dist/chunk-2Z6PFHD2.js +0 -91
- package/dist/chunk-47VWQ7FQ.js +0 -843
- package/dist/chunk-4QFMRL6O.js +0 -455
- package/dist/chunk-5OC6VUDZ.js +0 -930
- package/dist/chunk-5VXEH72O.js +0 -249
- package/dist/chunk-B4BITHOD.js +0 -2235
- package/dist/chunk-B4BITHOD.js.map +0 -1
- package/dist/chunk-BFAPSFS7.js +0 -1518
- package/dist/chunk-BMMXYR7A.js +0 -238
- package/dist/chunk-BNEWJXKU.js +0 -638
- package/dist/chunk-BXTIG5JL.js +0 -66
- package/dist/chunk-C7KV5O5J.js +0 -274
- package/dist/chunk-CDPX6WAL.js +0 -207
- package/dist/chunk-COOJKEJE.js +0 -312
- package/dist/chunk-CTJWMZPL.js +0 -430
- package/dist/chunk-D5HD46VV.js +0 -163
- package/dist/chunk-EGICPBDY.js +0 -1920
- package/dist/chunk-EGICPBDY.js.map +0 -1
- package/dist/chunk-EKOMZH2S.js +0 -685
- package/dist/chunk-ELC42LJJ.js +0 -8954
- package/dist/chunk-ELC42LJJ.js.map +0 -1
- package/dist/chunk-G4FU6VC5.js +0 -23
- package/dist/chunk-H3RCEM6L.js +0 -61
- package/dist/chunk-H7LKYGLJ.js +0 -24026
- package/dist/chunk-H7LKYGLJ.js.map +0 -1
- package/dist/chunk-HI4SKWNW.js +0 -709
- package/dist/chunk-HM4NWA72.js +0 -5471
- package/dist/chunk-I33FO2ON.js +0 -170
- package/dist/chunk-IAE24RKD.js +0 -604
- package/dist/chunk-IGCS3X4F.js +0 -150
- package/dist/chunk-IJ6WA2JW.js +0 -148
- package/dist/chunk-ITIUWJGQ.js +0 -131
- package/dist/chunk-J4BJLHLQ.js +0 -3510
- package/dist/chunk-J4BJLHLQ.js.map +0 -1
- package/dist/chunk-JAC6JVCI.js +0 -26
- package/dist/chunk-JCDCIQMA.js +0 -479
- package/dist/chunk-JGK2FDZW.js +0 -1919
- package/dist/chunk-JSOOLOHP.js +0 -468
- package/dist/chunk-JT3UUBID.js +0 -142
- package/dist/chunk-KUI74TNG.js +0 -169
- package/dist/chunk-LAOCXV6Z.js +0 -98
- package/dist/chunk-LQACNCAV.js +0 -334
- package/dist/chunk-MC5F2L64.js +0 -962
- package/dist/chunk-MCJ5I5LR.js +0 -3187
- package/dist/chunk-MCJ5I5LR.js.map +0 -1
- package/dist/chunk-MKG57P2E.js +0 -783
- package/dist/chunk-MZPS46OR.js +0 -76
- package/dist/chunk-O2ECZKXP.js +0 -197
- package/dist/chunk-OJZKY5UM.js +0 -46
- package/dist/chunk-P4UCSXNA.js +0 -156
- package/dist/chunk-QLO4RNHU.js +0 -51
- package/dist/chunk-QSS34JWZ.js +0 -224
- package/dist/chunk-QVHZTCB5.js +0 -1254
- package/dist/chunk-RVIBHENP.js +0 -344
- package/dist/chunk-TEJOILEY.js +0 -203
- package/dist/chunk-TEQEZAJI.js +0 -1320
- package/dist/chunk-TNI7CN4L.js +0 -547
- package/dist/chunk-TPJ34LXX.js +0 -220
- package/dist/chunk-U6AWJIFP.js +0 -225
- package/dist/chunk-V5ODOBBI.js +0 -399
- package/dist/chunk-VAURJ4QJ.js +0 -89
- package/dist/chunk-VAV5CCDD.js +0 -167
- package/dist/chunk-VWHUO3AP.js +0 -103
- package/dist/chunk-W3TZPHZO.js +0 -285
- package/dist/chunk-WZATC4O5.js +0 -297
- package/dist/chunk-X25XRSDP.js +0 -57
- package/dist/chunk-XGG72YRO.js +0 -91
- package/dist/chunk-XHWHBGKX.js +0 -4277
- package/dist/chunk-XHWHBGKX.js.map +0 -1
- package/dist/chunk-XWAOECD2.js +0 -831
- package/dist/chunk-YDALLZNS.js +0 -494
- package/dist/chunk-Z3RGBLVJ.js +0 -64
- package/dist/chunk-Z5JWFNG4.js +0 -19
- package/dist/claim-3UMAFZEM.js +0 -200
- package/dist/companies-RL5A26AT.js +0 -198
- package/dist/company-DJ44F5C6.js +0 -308
- package/dist/complete-PGNIP3LN.js +0 -84
- package/dist/connect-ROARWN63.js +0 -45
- package/dist/conversation-GDFMJL7X.js +0 -96
- package/dist/conversion-report-2FREFML5.js +0 -127
- package/dist/conversion-upload-command-G7LLWHSK.js +0 -439
- package/dist/conversion-writes-JZIJSQ7T.js +0 -122
- package/dist/conversions-2IFWDQKK.js +0 -140
- package/dist/conversions-Q5EBTEXA.js +0 -78
- package/dist/create-B5DIYK5D.js +0 -218
- package/dist/create-BRCSXXFO.js +0 -239
- package/dist/create-PXAUL6FF.js +0 -62
- package/dist/create-R6CMATVY.js +0 -135
- package/dist/creatives-D6O6Z46U.js +0 -229
- package/dist/creatives-XNVWQWFF.js +0 -58
- package/dist/credentials-CLJO7WWY.js +0 -290
- package/dist/critique-MBMKW6SL.js +0 -1451
- package/dist/critique-OUJDTVMI.js +0 -232
- package/dist/crm-H5ITJ2RC.js +0 -229
- package/dist/crm-JJHYRABB.js +0 -323
- package/dist/currency-EFDQYW5B.js +0 -88
- package/dist/customers-C5YXAVXI.js +0 -65
- package/dist/delete-3GYCQK6B.js +0 -57
- package/dist/delete-NBUDIGSD.js +0 -69
- package/dist/delete-WZ3KVVX5.js +0 -67
- package/dist/demographics-O7AJW7DO.js +0 -141
- package/dist/discard-RMVZAX2J.js +0 -69
- package/dist/discover-BPUUWRBP.js +0 -172
- package/dist/domain-J3ZMBOHS.js +0 -101
- package/dist/download-ZVOGLTFB.js +0 -172
- package/dist/draft-6PJD3MCW.js +0 -374
- package/dist/draft-GCOCG4PO.js +0 -315
- package/dist/draft-Q4PEFBJB.js +0 -578
- package/dist/draft-TPR3DH5N.js +0 -220
- package/dist/draft-ZPGGWU7E.js +0 -332
- package/dist/experiments-MM4BYHRH.js +0 -236
- package/dist/extract-JMY6YRPW.js +0 -143
- package/dist/facets-B5AZAU2C.js +0 -117
- package/dist/feedback-2EVDGTEN.js +0 -115
- package/dist/feedback-4MCMOMVN.js +0 -114
- package/dist/feedback-record-DL7UEU2H.js +0 -269
- package/dist/fetch-JDNFK476.js +0 -204
- package/dist/fit-DKVH5BDW.js +0 -65
- package/dist/flows-LURTZICL.js +0 -340
- package/dist/fonts-HUXFDDAE.js +0 -39
- package/dist/forecast-ITLKAFHM.js +0 -169
- package/dist/forecast-UHTW4Y7Q.js +0 -121
- package/dist/funnel-QM7WFFMD.js +0 -397
- package/dist/generate-KAWRRYTT.js +0 -263
- package/dist/get-237TYJZT.js +0 -82
- package/dist/get-FWPR2YPC.js +0 -62
- package/dist/google-DTSLO3PT.js +0 -163
- package/dist/google-JY7KDAFC.js +0 -3300
- package/dist/google-ads-RZOQQDQN.js +0 -198
- package/dist/history-H7S7XRBX.js +0 -153
- package/dist/history-XL52537O.js +0 -102
- package/dist/history-YQSYXBJH.js +0 -69
- package/dist/hubspot-2DSISSUI.js +0 -814
- package/dist/ideas-2XBFQJ56.js +0 -45
- package/dist/images-VFRQ32G5.js +0 -92
- package/dist/ingest-4RPLN54K.js +0 -28
- package/dist/ingest-TPVH44VI.js +0 -131
- package/dist/insights-UVCFOB3N.js +0 -132
- package/dist/inspect-VD3GVXDU.js +0 -192
- package/dist/intent-F5NTOSQC.js +0 -95
- package/dist/keyword-gap-EB5QATYN.js +0 -130
- package/dist/keyword-metrics-PW2DDIJW.js +0 -200
- package/dist/keywords-for-site-JEPABY6E.js +0 -131
- package/dist/landing-4N6YSB4L.js +0 -28
- package/dist/languages-4S26FJDP.js +0 -40
- package/dist/leads-R5OZJQHW.js +0 -115
- package/dist/learn-AQ2FRFB7.js +0 -207
- package/dist/line-item-writes-LGO7HIJJ.js +0 -211
- package/dist/line-items-AAZVKQ7E.js +0 -107
- package/dist/link-7IGHVARH.js +0 -67
- package/dist/linkedin-UB2CW4KP.js +0 -1344
- package/dist/linkedin-person-D6U2ZAUW.js +0 -139
- package/dist/list-P44QRX2O.js +0 -154
- package/dist/list-UMJACDTQ.js +0 -67
- package/dist/list-VZKUHY4Y.js +0 -306
- package/dist/locations-UWBQLHXW.js +0 -40
- package/dist/locations-WXGOI3VV.js +0 -69
- package/dist/log-6ZKMUTYS.js +0 -95
- package/dist/make-5CEIJRBC.js +0 -1367
- package/dist/map-ZL4MQVJZ.js +0 -445
- package/dist/mcp-GSRYLRD4.js +0 -729
- package/dist/media-sources-VSPVHLYN.js +0 -35
- package/dist/members-L6SXP6GC.js +0 -47
- package/dist/metrics-4AFEEDVP.js +0 -152
- package/dist/models-2ZEM64H5.js +0 -155
- package/dist/normalize-GK7DH7ZP.js +0 -144
- package/dist/options-FDAAHG7C.js +0 -125
- package/dist/organization-K2FTFAAO.js +0 -949
- package/dist/performance-N3UROH7Z.js +0 -5565
- package/dist/performance-RG2HR46T.js +0 -27
- package/dist/pixels-HEI5WVAO.js +0 -62
- package/dist/preview-NVWIEUHF.js +0 -101
- package/dist/promoted-tweet-writes-7QZRFDOM.js +0 -183
- package/dist/promoted-tweets-V555Y7DN.js +0 -119
- package/dist/publish-5KR6YLA6.js +0 -350
- package/dist/query-K7MYBRTS.js +0 -62
- package/dist/reddit-XPQ7YAJW.js +0 -29
- package/dist/refresh-XFHEBSDU.js +0 -97
- package/dist/release-3ECEF26P.js +0 -63
- package/dist/relevant-pages-XYQKVX3U.js +0 -99
- package/dist/remove-OCTUC3RB.js +0 -53
- package/dist/reopen-JRI3TYD4.js +0 -66
- package/dist/rerun-HWWYCDT2.js +0 -97
- package/dist/research-ODPU62BA.js +0 -265
- package/dist/research-TG5CBTYP.js +0 -75
- package/dist/reset-J2NLNITD.js +0 -57
- package/dist/reset-SRU7YJUR.js +0 -57
- package/dist/resolve-KHMMUGB2.js +0 -124
- package/dist/retry-VLH4AO7F.js +0 -65
- package/dist/retry-WP7LWKZF.js +0 -63
- package/dist/revenue-EEIS2AV5.js +0 -91
- package/dist/rules-TTUGQAEB.js +0 -99
- package/dist/rules-add-AIXUAZXG.js +0 -465
- package/dist/run-AQTACLY6.js +0 -69
- package/dist/run-YA6IWQAJ.js +0 -72
- package/dist/scaffold-ad-IYNFJPT7.js +0 -1513
- package/dist/scaffold-static-ad-SPYKSAJR.js +0 -1012
- package/dist/scaffold-static-ad-SPYKSAJR.js.map +0 -1
- package/dist/scaffold-video-BUN27PKS.js +0 -885
- package/dist/schedule-EH2MOC5C.js +0 -64
- package/dist/scheduled-agents-DTAEP25E.js +0 -55
- package/dist/schema-7B4MVVAS.js +0 -135
- package/dist/search-ZZWIJRXJ.js +0 -177
- package/dist/select-LWZRF7KV.js +0 -110
- package/dist/set-prompt-YKDH6FYK.js +0 -199
- package/dist/setup-links-OE6PC2YQ.js +0 -144
- package/dist/shopify-CCPLZI2H.js +0 -4009
- package/dist/site-FW5BBLYG.js +0 -180
- package/dist/sources-WPHMWBEK.js +0 -30
- package/dist/sources-X77TGJ52.js +0 -457
- package/dist/stale-SPCDL73V.js +0 -90
- package/dist/status-FLETGJ2A.js +0 -65
- package/dist/stock-5AOSQH52.js +0 -212
- package/dist/studio-4EV5S7PR.js +0 -49
- package/dist/sync-363VKXU3.js +0 -57
- package/dist/sync-definition-ZDE5L644.js +0 -70
- package/dist/tags-6MN3AWKN.js +0 -23
- package/dist/tags-VOKUNEIW.js +0 -227
- package/dist/tags-Y6MNMIEA.js +0 -23
- package/dist/tags-YHAC3NVY.js +0 -23
- package/dist/tags-ZCQMJ5YH.js +0 -26
- package/dist/targeting-criteria-ECQFHQF3.js +0 -113
- package/dist/targets-U2JHTB5U.js +0 -106
- package/dist/testimonials-IDVLMXDT.js +0 -32
- package/dist/themes-QMR5TWTI.js +0 -95
- package/dist/top-companies-CBI4O3ZB.js +0 -111
- package/dist/transcript-IIRFTFRW.js +0 -165
- package/dist/translate-N6QW4FZB.js +0 -603
- package/dist/triggers-Q3KRAMA3.js +0 -144
- package/dist/unlink-7RVQXKAR.js +0 -70
- package/dist/unstage-3LPHNZKR.js +0 -88
- package/dist/update-AL3LBHGK.js +0 -192
- package/dist/update-AWR7EHGA.js +0 -155
- package/dist/update-LNSSLZXG.js +0 -66
- package/dist/update-YBTFH5MN.js +0 -101
- package/dist/upload-45GCGMA5.js +0 -137
- package/dist/url-options-AHJPR5VY.js +0 -131
- package/dist/url-params-U6ZM4LL2.js +0 -101
- package/dist/validate-S325RXPH.js +0 -135
- package/dist/videos-NW2UP342.js +0 -41
- package/dist/viewer-check-IDXFRRCO.js +0 -83
- package/dist/web-VMPKMBKA.js +0 -173
- package/dist/winning-ads-7UJXCWFH.js +0 -86
- package/dist/write-commands-R42DQEW6.js +0 -1524
- package/dist/x-UGTUOCVR.js +0 -47
- /package/dist/{account-7KZ7MHMN.js.map → account-EXGRZIXS.js.map} +0 -0
- /package/dist/{account-52WDLW4Z.js.map → account-JVDP5ERG.js.map} +0 -0
- /package/dist/{account-reads-RXF37O4N.js.map → account-reads-Z467VAL4.js.map} +0 -0
- /package/dist/{account-users-NUI3ILRE.js.map → account-users-342OZALE.js.map} +0 -0
- /package/dist/{account-writes-3BJSUM2V.js.map → account-writes-KEXINJ5D.js.map} +0 -0
- /package/dist/{accounts-FLKNFDIE.js.map → accounts-QESGQJGZ.js.map} +0 -0
- /package/dist/{accounts-ZV4IXOF5.js.map → accounts-QR6OQ3GC.js.map} +0 -0
- /package/dist/{accounts-I2ZLR76R.js.map → accounts-UWC2TT6R.js.map} +0 -0
- /package/dist/{actions-IR47GVZ6.js.map → actions-NT3HXFFA.js.map} +0 -0
- /package/dist/{activecampaign-MNJYIWJL.js.map → activecampaign-EYRHDSXY.js.map} +0 -0
- /package/dist/{ad-group-writes-KU4QMQZP.js.map → ad-group-writes-SVR4RCKB.js.map} +0 -0
- /package/dist/{ad-groups-NMW2G32A.js.map → ad-groups-C726HUXS.js.map} +0 -0
- /package/dist/{ad-writes-7NOFTOM4.js.map → ad-writes-RWJIWGEL.js.map} +0 -0
- /package/dist/{add-QMTD6EGI.js.map → add-EPOHDTUO.js.map} +0 -0
- /package/dist/{add-4I25INAO.js.map → add-NSW26HIM.js.map} +0 -0
- /package/dist/{ads-P4Z3MLKS.js.map → ads-3KK7VQPU.js.map} +0 -0
- /package/dist/{ads-BT2DF3XN.js.map → ads-EWZGIC4T.js.map} +0 -0
- /package/dist/{advertisers-LOIXTTGP.js.map → advertisers-AHOWL3YL.js.map} +0 -0
- /package/dist/{analytics-6AHC3J4L.js.map → analytics-7H6NDVUQ.js.map} +0 -0
- /package/dist/{analytics-NL2KGDLK.js.map → analytics-GFFXCMLV.js.map} +0 -0
- /package/dist/{animate-VX7E7KJE.js.map → animate-GTUI7XX4.js.map} +0 -0
- /package/dist/{assign-NKHIHVGI.js.map → assign-SDPPWP3Q.js.map} +0 -0
- /package/dist/{audience-size-WEOM6XIL.js.map → audience-size-LKDDHKED.js.map} +0 -0
- /package/dist/{audiences-P3SPTAJT.js.map → audiences-6L43K2T2.js.map} +0 -0
- /package/dist/{audit-4RIBJ7BR.js.map → audit-TSZIQTUB.js.map} +0 -0
- /package/dist/{autocomplete-FMTJDXTL.js.map → autocomplete-5BSAOAMZ.js.map} +0 -0
- /package/dist/{avatars-LY5SFMWO.js.map → avatars-S6RRD7M3.js.map} +0 -0
- /package/dist/{bid-pricing-MQ7WLV5U.js.map → bid-pricing-5KUAINH4.js.map} +0 -0
- /package/dist/{brand-LR5IXW3W.js.map → brand-KFK2MQWW.js.map} +0 -0
- /package/dist/{brief-4DSXIX3F.js.map → brief-6DV2PKAU.js.map} +0 -0
- /package/dist/{campaign-groups-EZYLKMO2.js.map → campaign-groups-5RPZPDNW.js.map} +0 -0
- /package/dist/{campaign-writes-P5XPFTRK.js.map → campaign-writes-FUIGN5OR.js.map} +0 -0
- /package/dist/{campaign-writes-UMENYMKO.js.map → campaign-writes-XMYBEVZF.js.map} +0 -0
- /package/dist/{campaigns-TAFDM242.js.map → campaigns-5A3IE735.js.map} +0 -0
- /package/dist/{campaigns-PP2DQMJE.js.map → campaigns-JNP3VDZK.js.map} +0 -0
- /package/dist/{campaigns-SWZJVE2T.js.map → campaigns-N2SWSBYT.js.map} +0 -0
- /package/dist/{canvas-RKR3ZB4E.js.map → canvas-CHFNQTLY.js.map} +0 -0
- /package/dist/{capabilities-45RZ6E6W.js.map → capabilities-2W3SRZ2I.js.map} +0 -0
- /package/dist/{catalog-TOHUVBEU.js.map → catalog-6BER3SF7.js.map} +0 -0
- /package/dist/{catalogs-V7PTEJBO.js.map → catalogs-G5NOKL4L.js.map} +0 -0
- /package/dist/{changes-5OW3UYMF.js.map → changes-AS4RVEAL.js.map} +0 -0
- /package/dist/{chatgpt-JBMYNVJB.js.map → chatgpt-O6EEAYLF.js.map} +0 -0
- /package/dist/{chats-VOLBYA3R.js.map → chats-4JLWMUAC.js.map} +0 -0
- /package/dist/{check-4DI73QX4.js.map → check-BOKLY5WG.js.map} +0 -0
- /package/dist/{chunk-CTJWMZPL.js.map → chunk-3KUNRKNV.js.map} +0 -0
- /package/dist/{chunk-5OC6VUDZ.js.map → chunk-4INBMXUS.js.map} +0 -0
- /package/dist/{chunk-OJZKY5UM.js.map → chunk-5NMKNHJI.js.map} +0 -0
- /package/dist/{chunk-LAOCXV6Z.js.map → chunk-6D7WTUF3.js.map} +0 -0
- /package/dist/{chunk-X25XRSDP.js.map → chunk-6FQ7CJEX.js.map} +0 -0
- /package/dist/{chunk-JAC6JVCI.js.map → chunk-6OIKNJ7G.js.map} +0 -0
- /package/dist/{chunk-Z5JWFNG4.js.map → chunk-6OZDN2FI.js.map} +0 -0
- /package/dist/{chunk-VAURJ4QJ.js.map → chunk-75OGTGC4.js.map} +0 -0
- /package/dist/{chunk-BXTIG5JL.js.map → chunk-AXLKR3E4.js.map} +0 -0
- /package/dist/{chunk-4QFMRL6O.js.map → chunk-BEZEZHQ6.js.map} +0 -0
- /package/dist/{chunk-KUI74TNG.js.map → chunk-BMK4F4CU.js.map} +0 -0
- /package/dist/{chunk-QLO4RNHU.js.map → chunk-C52Q3L4C.js.map} +0 -0
- /package/dist/{chunk-JT3UUBID.js.map → chunk-CST52ZME.js.map} +0 -0
- /package/dist/{chunk-MKG57P2E.js.map → chunk-CUTTTFAU.js.map} +0 -0
- /package/dist/{chunk-IGCS3X4F.js.map → chunk-D32EWSMB.js.map} +0 -0
- /package/dist/{chunk-XGG72YRO.js.map → chunk-DW3H2XQA.js.map} +0 -0
- /package/dist/{chunk-ITIUWJGQ.js.map → chunk-EM5R3BYC.js.map} +0 -0
- /package/dist/{chunk-EKOMZH2S.js.map → chunk-EMR5KGNY.js.map} +0 -0
- /package/dist/{chunk-MC5F2L64.js.map → chunk-EONUZOJV.js.map} +0 -0
- /package/dist/{chunk-47VWQ7FQ.js.map → chunk-GRX3JXSR.js.map} +0 -0
- /package/dist/{chunk-CDPX6WAL.js.map → chunk-H4RHZJ65.js.map} +0 -0
- /package/dist/{chunk-TNI7CN4L.js.map → chunk-HFIHXIYY.js.map} +0 -0
- /package/dist/{chunk-5VXEH72O.js.map → chunk-HOA74TOS.js.map} +0 -0
- /package/dist/{chunk-HM4NWA72.js.map → chunk-HQDNDKNR.js.map} +0 -0
- /package/dist/{chunk-HI4SKWNW.js.map → chunk-HXSYWXLH.js.map} +0 -0
- /package/dist/{chunk-Z3RGBLVJ.js.map → chunk-I3QLWGKS.js.map} +0 -0
- /package/dist/{chunk-JGK2FDZW.js.map → chunk-J4AWNWKN.js.map} +0 -0
- /package/dist/{chunk-VWHUO3AP.js.map → chunk-JAK5VDSG.js.map} +0 -0
- /package/dist/{chunk-W3TZPHZO.js.map → chunk-JLAFNORO.js.map} +0 -0
- /package/dist/{chunk-2Z6PFHD2.js.map → chunk-KG5VNPKU.js.map} +0 -0
- /package/dist/{chunk-I33FO2ON.js.map → chunk-KJHG2DWS.js.map} +0 -0
- /package/dist/{chunk-BFAPSFS7.js.map → chunk-LAMSUL26.js.map} +0 -0
- /package/dist/{chunk-JCDCIQMA.js.map → chunk-LLTHDEM2.js.map} +0 -0
- /package/dist/{chunk-COOJKEJE.js.map → chunk-M5PZ6QQB.js.map} +0 -0
- /package/dist/{chunk-LQACNCAV.js.map → chunk-MFGUR5OD.js.map} +0 -0
- /package/dist/{chunk-BNEWJXKU.js.map → chunk-NOCBNING.js.map} +0 -0
- /package/dist/{chunk-O2ECZKXP.js.map → chunk-NWLK5RPA.js.map} +0 -0
- /package/dist/{chunk-VAV5CCDD.js.map → chunk-PR5OPERY.js.map} +0 -0
- /package/dist/{chunk-IJ6WA2JW.js.map → chunk-QGAUDVMR.js.map} +0 -0
- /package/dist/{chunk-JSOOLOHP.js.map → chunk-QRRAMUKV.js.map} +0 -0
- /package/dist/{chunk-22RM3UOO.js.map → chunk-QZ4YHQLW.js.map} +0 -0
- /package/dist/{chunk-YDALLZNS.js.map → chunk-RGLTITIH.js.map} +0 -0
- /package/dist/{chunk-U6AWJIFP.js.map → chunk-RIVQ4PQQ.js.map} +0 -0
- /package/dist/{chunk-D5HD46VV.js.map → chunk-RLLPY62L.js.map} +0 -0
- /package/dist/{chunk-H3RCEM6L.js.map → chunk-RQHXWPET.js.map} +0 -0
- /package/dist/{chunk-G4FU6VC5.js.map → chunk-RULW4627.js.map} +0 -0
- /package/dist/{chunk-P4UCSXNA.js.map → chunk-S4RCF3YT.js.map} +0 -0
- /package/dist/{chunk-MZPS46OR.js.map → chunk-SIKCVWM3.js.map} +0 -0
- /package/dist/{chunk-XWAOECD2.js.map → chunk-TCLJRWST.js.map} +0 -0
- /package/dist/{chunk-QVHZTCB5.js.map → chunk-UVUY6FLV.js.map} +0 -0
- /package/dist/{chunk-TEQEZAJI.js.map → chunk-V4HS5JRL.js.map} +0 -0
- /package/dist/{chunk-2TS2ITSG.js.map → chunk-WTOBG3YL.js.map} +0 -0
- /package/dist/{chunk-V5ODOBBI.js.map → chunk-WYMX3F47.js.map} +0 -0
- /package/dist/{chunk-BMMXYR7A.js.map → chunk-WZXMZFVB.js.map} +0 -0
- /package/dist/{chunk-QSS34JWZ.js.map → chunk-X5YHMGAT.js.map} +0 -0
- /package/dist/{chunk-WZATC4O5.js.map → chunk-XA7JN7YE.js.map} +0 -0
- /package/dist/{chunk-IAE24RKD.js.map → chunk-XHAGX4J4.js.map} +0 -0
- /package/dist/{chunk-C7KV5O5J.js.map → chunk-XY7W6MQN.js.map} +0 -0
- /package/dist/{chunk-TEJOILEY.js.map → chunk-YAINUFSC.js.map} +0 -0
- /package/dist/{chunk-RVIBHENP.js.map → chunk-Z7ICQKC2.js.map} +0 -0
- /package/dist/{chunk-TPJ34LXX.js.map → chunk-ZBXV2KOQ.js.map} +0 -0
- /package/dist/{chunk-2YXTXSYG.js.map → chunk-ZMNRSTNV.js.map} +0 -0
- /package/dist/{claim-3UMAFZEM.js.map → claim-L4WLCVUL.js.map} +0 -0
- /package/dist/{companies-RL5A26AT.js.map → companies-HW46BRQG.js.map} +0 -0
- /package/dist/{company-DJ44F5C6.js.map → company-KCIDE7SL.js.map} +0 -0
- /package/dist/{complete-PGNIP3LN.js.map → complete-JXM25FVW.js.map} +0 -0
- /package/dist/{connect-ROARWN63.js.map → connect-7TX7AAM5.js.map} +0 -0
- /package/dist/{conversation-GDFMJL7X.js.map → conversation-YIDUB6GL.js.map} +0 -0
- /package/dist/{conversion-report-2FREFML5.js.map → conversion-report-33SG7SHU.js.map} +0 -0
- /package/dist/{conversion-upload-command-G7LLWHSK.js.map → conversion-upload-command-N3OMLLF2.js.map} +0 -0
- /package/dist/{conversion-writes-JZIJSQ7T.js.map → conversion-writes-XGGTBML5.js.map} +0 -0
- /package/dist/{conversions-2IFWDQKK.js.map → conversions-F4OZYUCT.js.map} +0 -0
- /package/dist/{conversions-Q5EBTEXA.js.map → conversions-PPP4QK7U.js.map} +0 -0
- /package/dist/{create-BRCSXXFO.js.map → create-6EAKNERA.js.map} +0 -0
- /package/dist/{create-B5DIYK5D.js.map → create-772LZHZR.js.map} +0 -0
- /package/dist/{create-PXAUL6FF.js.map → create-FDNMIVFX.js.map} +0 -0
- /package/dist/{create-R6CMATVY.js.map → create-X2QM7GA7.js.map} +0 -0
- /package/dist/{creatives-XNVWQWFF.js.map → creatives-K2AAW6EL.js.map} +0 -0
- /package/dist/{creatives-D6O6Z46U.js.map → creatives-SNYN4KIM.js.map} +0 -0
- /package/dist/{credentials-CLJO7WWY.js.map → credentials-KZZVBO42.js.map} +0 -0
- /package/dist/{critique-MBMKW6SL.js.map → critique-G5QXRHPF.js.map} +0 -0
- /package/dist/{critique-OUJDTVMI.js.map → critique-PUHOJI7V.js.map} +0 -0
- /package/dist/{crm-H5ITJ2RC.js.map → crm-4LZZVT4N.js.map} +0 -0
- /package/dist/{crm-JJHYRABB.js.map → crm-M6NXDU5B.js.map} +0 -0
- /package/dist/{currency-EFDQYW5B.js.map → currency-HK2ZW2VW.js.map} +0 -0
- /package/dist/{customers-C5YXAVXI.js.map → customers-V5NT4W7X.js.map} +0 -0
- /package/dist/{delete-3GYCQK6B.js.map → delete-GQIKNO53.js.map} +0 -0
- /package/dist/{delete-NBUDIGSD.js.map → delete-LFZIPQEO.js.map} +0 -0
- /package/dist/{delete-WZ3KVVX5.js.map → delete-YOEI63OT.js.map} +0 -0
- /package/dist/{demographics-O7AJW7DO.js.map → demographics-CEQ74O74.js.map} +0 -0
- /package/dist/{discard-RMVZAX2J.js.map → discard-5GDF3TP3.js.map} +0 -0
- /package/dist/{discover-BPUUWRBP.js.map → discover-Q5PAOIQQ.js.map} +0 -0
- /package/dist/{domain-J3ZMBOHS.js.map → domain-PKOUPHHF.js.map} +0 -0
- /package/dist/{download-ZVOGLTFB.js.map → download-2WNTN7JQ.js.map} +0 -0
- /package/dist/{draft-Q4PEFBJB.js.map → draft-CF4XNJG5.js.map} +0 -0
- /package/dist/{draft-ZPGGWU7E.js.map → draft-F4CVSL2I.js.map} +0 -0
- /package/dist/{draft-GCOCG4PO.js.map → draft-L2NXCIYT.js.map} +0 -0
- /package/dist/{draft-6PJD3MCW.js.map → draft-RZCTAOI2.js.map} +0 -0
- /package/dist/{draft-TPR3DH5N.js.map → draft-UEVBUNKV.js.map} +0 -0
- /package/dist/{experiments-MM4BYHRH.js.map → experiments-DWC6L72S.js.map} +0 -0
- /package/dist/{extract-JMY6YRPW.js.map → extract-6HJXSOZW.js.map} +0 -0
- /package/dist/{facets-B5AZAU2C.js.map → facets-TBOXGYJT.js.map} +0 -0
- /package/dist/{feedback-4MCMOMVN.js.map → feedback-MSMFYAEY.js.map} +0 -0
- /package/dist/{feedback-2EVDGTEN.js.map → feedback-WAC6S42V.js.map} +0 -0
- /package/dist/{feedback-record-DL7UEU2H.js.map → feedback-record-XRQ2R2WD.js.map} +0 -0
- /package/dist/{fetch-JDNFK476.js.map → fetch-LGX7B3IC.js.map} +0 -0
- /package/dist/{fit-DKVH5BDW.js.map → fit-RVWPRBNO.js.map} +0 -0
- /package/dist/{flows-LURTZICL.js.map → flows-LA6EYMLS.js.map} +0 -0
- /package/dist/{fonts-HUXFDDAE.js.map → fonts-WRC34VSV.js.map} +0 -0
- /package/dist/{forecast-UHTW4Y7Q.js.map → forecast-6VHRGBJG.js.map} +0 -0
- /package/dist/{forecast-ITLKAFHM.js.map → forecast-OVKXBLJB.js.map} +0 -0
- /package/dist/{funnel-QM7WFFMD.js.map → funnel-U3GQIGND.js.map} +0 -0
- /package/dist/{generate-KAWRRYTT.js.map → generate-Y4NJEYIH.js.map} +0 -0
- /package/dist/{get-237TYJZT.js.map → get-AHI247JG.js.map} +0 -0
- /package/dist/{get-FWPR2YPC.js.map → get-PF3HGECD.js.map} +0 -0
- /package/dist/{google-JY7KDAFC.js.map → google-BMUJKAUO.js.map} +0 -0
- /package/dist/{google-DTSLO3PT.js.map → google-ZVAIFXQZ.js.map} +0 -0
- /package/dist/{google-ads-RZOQQDQN.js.map → google-ads-6Z7P3SCD.js.map} +0 -0
- /package/dist/{history-XL52537O.js.map → history-4QUV45ZJ.js.map} +0 -0
- /package/dist/{history-H7S7XRBX.js.map → history-PD7FCTDD.js.map} +0 -0
- /package/dist/{history-YQSYXBJH.js.map → history-VKRYKQ4C.js.map} +0 -0
- /package/dist/{hubspot-2DSISSUI.js.map → hubspot-WEFAFKVJ.js.map} +0 -0
- /package/dist/{ideas-2XBFQJ56.js.map → ideas-SMSEXKIA.js.map} +0 -0
- /package/dist/{images-VFRQ32G5.js.map → images-KAT4BPYV.js.map} +0 -0
- /package/dist/{ingest-4RPLN54K.js.map → ingest-IHKTSJ4H.js.map} +0 -0
- /package/dist/{ingest-TPVH44VI.js.map → ingest-TOHQ6MZA.js.map} +0 -0
- /package/dist/{insights-UVCFOB3N.js.map → insights-3IPSEBYW.js.map} +0 -0
- /package/dist/{inspect-VD3GVXDU.js.map → inspect-5MZBPDYS.js.map} +0 -0
- /package/dist/{intent-F5NTOSQC.js.map → intent-ZM4K623V.js.map} +0 -0
- /package/dist/{keyword-gap-EB5QATYN.js.map → keyword-gap-FAAF2I6V.js.map} +0 -0
- /package/dist/{keyword-metrics-PW2DDIJW.js.map → keyword-metrics-EXNJRJBY.js.map} +0 -0
- /package/dist/{keywords-for-site-JEPABY6E.js.map → keywords-for-site-5LW77QWF.js.map} +0 -0
- /package/dist/{landing-4N6YSB4L.js.map → landing-ZH4SD3DW.js.map} +0 -0
- /package/dist/{languages-4S26FJDP.js.map → languages-ZGDTERIQ.js.map} +0 -0
- /package/dist/{leads-R5OZJQHW.js.map → leads-736RILZN.js.map} +0 -0
- /package/dist/{learn-AQ2FRFB7.js.map → learn-BESXWXEN.js.map} +0 -0
- /package/dist/{line-item-writes-LGO7HIJJ.js.map → line-item-writes-FA72DHNQ.js.map} +0 -0
- /package/dist/{line-items-AAZVKQ7E.js.map → line-items-XVYE3IYT.js.map} +0 -0
- /package/dist/{link-7IGHVARH.js.map → link-6FPKFVC3.js.map} +0 -0
- /package/dist/{linkedin-UB2CW4KP.js.map → linkedin-TE6P4RYN.js.map} +0 -0
- /package/dist/{linkedin-person-D6U2ZAUW.js.map → linkedin-person-TZJ6VEXE.js.map} +0 -0
- /package/dist/{list-P44QRX2O.js.map → list-4R5EMKUQ.js.map} +0 -0
- /package/dist/{list-VZKUHY4Y.js.map → list-MN2FPF3T.js.map} +0 -0
- /package/dist/{list-UMJACDTQ.js.map → list-ORO4WDF4.js.map} +0 -0
- /package/dist/{locations-WXGOI3VV.js.map → locations-A65MFB7Q.js.map} +0 -0
- /package/dist/{locations-UWBQLHXW.js.map → locations-WN6B3IJK.js.map} +0 -0
- /package/dist/{log-6ZKMUTYS.js.map → log-ABBZLPRU.js.map} +0 -0
- /package/dist/{make-5CEIJRBC.js.map → make-QAFKU6WO.js.map} +0 -0
- /package/dist/{map-ZL4MQVJZ.js.map → map-52P35OKE.js.map} +0 -0
- /package/dist/{mcp-GSRYLRD4.js.map → mcp-PZ3VBIF4.js.map} +0 -0
- /package/dist/{media-sources-VSPVHLYN.js.map → media-sources-TT374PLN.js.map} +0 -0
- /package/dist/{members-L6SXP6GC.js.map → members-CF6VG6ZW.js.map} +0 -0
- /package/dist/{metrics-4AFEEDVP.js.map → metrics-3U3ZO2RF.js.map} +0 -0
- /package/dist/{models-2ZEM64H5.js.map → models-VOSJJFO2.js.map} +0 -0
- /package/dist/{normalize-GK7DH7ZP.js.map → normalize-4LZCLMTQ.js.map} +0 -0
- /package/dist/{options-FDAAHG7C.js.map → options-6IRL7CL6.js.map} +0 -0
- /package/dist/{organization-K2FTFAAO.js.map → organization-WMLLJE66.js.map} +0 -0
- /package/dist/{performance-N3UROH7Z.js.map → performance-A7CYFBW2.js.map} +0 -0
- /package/dist/{performance-RG2HR46T.js.map → performance-HYSTXLTS.js.map} +0 -0
- /package/dist/{pixels-HEI5WVAO.js.map → pixels-U6UA662G.js.map} +0 -0
- /package/dist/{preview-NVWIEUHF.js.map → preview-76ZP2QA3.js.map} +0 -0
- /package/dist/{promoted-tweet-writes-7QZRFDOM.js.map → promoted-tweet-writes-I5G4IDL5.js.map} +0 -0
- /package/dist/{promoted-tweets-V555Y7DN.js.map → promoted-tweets-X5XNO7IT.js.map} +0 -0
- /package/dist/{publish-5KR6YLA6.js.map → publish-S2Z4EF4H.js.map} +0 -0
- /package/dist/{query-K7MYBRTS.js.map → query-SAQADBM2.js.map} +0 -0
- /package/dist/{reddit-XPQ7YAJW.js.map → reddit-S2L5WDY7.js.map} +0 -0
- /package/dist/{refresh-XFHEBSDU.js.map → refresh-K2YTJSH3.js.map} +0 -0
- /package/dist/{release-3ECEF26P.js.map → release-FX76IIVN.js.map} +0 -0
- /package/dist/{relevant-pages-XYQKVX3U.js.map → relevant-pages-KTSODNNW.js.map} +0 -0
- /package/dist/{remove-OCTUC3RB.js.map → remove-LOVWPLDO.js.map} +0 -0
- /package/dist/{reopen-JRI3TYD4.js.map → reopen-DXV2Y6Z3.js.map} +0 -0
- /package/dist/{rerun-HWWYCDT2.js.map → rerun-TFQCRRFK.js.map} +0 -0
- /package/dist/{research-ODPU62BA.js.map → research-7PGDAKC7.js.map} +0 -0
- /package/dist/{research-TG5CBTYP.js.map → research-HY5PSUCC.js.map} +0 -0
- /package/dist/{reset-SRU7YJUR.js.map → reset-MEHUQJA4.js.map} +0 -0
- /package/dist/{reset-J2NLNITD.js.map → reset-Y5VZJRDQ.js.map} +0 -0
- /package/dist/{resolve-KHMMUGB2.js.map → resolve-FAVABEJW.js.map} +0 -0
- /package/dist/{retry-VLH4AO7F.js.map → retry-5IY4MNDW.js.map} +0 -0
- /package/dist/{retry-WP7LWKZF.js.map → retry-OMJ3C3AX.js.map} +0 -0
- /package/dist/{revenue-EEIS2AV5.js.map → revenue-S4KFZCOI.js.map} +0 -0
- /package/dist/{rules-TTUGQAEB.js.map → rules-66IGR2KA.js.map} +0 -0
- /package/dist/{rules-add-AIXUAZXG.js.map → rules-add-G7YGOYZJ.js.map} +0 -0
- /package/dist/{run-YA6IWQAJ.js.map → run-LJVBH3JS.js.map} +0 -0
- /package/dist/{run-AQTACLY6.js.map → run-XJBWDWN6.js.map} +0 -0
- /package/dist/{scaffold-ad-IYNFJPT7.js.map → scaffold-ad-GNMCB3QY.js.map} +0 -0
- /package/dist/{scaffold-video-BUN27PKS.js.map → scaffold-video-G6G2NPUF.js.map} +0 -0
- /package/dist/{schedule-EH2MOC5C.js.map → schedule-OX5XHXLH.js.map} +0 -0
- /package/dist/{scheduled-agents-DTAEP25E.js.map → scheduled-agents-A5ZFQB5X.js.map} +0 -0
- /package/dist/{schema-7B4MVVAS.js.map → schema-NTGHAPR2.js.map} +0 -0
- /package/dist/{search-ZZWIJRXJ.js.map → search-WCXQBMMM.js.map} +0 -0
- /package/dist/{select-LWZRF7KV.js.map → select-5ZD7FVBT.js.map} +0 -0
- /package/dist/{set-prompt-YKDH6FYK.js.map → set-prompt-NGCVMQIQ.js.map} +0 -0
- /package/dist/{setup-links-OE6PC2YQ.js.map → setup-links-4HCSF55G.js.map} +0 -0
- /package/dist/{shopify-CCPLZI2H.js.map → shopify-GDR5WGHH.js.map} +0 -0
- /package/dist/{site-FW5BBLYG.js.map → site-B7LT6KAO.js.map} +0 -0
- /package/dist/{sources-WPHMWBEK.js.map → sources-6DPUEROC.js.map} +0 -0
- /package/dist/{sources-X77TGJ52.js.map → sources-OSUXCLID.js.map} +0 -0
- /package/dist/{stale-SPCDL73V.js.map → stale-YKFKPPOH.js.map} +0 -0
- /package/dist/{status-FLETGJ2A.js.map → status-KIC3P5JV.js.map} +0 -0
- /package/dist/{stock-5AOSQH52.js.map → stock-VWFUFRYV.js.map} +0 -0
- /package/dist/{studio-4EV5S7PR.js.map → studio-XLC37YGX.js.map} +0 -0
- /package/dist/{sync-363VKXU3.js.map → sync-QBW4XH2H.js.map} +0 -0
- /package/dist/{sync-definition-ZDE5L644.js.map → sync-definition-4KMJK46H.js.map} +0 -0
- /package/dist/{tags-VOKUNEIW.js.map → tags-4F5UBPYG.js.map} +0 -0
- /package/dist/{tags-ZCQMJ5YH.js.map → tags-4O5FPEEY.js.map} +0 -0
- /package/dist/{tags-YHAC3NVY.js.map → tags-7RKKCQ4X.js.map} +0 -0
- /package/dist/{tags-6MN3AWKN.js.map → tags-CB4MWI3A.js.map} +0 -0
- /package/dist/{tags-Y6MNMIEA.js.map → tags-QZJIP4LJ.js.map} +0 -0
- /package/dist/{targeting-criteria-ECQFHQF3.js.map → targeting-criteria-65UU7EYD.js.map} +0 -0
- /package/dist/{targets-U2JHTB5U.js.map → targets-T742OPQI.js.map} +0 -0
- /package/dist/{testimonials-IDVLMXDT.js.map → testimonials-HKJJXONO.js.map} +0 -0
- /package/dist/{themes-QMR5TWTI.js.map → themes-Q6LVMEMF.js.map} +0 -0
- /package/dist/{top-companies-CBI4O3ZB.js.map → top-companies-T6AMU4C6.js.map} +0 -0
- /package/dist/{transcript-IIRFTFRW.js.map → transcript-DOUYMZAP.js.map} +0 -0
- /package/dist/{translate-N6QW4FZB.js.map → translate-WKOXFZTQ.js.map} +0 -0
- /package/dist/{triggers-Q3KRAMA3.js.map → triggers-EYY4GSUL.js.map} +0 -0
- /package/dist/{unlink-7RVQXKAR.js.map → unlink-JNM4WRZK.js.map} +0 -0
- /package/dist/{unstage-3LPHNZKR.js.map → unstage-QF4JT5YP.js.map} +0 -0
- /package/dist/{update-YBTFH5MN.js.map → update-6V3RBRIE.js.map} +0 -0
- /package/dist/{update-AL3LBHGK.js.map → update-J4DURR4K.js.map} +0 -0
- /package/dist/{update-AWR7EHGA.js.map → update-J7Y6LZC5.js.map} +0 -0
- /package/dist/{update-LNSSLZXG.js.map → update-MQ4NYIU6.js.map} +0 -0
- /package/dist/{upload-45GCGMA5.js.map → upload-CEIYYPID.js.map} +0 -0
- /package/dist/{url-options-AHJPR5VY.js.map → url-options-6WC2XQKB.js.map} +0 -0
- /package/dist/{url-params-U6ZM4LL2.js.map → url-params-OVBIP6UA.js.map} +0 -0
- /package/dist/{validate-S325RXPH.js.map → validate-UHXI2ESE.js.map} +0 -0
- /package/dist/{videos-NW2UP342.js.map → videos-Z72RXCRB.js.map} +0 -0
- /package/dist/{viewer-check-IDXFRRCO.js.map → viewer-check-655BZRML.js.map} +0 -0
- /package/dist/{web-VMPKMBKA.js.map → web-4QN6QB7L.js.map} +0 -0
- /package/dist/{winning-ads-7UJXCWFH.js.map → winning-ads-2J2RIOLR.js.map} +0 -0
- /package/dist/{write-commands-R42DQEW6.js.map → write-commands-V7B4FBMX.js.map} +0 -0
- /package/dist/{x-UGTUOCVR.js.map → x-7KXNCWTJ.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/avatars/namedPerson.ts","../src/commands/canvas/slug-restore.ts","../src/commands/canvas/series-run.ts","../src/commands/canvas/voice-retake.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 { runResult } from \"./printed-result.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 plainRunEdit,\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 verdictBrief,\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 full: {\n type: \"boolean\",\n default: false,\n description:\n \"Also print the per-node output, the run's stats, the judge's scores and the full guide in hints. The default is the result alone on stdout (verdict, review, the next step as hints, run_id, files); the progress, [warn] and [hint] lines (the full guide) go to stderr.\",\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 full: args.full === true,\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 /** Print the per-node output, stats and judge scores too — see the `--full` flag. */\n full?: boolean;\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 opts.fix === undefined &&\n opts.useVariant === undefined && opts.regenerate === undefined && opts.from === undefined && shown.rendered\n ? plainRunEdit(parsed, 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 unremoved =\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 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 ...unremoved,\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 // What the default prints in place of `hints`: the next step alone, the full guide behind `--full`.\n const brief = staticReview\n ? [\n ...runNotes,\n ...(corrected.length > 0\n ? [`Corrected automatically before this result, ${corrected.length} more render${corrected.length === 1 ? \"\" : \"s\"}; what follows is the review of the corrected version.`]\n : []),\n ...verdictBrief(staticReview.verdict, sizeShapeOf(madeHere)),\n ...staticReview.notes,\n ...seriesHints,\n ...unremoved,\n ]\n : reviewable && review !== null && review.length > 0\n ? [...runNotes, ...reviewHints.slice(0, 1)]\n : undefined;\n /** Said at the head of both: what stopped the corrections is the next step itself. */\n const lead = (hint: string): void => {\n hints.unshift(hint);\n brief?.unshift(hint);\n };\n const findings = staticReview ? staticReview.review : review;\n // The lifecycle field moves with what happened, never by hand: a render the review\n // calls ready (with or without notes) makes the creative `rendered`.\n const ready = staticReview\n ? staticReview.verdict === \"ready\" || staticReview.verdict === \"ready_with_notes\"\n : review !== null && !review.some((f) => f.severity === \"blocking\");\n const definitionStatus =\n ready && creativeSlug\n ? await advanceDefinitionStatus(path.join(path.dirname(filePath), \"_definition.md\"), \"rendered\")\n : null;\n if (poster) {\n await flushBilled(poster, \n // `review` is null only when nobody looked (no key, no ffmpeg, unreadable video);\n // an empty array is a render that was reviewed and came back clean. The record\n // has to keep those apart.\n buildRunRecord(\n result,\n {\n ...recordMeta,\n ...(findings ? { review: findings } : {}),\n ...(reviewUsage.length > 0 ? { reviewUsage } : {}),\n // A static ad that failed a check is never shown as a version (the backend reads both).\n ...(staticReview\n ? { verdict: staticReview.verdict, presentable: staticReview.verdict !== \"needs_fixes\" }\n : {}),\n },\n progress?.planInfo(),\n finalLabels,\n ),\n );\n }\n // A blocking defect is corrected by the run itself, before anyone sees the ad (static-autofix.ts).\n const round = opts.autoFixRound ?? 0;\n // A picture the person chose stays theirs through every correction and re-layout of it.\n const keepPicture =\n opts.useVariant !== undefined ||\n opts.autoFixKeepPicture === true ||\n ((fixInstruction !== undefined || relaidFrom !== undefined) && keepsChosen(shown.picture, fromRun));\n // Every render of this correction so far: the next one starts from the best, never a worse one.\n const attempts: Attempt[] = staticReview?.review\n ? [...(opts.autoFixAttempts ?? []), { runId: result.run_id, review: staticReview.review }]\n : [];\n const base = attempts.length > 0 ? correctFrom(attempts as [Attempt, ...Attempt[]]) : null;\n const reverted = base !== null && base.runId !== result.run_id;\n let step =\n staticReview && base && opts.autoFix !== false\n ? // The graph the next round re-prepares (the file's), never this run's rewrite of it: a fix or a\n // re-layout takes the variants out of `parsed`, and only the file's graph can draw a new picture.\n autoFixStep(prepared.canvas, base.review, {\n round,\n keepPicture,\n // Gone back to an earlier attempt: what this round did and left is no longer the picture's.\n ...(!reverted && opts.autoFixKind ? { previous: opts.autoFixKind } : {}),\n ...(!reverted && fixInstruction !== undefined\n ? { lastFix: { instruction: fixInstruction.trim(), blocking: stillThere } }\n : {}),\n tooFar: reverted ? [] : placedTooFar(parsed, result.outputs_by_node),\n fixedBefore: base.fixedBefore,\n })\n : null;\n if (step && reverted && base) {\n process.stdout.write(\n `[autofix] run ${result.run_id} came out worse than run ${base.runId}: the next correction starts from run ${base.runId}\\n`,\n );\n }\n // A round past the ad's time in this turn is not started: the ad is shown as it stands (turn-renders.ts).\n const outOfTime =\n step !== null && !roundFitsTurn(await readTurnRenders(turnCache), turnId, creativeSlug, Date.now() - startedAt, step.kind);\n if (outOfTime) {\n process.stdout.write(\n `[autofix] not started: this ad has had its time in this turn (${Math.round((Date.now() - startedAt) / 60_000)} min in this render). It stands as it is.\\n`,\n );\n lead(\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 lead(\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 lead(\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 full: opts.full,\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 // The full guide stays in the progress log when the result prints the next step alone.\n if (brief && opts.full !== true) for (const hint of hints) process.stderr.write(`[hint] ${hint}\\n`);\n process.stdout.write(\n `${JSON.stringify(\n runResult(\n {\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\" as const } : {}),\n hints,\n ...(brief ? { brief } : {}),\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 { full: opts.full === true },\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","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 * 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","/**\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAAA,iBAAgB;AACzB,OAAOC,WAAU;AAEjB,SAAS,qBAAqB;;;ACiB9B,SAAS,eAAe,OAAmC;AACzD,SAAO,EAAE,GAAG,OAAO,SAAS,MAAM,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ACF;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","existsSync","path","path","existsSync","readFile","writeFile","path","readFile","writeFile","path","readFile","requested","held"]}
|