@koda-sl/baker-cli 0.482.0-dev.a5555ab55 → 0.482.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/{account-KZVOT6HL.js → account-VH2AATWI.js} +5 -5
- package/dist/{account-ELL7ZZLM.js → account-Z65CPOWE.js} +3 -3
- package/dist/{account-reads-LA45L6G3.js → account-reads-GYI2SS6T.js} +4 -4
- package/dist/{account-writes-CEPERFD6.js → account-writes-4N2MA2ZR.js} +3 -3
- package/dist/{accounts-HC7GPQNG.js → accounts-SPLE7URQ.js} +6 -6
- package/dist/{accounts-7G556DH4.js → accounts-XG472YLB.js} +4 -4
- package/dist/{actions-V6YP5C3X.js → actions-KQTXBNJU.js} +18 -18
- package/dist/{activecampaign-CHZEHRHZ.js → activecampaign-42JXANUA.js} +4 -4
- package/dist/{ad-group-writes-XGSCEQTW.js → ad-group-writes-EUTMPBMK.js} +3 -3
- package/dist/{ad-groups-GKOLDGET.js → ad-groups-OVPAI5RM.js} +7 -7
- package/dist/{ad-writes-VVD36JKH.js → ad-writes-DACTYFEO.js} +3 -3
- package/dist/{add-3MD72QMT.js → add-C3FQ5D62.js} +3 -3
- package/dist/{add-TSQNUP5N.js → add-KTEJCE4L.js} +4 -4
- package/dist/{ads-EKZVHKPN.js → ads-L65JIKCD.js} +8 -8
- package/dist/{ads-KRM4WAMZ.js → ads-WPI3AMSR.js} +5 -5
- package/dist/{advertisers-XJG7XDK7.js → advertisers-36HP3AOE.js} +6 -6
- package/dist/{analytics-JVT2OBQC.js → analytics-I4LZCRG2.js} +4 -4
- package/dist/{analytics-DO4UKW2H.js → analytics-IFNBT7IM.js} +7 -7
- package/dist/{animate-G4P3OEJE.js → animate-3LV3LHXQ.js} +4 -4
- package/dist/{assign-72YAL6TP.js → assign-WBLSZNCO.js} +4 -4
- package/dist/{audience-size-M5NU4QYN.js → audience-size-LOX5BNXI.js} +4 -4
- package/dist/{audiences-BU4JZJT7.js → audiences-RPLVMO4H.js} +3 -3
- package/dist/{audit-22KQAHJR.js → audit-6AG6BPXQ.js} +4 -4
- package/dist/{autocomplete-KLNQIK5T.js → autocomplete-2QRU7ARD.js} +6 -6
- package/dist/{avatars-VO6FMJFB.js → avatars-EIETXCF3.js} +4 -4
- package/dist/{bid-pricing-52HDANYL.js → bid-pricing-5LZFHQTS.js} +5 -5
- package/dist/{brand-XXNOVSGE.js → brand-CINQG3JG.js} +2 -2
- package/dist/{brief-JIARAUIR.js → brief-WAQ2V6Q4.js} +19 -19
- package/dist/{campaign-groups-JFOFU76X.js → campaign-groups-5CMTEJZZ.js} +9 -9
- package/dist/{campaign-writes-PKWLLKB5.js → campaign-writes-4RMPHQCT.js} +4 -4
- package/dist/{campaign-writes-NSEJCINS.js → campaign-writes-U5LTDTYK.js} +3 -3
- package/dist/{campaigns-5AZMOOID.js → campaigns-NFRLFNXI.js} +5 -5
- package/dist/{campaigns-H4VK3GKK.js → campaigns-PC7UAVXR.js} +12 -12
- package/dist/{campaigns-VWN2XPK2.js → campaigns-TFEQTSO3.js} +7 -7
- package/dist/{canvas-TTV7QZZT.js → canvas-A4XKEBN7.js} +14 -14
- package/dist/{capabilities-VJ53ROIP.js → capabilities-FNVTPCDT.js} +4 -4
- package/dist/{catalog-43BSTAT6.js → catalog-SJBGNNY4.js} +8 -8
- package/dist/{catalogs-XH5NHH4C.js → catalogs-A7XMEEEP.js} +3 -3
- package/dist/{changes-F6WUXFC3.js → changes-J67WATHX.js} +4 -4
- package/dist/{chatgpt-K6KNTME4.js → chatgpt-4PEWDJKP.js} +13 -13
- package/dist/{chats-PWLQO7UY.js → chats-S5FCV7YO.js} +4 -4
- package/dist/{check-545MAB4E.js → check-GCZ2ZBKH.js} +11 -11
- package/dist/{chunk-GJWMPTUE.js → chunk-2DHHL4PU.js} +4 -4
- package/dist/{chunk-XF5R2FQT.js → chunk-2K3NCVDI.js} +19 -31
- package/dist/{chunk-XF5R2FQT.js.map → chunk-2K3NCVDI.js.map} +1 -1
- package/dist/{chunk-UTLIQBRY.js → chunk-3S5YZWB7.js} +7 -10
- package/dist/chunk-3S5YZWB7.js.map +1 -0
- package/dist/{chunk-5SRHACZW.js → chunk-3UXMQ3K2.js} +2 -2
- package/dist/{chunk-U63S2JWI.js → chunk-4VWTIT5C.js} +2 -2
- package/dist/{chunk-XLJVJ5TK.js → chunk-5NS4CNF6.js} +5 -5
- package/dist/{chunk-PNVEV3XP.js → chunk-5RCCESDX.js} +41 -109
- package/dist/chunk-5RCCESDX.js.map +1 -0
- package/dist/{chunk-YU2XIIL3.js → chunk-5YKC2WWG.js} +6 -6
- package/dist/{chunk-6OIKNJ7G.js → chunk-65N4ZPQD.js} +2 -2
- package/dist/{chunk-I2WRZJAC.js → chunk-6KK26F2T.js} +2 -2
- package/dist/{chunk-64HQDJ2E.js → chunk-7U3V64YT.js} +5 -5
- package/dist/{chunk-SEPPFM5S.js → chunk-7VHPAGPK.js} +2 -2
- package/dist/{chunk-C7MENOP5.js → chunk-A2FKWRKO.js} +6 -6
- package/dist/{chunk-MK3OJZIU.js → chunk-ABXTGAG7.js} +2 -2
- package/dist/{chunk-G5GV6SUK.js → chunk-ADSNY4KZ.js} +2 -2
- package/dist/{chunk-3UBTVAFJ.js → chunk-AHF6TQWB.js} +2 -2
- package/dist/{chunk-S7B2TOOU.js → chunk-AQ5WISEG.js} +2 -2
- package/dist/{chunk-RGX7AQ2K.js → chunk-AS5VL32C.js} +2 -2
- package/dist/{chunk-QKABEX3F.js → chunk-BSEB55E6.js} +2 -2
- package/dist/{chunk-TKPVVD52.js → chunk-CCIDHU6M.js} +2 -2
- package/dist/{chunk-AOZ7547I.js → chunk-CXQRTLSQ.js} +3 -3
- package/dist/{chunk-FQXGII24.js → chunk-DCTEL4KG.js} +4 -4
- package/dist/{chunk-P5PX2G7E.js → chunk-DF22CTXE.js} +3 -3
- package/dist/{chunk-V4UIM4QE.js → chunk-DH5CKOYK.js} +2 -2
- package/dist/{chunk-QZHGIJOW.js → chunk-DQC4NIJE.js} +3 -3
- package/dist/{chunk-QTLZXIF3.js → chunk-ELL2IQMF.js} +10 -9
- package/dist/chunk-ELL2IQMF.js.map +1 -0
- package/dist/{chunk-SQ7DRYCC.js → chunk-FEELV5IV.js} +2 -2
- package/dist/{chunk-2QSPPWOU.js → chunk-FRK7SSEH.js} +2 -2
- package/dist/{chunk-HNEYIWXW.js → chunk-GQ6JS5MR.js} +11 -56
- package/dist/{chunk-HNEYIWXW.js.map → chunk-GQ6JS5MR.js.map} +1 -1
- package/dist/{chunk-3BKNGXCL.js → chunk-IG627WWY.js} +169 -169
- package/dist/chunk-IG627WWY.js.map +1 -0
- package/dist/{chunk-GD6UJDOB.js → chunk-IWWOGBGA.js} +2 -2
- package/dist/{chunk-QYAI24PN.js → chunk-JFA4R3KS.js} +2 -2
- package/dist/{chunk-WHSTZRUY.js → chunk-K2Z3KGOH.js} +2 -2
- package/dist/{chunk-3ZHOBEQD.js → chunk-KQDAFZKR.js} +3 -3
- package/dist/{chunk-ZJ6HUCRK.js → chunk-LD4CHA7U.js} +2 -2
- package/dist/{chunk-CSN6L345.js → chunk-MIOOPOG2.js} +5 -5
- package/dist/{chunk-I2DNBEV6.js → chunk-ML7DLFFY.js} +14 -14
- package/dist/chunk-ML7DLFFY.js.map +1 -0
- package/dist/{chunk-TY4BDVLG.js → chunk-MMVLRUMK.js} +11 -23
- package/dist/chunk-MMVLRUMK.js.map +1 -0
- package/dist/{chunk-TNB5EIFV.js → chunk-NCP6RD6A.js} +2 -2
- package/dist/{chunk-D6KHVUDS.js → chunk-NNF4RARY.js} +3 -3
- package/dist/{chunk-UWT7RCL3.js → chunk-NR2OVOTD.js} +2 -2
- package/dist/{chunk-LMZAOTRX.js → chunk-NVGXYF6K.js} +2 -2
- package/dist/{chunk-SIKCVWM3.js → chunk-ORQKMXHA.js} +2 -2
- package/dist/{chunk-JRFVSSKP.js → chunk-PQTY22FR.js} +6 -7
- package/dist/chunk-PQTY22FR.js.map +1 -0
- package/dist/{chunk-XP4G2DJL.js → chunk-Q7YZL7PG.js} +2 -2
- package/dist/{chunk-K4NMOWG7.js → chunk-R2TAVQGZ.js} +2 -2
- package/dist/{chunk-IYELKHBG.js → chunk-R5WNYLG4.js} +2 -2
- package/dist/{chunk-XFJNCZXA.js → chunk-RCSOG2DV.js} +5 -5
- package/dist/{chunk-ZBUWO4XH.js → chunk-RD2XXQW3.js} +3 -3
- package/dist/{chunk-RMNKCVRB.js → chunk-RDCYPWQZ.js} +8 -23
- package/dist/chunk-RDCYPWQZ.js.map +1 -0
- package/dist/{chunk-46TND6YK.js → chunk-RLS5OPPZ.js} +2 -2
- package/dist/{chunk-PHPXAMY3.js → chunk-RMLJNHCU.js} +3 -3
- package/dist/{chunk-GM46ZEYP.js → chunk-RTWRNG3E.js} +8 -18
- package/dist/{chunk-GM46ZEYP.js.map → chunk-RTWRNG3E.js.map} +1 -1
- package/dist/{chunk-F3CZFUXZ.js → chunk-T6ATGN7Y.js} +4 -4
- package/dist/chunk-T6ATGN7Y.js.map +1 -0
- package/dist/{chunk-LFXE2G6R.js → chunk-TNOJ6O6B.js} +2 -2
- package/dist/{chunk-F5IH7G2F.js → chunk-U2452GLO.js} +6 -11
- package/dist/chunk-U2452GLO.js.map +1 -0
- package/dist/{chunk-TBHRRQZD.js → chunk-U4W4LULB.js} +8 -8
- package/dist/{chunk-2WTD5Y34.js → chunk-U6IWRZQF.js} +3 -3
- package/dist/{chunk-SK2N45LO.js → chunk-UMZIQIWN.js} +2 -2
- package/dist/{chunk-KXSXZAC2.js → chunk-V6PXHQSI.js} +2 -2
- package/dist/{chunk-REMR5FHD.js → chunk-WD5BQBVY.js} +3 -3
- package/dist/{chunk-ROX7LQRR.js → chunk-WMVTIKET.js} +2 -2
- package/dist/{chunk-I44SNQ34.js → chunk-WNJ5SYAG.js} +2 -2
- package/dist/{chunk-DDES6J6A.js → chunk-XSGO44OV.js} +4 -4
- package/dist/{chunk-TUSR5R7I.js → chunk-XUB2EK65.js} +2 -2
- package/dist/{chunk-JQNO6JCV.js → chunk-XUR4QWCS.js} +2 -2
- package/dist/{chunk-KOVQ2JGM.js → chunk-YD7BQDJ6.js} +2 -2
- package/dist/{chunk-B7FVPHCW.js → chunk-ZBV5IV5T.js} +2 -2
- package/dist/{claim-QHXKN7W6.js → claim-6MPQD43X.js} +4 -4
- package/dist/cli.js +30 -30
- package/dist/{companies-PGVT62JL.js → companies-KRF2K4CA.js} +4 -4
- package/dist/{complete-TCTR3XVD.js → complete-V433ON5C.js} +4 -4
- package/dist/{connect-4S7JLICS.js → connect-QVIAM3GX.js} +7 -7
- package/dist/{conversation-DI4WMEL2.js → conversation-VZKBZZGG.js} +4 -4
- package/dist/{conversion-report-KL4LIVY5.js → conversion-report-REOHVLCI.js} +2 -2
- package/dist/{conversion-upload-command-EIKJU5ZW.js → conversion-upload-command-ASHA6T6H.js} +4 -4
- package/dist/{conversion-writes-MPBCTVSP.js → conversion-writes-JU7Q2MUO.js} +3 -3
- package/dist/{conversions-ACYT6K7H.js → conversions-3ISBR3TS.js} +5 -5
- package/dist/{conversions-JTYMFX66.js → conversions-ZLC6YTJ5.js} +8 -8
- package/dist/{create-VFXEJ3EV.js → create-B3QMYSIX.js} +4 -4
- package/dist/{create-3QA7X2DD.js → create-IFCCMKFT.js} +3 -3
- package/dist/{create-AFVT5JTH.js → create-R5P6JU5A.js} +4 -4
- package/dist/{create-TYCOMVWR.js → create-SF6DOGDJ.js} +4 -4
- package/dist/{creatives-E6N2YLHE.js → creatives-KD7MOCR3.js} +9 -9
- package/dist/{creatives-5VY3LT6X.js → creatives-U2M4F3D5.js} +12 -12
- package/dist/{credentials-34I6ZZWU.js → credentials-2KJUKBMF.js} +4 -4
- package/dist/{critique-OCVV6N3U.js → critique-43OVWKN7.js} +18 -18
- package/dist/{critique-JM5QADYW.js → critique-JVKJEBAC.js} +7 -7
- package/dist/{crm-MNBYNP5R.js → crm-GX72E2LT.js} +5 -5
- package/dist/{crm-4F3LFOZD.js → crm-ZYDNEME5.js} +5 -5
- package/dist/{currency-3QTI5RSB.js → currency-CGDI2NXI.js} +4 -4
- package/dist/{customers-VNYNT2EQ.js → customers-P4N4NXLJ.js} +8 -8
- package/dist/{delete-UZRHYEPK.js → delete-AK5IV44E.js} +3 -3
- package/dist/{delete-PRJGFA2U.js → delete-RS7RQDUX.js} +4 -4
- package/dist/{delete-AZEVPMVO.js → delete-S4VKH7IS.js} +4 -4
- package/dist/{demographics-JMZA7MB6.js → demographics-IKWN2H3V.js} +4 -4
- package/dist/{discard-OH3B5P4C.js → discard-H6DOHJRG.js} +4 -4
- package/dist/{discover-5GLET36U.js → discover-L4TPEKGY.js} +4 -4
- package/dist/{domain-K3IILLYE.js → domain-US4KKAXC.js} +4 -4
- package/dist/{draft-LZL6VWHX.js → draft-BIQ3ZAYW.js} +5 -5
- package/dist/{draft-7RYDPOFS.js → draft-IZ4YLQRD.js} +4 -4
- package/dist/{draft-2KHUZTIE.js → draft-OLFQZBWL.js} +4 -4
- package/dist/{draft-BB3UUWJP.js → draft-R32RFDCI.js} +4 -4
- package/dist/{draft-VXGZDBC7.js → draft-Y2QJE2NM.js} +3 -3
- package/dist/engine/index.js +7 -7
- package/dist/{facets-PAWOEHOK.js → facets-JBZQHN3D.js} +4 -4
- package/dist/{feedback-GAGIKZ6B.js → feedback-3GU3PAEI.js} +21 -21
- package/dist/{feedback-record-ZORDBRV2.js → feedback-record-PIJDOJW3.js} +22 -22
- package/dist/{fetch-M5GIBURQ.js → fetch-GOY6DQRL.js} +4 -4
- package/dist/{fit-DGCYW7LN.js → fit-TVQ7RK52.js} +13 -13
- package/dist/{flows-TD6PNUDM.js → flows-274YPU6I.js} +11 -11
- package/dist/{fonts-IQ6XOUGU.js → fonts-BMUNDGOZ.js} +9 -9
- package/dist/{forecast-YXOKAWDZ.js → forecast-F2CZSIMP.js} +4 -4
- package/dist/{forecast-FACEH4WR.js → forecast-W5F2MNOV.js} +5 -5
- package/dist/{funnel-CJRFDTCD.js → funnel-LEUXICXU.js} +5 -5
- package/dist/{generate-D3LUXFJT.js → generate-4HWNFAH3.js} +3 -3
- package/dist/{get-JRMJLLU5.js → get-MGDY5JYZ.js} +4 -4
- package/dist/{get-NUL4YJG5.js → get-TY6AMFI4.js} +4 -4
- package/dist/{google-URYXWN5O.js → google-ZTTE34A4.js} +22 -22
- package/dist/{google-ads-BB7CF4NV.js → google-ads-5ARKO757.js} +4 -4
- package/dist/{history-OQAOTEO3.js → history-IQ33J5PB.js} +3 -3
- package/dist/{history-Q47TKZJS.js → history-SU7VQCDJ.js} +4 -4
- package/dist/{hubspot-A6O5GVTH.js → hubspot-TJED44GO.js} +8 -8
- package/dist/{ideas-LD6X753E.js → ideas-UTSCGCT6.js} +10 -10
- package/dist/{images-XY5DLJEA.js → images-ZMZ4WLYH.js} +4 -4
- package/dist/{ingest-WWNSA6VZ.js → ingest-DGDNZWEM.js} +4 -4
- package/dist/{ingest-PUMTHASV.js → ingest-SGBJ3NXX.js} +3 -3
- package/dist/{insights-PZXFCMX2.js → insights-SQLE5NOJ.js} +2 -2
- package/dist/{inspect-5PRLZLF5.js → inspect-BMQTTKMW.js} +4 -4
- package/dist/{intent-4QVVI4FF.js → intent-LM36WK45.js} +4 -4
- package/dist/{keyword-gap-YMMDRYVK.js → keyword-gap-P652ODHN.js} +4 -4
- package/dist/{keyword-metrics-FB7FCYK6.js → keyword-metrics-MQLGGJBT.js} +6 -6
- package/dist/{keywords-for-site-YZYALONY.js → keywords-for-site-JL6H2YGU.js} +6 -6
- package/dist/{landing-XOCPIOWX.js → landing-AJO2BPC2.js} +2 -2
- package/dist/{languages-R3Y2IOFU.js → languages-HL42MI7H.js} +4 -4
- package/dist/{leads-SWINPYEP.js → leads-H6JIWVI6.js} +4 -4
- package/dist/{learn-6HVDSTTJ.js → learn-RGO5KDHS.js} +10 -10
- package/dist/{line-item-writes-FG3TY4W4.js → line-item-writes-V7AKAHFC.js} +4 -4
- package/dist/{line-items-ZNVBFA4H.js → line-items-GAMKVVIQ.js} +5 -5
- package/dist/{link-IFEXIUDW.js → link-Z5AQP6JN.js} +4 -4
- package/dist/{linkedin-NINSMEW6.js → linkedin-7F6YVXQL.js} +27 -27
- package/dist/{list-K65FY6SV.js → list-NLGM3QDP.js} +4 -4
- package/dist/{list-RJG3FMZR.js → list-SZH6TH74.js} +4 -4
- package/dist/{list-FR2OVRVL.js → list-XZVQWIJN.js} +3 -3
- package/dist/{locations-6IH7WGRG.js → locations-AEGZ36JH.js} +4 -4
- package/dist/{locations-VL2G22Y5.js → locations-YA7NZY44.js} +2 -2
- package/dist/{log-TAKCMC2C.js → log-JM4VLJE4.js} +4 -4
- package/dist/{make-EWHS4EHQ.js → make-IHJROEKG.js} +34 -40
- package/dist/make-IHJROEKG.js.map +1 -0
- package/dist/{map-DWLEYXSW.js → map-HRLUMCR2.js} +5 -5
- package/dist/{mcp-NNQZ5B7N.js → mcp-T6SAG4XB.js} +3 -3
- package/dist/{media-sources-OAFBA62X.js → media-sources-7AS3274L.js} +2 -2
- package/dist/{members-SS7IBYVE.js → members-J5KWXTXY.js} +4 -4
- package/dist/{metrics-YLAREC4T.js → metrics-VDBJ6KL7.js} +4 -4
- package/dist/{models-IH6KE6OH.js → models-2DQ5NBMT.js} +2 -2
- package/dist/{normalize-WOZTAI6C.js → normalize-CHZB4QDD.js} +4 -4
- package/dist/{options-PL44BV5E.js → options-QLXFLESP.js} +7 -7
- package/dist/{organization-SQBODZUK.js → organization-KEGKAP4P.js} +4 -4
- package/dist/{performance-WRARV3YR.js → performance-SPGPGXE5.js} +5 -5
- package/dist/{pixels-DWW2TDY2.js → pixels-6IUB3Y3H.js} +3 -3
- package/dist/{promoted-tweet-writes-CAD3RGU4.js → promoted-tweet-writes-TRR3KPRJ.js} +4 -4
- package/dist/{promoted-tweets-NYJP3TXL.js → promoted-tweets-XRYZNJI2.js} +3 -3
- package/dist/{publish-ZW6VHB27.js → publish-V5YGMK53.js} +4 -4
- package/dist/{query-QRPBV2AR.js → query-M3IO54U2.js} +5 -5
- package/dist/{reddit-VJTNXORD.js → reddit-STSECKMZ.js} +5 -5
- package/dist/{refresh-6I52WXG5.js → refresh-RQ3C2MHI.js} +3 -3
- package/dist/{release-LSSYP2ZJ.js → release-UHGU5WBY.js} +4 -4
- package/dist/{relevant-pages-2XHS5WP4.js → relevant-pages-G6SNC73K.js} +4 -4
- package/dist/{remove-K62YJYGT.js → remove-LTKICIIF.js} +3 -3
- package/dist/{reopen-RPVEBQVR.js → reopen-BP5ERELB.js} +4 -4
- package/dist/{rerun-ETH2NEEX.js → rerun-R3DNEV5U.js} +27 -27
- package/dist/{research-6J3EOBAL.js → research-GOYMTKZM.js} +3 -3
- package/dist/{research-4ASN2KMB.js → research-MBAPL35Y.js} +13 -13
- package/dist/{reset-YVTYHSTY.js → reset-Q62PEGOU.js} +3 -3
- package/dist/{reset-ETORO5UO.js → reset-SJPGSQ7I.js} +3 -3
- package/dist/{resolve-BI7GB5U2.js → resolve-R45W7QEQ.js} +4 -4
- package/dist/{retry-QZ7YHXF3.js → retry-CD2Q2AJN.js} +3 -3
- package/dist/{retry-2ZZCKSRW.js → retry-NBZ7Q6HK.js} +3 -3
- package/dist/{rules-KEHQEXEU.js → rules-SZIY67QF.js} +10 -10
- package/dist/{rules-add-IDBWO6XV.js → rules-add-KTLHU3YD.js} +11 -11
- package/dist/{run-KYEOLJFV.js → run-HCJKCEOL.js} +4 -4
- package/dist/{run-FFASB4YB.js → run-QYIUO4NB.js} +27 -27
- package/dist/{scaffold-ad-EKCXHZPT.js → scaffold-ad-NIVJSO73.js} +26 -26
- package/dist/{scaffold-static-ad-MWKTXATN.js → scaffold-static-ad-QX2NUXFR.js} +33 -33
- package/dist/{scaffold-video-BYPPH352.js → scaffold-video-NXBM54K3.js} +23 -23
- package/dist/{schedule-4BK2ML6F.js → schedule-BSQHXJ5V.js} +3 -3
- package/dist/{scheduled-agents-GMGP3G6T.js → scheduled-agents-MFLMG34I.js} +10 -10
- package/dist/{schema-QPPWADIL.js → schema-IWPG3YSN.js} +5 -5
- package/dist/{search-GCSQ6CSD.js → search-EGI5K77S.js} +3 -3
- package/dist/{select-CPFKK57J.js → select-Q4S4CPKV.js} +20 -20
- package/dist/{set-prompt-TJ3UTNYS.js → set-prompt-3MVZW3L6.js} +19 -19
- package/dist/{setup-links-C3EUV2RX.js → setup-links-5ILQNMFZ.js} +4 -4
- package/dist/{site-W5W7FCUD.js → site-LBXNVRPE.js} +5 -5
- package/dist/{sources-AWODYZDS.js → sources-GP4PUTX2.js} +7 -7
- package/dist/{sources-SGGLJIOA.js → sources-N4UANUHJ.js} +6 -6
- package/dist/{stale-KILEXX57.js → stale-NT2JRQHY.js} +19 -19
- package/dist/{status-KUSLGZD7.js → status-GSFMLC6W.js} +4 -4
- package/dist/{studio-LMDDQWRY.js → studio-YB5WXQYC.js} +4 -4
- package/dist/{sync-TCY4NX7J.js → sync-LIV7FU4N.js} +3 -3
- package/dist/{sync-definition-DGSAZGQZ.js → sync-definition-6XPX6VJU.js} +22 -22
- package/dist/{tags-ZYVOKGHU.js → tags-4JQX7HMT.js} +4 -4
- package/dist/{tags-QQLYW2QQ.js → tags-6RQVXS47.js} +3 -3
- package/dist/{tags-QXRKKRIR.js → tags-AAIFQ6LS.js} +4 -4
- package/dist/{tags-U5YWCPFW.js → tags-F355NMIR.js} +4 -4
- package/dist/{tags-IHLO2NDM.js → tags-ZHCGHGYC.js} +4 -4
- package/dist/{targeting-criteria-AEBSY6OY.js → targeting-criteria-6FY2JB3V.js} +3 -3
- package/dist/{targets-5Q2OFVXL.js → targets-NI7TR4GV.js} +4 -4
- package/dist/{testimonials-O52ULRAU.js → testimonials-G7CCH7VN.js} +6 -6
- package/dist/{themes-26XFWSWC.js → themes-PXDXIKYR.js} +4 -4
- package/dist/{top-companies-OMGAFFWN.js → top-companies-YH2ZJEH5.js} +4 -4
- package/dist/{translate-C5LZ6KVN.js → translate-27DIFMBU.js} +24 -24
- package/dist/{triggers-PTPG6OQ6.js → triggers-WYFM7PAH.js} +4 -4
- package/dist/{unlink-3BAXM2OH.js → unlink-PTWUSM5B.js} +4 -4
- package/dist/{unstage-EFW465VN.js → unstage-MCM6EZWK.js} +4 -4
- package/dist/{update-VTUB2M5I.js → update-2BDIJDHN.js} +3 -3
- package/dist/{update-5A7Q7S6I.js → update-643S2MUW.js} +4 -4
- package/dist/{update-XPRHUFBR.js → update-GUIP6G3N.js} +4 -4
- package/dist/{update-2RCIXWP3.js → update-V6E3CIFD.js} +4 -4
- package/dist/{upload-Y3TACPEN.js → upload-3YJJ5VID.js} +4 -4
- package/dist/{url-options-6CNDIUDM.js → url-options-LHS4SWWB.js} +4 -4
- package/dist/{url-params-ZUYOLAJG.js → url-params-2DKIXKHH.js} +4 -4
- package/dist/{validate-KPJLIGYY.js → validate-AYPLNS7A.js} +22 -22
- package/dist/{videos-EFMNE6U2.js → videos-KEDR4GG3.js} +5 -5
- package/dist/{viewer-check-2GI26EKA.js → viewer-check-TSH3SAYJ.js} +12 -12
- package/dist/{web-4JGYRY36.js → web-UOGBNAHR.js} +4 -4
- package/dist/{winning-ads-6SXA4HGB.js → winning-ads-SGBI3WHK.js} +3 -3
- package/dist/{write-commands-LQXKNBA5.js → write-commands-E7JOB4HX.js} +5 -5
- package/dist/{x-LUEUC3XO.js → x-UNSN57YP.js} +6 -6
- package/package.json +1 -1
- package/dist/chunk-3BKNGXCL.js.map +0 -1
- package/dist/chunk-F3CZFUXZ.js.map +0 -1
- package/dist/chunk-F5IH7G2F.js.map +0 -1
- package/dist/chunk-I2DNBEV6.js.map +0 -1
- package/dist/chunk-JRFVSSKP.js.map +0 -1
- package/dist/chunk-PNVEV3XP.js.map +0 -1
- package/dist/chunk-QTLZXIF3.js.map +0 -1
- package/dist/chunk-RMNKCVRB.js.map +0 -1
- package/dist/chunk-TY4BDVLG.js.map +0 -1
- package/dist/chunk-UTLIQBRY.js.map +0 -1
- package/dist/make-EWHS4EHQ.js.map +0 -1
- /package/dist/{account-KZVOT6HL.js.map → account-VH2AATWI.js.map} +0 -0
- /package/dist/{account-ELL7ZZLM.js.map → account-Z65CPOWE.js.map} +0 -0
- /package/dist/{account-reads-LA45L6G3.js.map → account-reads-GYI2SS6T.js.map} +0 -0
- /package/dist/{account-writes-CEPERFD6.js.map → account-writes-4N2MA2ZR.js.map} +0 -0
- /package/dist/{accounts-HC7GPQNG.js.map → accounts-SPLE7URQ.js.map} +0 -0
- /package/dist/{accounts-7G556DH4.js.map → accounts-XG472YLB.js.map} +0 -0
- /package/dist/{actions-V6YP5C3X.js.map → actions-KQTXBNJU.js.map} +0 -0
- /package/dist/{activecampaign-CHZEHRHZ.js.map → activecampaign-42JXANUA.js.map} +0 -0
- /package/dist/{ad-group-writes-XGSCEQTW.js.map → ad-group-writes-EUTMPBMK.js.map} +0 -0
- /package/dist/{ad-groups-GKOLDGET.js.map → ad-groups-OVPAI5RM.js.map} +0 -0
- /package/dist/{ad-writes-VVD36JKH.js.map → ad-writes-DACTYFEO.js.map} +0 -0
- /package/dist/{add-3MD72QMT.js.map → add-C3FQ5D62.js.map} +0 -0
- /package/dist/{add-TSQNUP5N.js.map → add-KTEJCE4L.js.map} +0 -0
- /package/dist/{ads-EKZVHKPN.js.map → ads-L65JIKCD.js.map} +0 -0
- /package/dist/{ads-KRM4WAMZ.js.map → ads-WPI3AMSR.js.map} +0 -0
- /package/dist/{advertisers-XJG7XDK7.js.map → advertisers-36HP3AOE.js.map} +0 -0
- /package/dist/{analytics-JVT2OBQC.js.map → analytics-I4LZCRG2.js.map} +0 -0
- /package/dist/{analytics-DO4UKW2H.js.map → analytics-IFNBT7IM.js.map} +0 -0
- /package/dist/{animate-G4P3OEJE.js.map → animate-3LV3LHXQ.js.map} +0 -0
- /package/dist/{assign-72YAL6TP.js.map → assign-WBLSZNCO.js.map} +0 -0
- /package/dist/{audience-size-M5NU4QYN.js.map → audience-size-LOX5BNXI.js.map} +0 -0
- /package/dist/{audiences-BU4JZJT7.js.map → audiences-RPLVMO4H.js.map} +0 -0
- /package/dist/{audit-22KQAHJR.js.map → audit-6AG6BPXQ.js.map} +0 -0
- /package/dist/{autocomplete-KLNQIK5T.js.map → autocomplete-2QRU7ARD.js.map} +0 -0
- /package/dist/{avatars-VO6FMJFB.js.map → avatars-EIETXCF3.js.map} +0 -0
- /package/dist/{bid-pricing-52HDANYL.js.map → bid-pricing-5LZFHQTS.js.map} +0 -0
- /package/dist/{brand-XXNOVSGE.js.map → brand-CINQG3JG.js.map} +0 -0
- /package/dist/{brief-JIARAUIR.js.map → brief-WAQ2V6Q4.js.map} +0 -0
- /package/dist/{campaign-groups-JFOFU76X.js.map → campaign-groups-5CMTEJZZ.js.map} +0 -0
- /package/dist/{campaign-writes-PKWLLKB5.js.map → campaign-writes-4RMPHQCT.js.map} +0 -0
- /package/dist/{campaign-writes-NSEJCINS.js.map → campaign-writes-U5LTDTYK.js.map} +0 -0
- /package/dist/{campaigns-5AZMOOID.js.map → campaigns-NFRLFNXI.js.map} +0 -0
- /package/dist/{campaigns-H4VK3GKK.js.map → campaigns-PC7UAVXR.js.map} +0 -0
- /package/dist/{campaigns-VWN2XPK2.js.map → campaigns-TFEQTSO3.js.map} +0 -0
- /package/dist/{canvas-TTV7QZZT.js.map → canvas-A4XKEBN7.js.map} +0 -0
- /package/dist/{capabilities-VJ53ROIP.js.map → capabilities-FNVTPCDT.js.map} +0 -0
- /package/dist/{catalog-43BSTAT6.js.map → catalog-SJBGNNY4.js.map} +0 -0
- /package/dist/{catalogs-XH5NHH4C.js.map → catalogs-A7XMEEEP.js.map} +0 -0
- /package/dist/{changes-F6WUXFC3.js.map → changes-J67WATHX.js.map} +0 -0
- /package/dist/{chatgpt-K6KNTME4.js.map → chatgpt-4PEWDJKP.js.map} +0 -0
- /package/dist/{chats-PWLQO7UY.js.map → chats-S5FCV7YO.js.map} +0 -0
- /package/dist/{check-545MAB4E.js.map → check-GCZ2ZBKH.js.map} +0 -0
- /package/dist/{chunk-GJWMPTUE.js.map → chunk-2DHHL4PU.js.map} +0 -0
- /package/dist/{chunk-5SRHACZW.js.map → chunk-3UXMQ3K2.js.map} +0 -0
- /package/dist/{chunk-U63S2JWI.js.map → chunk-4VWTIT5C.js.map} +0 -0
- /package/dist/{chunk-XLJVJ5TK.js.map → chunk-5NS4CNF6.js.map} +0 -0
- /package/dist/{chunk-YU2XIIL3.js.map → chunk-5YKC2WWG.js.map} +0 -0
- /package/dist/{chunk-6OIKNJ7G.js.map → chunk-65N4ZPQD.js.map} +0 -0
- /package/dist/{chunk-I2WRZJAC.js.map → chunk-6KK26F2T.js.map} +0 -0
- /package/dist/{chunk-64HQDJ2E.js.map → chunk-7U3V64YT.js.map} +0 -0
- /package/dist/{chunk-SEPPFM5S.js.map → chunk-7VHPAGPK.js.map} +0 -0
- /package/dist/{chunk-C7MENOP5.js.map → chunk-A2FKWRKO.js.map} +0 -0
- /package/dist/{chunk-MK3OJZIU.js.map → chunk-ABXTGAG7.js.map} +0 -0
- /package/dist/{chunk-G5GV6SUK.js.map → chunk-ADSNY4KZ.js.map} +0 -0
- /package/dist/{chunk-3UBTVAFJ.js.map → chunk-AHF6TQWB.js.map} +0 -0
- /package/dist/{chunk-S7B2TOOU.js.map → chunk-AQ5WISEG.js.map} +0 -0
- /package/dist/{chunk-RGX7AQ2K.js.map → chunk-AS5VL32C.js.map} +0 -0
- /package/dist/{chunk-QKABEX3F.js.map → chunk-BSEB55E6.js.map} +0 -0
- /package/dist/{chunk-TKPVVD52.js.map → chunk-CCIDHU6M.js.map} +0 -0
- /package/dist/{chunk-AOZ7547I.js.map → chunk-CXQRTLSQ.js.map} +0 -0
- /package/dist/{chunk-FQXGII24.js.map → chunk-DCTEL4KG.js.map} +0 -0
- /package/dist/{chunk-P5PX2G7E.js.map → chunk-DF22CTXE.js.map} +0 -0
- /package/dist/{chunk-V4UIM4QE.js.map → chunk-DH5CKOYK.js.map} +0 -0
- /package/dist/{chunk-QZHGIJOW.js.map → chunk-DQC4NIJE.js.map} +0 -0
- /package/dist/{chunk-SQ7DRYCC.js.map → chunk-FEELV5IV.js.map} +0 -0
- /package/dist/{chunk-2QSPPWOU.js.map → chunk-FRK7SSEH.js.map} +0 -0
- /package/dist/{chunk-GD6UJDOB.js.map → chunk-IWWOGBGA.js.map} +0 -0
- /package/dist/{chunk-QYAI24PN.js.map → chunk-JFA4R3KS.js.map} +0 -0
- /package/dist/{chunk-WHSTZRUY.js.map → chunk-K2Z3KGOH.js.map} +0 -0
- /package/dist/{chunk-3ZHOBEQD.js.map → chunk-KQDAFZKR.js.map} +0 -0
- /package/dist/{chunk-ZJ6HUCRK.js.map → chunk-LD4CHA7U.js.map} +0 -0
- /package/dist/{chunk-CSN6L345.js.map → chunk-MIOOPOG2.js.map} +0 -0
- /package/dist/{chunk-TNB5EIFV.js.map → chunk-NCP6RD6A.js.map} +0 -0
- /package/dist/{chunk-D6KHVUDS.js.map → chunk-NNF4RARY.js.map} +0 -0
- /package/dist/{chunk-UWT7RCL3.js.map → chunk-NR2OVOTD.js.map} +0 -0
- /package/dist/{chunk-LMZAOTRX.js.map → chunk-NVGXYF6K.js.map} +0 -0
- /package/dist/{chunk-SIKCVWM3.js.map → chunk-ORQKMXHA.js.map} +0 -0
- /package/dist/{chunk-XP4G2DJL.js.map → chunk-Q7YZL7PG.js.map} +0 -0
- /package/dist/{chunk-K4NMOWG7.js.map → chunk-R2TAVQGZ.js.map} +0 -0
- /package/dist/{chunk-IYELKHBG.js.map → chunk-R5WNYLG4.js.map} +0 -0
- /package/dist/{chunk-XFJNCZXA.js.map → chunk-RCSOG2DV.js.map} +0 -0
- /package/dist/{chunk-ZBUWO4XH.js.map → chunk-RD2XXQW3.js.map} +0 -0
- /package/dist/{chunk-46TND6YK.js.map → chunk-RLS5OPPZ.js.map} +0 -0
- /package/dist/{chunk-PHPXAMY3.js.map → chunk-RMLJNHCU.js.map} +0 -0
- /package/dist/{chunk-LFXE2G6R.js.map → chunk-TNOJ6O6B.js.map} +0 -0
- /package/dist/{chunk-TBHRRQZD.js.map → chunk-U4W4LULB.js.map} +0 -0
- /package/dist/{chunk-2WTD5Y34.js.map → chunk-U6IWRZQF.js.map} +0 -0
- /package/dist/{chunk-SK2N45LO.js.map → chunk-UMZIQIWN.js.map} +0 -0
- /package/dist/{chunk-KXSXZAC2.js.map → chunk-V6PXHQSI.js.map} +0 -0
- /package/dist/{chunk-REMR5FHD.js.map → chunk-WD5BQBVY.js.map} +0 -0
- /package/dist/{chunk-ROX7LQRR.js.map → chunk-WMVTIKET.js.map} +0 -0
- /package/dist/{chunk-I44SNQ34.js.map → chunk-WNJ5SYAG.js.map} +0 -0
- /package/dist/{chunk-DDES6J6A.js.map → chunk-XSGO44OV.js.map} +0 -0
- /package/dist/{chunk-TUSR5R7I.js.map → chunk-XUB2EK65.js.map} +0 -0
- /package/dist/{chunk-JQNO6JCV.js.map → chunk-XUR4QWCS.js.map} +0 -0
- /package/dist/{chunk-KOVQ2JGM.js.map → chunk-YD7BQDJ6.js.map} +0 -0
- /package/dist/{chunk-B7FVPHCW.js.map → chunk-ZBV5IV5T.js.map} +0 -0
- /package/dist/{claim-QHXKN7W6.js.map → claim-6MPQD43X.js.map} +0 -0
- /package/dist/{companies-PGVT62JL.js.map → companies-KRF2K4CA.js.map} +0 -0
- /package/dist/{complete-TCTR3XVD.js.map → complete-V433ON5C.js.map} +0 -0
- /package/dist/{connect-4S7JLICS.js.map → connect-QVIAM3GX.js.map} +0 -0
- /package/dist/{conversation-DI4WMEL2.js.map → conversation-VZKBZZGG.js.map} +0 -0
- /package/dist/{conversion-report-KL4LIVY5.js.map → conversion-report-REOHVLCI.js.map} +0 -0
- /package/dist/{conversion-upload-command-EIKJU5ZW.js.map → conversion-upload-command-ASHA6T6H.js.map} +0 -0
- /package/dist/{conversion-writes-MPBCTVSP.js.map → conversion-writes-JU7Q2MUO.js.map} +0 -0
- /package/dist/{conversions-ACYT6K7H.js.map → conversions-3ISBR3TS.js.map} +0 -0
- /package/dist/{conversions-JTYMFX66.js.map → conversions-ZLC6YTJ5.js.map} +0 -0
- /package/dist/{create-VFXEJ3EV.js.map → create-B3QMYSIX.js.map} +0 -0
- /package/dist/{create-3QA7X2DD.js.map → create-IFCCMKFT.js.map} +0 -0
- /package/dist/{create-AFVT5JTH.js.map → create-R5P6JU5A.js.map} +0 -0
- /package/dist/{create-TYCOMVWR.js.map → create-SF6DOGDJ.js.map} +0 -0
- /package/dist/{creatives-E6N2YLHE.js.map → creatives-KD7MOCR3.js.map} +0 -0
- /package/dist/{creatives-5VY3LT6X.js.map → creatives-U2M4F3D5.js.map} +0 -0
- /package/dist/{credentials-34I6ZZWU.js.map → credentials-2KJUKBMF.js.map} +0 -0
- /package/dist/{critique-OCVV6N3U.js.map → critique-43OVWKN7.js.map} +0 -0
- /package/dist/{critique-JM5QADYW.js.map → critique-JVKJEBAC.js.map} +0 -0
- /package/dist/{crm-MNBYNP5R.js.map → crm-GX72E2LT.js.map} +0 -0
- /package/dist/{crm-4F3LFOZD.js.map → crm-ZYDNEME5.js.map} +0 -0
- /package/dist/{currency-3QTI5RSB.js.map → currency-CGDI2NXI.js.map} +0 -0
- /package/dist/{customers-VNYNT2EQ.js.map → customers-P4N4NXLJ.js.map} +0 -0
- /package/dist/{delete-UZRHYEPK.js.map → delete-AK5IV44E.js.map} +0 -0
- /package/dist/{delete-PRJGFA2U.js.map → delete-RS7RQDUX.js.map} +0 -0
- /package/dist/{delete-AZEVPMVO.js.map → delete-S4VKH7IS.js.map} +0 -0
- /package/dist/{demographics-JMZA7MB6.js.map → demographics-IKWN2H3V.js.map} +0 -0
- /package/dist/{discard-OH3B5P4C.js.map → discard-H6DOHJRG.js.map} +0 -0
- /package/dist/{discover-5GLET36U.js.map → discover-L4TPEKGY.js.map} +0 -0
- /package/dist/{domain-K3IILLYE.js.map → domain-US4KKAXC.js.map} +0 -0
- /package/dist/{draft-LZL6VWHX.js.map → draft-BIQ3ZAYW.js.map} +0 -0
- /package/dist/{draft-7RYDPOFS.js.map → draft-IZ4YLQRD.js.map} +0 -0
- /package/dist/{draft-2KHUZTIE.js.map → draft-OLFQZBWL.js.map} +0 -0
- /package/dist/{draft-BB3UUWJP.js.map → draft-R32RFDCI.js.map} +0 -0
- /package/dist/{draft-VXGZDBC7.js.map → draft-Y2QJE2NM.js.map} +0 -0
- /package/dist/{facets-PAWOEHOK.js.map → facets-JBZQHN3D.js.map} +0 -0
- /package/dist/{feedback-GAGIKZ6B.js.map → feedback-3GU3PAEI.js.map} +0 -0
- /package/dist/{feedback-record-ZORDBRV2.js.map → feedback-record-PIJDOJW3.js.map} +0 -0
- /package/dist/{fetch-M5GIBURQ.js.map → fetch-GOY6DQRL.js.map} +0 -0
- /package/dist/{fit-DGCYW7LN.js.map → fit-TVQ7RK52.js.map} +0 -0
- /package/dist/{flows-TD6PNUDM.js.map → flows-274YPU6I.js.map} +0 -0
- /package/dist/{fonts-IQ6XOUGU.js.map → fonts-BMUNDGOZ.js.map} +0 -0
- /package/dist/{forecast-YXOKAWDZ.js.map → forecast-F2CZSIMP.js.map} +0 -0
- /package/dist/{forecast-FACEH4WR.js.map → forecast-W5F2MNOV.js.map} +0 -0
- /package/dist/{funnel-CJRFDTCD.js.map → funnel-LEUXICXU.js.map} +0 -0
- /package/dist/{generate-D3LUXFJT.js.map → generate-4HWNFAH3.js.map} +0 -0
- /package/dist/{get-JRMJLLU5.js.map → get-MGDY5JYZ.js.map} +0 -0
- /package/dist/{get-NUL4YJG5.js.map → get-TY6AMFI4.js.map} +0 -0
- /package/dist/{google-URYXWN5O.js.map → google-ZTTE34A4.js.map} +0 -0
- /package/dist/{google-ads-BB7CF4NV.js.map → google-ads-5ARKO757.js.map} +0 -0
- /package/dist/{history-OQAOTEO3.js.map → history-IQ33J5PB.js.map} +0 -0
- /package/dist/{history-Q47TKZJS.js.map → history-SU7VQCDJ.js.map} +0 -0
- /package/dist/{hubspot-A6O5GVTH.js.map → hubspot-TJED44GO.js.map} +0 -0
- /package/dist/{ideas-LD6X753E.js.map → ideas-UTSCGCT6.js.map} +0 -0
- /package/dist/{images-XY5DLJEA.js.map → images-ZMZ4WLYH.js.map} +0 -0
- /package/dist/{ingest-WWNSA6VZ.js.map → ingest-DGDNZWEM.js.map} +0 -0
- /package/dist/{ingest-PUMTHASV.js.map → ingest-SGBJ3NXX.js.map} +0 -0
- /package/dist/{insights-PZXFCMX2.js.map → insights-SQLE5NOJ.js.map} +0 -0
- /package/dist/{inspect-5PRLZLF5.js.map → inspect-BMQTTKMW.js.map} +0 -0
- /package/dist/{intent-4QVVI4FF.js.map → intent-LM36WK45.js.map} +0 -0
- /package/dist/{keyword-gap-YMMDRYVK.js.map → keyword-gap-P652ODHN.js.map} +0 -0
- /package/dist/{keyword-metrics-FB7FCYK6.js.map → keyword-metrics-MQLGGJBT.js.map} +0 -0
- /package/dist/{keywords-for-site-YZYALONY.js.map → keywords-for-site-JL6H2YGU.js.map} +0 -0
- /package/dist/{landing-XOCPIOWX.js.map → landing-AJO2BPC2.js.map} +0 -0
- /package/dist/{languages-R3Y2IOFU.js.map → languages-HL42MI7H.js.map} +0 -0
- /package/dist/{leads-SWINPYEP.js.map → leads-H6JIWVI6.js.map} +0 -0
- /package/dist/{learn-6HVDSTTJ.js.map → learn-RGO5KDHS.js.map} +0 -0
- /package/dist/{line-item-writes-FG3TY4W4.js.map → line-item-writes-V7AKAHFC.js.map} +0 -0
- /package/dist/{line-items-ZNVBFA4H.js.map → line-items-GAMKVVIQ.js.map} +0 -0
- /package/dist/{link-IFEXIUDW.js.map → link-Z5AQP6JN.js.map} +0 -0
- /package/dist/{linkedin-NINSMEW6.js.map → linkedin-7F6YVXQL.js.map} +0 -0
- /package/dist/{list-K65FY6SV.js.map → list-NLGM3QDP.js.map} +0 -0
- /package/dist/{list-RJG3FMZR.js.map → list-SZH6TH74.js.map} +0 -0
- /package/dist/{list-FR2OVRVL.js.map → list-XZVQWIJN.js.map} +0 -0
- /package/dist/{locations-6IH7WGRG.js.map → locations-AEGZ36JH.js.map} +0 -0
- /package/dist/{locations-VL2G22Y5.js.map → locations-YA7NZY44.js.map} +0 -0
- /package/dist/{log-TAKCMC2C.js.map → log-JM4VLJE4.js.map} +0 -0
- /package/dist/{map-DWLEYXSW.js.map → map-HRLUMCR2.js.map} +0 -0
- /package/dist/{mcp-NNQZ5B7N.js.map → mcp-T6SAG4XB.js.map} +0 -0
- /package/dist/{media-sources-OAFBA62X.js.map → media-sources-7AS3274L.js.map} +0 -0
- /package/dist/{members-SS7IBYVE.js.map → members-J5KWXTXY.js.map} +0 -0
- /package/dist/{metrics-YLAREC4T.js.map → metrics-VDBJ6KL7.js.map} +0 -0
- /package/dist/{models-IH6KE6OH.js.map → models-2DQ5NBMT.js.map} +0 -0
- /package/dist/{normalize-WOZTAI6C.js.map → normalize-CHZB4QDD.js.map} +0 -0
- /package/dist/{options-PL44BV5E.js.map → options-QLXFLESP.js.map} +0 -0
- /package/dist/{organization-SQBODZUK.js.map → organization-KEGKAP4P.js.map} +0 -0
- /package/dist/{performance-WRARV3YR.js.map → performance-SPGPGXE5.js.map} +0 -0
- /package/dist/{pixels-DWW2TDY2.js.map → pixels-6IUB3Y3H.js.map} +0 -0
- /package/dist/{promoted-tweet-writes-CAD3RGU4.js.map → promoted-tweet-writes-TRR3KPRJ.js.map} +0 -0
- /package/dist/{promoted-tweets-NYJP3TXL.js.map → promoted-tweets-XRYZNJI2.js.map} +0 -0
- /package/dist/{publish-ZW6VHB27.js.map → publish-V5YGMK53.js.map} +0 -0
- /package/dist/{query-QRPBV2AR.js.map → query-M3IO54U2.js.map} +0 -0
- /package/dist/{reddit-VJTNXORD.js.map → reddit-STSECKMZ.js.map} +0 -0
- /package/dist/{refresh-6I52WXG5.js.map → refresh-RQ3C2MHI.js.map} +0 -0
- /package/dist/{release-LSSYP2ZJ.js.map → release-UHGU5WBY.js.map} +0 -0
- /package/dist/{relevant-pages-2XHS5WP4.js.map → relevant-pages-G6SNC73K.js.map} +0 -0
- /package/dist/{remove-K62YJYGT.js.map → remove-LTKICIIF.js.map} +0 -0
- /package/dist/{reopen-RPVEBQVR.js.map → reopen-BP5ERELB.js.map} +0 -0
- /package/dist/{rerun-ETH2NEEX.js.map → rerun-R3DNEV5U.js.map} +0 -0
- /package/dist/{research-6J3EOBAL.js.map → research-GOYMTKZM.js.map} +0 -0
- /package/dist/{research-4ASN2KMB.js.map → research-MBAPL35Y.js.map} +0 -0
- /package/dist/{reset-YVTYHSTY.js.map → reset-Q62PEGOU.js.map} +0 -0
- /package/dist/{reset-ETORO5UO.js.map → reset-SJPGSQ7I.js.map} +0 -0
- /package/dist/{resolve-BI7GB5U2.js.map → resolve-R45W7QEQ.js.map} +0 -0
- /package/dist/{retry-QZ7YHXF3.js.map → retry-CD2Q2AJN.js.map} +0 -0
- /package/dist/{retry-2ZZCKSRW.js.map → retry-NBZ7Q6HK.js.map} +0 -0
- /package/dist/{rules-KEHQEXEU.js.map → rules-SZIY67QF.js.map} +0 -0
- /package/dist/{rules-add-IDBWO6XV.js.map → rules-add-KTLHU3YD.js.map} +0 -0
- /package/dist/{run-KYEOLJFV.js.map → run-HCJKCEOL.js.map} +0 -0
- /package/dist/{run-FFASB4YB.js.map → run-QYIUO4NB.js.map} +0 -0
- /package/dist/{scaffold-ad-EKCXHZPT.js.map → scaffold-ad-NIVJSO73.js.map} +0 -0
- /package/dist/{scaffold-static-ad-MWKTXATN.js.map → scaffold-static-ad-QX2NUXFR.js.map} +0 -0
- /package/dist/{scaffold-video-BYPPH352.js.map → scaffold-video-NXBM54K3.js.map} +0 -0
- /package/dist/{schedule-4BK2ML6F.js.map → schedule-BSQHXJ5V.js.map} +0 -0
- /package/dist/{scheduled-agents-GMGP3G6T.js.map → scheduled-agents-MFLMG34I.js.map} +0 -0
- /package/dist/{schema-QPPWADIL.js.map → schema-IWPG3YSN.js.map} +0 -0
- /package/dist/{search-GCSQ6CSD.js.map → search-EGI5K77S.js.map} +0 -0
- /package/dist/{select-CPFKK57J.js.map → select-Q4S4CPKV.js.map} +0 -0
- /package/dist/{set-prompt-TJ3UTNYS.js.map → set-prompt-3MVZW3L6.js.map} +0 -0
- /package/dist/{setup-links-C3EUV2RX.js.map → setup-links-5ILQNMFZ.js.map} +0 -0
- /package/dist/{site-W5W7FCUD.js.map → site-LBXNVRPE.js.map} +0 -0
- /package/dist/{sources-AWODYZDS.js.map → sources-GP4PUTX2.js.map} +0 -0
- /package/dist/{sources-SGGLJIOA.js.map → sources-N4UANUHJ.js.map} +0 -0
- /package/dist/{stale-KILEXX57.js.map → stale-NT2JRQHY.js.map} +0 -0
- /package/dist/{status-KUSLGZD7.js.map → status-GSFMLC6W.js.map} +0 -0
- /package/dist/{studio-LMDDQWRY.js.map → studio-YB5WXQYC.js.map} +0 -0
- /package/dist/{sync-TCY4NX7J.js.map → sync-LIV7FU4N.js.map} +0 -0
- /package/dist/{sync-definition-DGSAZGQZ.js.map → sync-definition-6XPX6VJU.js.map} +0 -0
- /package/dist/{tags-ZYVOKGHU.js.map → tags-4JQX7HMT.js.map} +0 -0
- /package/dist/{tags-QQLYW2QQ.js.map → tags-6RQVXS47.js.map} +0 -0
- /package/dist/{tags-QXRKKRIR.js.map → tags-AAIFQ6LS.js.map} +0 -0
- /package/dist/{tags-U5YWCPFW.js.map → tags-F355NMIR.js.map} +0 -0
- /package/dist/{tags-IHLO2NDM.js.map → tags-ZHCGHGYC.js.map} +0 -0
- /package/dist/{targeting-criteria-AEBSY6OY.js.map → targeting-criteria-6FY2JB3V.js.map} +0 -0
- /package/dist/{targets-5Q2OFVXL.js.map → targets-NI7TR4GV.js.map} +0 -0
- /package/dist/{testimonials-O52ULRAU.js.map → testimonials-G7CCH7VN.js.map} +0 -0
- /package/dist/{themes-26XFWSWC.js.map → themes-PXDXIKYR.js.map} +0 -0
- /package/dist/{top-companies-OMGAFFWN.js.map → top-companies-YH2ZJEH5.js.map} +0 -0
- /package/dist/{translate-C5LZ6KVN.js.map → translate-27DIFMBU.js.map} +0 -0
- /package/dist/{triggers-PTPG6OQ6.js.map → triggers-WYFM7PAH.js.map} +0 -0
- /package/dist/{unlink-3BAXM2OH.js.map → unlink-PTWUSM5B.js.map} +0 -0
- /package/dist/{unstage-EFW465VN.js.map → unstage-MCM6EZWK.js.map} +0 -0
- /package/dist/{update-VTUB2M5I.js.map → update-2BDIJDHN.js.map} +0 -0
- /package/dist/{update-5A7Q7S6I.js.map → update-643S2MUW.js.map} +0 -0
- /package/dist/{update-XPRHUFBR.js.map → update-GUIP6G3N.js.map} +0 -0
- /package/dist/{update-2RCIXWP3.js.map → update-V6E3CIFD.js.map} +0 -0
- /package/dist/{upload-Y3TACPEN.js.map → upload-3YJJ5VID.js.map} +0 -0
- /package/dist/{url-options-6CNDIUDM.js.map → url-options-LHS4SWWB.js.map} +0 -0
- /package/dist/{url-params-ZUYOLAJG.js.map → url-params-2DKIXKHH.js.map} +0 -0
- /package/dist/{validate-KPJLIGYY.js.map → validate-AYPLNS7A.js.map} +0 -0
- /package/dist/{videos-EFMNE6U2.js.map → videos-KEDR4GG3.js.map} +0 -0
- /package/dist/{viewer-check-2GI26EKA.js.map → viewer-check-TSH3SAYJ.js.map} +0 -0
- /package/dist/{web-4JGYRY36.js.map → web-UOGBNAHR.js.map} +0 -0
- /package/dist/{winning-ads-6SXA4HGB.js.map → winning-ads-SGBI3WHK.js.map} +0 -0
- /package/dist/{write-commands-LQXKNBA5.js.map → write-commands-E7JOB4HX.js.map} +0 -0
- /package/dist/{x-LUEUC3XO.js.map → x-UNSN57YP.js.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/creatives/make-model.ts"],"sourcesContent":["/**\n * The rules `baker creatives make` applies to turn an idea into a creative: which reference to\n * look for, which one fits, and what the creative records about the idea it carries. Pure.\n */\nimport { proofStrength } from \"@baker/api/ad-library\";\nimport { parse, parseDocument, Scalar, visit } from \"yaml\";\nimport { AD_SPEC_SCHEMA, type AdSpec, unfitReasons } from \"../../engine/scaffold/static-ad-spec.ts\";\nimport type { ViewerTemperature } from \"../../viewer-profile.ts\";\nimport type { PersonaEntry } from \"../canvas/viewer-check.ts\";\nimport type { FitAnswer, FitBet } from \"../winning-ads/fit.ts\";\nimport type { WinningAdsSearchArgs } from \"../winning-ads/search.ts\";\nimport { type EvidenceLevel, figuresIn, IDEA_VIDEO_FORMATS, type Idea, unsourcedClaims } from \"./ideas-model.ts\";\nimport type { ReferenceBrief } from \"./reference-brief.ts\";\nimport type { RankedFor } from \"./reference-rank.ts\";\n\nexport const REFERENCE_CANDIDATES = 6;\n\n/** Whether the idea is a video, built from beats, rather than a static from a reference. */\nexport function isVideoIdea(idea: Pick<Idea, \"format\">): boolean {\n return (IDEA_VIDEO_FORMATS as readonly string[]).includes(idea.format ?? \"\");\n}\n\n/** Who a reference was made for, by our viewer: a stranger's ad never leans on its own brand. */\nconst BY_TEMPERATURE: Record<ViewerTemperature, { audienceTemperature: string; excludeBrandReliant?: true }> = {\n cold: { audienceTemperature: \"0_cold\", excludeBrandReliant: true },\n warm: { audienceTemperature: \"1_warm_engaged,2_hot_visited\", excludeBrandReliant: true },\n hot: { audienceTemperature: \"3_customer\" },\n};\n\n/**\n * Where a reference is looked for: the company's market (`GB`), what it sells (\"rooftop solar\") and\n * who the ad is for (\"Bill-shocked homeowner\") and its broader industry (\"home energy\"), when known.\n */\nexport type ReferenceWhere = {\n country?: string;\n category?: string;\n audience?: string;\n /** Searches that widen from the ad, closest first: adjacent products, the same buyer, the same decision. */\n wider?: readonly string[];\n industry?: string;\n};\n\n/**\n * The library search for a static idea's reference: its container, made for our viewer, on what\n * the company sells (else the idea's message), in its market when given.\n */\nexport function referenceSearchFor(\n idea: Idea,\n temperature: ViewerTemperature,\n where: ReferenceWhere = {},\n): WinningAdsSearchArgs {\n return {\n query: where.category || idea.message,\n scope: \"followed-first\",\n platform: \"meta\",\n format: \"static\",\n formatPattern: idea.format,\n awareness: idea.awareness,\n ...BY_TEMPERATURE[temperature],\n ...(where.country ? { country: where.country } : {}),\n maxPerAdvertiser: 1,\n limit: REFERENCE_CANDIDATES,\n diverse: true,\n };\n}\n\n/**\n * The searches whose candidates are tried, best first. A proven ad of what the company sells comes\n * before the idea's container: its market, viewer and objections are ours, and its container is one\n * the thinking can keep or change. So: what the company sells, in its market (in the idea's\n * container for our viewer, loosened in turn, then any container), then anywhere; then ads made for\n * the same people, whatever they sell; then wider (an adjacent product, the same buyer buying\n * something else, the same kind of decision); then ads of the broader industry; then the message;\n * then the container's proven winners from any category, in the market and anywhere.\n * The library's judge scores an ad against the query: prod, Oct 2026, a customer's sentence about\n * one product matched no ad of another category and 13 of 15 ideas found nothing; dev, Oct 2026,\n * searched with the whole message, a UK solar installer's ads were checked against a crypto\n * exchange, a clinic and an English course, while the library held UK solar ads; and with the\n * container a filter, 7 of 10 companies found 0–2 ads of their own category.\n */\nexport function referenceSearchesFor(\n idea: Idea,\n temperature: ViewerTemperature,\n where: ReferenceWhere = {},\n): WinningAdsSearchArgs[] {\n const strict = referenceSearchFor(idea, temperature, where);\n const { awareness: _awareness, ...anyStage } = strict;\n const { audienceTemperature: _temperature, excludeBrandReliant: _reliant, ...viewerAny } = anyStage;\n const anyViewer = { ...viewerAny, scope: \"all\" as const };\n const { formatPattern: _pattern, ...anyContainer } = anyViewer;\n const { country: _country, ...anywhere } = anyViewer;\n const { country: _anyCountry, ...anyContainerAnywhere } = anyContainer;\n const { query: _query, ...winners } = anyStage;\n const { query: _anyQuery, country: _winnersCountry, ...winnersAnywhere } = anyViewer;\n const inMarket = (steps: WinningAdsSearchArgs[]) => (where.country ? steps : []);\n // What the idea shows, from any category: the picture that lands the message is found where it\n // won, and the ranking then asks whether it was made for our buyer.\n const shows = idea.shows?.trim();\n const { formatPattern: _shownPattern, ...anyCategory } = { ...anyStage, scope: \"all\" as const };\n const { country: _shownCountry, ...anyCategoryAnywhere } = anyCategory;\n const { country: _viewerCountry, ...anyViewerAnywhere } = anyViewer;\n const { formatPattern: _anyPattern, ...shownAnyViewer } = anyViewerAnywhere;\n const shown: WinningAdsSearchArgs[] = shows\n ? [\n ...inMarket([{ ...anyCategory, query: shows }]),\n { ...anyCategoryAnywhere, query: shows },\n { ...shownAnyViewer, query: shows },\n ...(idea.format ? [{ ...anyViewerAnywhere, query: shows }] : []),\n ]\n : [];\n const anyAd = (query: string | undefined) =>\n query?.trim()\n ? [...inMarket([{ ...anyContainer, query: query.trim() }]), { ...anyContainerAnywhere, query: query.trim() }]\n : [];\n return [\n ...shown,\n ...(where.country ? [strict, anyStage, anyContainer] : [strict, anyStage]),\n anywhere,\n anyContainerAnywhere,\n ...anyAd(where.audience),\n ...(where.wider ?? []).flatMap((q) => (q.trim() ? [{ ...anyContainerAnywhere, query: q.trim() }] : [])),\n ...anyAd(where.industry),\n ...(where.category ? [{ ...anyContainerAnywhere, query: idea.message }] : []),\n ...inMarket([{ ...winners, sort: \"winner\" }]),\n { ...winnersAnywhere, sort: \"winner\" },\n ];\n}\n\n/**\n * Where a reference is looked for, from the brief when the model read one (its market over the\n * notes' guess; every market when it says the ad runs in several), else from the notes. Pure.\n */\nexport function referenceWhereOf(brief: ReferenceBrief | null, fallback: ReferenceWhere): ReferenceWhere {\n if (!brief) return fallback;\n const country = brief.country === null ? undefined : (brief.country ?? fallback.country);\n const audience = brief.audience ?? fallback.audience;\n return {\n ...(country ? { country } : {}),\n category: brief.category,\n ...(brief.industry ? { industry: brief.industry } : {}),\n ...(audience ? { audience } : {}),\n ...(brief.wider.length ? { wider: brief.wider } : {}),\n };\n}\n\n/** The ad being made, as candidates are ranked and picked for it: the brief's read, else the search's words. Pure. */\nexport function rankedForOf(\n brief: ReferenceBrief | null,\n where: ReferenceWhere,\n bet: Pick<FitBet, \"who\" | \"message\" | \"shows\">,\n): RankedFor {\n return {\n category: brief?.category ?? where.category ?? bet.message,\n ...(brief?.industry ? { industry: brief.industry } : {}),\n ...(brief?.buyer ? { buyer: brief.buyer } : {}),\n ...(brief?.humour ? { humour: brief.humour } : {}),\n ...(brief?.memes ? { memes: brief.memes } : {}),\n ...(brief?.memesWhy ? { memesWhy: brief.memesWhy } : {}),\n ...(brief?.avoid.length ? { avoid: brief.avoid } : {}),\n message: bet.message,\n who: bet.who,\n ...(bet.shows ? { shows: bet.shows } : {}),\n };\n}\n\n/** A name as the library and a person may both spell it: no accents, case or punctuation. Pure. */\nconst brandKey = (name: string) =>\n name\n .normalize(\"NFD\")\n .replace(/\\p{M}/gu, \"\")\n .toLowerCase()\n .replace(/[^\\p{L}\\p{N}]/gu, \"\");\n\n/** Whether an ad's advertiser is the company itself, by its brand names (three letters or more). Pure. */\nexport function isOwnBrand(advertiser: string | null | undefined, brands: readonly string[]): boolean {\n const page = brandKey(advertiser ?? \"\");\n return page !== \"\" && brands.some((b) => brandKey(b).length >= 3 && page.includes(brandKey(b)));\n}\n\ntype PoolCandidate = { ad_id?: string | null; advertiser_id?: string | null; winner_score?: number | null };\n\n/**\n * Every search's candidates in one list, the better search's first, one ad per brand (each fit\n * tried is another brand's move), the ads whose run barely proves them (`proofStrength` \"little\")\n * after the proven ones, at most `limit`. Pure.\n */\nexport function pooledCandidates<T extends PoolCandidate>(searches: readonly T[][], limit: number): T[] {\n const seen = new Set<string>();\n const pooled: T[] = [];\n for (const candidate of searches.flat()) {\n const brand = candidate.advertiser_id ? `brand:${candidate.advertiser_id}` : null;\n if (!candidate.ad_id || seen.has(candidate.ad_id) || (brand && seen.has(brand))) continue;\n seen.add(candidate.ad_id);\n if (brand) seen.add(brand);\n pooled.push(candidate);\n }\n const proven = (c: T) => proofStrength(c.winner_score) !== \"little\";\n return [...pooled.filter(proven), ...pooled.filter((c) => !proven(c))].slice(0, limit);\n}\n\n/** The proven ads, and their brands, the workspace's other creatives are already built on. */\nexport type TakenReferences = { adIds: ReadonlySet<string>; advertiserIds: ReadonlySet<string> };\n\n/**\n * The candidates no other creative is built on first (neither the ad nor its brand), then the\n * rest, each in its order: a batch of ideas is no longer built on one winning ad over and over,\n * and one already used is still built on when nothing else fits. Pure.\n */\nexport function freshReferencesFirst<T extends PoolCandidate>(candidates: readonly T[], taken: TakenReferences): T[] {\n return [\n ...candidates.filter((c) => !isTakenReference(c, taken)),\n ...candidates.filter((c) => isTakenReference(c, taken)),\n ];\n}\n\n/** Whether another creative is built on this ad or on another ad of its brand. Pure. */\nexport function isTakenReference(c: PoolCandidate, taken: TakenReferences): boolean {\n return (\n (c.ad_id != null && taken.adIds.has(c.ad_id)) ||\n (c.advertiser_id != null && taken.advertiserIds.has(c.advertiser_id))\n );\n}\n\n/** A reference fits when what it wins on is something we can supply, and our viewer would stop for it. */\nexport function fitsIdea(fit: Pick<FitAnswer, \"verdict\" | \"load_bearing\" | \"our_viewer\">): boolean {\n return fit.verdict !== \"reject\" && missingElements(fit).length === 0 && fit.our_viewer?.stops !== \"no\";\n}\n\n/** The load-bearing elements a reference wins on that we have nothing for. Pure. */\nexport function missingElements(fit: Pick<FitAnswer, \"load_bearing\">): string[] {\n return fit.load_bearing.filter((l) => l.have === \"missing\" && !l.ours?.trim()).map((l) => l.element);\n}\n\n/**\n * Why a checked reference was not built on, in one line the person can hear: what stops the scroll\n * or the proof that cannot be ours first, with the rule that forbids it; else that our viewer would\n * not stop for it; else the check's own note. Pure.\n */\nexport function whyUnfit(fit: Pick<FitAnswer, \"load_bearing\" | \"our_viewer\" | \"transfer_note\">): string {\n const reasons = unfitReasons(fit);\n if (reasons.length > 0) return reasons.join(\"; \");\n if (fit.our_viewer?.stops === \"no\") {\n return `our viewer would not stop for it${fit.our_viewer.why ? `: ${fit.our_viewer.why}` : \"\"}`;\n }\n return fit.transfer_note?.trim() || \"the check found it does not carry this ad\";\n}\n\nexport type DefinitionStrategyFields = {\n idea: string;\n message: string;\n evidence?: EvidenceLevel;\n angle: string;\n persona: string;\n awareness: string;\n hypothesis: string;\n};\n\n/** What a creative records about the idea it executes. */\nexport function definitionFieldsOf(idea: Idea, evidence: EvidenceLevel | \"explore\"): DefinitionStrategyFields {\n return {\n idea: idea.id,\n message: idea.message,\n ...(evidence !== \"explore\" ? { evidence } : {}),\n angle: idea.angle,\n persona: idea.who,\n awareness: idea.awareness,\n hypothesis: idea.why,\n };\n}\n\nconst FRONTMATTER = /^---\\r?\\n([\\s\\S]*?\\r?\\n)?---/;\n\n/** Whether a bare string reads back as the same text under YAML 1.1. */\nfunction readsAsText11(text: string): boolean {\n try {\n return parse(text, { version: \"1.1\" }) === text;\n } catch {\n return false;\n }\n}\n\n/** Set fields in a markdown file's frontmatter, keeping every other field and the body. */\nexport function setDefinitionFields(raw: string, fields: Record<string, unknown>): string {\n const match = raw.match(FRONTMATTER);\n if (!match) return raw;\n const doc = parseDocument(match[1] ?? \"\");\n if (doc.errors.length > 0) return raw;\n for (const [key, value] of Object.entries(fields)) {\n if (value === undefined) continue;\n const node = doc.createNode(value);\n // The site reads frontmatter as YAML 1.1, where a bare 2026-10-04 is a date, not text.\n visit(node, {\n Scalar(_, scalar) {\n if (typeof scalar.value === \"string\" && !readsAsText11(scalar.value)) {\n scalar.type = Scalar.QUOTE_DOUBLE;\n }\n },\n });\n doc.set(key, node);\n }\n return `---\\n${doc.toString()}---${raw.slice(match[0].length)}`;\n}\n\n/** The ad spec with the idea's message as the one thing it tells the viewer. */\nexport function setSpecMessage(specJson: string, message: string): string {\n const spec = JSON.parse(specJson) as Record<string, unknown>;\n return `${JSON.stringify({ ...spec, message }, null, 2)}\\n`;\n}\n\n/**\n * The ad spec made for the idea's persona: its title and segment from the Knowledge (\"The owner on\n * the move (Owner, 30–55, 1–10 staff)\"), else the idea's own words. The image prompt, the casting\n * check and the viewer check all read `viewer.who`; a reference-built spec held only the\n * scaffold's placeholder. The market and what the viewer knows are kept. Pure.\n */\nexport function setSpecViewer(specJson: string, idea: Pick<Idea, \"who\">, personas: readonly PersonaEntry[]): string {\n const spec = JSON.parse(specJson) as Record<string, unknown>;\n const viewer = (spec.viewer ?? {}) as Record<string, unknown>;\n return `${JSON.stringify({ ...spec, viewer: { ...viewer, who: personaWho(idea, personas) } }, null, 2)}\\n`;\n}\n\n/** Who an idea is for, in its persona's words (\"The owner on the move (Owner, 30–55)\"), else its own. Pure. */\nexport function personaWho(idea: Pick<Idea, \"who\">, personas: readonly PersonaEntry[]): string {\n const persona = personas.find((p) => p.slug === idea.who);\n if (persona?.title) return `${persona.title}${persona.segment ? ` (${persona.segment})` : \"\"}`;\n return persona?.segment ?? idea.who.replace(/[-_]/g, \" \");\n}\n\n/** The most words the audience search keeps: the library's judge reads a long query slowly. */\nconst AUDIENCE_QUERY_WORDS = 9;\n\n/**\n * The people the idea is for, as a library search: its persona's own words, cut short. Dev, Oct\n * 2026: \"homeowners worried about rising energy bills\" found twelve proven energy ads where\n * \"rooftop solar\" in the idea's container found one. Pure.\n */\nexport function audienceQuery(idea: Pick<Idea, \"who\">, personas: readonly PersonaEntry[]): string {\n return personaWho(idea, personas)\n .replace(/\\(/g, \" \")\n .replace(/\\)/g, \"\")\n .split(/\\s+/)\n .filter(Boolean)\n .slice(0, AUDIENCE_QUERY_WORDS)\n .join(\" \")\n .replace(/[\\s,;:.–—-]+$/, \"\");\n}\n\n/** The ad being made, as the fit judges a reference for it: its persona, message and the customers' words it stands on. Pure. */\nexport function fitBetOf(\n idea: Pick<Idea, \"who\" | \"message\" | \"awareness\" | \"angle\" | \"evidence\" | \"shows\">,\n personas: readonly PersonaEntry[],\n insights: readonly { id: string; quote: string }[],\n market?: string,\n): FitBet {\n const quotes = insights.filter((i) => idea.evidence.includes(i.id)).map((i) => i.quote);\n return {\n who: personaWho(idea, personas),\n message: idea.message,\n awareness: idea.awareness,\n angle: idea.angle,\n ...(idea.shows ? { shows: idea.shows } : {}),\n ...(quotes.length > 0 ? { quotes } : {}),\n ...(market ? { market } : {}),\n };\n}\n\n/**\n * The ad spec with the concept the reference's fit read (`conceptFromFit`): a build started before\n * the fit answered has none, or only the one the scaffold drafted from its describe, which names no\n * reference and nothing of what we have; without the fit's, the render never sees the reference at\n * the level that won. A concept a fit already seeded (it names its reference) stays. Pure.\n */\nexport function withFitConcept(specJson: string, seeded: Record<string, unknown>): string {\n const spec = JSON.parse(specJson) as Record<string, unknown>;\n const held = spec.concept as { reference_ad_id?: unknown } | undefined;\n if (held?.reference_ad_id) return specJson;\n return `${JSON.stringify({ ...spec, ...seeded }, null, 2)}\\n`;\n}\n\n/**\n * The copy lines the scaffold drafted that claim a figure the company never wrote: a draft written\n * beside a competitor's ad can carry the competitor's promise. `corpus` is what the company wrote.\n */\nexport function unsourcedCopyLines(specJson: string, corpus: string): string[] {\n const spec = JSON.parse(specJson) as { copy?: unknown };\n const figures = figuresIn(corpus);\n const lines = Array.isArray(spec.copy) ? spec.copy : [];\n return lines.flatMap((line) => {\n const text = typeof line === \"object\" && line !== null ? (line as { text?: unknown }).text : undefined;\n return typeof text === \"string\" && unsourcedClaims(text, figures).length > 0 ? [text] : [];\n });\n}\n\n/** Containers shown as a photograph; every other container is a designed graphic or a screen. */\nconst PHOTO_FORMATS = /photo|lifestyle|before_after|ugc|product|selfie|street/;\n\n/**\n * The ad spec an idea starts from when no proven ad fits it: the message and who it is for are\n * the idea's; the scene and the copy are placeholders the agent writes before anything renders\n * (`canvas run` refuses a placeholder). Pure.\n */\nexport function ideaSpec(idea: Idea, who: string): AdSpec {\n const container = idea.format ? `, as a ${idea.format.replace(/_/g, \" \")}` : \"\";\n const shows = idea.shows ? ` (${idea.shows})` : \"\";\n return {\n schema: AD_SPEC_SCHEMA,\n viewer: { who },\n message: idea.message,\n copy: [{ text: \"[TODO: the headline, in the customer's words]\", lettering: \"designed\", role: \"headline\" }],\n scene: {\n description: `[TODO: what the viewer sees first${shows}${container}, that shows: ${idea.message}]`,\n look: PHOTO_FORMATS.test(idea.format ?? idea.shows ?? \"\") ? \"photo\" : \"designed\",\n },\n colors: [],\n references: [],\n logo: true,\n third_party_brands: [],\n scene_text: [],\n mechanism: [],\n };\n}\n"],"mappings":";;;;;;;;;;;;;;AAKA,SAAS,OAAO,eAAe,QAAQ,aAAa;AAU7C,IAAM,uBAAuB;AAG7B,SAAS,YAAY,MAAqC;AAC/D,SAAQ,mBAAyC,SAAS,KAAK,UAAU,EAAE;AAC7E;AAGA,I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L,QAAQ;AAAA,IACR,QAAQ,EAAE,IAAI;AAAA,IACd,SAAS,KAAK;AAAA,IACd,MAAM,CAAC,EAAE,MAAM,iDAAiD,WAAW,YAAY,MAAM,WAAW,CAAC;AAAA,IACzG,OAAO;AAAA,MACL,aAAa,oCAAoC,KAAK,GAAG,SAAS,iBAAiB,KAAK,OAAO;AAAA,MAC/F,MAAM,cAAc,KAAK,KAAK,UAAU,KAAK,SAAS,EAAE,IAAI,UAAU;AAAA,IACxE;AAAA,IACA,QAAQ,CAAC;AAAA,IACT,YAAY,CAAC;AAAA,IACb,MAAM;AAAA,IACN,oBAAoB,CAAC;AAAA,IACrB,YAAY,CAAC;AAAA,IACb,WAAW,CAAC;AAAA,EACd;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/engine/creative-rules/schema.ts","../src/engine/copy-tells/rule-tells.ts","../src/commands/creatives/ideas-model.ts","../src/engine/creative-rules/read.ts"],"sourcesContent":["/**\n * A creative rule: a standing must, never or prefer about every ad a company makes. Declared ones\n * are the brand's own (BRAND.md, read by `brand-doc.ts`); learned ones are what a person taught in a\n * chat, one file each in `src/content/creative-rules/<slug>.md`, saved only after they said yes.\n * Read when a call runs, never copied into an ad's own files.\n */\nimport { z } from \"zod\";\n\nexport const RULE_STRENGTHS = [\"never\", \"must\", \"prefer\"] as const;\nexport type RuleStrength = (typeof RULE_STRENGTHS)[number];\n\n/** What of the ad a rule is about, and so which check holds it. */\nexport const RULE_APPLIES = [\"copy\", \"picture\", \"cast\", \"logo\", \"voice\", \"sound\", \"subtitles\", \"any\"] as const;\nexport type RuleApplies = (typeof RULE_APPLIES)[number];\n\nexport const RULE_KINDS = [\"static\", \"video\"] as const;\n\n/** Where a rule holds; absent parts hold everywhere. */\nexport type RuleScope = {\n kinds?: Array<(typeof RULE_KINDS)[number]>;\n /** Product slugs (`src/content/products/<slug>.md`) a business unit's rule is about. */\n products?: string[];\n platforms?: string[];\n /** The language its phrases are in (\"es\"): its wording checks hold only in ads in that language. */\n language?: string;\n};\n\n/**\n * The part of a rule code can decide on the ad's words: phrases it bans (`forbid`, except where they\n * sit inside an `allow`), phrases every ad must say (`require`), and that only real people may appear.\n */\nexport type RuleCheck = {\n forbid?: string[];\n require?: string[];\n allow?: string[];\n people?: \"real\";\n};\n\nexport const RULE_SOURCE_KINDS = [\"feedback\", \"user\", \"brand-import\", \"brand\"] as const;\n\nexport type RuleSource = {\n kind: (typeof RULE_SOURCE_KINDS)[number];\n feedbackId?: string;\n runId?: string;\n slug?: string;\n /** The person's own words the rule came from. */\n quote?: string;\n /** When it was taught (YYYY-MM-DD). */\n date?: string;\n};\n\nexport type CreativeRule = {\n /** The file's slug for a learned rule; `brand-<hash>` for one BRAND.md states. */\n id: string;\n origin: \"learned\" | \"declared\";\n strength: RuleStrength;\n applies: RuleApplies;\n scope: RuleScope;\n check?: RuleCheck;\n /** The rule, in the words it was given in. */\n text: string;\n why?: string;\n source: RuleSource;\n status: \"active\" | \"retired\";\n retiredBy?: string;\n};\n\nconst phrase = z.string().trim().min(1).max(120);\n\n/** A list of phrases, each trimmed, the empty and malformed ones dropped. */\nexport const Phrases = z\n .array(z.unknown())\n .transform((list) => list.flatMap((p) => (phrase.safeParse(p).success ? [String(p).trim()] : [])));\n","/**\n * The company's wording rules, checked on an ad's words without a model: a phrase a rule bans\n * (except inside a phrase it allows) and a phrase every ad must say. Whole phrases only, read the\n * way a person reads them: accents, case and spacing folded (\"100 % online\" is \"100% Online\"), ß as\n * ss. A rule whose phrases differ only in case is about spelling, and keeps case (\"ZentIA\", never\n * \"Zentia\"). A rule in one language holds only in ads in that language. Never and must rules only:\n * a prefer is the reviewers' to weigh. Pure and total.\n */\nimport type { CreativeRule } from \"../creative-rules/schema.ts\";\n\nexport type RuleTell = {\n rule: string;\n strength: CreativeRule[\"strength\"];\n /** A phrase the rule bans was found, or none of the lines says one it requires. */\n kind: \"forbidden\" | \"missing\";\n phrase: string;\n /** The line it was found in (a forbidden phrase only). */\n line?: string;\n /** The rule's words. */\n text: string;\n /** The person's own words, when they taught it. */\n quote?: string;\n};\n\n/** Marks that separate words rather than say anything: never part of a phrase unless it is only marks. */\nconst SOFT = new Set([\n \".\",\n \",\",\n \";\",\n \":\",\n \"!\",\n \"?\",\n \"¡\",\n \"¿\",\n '\"',\n \"'\",\n \"“\",\n \"”\",\n \"‘\",\n \"’\",\n \"«\",\n \"»\",\n \"(\",\n \")\",\n \"[\",\n \"]\",\n \"{\",\n \"}\",\n \"…\",\n \"-\",\n \"/\",\n \"*\",\n \"_\",\n]);\n\n/** Accents off, ß as ss, and case folded unless the rule is about case. Pure. */\nfunction fold(text: string, keepCase: boolean): string {\n const plain = text.normalize(\"NFKD\").replace(/\\p{M}/gu, \"\").replace(/ß/g, \"ss\").replace(/ẞ/g, \"SS\");\n return keepCase ? plain : plain.toLowerCase();\n}\n\n/** The words and marks of a text, as phrases are matched on; the separating marks only when `marks`. Pure. */\nfunction tokens(text: string, keepCase: boolean, marks = false): string[] {\n const all = fold(text, keepCase).match(/[\\p{L}\\p{N}]+|[^\\s\\p{L}\\p{N}]/gu) ?? [];\n return marks ? all : all.filter((t) => !SOFT.has(t));\n}\n\n/** Whether a phrase is only separating marks (\"!\", \"¿\"): then it is matched among the marks of a line. Pure. */\nfunction onlyMarks(phrase: string, keepCase: boolean): boolean {\n return tokens(phrase, keepCase).length === 0 && tokens(phrase, keepCase, true).length > 0;\n}\n\n/** Where `phrase` starts in `words`, every place. Pure. */\nfunction positions(words: readonly string[], phrase: readonly string[]): number[] {\n if (phrase.length === 0) return [];\n const at: number[] = [];\n for (let i = 0; i + phrase.length <= words.length; i++) {\n if (phrase.every((w, j) => words[i + j] === w)) at.push(i);\n }\n return at;\n}\n\n/** A rule is about case when two of its phrases are the same word but for case. Pure. */\nfunction aboutCase(check: NonNullable<CreativeRule[\"check\"]>): boolean {\n const phrases = [...(check.forbid ?? []), ...(check.allow ?? []), ...(check.require ?? [])];\n return phrases.some((a, i) =>\n phrases.some((b, j) => i !== j && a !== b && fold(a, false) === fold(b, false) && fold(a, true) !== fold(b, true)),\n );\n}\n\n/** Whether a rule in one language holds for an ad in `language`: the same primary tag, or a rule in none. Pure. */\nfunction sameLanguage(rule: CreativeRule, language: string | undefined): boolean {\n const ruleLanguage = rule.scope.language;\n if (!ruleLanguage) return true;\n if (!language) return false;\n const primary = (tag: string) => tag.toLowerCase().split(/[-_]/)[0];\n return primary(ruleLanguage) === primary(language);\n}\n\n/** The first phrase of `forbid` a line says outside every `allow`, or null. Pure. */\nfunction forbiddenIn(line: string, check: NonNullable<CreativeRule[\"check\"]>, keepCase: boolean): string | null {\n for (const banned of check.forbid ?? []) {\n const marks = onlyMarks(banned, keepCase);\n const words = tokens(line, keepCase, marks);\n const allowed = (check.allow ?? []).flatMap((a) => {\n const allow = tokens(a, keepCase, marks);\n return positions(words, allow).map((start) => [start, start + allow.length] as const);\n });\n const phrase = tokens(banned, keepCase, marks);\n const free = positions(words, phrase).some(\n (start) => !allowed.some(([from, to]) => start >= from && start + phrase.length <= to),\n );\n if (free) return banned;\n }\n return null;\n}\n\n/** What one rule finds in the lines: each line saying a phrase it bans, each phrase it requires none says. Pure. */\nfunction tellsOf(rule: CreativeRule, lines: readonly string[]): RuleTell[] {\n const check = rule.check;\n if (!check) return [];\n const keepCase = aboutCase(check);\n const base = {\n rule: rule.id,\n strength: rule.strength,\n text: rule.text,\n ...(rule.source.quote ? { quote: rule.source.quote } : {}),\n };\n const forbidden = lines.flatMap((line) => {\n const phrase = forbiddenIn(line, check, keepCase);\n return phrase ? [{ ...base, kind: \"forbidden\" as const, phrase, line }] : [];\n });\n const missing = (check.require ?? []).flatMap((required) => {\n const marks = onlyMarks(required, keepCase);\n const phrase = tokens(required, keepCase, marks);\n const said = lines.some((line) => positions(tokens(line, keepCase, marks), phrase).length > 0);\n return said ? [] : [{ ...base, kind: \"missing\" as const, phrase: required }];\n });\n return [...forbidden, ...missing];\n}\n\n/** Every wording rule the lines break, the line it is broken in first. Pure. */\nexport function ruleTells(\n lines: readonly string[],\n rules: readonly CreativeRule[],\n language: string | undefined,\n): RuleTell[] {\n return rules\n .filter((rule) => rule.strength !== \"prefer\" && sameLanguage(rule, language))\n .flatMap((rule) => tellsOf(rule, lines));\n}\n","/**\n * Ideas and the customer truths they stand on.\n *\n * An idea (src/creatives/_ideas/<id>.md) is one bet: who it is for, the one thing it says, the\n * customer evidence behind it and how it says it. An insight (src/content/insights/<id>.md) is\n * one customer truth, a quote with its source. `checkIdeas` is the judgment the agent used to\n * carry in prose: is each idea backed by something a customer said, does it claim only what the\n * Knowledge holds, is it a different ad from the others, does it fill a gap. Pure.\n */\nimport { staticFormatPatternSchema } from \"@baker/api\";\nimport { AD_PLATFORMS } from \"@baker/canvas-contract\";\nimport { parse as parseYaml, YAMLParseError } from \"yaml\";\nimport { ruleTells } from \"../../engine/copy-tells/rule-tells.ts\";\nimport type { CreativeRule } from \"../../engine/creative-rules/schema.ts\";\n\n/** How an idea persuades, in the ads library's own angle vocabulary, so ours and theirs compare. */\nexport const IDEA_ANGLES = [\n \"pain_relief\",\n \"aspiration\",\n \"status\",\n \"fear\",\n \"FOMO\",\n \"identity\",\n \"contrarian\",\n \"education\",\n \"novelty\",\n \"authority\",\n \"community\",\n \"transformation\",\n \"convenience\",\n \"save_money\",\n \"save_time\",\n \"save_effort\",\n \"named_enemy\",\n \"objection_crusher\",\n \"villain_democratization\",\n \"commiseration\",\n \"recognition_mirror\",\n \"flipped_idiom\",\n] as const;\n\n/** Video formats an idea may take; every other format is a static container from the library. */\nexport const IDEA_VIDEO_FORMATS = [\n \"video_ugc\",\n \"video_founder\",\n \"video_testimonial\",\n \"video_demo\",\n \"video_screen_recording\",\n \"video_explainer\",\n \"video_motion_graphics\",\n] as const;\n\nexport const IDEA_FORMATS: readonly string[] = [...staticFormatPatternSchema.options, ...IDEA_VIDEO_FORMATS];\n\nexport const AWARENESS_STAGES = [\"unaware\", \"problem_aware\", \"solution_aware\", \"product_aware\", \"most_aware\"] as const;\nexport type AwarenessStage = (typeof AWARENESS_STAGES)[number];\n\nexport const EVIDENCE_LEVELS = [\"observed\", \"interpreted\", \"hypothesized\", \"generated\"] as const;\nexport type EvidenceLevel = (typeof EVIDENCE_LEVELS)[number];\n\nexport const IDEA_STATUSES = [\"idea\", \"built\", \"testing\", \"winner\", \"failed\", \"inconclusive\", \"retired\"] as const;\nexport type IdeaStatus = (typeof IDEA_STATUSES)[number];\n\nexport type Insight = {\n id: string;\n type: string;\n quote: string;\n source: string;\n status: EvidenceLevel;\n sourceKind?: string;\n force?: string;\n persona?: string;\n /** Who said it, as the research wrote it (\"A 5★ Trustpilot review by Lena Fischer.\"). */\n author?: string;\n};\n\nexport type Idea = {\n id: string;\n who: string;\n message: string;\n evidence: string[];\n awareness: AwarenessStage;\n angle: string;\n /**\n * What the scroller sees in the first second that makes the message land (\"before/after split:\n * a tangle of 16 platform logos, then one API key\"). The proven ad is searched by it, in any category.\n */\n shows?: string;\n /** The container: a video style (built from beats), or a static one the idea insists on. Absent: the proven ad's. */\n format?: string;\n job: \"opener\" | \"closer\";\n why: string;\n status: IdeaStatus;\n /** Where its ads run, main platform first (`AD_PLATFORMS`): the sizes they are made in. Absent: not said yet. */\n platforms?: string[];\n};\n\nconst FRONTMATTER = /^---\\r?\\n([\\s\\S]*?)\\r?\\n---/;\n\n/** A markdown file's frontmatter as an object, or null when it has none or it does not parse. */\nexport function frontmatterOf(markdown: string): Record<string, unknown> | null {\n const block = FRONTMATTER.exec(markdown)?.[1];\n if (block === undefined) return null;\n try {\n const parsed: unknown = parseYaml(block);\n return parsed !== null && typeof parsed === \"object\" && !Array.isArray(parsed)\n ? (parsed as Record<string, unknown>)\n : null;\n } catch {\n return null;\n }\n}\n\n/**\n * Why a file's frontmatter does not parse, naming the line, or null when it parses (or has none).\n * Dev, Oct 2026: an unquoted `why: \"a minefield\" with quotes` read as every field missing. Pure.\n */\nexport function frontmatterError(markdown: string): string | null {\n const block = FRONTMATTER.exec(markdown)?.[1];\n if (block === undefined) return null;\n try {\n parseYaml(block);\n return null;\n } catch (e) {\n const line = e instanceof YAMLParseError ? e.linePos?.[0]?.line : undefined;\n const at = line ? ` at line ${line} (\\`${block.split(/\\r?\\n/)[line - 1]?.trim() ?? \"\"}\\`)` : \"\";\n return `the frontmatter is not valid YAML${at}: put each text value wholly in double quotes, with any quote inside it as \\\\\" or as single quotes`;\n }\n}\n\nfunction text(value: unknown): string | undefined {\n if (typeof value === \"string\") return value.trim() || undefined;\n if (typeof value === \"number\") return String(value);\n return undefined;\n}\n\nfunction oneOf<T extends string>(values: readonly T[], value: unknown): T | undefined {\n return typeof value === \"string\" && (values as readonly string[]).includes(value) ? (value as T) : undefined;\n}\n\n/** A source a reader can open: a link, or a library entry (`testimonials:t1`). */\nconst CHECKABLE_SOURCE = /^(?:https?:\\/\\/\\S+|[a-z_]+:[\\w-]+)$/i;\n\n/**\n * How strong an insight really is: one filed as observed is read as interpreted when its source\n * cannot be checked. Audited live Oct 2026: article lines, sourced \"an article (referenced in …)\",\n * filed as what customers said. A quote that is a statistic about people rather than someone's\n * words is the other half of that audit, and a reading of the words: `ideas-judgments.ts`.\n */\nfunction evidenceStatus(stated: EvidenceLevel, source: string): EvidenceLevel {\n if (stated !== \"observed\") return stated;\n return CHECKABLE_SOURCE.test(source) ? \"observed\" : \"interpreted\";\n}\n\n/** One customer truth, or null when it carries no quote or source to stand on. */\nexport function parseInsight(id: string, markdown: string): Insight | null {\n const fm = frontmatterOf(markdown);\n const quote = text(fm?.quote);\n const source = text(fm?.source);\n if (!fm || !quote || !source) return null;\n const force = text(fm.force);\n const persona = text(fm.persona);\n const sourceKind = text(fm.sourceKind);\n const author = markdown\n .replace(/^---[\\s\\S]*?\\n---/, \"\")\n .match(/\\bby ([\\p{Lu}][\\p{L}'’-]*\\.?(?: [\\p{Lu}][\\p{L}'’-]*\\.?)?)/u)?.[1]\n // The sentence's full stop, never an initial's (\"Marta G.\").\n ?.replace(/(\\p{L}{2,})\\.$/u, \"$1\");\n return {\n id,\n type: text(fm.type) ?? \"other\",\n quote,\n source,\n status: evidenceStatus(oneOf(EVIDENCE_LEVELS, fm.status) ?? \"observed\", source),\n ...(sourceKind ? { sourceKind } : {}),\n ...(force ? { force } : {}),\n ...(persona ? { persona } : {}),\n ...(author ? { author } : {}),\n };\n}\n\nfunction evidenceList(value: unknown): string[] {\n if (Array.isArray(value)) return value.flatMap((e) => (text(e) ? [String(text(e))] : []));\n const single = text(value);\n return single ? [single] : [];\n}\n\ntype IdeaFields = {\n who?: string;\n message?: string;\n why?: string;\n angle?: string;\n shows?: string;\n format?: string;\n awareness?: AwarenessStage;\n /** The awareness as written, to quote back when it is not a stage. */\n awarenessWritten?: string;\n /** The platforms as written; absent when the idea names none (never a problem). */\n platforms?: string[];\n};\n\nfunction fieldProblems(f: IdeaFields): string[] {\n const problems: string[] = [];\n if (!f.who) problems.push(\"who is missing: the persona it is for\");\n if (!f.message)\n problems.push(\n \"message is missing: the one promise a stranger should get, what is offered and what changes for them\",\n );\n if (!f.why) problems.push(\"why is missing: the brief finding it answers\");\n if (!f.awareness) {\n const written = f.awarenessWritten ? `\"${f.awarenessWritten}\" ` : \"\";\n problems.push(`awareness ${written}must be one of ${AWARENESS_STAGES.join(\", \")}`);\n }\n if (!(f.angle && (IDEA_ANGLES as readonly string[]).includes(f.angle)))\n problems.push(`angle ${f.angle ? `\"${f.angle}\" ` : \"\"}must be one of ${IDEA_ANGLES.join(\", \")}`);\n if (f.format && !IDEA_FORMATS.includes(f.format))\n problems.push(`format \"${f.format}\" must be one of ${IDEA_FORMATS.join(\", \")}`);\n if (!f.format && !f.shows)\n problems.push(\n \"shows is missing: what the scroller sees in the first second that makes the message land (a before/after, a reaction, the product doing it, a real review, the pain itself); the proven ad is searched by it\",\n );\n return [...problems, ...platformProblems(f.platforms)];\n}\n\n/** A platform the catalog does not know, named with the ones it does; none named is no problem. */\nfunction platformProblems(platforms: readonly string[] | undefined): string[] {\n const unknown = (platforms ?? []).filter((p) => !(AD_PLATFORMS as readonly string[]).includes(p));\n return unknown.length > 0\n ? [`platforms ${unknown.map((p) => `\"${p}\"`).join(\", \")} must be among ${AD_PLATFORMS.join(\", \")}`]\n : [];\n}\n\n/** The platforms an idea names, as written (a single name read as a list of one). */\nfunction platformList(value: unknown): string[] | undefined {\n const list = (Array.isArray(value) ? value : value === undefined || value === null ? [] : [value])\n .map((v) => text(v))\n .filter((v): v is string => v !== undefined);\n return list.length > 0 ? list : undefined;\n}\n\n/** One idea file, or every problem that keeps it from being one. */\nexport function parseIdea(id: string, markdown: string): { idea?: Idea; problems: string[] } {\n const unparsable = frontmatterError(markdown);\n if (unparsable) return { problems: [unparsable] };\n const fm = frontmatterOf(markdown) ?? {};\n const f: IdeaFields = {\n who: text(fm.who),\n message: text(fm.message),\n why: text(fm.why),\n angle: text(fm.angle),\n shows: text(fm.shows),\n format: text(fm.format),\n awareness: oneOf(AWARENESS_STAGES, fm.awareness),\n awarenessWritten: text(fm.awareness),\n platforms: platformList(fm.platforms),\n };\n const problems = fieldProblems(f);\n const { who, message, why, angle, shows, format, awareness } = f;\n if (problems.length > 0 || !who || !message || !why || !awareness || !angle) return { problems };\n return {\n idea: {\n id,\n who,\n message,\n evidence: evidenceList(fm.evidence),\n awareness,\n angle,\n ...(shows ? { shows } : {}),\n ...(format ? { format } : {}),\n job: fm.job === \"closer\" ? \"closer\" : \"opener\",\n why,\n status: oneOf(IDEA_STATUSES, fm.status) ?? \"idea\",\n ...(f.platforms ? { platforms: f.platforms } : {}),\n },\n problems,\n };\n}\n\nexport type IdeaCheck = {\n id: string;\n status: IdeaStatus;\n message: string;\n /** The strongest evidence behind it; `explore` when no insight backs it. */\n evidence: EvidenceLevel | \"explore\";\n /** The customer's own words it stands on, when it has some. */\n quote?: string;\n awareness: AwarenessStage;\n angle: string;\n /** What the scroller sees first, when the idea says. */\n shows?: string;\n /** The container, when the idea names one; absent: the proven ad's. */\n format?: string;\n /** Where its ads run, main platform first; absent when the idea names nowhere. */\n platforms?: string[];\n /** Blocks building it until fixed. */\n problems: string[];\n /** Worth fixing; never blocks. */\n warnings: string[];\n /** What it adds that the live ads do not have. */\n gaps: string[];\n score: number;\n};\n\nexport type CheckIdeasInput = {\n ideas: readonly Idea[];\n insights: readonly Insight[];\n /** Everything the company's documents say (COMPANY.md, the Knowledge): the claims an ad may make. */\n knowledge: string;\n /** Persona entry ids in the Knowledge; empty when there are none to check against. */\n personas: readonly string[];\n /** Awareness stages the company's live or built ads already speak to. */\n coveredAwareness: readonly string[];\n /** How many live or built ideas close (`job: closer`). */\n closersLive: number;\n /** Whether two messages say the same thing (`ideas-judgments.ts`); the same words, without it. */\n sameMessage?: SameMessage;\n /** The company's rules for its ads: a message that breaks a wording rule is not an idea to build. */\n rules?: readonly CreativeRule[];\n /** The language the ideas' messages are in (the company's market's), for the wording rules. */\n language?: string;\n};\n\nconst EVIDENCE_WEIGHT: Record<EvidenceLevel | \"explore\", number> = {\n observed: 3,\n interpreted: 2,\n hypothesized: 1,\n generated: 0,\n explore: 0,\n};\n\nconst LIVE_STATUSES: readonly IdeaStatus[] = [\"built\", \"testing\", \"winner\"];\n\n/** Numbers, percentages and prices a message states: each must be found in what the company wrote. */\nfunction claimsOf(message: string): string[] {\n return [...message.matchAll(/\\d[\\d.,]*\\s?(?:%|€|\\$|£|x\\b|k\\b)?/gi)].map((m) => m[0].trim());\n}\n\n/** A figure as written anywhere, separators dropped: \"4.990 €\", \"4990€\" and \"4,990\" are one number. */\nfunction figureOf(claim: string): string {\n return claim.replace(/[^\\d]/g, \"\");\n}\n\n/** Every whole number a text states, so \"4\" is never found inside \"4.990\". Pure. */\nexport function figuresIn(text: string): Set<string> {\n return new Set([...text.matchAll(/\\d(?:[\\d.,]*\\d)?/g)].map((m) => figureOf(m[0])));\n}\n\nfunction normalize(value: string): string {\n return value.toLowerCase().replace(/\\s+/g, \" \").trim();\n}\n\nfunction sentencesOf(message: string): number {\n return message.split(/[.!?]+(?:\\s|$)/).filter((s) => s.trim().length > 0).length;\n}\n\ntype CheckContext = {\n insights: ReadonlyMap<string, Insight>;\n corpusFigures: ReadonlySet<string>;\n covered: ReadonlySet<string>;\n duplicateOf: ReadonlyMap<string, string>;\n personas: readonly string[];\n closersLive: number;\n failed: readonly Idea[];\n sameMessage: SameMessage;\n rules: readonly CreativeRule[];\n language: string | undefined;\n};\n\n/** Whether two ad messages say the same thing, however reworded. */\nexport type SameMessage = (a: string, b: string) => boolean;\n\n/** Without a reading of the words, only the same message written the same way is one. Pure. */\nexport const SAME_WORDS: SameMessage = (a, b) => normalize(a) === normalize(b);\n\n/** A failed idea this one repeats: the same message (reworded or not), or the same angle in the same format. */\nfunction repeatedFailure(idea: Idea, failed: readonly Idea[], sameMessage: SameMessage): string[] {\n const lost = failed.find(\n (f) =>\n f.id !== idea.id &&\n (sameMessage(f.message, idea.message) || (f.angle === idea.angle && f.format === idea.format)),\n );\n return lost\n ? [`says what \"${lost.id}\" said, and that idea failed in the account: change the message, not just the picture`]\n : [];\n}\n\n/** The insight on file whose id and quote share the most words with `id`, an id written from memory. */\nfunction likelyMeant(id: string, insights: ReadonlyMap<string, Insight>): string | undefined {\n const words = (text: string) =>\n new Set(\n text\n .toLowerCase()\n .split(/[^\\p{L}\\p{N}]+/u)\n .filter((w) => w.length >= 3),\n );\n const wanted = words(id);\n let best: { id: string; shared: number } | undefined;\n for (const insight of insights.values()) {\n const said = words(`${insight.id} ${insight.quote}`);\n const shared = [...wanted].filter((w) => said.has(w)).length;\n if (shared > 0 && shared > (best?.shared ?? 0)) best = { id: insight.id, shared };\n }\n return best?.id;\n}\n\nfunction backingOf(idea: Idea, insights: ReadonlyMap<string, Insight>, problems: string[]) {\n const backing = idea.evidence.flatMap((id) => {\n const insight = insights.get(id);\n if (!insight) {\n const meant = likelyMeant(id, insights);\n problems.push(\n `evidence \"${id}\" is not in src/content/insights/: ${meant ? `did you mean \"${meant}\"? ` : \"\"}name an insight on file by its id, or leave it out`,\n );\n }\n return insight ? [insight] : [];\n });\n return [...backing].sort((a, b) => EVIDENCE_WEIGHT[b.status] - EVIDENCE_WEIGHT[a.status])[0];\n}\n\n/** The figures a text claims that nothing the company wrote holds. Pure. */\nexport function unsourcedClaims(text: string, corpusFigures: ReadonlySet<string>): string[] {\n return claimsOf(text).filter((claim) => {\n const figure = figureOf(claim);\n return figure !== \"\" && !corpusFigures.has(figure);\n });\n}\n\n/**\n * Why an insight that states a figure cannot stand behind it as our claim, in words the agent can act\n * on. Review, Oct 2026: a figure held by an insight read as interpreted only for its unlinked source\n * was said to be in no quote at all, and the agent searched for what it already had. Pure.\n */\nfunction whyNotBacking(insight: Insight): string {\n const named = `the insight \"${insight.id}\"`;\n if (fromMarket(insight))\n return `${named}, what someone in the market said, not our customer: it is never our claim; drop it`;\n if (insight.status === \"hypothesized\" || insight.status === \"generated\")\n return `${named}, a ${insight.status} reading, not a customer's words: source it or drop it`;\n if (!CHECKABLE_SOURCE.test(insight.source))\n return `${named}, which cites no link a reader can open (its source: \"${insight.source}\"): give it its link, or drop the figure`;\n return `${named}, a statistic about people rather than a customer's words: it cannot stand behind our claim; drop it`;\n}\n\nfunction claimProblems(message: string, ctx: Pick<CheckContext, \"corpusFigures\" | \"insights\">): string[] {\n return unsourcedClaims(message, ctx.corpusFigures).map((claim) => {\n const figure = figureOf(claim);\n const holder = [...ctx.insights.values()].find((insight) => figuresIn(insight.quote).has(figure));\n return holder\n ? `\"${claim}\" is in ${whyNotBacking(holder)}`\n : `\"${claim}\" is in no customer quote, COMPANY.md or Knowledge entry: source it or drop it`;\n });\n}\n\n/** Where people in the market speak, as opposed to our own customers (reviews, testimonials, calls…). */\nexport const MARKET_SOURCES: readonly string[] = [\"reddit\", \"forum\", \"web\"];\nconst TESTIMONIAL_FORMATS = [\"review_screenshot\", \"testimonial_quote\", \"video_testimonial\"];\n\nfunction fromMarket(insight: Insight | undefined): boolean {\n return insight?.sourceKind !== undefined && MARKET_SOURCES.includes(insight.sourceKind);\n}\n\n/** An insight whose figures may stand behind our claim: our own customer's words, as written. */\nexport function sourcesClaims(insight: Insight): boolean {\n return insight.status === \"observed\" && !fromMarket(insight);\n}\n\n/** A cited result someone in the market reported, which an ad could pass off as ours. */\nfunction borrowedProof(idea: Idea, insights: ReadonlyMap<string, Insight>): string | undefined {\n return idea.evidence.find((id) => {\n const insight = insights.get(id);\n return fromMarket(insight) && insight?.type === \"proof\";\n });\n}\n\n/** A review or testimonial format with no quote from our own customers: it could only be a fake review. */\nfunction fakeReviewProblem(idea: Idea, insights: ReadonlyMap<string, Insight>): string[] {\n if (!idea.format || !TESTIMONIAL_FORMATS.includes(idea.format)) return [];\n const cited = idea.evidence.flatMap((id) => insights.get(id) ?? []);\n if (cited.length === 0 || !cited.every(fromMarket)) return [];\n return [\n `${idea.format} needs a quote from our own customer (a review, testimonial, call or survey); every one cited was said by someone in the market. Pick another format, or cite our own customer`,\n ];\n}\n\nfunction warningsOf(\n idea: Idea,\n evidence: EvidenceLevel | \"explore\",\n personas: readonly string[],\n insights: ReadonlyMap<string, Insight>,\n): string[] {\n const warnings: string[] = [];\n const video = (IDEA_VIDEO_FORMATS as readonly string[]).includes(idea.format ?? \"\");\n if (idea.status === \"idea\" && !video && !idea.shows)\n warnings.push(\n \"say what it shows (`shows`): what the scroller sees in the first second that lands the message; the proven ad is searched by it, and without it by what the company sells\",\n );\n const borrowed = borrowedProof(idea, insights);\n if (borrowed) {\n warnings.push(\n `\"${borrowed}\" was said by someone in the market, not a customer of ours: use their words for the problem, never show it as our review, testimonial or result`,\n );\n }\n if (sentencesOf(idea.message) > 1 || idea.message.split(/\\s+/).length > 25) {\n warnings.push(\n 'the message says more than one thing: keep one promise that still names what is offered (\"a free roof survey that shows your real saving\", never a slogan like \"the numbers, explained\"), the rest goes to the ad text',\n );\n }\n if (personas.length > 0 && !personas.includes(idea.who)) {\n warnings.push(`who \"${idea.who}\" is not a persona in the Knowledge (${personas.join(\", \")})`);\n }\n if (evidence === \"explore\") {\n warnings.push(\"no customer evidence: an explore bet. `baker research customers` may find some\");\n }\n return warnings;\n}\n\nfunction checkOne(idea: Idea, ctx: CheckContext): IdeaCheck {\n const problems: string[] = [];\n const best = backingOf(idea, ctx.insights, problems);\n const evidence = best?.status ?? \"explore\";\n problems.push(\n ...claimProblems(idea.message, ctx),\n ...fakeReviewProblem(idea, ctx.insights),\n // The message is one line of the ad: a phrase a rule requires may sit in another.\n ...ruleTells([idea.message], ctx.rules, ctx.language)\n .filter((t) => t.kind === \"forbidden\")\n .map((t) => `The message says \"${t.phrase}\": ${t.rule} (${t.strength}) — ${t.text}`),\n );\n const duplicate = ctx.duplicateOf.get(idea.id);\n if (duplicate) {\n problems.push(\n `same angle and the same picture (format or what it shows), or the same message, as \"${duplicate}\": to the platform it is the same ad. Change the angle or what it shows`,\n );\n }\n const gaps: string[] = [];\n if (!ctx.covered.has(idea.awareness)) gaps.push(`no live ad speaks to ${idea.awareness} people`);\n if (idea.job === \"closer\" && ctx.closersLive === 0) gaps.push(\"no live ad closes warm people\");\n return {\n id: idea.id,\n status: idea.status,\n message: idea.message,\n evidence,\n ...(best ? { quote: best.quote } : {}),\n awareness: idea.awareness,\n angle: idea.angle,\n ...(idea.shows ? { shows: idea.shows } : {}),\n ...(idea.format ? { format: idea.format } : {}),\n ...(idea.platforms ? { platforms: idea.platforms } : {}),\n problems,\n warnings: [\n ...warningsOf(idea, evidence, ctx.personas, ctx.insights),\n ...repeatedFailure(idea, ctx.failed, ctx.sameMessage),\n ],\n gaps,\n score: EVIDENCE_WEIGHT[evidence] + gaps.length - (problems.length > 0 ? 10 : 0),\n };\n}\n\n/** Which idea repeats an earlier one: a built idea, then the better-evidenced, then the first written keeps it. */\nfunction duplicatesOf(ideas: readonly Idea[], insights: ReadonlyMap<string, Insight>): Map<string, string> {\n const active = ideas.filter((i) => i.status !== \"retired\" && i.status !== \"failed\");\n const strength = (idea: Idea) =>\n Math.max(0, ...idea.evidence.map((id) => EVIDENCE_WEIGHT[insights.get(id)?.status ?? \"explore\"]));\n const position = new Map(ideas.map((idea, index) => [idea.id, index]));\n const order = [...active].sort(\n (a, b) =>\n Number(LIVE_STATUSES.includes(b.status)) - Number(LIVE_STATUSES.includes(a.status)) ||\n strength(b) - strength(a) ||\n (position.get(a.id) ?? 0) - (position.get(b.id) ?? 0),\n );\n const seenPairs = new Map<string, string>();\n const seenMessages = new Map<string, string>();\n const duplicateOf = new Map<string, string>();\n for (const idea of order) {\n const pair = `${idea.angle}×${idea.format ?? normalize(idea.shows ?? \"\")}`;\n const message = normalize(idea.message);\n const earlier = seenPairs.get(pair) ?? seenMessages.get(message);\n if (earlier) duplicateOf.set(idea.id, earlier);\n if (!seenPairs.has(pair)) seenPairs.set(pair, idea.id);\n if (!seenMessages.has(message)) seenMessages.set(message, idea.id);\n }\n return duplicateOf;\n}\n\n/**\n * Check and rank every idea. Ideas still to build come first, best first: the strongest customer\n * evidence, then a gap the live ads leave; anything with a problem sinks. Built ideas follow.\n */\nexport function checkIdeas(input: CheckIdeasInput): IdeaCheck[] {\n const insights = new Map(input.insights.map((insight) => [insight.id, insight]));\n // What our own customers said, word for word, can source a claim; a stranger's number or a reading never can.\n const ownQuotes = input.insights.filter(sourcesClaims).map((i) => i.quote);\n const corpusFigures = figuresIn(`${input.knowledge}\\n${ownQuotes.join(\"\\n\")}`);\n const covered = new Set(input.coveredAwareness);\n const duplicateOf = duplicatesOf(input.ideas, insights);\n const checks = input.ideas.map((idea) =>\n checkOne(idea, {\n insights,\n corpusFigures,\n covered,\n duplicateOf,\n personas: input.personas,\n closersLive: input.closersLive,\n failed: input.ideas.filter((i) => i.status === \"failed\"),\n sameMessage: input.sameMessage ?? SAME_WORDS,\n rules: input.rules ?? [],\n language: input.language,\n }),\n );\n\n const toBuild = (c: IdeaCheck) => c.status === \"idea\";\n return checks.sort(\n (a, b) => Number(toBuild(b)) - Number(toBuild(a)) || b.score - a.score || a.id.localeCompare(b.id),\n );\n}\n","/**\n * Where a company's creative rules come from: the brand's own (BRAND.md, through its reading) and\n * the ones a person taught in a chat (`src/content/creative-rules/<slug>.md`, one per file). Each is\n * read as it stands when a call runs; nothing is copied into an ad's files.\n */\nimport { createHash } from \"node:crypto\";\nimport { readdir, readFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport { z } from \"zod\";\nimport { frontmatterOf } from \"../../commands/creatives/ideas-model.ts\";\nimport type { BrandRule } from \"../brand/brand-rules.ts\";\nimport {\n type CreativeRule,\n Phrases,\n RULE_APPLIES,\n RULE_KINDS,\n RULE_SOURCE_KINDS,\n RULE_STRENGTHS,\n type RuleCheck,\n} from \"./schema.ts\";\n\n/** Where the learned rules live in a workspace. */\nexport const RULES_DIR = path.join(\"src\", \"content\", \"creative-rules\");\n\nconst optionalText = z.string().trim().min(1).max(2000).optional().catch(undefined);\nconst optionalPhrases = Phrases.optional().catch(undefined);\nconst dateText = z\n .union([z.string(), z.date().transform((d) => d.toISOString().slice(0, 10))])\n .pipe(z.string().trim().min(1))\n .optional()\n .catch(undefined);\n\nconst Frontmatter = z.object({\n strength: z.enum(RULE_STRENGTHS).catch(\"must\"),\n applies: z.enum(RULE_APPLIES).catch(\"any\"),\n scope: z\n .object({\n kinds: z.array(z.enum(RULE_KINDS)).optional().catch(undefined),\n products: optionalPhrases,\n platforms: optionalPhrases,\n language: z.string().trim().min(2).max(10).optional().catch(undefined),\n })\n .catch({}),\n check: z\n .object({\n forbid: optionalPhrases,\n require: optionalPhrases,\n allow: optionalPhrases,\n people: z.literal(\"real\").optional().catch(undefined),\n })\n .optional()\n .catch(undefined),\n source: z\n .object({\n kind: z.enum(RULE_SOURCE_KINDS).catch(\"user\"),\n feedbackId: optionalText,\n runId: optionalText,\n slug: optionalText,\n quote: optionalText,\n date: dateText,\n })\n .catch({ kind: \"user\" }),\n status: z.enum([\"active\", \"retired\"]).catch(\"active\"),\n retiredBy: optionalText,\n});\n\n/** An object with its undefined and empty-list entries left out. Pure. */\nfunction defined<T extends object>(value: T): T {\n return Object.fromEntries(\n Object.entries(value).filter(([, v]) => v !== undefined && !(Array.isArray(v) && v.length === 0)),\n ) as T;\n}\n\n/** The rule's words (the body's first paragraph) and its why (a `Why:` paragraph). Pure. */\nfunction bodyOf(markdown: string): { text?: string; why?: string } {\n const body = markdown.replace(/^---\\r?\\n[\\s\\S]*?\\r?\\n---\\r?\\n?/, \"\").trim();\n const paragraphs = body\n .split(/\\r?\\n\\s*\\r?\\n/)\n .map((p) => p.trim())\n .filter(Boolean);\n const why = paragraphs.find((p) => /^(?:why|por qué|porque)\\s*:/i.test(p));\n const text = paragraphs.find((p) => p !== why && !p.startsWith(\"#\"));\n return { ...(text ? { text } : {}), ...(why ? { why: why.replace(/^[^:]+:\\s*/, \"\") } : {}) };\n}\n\n/** A rule file as a rule, read leniently (a hand edit still teaches it); null without words. Pure. */\nexport function parseRuleFile(id: string, markdown: string): CreativeRule | null {\n const { text, why } = bodyOf(markdown);\n if (!text) return null;\n const fm = Frontmatter.parse(frontmatterOf(markdown) ?? {});\n const check = fm.check ? defined<RuleCheck>(fm.check) : undefined;\n return {\n id,\n origin: \"learned\",\n strength: fm.strength,\n applies: fm.applies,\n scope: defined(fm.scope),\n ...(check && Object.keys(check).length > 0 ? { check } : {}),\n text,\n ...(why ? { why } : {}),\n source: defined(fm.source),\n status: fm.status,\n ...(fm.retiredBy ? { retiredBy: fm.retiredBy } : {}),\n };\n}\n\n/** Every rule file in the workspace, by its slug; none when there is no folder. */\nexport async function readLearnedRules(root: string): Promise<CreativeRule[]> {\n const dir = path.join(root, RULES_DIR);\n const files = (await readdir(dir).catch(() => [] as string[])).filter((f) => f.endsWith(\".md\")).sort();\n const rules = await Promise.all(\n files.map(async (file) =>\n parseRuleFile(file.replace(/\\.md$/, \"\"), await readFile(path.join(dir, file), \"utf8\").catch(() => \"\")),\n ),\n );\n return rules.filter((r): r is CreativeRule => r !== null);\n}\n\n/** A declared rule's id: its words decide it, so the same rule keeps it across readings. Pure. */\nconst declaredId = (text: string) => `brand-${createHash(\"sha256\").update(text.trim()).digest(\"hex\").slice(0, 8)}`;\n\n/**\n * A ban the rule's own words show as both right and wrong, no allowed phrase telling them apart:\n * \"'£640 a year, at 24p a unit', never '£640 a year'\" bans a bare figure, not the words, so code\n * cannot check it (live, Oct 2026: read as banning \"£640 a year\", which the right form says too).\n */\nfunction shownBothWays(text: string, phrase: string, allow: readonly string[] | undefined): boolean {\n const fold = (s: string) => s.normalize(\"NFKD\").replace(/\\p{M}/gu, \"\").toLowerCase();\n const said = fold(text).split(fold(phrase)).length - 1;\n return said > 1 && !(allow ?? []).some((a) => fold(a).includes(fold(phrase)));\n}\n\n/** A bare word of one or two letters (\"IA\", \"DS\"): an acronym a brand bans reads as an ordinary word too. */\nconst BARE_SHORT_WORD = /^\\p{L}{1,2}$/u;\n\n/**\n * The rules the brand's documents state, as creative rules. Code holds only the words a brand bans,\n * never the ones it says to use: a brand document's \"must\" depends on the piece (prod, Oct 2026: its\n * taglines and CTAs fired on 28 of 66 approved ads), and the reviewers weigh those. Pure.\n */\nexport function declaredRules(rules: readonly BrandRule[]): CreativeRule[] {\n return rules.map(({ text, strength, applies, forbid, allow }) => {\n const checked = forbid?.filter((p) => !BARE_SHORT_WORD.test(p.trim()) && !shownBothWays(text, p, allow));\n const check = defined<RuleCheck>({ forbid: checked, ...(checked?.length ? { allow } : {}) });\n return {\n id: declaredId(text),\n origin: \"declared\",\n strength,\n applies,\n scope: {},\n ...(Object.keys(check).length > 0 ? { check } : {}),\n text,\n source: { kind: \"brand\" },\n status: \"active\",\n };\n });\n}\n"],"mappings":";;;;;;;;AAMA,SAAS,SAAS;AAEX,IAAM,iBAAiB,CAAC,SAAS,QAAQ,QAAQ;AAIjD,IAAM,eAAe,CAAC,QAAQ,WAAW,QAAQ,QAAQ,SAAS,SAAS,aAAa,KAAK;AAG7F,IAAM,aAAa,CAAC,UAAU,OAAO;AAuBrC,IAAM,oBAAoB,CAAC,YAAY,QAAQ,gBAAgB,OAAO;AA6B7E,IAAM,SAAS,EAAE,OAAO,EAAE,KAAK,EAAE,IAAI,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AC,gBAAgB,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,cAAcA,OAAM,GAAG,KAAK,CAAC;AACvG,UAAM,QAAQ,QAAmB,EAAE,QAAQ,SAAS,GAAI,SAAS,SAAS,EAAE,MAAM,IAAI,CAAC,EAAG,CAAC;AAC3F,WAAO;AAAA,MACL,IAAI,WAAWA,KAAI;AAAA,MACnB,QAAQ;AAAA,MACR;AAAA,MACA;AAAA,MACA,OAAO,CAAC;AAAA,MACR,GAAI,OAAO,KAAK,KAAK,EAAE,SAAS,IAAI,EAAE,MAAM,IAAI,CAAC;AAAA,MACjD,MAAAA;AAAA,MACA,QAAQ,EAAE,MAAM,QAAQ;AAAA,MACxB,QAAQ;AAAA,IACV;AAAA,EACF,CAAC;AACH;","names":["text","phrase","text","z","z","text","phrase","fold"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/winning-ads/fit.ts","../src/commands/canvas/library-reference.ts"],"sourcesContent":["import { createHash } from \"node:crypto\";\n/**\n * Does this winning ad fit this company, and what would we have to supply to keep why it won?\n *\n * Audited Sept 2026: of 33 creatives built from winning ads, 12 lost the concept. References\n * were picked whose load-bearing ingredient we could not supply (a gift, a peer's voice, priced\n * tiers, a native disguise our \"big logo, big button\" rule broke), and nothing said so until the\n * finished ad came back as a feature list in a notes app. So before scaffolding, one vision call\n * reads the reference beside what the company has (COMPANY.md, the brand's rules, the offers,\n * products and personas in the Knowledge, its reviews, its Avatars) and says, in layers, why the ad\n * wins, what each load-bearing element needs, whether we have it, and a verdict: use, adapt or\n * reject. Always among them what stops the scroll and the proof (Oct 2026: a meme's fit left out the\n * reaction faces it stopped the scroll with), each kept, replaced with ours or impossible, the rule\n * that forbids one quoted; either impossible is a reject. The agent checks about three candidates and\n * scaffolds only one that fits; the scaffold seeds the ad spec's `concept` from the verdict, and\n * `baker canvas run` refuses a `reject`.\n */\nimport { mkdir, readdir, readFile, writeFile } from \"node:fs/promises\";\nimport path from \"node:path\";\nimport type { AvatarsListResponse } from \"@baker/api\";\nimport { AD_DESCRIBE_MODEL } from \"@baker/canvas-contract\";\nimport { defineCommand } from \"citty\";\nimport sharp from \"sharp\";\nimport { z } from \"zod\";\nimport { apiGet } from \"../../client.ts\";\nimport { memeRegister, readCompanyReading } from \"../../engine/creative-context/company.ts\";\nimport { type ContextReaders, type CreativeContext, readCreativeContext } from \"../../engine/creative-context/index.ts\";\nimport { rulesBlock } from \"../../engine/creative-rules/select.ts\";\nimport { askAboutImages, type ReviewUsage } from \"../../engine/nodes/local/lib/render-review.ts\";\nimport { bytesOf } from \"../../engine/nodes/local/lib/static-review.ts\";\nimport {\n CONCEPT_CARRY_LEVELS,\n decisionOf,\n LOAD_BEARING_FIELDS,\n type MemeAudience,\n unfitReasons,\n withDerivedHave,\n} from \"../../engine/scaffold/static-ad-spec.ts\";\nimport { writeJson } from \"../../output.ts\";\nimport { registerSchema } from \"../../schemas.ts\";\nimport { readAvatars } from \"../avatars/transport.ts\";\nimport {\n type DesignRefusal,\n fetchLibraryReference,\n LIBRARY_PLATFORMS,\n type LibraryPlatform,\n notADesignReference,\n resolveSourcePlatform,\n} from \"../canvas/library-reference.ts\";\nimport { findWorkspaceRoot } from \"../canvas/normalize-paths.ts\";\nimport { holdUnbilledSpend } from \"../canvas/unbilled-spend.ts\";\nimport { avatarsOf, castCompany } from \"../creatives/cast-inventory.ts\";\n\nconst Layers = z\n .object({\n disguise: z.string().optional(),\n voice: z.string().optional(),\n trigger: z.string().optional(),\n attention: z.string().optional(),\n logic: z.string().optional(),\n })\n .strip();\n\n/**\n * What the fit model answers. A read that names no element stopping the scroll or no proof is no read\n * of why the ad won, and is asked again (a fit cached before either was asked for is read again too).\n */\nexport const FitAnswerSchema = z\n .object({\n why_it_wins: Layers.default({}),\n load_bearing: z.array(z.preprocess(withDerivedHave, z.object(LOAD_BEARING_FIELDS).strip())).default([]),\n verdict: z.enum([\"use\", \"adapt\", \"reject\"]),\n transfer_note: z.string().optional(),\n brand_presence: z.enum([\"native\", \"standard\"]).optional(),\n recognition: z.string().optional(),\n carry: z.enum(CONCEPT_CARRY_LEVELS).optional(),\n carry_why: z.string().optional(),\n /** Asked only with a bet: would the viewer of the ad we are making stop for this one. */\n our_viewer: z\n .object({ stops: z.enum([\"yes\", \"maybe\", \"no\"]), why: z.string().default(\"\") })\n .strip()\n .optional()\n .catch(undefined),\n })\n .refine((fit) => fit.load_bearing.some((l) => l.job === \"stop\") && fit.load_bearing.some((l) => l.job === \"proof\"), {\n message: \"name what stops the scroll (job: stop) and the proof (job: proof) among load_bearing\",\n })\n // An element it wins on that nothing of ours may carry is a reject, whatever the model's verdict.\n .transform((fit) =>\n fit.verdict !== \"reject\" && fit.load_bearing.some((l) => decisionOf(l) === \"impossible\")\n ? { ...fit, verdict: \"reject\" as const }\n : fit,\n );\n\n/** The ad we are making, as the fit judges a reference for it. */\nexport type FitBet = {\n who: string;\n message: string;\n awareness?: string;\n angle?: string;\n /** What our ad shows first; a reference whose picture cannot carry it does not fit. */\n shows?: string;\n /** Our customers' own words the idea stands on. */\n quotes?: readonly string[];\n /** The viewer's market in words (`describeMarket`). */\n market?: string;\n};\nexport type FitAnswer = z.infer<typeof FitAnswerSchema>;\n\n/** The library's read of the reference, as far as the fit needs it. */\nexport type FitLibraryRead = {\n advertiser?: string;\n format_pattern?: string;\n mechanism?: string;\n awareness?: string;\n offer?: string;\n text?: string[];\n /** The library's evidence that it won: winner, scaled_winner, evergreen, rising. */\n winner_category?: string;\n angle?: string;\n hook_archetype?: string;\n composition?: string;\n};\n\n/** Whether our brand's voice runs memes: the company's reading (`memeRegister`), kept with the fit. */\ntype FitAudience = MemeAudience;\n\n/** The line that tells the fit our brand's voice does not run memes, and why. Pure. */\nfunction audienceLines(audience: FitAudience | undefined): string[] {\n return audience?.memes === \"off_brand\"\n ? [\n `Our brand's voice does not run memes${audience.why ? ` (${audience.why})` : \"\"}: a meme or a reaction face that does the stop job is impossible for us (decision impossible, rule: our brand's voice does not run memes), and the verdict is reject.`,\n ]\n : [];\n}\n\n/** The fit with its verdict set to reject when its scroll-stopper is a meme our audience does not read. Pure. */\nexport function rejectForAudience(fit: FitAnswer, audience: FitAudience | undefined): FitAnswer {\n const reasons = unfitReasons(fit, audience).filter((r) => r.includes(\"does not run memes\"));\n if (reasons.length === 0) return fit;\n return { ...fit, verdict: \"reject\", transfer_note: reasons.join(\"; \") };\n}\n\n/** The key a fit is kept under besides its ad: the bet it was made for and the register it was read in; none for neither. Pure. */\nexport function fitKeyOf(bet: FitBet | undefined, audience: FitAudience | undefined): string | undefined {\n const parts = [bet ? JSON.stringify(bet) : \"\", audience ? `memes:${audience.memes}:${audience.why ?? \"\"}` : \"\"];\n return parts.some(Boolean) ? parts.join(\"|\") : undefined;\n}\n\n/** A person the company may show in its ads: one of its Avatars (`castInventory`'s). */\ntype FitCast = { handle: string; real: boolean; who: string; relation: string; castable: boolean };\n\n/** Who the company may show, as the fit reads it: its team's, founder's and made-for-a-role Avatars; a customer's only in their own testimonial. Pure. */\nfunction castLines(cast: readonly FitCast[]): string[] {\n const ours = cast\n .filter((a) => a.castable)\n .map((a) => `@${a.handle} (${a.real ? \"a real person\" : \"made for a role\"}: ${a.who})`);\n const theirs = cast\n .filter((a) => !a.castable)\n .map(\n (a) =>\n `@${a.handle}: a ${a.relation === \"unknown\" ? \"customer\" : a.relation} (${a.who}); only in an ad quoting their own published words, never a reaction face or a model`,\n );\n return [\n `The people OUR ads may show: our team's, founder's or a made-for-a-role Avatar${ours.length > 0 ? ` (${ours.join(\"; \")})` : \" (none made yet)\"}, unless our rules forbid made-up people.`,\n ...(theirs.length > 0\n ? [\n `Avatars of people who are not ours to cast: ${theirs.join(\"; \")}. A customer's face appears only in a testimonial ad that quotes them.`,\n ]\n : [\"A customer's face appears only in a testimonial ad that quotes them.\"]),\n ];\n}\n\n/**\n * The fit model's prompt: the company first, then the question, the answer a fixed JSON the code\n * reads. The layers are the ones the ad spec's `concept` keeps. Pure.\n */\nexport function buildFitPrompt(input: {\n library: FitLibraryRead;\n knowledge: string;\n bet?: FitBet;\n /** The company's Avatars, when they could be read. */\n cast?: readonly FitCast[];\n /** Whether its audience reads memes. */\n audience?: FitAudience;\n}): string {\n const facts = libraryFacts(input.library);\n return [\n \"The image is a winning ad by another advertiser. We want to build an ad for OUR company on its concept: keep why it wins, change everything else to ours.\",\n ...(facts.length > 0 ? [`The ads library read it as: ${facts.join(\". \")}.`] : []),\n \"\",\n \"What OUR company has (its own documents):\",\n input.knowledge.trim() || \"(nothing written down yet)\",\n ...(input.cast ? castLines(input.cast) : []),\n ...audienceLines(input.audience),\n \"\",\n ...(input.bet ? [...betLines(input.bet), \"\"] : []),\n \"Answer in English:\",\n \"why_it_wins, in layers, one short phrase each, empty when a layer does nothing: disguise (what the ad pretends to be: a note, a tweet, a newspaper, a chat, a plain ad), voice (who speaks and how: a peer, a founder, a brand), trigger (the emotion or need it pulls: a free gift, fear of a hidden loss, status, curiosity), attention (what stops the scroll), logic (why it convinces: reciprocity, social proof, a comparison, a price anchor).\",\n 'load_bearing: the 2-5 elements the ad stops working without (never decoration), always these two: what stops the scroll (job \"stop\": the face or reaction, the joke, the meme people know, the odd photo; when attention names a face, that face is it) and the proof that makes it believed (job \"proof\": the ✗/✓ checklist, the before and after, the rating, the result shown), then any other its why_it_wins rests on (job \"other\"). Name each as it shows in the picture (\"the two reaction faces of a famous sitcom boss\", \"the red ✗ and green ✓ marks before each line\"), never as an idea (\"a contrast\", \"relatable fatigue\").',\n \"Each with: element, job, needs (what it takes to carry it), have (have: we have it as it is; adapt: something of ours can do its job; missing: we have nothing that does), decision (keep: as it is; replace: with something of ours that does the same job, named in ours; impossible: nothing of ours may do its job; a person is never kept as theirs: the advertiser's own people, or a celebrity who is not a meme template, are replaced with one of ours; a famous meme's job is done by a meme our buyer persona knows and relates to, from `baker images meme`, our words on it, whenever our brand's voice runs memes: the proven ad's own template only when it is also the one our persona knows best; a two-panel reaction meme becomes two real templates, top and bottom; never a customer's face: a customer appears only in an ad quoting their own words), ours (what of ours does its job, concretely, one thing of ours, never a choice between two: a meme our buyer persona knows and relates to, from `baker images meme` with our words, our team's, founder's or a made-for-a-role Avatar, the ✓/✗ marks in our colours; never invent an offer, a gift, a price, a review or a customer we do not have), rule (only when one of the company's rules forbids it as it is: that rule, quoted word for word).\",\n \"A rule forbids only what it names: \\\"no stock photography\\\" forbids stock photos, never a meme's reaction face, the company's own people or its Avatars; a rule on logos, buttons or colours says nothing about faces.\",\n \"verdict: use (it transfers as it is), adapt (it transfers with ours in place of theirs), reject (what stops the scroll, the proof or another load-bearing element is impossible for us: without it our version loses why it wins).\",\n \"transfer_note: one sentence on how the idea becomes ours, or why it cannot.\",\n \"brand_presence: native when the disguise only works without looking like an ad (the logo as the sender's picture, no big button), else standard.\",\n 'recognition: what kind of product a stranger must take OUR version for in one second, never its format (\"a trade course\", \"a social media API for developers\", \"a payroll app\").',\n \"carry: what made it a winner, so what OUR ad takes from it: whole_ad (it wins as one piece: its disguise, layout and hook together; ours keeps all three with our words, brand and pictures), layout (its composition or container does the work: ours keeps that arrangement), hook (its opening line or first visual stops the scroll: ours opens on the same pattern in our words), angle (the argument or need it pulls wins, its look is ordinary: ours keeps the argument and looks like ours). carry_why: one sentence on why that level.\",\n ...(input.bet\n ? [\n \"our_viewer: would the viewer of the ad we are making stop on THIS ad's move, made ours? stops: yes, maybe or no; why: one sentence naming what in it would or would not reach them (their age, life, market, what they care about). An ad that wins with another audience is no reference for ours.\",\n ]\n : []),\n \"\",\n `Reply with only this JSON: {\"why_it_wins\":{\"disguise\":\"\",\"voice\":\"\",\"trigger\":\"\",\"attention\":\"\",\"logic\":\"\"},\"load_bearing\":[{\"element\":\"\",\"job\":\"stop|proof|other\",\"needs\":\"\",\"have\":\"have|adapt|missing\",\"decision\":\"keep|replace|impossible\",\"ours\":\"\",\"rule\":\"\"}],\"verdict\":\"use|adapt|reject\",\"transfer_note\":\"\",\"brand_presence\":\"native|standard\",\"recognition\":\"\",\"carry\":\"whole_ad|layout|hook|angle\",\"carry_why\":\"\"${input.bet ? ',\"our_viewer\":{\"stops\":\"yes|maybe|no\",\"why\":\"\"}' : \"\"}}`,\n ].join(\"\\n\");\n}\n\n/** The library's read of a reference, as lines the fit prompt quotes. Pure. */\nfunction libraryFacts(lib: FitLibraryRead): string[] {\n return [\n lib.advertiser ? `advertiser: ${lib.advertiser}` : \"\",\n lib.format_pattern ? `container: ${lib.format_pattern}` : \"\",\n lib.mechanism ? `persuasion mechanism: ${lib.mechanism}` : \"\",\n lib.awareness ? `awareness stage: ${lib.awareness}` : \"\",\n lib.offer ? `offer: ${lib.offer}` : \"\",\n lib.winner_category ? `evidence it won: ${lib.winner_category}` : \"\",\n lib.angle ? `angle: ${lib.angle}` : \"\",\n lib.hook_archetype ? `hook: ${lib.hook_archetype}` : \"\",\n lib.composition ? `composition: ${lib.composition}` : \"\",\n lib.text && lib.text.length > 0 ? `its words: ${lib.text.map((t) => `\"${t}\"`).join(\"; \")}` : \"\",\n ].filter(Boolean);\n}\n\n/** The ad we are making, as the fit reads it: who it is for, what it says, in our customers' words. Pure. */\nfunction betLines(bet: FitBet): string[] {\n return [\n \"The ad we are making with it:\",\n `- For: ${bet.who}${bet.market ? `, ${bet.market}` : \"\"}${bet.awareness ? `; awareness: ${bet.awareness}` : \"\"}`,\n `- It says: ${bet.message}${bet.angle ? ` (angle: ${bet.angle})` : \"\"}`,\n ...(bet.shows\n ? [\n `- What it shows first: ${bet.shows}. A reference whose picture cannot be remade to show this does not fit (verdict reject), however good its buyer match.`,\n ]\n : []),\n ...(bet.quotes && bet.quotes.length > 0\n ? [`- In our customers' own words: ${bet.quotes.map((q) => `\"${q}\"`).join(\"; \")}`]\n : []),\n ];\n}\n\n/** What the agent does next with a fit. Pure. */\nexport function fitHints(fit: FitAnswer, adId: string, platform = \"meta\", audience?: FitAudience): string[] {\n const reasons = unfitReasons(fit, audience);\n if (fit.verdict === \"reject\" || reasons.length > 0) {\n return [\n `Pick another reference: ${reasons.length > 0 ? reasons.join(\"; \") : \"this one wins on something we cannot supply\"}, and our version would lose why it won.${fit.transfer_note ? ` ${fit.transfer_note}` : \"\"} Do not stop or ask the person: check the next candidates (\\`baker winning-ads fit <adId> --platform ${platform}\\`, about three) and scaffold the first that fits.`,\n ];\n }\n const keeps = fit.load_bearing.map((l) => {\n const job = l.job === \"stop\" ? \"what stops the scroll\" : l.job === \"proof\" ? \"the proof\" : `\"${l.element}\"`;\n return decisionOf(l) === \"replace\" && l.ours?.trim() ? `${job} as \"${l.ours.trim()}\"` : `\"${l.element}\"`;\n });\n return [\n `It fits (${fit.verdict}). Scaffold it: \\`baker canvas scaffold-static-ad --source-ad-id ${adId} --source-platform ${platform} --slug <slug>\\`: prompt.json's \\`concept\\` is seeded from this fit, and every render keeps ${keeps.join(\", \") || \"its idea\"}.`,\n ...(fit.brand_presence === \"native\"\n ? [\n \"The concept is a native disguise: the brand shows as the sender (the logo small, as its picture or signature) and there is no big button; prompt.json says `brand_presence: native`.\",\n ]\n : []),\n ];\n}\n\n/** How the scaffold's hint for a reference built on with no fit opens (`creatives make` drops it once it checked the reference). */\nexport const NO_FIT_HINT = \"No fit was made of this reference\";\n\n/** The ad spec fields a fit seeds: `concept`, `brand_presence`, `recognition`. Pure. */\nexport function conceptFromFit(fit: FitAnswer, adId: string) {\n return {\n concept: {\n reference_ad_id: adId,\n why_it_wins: fit.why_it_wins,\n load_bearing: fit.load_bearing,\n verdict: fit.verdict,\n ...(fit.transfer_note ? { transfer_note: fit.transfer_note } : {}),\n // A fit that names no level (cached before `carry`) is read as the whole ad, and says so.\n carry: fit.carry ?? \"whole_ad\",\n ...(fit.carry_why ? { carry_why: fit.carry_why } : {}),\n },\n ...(fit.brand_presence ? { brand_presence: fit.brand_presence } : {}),\n ...(fit.recognition ? { recognition: fit.recognition } : {}),\n };\n}\n\nconst MAX_DOC_CHARS = 6000;\nconst MAX_ENTRY_CHARS = 1200;\nconst KNOWLEDGE_COLLECTIONS = [\"offers\", \"products\", \"personas\", \"positioning\"] as const;\n\nfunction readText(file: string): Promise<string | null> {\n return readFile(file, \"utf8\").catch(() => null);\n}\n\n/** How the brand speaks and looks and which logo its ads use, as its reading says. Pure. */\nfunction brandLines(brand: CreativeContext[\"brand\"]): string {\n const lines = [\n ...(brand?.voice ? [`Voice: ${brand.voice}`] : []),\n ...(brand?.imagery ? [`Pictures: ${brand.imagery}`] : []),\n ...(brand?.logoUsage ? [`Logo: ${brand.logoUsage}`] : []),\n ];\n return lines.length > 0 ? `The brand:\\n${lines.join(\"\\n\")}` : \"\";\n}\n\n/**\n * What the company has, as the fit reads it: COMPANY.md (the records of what it has), how its brand\n * speaks and looks, every rule it sets for a static ad, and every entry of the offers, products and\n * personas in the Knowledge, each cut short. Never throws.\n */\nexport async function readKnowledge(root: string, readers?: ContextReaders): Promise<string> {\n const parts: string[] = [];\n const company = await readText(path.join(root, \"COMPANY.md\"));\n if (company) parts.push(`COMPANY.md:\\n${company.slice(0, MAX_DOC_CHARS)}`);\n const context = await readCreativeContext(root, { kind: \"static\" }, readers ? { readers } : {});\n const brand = brandLines(context.brand);\n if (brand) parts.push(brand);\n const rules = rulesBlock(context.rules);\n if (rules) parts.push(rules);\n for (const collection of KNOWLEDGE_COLLECTIONS) {\n const dir = path.join(root, \"src\", \"content\", collection);\n const files = ((await readdir(dir, { recursive: true }).catch(() => [])) as string[]).filter((f) =>\n f.endsWith(\".md\"),\n );\n for (const file of files.sort().slice(0, 12)) {\n const text = await readText(path.join(dir, file));\n if (text) parts.push(`${collection}/${file}:\\n${text.slice(0, MAX_ENTRY_CHARS)}`);\n }\n }\n return parts.join(\"\\n\\n\");\n}\n\n/** One review as the testimonials route returns it, read loosely so a new field never empties the list. */\nconst ReviewSchema = z.object({\n reviewText: z.string(),\n sourceType: z.string().optional(),\n rating: z.number().optional(),\n});\n\n/** The company's reviews (`/api/testimonials`, a plain list), as a few lines the fit can weigh proof against. Pure. */\nexport function reviewsForFit(data: unknown): string {\n const list = Array.isArray(data) ? data : [];\n const lines = list.slice(0, 15).flatMap((item) => {\n const review = ReviewSchema.safeParse(item);\n if (!review.success || !review.data.reviewText.trim()) return [];\n const { reviewText, sourceType, rating } = review.data;\n const label = [sourceType, rating !== undefined ? `${rating}★` : \"\"].filter(Boolean).join(\" \");\n return [`- ${label ? `${label} ` : \"\"}\"${reviewText.slice(0, 160)}\"`];\n });\n return lines.length > 0\n ? `Reviews we have (${lines.length}):\\n${lines.join(\"\\n\")}`\n : \"Reviews we have: none on file.\";\n}\n\n/** The company's reviews for the fit. Never throws. */\nasync function readReviews(): Promise<string> {\n try {\n return reviewsForFit(await apiGet<unknown>(\"/api/testimonials\", { limit: \"15\" }));\n } catch {\n return \"\";\n }\n}\n\n/** Where a fit is kept, so the scaffold of the same reference seeds its concept from it. */\nexport function fitCachePath(root: string, platform: string, adId: string): string {\n return path.join(root, \"canvas\", \".cache\", \"fit\", `${platform}-${adId.replace(/[^a-zA-Z0-9_-]/g, \"_\")}.json`);\n}\n\n/** The fit this workspace made of a reference, or null. Never throws. */\nexport function readCachedFit(root: string, platform: string, adId: string): Promise<FitAnswer | null> {\n return readFitFile(fitCachePath(root, platform, adId));\n}\n\n/** A cached fit file's answer, or null. Never throws. */\nasync function readFitFile(file: string): Promise<FitAnswer | null> {\n const raw = await readText(file);\n if (!raw) return null;\n try {\n const parsed = FitAnswerSchema.safeParse(JSON.parse(raw));\n return parsed.success ? parsed.data : null;\n } catch {\n return null;\n }\n}\n\nconst DESCRIPTION =\n \"Does a winning ad fit this company? One vision call reads the reference beside what the company has (COMPANY.md, the brand's rules, the offers, products and personas in the Knowledge, its reviews, its Avatars) and says why the ad wins (disguise, voice, trigger, attention, logic), the elements it stops working without (always what stops the scroll, `job: stop`, and its proof, `job: proof`), what our ad does with each (`decision`: keep, replace with `ours`, or impossible, quoting the `rule` that forbids it), and a verdict: use, adapt or reject (a stop or proof that is impossible for us is a reject). Start here before scaffolding a static ad from the library: check about three candidates, scaffold only one that fits. `baker canvas scaffold-static-ad --source-ad-id <adId>` then seeds prompt.json's `concept` from this verdict, and a run refuses a rejected concept. Example: baker winning-ads fit 1310524137919413 --platform meta. Output is compact; --full adds the whole read.\";\n\nconst ARGS = {\n \"ad-id\": { type: \"positional\", required: true, description: \"The library ad id (from search/winners/feed).\" },\n platform: {\n type: \"string\",\n required: false,\n description: `Which platform the ad id is on: ${LIBRARY_PLATFORMS.join(\"|\")} (default meta). The fit reads a still picture: a static ad (on google, a display ad). A video ad, YouTube included, is read with \\`content\\`; a Google search, Shopping or app ad is refused.`,\n },\n full: {\n type: \"boolean\",\n required: false,\n default: false,\n description: \"Add the whole read: every layer, need and note.\",\n },\n} as const;\n\nregisterSchema({ command: \"winning-ads.fit\", description: DESCRIPTION, args: ARGS });\n\ntype LibraryAd = Awaited<ReturnType<typeof fetchLibraryReference>>;\n\n/** The reference's picture as a JPEG the vision model reads, null when it has none to read. */\n/** A picture as the vision models read it: a JPEG at most 1024 px, base64; null when it cannot be read. */\nexport async function pictureOf(url: string | null | undefined): Promise<string | null> {\n if (!url) return null;\n try {\n const bytes = await bytesOf(url);\n return (await sharp(bytes).resize(1024, 1024, { fit: \"inside\" }).jpeg({ quality: 85 }).toBuffer()).toString(\n \"base64\",\n );\n } catch {\n return null;\n }\n}\n\n/** What the library already read of the ad, to ground the fit. */\nfunction libraryRead(ad: LibraryAd) {\n return {\n ...(ad.advertiser ? { advertiser: ad.advertiser } : {}),\n ...(ad.layout.format_pattern ? { format_pattern: ad.layout.format_pattern } : {}),\n ...(ad.message.mechanism ? { mechanism: ad.message.mechanism } : {}),\n ...(ad.message.awareness_stage ? { awareness: ad.message.awareness_stage } : {}),\n ...(ad.offer.offer_type ? { offer: ad.offer.offer_type } : {}),\n ...(ad.winner_category ? { winner_category: ad.winner_category } : {}),\n ...(ad.angle ? { angle: ad.angle } : {}),\n ...(ad.hook_archetype ? { hook_archetype: ad.hook_archetype } : {}),\n ...(ad.layout.composition ? { composition: ad.layout.composition } : {}),\n text: ad.on_screen_text.flatMap((o) => (o.text ? [o.text] : [])).slice(0, 10),\n };\n}\n\n/**\n * The fit this workspace already made of the ad, else a new one from `ask`, kept for next time:\n * asking again is free, and a `reject` stays a reject (the scaffold's concept gate reads it).\n * With a `bet` key (the ad being made), a fit made for another bet is never reused: one ad can\n * suit one idea's viewer and not another's. The latest fit stays the ad's own, for its readers.\n */\nexport async function fitOnce(\n root: string,\n platform: string,\n adId: string,\n ask: () => Promise<FitAnswer | null>,\n bet?: string,\n): Promise<FitAnswer | null> {\n const betFile = bet ? fitCachePath(root, platform, `${adId}--${betKey(bet)}`) : null;\n const cached = betFile ? await readFitFile(betFile) : await readCachedFit(root, platform, adId);\n if (cached) return cached;\n const fit = await ask();\n if (!fit) return null;\n const text = `${JSON.stringify(fit, null, 2)}\\n`;\n for (const file of [betFile, fitCachePath(root, platform, adId)]) {\n if (!file) continue;\n await mkdir(path.dirname(file), { recursive: true });\n await writeFile(file, text, \"utf8\");\n }\n return fit;\n}\n\n/** A short stable key for a bet's text. Pure. */\nfunction betKey(bet: string): string {\n return createHash(\"sha256\").update(bet).digest(\"hex\").slice(0, 16);\n}\n\n/**\n * The first ask reads one reference for one ad the same way every time: whether what stops its\n * scroll can be ours decides the ad, and on dev the same question came back kept, replaced and\n * impossible on four asks. A reply out of shape is asked again as usual.\n */\nconst FIT_REQUEST = { temperature: 0, seed: 0 };\n\n/** The fit, asked at most twice; null when the model never answered in shape. */\nasync function askFit(jpeg: string, prompt: string, onSpend: (usage: ReviewUsage) => void): Promise<FitAnswer | null> {\n for (let attempt = 0; attempt < 2; attempt++) {\n const reply = await askAboutImages(\n AD_DESCRIBE_MODEL,\n [jpeg],\n prompt,\n onSpend,\n undefined,\n undefined,\n undefined,\n attempt === 0 ? FIT_REQUEST : {},\n );\n const parsed = FitAnswerSchema.safeParse(reply);\n if (parsed.success) return parsed.data;\n }\n return null;\n}\n\nexport type FitFailure =\n | { code: \"NOT_FOUND\" | \"UNAVAILABLE\" | \"VIDEO_REFERENCE\"; message: string; fix: string }\n | DesignRefusal;\n\n/** The library ad and its picture the fit reads, or why it cannot: never exits. */\nasync function readFitReference(\n adId: string,\n platform: LibraryPlatform,\n): Promise<{ ok: true; ad: LibraryAd; jpeg: string } | { ok: false; failure: FitFailure }> {\n let ad: LibraryAd;\n try {\n ad = await fetchLibraryReference(adId, platform);\n } catch (e) {\n return {\n ok: false,\n failure: {\n code: \"NOT_FOUND\",\n message: `The library could not return ad ${adId} on ${platform} (${e instanceof Error ? e.message : String(e)}).`,\n fix: \"Check the ad id and --platform against `baker winning-ads search`.\",\n },\n };\n }\n // A search text ad, a Shopping listing or an app-install ad is no design: never billed a fit.\n const refusal = notADesignReference(platform, adId, ad);\n if (refusal) return { ok: false, failure: refusal };\n // The fit reads one still picture: a video is studied whole with `content`, never fetched here.\n if (ad.format === \"video\") {\n return {\n ok: false,\n failure: {\n code: \"VIDEO_REFERENCE\",\n message: `Ad ${adId} is a video: the fit reads still pictures.`,\n fix: `Read it with \\`baker winning-ads content ${adId} --platform ${platform}\\` (transcript, on-screen text, pacing) and build the video with \\`baker canvas scaffold-ad\\`. For a static, pick a static ad.`,\n },\n };\n }\n const jpeg = await pictureOf(ad.media_url);\n if (!jpeg) {\n return {\n ok: false,\n failure: {\n code: \"NOT_FOUND\",\n message: `Ad ${adId} has no picture the fit can read.`,\n fix: \"Pick a static ad with a picture.\",\n },\n };\n }\n return { ok: true, ad, jpeg };\n}\n\n/**\n * The fit of one library ad for this workspace's company: cached, else one vision call. Never\n * exits; a reference the library cannot return, one with no picture, or a model that does not\n * answer is a failure the caller reports.\n */\nexport async function fitReference(\n root: string,\n platform: LibraryPlatform,\n adId: string,\n bet?: FitBet,\n): Promise<{ ok: true; fit: FitAnswer } | { ok: false; error: FitFailure }> {\n let failure = null as FitFailure | null;\n // Read before the cache: a fit made in another register is read again.\n const audience = memeRegister(await readCompanyReading(root).catch(() => null));\n const askFor = async () => {\n const read = await readFitReference(adId, platform);\n if (!read.ok) {\n failure = read.failure;\n return null;\n }\n const { ad, jpeg } = read;\n const knowledge = [await readKnowledge(root), await readReviews()].filter(Boolean).join(\"\\n\\n\");\n // Who we may show decides whether a face the reference stops the scroll with can be ours.\n const company = await castCompany(root);\n const cast = await readAvatars<AvatarsListResponse>(\"/api/avatars\", { status: \"ready\" }).then(\n (response) => avatarsOf(response, company),\n () => undefined,\n );\n const prompt = buildFitPrompt({\n library: libraryRead(ad),\n knowledge,\n ...(bet ? { bet } : {}),\n ...(cast ? { cast } : {}),\n ...(audience ? { audience } : {}),\n });\n const spent: ReviewUsage[] = [];\n const answer = await askFit(jpeg, prompt, (u) => spent.push(u));\n // No run record carries this call: the next render of this workspace bills it.\n await holdUnbilledSpend(path.join(root, \"canvas\", \".cache\"), spent);\n return answer && rejectForAudience(answer, audience);\n };\n // With no bet the ad's own file is the one `make` kept: a register-only key would look elsewhere and overwrite it.\n const fit = await fitOnce(root, platform, adId, askFor, bet ? fitKeyOf(bet, audience) : undefined);\n if (fit) return { ok: true, fit };\n return {\n ok: false,\n error: failure ?? {\n code: \"UNAVAILABLE\",\n message: \"The fit model did not answer (no gateway key here, or it failed twice).\",\n fix: \"Run it again, or read the reference yourself with `baker winning-ads content <adId> --full` and write prompt.json's `concept` by hand.\",\n },\n };\n}\n\nexport const fitCommand = defineCommand({\n meta: { name: \"fit\", description: DESCRIPTION },\n args: ARGS,\n async run({ args }) {\n const adId = String(args[\"ad-id\"]);\n const platformResult = resolveSourcePlatform(args.platform ? String(args.platform) : undefined);\n if (!platformResult.ok) {\n writeJson({ ok: false, error: { code: \"INVALID_ARGUMENT\", message: platformResult.message } });\n process.exit(1);\n }\n const platform = platformResult.platform;\n const root = findWorkspaceRoot(process.cwd()) ?? process.cwd();\n const result = await fitReference(root, platform, adId);\n if (!result.ok) {\n writeJson({ ok: false, error: result.error });\n process.exit(1);\n }\n const fit = result.fit;\n const why = [fit.why_it_wins.disguise, fit.why_it_wins.trigger, fit.why_it_wins.logic].filter(Boolean).join(\"; \");\n writeJson({\n ok: true,\n data: {\n ad_id: adId,\n verdict: fit.verdict,\n why_it_wins: why,\n load_bearing: fit.load_bearing.map((l) => ({\n element: l.element,\n ...(l.job ? { job: l.job } : {}),\n decision: decisionOf(l),\n ...(l.ours ? { ours: l.ours } : {}),\n ...(l.rule ? { rule: l.rule } : {}),\n })),\n ...(fit.brand_presence ? { brand_presence: fit.brand_presence } : {}),\n ...(fit.carry ? { carry: fit.carry } : {}),\n ...(args.full ? { read: fit } : {}),\n },\n hints: fitHints(fit, adId, platform, memeRegister(await readCompanyReading(root).catch(() => null))),\n });\n },\n});\n","import type { AdContent, AdContentResponse } from \"@baker/api/ad-library\";\nimport { apiGet } from \"../../client.ts\";\n\n/**\n * The winners library's structured read of the reference ad, carried into the scaffold by id.\n *\n * Before this, the reference reached `scaffold-static-ad` as a picture plus free text, and the\n * describe pass re-read from pixels what ad-dna had already extracted: the container\n * (`format_pattern`), the composition, the persuasion mechanism, the offer, every text block\n * with its role. That read is fetched here the way `baker winning-ads content <adId> --full`\n * fetches it, projected to what the render can act on, and written into `prompt.json` as\n * `reference`, so the agent and the render prompt read one account of why the ad won.\n */\n\n/** The platforms the library indexes: the `sourcePlatform` enum of the scaffold's creatives collection. */\nexport const LIBRARY_PLATFORMS = [\"meta\", \"linkedin\", \"tiktok\", \"google\"] as const;\nexport type LibraryPlatform = (typeof LIBRARY_PLATFORMS)[number];\n\nexport type SourcePlatformResolution = { ok: true; platform: LibraryPlatform } | { ok: false; message: string };\n\n/** `--source-platform`, default meta; an unknown value is refused, never mapped to a guess. */\nexport function resolveSourcePlatform(flag: string | undefined): SourcePlatformResolution {\n const value = flag?.trim();\n if (!value) return { ok: true, platform: \"meta\" };\n if ((LIBRARY_PLATFORMS as readonly string[]).includes(value)) return { ok: true, platform: value as LibraryPlatform };\n return {\n ok: false,\n message: `--source-platform \"${value}\" is not a library platform. Use one of: ${LIBRARY_PLATFORMS.join(\", \")}.`,\n };\n}\n\nconst PICK_A_DESIGN =\n \"To build a static on a proven design, pick a Google display ad or a static from another platform (`baker winning-ads search --format static`); a YouTube ad is a video reference, read with `baker winning-ads content`.\";\n\n/** Why an ad cannot be built on: what the agent reads it for instead. */\nexport type DesignRefusal = { code: \"NOT_A_DESIGN_REFERENCE\"; message: string; fix: string };\n\n/** What a reference is judged on: its format and, on Google, which kind of ad it is. */\nexport type ReferenceKind = Pick<AdContent, \"format\"> & Partial<Pick<AdContent, \"google_ad_type\">>;\n\n/**\n * Why a library ad is no design to build on, else null. Only Google's display (image) and YouTube\n * (video) ads are: a search ad is words, and a Shopping listing or an app-install ad is assembled by\n * Google from a feed or a store page. An ad whose kind the library does not say is judged by its\n * format alone. Pure.\n */\nexport function notADesignReference(\n platform: LibraryPlatform,\n adId: string,\n ad: ReferenceKind,\n): DesignRefusal | null {\n if (platform !== \"google\") return null;\n if (ad.format === \"text\" || ad.google_ad_type === \"search\") {\n return {\n code: \"NOT_A_DESIGN_REFERENCE\",\n message: `Google ad ${adId} is a search text ad: a reference for wording, not a design.`,\n fix: `Read it with \\`baker winning-ads content ${adId} --platform google\\` and write our own copy. ${PICK_A_DESIGN}`,\n };\n }\n const assembled =\n ad.google_ad_type === \"shopping\"\n ? \"a Shopping product listing, which Google builds from a product feed\"\n : ad.google_ad_type === \"app\"\n ? \"an app-install ad, which Google builds from the app's store page\"\n : null;\n if (assembled) {\n return {\n code: \"NOT_A_DESIGN_REFERENCE\",\n message: `Google ad ${adId} is ${assembled}: there is no design of the advertiser's to build on.`,\n fix: PICK_A_DESIGN,\n };\n }\n return null;\n}\n\nexport type ReferenceTextBlock = { text: string; role?: string; position?: string };\n\n/** The `reference` block `prompt.json` carries: the library's read of the source ad, filled fields only. */\nexport type LibraryReference = {\n ad_id: string;\n platform: LibraryPlatform;\n advertiser?: string;\n advertiser_id?: string;\n format_pattern?: string;\n layout: Record<string, unknown>;\n message: Record<string, unknown>;\n offer: Record<string, unknown>;\n text_blocks: ReferenceTextBlock[];\n copy: Record<string, unknown>;\n};\n\n/** Fetch one ad's content as `baker winning-ads content --full` does. Throws on any failure; the caller degrades. */\nexport async function fetchLibraryReference(adId: string, platform: LibraryPlatform): Promise<AdContent> {\n const data = await apiGet<AdContentResponse>(\"/api/ad-library/ad-content\", { id: adId, platform });\n if (!data?.ad) throw new Error(`the library returned no ad for ${adId} on ${platform}`);\n return data.ad;\n}\n\n/** Only what the library found: null, undefined and empty lists are absences, never findings. */\nfunction filled(entries: Record<string, unknown>): Record<string, unknown> {\n return Object.fromEntries(\n Object.entries(entries).filter(([, v]) => v !== null && v !== undefined && !(Array.isArray(v) && v.length === 0)),\n );\n}\n\n/** Project the library's ad content to the block the blueprint and the render prompt read. */\nexport function libraryReferenceBlock(\n ad: AdContent,\n ids: { adId: string; platform: LibraryPlatform; advertiserId: string | undefined },\n): LibraryReference {\n const textBlocks: ReferenceTextBlock[] = ad.on_screen_text.flatMap((o) =>\n o.text\n ? [{ text: o.text, ...(o.role ? { role: o.role } : {}), ...(o.position ? { position: o.position } : {}) }]\n : [],\n );\n const advertiser = ad.advertiser ?? undefined;\n const advertiserId = ids.advertiserId ?? ad.advertiser_id ?? undefined;\n return {\n ad_id: ids.adId,\n platform: ids.platform,\n ...(advertiser ? { advertiser } : {}),\n ...(advertiserId ? { advertiser_id: advertiserId } : {}),\n ...(ad.layout.format_pattern ? { format_pattern: ad.layout.format_pattern } : {}),\n layout: filled({\n composition: ad.layout.composition,\n focal_subject: ad.layout.focal_subject,\n aspect_ratio: ad.layout.aspect_ratio,\n background: ad.layout.background,\n palette_mood: ad.layout.palette_mood,\n colors: ad.layout.colors,\n production: ad.layout.production,\n aesthetic: ad.layout.aesthetic,\n cta_in_image: ad.layout.cta_in_image,\n markers: ad.layout.markers,\n }),\n message: filled({\n mechanism: ad.message.mechanism,\n awareness: ad.message.awareness_stage,\n sophistication: ad.message.sophistication,\n angle: ad.angle,\n hook_archetype: ad.hook_archetype,\n pain_points: ad.message.pain_points,\n desires: ad.message.desires,\n value_props: ad.message.value_props,\n objections_handled: ad.message.objections_handled,\n proof: ad.message.proof,\n risk_reversal: ad.message.risk_reversal,\n }),\n offer: filled({\n offer_type: ad.offer.offer_type,\n pricing_model: ad.offer.pricing_model,\n entry_price: ad.offer.entry_price,\n no_credit_card: ad.offer.no_credit_card,\n guarantee: ad.offer.guarantee,\n guarantee_days: ad.offer.guarantee_days,\n urgency: ad.offer.urgency,\n bonus: ad.offer.bonus,\n }),\n text_blocks: textBlocks,\n copy: filled({ primary_text: ad.primary_text, headline: ad.headline, cta: ad.cta }),\n };\n}\n\n/**\n * The `context` the describe pass gets: the agent's own provenance plus what the library\n * already read off this ad. The describe pass still reads the pixels (the layout grid, the\n * fonts, the expressions), but it is told the container, the mechanism and the words up front\n * so its blueprint and the library's read cannot disagree on what the ad is.\n */\nexport function referenceDescribeContext(\n reference: LibraryReference | undefined,\n agentContext: string | undefined,\n): string | undefined {\n const own = agentContext?.trim() || undefined;\n if (!reference) return own;\n const facts: string[] = [];\n if (reference.advertiser) facts.push(`advertiser: ${reference.advertiser}`);\n if (reference.format_pattern) facts.push(`container (format_pattern): ${reference.format_pattern}`);\n if (typeof reference.layout.composition === \"string\") facts.push(`composition: ${reference.layout.composition}`);\n if (typeof reference.message.mechanism === \"string\") facts.push(`persuasion mechanism: ${reference.message.mechanism}`);\n if (typeof reference.message.awareness === \"string\") facts.push(`awareness stage: ${reference.message.awareness}`);\n if (typeof reference.offer.offer_type === \"string\") facts.push(`offer: ${reference.offer.offer_type}`);\n if (reference.text_blocks.length > 0) {\n facts.push(\n `text blocks: ${reference.text_blocks.map((b) => `\"${b.text}\"${b.role ? ` (${b.role})` : \"\"}`).join(\"; \")}`,\n );\n }\n const library =\n `The ads library has already read this ad: ${facts.join(\". \")}. ` +\n \"Your blueprint must agree with it on the container and the mechanism; refine and detail them, never contradict them, and transcribe the text blocks exactly.\";\n return own ? `${own}. ${library}` : library;\n}\n\n/**\n * Write the library's read into the blueprint as `reference`. Never a mechanism: the library's\n * container and persuasion label (\"comparison_table container carrying us_vs_them\") name the\n * format, not why the ad won, and seeded as the mechanism they hid that the read found none\n * (audited Sept 2026). Why it wins is `baker winning-ads fit`'s to say.\n */\nexport function mergeReferenceIntoBlueprint(blueprint: unknown, reference: LibraryReference | undefined): unknown {\n if (!reference || !blueprint || typeof blueprint !== \"object\" || Array.isArray(blueprint)) return blueprint;\n return { ...(blueprint as Record<string, unknown>), reference };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,kBAAkB;AAiB3B,SAAS,OAAO,SAAS,UAAU,iBAAiB;AACpD,OAAO,UAAU;AAGjB,SAAS,qBAAqB;AAC9B,OAAO,WAAW;AAClB,SAAS,SAAS;;;ACRX,IAAM,oBAAoB,CAAC,QAAQ,YAAY,UAAU,QAAQ;AAMjE,SAAS,sBAAsB,MAAoD;AACxF,QAAM,QAAQ,MAAM,KAAK;AACzB,MAAI,CAAC,MAAO,QAAO,EAAE,IAAI,MAAM,UAAU,OAAO;AAChD,MAAK,kBAAwC,SAAS,KAAK,EAAG,QAAO,EAAE,IAAI,MAAM,UAAU,MAAyB;AACpH,SAAO;AAAA,IACL,IAAI;AAAA,IACJ,SAAS,sBAAsB,KAAK,4CAA4C,kBAAkB,KAAK,IAAI,CAAC;AAAA,EAC9G;AACF;AAEA,IAAM,gBACJ;AAcK,SAAS,oBACd,UACA,MACA,IACsB;AACtB,MAAI,aAAa,SAAU,QAAO;AAClC,MAAI,GAAG,WAAW,UAAU,GAAG,mBAAmB,UAAU;AAC1D,WAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS,aAAa,IAAI;AAAA,MAC1B,KAAK,4CAA4C,IAAI,gDAAgD,aAAa;AAAA,IACpH;AAAA,EACF;AACA,QAAM,YACJ,GAAG,mBAAmB,aAClB,wEACA,GAAG,mBAAmB,QACpB,qEACA;AACR,MAAI,WAAW;AACb,WAAO;AAAA,MACL,MAAM;AAAA,MACN,SAAS,aAAa,IAAI,OAAO,SAAS;AAAA,MAC1C,KAAK;AAAA,IACP;AA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