@koda-sl/baker-cli 0.869.0-dev.620009099.1 → 0.869.0-dev.625c5485d
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 +2 -2
- package/dist/{account-5VOZ4R2X.js → account-LHY6YM6L.js} +2 -2
- package/dist/{account-CTM4XBY3.js → account-RHY557Z3.js} +4 -4
- package/dist/{account-assets-DOHOKM2L.js → account-assets-L6BX4YUQ.js} +46 -54
- package/dist/account-assets-L6BX4YUQ.js.map +1 -0
- package/dist/{account-level-HLSTNJHR.js → account-level-OX34JQ7C.js} +4 -4
- package/dist/{account-users-DL3UD2XG.js → account-users-JKMGJLS5.js} +4 -4
- package/dist/{accounts-KNMGEMMG.js → accounts-EA5AY2A2.js} +9 -9
- package/dist/{accounts-SNH3LJ2H.js → accounts-LNFU27BU.js} +2 -2
- package/dist/{accounts-7ACHUCAY.js → accounts-N2CYZQZZ.js} +3 -3
- package/dist/{actions-PO35WQVS.js → actions-J776YSK6.js} +18 -18
- package/dist/{activecampaign-4S63QE4C.js → activecampaign-GTESSOXT.js} +3 -3
- package/dist/{activities-QHDGHXMI.js → activities-LC64DAAK.js} +12 -21
- package/dist/activities-LC64DAAK.js.map +1 -0
- package/dist/{add-ZMOFKHFR.js → add-6P554X3K.js} +5 -5
- package/dist/{add-4PCJL2QX.js → add-CLWC4FVU.js} +2 -2
- package/dist/{add-2F6KL6KB.js → add-KINU722K.js} +3 -3
- package/dist/{ads-MYACXO5A.js → ads-6PCQ4OYH.js} +5 -5
- package/dist/{ads-ZDSRE7D6.js → ads-ZR5D7BZT.js} +19 -27
- package/dist/ads-ZR5D7BZT.js.map +1 -0
- package/dist/{adsets-CZQMTJ2T.js → adsets-3NIYL2GQ.js} +30 -48
- package/dist/adsets-3NIYL2GQ.js.map +1 -0
- package/dist/{advertisers-Y2ATV7L6.js → advertisers-CNK73JJF.js} +3 -3
- package/dist/{alerts-C4UFNZMJ.js → alerts-BW2CGM3I.js} +5 -5
- package/dist/{analytics-YRGTZHAY.js → analytics-KHTALHLZ.js} +3 -3
- package/dist/{analytics-EM4NNEG5.js → analytics-MUNUPB7Q.js} +7 -7
- package/dist/{asset-writes-TXYCARXJ.js → asset-writes-5ZKZDPQ4.js} +4 -4
- package/dist/{assign-GDV4YOFF.js → assign-QBJVLNC6.js} +3 -3
- package/dist/{audience-size-ONXW6YWQ.js → audience-size-QIDHHX6X.js} +3 -3
- package/dist/{audience-writes-DJG7XTFA.js → audience-writes-NL6NRLLY.js} +15 -29
- package/dist/audience-writes-NL6NRLLY.js.map +1 -0
- package/dist/{audiences-QHM26I5Y.js → audiences-DL267GNQ.js} +15 -27
- package/dist/audiences-DL267GNQ.js.map +1 -0
- package/dist/{audit-3Z6ZZKCH.js → audit-UJGOGIAU.js} +3 -3
- package/dist/{autocomplete-4ZI234QK.js → autocomplete-RG3TDFEI.js} +3 -3
- package/dist/{avatars-4OT3XVOD.js → avatars-N3RMT2EC.js} +4 -4
- package/dist/{bid-pricing-7NZ7QKXF.js → bid-pricing-3TXY2VBG.js} +4 -4
- package/dist/{brief-WOGFWWB3.js → brief-F7ULA7O4.js} +7 -7
- package/dist/{businesses-ALNQZFB4.js → businesses-RQ6P4DOS.js} +2 -2
- package/dist/{campaign-groups-VBOFSUJS.js → campaign-groups-DW3FEF3T.js} +9 -9
- package/dist/{campaign-writes-NMMJXTYD.js → campaign-writes-66YXATV2.js} +3 -3
- package/dist/{campaigns-ZWPYUZFF.js → campaigns-OX66VCI5.js} +5 -5
- package/dist/{campaigns-55VLNVCE.js → campaigns-RXDC5FSQ.js} +18 -29
- package/dist/campaigns-RXDC5FSQ.js.map +1 -0
- package/dist/{campaigns-YFB3PCLE.js → campaigns-YD3A4SOC.js} +12 -12
- package/dist/{canvas-NJV6RSX3.js → canvas-XCDAHTHR.js} +15 -15
- package/dist/{capabilities-FJAYWDY6.js → capabilities-IDPGBIYO.js} +3 -3
- package/dist/{catalog-XEALUTOG.js → catalog-SQQCJIP2.js} +4 -4
- package/dist/{catalogs-B24HAEXZ.js → catalogs-QAZ7ZZ5R.js} +3 -3
- package/dist/{chats-65GTXYEC.js → chats-AUQRML3Z.js} +3 -3
- package/dist/{check-YQIY4BTG.js → check-2W3UP257.js} +2 -2
- package/dist/{chunk-YUZGTNAO.js → chunk-25ZHO74B.js} +2 -2
- package/dist/{chunk-J4ZRPGNJ.js → chunk-34OSJO72.js} +7 -7
- package/dist/{chunk-FRYH2T32.js → chunk-3ZVNGEF4.js} +4 -4
- package/dist/{chunk-PUDEC2K3.js → chunk-45L3LIY4.js} +2 -2
- package/dist/{chunk-52YU7I5M.js → chunk-4VHCG242.js} +2 -2
- package/dist/{chunk-2RYEYBMF.js → chunk-5SHKAOXE.js} +12 -12
- package/dist/{chunk-5NLZJ75G.js → chunk-6LUVWBE5.js} +3 -3
- package/dist/{chunk-TU3HH4O3.js → chunk-7AJN5YDQ.js} +2 -2
- package/dist/{chunk-YY6D3PI6.js → chunk-7HIOYPDF.js} +3 -3
- package/dist/{chunk-Q7V5XSFZ.js → chunk-7T2KWVYO.js} +7 -7
- package/dist/{chunk-XOW4EBDN.js → chunk-7XKQ4DTX.js} +11 -2
- package/dist/chunk-7XKQ4DTX.js.map +1 -0
- package/dist/{chunk-UBUFWX5O.js → chunk-AMPV5F2W.js} +2 -2
- package/dist/{chunk-NKXH4YZT.js → chunk-B2VA4ARJ.js} +5 -5
- package/dist/{chunk-CBQTKSSP.js → chunk-C7PBCJWD.js} +3 -3
- package/dist/{chunk-4U4YQOO2.js → chunk-CSYSMGQ5.js} +2 -2
- package/dist/{chunk-6HQATKKL.js → chunk-DH35JQR4.js} +2 -2
- package/dist/{chunk-YF57BX3S.js → chunk-DP76WGDV.js} +8 -87
- package/dist/chunk-DP76WGDV.js.map +1 -0
- package/dist/{chunk-DNI4DYGT.js → chunk-E5LCUKVH.js} +2 -2
- package/dist/{chunk-EJ6B5OS5.js → chunk-EGM42UKF.js} +2 -2
- package/dist/{chunk-SBID6GZZ.js → chunk-EM3RZ72M.js} +2 -2
- package/dist/{chunk-W3XIDU5C.js → chunk-F7MZMCIZ.js} +2 -2
- package/dist/{chunk-6LFIF6BK.js → chunk-H6V7BEL6.js} +2 -2
- package/dist/{chunk-Z6WDG4DW.js → chunk-HP5LL75J.js} +2 -2
- package/dist/{chunk-6VAUBRY3.js → chunk-KIMJZDJ2.js} +2 -2
- package/dist/{chunk-W5JX7LUK.js → chunk-LD2SAHUD.js} +3 -3
- package/dist/{chunk-7MVVDZM2.js → chunk-LPZ2YSGS.js} +5 -5
- package/dist/{chunk-5EQF26Z4.js → chunk-LZIRACQU.js} +2 -2
- package/dist/{chunk-LVR2UYQ7.js → chunk-OF23KGEF.js} +2 -2
- package/dist/{chunk-JPFYTKQA.js → chunk-OJGQTU6L.js} +2 -2
- package/dist/{chunk-2WHALQOJ.js → chunk-OMJ7DVFJ.js} +2 -2
- package/dist/{chunk-FZWLNE53.js → chunk-PFBU3ENV.js} +2 -2
- package/dist/{chunk-4YQ46MM4.js → chunk-PK6E2I2B.js} +2 -2
- package/dist/{chunk-GOC2ZZJF.js → chunk-PTZT2BFY.js} +2 -2
- package/dist/{chunk-KPQJVORC.js → chunk-PYEEAI77.js} +2 -2
- package/dist/{chunk-IIXEFX33.js → chunk-Q24O2XAN.js} +3 -3
- package/dist/{chunk-JGXB7NBP.js → chunk-SCJEXSAX.js} +4 -2
- package/dist/{chunk-JGXB7NBP.js.map → chunk-SCJEXSAX.js.map} +1 -1
- package/dist/{chunk-TZPFQJTH.js → chunk-SCXUABAO.js} +2 -2
- package/dist/{chunk-JPP3LYVH.js → chunk-SKF5CGAD.js} +2 -2
- package/dist/{chunk-VUJPKIJN.js → chunk-UE5ZFTDL.js} +2 -2
- package/dist/{chunk-D4MNDYPX.js → chunk-UQJ3OKEK.js} +3 -3
- package/dist/{chunk-7YHMZVKM.js → chunk-UQR76QNY.js} +2 -2
- package/dist/{chunk-O5UWZ4AI.js → chunk-VEKIDFC5.js} +2 -2
- package/dist/{chunk-VBIKO56A.js → chunk-WKRVHRWY.js} +3 -14
- package/dist/chunk-WKRVHRWY.js.map +1 -0
- package/dist/{chunk-3YZBGH2W.js → chunk-XPYYZ7UV.js} +2 -2
- package/dist/{chunk-KYOKEQ5E.js → chunk-Y3I5TGOR.js} +6 -6
- package/dist/{chunk-RVWBLOXX.js → chunk-YXDE7ESY.js} +2 -2
- package/dist/{chunk-MIIY3MVK.js → chunk-ZMK4JKWY.js} +2 -2
- package/dist/{claim-IOM6PVO5.js → claim-IEORXE3L.js} +3 -3
- package/dist/cli.js +33 -33
- package/dist/{companies-WY4K6WLI.js → companies-CWM7XHPU.js} +7 -7
- package/dist/{company-PVCI3LC7.js → company-WJTDDC7Z.js} +3 -3
- package/dist/{complete-2QF4BZ5T.js → complete-QIEXZN4I.js} +3 -3
- package/dist/{connect-GSLMEPHD.js → connect-IEHPWYJU.js} +6 -6
- package/dist/{conversation-5NCE56L3.js → conversation-EWDSZ3HU.js} +3 -3
- package/dist/{conversions-DGKHWOMN.js → conversions-NYNJWZ7Y.js} +8 -8
- package/dist/{copy-writes-S4X5XUSK.js → copy-writes-QYN6PBU2.js} +4 -4
- package/dist/{create-2EFBCVF4.js → create-FC637MED.js} +2 -2
- package/dist/{create-TRL622CZ.js → create-NUE76WIZ.js} +3 -3
- package/dist/{create-KKJX3JLV.js → create-OICX2OGE.js} +3 -3
- package/dist/{create-X2R7FNDZ.js → create-OZDE3YHB.js} +3 -3
- package/dist/{creatives-BCTG6PV4.js → creatives-CPLH3KHQ.js} +19 -32
- package/dist/creatives-CPLH3KHQ.js.map +1 -0
- package/dist/{creatives-EWTMQK7H.js → creatives-QUIE4YDA.js} +9 -9
- package/dist/{creatives-D5WLUJWC.js → creatives-TSY3IRZP.js} +9 -9
- package/dist/{credentials-H4W36WE7.js → credentials-PBPCUZKS.js} +3 -3
- package/dist/{critique-4Q3XEGS5.js → critique-CUTABYRT.js} +4 -4
- package/dist/{crm-APNCVLF2.js → crm-FIT55QTZ.js} +4 -4
- package/dist/{crm-T3NV4EOU.js → crm-OBJOZBMY.js} +4 -4
- package/dist/{custom-conversions-56VXFOWV.js → custom-conversions-CTJVAZKC.js} +15 -27
- package/dist/custom-conversions-CTJVAZKC.js.map +1 -0
- package/dist/{customers-VZYCYMSL.js → customers-JCT5ST4D.js} +5 -5
- package/dist/{delete-BWPILWUN.js → delete-5MUFZDPC.js} +3 -3
- package/dist/{delete-VJEOLHNE.js → delete-AKJ73UEW.js} +3 -3
- package/dist/{delete-JGR3HPY5.js → delete-BIUYWSCA.js} +2 -2
- package/dist/{demographics-CBJ26IAA.js → demographics-FJEAZGHO.js} +3 -3
- package/dist/{discard-3MMFPF26.js → discard-XCPNQXQG.js} +3 -3
- package/dist/{domain-7MSMJMDP.js → domain-EXIGIEWD.js} +3 -3
- package/dist/{download-N3R6G3QV.js → download-URRCJTS5.js} +2 -2
- package/dist/{draft-XBO2DYIJ.js → draft-H6PPGFGH.js} +3 -3
- package/dist/{draft-OMGA2NYG.js → draft-UU3F2VMJ.js} +2 -2
- package/dist/{draft-F6FHBF6I.js → draft-VM4EX4V7.js} +3 -3
- package/dist/{draft-MKFFXTJK.js → draft-XRHDIPEI.js} +4 -4
- package/dist/engine/index.js +3 -3
- package/dist/{experiments-VYYS5Y7W.js → experiments-QHPFYUEZ.js} +4 -4
- package/dist/{extract-F7D62JMA.js → extract-2XX3WVX5.js} +2 -2
- package/dist/{facets-6GJJIRRR.js → facets-2RSHTLGX.js} +3 -3
- package/dist/{feedback-3TYBQZY4.js → feedback-WGO4NLTX.js} +3 -3
- package/dist/{fetch-JBXBMJBK.js → fetch-NMDFVLEK.js} +3 -3
- package/dist/{fit-ZFPYO3MS.js → fit-UNW33SFO.js} +2 -2
- package/dist/{flows-PP6BRBD7.js → flows-OXGIXQDY.js} +11 -11
- package/dist/{forecast-H24SICMO.js → forecast-7YQXOZYJ.js} +4 -4
- package/dist/{funnel-BFVSY5A6.js → funnel-AH2IGEWY.js} +4 -4
- package/dist/{get-SPKPNRXF.js → get-KOMUOBJX.js} +3 -3
- package/dist/{get-J4CETDIS.js → get-MCAPNYYL.js} +3 -3
- package/dist/{google-4IKGTP3C.js → google-CO72NV2S.js} +2 -2
- package/dist/{google-ads-SGKGDWV6.js → google-ads-3WTKW5L4.js} +3 -3
- package/dist/{history-QOQY2F77.js → history-BQJP6675.js} +3 -3
- package/dist/{history-K5ULNTEM.js → history-WBC3IZP4.js} +3 -3
- package/dist/{hubspot-HNZLT2BH.js → hubspot-XEDTNDRU.js} +9 -9
- package/dist/{ideas-35LERPN4.js → ideas-SCX336UC.js} +2 -2
- package/dist/{images-R3EK4BDH.js → images-IXU5XA3B.js} +7 -7
- package/dist/{ingest-LYVNO5M5.js → ingest-CWUFMM2F.js} +3 -3
- package/dist/{ingest-5TSJM7A7.js → ingest-KYHSANS7.js} +2 -2
- package/dist/{insights-3SQWIU4E.js → insights-QU5A4XBO.js} +2 -2
- package/dist/{inspect-36R5WLLX.js → inspect-VZPDZAMR.js} +4 -4
- package/dist/{instant-experiences-HSRGMQ5T.js → instant-experiences-EJWYFWDT.js} +3 -3
- package/dist/{keyword-metrics-JRB6DREM.js → keyword-metrics-TVLVS37F.js} +3 -3
- package/dist/{keywords-for-site-FQOELX5H.js → keywords-for-site-QQPOZ7YB.js} +3 -3
- package/dist/{leads-ILZAOKIF.js → leads-6KLZ3OQK.js} +3 -3
- package/dist/{leads-LWWPMZRY.js → leads-FEEWX7OO.js} +3 -3
- package/dist/{learn-AWQ6JTP2.js → learn-USN47KME.js} +4 -4
- package/dist/{line-item-writes-APTZP3DI.js → line-item-writes-WE7OPQKW.js} +3 -3
- package/dist/{line-items-5YSLNBGJ.js → line-items-5FGOMB4G.js} +5 -5
- package/dist/{link-2MGGDKLP.js → link-WEYSRLKQ.js} +3 -3
- package/dist/{linkedin-EBOTX37R.js → linkedin-KMDBZRRC.js} +30 -30
- package/dist/{linkedin-person-FNKW44RV.js → linkedin-person-EVT5PNT7.js} +3 -3
- package/dist/{list-75NNAGBR.js → list-BCNKRG35.js} +3 -3
- package/dist/{list-CJU2Y6OP.js → list-ME5VQY5U.js} +3 -3
- package/dist/{list-L3NBK64M.js → list-MVDGFAIL.js} +2 -2
- package/dist/{log-JJDSDLOK.js → log-CCYOQSTI.js} +3 -3
- package/dist/{make-U323I4SF.js → make-GFKMKMCC.js} +11 -11
- package/dist/{map-KFN2QLYV.js → map-NOKM43SB.js} +4 -4
- package/dist/{mcp-KGAXFVUM.js → mcp-GA2HAKE5.js} +2 -2
- package/dist/{media-UODVM47L.js → media-PUOLJUN3.js} +3 -3
- package/dist/{media-sources-BSECLIMM.js → media-sources-URJC5ZXU.js} +2 -2
- package/dist/{members-6FHV7EM2.js → members-23GZ3LYM.js} +3 -3
- package/dist/{meta-4IOVQSFF.js → meta-SPPSYRMC.js} +40 -40
- package/dist/{normalize-YWIDJR4R.js → normalize-AC6ISCSR.js} +3 -3
- package/dist/{options-R4Q46LU5.js → options-ML7OSX7I.js} +6 -6
- package/dist/{organization-76LF7MHK.js → organization-CCJEADUV.js} +3 -3
- package/dist/{page-photos-BCEDWPGX.js → page-photos-ZBMJLL5V.js} +3 -3
- package/dist/{pages-TZBFJXNR.js → pages-YZC44QR2.js} +2 -2
- package/dist/{people-BK6GRJXB.js → people-Y6DIISJJ.js} +3 -3
- package/dist/{people-HR7CAKZS.js → people-YW5IYH6F.js} +3 -3
- package/dist/{performance-PTBBUEZU.js → performance-7U7TPKQ6.js} +4 -4
- package/dist/{performance-Y2S5FDGI.js → performance-CZOXKJZJ.js} +3 -3
- package/dist/{pipedrive-NONV3NBQ.js → pipedrive-TQ4INC6B.js} +3 -3
- package/dist/{pixels-2BG3XMZP.js → pixels-EX6FHVHW.js} +12 -25
- package/dist/pixels-EX6FHVHW.js.map +1 -0
- package/dist/{preview-WHUVS5JJ.js → preview-4GUQGDBD.js} +2 -2
- package/dist/{preview-HD3QAR53.js → preview-ZY2NBGCK.js} +3 -3
- package/dist/{promoted-tweet-writes-3LNFAGEM.js → promoted-tweet-writes-43G7IOP2.js} +3 -3
- package/dist/{promoted-tweets-IHUQA35K.js → promoted-tweets-ESQOGB5N.js} +3 -3
- package/dist/{publish-IUE7RHRD.js → publish-UKADDPWA.js} +3 -3
- package/dist/{reddit-BOTUVLHL.js → reddit-MWNRB3UJ.js} +4 -4
- package/dist/{refresh-RPVVOQX4.js → refresh-4Q3YNBSS.js} +2 -2
- package/dist/{release-4YZWORV2.js → release-OVH45PQK.js} +3 -3
- package/dist/{remove-FO7I4RQ3.js → remove-6OV63L4F.js} +2 -2
- package/dist/{reopen-FMPQVL2C.js → reopen-VFIRDEFS.js} +3 -3
- package/dist/{rerun-RYL5UJRE.js → rerun-EFELGU7H.js} +14 -14
- package/dist/{research-3LSWITEK.js → research-QFABGPW7.js} +2 -2
- package/dist/{research-2H3ST6C2.js → research-Y5CUG6RA.js} +14 -14
- package/dist/{reset-RI6NO6NQ.js → reset-KBUW4MSS.js} +2 -2
- package/dist/{reset-PNCDMWGO.js → reset-PBO6UZCW.js} +2 -2
- package/dist/{resolve-SGL3A5N5.js → resolve-NPWBHA2X.js} +3 -3
- package/dist/{retry-JRH3WJSF.js → retry-K47P245Z.js} +2 -2
- package/dist/{retry-4FMP73MN.js → retry-ST2ABI4Q.js} +2 -2
- package/dist/{revenue-V4ODLBZ6.js → revenue-XMO76GKE.js} +4 -4
- package/dist/{rule-writes-Q5NLSBF5.js → rule-writes-6XP7G35U.js} +3 -3
- package/dist/{rules-Z7MMVOZ2.js → rules-BRULCGRV.js} +24 -41
- package/dist/rules-BRULCGRV.js.map +1 -0
- package/dist/{rules-EPNUXMHG.js → rules-G5SYPIVC.js} +5 -5
- package/dist/{run-2SPQZ2ZZ.js → run-4KGXARYK.js} +14 -14
- package/dist/{run-HLQUPQZ2.js → run-YU5FL7NI.js} +3 -3
- package/dist/{scaffold-ad-3YLGTFRT.js → scaffold-ad-GVFTZEW7.js} +9 -9
- package/dist/{scaffold-static-ad-3RCD642H.js → scaffold-static-ad-TNX7XV77.js} +17 -17
- package/dist/{scaffold-video-F5HTBM4R.js → scaffold-video-EMKTEEEJ.js} +8 -8
- package/dist/{schedule-O36GKVZV.js → schedule-B44TZ2ZG.js} +2 -2
- package/dist/{scheduled-agents-4UNG26CX.js → scheduled-agents-I3FXF2P5.js} +11 -11
- package/dist/{schema-SRFWL4ZT.js → schema-JBDPR3PA.js} +1 -1
- package/dist/{schema-EOQASVWI.js → schema-QHTODYWX.js} +4 -4
- package/dist/{search-DLMLA423.js → search-IXCXPVQB.js} +2 -2
- package/dist/{select-KBYLNNL4.js → select-EWEIL6TC.js} +5 -5
- package/dist/{set-6L7YV57E.js → set-FIFBH2JO.js} +5 -5
- package/dist/{set-prompt-WBYLKIO3.js → set-prompt-CEEJFM2T.js} +5 -5
- package/dist/{setup-links-XT4TEZWI.js → setup-links-WS4IXPAU.js} +3 -3
- package/dist/{shared-AXONQS3M.js → shared-64RE42DL.js} +4 -16
- package/dist/{shopify-ICWRWUZE.js → shopify-C7PDSZC5.js} +3 -3
- package/dist/{site-LYDFZM5U.js → site-2OSMZ2Q5.js} +4 -4
- package/dist/{sources-FPWA4AJN.js → sources-EYC2VWOB.js} +6 -6
- package/dist/{sources-CP4UQ5KA.js → sources-QO4JEY37.js} +6 -6
- package/dist/{stale-GWG4V65Q.js → stale-ZUTU73NO.js} +5 -5
- package/dist/{status-W6S7AY43.js → status-GHVRF3YU.js} +3 -3
- package/dist/{stock-6VZFFAHW.js → stock-CVYIUWEC.js} +2 -2
- package/dist/{studies-HUINRZHD.js → studies-357M2C2K.js} +16 -33
- package/dist/studies-357M2C2K.js.map +1 -0
- package/dist/{study-writes-SI5QXY7F.js → study-writes-HXUQRPIK.js} +3 -3
- package/dist/{sync-I6ZVQOSZ.js → sync-SBTP4YVN.js} +2 -2
- package/dist/{sync-definition-NADPEPFQ.js → sync-definition-T3JWIPFH.js} +8 -8
- package/dist/{tags-IQ6BCRLE.js → tags-6FOGX3BD.js} +3 -3
- package/dist/{tags-AN5B56GA.js → tags-AZJO5MJ7.js} +4 -4
- package/dist/{tags-ETUV62EB.js → tags-DGKZFNOA.js} +3 -3
- package/dist/{tags-UKAR6FCS.js → tags-W6RUDM3P.js} +3 -3
- package/dist/{tags-47QAF2ZJ.js → tags-XNSEOT6N.js} +3 -3
- package/dist/{targeting-3XK4OLPG.js → targeting-7T7XHBIX.js} +3 -3
- package/dist/{targeting-criteria-4E6SURB5.js → targeting-criteria-VRNDPRG7.js} +3 -3
- package/dist/{targets-GJUR5WTB.js → targets-MWYBWEFB.js} +3 -3
- package/dist/{testimonials-UCVT5VQY.js → testimonials-ZZYY2O56.js} +6 -6
- package/dist/{top-companies-WID72GN5.js → top-companies-AKJIL3OJ.js} +7 -7
- package/dist/{transcript-OMYAOZSP.js → transcript-H4R4D3SB.js} +3 -3
- package/dist/{translate-TIAJBFQ3.js → translate-JZUARDL6.js} +10 -10
- package/dist/{triggers-IEMDGR6W.js → triggers-RX5RNDLK.js} +3 -3
- package/dist/{unlink-WCLQPP7S.js → unlink-L72ROGSX.js} +3 -3
- package/dist/{unstage-KRPX3AGF.js → unstage-RFZNFCUC.js} +3 -3
- package/dist/{update-XF462N7M.js → update-DQQE2KKZ.js} +3 -3
- package/dist/{update-CPSZ4EH3.js → update-POMDJGRN.js} +2 -2
- package/dist/{update-CQ4VF2S5.js → update-S2OKSUFH.js} +3 -3
- package/dist/{update-NP2MOMJS.js → update-ZCLPU7U2.js} +3 -3
- package/dist/{upload-WRRNFTRK.js → upload-EGKKXKOW.js} +3 -3
- package/dist/{url-params-DKGJVTGL.js → url-params-QCVRTKVY.js} +3 -3
- package/dist/{validate-6AHY2UQR.js → validate-I66HVWO4.js} +10 -10
- package/dist/{videos-FG64T3XK.js → videos-OKKKMRSV.js} +6 -6
- package/dist/{videos-C5OCSAIF.js → videos-TJG5CA7N.js} +2 -2
- package/dist/{viewer-check-3YGDWCTR.js → viewer-check-YWFR4KM4.js} +2 -2
- package/dist/{visuals-3C2QUE6G.js → visuals-4R2NTKXP.js} +3 -3
- package/dist/{web-K3JH5TXT.js → web-UCQMO7PP.js} +15 -6
- package/dist/web-UCQMO7PP.js.map +1 -0
- package/dist/{winning-ads-QDVS56XX.js → winning-ads-L4VL5SRB.js} +3 -3
- package/dist/{write-commands-T46SVSQ7.js → write-commands-4KI6T2NF.js} +7 -7
- package/dist/{write-commands-X72A5F7K.js → write-commands-BA5OPMJ4.js} +4 -4
- package/dist/{x-JU6LF2MM.js → x-R6VRO4LT.js} +6 -6
- package/package.json +1 -1
- package/dist/account-assets-DOHOKM2L.js.map +0 -1
- package/dist/activities-QHDGHXMI.js.map +0 -1
- package/dist/ads-ZDSRE7D6.js.map +0 -1
- package/dist/adsets-CZQMTJ2T.js.map +0 -1
- package/dist/audience-writes-DJG7XTFA.js.map +0 -1
- package/dist/audiences-QHM26I5Y.js.map +0 -1
- package/dist/campaigns-55VLNVCE.js.map +0 -1
- package/dist/chunk-VBIKO56A.js.map +0 -1
- package/dist/chunk-XOW4EBDN.js.map +0 -1
- package/dist/chunk-YF57BX3S.js.map +0 -1
- package/dist/creatives-BCTG6PV4.js.map +0 -1
- package/dist/custom-conversions-56VXFOWV.js.map +0 -1
- package/dist/pixels-2BG3XMZP.js.map +0 -1
- package/dist/rules-Z7MMVOZ2.js.map +0 -1
- package/dist/studies-HUINRZHD.js.map +0 -1
- package/dist/web-K3JH5TXT.js.map +0 -1
- /package/dist/{account-5VOZ4R2X.js.map → account-LHY6YM6L.js.map} +0 -0
- /package/dist/{account-CTM4XBY3.js.map → account-RHY557Z3.js.map} +0 -0
- /package/dist/{account-level-HLSTNJHR.js.map → account-level-OX34JQ7C.js.map} +0 -0
- /package/dist/{account-users-DL3UD2XG.js.map → account-users-JKMGJLS5.js.map} +0 -0
- /package/dist/{accounts-KNMGEMMG.js.map → accounts-EA5AY2A2.js.map} +0 -0
- /package/dist/{accounts-SNH3LJ2H.js.map → accounts-LNFU27BU.js.map} +0 -0
- /package/dist/{accounts-7ACHUCAY.js.map → accounts-N2CYZQZZ.js.map} +0 -0
- /package/dist/{actions-PO35WQVS.js.map → actions-J776YSK6.js.map} +0 -0
- /package/dist/{activecampaign-4S63QE4C.js.map → activecampaign-GTESSOXT.js.map} +0 -0
- /package/dist/{add-ZMOFKHFR.js.map → add-6P554X3K.js.map} +0 -0
- /package/dist/{add-4PCJL2QX.js.map → add-CLWC4FVU.js.map} +0 -0
- /package/dist/{add-2F6KL6KB.js.map → add-KINU722K.js.map} +0 -0
- /package/dist/{ads-MYACXO5A.js.map → ads-6PCQ4OYH.js.map} +0 -0
- /package/dist/{advertisers-Y2ATV7L6.js.map → advertisers-CNK73JJF.js.map} +0 -0
- /package/dist/{alerts-C4UFNZMJ.js.map → alerts-BW2CGM3I.js.map} +0 -0
- /package/dist/{analytics-YRGTZHAY.js.map → analytics-KHTALHLZ.js.map} +0 -0
- /package/dist/{analytics-EM4NNEG5.js.map → analytics-MUNUPB7Q.js.map} +0 -0
- /package/dist/{asset-writes-TXYCARXJ.js.map → asset-writes-5ZKZDPQ4.js.map} +0 -0
- /package/dist/{assign-GDV4YOFF.js.map → assign-QBJVLNC6.js.map} +0 -0
- /package/dist/{audience-size-ONXW6YWQ.js.map → audience-size-QIDHHX6X.js.map} +0 -0
- /package/dist/{audit-3Z6ZZKCH.js.map → audit-UJGOGIAU.js.map} +0 -0
- /package/dist/{autocomplete-4ZI234QK.js.map → autocomplete-RG3TDFEI.js.map} +0 -0
- /package/dist/{avatars-4OT3XVOD.js.map → avatars-N3RMT2EC.js.map} +0 -0
- /package/dist/{bid-pricing-7NZ7QKXF.js.map → bid-pricing-3TXY2VBG.js.map} +0 -0
- /package/dist/{brief-WOGFWWB3.js.map → brief-F7ULA7O4.js.map} +0 -0
- /package/dist/{businesses-ALNQZFB4.js.map → businesses-RQ6P4DOS.js.map} +0 -0
- /package/dist/{campaign-groups-VBOFSUJS.js.map → campaign-groups-DW3FEF3T.js.map} +0 -0
- /package/dist/{campaign-writes-NMMJXTYD.js.map → campaign-writes-66YXATV2.js.map} +0 -0
- /package/dist/{campaigns-ZWPYUZFF.js.map → campaigns-OX66VCI5.js.map} +0 -0
- /package/dist/{campaigns-YFB3PCLE.js.map → campaigns-YD3A4SOC.js.map} +0 -0
- /package/dist/{canvas-NJV6RSX3.js.map → canvas-XCDAHTHR.js.map} +0 -0
- /package/dist/{capabilities-FJAYWDY6.js.map → capabilities-IDPGBIYO.js.map} +0 -0
- /package/dist/{catalog-XEALUTOG.js.map → catalog-SQQCJIP2.js.map} +0 -0
- /package/dist/{catalogs-B24HAEXZ.js.map → catalogs-QAZ7ZZ5R.js.map} +0 -0
- /package/dist/{chats-65GTXYEC.js.map → chats-AUQRML3Z.js.map} +0 -0
- /package/dist/{check-YQIY4BTG.js.map → check-2W3UP257.js.map} +0 -0
- /package/dist/{chunk-YUZGTNAO.js.map → chunk-25ZHO74B.js.map} +0 -0
- /package/dist/{chunk-J4ZRPGNJ.js.map → chunk-34OSJO72.js.map} +0 -0
- /package/dist/{chunk-FRYH2T32.js.map → chunk-3ZVNGEF4.js.map} +0 -0
- /package/dist/{chunk-PUDEC2K3.js.map → chunk-45L3LIY4.js.map} +0 -0
- /package/dist/{chunk-52YU7I5M.js.map → chunk-4VHCG242.js.map} +0 -0
- /package/dist/{chunk-2RYEYBMF.js.map → chunk-5SHKAOXE.js.map} +0 -0
- /package/dist/{chunk-5NLZJ75G.js.map → chunk-6LUVWBE5.js.map} +0 -0
- /package/dist/{chunk-TU3HH4O3.js.map → chunk-7AJN5YDQ.js.map} +0 -0
- /package/dist/{chunk-YY6D3PI6.js.map → chunk-7HIOYPDF.js.map} +0 -0
- /package/dist/{chunk-Q7V5XSFZ.js.map → chunk-7T2KWVYO.js.map} +0 -0
- /package/dist/{chunk-UBUFWX5O.js.map → chunk-AMPV5F2W.js.map} +0 -0
- /package/dist/{chunk-NKXH4YZT.js.map → chunk-B2VA4ARJ.js.map} +0 -0
- /package/dist/{chunk-CBQTKSSP.js.map → chunk-C7PBCJWD.js.map} +0 -0
- /package/dist/{chunk-4U4YQOO2.js.map → chunk-CSYSMGQ5.js.map} +0 -0
- /package/dist/{chunk-6HQATKKL.js.map → chunk-DH35JQR4.js.map} +0 -0
- /package/dist/{chunk-DNI4DYGT.js.map → chunk-E5LCUKVH.js.map} +0 -0
- /package/dist/{chunk-EJ6B5OS5.js.map → chunk-EGM42UKF.js.map} +0 -0
- /package/dist/{chunk-SBID6GZZ.js.map → chunk-EM3RZ72M.js.map} +0 -0
- /package/dist/{chunk-W3XIDU5C.js.map → chunk-F7MZMCIZ.js.map} +0 -0
- /package/dist/{chunk-6LFIF6BK.js.map → chunk-H6V7BEL6.js.map} +0 -0
- /package/dist/{chunk-Z6WDG4DW.js.map → chunk-HP5LL75J.js.map} +0 -0
- /package/dist/{chunk-6VAUBRY3.js.map → chunk-KIMJZDJ2.js.map} +0 -0
- /package/dist/{chunk-W5JX7LUK.js.map → chunk-LD2SAHUD.js.map} +0 -0
- /package/dist/{chunk-7MVVDZM2.js.map → chunk-LPZ2YSGS.js.map} +0 -0
- /package/dist/{chunk-5EQF26Z4.js.map → chunk-LZIRACQU.js.map} +0 -0
- /package/dist/{chunk-LVR2UYQ7.js.map → chunk-OF23KGEF.js.map} +0 -0
- /package/dist/{chunk-JPFYTKQA.js.map → chunk-OJGQTU6L.js.map} +0 -0
- /package/dist/{chunk-2WHALQOJ.js.map → chunk-OMJ7DVFJ.js.map} +0 -0
- /package/dist/{chunk-FZWLNE53.js.map → chunk-PFBU3ENV.js.map} +0 -0
- /package/dist/{chunk-4YQ46MM4.js.map → chunk-PK6E2I2B.js.map} +0 -0
- /package/dist/{chunk-GOC2ZZJF.js.map → chunk-PTZT2BFY.js.map} +0 -0
- /package/dist/{chunk-KPQJVORC.js.map → chunk-PYEEAI77.js.map} +0 -0
- /package/dist/{chunk-IIXEFX33.js.map → chunk-Q24O2XAN.js.map} +0 -0
- /package/dist/{chunk-TZPFQJTH.js.map → chunk-SCXUABAO.js.map} +0 -0
- /package/dist/{chunk-JPP3LYVH.js.map → chunk-SKF5CGAD.js.map} +0 -0
- /package/dist/{chunk-VUJPKIJN.js.map → chunk-UE5ZFTDL.js.map} +0 -0
- /package/dist/{chunk-D4MNDYPX.js.map → chunk-UQJ3OKEK.js.map} +0 -0
- /package/dist/{chunk-7YHMZVKM.js.map → chunk-UQR76QNY.js.map} +0 -0
- /package/dist/{chunk-O5UWZ4AI.js.map → chunk-VEKIDFC5.js.map} +0 -0
- /package/dist/{chunk-3YZBGH2W.js.map → chunk-XPYYZ7UV.js.map} +0 -0
- /package/dist/{chunk-KYOKEQ5E.js.map → chunk-Y3I5TGOR.js.map} +0 -0
- /package/dist/{chunk-RVWBLOXX.js.map → chunk-YXDE7ESY.js.map} +0 -0
- /package/dist/{chunk-MIIY3MVK.js.map → chunk-ZMK4JKWY.js.map} +0 -0
- /package/dist/{claim-IOM6PVO5.js.map → claim-IEORXE3L.js.map} +0 -0
- /package/dist/{companies-WY4K6WLI.js.map → companies-CWM7XHPU.js.map} +0 -0
- /package/dist/{company-PVCI3LC7.js.map → company-WJTDDC7Z.js.map} +0 -0
- /package/dist/{complete-2QF4BZ5T.js.map → complete-QIEXZN4I.js.map} +0 -0
- /package/dist/{connect-GSLMEPHD.js.map → connect-IEHPWYJU.js.map} +0 -0
- /package/dist/{conversation-5NCE56L3.js.map → conversation-EWDSZ3HU.js.map} +0 -0
- /package/dist/{conversions-DGKHWOMN.js.map → conversions-NYNJWZ7Y.js.map} +0 -0
- /package/dist/{copy-writes-S4X5XUSK.js.map → copy-writes-QYN6PBU2.js.map} +0 -0
- /package/dist/{create-2EFBCVF4.js.map → create-FC637MED.js.map} +0 -0
- /package/dist/{create-TRL622CZ.js.map → create-NUE76WIZ.js.map} +0 -0
- /package/dist/{create-KKJX3JLV.js.map → create-OICX2OGE.js.map} +0 -0
- /package/dist/{create-X2R7FNDZ.js.map → create-OZDE3YHB.js.map} +0 -0
- /package/dist/{creatives-EWTMQK7H.js.map → creatives-QUIE4YDA.js.map} +0 -0
- /package/dist/{creatives-D5WLUJWC.js.map → creatives-TSY3IRZP.js.map} +0 -0
- /package/dist/{credentials-H4W36WE7.js.map → credentials-PBPCUZKS.js.map} +0 -0
- /package/dist/{critique-4Q3XEGS5.js.map → critique-CUTABYRT.js.map} +0 -0
- /package/dist/{crm-APNCVLF2.js.map → crm-FIT55QTZ.js.map} +0 -0
- /package/dist/{crm-T3NV4EOU.js.map → crm-OBJOZBMY.js.map} +0 -0
- /package/dist/{customers-VZYCYMSL.js.map → customers-JCT5ST4D.js.map} +0 -0
- /package/dist/{delete-BWPILWUN.js.map → delete-5MUFZDPC.js.map} +0 -0
- /package/dist/{delete-VJEOLHNE.js.map → delete-AKJ73UEW.js.map} +0 -0
- /package/dist/{delete-JGR3HPY5.js.map → delete-BIUYWSCA.js.map} +0 -0
- /package/dist/{demographics-CBJ26IAA.js.map → demographics-FJEAZGHO.js.map} +0 -0
- /package/dist/{discard-3MMFPF26.js.map → discard-XCPNQXQG.js.map} +0 -0
- /package/dist/{domain-7MSMJMDP.js.map → domain-EXIGIEWD.js.map} +0 -0
- /package/dist/{download-N3R6G3QV.js.map → download-URRCJTS5.js.map} +0 -0
- /package/dist/{draft-XBO2DYIJ.js.map → draft-H6PPGFGH.js.map} +0 -0
- /package/dist/{draft-OMGA2NYG.js.map → draft-UU3F2VMJ.js.map} +0 -0
- /package/dist/{draft-F6FHBF6I.js.map → draft-VM4EX4V7.js.map} +0 -0
- /package/dist/{draft-MKFFXTJK.js.map → draft-XRHDIPEI.js.map} +0 -0
- /package/dist/{experiments-VYYS5Y7W.js.map → experiments-QHPFYUEZ.js.map} +0 -0
- /package/dist/{extract-F7D62JMA.js.map → extract-2XX3WVX5.js.map} +0 -0
- /package/dist/{facets-6GJJIRRR.js.map → facets-2RSHTLGX.js.map} +0 -0
- /package/dist/{feedback-3TYBQZY4.js.map → feedback-WGO4NLTX.js.map} +0 -0
- /package/dist/{fetch-JBXBMJBK.js.map → fetch-NMDFVLEK.js.map} +0 -0
- /package/dist/{fit-ZFPYO3MS.js.map → fit-UNW33SFO.js.map} +0 -0
- /package/dist/{flows-PP6BRBD7.js.map → flows-OXGIXQDY.js.map} +0 -0
- /package/dist/{forecast-H24SICMO.js.map → forecast-7YQXOZYJ.js.map} +0 -0
- /package/dist/{funnel-BFVSY5A6.js.map → funnel-AH2IGEWY.js.map} +0 -0
- /package/dist/{get-SPKPNRXF.js.map → get-KOMUOBJX.js.map} +0 -0
- /package/dist/{get-J4CETDIS.js.map → get-MCAPNYYL.js.map} +0 -0
- /package/dist/{google-4IKGTP3C.js.map → google-CO72NV2S.js.map} +0 -0
- /package/dist/{google-ads-SGKGDWV6.js.map → google-ads-3WTKW5L4.js.map} +0 -0
- /package/dist/{history-QOQY2F77.js.map → history-BQJP6675.js.map} +0 -0
- /package/dist/{history-K5ULNTEM.js.map → history-WBC3IZP4.js.map} +0 -0
- /package/dist/{hubspot-HNZLT2BH.js.map → hubspot-XEDTNDRU.js.map} +0 -0
- /package/dist/{ideas-35LERPN4.js.map → ideas-SCX336UC.js.map} +0 -0
- /package/dist/{images-R3EK4BDH.js.map → images-IXU5XA3B.js.map} +0 -0
- /package/dist/{ingest-LYVNO5M5.js.map → ingest-CWUFMM2F.js.map} +0 -0
- /package/dist/{ingest-5TSJM7A7.js.map → ingest-KYHSANS7.js.map} +0 -0
- /package/dist/{insights-3SQWIU4E.js.map → insights-QU5A4XBO.js.map} +0 -0
- /package/dist/{inspect-36R5WLLX.js.map → inspect-VZPDZAMR.js.map} +0 -0
- /package/dist/{instant-experiences-HSRGMQ5T.js.map → instant-experiences-EJWYFWDT.js.map} +0 -0
- /package/dist/{keyword-metrics-JRB6DREM.js.map → keyword-metrics-TVLVS37F.js.map} +0 -0
- /package/dist/{keywords-for-site-FQOELX5H.js.map → keywords-for-site-QQPOZ7YB.js.map} +0 -0
- /package/dist/{leads-ILZAOKIF.js.map → leads-6KLZ3OQK.js.map} +0 -0
- /package/dist/{leads-LWWPMZRY.js.map → leads-FEEWX7OO.js.map} +0 -0
- /package/dist/{learn-AWQ6JTP2.js.map → learn-USN47KME.js.map} +0 -0
- /package/dist/{line-item-writes-APTZP3DI.js.map → line-item-writes-WE7OPQKW.js.map} +0 -0
- /package/dist/{line-items-5YSLNBGJ.js.map → line-items-5FGOMB4G.js.map} +0 -0
- /package/dist/{link-2MGGDKLP.js.map → link-WEYSRLKQ.js.map} +0 -0
- /package/dist/{linkedin-EBOTX37R.js.map → linkedin-KMDBZRRC.js.map} +0 -0
- /package/dist/{linkedin-person-FNKW44RV.js.map → linkedin-person-EVT5PNT7.js.map} +0 -0
- /package/dist/{list-75NNAGBR.js.map → list-BCNKRG35.js.map} +0 -0
- /package/dist/{list-CJU2Y6OP.js.map → list-ME5VQY5U.js.map} +0 -0
- /package/dist/{list-L3NBK64M.js.map → list-MVDGFAIL.js.map} +0 -0
- /package/dist/{log-JJDSDLOK.js.map → log-CCYOQSTI.js.map} +0 -0
- /package/dist/{make-U323I4SF.js.map → make-GFKMKMCC.js.map} +0 -0
- /package/dist/{map-KFN2QLYV.js.map → map-NOKM43SB.js.map} +0 -0
- /package/dist/{mcp-KGAXFVUM.js.map → mcp-GA2HAKE5.js.map} +0 -0
- /package/dist/{media-UODVM47L.js.map → media-PUOLJUN3.js.map} +0 -0
- /package/dist/{media-sources-BSECLIMM.js.map → media-sources-URJC5ZXU.js.map} +0 -0
- /package/dist/{members-6FHV7EM2.js.map → members-23GZ3LYM.js.map} +0 -0
- /package/dist/{meta-4IOVQSFF.js.map → meta-SPPSYRMC.js.map} +0 -0
- /package/dist/{normalize-YWIDJR4R.js.map → normalize-AC6ISCSR.js.map} +0 -0
- /package/dist/{options-R4Q46LU5.js.map → options-ML7OSX7I.js.map} +0 -0
- /package/dist/{organization-76LF7MHK.js.map → organization-CCJEADUV.js.map} +0 -0
- /package/dist/{page-photos-BCEDWPGX.js.map → page-photos-ZBMJLL5V.js.map} +0 -0
- /package/dist/{pages-TZBFJXNR.js.map → pages-YZC44QR2.js.map} +0 -0
- /package/dist/{people-BK6GRJXB.js.map → people-Y6DIISJJ.js.map} +0 -0
- /package/dist/{people-HR7CAKZS.js.map → people-YW5IYH6F.js.map} +0 -0
- /package/dist/{performance-PTBBUEZU.js.map → performance-7U7TPKQ6.js.map} +0 -0
- /package/dist/{performance-Y2S5FDGI.js.map → performance-CZOXKJZJ.js.map} +0 -0
- /package/dist/{pipedrive-NONV3NBQ.js.map → pipedrive-TQ4INC6B.js.map} +0 -0
- /package/dist/{preview-WHUVS5JJ.js.map → preview-4GUQGDBD.js.map} +0 -0
- /package/dist/{preview-HD3QAR53.js.map → preview-ZY2NBGCK.js.map} +0 -0
- /package/dist/{promoted-tweet-writes-3LNFAGEM.js.map → promoted-tweet-writes-43G7IOP2.js.map} +0 -0
- /package/dist/{promoted-tweets-IHUQA35K.js.map → promoted-tweets-ESQOGB5N.js.map} +0 -0
- /package/dist/{publish-IUE7RHRD.js.map → publish-UKADDPWA.js.map} +0 -0
- /package/dist/{reddit-BOTUVLHL.js.map → reddit-MWNRB3UJ.js.map} +0 -0
- /package/dist/{refresh-RPVVOQX4.js.map → refresh-4Q3YNBSS.js.map} +0 -0
- /package/dist/{release-4YZWORV2.js.map → release-OVH45PQK.js.map} +0 -0
- /package/dist/{remove-FO7I4RQ3.js.map → remove-6OV63L4F.js.map} +0 -0
- /package/dist/{reopen-FMPQVL2C.js.map → reopen-VFIRDEFS.js.map} +0 -0
- /package/dist/{rerun-RYL5UJRE.js.map → rerun-EFELGU7H.js.map} +0 -0
- /package/dist/{research-3LSWITEK.js.map → research-QFABGPW7.js.map} +0 -0
- /package/dist/{research-2H3ST6C2.js.map → research-Y5CUG6RA.js.map} +0 -0
- /package/dist/{reset-RI6NO6NQ.js.map → reset-KBUW4MSS.js.map} +0 -0
- /package/dist/{reset-PNCDMWGO.js.map → reset-PBO6UZCW.js.map} +0 -0
- /package/dist/{resolve-SGL3A5N5.js.map → resolve-NPWBHA2X.js.map} +0 -0
- /package/dist/{retry-JRH3WJSF.js.map → retry-K47P245Z.js.map} +0 -0
- /package/dist/{retry-4FMP73MN.js.map → retry-ST2ABI4Q.js.map} +0 -0
- /package/dist/{revenue-V4ODLBZ6.js.map → revenue-XMO76GKE.js.map} +0 -0
- /package/dist/{rule-writes-Q5NLSBF5.js.map → rule-writes-6XP7G35U.js.map} +0 -0
- /package/dist/{rules-EPNUXMHG.js.map → rules-G5SYPIVC.js.map} +0 -0
- /package/dist/{run-2SPQZ2ZZ.js.map → run-4KGXARYK.js.map} +0 -0
- /package/dist/{run-HLQUPQZ2.js.map → run-YU5FL7NI.js.map} +0 -0
- /package/dist/{scaffold-ad-3YLGTFRT.js.map → scaffold-ad-GVFTZEW7.js.map} +0 -0
- /package/dist/{scaffold-static-ad-3RCD642H.js.map → scaffold-static-ad-TNX7XV77.js.map} +0 -0
- /package/dist/{scaffold-video-F5HTBM4R.js.map → scaffold-video-EMKTEEEJ.js.map} +0 -0
- /package/dist/{schedule-O36GKVZV.js.map → schedule-B44TZ2ZG.js.map} +0 -0
- /package/dist/{scheduled-agents-4UNG26CX.js.map → scheduled-agents-I3FXF2P5.js.map} +0 -0
- /package/dist/{schema-SRFWL4ZT.js.map → schema-JBDPR3PA.js.map} +0 -0
- /package/dist/{schema-EOQASVWI.js.map → schema-QHTODYWX.js.map} +0 -0
- /package/dist/{search-DLMLA423.js.map → search-IXCXPVQB.js.map} +0 -0
- /package/dist/{select-KBYLNNL4.js.map → select-EWEIL6TC.js.map} +0 -0
- /package/dist/{set-6L7YV57E.js.map → set-FIFBH2JO.js.map} +0 -0
- /package/dist/{set-prompt-WBYLKIO3.js.map → set-prompt-CEEJFM2T.js.map} +0 -0
- /package/dist/{setup-links-XT4TEZWI.js.map → setup-links-WS4IXPAU.js.map} +0 -0
- /package/dist/{shared-AXONQS3M.js.map → shared-64RE42DL.js.map} +0 -0
- /package/dist/{shopify-ICWRWUZE.js.map → shopify-C7PDSZC5.js.map} +0 -0
- /package/dist/{site-LYDFZM5U.js.map → site-2OSMZ2Q5.js.map} +0 -0
- /package/dist/{sources-FPWA4AJN.js.map → sources-EYC2VWOB.js.map} +0 -0
- /package/dist/{sources-CP4UQ5KA.js.map → sources-QO4JEY37.js.map} +0 -0
- /package/dist/{stale-GWG4V65Q.js.map → stale-ZUTU73NO.js.map} +0 -0
- /package/dist/{status-W6S7AY43.js.map → status-GHVRF3YU.js.map} +0 -0
- /package/dist/{stock-6VZFFAHW.js.map → stock-CVYIUWEC.js.map} +0 -0
- /package/dist/{study-writes-SI5QXY7F.js.map → study-writes-HXUQRPIK.js.map} +0 -0
- /package/dist/{sync-I6ZVQOSZ.js.map → sync-SBTP4YVN.js.map} +0 -0
- /package/dist/{sync-definition-NADPEPFQ.js.map → sync-definition-T3JWIPFH.js.map} +0 -0
- /package/dist/{tags-IQ6BCRLE.js.map → tags-6FOGX3BD.js.map} +0 -0
- /package/dist/{tags-AN5B56GA.js.map → tags-AZJO5MJ7.js.map} +0 -0
- /package/dist/{tags-ETUV62EB.js.map → tags-DGKZFNOA.js.map} +0 -0
- /package/dist/{tags-UKAR6FCS.js.map → tags-W6RUDM3P.js.map} +0 -0
- /package/dist/{tags-47QAF2ZJ.js.map → tags-XNSEOT6N.js.map} +0 -0
- /package/dist/{targeting-3XK4OLPG.js.map → targeting-7T7XHBIX.js.map} +0 -0
- /package/dist/{targeting-criteria-4E6SURB5.js.map → targeting-criteria-VRNDPRG7.js.map} +0 -0
- /package/dist/{targets-GJUR5WTB.js.map → targets-MWYBWEFB.js.map} +0 -0
- /package/dist/{testimonials-UCVT5VQY.js.map → testimonials-ZZYY2O56.js.map} +0 -0
- /package/dist/{top-companies-WID72GN5.js.map → top-companies-AKJIL3OJ.js.map} +0 -0
- /package/dist/{transcript-OMYAOZSP.js.map → transcript-H4R4D3SB.js.map} +0 -0
- /package/dist/{translate-TIAJBFQ3.js.map → translate-JZUARDL6.js.map} +0 -0
- /package/dist/{triggers-IEMDGR6W.js.map → triggers-RX5RNDLK.js.map} +0 -0
- /package/dist/{unlink-WCLQPP7S.js.map → unlink-L72ROGSX.js.map} +0 -0
- /package/dist/{unstage-KRPX3AGF.js.map → unstage-RFZNFCUC.js.map} +0 -0
- /package/dist/{update-XF462N7M.js.map → update-DQQE2KKZ.js.map} +0 -0
- /package/dist/{update-CPSZ4EH3.js.map → update-POMDJGRN.js.map} +0 -0
- /package/dist/{update-CQ4VF2S5.js.map → update-S2OKSUFH.js.map} +0 -0
- /package/dist/{update-NP2MOMJS.js.map → update-ZCLPU7U2.js.map} +0 -0
- /package/dist/{upload-WRRNFTRK.js.map → upload-EGKKXKOW.js.map} +0 -0
- /package/dist/{url-params-DKGJVTGL.js.map → url-params-QCVRTKVY.js.map} +0 -0
- /package/dist/{validate-6AHY2UQR.js.map → validate-I66HVWO4.js.map} +0 -0
- /package/dist/{videos-FG64T3XK.js.map → videos-OKKKMRSV.js.map} +0 -0
- /package/dist/{videos-C5OCSAIF.js.map → videos-TJG5CA7N.js.map} +0 -0
- /package/dist/{viewer-check-3YGDWCTR.js.map → viewer-check-YWFR4KM4.js.map} +0 -0
- /package/dist/{visuals-3C2QUE6G.js.map → visuals-4R2NTKXP.js.map} +0 -0
- /package/dist/{winning-ads-QDVS56XX.js.map → winning-ads-L4VL5SRB.js.map} +0 -0
- /package/dist/{write-commands-T46SVSQ7.js.map → write-commands-4KI6T2NF.js.map} +0 -0
- /package/dist/{write-commands-X72A5F7K.js.map → write-commands-BA5OPMJ4.js.map} +0 -0
- /package/dist/{x-JU6LF2MM.js.map → x-R6VRO4LT.js.map} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/research/hints.ts"],"sourcesContent":["/**\n * The `research` family shipped with no `hints[]` on any command. Everything\n * here is one nudge for one dead end that an audited run actually hit — not a\n * running commentary on healthy results.\n */\n\nimport {\n RESEARCH_GOOGLE_ADS_MAX_COPY,\n type ResearchCompanyHiring,\n type ResearchCompanyIndustry,\n type ResearchRedditSource,\n} from \"@baker/api\";\nimport type { QueryContext } from \"../../geo-context.ts\";\nimport type { ResearchFix } from \"./output.ts\";\n\ntype Depth = \"medium\" | \"high\" | \"xhigh\";\n\n/**\n * `advertisers` is named after advertisers and returns none of their advertising.\n * A run read the name as \"SERP ad creative\", got domain economics, and wrote \"no\n * live paid ad copy captured\" into the client's vault without ever trying the\n * command that does return copy. So this fires on every call, not just empty ones.\n */\nexport const AD_COPY_ROUTE =\n \"This returns competing domains and their SERP economics — no ad copy, no headlines, no creative. \" +\n \"For a competitor's Google ads and their copy: `baker research google-ads <competitor.com> --copy` \" +\n \"(Google's Ads Transparency Center: every ad, how long it has run, and the text ads' headline and description). \" +\n 'For Meta and LinkedIn: `baker winning-ads advertisers \"<brand>\"` → ' +\n '`baker winning-ads search \"<brief>\" --advertiser-id <id>` → `baker winning-ads content <adId>` ' +\n \"(`primary_text` / `headline` / `cta`, plus the spoken transcript and on-screen text for video). \" +\n \"Do not keep querying this command for copy.\";\n\n/**\n * Empty SERP data has two causes and only one is worth a second call: the wrong\n * market. Once the market was explicit, a re-query is waste — say so, because\n * \"no rows\" otherwise reads as \"reword the keyword\".\n */\nexport function noSerpRowsHints(rowCount: number, queryContext: QueryContext): string[] {\n if (rowCount > 0) {\n return [];\n }\n const defaulted = queryContext.location_is_default || queryContext.language_is_default;\n if (defaulted) {\n return [\n `No rows for ${queryContext.location} / ${queryContext.language} — the market you did not set. ` +\n \"Set --location and --language for the client's actual market and re-run once \" +\n \"(`baker research countries` / `baker research languages` for the accepted codes) \" +\n \"before you touch the keyword.\",\n ];\n }\n return [\n `No rows for ${queryContext.location} / ${queryContext.language}, which you set explicitly. ` +\n \"This term has no third-party SERP coverage in that market — move on rather than re-querying it. \" +\n \"For demand signal try `baker research autocomplete`; for a competitor's actual terms, \" +\n \"`baker research keywords-for-site <domain>`.\",\n ];\n}\n\nexport function advertisersHints(rowCount: number, queryContext: QueryContext): string[] {\n return [...noSerpRowsHints(rowCount, queryContext), AD_COPY_ROUTE];\n}\n\n/**\n * \"This competitor buys no paid search\" is a real competitive answer, but it\n * arrives as an empty array that looks like a broken call — so say which it is\n * before the agent re-runs the same query with a different sort.\n */\nexport function keywordsForSiteHints(\n rowCount: number,\n queryContext: QueryContext,\n typeFilter: string | undefined,\n): string[] {\n if (rowCount > 0) {\n return [];\n }\n if (typeFilter === \"paid\" || typeFilter === \"organic\") {\n return [\n `No rows with --type ${typeFilter} in ${queryContext.location} / ${queryContext.language}. ` +\n `A domain with zero ${typeFilter} keywords in a market is itself the finding — record it and move on. ` +\n \"Confirm once with --type all (nothing at all there means the domain has no SERP coverage, \" +\n \"not that it has no ads) instead of re-running with a different --sort or --limit.\",\n ];\n }\n return noSerpRowsHints(rowCount, queryContext);\n}\n\nconst THIN_ANSWER_CHARS = 600;\nconst THIN_SOURCE_COUNT = 2;\n\n// Only `medium` and `high` have somewhere to escalate to; `xhigh` is the ceiling,\n// so a thin answer there is a fact about the web, not a flag the agent forgot.\nconst ESCALATION: Partial<Record<Depth, string>> = {\n medium:\n \"`medium` is a quick lookup, not a search. Re-ask the SAME question once with `--depth high` before \" +\n \"concluding the web has nothing on it.\",\n high:\n \"`high` already thought hard about this. `--depth xhigh` is the only step left and it can run 15 minutes — \" +\n \"take it only if this answer blocks a deliverable; otherwise record the gap and move on.\",\n};\n\n/**\n * Google grounding used to come back as opaque redirect links labelled by domain,\n * and the agent guessed the real paths, 404'd, and invented links. The backend\n * now follows them; this says what to do with the ones it could not, and with\n * an answer that rests on nothing.\n */\nexport function webSourceHints(sources: Array<{ resolved?: boolean }>): string[] {\n if (sources.length === 0) {\n return [\n \"This answer came back with no sources. Treat every claim in it as Synthesis: — no source to cite. \" +\n \"Do not attach a URL to it; to cite a fact, find the page that states it and read it with `baker research fetch`.\",\n ];\n }\n // An older backend sends no `resolved`; only an explicit false is a link we know is opaque.\n const unresolved = sources.filter((s) => s.resolved === false).length;\n if (unresolved > 0) {\n return [\n `${unresolved} of ${sources.length} sources are Google links that could not be followed (resolved: false). ` +\n \"Do not cite them or guess a path from the site name — cite only a resolved URL, or open the claim's page yourself.\",\n ];\n }\n return [];\n}\n\n/**\n * The one thing worth saying about a page that came back fine is that you are\n * not looking at all of it — which the content itself cannot tell you.\n */\nexport function fetchHints({\n truncated,\n contentChars,\n shownChars,\n maxChars,\n}: {\n truncated: boolean;\n contentChars: number;\n shownChars: number;\n /** The `--max-chars` bound, when one was passed: it wins over `--full`. */\n maxChars?: number;\n}): string[] {\n const hints: string[] = [];\n\n if (shownChars < contentChars) {\n const more =\n maxChars === undefined\n ? \"Re-run the same command with `--full` for the whole page\"\n : \"Re-run with a larger `--max-chars` for more, or without `--max-chars` and with `--full` for the whole page\";\n hints.push(\n `Showing the first ${shownChars.toLocaleString(\"en-US\")} of ${contentChars.toLocaleString(\"en-US\")} characters. ` +\n `${more}, or \\`--find '<words>'\\` for only the lines you need — the read is cached for 24h, so it costs no extra time and no extra credit.`,\n );\n }\n\n if (truncated) hints.push(TRUNCATED_READ);\n\n return hints;\n}\n\nconst TRUNCATED_READ =\n \"This page is longer than one read returns, so the end of it is missing. \" +\n \"Don't present this as the complete page; if the part you need is further down, fetch the deeper URL directly.\";\n\n/** Where to look next when the page itself did not have it: the chrome left out of a main-content read. */\nconst wholePageNudge = (wholePage: boolean) =>\n wholePage ? \"\" : \" The read is the main content only: add `--whole-page` to include the header, nav and footer.\";\n\n/**\n * `--find` answers from the whole read, so \"no match\" is a finding about the\n * page, not a reason to dump it and grep by hand.\n */\nexport function findHints({\n find,\n matches,\n shownMatches,\n maxChars,\n wholePage,\n truncated,\n}: {\n find: string;\n matches: number;\n /** Matching lines the answer shows: fewer when the passage limit or the character budget cut it short. */\n shownMatches: number;\n /** The `--max-chars` bound, when one was passed. */\n maxChars?: number;\n wholePage: boolean;\n truncated: boolean;\n}): string[] {\n const hints: string[] = [];\n if (matches === 0) {\n hints.push(\n `No line of the page matches \\`${find}\\` (case-insensitive). Try another word the page would use — its language, a currency sign, a digit pattern like '[0-9]+,[0-9]{2}'.${wholePageNudge(wholePage)}`,\n );\n }\n if (shownMatches < matches) {\n const more = maxChars === undefined ? \"\" : \", or raise `--max-chars`\";\n hints.push(\n `${matches - shownMatches} more matching lines are not shown. Narrow \\`--find\\` to the words around what you need${more}.`,\n );\n }\n if (truncated) hints.push(TRUNCATED_READ);\n return hints;\n}\n\ninterface RefCount {\n kept: number;\n total: number;\n}\n\nexport function refsHints({\n links,\n images,\n find,\n wholePage,\n truncated,\n}: {\n links?: RefCount;\n images?: RefCount;\n find?: string;\n wholePage: boolean;\n truncated: boolean;\n}): string[] {\n const hints: string[] = [];\n const empty = (name: string, count: RefCount) => {\n if (count.kept > 0) return;\n hints.push(\n count.total > 0 && find !== undefined\n ? `None of the page's ${count.total} ${name} matches \\`${find}\\`.${wholePageNudge(wholePage)}`\n : `The page references no ${name}.${wholePageNudge(wholePage)}`,\n );\n };\n if (links) empty(\"links\", links);\n if (images) empty(\"images\", images);\n if (truncated) hints.push(TRUNCATED_READ);\n return hints;\n}\n\nexport function webDepthHints({\n answer,\n sourceCount,\n depth,\n}: {\n answer: string;\n sourceCount: number;\n depth: Depth;\n}): string[] {\n const thin = answer.length < THIN_ANSWER_CHARS || sourceCount <= THIN_SOURCE_COUNT;\n const escalation = ESCALATION[depth];\n if (!thin || !escalation) {\n return [];\n }\n return [`Thin answer (${answer.length} chars, ${sourceCount} source(s)). ${escalation}`];\n}\n\n/**\n * The volume DataForSEO returns is Google's own Keyword Planner figure resold,\n * so putting the two side by side validates nothing — a run did exactly that,\n * found all seven rows agreeing to the digit, and reported the agreement as\n * corroboration. This fires on every call rather than on a suspicious one,\n * because by the time the numbers are in a table the provenance is already gone.\n */\nexport function keywordMetricsHints({\n rows,\n asked,\n clickstream,\n queryContext,\n}: {\n rows: Array<{ keyword: string; location?: string; search_volume: number | null }>;\n asked: string[];\n clickstream: boolean;\n queryContext: QueryContext;\n}): string[] {\n if (rows.length === 0) {\n return noSerpRowsHints(0, queryContext);\n }\n\n const provenance =\n \"DataForSEO resells Google's Keyword Planner volume — planner_search_volume here is the SAME number \" +\n \"`baker ads google keywords metrics` returns, not an independent reading of it. Quoting the two as agreeing \" +\n \"sources is not corroboration.\" +\n (clickstream\n ? \" clickstream_search_volume IS independent (DataForSEO's own panels); when the two disagree, say which one you are quoting.\"\n : \" For a genuinely independent estimate of demand, re-run with --clickstream (costs 2x), or use first-party data: \" +\n \"`baker gsc query` for what already reaches the site, or the account's own search terms.\");\n\n const hints = [provenance];\n\n const compared = rows.some((row) => row.location !== undefined);\n const empty = rows\n .filter((row) => row.search_volume === null)\n .map((row) => (row.location === undefined ? row.keyword : `${row.keyword} (${row.location})`));\n if (empty.length > 0) {\n hints.push(\n `${empty.length} of ${compared ? `${rows.length} keyword/market rows` : `${asked.length} keywords`} came back with no data in ${queryContext.location} / ${queryContext.language}: ` +\n `${empty.join(\", \")}. That is missing coverage, NOT zero demand — do not report them as unsearched, and do not ` +\n \"re-query them reworded. `baker research autocomplete` on the head term is the way to find the phrasing that market uses.\",\n );\n }\n\n return hints;\n}\n\n/**\n * The archive keeps a post's words the moment it is written and its points\n * only once it has settled, so a number on something young is not the number\n * Reddit shows. Said once, when it applies, so a count is never quoted as live.\n */\nconst ARCHIVE_NOTE =\n \"Read from the Reddit archive: the words are as posted, but points and comment counts on anything under ~36h old are as first captured — don't quote those numbers as current.\";\n\n/**\n * An empty Reddit search is almost always a phrasing miss, not a silent\n * audience: Reddit matches words, and people write in their own. A run that\n * came back empty on a posts search also never looked at the replies, which is\n * where most of the verbatim voice is.\n */\nexport function redditSearchHints({\n resultCount,\n kind,\n source,\n}: {\n resultCount: number;\n kind: \"posts\" | \"comments\";\n source: ResearchRedditSource;\n}): string[] {\n const hints: string[] = [];\n if (resultCount === 0) {\n hints.push(\n \"Nothing matched. Reddit search matches words, not meaning: try the audience's own phrasing (one distinctive word, \" +\n \"or a seed from `baker research autocomplete`), a longer --since window, or other subreddits — \" +\n '`baker research reddit subreddits \"<topic>\"` finds where the audience actually talks' +\n (kind === \"posts\" ? \", and try --kind comments — most of the voice is in the replies.\" : \".\"),\n );\n } else if (kind === \"posts\") {\n hints.push(\n \"Titles rarely carry the voice. Read the promising threads with `baker research reddit thread <permalink>` \" +\n \"for the replies, or search the replies directly with --kind comments.\",\n );\n }\n if (source === \"archive\" && resultCount > 0) hints.push(ARCHIVE_NOTE);\n return hints;\n}\n\n/** A thread whose replies no source would serve is still the post — but it must not read as a thread nobody answered. */\nexport function redditThreadHints({\n commentsShown,\n commentsAsked,\n commentCount,\n source,\n}: {\n commentsShown: number;\n commentsAsked: number;\n commentCount: number | null;\n source: ResearchRedditSource;\n}): string[] {\n const hints: string[] = [];\n if (commentsAsked > 0 && commentsShown === 0 && (commentCount ?? 0) > 0) {\n hints.push(\n `This thread has ${commentCount} comments but none could be read just now. Quote the post only, and don't describe the replies.`,\n );\n }\n if (source === \"archive\") hints.push(ARCHIVE_NOTE);\n return hints;\n}\n\nconst REDDIT_HOST = /(^|\\.)reddit\\.com$|^redd\\.it$/i;\n\n/**\n * A subreddit's member count is its size, not its pulse. The run that prompted\n * this command mined r/CouriersUK — a real subreddit, with one post in its whole\n * history — and found nothing. One dated search tells a living subreddit from a\n * dead one before it is relied on.\n */\nexport function redditSubredditsHints({ resultCount }: { resultCount: number }): string[] {\n if (resultCount === 0) {\n return [\n 'No subreddits matched. Try the audience\\'s role or the platform they work on (\"amazon flex\", \"deliveroo\", \"nurses\"), one word at a time, or a web search for `site:reddit.com <topic>`.',\n ];\n }\n return [\n 'Members say how big a subreddit is, not how active it is. Before mining one, run `baker research reddit search \"<word>\" --subreddit <name> --since <a recent date>`: nothing back means it is quiet, so pick another. `restricted` can still be read; `private` cannot.',\n ];\n}\n\n/** A Reddit link that does not lead to the words attributed to it. Shared by `reddit thread` and `fetch`. */\nexport const REDDIT_LINK_REJECTED: ResearchFix = {\n action: \"reject\",\n explanation:\n \"Do not quote anything attributed to this link — it does not lead to those words. Find the real thread with `baker research reddit search`, and if you already wrote a quote from it, remove it.\",\n};\n\n/**\n * `research fetch` hands a Reddit URL to the Reddit reader, but its generic\n * remediation was written for ordinary pages: FORBIDDEN reads \"this will not\n * open, carry on without it\" and NOT_FOUND \"carry on\". For Reddit both are the\n * wrong advice. A page the reader will not turn into a thread is one `reddit`\n * command away, and a link that leads nowhere real must not be quoted at all.\n */\nexport function redditPageFix(url: string, code: string): ResearchFix | null {\n let host: string;\n try {\n host = new URL(url).hostname;\n } catch {\n return null;\n }\n if (!REDDIT_HOST.test(host)) return null;\n if (code === \"NOT_FOUND\") return REDDIT_LINK_REJECTED;\n if (code !== \"FORBIDDEN\") return null;\n return {\n action: \"retry_with_changes\",\n explanation:\n 'Read Reddit with its own commands: `baker research reddit search \"<words>\" --subreddit <name>` to find what people said, `baker research reddit thread <url>` for one thread.',\n };\n}\n\n/**\n * `google-ads` replaces a browser trip through Google's Ads Transparency\n * Center, so its hints keep the agent out of one: no ads is an answer, and an\n * ad whose copy Google does not give is shown by its link, never opened.\n */\nexport function googleAdsHints({\n target,\n adCount,\n located,\n textWithoutCopy,\n copyAsked,\n copyUnread,\n visual,\n}: {\n target: string;\n adCount: number;\n located: boolean;\n textWithoutCopy: number;\n copyAsked: boolean;\n copyUnread: number;\n visual: number;\n}): string[] {\n if (adCount === 0) {\n return [\n `No Google ads point to ${target}${located ? \" in that region\" : \"\"} — that is the answer, not a failed call: ` +\n \"this competitor is not advertising on Google there, or its ads point to another domain. \" +\n (located ? \"Re-run once without --location to see every region; then move on. \" : \"Move on. \") +\n `Its paid search terms, if any: \\`baker research keywords-for-site ${target} --type paid\\`.`,\n ];\n }\n const hints: string[] = [];\n if (!copyAsked && textWithoutCopy > 0) {\n hints.push(\n `${textWithoutCopy} text ads came back without their words. Re-run with --copy to read the headline and description of up to ${RESEARCH_GOOGLE_ADS_MAX_COPY} (cached, so only the reading is new).`,\n );\n }\n const pastCap = copyAsked ? textWithoutCopy - copyUnread : 0;\n if (pastCap > 0) {\n hints.push(\n `${pastCap} text ads past the first ${RESEARCH_GOOGLE_ADS_MAX_COPY} were not read — one request reads at most ${RESEARCH_GOOGLE_ADS_MAX_COPY}. ` +\n \"Narrow with --since, --location or --platform google_search and re-run for their words.\",\n );\n }\n if (visual > 0 || copyUnread > 0) {\n const without = [\n visual > 0 ? `${visual} image or video ads (Google gives no text for those)` : \"\",\n copyUnread > 0 ? `${copyUnread} text ads whose image could not be read` : \"\",\n ].filter(Boolean);\n hints.push(\n `No copy for ${without.join(\" and \")}: show those by their \\`transparency_url\\`. ` +\n \"Do not open the Transparency Center in agent-browser to read them — it is the browser load this command exists to avoid.\",\n );\n }\n return hints;\n}\n\n/**\n * A person's profile is read to write one account's ads and pages, and that is\n * all it is for. Said on every read, because the next natural step — saving\n * them to Knowledge, or reading them again next week — is the one we don't take.\n */\nexport const LINKEDIN_PERSON_USE =\n \"For ad and page messaging only; nothing is stored — quote their stated priorities into the creative brief \" +\n \"for this account, and don't save the person to Knowledge or read them again to keep track of them.\";\n\n/**\n * The people a search found are public profiles a decision model checked, not\n * contacts: said on every read, with the one next step that deepens a lead.\n */\nexport function peopleHints({\n found,\n dropped,\n verified,\n}: {\n found: number;\n dropped: number;\n verified: boolean;\n}): string[] {\n if (found === 0) {\n return [\n `Nobody in public LinkedIn results holds this role here${dropped > 0 ? ` (${dropped} profiles were elsewhere now or in another role)` : \"\"}. ` +\n \"Try the name people write on LinkedIn with --name, a broader --seniority, or the client's CRM: `baker hubspot companies contacts <domain>`.\",\n ];\n }\n const hints = [\n verified\n ? \"These are public search results a decision model checked — likely holders of the role, to confirm before anyone reaches out. Brief sales with them; never contact anyone or save them to Knowledge.\"\n : \"The check could not run, so these profiles are unchecked: Google matched the words, not the person. Read each headline before naming anyone.\",\n \"To write to one of them in their own words, read their profile once: `baker research linkedin-person <profile_url>`.\",\n ];\n return hints;\n}\n\nexport function linkedinPersonHints({ isPrivate, postCount }: { isPrivate: boolean; postCount: number }): string[] {\n if (isPrivate) {\n return [\n \"LinkedIn doesn't show this profile publicly, and reading it again won't change that. \" +\n \"Find their own words elsewhere — a keynote, podcast or earnings call through \" +\n \"`baker research transcript <url>`, or an interview through `baker research fetch <url>` — \" +\n \"or write the brief from the account's company-level priorities.\",\n ];\n }\n if (postCount === 0) {\n return [\n LINKEDIN_PERSON_USE,\n \"They have no recent posts, so their `about` is the only first-person line here. \" +\n \"Their priorities are more often said aloud: a keynote, podcast or earnings call through `baker research transcript <url>`.\",\n ];\n }\n return [LINKEDIN_PERSON_USE];\n}\n\n/**\n * A keynote runs to tens of thousands of words, which is why the default is an\n * excerpt; the transcript is cached for a week, so asking again for the rest\n * costs nothing.\n */\nexport function transcriptHints({ excerpted, truncated }: { excerpted: boolean; truncated: boolean }): string[] {\n const hints: string[] = [];\n if (excerpted) {\n hints.push(\n \"This is the opening excerpt. Re-run with `--out <file>` to write the whole text to a file and read the parts you need, \" +\n \"or `--full` to have it all here — the transcript is cached for 7 days, so either costs nothing more.\",\n );\n }\n if (truncated) {\n hints.push(\n \"The recording is longer than one transcript carries, so the end of the recording is missing. \" +\n \"Don't quote this as the whole talk.\",\n );\n }\n return hints;\n}\n\n/** The facts whose absence marks a profile as possibly another company's. */\nexport interface CompanyProfileFacts {\n linkedinUrl: string | null;\n hqCountry: string | null;\n employees: string | null;\n}\n\n/**\n * A profile missing two of its anchor facts, or sized 1-10, is often a namesake\n * on the domain asked for while the company itself runs on another one.\n */\nfunction thinProfileHint(domain: string, profile: CompanyProfileFacts): string | null {\n const missing = [\n profile.linkedinUrl ? null : \"no LinkedIn page\",\n profile.hqCountry ? null : \"no HQ country\",\n profile.employees ? null : \"no employee band\",\n ].filter((gap) => gap !== null);\n const tiny = profile.employees === \"1-10\";\n if (missing.length < 2 && !tiny) return null;\n const why = [...missing, ...(tiny ? [\"1-10 employees\"] : [])].join(\", \");\n return (\n `This profile is thin (${why}). Check ${domain} is the company's main website — companies often run on another ` +\n \"domain (e.g. factorial.es vs factorialhr.com) — before using these facts for tiering.\"\n );\n}\n\n/**\n * Hiring is a signal on top of the profile, so a lookup without it still\n * answers — and says which half is missing, so the agent neither loops on it\n * nor reads \"no openings\" into a gap. A hiring read left out on purpose\n * (`--no-hiring`) says nothing.\n */\nexport function companyHints({\n domain,\n profile,\n hiring,\n}: {\n domain: string;\n profile: CompanyProfileFacts | null;\n hiring: ResearchCompanyHiring;\n}): string[] {\n const hints: string[] = [];\n if (!profile) {\n hints.push(\n \"There's no company profile for this domain, only its hiring. Check it is the company's main website; \" +\n \"otherwise take size, industry and location from its LinkedIn page or its own site.\",\n );\n } else {\n const thin = thinProfileHint(domain, profile);\n if (thin) hints.push(thin);\n }\n if (hiring.status === \"unavailable\" && hiring.reason === \"not_configured\") {\n hints.push(\n \"Hiring signals aren't switched on for this workspace yet, so these are the firmographics alone. \" +\n \"Score the account on them and leave hiring out of the reason.\",\n );\n }\n if (hiring.status === \"unavailable\" && hiring.reason === \"failed\") {\n hints.push(\n \"Hiring signals couldn't be read this time; don't retry in a loop. Use the firmographics and say hiring is unknown for this account.\",\n );\n }\n if (hiring.status === \"not_tracked\") {\n hints.push(\n \"No hiring data is kept for this company — that means unknown, not that it isn't hiring. Don't score it down for it.\",\n );\n }\n return hints;\n}\n\nfunction industryList(industries: readonly ResearchCompanyIndustry[]): string {\n return industries.map(({ slug, companies }) => `${slug} (${companies.toLocaleString(\"en-US\")})`).join(\", \");\n}\n\n/**\n * Neighbouring industries the search left out, so a thin market is widened on\n * purpose rather than guessed at. Each count is the companies it would add.\n */\nfunction relatedIndustriesHint(related: readonly ResearchCompanyIndustry[]): string | null {\n if (related.length === 0) return null;\n return (\n `Related industries not included (companies each adds with your other filters): ${industryList(related)}` +\n \" — add them with --industry a,b to widen.\"\n );\n}\n\nexport function companySearchHints({\n total,\n returned,\n page,\n lastPage,\n related,\n}: {\n total: number;\n returned: number;\n page: number;\n lastPage: number;\n related: readonly ResearchCompanyIndustry[];\n}): string[] {\n const hints: string[] = [];\n if (total === 0) {\n hints.push(\n \"No company matches every filter. Widen one at a time — a neighbouring size band, a related industry, one more country.\",\n );\n } else if (page < lastPage && returned > 0) {\n hints.push(\n `${total} companies match and ${returned} came back (each one returned is billed). ` +\n `Use \\`total\\` to size the market; ask for \\`--page ${page + 1}\\` only if you need the next rows for the list.`,\n );\n }\n const widen = relatedIndustriesHint(related);\n if (widen) hints.push(widen);\n return hints;\n}\n\n/** An industry that is no slug refuses the search before anything is billed; the fix offers the real ones. */\nexport function unknownIndustriesFix(industries: readonly { input: string; closest: ResearchCompanyIndustry[] }[]): {\n action: \"retry_with_changes\";\n explanation: string;\n} {\n const misses = industries.map(({ input, closest }) =>\n closest.length > 0\n ? `\"${input}\" is not an industry. Closest (companies each matches with your other filters): ${industryList(closest)}.`\n : `\"${input}\" is not an industry, and none is named like it — try a broader word (software, logistics, retail).`,\n );\n return {\n action: \"retry_with_changes\",\n explanation: `${misses.join(\" \")} Pass one or several of these slugs with --industry a,b — several widen the search, any of them matching. Nothing was charged.`,\n };\n}\n"],"mappings":";;;;;AAuBO,IAAM,gBACX;AAaK,SAAS,gBAAgB,UAAkB,cAAsC;AACtF,MAAI,WAAW,GAAG;AAChB,WAAO,CAAC;AAAA,EACV;AACA,QAAM,YAAY,aAAa,uBAAuB,aAAa;AACnE,MAAI,WAAW;AACb,WAAO;AAAA,MACL,eAAe,aAAa,QAAQ,MAAM,aAAa,QAAQ;AAAA,IAIjE;AAAA,EACF;AACA,SAAO;AAAA,IACL,eAAe,aAAa,QAAQ,MAAM,aAAa,QAAQ;AAAA,EAIjE;AACF;AAEO,SAAS,iBAAiB,UAAkB,cAAsC;AACvF,SAAO,CAAC,GAAG,gBAAgB,UAAU,YAAY,GAAG,aAAa;AACnE;AAOO,SAAS,qBACd,UACA,cACA,YACU;AACV,MAAI,WAAW,GAAG;AAChB,WAAO,CAAC;AAAA,EACV;AACA,MAAI,eAAe,UAAU,eAAe,WAAW;AACrD,WAAO;AAAA,MACL,uBAAuB,UAAU,OAAO,aAAa,QAAQ,MAAM,aAAa,QAAQ,wBAChE,UAAU;AAAA,IAGpC;AAAA,EACF;AACA,SAAO,gBAAgB,UAAU,YAAY;AAC/C;AAEA,IAAM,oBAAoB;AAC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,OAAO,WAAW,UAAU;AACjE,UAAM;AAAA,MACJ;AAAA,IACF;AAAA,EACF;AACA,MAAI,OAAO,WAAW,eAAe;AACnC,UAAM;AAAA,MACJ;AAAA,IACF;AAAA,EACF;AACA,SAAO;AACT;AAEA,SAAS,aAAa,YAAwD;AAC5E,SAAO,WAAW,IAAI,CAAC,EAAE,MAAM,UAAU,MAAM,GAAG,IAAI,KAAK,UAAU,eAAe,OAAO,CAAC,GAAG,EAAE,KAAK,IAAI;AAC5G;AAMA,SAAS,sBAAsB,SAA4D;AACzF,MAAI,QAAQ,WAAW,EAAG,QAAO;AACjC,SACE,kFAAkF,aAAa,OAAO,CAAC;AAG3G;AAEO,SAAS,mBAAmB;AAAA,EACjC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAMa;AACX,QAAM,QAAkB,CAAC;AACzB,MAAI,UAAU,GAAG;AACf,UAAM;AAAA,MACJ;AAAA,IACF;AAAA,EACF,WAAW,OAAO,YAAY,WAAW,GAAG;AAC1C,UAAM;AAAA,MACJ,GAAG,KAAK,wBAAwB,QAAQ,gGACgB,OAAO,CAAC;AAAA,IAClE;AAAA,EACF;AACA,QAAM,QAAQ,sBAAsB,OAAO;AAC3C,MAAI,MAAO,OAAM,KAAK,KAAK;AAC3B,SAAO;AACT;AAGO,SAAS,qBAAqB,YAGnC;AACA,QAAM,SAAS,WAAW;AAAA,IAAI,CAAC,EAAE,OAAO,QAAQ,MAC9C,QAAQ,SAAS,IACb,IAAI,KAAK,mFAAmF,aAAa,OAAO,CAAC,MACjH,IAAI,KAAK;AAAA,EACf;AACA,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,aAAa,GAAG,OAAO,KAAK,GAAG,CAAC;AAAA,EAClC;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../api/src/ads-meta/permissionGates.ts","../src/commands/ads/meta/shared.ts"],"sourcesContent":["/**\n * The refusals Baker writes for Meta work that needs a permission the baseline\n * connection does not ask for — managing catalogs (`catalog_management`) and\n * posting to a Facebook Page (`pages_manage_posts`). Shared verbatim by the\n * backend that throws them and the CLI that explains them, for the same reason\n * as `leadAds.ts`: these name their own cause and remedy, so the CLI must not\n * append Meta's ambiguous \"maybe reconnect, maybe an unassigned asset\" advice.\n */\n\nexport type MetaPermissionGate = \"catalog\" | \"pagePosts\";\n\n/** Everything a person or the agent can see about one per-company Meta permission. */\nexport interface MetaPermissionState {\n /** A Baker admin switched it on for this company, so the consent screen asks for it. */\n enabled: boolean;\n /** The current Meta connection holds it. */\n granted: boolean;\n /** Switched on, but the connection predates it — reconnecting Meta is the fix. */\n reconnectNeeded: boolean;\n}\n\nexport type MetaPermissionStates = Record<\"leadAds\" | MetaPermissionGate, MetaPermissionState>;\n\nexport const META_PERMISSION_NOT_ENABLED_MESSAGE: Record<MetaPermissionGate, string> = {\n catalog:\n \"Catalog changes need the Catalog permission for Meta — ask a Baker admin to turn it on, then reconnect Meta. \" +\n \"Everything else on Meta keeps working: tell the user, and carry on with the rest of the job.\",\n pagePosts:\n \"Facebook Page posts need the Page posts permission for Meta — ask a Baker admin to turn it on, then reconnect \" +\n \"Meta. Everything else on Meta keeps working: tell the user, and carry on with the rest of the job.\",\n};\n\nexport const META_PERMISSION_RECONNECT_MESSAGE: Record<MetaPermissionGate, string> = {\n catalog:\n \"Catalog changes need the Catalog permission for Meta. It is turned on for this company, but this Meta \" +\n \"connection was made before, so it does not hold it — ask the user to reconnect Meta in the dashboard, then \" +\n \"try again. Everything else on Meta keeps working meanwhile.\",\n pagePosts:\n \"Facebook Page posts need the Page posts permission for Meta. It is turned on for this company, but this Meta \" +\n \"connection was made before, so it does not hold it — ask the user to reconnect Meta in the dashboard, then \" +\n \"try again. Everything else on Meta keeps working meanwhile.\",\n};\n\n/**\n * Work that needs a Meta permission Baker's connection does not ask for at all\n * (no switch turns it on): reading and moderating comments on ads\n * (`pages_read_user_content`, `pages_manage_engagement`) and listing an\n * Instagram account's posts (`instagram_basic`). Live on v26.0 (2026-10-15)\n * Meta refused both with code 10.\n */\nexport const META_UNREQUESTED_PERMISSION_MESSAGE = {\n comments:\n \"Reading and moderating comments on ads needs Meta permissions Baker's Meta connection does not ask for yet \" +\n \"(reading people's comments and managing them on the Page). Tell the user that comment moderation happens in \" +\n \"Meta Business Suite for now, and carry on with the rest of the job.\",\n instagramMedia:\n \"Listing an Instagram account's posts needs a Meta permission Baker's Meta connection does not ask for yet. \" +\n \"Ask the user for the post's link or id instead, or boost it from Meta Business Suite, and carry on.\",\n} as const;\n\nconst META_PAGE_ADS_PERMISSION_REMEDY =\n \"A Baker admin turns it on with the lead ads switch for this company; then the user reconnects Meta in the dashboard. \" +\n \"Tell the user, and carry on with the rest of the job.\";\n\n/**\n * Click-to-message ads and Instant Experiences need Meta's Page ads permission\n * (`pages_manage_ads`), which only the lead ads switch adds to the consent\n * screen. `work` names what was refused (\"Click-to-message ads\").\n */\nexport function metaPageAdsPermissionMessage(work: string): string {\n return `${work} need Meta's Page ads permission, and this Meta connection does not have it. ${META_PAGE_ADS_PERMISSION_REMEDY}`;\n}\n\n/**\n * Whether a `FORBIDDEN` message carries one of these refusals. `includes`, not\n * equality: a stage-time refusal may lead with what the op was trying to do.\n */\nexport function isMetaPermissionGateRefusal(message: string): boolean {\n return [\n ...Object.values(META_PERMISSION_NOT_ENABLED_MESSAGE),\n ...Object.values(META_PERMISSION_RECONNECT_MESSAGE),\n ...Object.values(META_UNREQUESTED_PERMISSION_MESSAGE),\n META_PAGE_ADS_PERMISSION_REMEDY,\n ].some((refusal) => message.includes(refusal));\n}\n","import { isMetaPermissionGateRefusal } from \"@baker/api/ads-meta/permissionGates\";\nimport { ApiError, apiGet } from \"../../../client.ts\";\nimport { getEnv } from \"../../../env.ts\";\nimport { handleConnectionError, isOrganizationReadRefusal, needsConnectionFix } from \"../../../error-handler.ts\";\nimport { cacheGet, cacheSet } from \"../cache.ts\";\nimport { writeAdsJson, writeJsonEnvelope } from \"../output.ts\";\nimport { termsRefusalFix } from \"../terms-output.ts\";\nimport type { AdsErrorEnvelope, QueryFix } from \"../types.ts\";\n\nconst DAY_MS = 86_400_000;\n\n/**\n * Meta answers a permission refusal (Graph codes 200/10/294) with a bare\n * \"Permissions error\" that covers two causes needing opposite remedies: a\n * consent grant the connection never got — nothing validates Meta's granted\n * scopes after connect, unlike HubSpot's `requireCapability` — or a role the\n * user lacks on one asset, since a Pixel/Dataset, Page or catalog lives in a\n * Business and is assigned separately from the ad account. Only the blast radius\n * separates them, so hand the agent that test rather than a verdict: guessing\n * \"reconnect\" wastes the user's time on an unassigned asset, and ruling it out\n * strands a connection that really is short a scope.\n */\nexport function metaForbiddenFix(message: string): QueryFix {\n // Baker's own refusal already names the switch or the reconnect; Meta's\n // two-cause advice under it would contradict it.\n if (isMetaPermissionGateRefusal(message)) {\n return { action: \"reject\", explanation: message };\n }\n if (message.includes(\"has not accepted Meta's Lead Generation Terms\")) {\n return {\n action: \"reject\",\n explanation: `${message}\\n\\nMeta confirmed the Page's terms status using its Page access. Give the Page owner the terms link in the error and ask them to accept it before trying the form or lead ad set again. Do not suggest reconnecting Meta for this refusal; continue with other work that does not require the form or ad set.`,\n };\n }\n return {\n action: \"reject\",\n explanation: [\n message,\n \"This is a permission refusal, not a dead connection, and Meta returns the same code for two causes with opposite remedies. Tell them apart by how much else works before you answer.\",\n \"If other reads on this account are ALSO refused (campaigns, ad sets, insights), the connection is short a permission it was never granted. Only the user can widen it, by reconnecting Meta from the dashboard.\",\n \"If those reads work and only this object is refused, the asset (pixel/dataset, Page, or catalog) belongs to a Business the connected user holds no role in. Ad-account access does not carry asset access and reconnecting cannot grant it — the client assigns that asset to the connected user or partner in Meta Business settings, under the asset's own section (Data sources → Datasets for a pixel).\",\n \"Either way do not retry the same call, and do not abort the wider job. Continue with what you can read, and state in your answer that this specific check could not run and why — never present the task as verified when this step was skipped.\",\n ].join(\"\\n\\n\"),\n };\n}\n\nexport function handleMetaError(err: unknown): never {\n if (err instanceof ApiError) {\n if (needsConnectionFix(err.code, err.message)) {\n handleConnectionError(\"meta_ads\", err.message);\n }\n const terms = termsRefusalFix(err.code, err.message);\n if (terms) {\n writeJsonEnvelope({\n ok: false,\n error: { code: terms.code, message: err.message, fix: terms.fix, retryable: false },\n });\n process.exit(1);\n }\n const envelope: AdsErrorEnvelope = {\n ok: false,\n error: {\n code: err.code,\n message: err.message,\n fix:\n err.code === \"FORBIDDEN\" && !isOrganizationReadRefusal(err.message)\n ? metaForbiddenFix(err.message)\n : { action: \"reject\", explanation: err.message },\n retryable:\n err.code === \"RATE_LIMITED\" ||\n err.code === \"UNAVAILABLE\" ||\n err.code === \"INTERNAL_ERROR\" ||\n err.code === \"BUDGET_EXCEEDED\",\n },\n };\n writeAdsJson(envelope);\n process.exit(1);\n }\n const message = err instanceof Error ? err.message : \"Unexpected error\";\n writeAdsJson({ ok: false, error: { code: \"NETWORK_ERROR\", message } });\n process.exit(1);\n}\n\nconst ACCOUNT_ID_RE = /^(act_)?[0-9]+$/;\nconst CONNECTED_ACCOUNTS_TTL_MS = 60 * 60 * 1000;\n\ninterface ConnectedMetaAccount {\n externalId?: string;\n id?: string;\n name?: string;\n}\n\nfunction invalidAccountId(id: string): never {\n writeAdsJson({\n ok: false,\n error: {\n code: \"INVALID_ACCOUNT_ID\",\n message: `Invalid account ID \"${id}\". Expected numeric ID, optionally prefixed with \"act_\".`,\n },\n });\n process.exit(1);\n}\n\n/** A Meta ad account id however it was written — `123`, `act_123`, padded — as `act_123`; null for anything else. */\nexport function normalizeMetaAccountId(raw: string): string | null {\n const trimmed = raw.trim();\n return ACCOUNT_ID_RE.test(trimmed) ? actId(trimmed) : null;\n}\n\nfunction actId(id: string): string {\n return id.startsWith(\"act_\") ? id : `act_${id}`;\n}\n\nasync function connectedMetaAccounts(useCache: boolean): Promise<ConnectedMetaAccount[]> {\n if (useCache) {\n const cached = cacheGet<ConnectedMetaAccount[]>(\"meta-accounts\", \"list\");\n if (cached) return cached.data;\n }\n const accounts = await apiGet<ConnectedMetaAccount[]>(\n \"/api/ads/meta/accounts\",\n useCache ? undefined : { \"skip-cache\": \"true\" },\n );\n // An empty list is never kept: the refusal asks the user to select an account, and the retry must see it.\n if (useCache && accounts.length > 0) cacheSet(\"meta-accounts\", \"list\", accounts, CONNECTED_ACCOUNTS_TTL_MS);\n return accounts;\n}\n\n/** `--account-id` on a listing, which reads every connected account when none is named (`readEachAccount`). */\nexport const LISTING_ACCOUNT_ARG = {\n type: \"string\",\n description:\n \"Meta ad account ID (act_123). Without it the listing reads every connected account, each row tagged with its account_id.\",\n} as const;\n\nexport interface NamedAccount {\n id: string;\n name?: string;\n}\n\n/**\n * The accounts a listing reads: `--account-id` or `BAKER_META_AD_ACCOUNT_ID` as\n * `act_<id>`, else every account the company connected (`readEachAccount`).\n */\nexport async function accountsInScope(args: Record<string, unknown>): Promise<NamedAccount[]> {\n const fromArgs = args[\"account-id\"] as string | undefined;\n const explicit = fromArgs || getEnv().BAKER_META_AD_ACCOUNT_ID;\n if (explicit) {\n if (!ACCOUNT_ID_RE.test(explicit)) invalidAccountId(explicit);\n return [{ id: actId(explicit) }];\n }\n let accounts: ConnectedMetaAccount[];\n try {\n accounts = await connectedMetaAccounts(!args[\"no-cache\"]);\n } catch (err) {\n handleMetaError(err);\n }\n const ids = accounts.flatMap((account) => {\n const id = account.externalId ?? account.id;\n return id && ACCOUNT_ID_RE.test(id) ? [{ id: actId(id), name: account.name }] : [];\n });\n if (ids.length === 0) refuseMissingAccount(ids);\n if (ids.length === 1 && ids[0]) {\n process.stderr.write(`Using account \"${ids[0].name ?? ids[0].id}\" (${ids[0].id})\\n`);\n }\n return ids;\n}\n\nfunction listedAccounts(ids: readonly NamedAccount[]): string {\n return ids.map((account) => (account.name ? `${account.id} (${account.name})` : account.id)).join(\"; \");\n}\n\nfunction refuseMissingAccount(ids: readonly NamedAccount[]): never {\n const listed = listedAccounts(ids);\n writeAdsJson({\n ok: false,\n error: {\n code: \"MISSING_ACCOUNT_ID\",\n message:\n ids.length === 0\n ? \"This company has no Meta ad account selected, so there is no account to default to.\"\n : `This company connected ${ids.length} Meta ad accounts, so pass --account-id to name one: ${listed}.`,\n fix: {\n action: \"reject\",\n explanation:\n ids.length === 0\n ? \"Ask the user to select a Meta ad account for this company in Baker's Meta connection, or pass --account-id act_<id> for one the login reaches (`baker ads meta accounts --available`).\"\n : `Re-run with --account-id set to one of: ${listed}. A question about the whole business covers all ${ids.length}.`,\n },\n retryable: false,\n },\n });\n process.exit(1);\n}\n\n/**\n * The Meta ad account a command works on: `--account-id`, then\n * `BAKER_META_AD_ACCOUNT_ID`, then the company's only connected account — the\n * default `baker ads meta accounts` promises. With several connected, nothing is\n * picked: the refusal lists them so the next call can name one. Listings read\n * every account instead (`readEachAccount`).\n */\nexport async function resolveAccountIdArg(args: Record<string, unknown>): Promise<string> {\n const accounts = await accountsInScope(args);\n const [single] = accounts;\n if (accounts.length === 1 && single) return single.id;\n refuseMissingAccount(accounts);\n}\n\nexport interface AccountsRead<Row> {\n rows: Row[];\n /** Each row's account, in row order — only when several accounts were read. */\n accountOf?: string[];\n hints: string[];\n}\n\nexport interface ReadEachAccountOptions<Row> {\n /** A read scoped by a parent id (`--campaign-id`, `--adset-id`): the parent decides the account. */\n byParent?: boolean;\n /** The most rows the whole listing prints (`--limit`, else the route's default), not each account's. */\n limit?: number;\n /** When each row happened, for a log merged newest first (one account's arrives in that order already). */\n time?: (row: Row) => number;\n}\n\n/**\n * A listing reads whichever account it names; with none named and several\n * connected, it reads each one in turn (the company's request budget refuses a\n * parallel burst) and says which account every row came from. A read guesses\n * nothing by covering them all, while a write still has to name its account.\n * An account Meta refuses is named in a hint while the others' rows still\n * arrive; only when every account fails does the listing fail. A read scoped\n * by a parent id lists that parent's children whichever connected account it\n * is sent with, so `byParent` sends it once (the backend paces it on the\n * parent's own account). `limit` caps the merged listing, as it caps one\n * account's.\n */\nexport async function readEachAccount<Row>(\n accounts: readonly NamedAccount[],\n read: (accountId: string) => Promise<Row[]>,\n options: ReadEachAccountOptions<Row> = {},\n): Promise<AccountsRead<Row>> {\n const [first] = accounts;\n if ((accounts.length === 1 || options.byParent) && first) return { rows: await read(first.id), hints: [] };\n let rows: Row[] = [];\n let accountOf: string[] = [];\n const failed: Array<{ account: NamedAccount; err: unknown }> = [];\n for (const account of accounts) {\n try {\n const listed = await read(account.id);\n rows.push(...listed);\n accountOf.push(...listed.map(() => account.id));\n } catch (err) {\n failed.push({ account, err });\n }\n }\n if (failed.length === accounts.length && failed[0]) throw failed[0].err;\n const { time } = options;\n if (time) {\n const order = rows.map((_, i) => i).sort((a, b) => rowTime(rows[b], time) - rowTime(rows[a], time));\n rows = order.flatMap((i) => (rows[i] === undefined ? [] : [rows[i]]));\n accountOf = order.map((i) => accountOf[i] ?? \"\");\n }\n const total = rows.length;\n const { limit } = options;\n const cut = limit !== undefined && total > limit;\n if (cut) {\n rows = rows.slice(0, limit);\n accountOf = accountOf.slice(0, limit);\n }\n return {\n rows,\n accountOf,\n hints: [\n `No --account-id, so all ${accounts.length} connected accounts were read: ${listedAccounts(accounts)}. account_id says which one each row is in; --account-id act_<id> reads one.`,\n ...(cut\n ? [\n `The accounts returned ${total} rows; the ${time ? \"newest\" : \"first\"} ${limit} are shown, as --limit caps the whole listing. --limit <n> shows more, or --account-id act_<id> reads one account.`,\n ]\n : []),\n ...failed.map(\n ({ account, err }) =>\n `${account.id}${account.name ? ` (${account.name})` : \"\"} could not be read, so none of its rows are here: ${err instanceof Error ? err.message : String(err)}`,\n ),\n ],\n };\n}\n\nfunction rowTime<Row>(row: Row | undefined, time: (row: Row) => number): number {\n return row === undefined ? 0 : time(row) || 0;\n}\n\n/** When a Meta log row happened (`event_time`, a rule run's `timestamp`), for merging accounts' logs. */\nexport function loggedAt(value: unknown): number {\n if (typeof value === \"number\") return value < 1e12 ? value * 1000 : value;\n return Date.parse(String(value ?? \"\")) || 0;\n}\n\n/** The `--limit` a listing asked for, else the route's own default, as the cap on the merged listing. */\nexport function listingLimit(args: Record<string, unknown>, routeDefault: number): number {\n const asked = Number(args.limit);\n return Number.isInteger(asked) && asked > 0 ? asked : routeDefault;\n}\n\n/** Puts each row's account first, when the rows came from several accounts. */\nexport function withAccountColumn<Row extends object>(\n rows: Row[],\n accountOf: readonly string[] | undefined,\n): Array<Row & { account_id?: string }> {\n if (!accountOf) return rows;\n // Ahead of the row's own fields, and over Graph's `account_id` (no `act_`) under --full.\n return rows.map((row, i) => Object.assign({ account_id: accountOf[i] }, row, { account_id: accountOf[i] }));\n}\n\nexport function getDateRange(args: Record<string, unknown>): { datePreset?: string; since?: string; until?: string } {\n const datePreset = args[\"date-preset\"] as string | undefined;\n const since = args.since as string | undefined;\n const until = args.until as string | undefined;\n if (since && until) return { since, until };\n return { datePreset: datePreset ?? \"last_7d\" };\n}\n\nexport function todayIso(): string {\n return new Date().toISOString().slice(0, 10);\n}\n\nexport function daysAgoIso(days: number): string {\n return new Date(Date.now() - days * DAY_MS).toISOString().slice(0, 10);\n}\n\nexport function csvOrJson(args: Record<string, unknown>): string {\n return (args.output as string | undefined) ?? \"json\";\n}\n\n/**\n * Matched by Meta itself, so finding one entity by name reads only the rows that\n * match instead of the whole account.\n */\nexport const NAME_CONTAINS_ARG = {\n type: \"string\",\n description:\n \"Only rows whose name contains this text, matched by Meta before anything is returned. Start here to find one entity by name: --name-contains octubre --all-statuses\",\n} as const;\n\n/**\n * Default to ACTIVE-only on listings — that's almost always what an AI agent or\n * a human glance wants. Pass `--effective-status ACTIVE,PAUSED` to override, or\n * `--all-statuses` to drop the filter entirely.\n */\nexport function resolveEffectiveStatus(args: Record<string, unknown>): string | undefined {\n if (args[\"all-statuses\"]) {\n return undefined;\n }\n const explicit = args[\"effective-status\"] as string | undefined;\n if (explicit) {\n return explicit;\n }\n // Rows named by id are wanted whatever they are doing; the ACTIVE default would hide a paused one.\n if (args.ids) {\n return undefined;\n }\n return \"ACTIVE\";\n}\n\n/**\n * An empty listing under a status filter reads exactly like \"nothing exists\":\n * a paused campaign's ad sets are CAMPAIGN_PAUSED, so the ACTIVE default hides\n * every one of them. Say which filter produced the empty list and how to widen it.\n */\nexport function statusFilterHints(\n rows: ReadonlyArray<unknown>,\n effectiveStatus: string | undefined,\n noun: string,\n): string[] {\n if (rows.length > 0 || effectiveStatus === undefined) return [];\n if (effectiveStatus === \"ACTIVE\") {\n return [\n `No ACTIVE ${noun}. The ACTIVE filter hides paused, archived and in-review ones (under a paused campaign or ad set that is all of them), so this does NOT mean none exist. Re-run with --all-statuses before concluding there are none.`,\n ];\n }\n return [\n `No ${noun} with effective_status ${effectiveStatus}. Re-run with --all-statuses to see every status before concluding there are none.`,\n ];\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuBO,IAAM,sCAA0E;AAAA,EACrF,SACE;AAAA,EAEF,WACE;AAEJ;AAEO,IAAM,oCAAwE;AAAA,EACnF,SACE;AAAA,EAGF,WACE;AAGJ;AASO,IAAM,sCAAsC;AAAA,EACjD,UACE;AAAA,EAGF,gBACE;AAEJ;AAEA,IAAM,kCACJ;AAgBK,SAAS,4BAA4B,SAA0B;AACpE,SAAO;AAAA,IACL,GAAG,OAAO,OAAO,mCAAmC;AAAA,IACpD,GAAG,OAAO,OAAO,iCAAiC;AAAA,IAClD,GAAG,OAAO,OAAO,mCAAmC;AAAA,IACpD;AAAA,EACF,EAAE,KAAK,CAAC,YAAY,QAAQ,SAAS,OAAO,CAAC;AAC/C;;;AC3EA,IAAM,SAAS;AAaR,SAAS,iBAAiB,SAA2B;AAG1D,MAAI,4BAA4B,OAAO,GAAG;AACxC,WAAO,EAAE,QAAQ,UAAU,aAAa,QAAQ;AAAA,EAClD;AACA,MAAI,QAAQ,SAAS,+CAA+C,GAAG;AACrE,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,aAAa,GAAG,OAAO;AAAA;AAAA;AAAA,IACzB;AAAA,EACF;AACA,SAAO;AAAA,IACL,QAAQ;AAAA,IACR,aAAa;AAAA,MACX;AAAA,MACA;AAAA,MACA;AAAA,MACA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;AACxB,WAAO;AAAA,EACT;AACA,QAAM,WAAW,KAAK,kBAAkB;AACxC,MAAI,UAAU;AACZ,WAAO;AAAA,EACT;AAEA,MAAI,KAAK,KAAK;AACZ,WAAO;AAAA,EACT;AACA,SAAO;AACT;AAOO,SAAS,kBACd,MACA,iBACA,MACU;AACV,MAAI,KAAK,SAAS,KAAK,oBAAoB,OAAW,QAAO,CAAC;AAC9D,MAAI,oBAAoB,UAAU;AAChC,WAAO;AAAA,MACL,aAAa,IAAI;AAAA,IACnB;AAAA,EACF;AACA,SAAO;AAAA,IACL,MAAM,IAAI,0BAA0B,eAAe;AAAA,EACrD;AACF;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/ads/meta/creatives.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { NO_CACHE_ARG } from \"../../../cache-flag.ts\";\nimport { apiGet } from \"../../../client.ts\";\nimport { META_LIST_SHAPE_ARGS, registerMetaListSchema, shapeMetaListRows, writeMetaListRows } from \"./list-rows.ts\";\nimport {\n accountsInScope,\n csvOrJson,\n handleMetaError,\n LISTING_ACCOUNT_ARG,\n listingLimit,\n readEachAccount,\n} from \"./shared.ts\";\n\nconst listArgs = {\n \"account-id\": LISTING_ACCOUNT_ARG,\n \"creative-id\": {\n type: \"string\",\n description: \"One creative ID, or several comma-separated, read in one call: --creative-id 2394…,2395…\",\n },\n \"name-contains\": {\n type: \"string\",\n description:\n \"Only creatives whose name contains this text (any case), matched by Baker while it reads the account; --limit counts the matches. Start here to find a creative by name: --name-contains octubre\",\n },\n limit: { type: \"string\", description: \"Max rows (default 500)\" },\n \"no-cache\": NO_CACHE_ARG,\n ...META_LIST_SHAPE_ARGS,\n} as const;\n\nregisterMetaListSchema(\n \"creatives\",\n \"List ad creatives, or read some by id, as a table by default: id, name, status, object_type, dynamic (the asset feed's optimization_type), body, title, description, link, cta, url_tags, image_hash, video_id, page_id, instagram_user_id, effective_object_story_id. Copy and assets are read from wherever the creative keeps them (top level, object_story_spec, its carousel cards or asset_feed_spec); a dynamic creative's variants and a carousel's cards come back as lists. Per-placement rules and enhancement toggles are --fields (asset_feed_spec.asset_customization_rules, degrees_of_freedom_spec) or --full. Start here: baker ads meta creatives --creative-id 2394…,2395… --output json. With no --account-id and several accounts connected, every account is read and each row leads with its account_id.\",\n listArgs,\n);\n\nconst CREATIVE_IDS_PER_REQUEST = 50;\n\n/**\n * Up to 50 ids per request, which Baker reads from Meta in one Graph batch call. The requests run one after\n * another: the company's request budget (a burst of 4, then 2 a second) refuses a parallel burst.\n */\nasync function readCreatives(ids: string[], skipCache: boolean): Promise<Array<Record<string, unknown>>> {\n const rows: Array<Record<string, unknown>> = [];\n for (let start = 0; start < ids.length; start += CREATIVE_IDS_PER_REQUEST) {\n const read = await apiGet<Record<string, unknown> | Array<Record<string, unknown>>>(\"/api/ads/meta/creatives\", {\n \"creative-id\": ids.slice(start, start + CREATIVE_IDS_PER_REQUEST).join(\",\"),\n ...(skipCache ? { \"skip-cache\": \"true\" } : {}),\n });\n rows.push(...(Array.isArray(read) ? read : [read]));\n }\n return rows;\n}\n\nconst listCommand = defineCommand({\n meta: {\n name: \"list\",\n description:\n \"List ad creatives, or read some by ID. Runs by default when no subcommand is given. Example: baker ads meta creatives --creative-id 2394…,2395…\",\n },\n args: listArgs,\n run: async ({ args }) => {\n const ids = ((args[\"creative-id\"] as string | undefined) ?? \"\")\n .split(\",\")\n .map((id) => id.trim())\n .filter(Boolean);\n const accounts = ids.length > 0 ? [] : await accountsInScope(args);\n try {\n if (ids.length > 0) {\n const data = await readCreatives(ids, Boolean(args[\"no-cache\"]));\n writeMetaListRows(\"creatives\", shapeMetaListRows(\"creatives\", data, args), csvOrJson(args));\n return;\n }\n const params: Record<string, string> = {};\n if (args[\"name-contains\"]) params[\"name-contains\"] = args[\"name-contains\"] as string;\n if (args.limit) params.limit = args.limit as string;\n if (args[\"no-cache\"]) params[\"skip-cache\"] = \"true\";\n const read = await readEachAccount(\n accounts,\n (accountId) =>\n apiGet<Array<Record<string, unknown>>>(\"/api/ads/meta/creatives\", { ...params, \"account-id\": accountId }),\n { limit: listingLimit(args, 500) },\n );\n writeMetaListRows(\n \"creatives\",\n shapeMetaListRows(\"creatives\", read.rows, args, read.accountOf),\n csvOrJson(args),\n read.hints,\n );\n } catch (err) {\n handleMetaError(err);\n }\n },\n});\n\nexport const creativesCommand = defineCommand({\n meta: {\n name: \"creatives\",\n description: `List ad creatives, fetch one by ID, or stage writes (create/update). Write subcommands stage ops on this chat's draft.\n\nImportant: Meta creatives are effectively immutable once attached to an ad. Editing copy/image/CTA = create\na new creative + repoint the ad (baker ads meta ads update <adId> --creative <ref>).\n\nReads print a table by default: id, name, status, object_type, dynamic, body, title, description, link, cta,\nurl_tags, image_hash, video_id, page_id, instagram_user_id, effective_object_story_id — read from wherever the\ncreative keeps them; a dynamic creative's variants and a carousel's cards come back as lists. --fields (dotted paths) or --full for the rest.\n\nExamples:\n baker ads meta creatives --account-id act_123 --name-contains octubre — find creatives by name\n baker ads meta creatives --creative-id 23842...,23843... --output json # read several at once\n baker ads meta creatives --creative-id 23842... --fields id,asset_feed_spec.asset_customization_rules --output json\n baker ads meta creatives create --page 555 --message \"Save now\" --link https://x.com --image-hash abc… --cta SHOP_NOW`,\n },\n subCommands: {\n list: listCommand,\n create: () => import(\"./write-commands.ts\").then((m) => m.adCreativesCreateCommand),\n update: () => import(\"./write-commands.ts\").then((m) => m.adCreativesUpdateCommand),\n delete: () => import(\"./asset-writes.ts\").then((m) => m.creativesDeleteCommand),\n },\n // `args` stays even though the parent has no `run`: citty scans rawArgs for the\n // subcommand name using THIS command's arg defs, so without them `--account-id act_1`\n // would read `act_1` as a subcommand. `default` (not `run`) dispatches the bare\n // invocation — citty falls through to `run` after a subcommand, double-executing it.\n args: listArgs,\n default: \"list\",\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,qBAAqB;AAa9B,IAAM,WAAW;AAAA,E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,SAAiC,CAAC;AACxC,UAAI,KAAK,eAAe,EAAG,QAAO,eAAe,IAAI,KAAK,eAAe;AACzE,UAAI,KAAK,MAAO,QAAO,QAAQ,KAAK;AACpC,UAAI,KAAK,UAAU,EAAG,QAAO,YAAY,IAAI;AAC7C,YAAM,OAAO,MAAM;AAAA,QACjB;AAAA,QACA,CAAC,cACC,OAAuC,2BAA2B,EAAE,GAAG,QAAQ,cAAc,UAAU,CAAC;AAAA,QAC1G,EAAE,OAAO,aAAa,MAAM,GAAG,EAAE;AAAA,MACnC;AACA;AAAA,QACE;AAAA,QACA,kBAAkB,aAAa,KAAK,MAAM,MAAM,KAAK,SAAS;AAAA,QAC9D,UAAU,IAAI;AAAA,QACd,KAAK;AAAA,MACP;AAAA,IACF,SAAS,KAAK;AACZ,sBAAgB,GAAG;AAAA,IACrB;AAAA,EACF;AACF,CAAC;AAEM,IAAM,mBAAmB,cAAc;AAAA,EAC5C,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAcf;AAAA,EACA,aAAa;AAAA,IACX,MAAM;AAAA,IACN,QAAQ,MAAM,OAAO,8BAAqB,EAAE,KAAK,CAAC,MAAM,EAAE,wBAAwB;AAAA,IAClF,QAAQ,MAAM,OAAO,8BAAqB,EAAE,KAAK,CAAC,MAAM,EAAE,wBAAwB;AAAA,IAClF,QAAQ,MAAM,OAAO,4BAAmB,EAAE,KAAK,CAAC,MAAM,EAAE,sBAAsB;AAAA,EAChF;AAAA;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM;AAAA,EACN,SAAS;AACX,CAAC;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/ads/meta/custom-conversions.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { NO_CACHE_ARG } from \"../../../cache-flag.ts\";\nimport { apiGet } from \"../../../client.ts\";\nimport { registerSchema } from \"../../../schemas.ts\";\nimport { writeAdsOutput, writeJsonEnvelope } from \"../output.ts\";\nimport {\n accountsInScope,\n csvOrJson,\n handleMetaError,\n LISTING_ACCOUNT_ARG,\n listingLimit,\n readEachAccount,\n withAccountColumn,\n} from \"./shared.ts\";\n\n/** A Custom Conversion as the backend returns it, rule already read back as a phrase. */\nexport interface MetaCustomConversion {\n id: string;\n name?: string;\n description?: string;\n custom_event_type?: string;\n event_source_type?: string;\n pixel?: { id?: string; name?: string };\n rule?: string;\n rule_summary?: string;\n default_conversion_value?: number;\n retention_days?: number;\n is_archived?: boolean;\n is_unavailable?: boolean;\n creation_time?: string;\n first_fired_time?: string;\n last_fired_time?: string;\n}\n\n/** What the caller needs to pick one. The raw rule and the timestamps sit behind --full. */\ninterface CompactCustomConversion {\n id: string;\n name?: string;\n custom_event_type?: string;\n counts?: string;\n pixel_id?: string;\n last_fired_time?: string;\n archived?: true;\n unavailable?: true;\n}\n\nexport function compactCustomConversion(row: MetaCustomConversion): CompactCustomConversion {\n return {\n id: row.id,\n name: row.name,\n custom_event_type: row.custom_event_type,\n counts: row.rule_summary,\n pixel_id: row.pixel?.id,\n last_fired_time: row.last_fired_time,\n ...(row.is_archived ? { archived: true as const } : {}),\n ...(row.is_unavailable ? { unavailable: true as const } : {}),\n };\n}\n\n/**\n * What to say about a listing, once.\n *\n * A conversion that has never fired is the one thing that reads as \"broken\" and\n * usually is not — Meta creates it counting nothing until the rule matches a\n * real event — while pointing an ad set at one is a real decision with a real\n * cost, because Meta cannot optimize toward an event it has never seen. Saying\n * so here is cheaper than the chat where it gets discovered after a week of\n * delivery.\n */\nexport function customConversionHints(rows: MetaCustomConversion[]): string[] {\n if (rows.length === 0) {\n return [\n \"This account has no custom conversions. Optimize toward a standard pixel event instead (`--pixel-id` + `--custom-event-type`), or stage one: `baker ads meta custom-conversions create --name … --pixel-id … --custom-event-type LEAD --url-contains /thank-you`.\",\n ];\n }\n const hints: string[] = [\n \"To optimize an ad set toward one: `baker ads meta adsets create … --optimization-goal OFFSITE_CONVERSIONS --custom-conversion-id <id>`. Baker fills the pixel and the event category from the conversion — do not also pass --pixel-id or --custom-event-type.\",\n ];\n const neverFired = rows.filter((row) => !row.is_archived && !row.last_fired_time);\n if (neverFired.length > 0) {\n hints.push(\n `${neverFired.length === 1 ? \"This conversion has\" : `${neverFired.length} of these have`} never fired (${neverFired\n .map((row) => row.name ?? row.id)\n .join(\n \", \",\n )}). Meta cannot optimize toward an event it has never seen, so an ad set pointed at one delivers without learning — check the rule matches a page the site actually serves before spending on it.`,\n );\n }\n return hints;\n}\n\nregisterSchema({\n command: \"ads.meta.custom-conversions\",\n description:\n \"List the Custom Conversions defined on a Meta ad account — the measurement objects a marketer sets up in Events Manager (a pixel event narrowed by a rule, e.g. 'PageView on /thank-you'). Start here whenever the user talks about their own conversions rather than a standard event: an ad set optimizes toward one with `adsets create --custom-conversion-id <id>`. With no --account-id and several accounts connected, every account is read and each row leads with its account_id.\",\n args: {\n \"account-id\": { ...LISTING_ACCOUNT_ARG, required: false },\n full: { type: \"boolean\", description: \"Include the raw rule JSON, retention and creation times\", required: false },\n limit: { type: \"string\", description: \"Max rows\", required: false },\n \"no-cache\": { type: \"boolean\", description: \"Bypass the cache\", required: false },\n output: { type: \"string\", description: \"json|csv\", required: false, default: \"json\" },\n },\n});\n\nconst listArgs = {\n \"account-id\": LISTING_ACCOUNT_ARG,\n full: { type: \"boolean\", description: \"Include the raw rule JSON, retention and creation times\" },\n limit: { type: \"string\", description: \"Max rows\" },\n \"no-cache\": NO_CACHE_ARG,\n output: { type: \"string\", description: \"Output format: json|csv|jsonl|md\", default: \"json\" },\n} as const;\n\nconst listCommand = defineCommand({\n meta: {\n name: \"list\",\n description:\n \"List custom conversions. Runs by default when no subcommand is given. Example: baker ads meta custom-conversions --account-id act_123\",\n },\n args: listArgs,\n run: async ({ args }) => {\n const accounts = await accountsInScope(args);\n try {\n const params: Record<string, string> = {};\n if (args.limit) params.limit = args.limit as string;\n if (args[\"no-cache\"]) params[\"skip-cache\"] = \"true\";\n const read = await readEachAccount(\n accounts,\n (accountId) =>\n apiGet<MetaCustomConversion[]>(\"/api/ads/meta/custom-conversions\", { ...params, \"account-id\": accountId }),\n { limit: listingLimit(args, 200) },\n );\n const rows = read.rows;\n const data: Array<Record<string, unknown>> = withAccountColumn(\n args.full ? rows.map((row) => ({ ...row })) : rows.map((row) => ({ ...compactCustomConversion(row) })),\n read.accountOf,\n );\n const fmt = csvOrJson(args);\n if (fmt !== \"json\") {\n writeAdsOutput(data, fmt, undefined, read.hints);\n return;\n }\n writeJsonEnvelope({ ok: true, data, hints: [...read.hints, ...customConversionHints(rows)] });\n } catch (err) {\n handleMetaError(err);\n }\n },\n});\n\nexport const customConversionsCommand = defineCommand({\n meta: {\n name: \"custom-conversions\",\n description: `List the Custom Conversions on an ad account, or stage a new one — a pixel event narrowed by a rule, set up in Events Manager.\nUse this whenever the user says \"my conversions\" rather than naming a standard event: the id here is what an ad set optimizes toward.\n\nExamples:\n baker ads meta custom-conversions --account-id act_123\n baker ads meta custom-conversions --account-id act_123 --full # raw rule JSON\n baker ads meta custom-conversions create --name \"Lead formulario\" --pixel-id 9988 --custom-event-type LEAD --url-contains \"/gracias\"`,\n },\n subCommands: {\n list: listCommand,\n create: () => import(\"./write-commands.ts\").then((m) => m.customConversionsCreateCommand),\n update: () => import(\"./asset-writes.ts\").then((m) => m.customConversionsUpdateCommand),\n delete: () => import(\"./asset-writes.ts\").then((m) => m.customConversionsDeleteCommand),\n },\n // `args` stays even though the parent has no `run`: citty scans rawArgs for\n // the subcommand name using THIS command's arg defs. `default` (not `run`)\n // dispatches the bare invocation.\n args: listArgs,\n default: \"list\",\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,qBAAqB;AA8CvB,SAAS,wBAAwB,KAAoD;AAC1F,SAAO;AAAA,IACL,IAAI,IAAI;AAAA,IACR,MAAM,IAAI;AAAA,IACV,mB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AA,IACX,MAAM;AAAA,IACN,QAAQ,MAAM,OAAO,8BAAqB,EAAE,KAAK,CAAC,MAAM,EAAE,8BAA8B;AAAA,IACxF,QAAQ,MAAM,OAAO,4BAAmB,EAAE,KAAK,CAAC,MAAM,EAAE,8BAA8B;AAAA,IACtF,QAAQ,MAAM,OAAO,4BAAmB,EAAE,KAAK,CAAC,MAAM,EAAE,8BAA8B;AAAA,EACxF;AAAA;AAAA;AAAA;AAAA,EAIA,MAAM;AAAA,EACN,SAAS;AACX,CAAC;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/ads/meta/pixels.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { DateTime } from \"luxon\";\nimport { NO_CACHE_ARG } from \"../../../cache-flag.ts\";\nimport { apiGet } from \"../../../client.ts\";\nimport { writeAdsJson, writeAdsOutput } from \"../output.ts\";\nimport type { AdsWarning } from \"../types.ts\";\nimport {\n accountsInScope,\n csvOrJson,\n daysAgoIso,\n handleMetaError,\n LISTING_ACCOUNT_ARG,\n readEachAccount,\n todayIso,\n withAccountColumn,\n} from \"./shared.ts\";\n\nexport const pixelsCommand = defineCommand({\n meta: {\n name: \"pixels\",\n description: `List Meta Pixels for an ad account, or count what one pixel received — the firing read, not ad-attributed conversions.\n\n--stats prints one row per day per event (date, weekday, event, count) by default, in the ad account's time zone; --by hour or --by total change the grain, --full returns Meta's raw hourly buckets.\n\nExamples:\n baker ads meta pixels --account-id act_123\n baker ads meta pixels --pixel-id 9876 --stats --days 7 # per day per event\n baker ads meta pixels --pixel-id 9876 --stats --days 7 --event Lead,Purchase # only those events\n baker ads meta pixels --pixel-id 9876 --stats --days 30 --by total # each event's count, first and last seen`,\n },\n args: {\n \"account-id\": LISTING_ACCOUNT_ARG,\n \"pixel-id\": { type: \"string\", description: \"Pixel ID for --stats\" },\n stats: { type: \"boolean\", description: \"Fetch firing stats for the pixel\" },\n aggregation: {\n type: \"string\",\n description: \"stats aggregation: event|browser_type|host|pixel_fire\",\n default: \"event\",\n },\n days: { type: \"string\", description: \"Lookback days for --stats (default 7)\" },\n by: {\n type: \"string\",\n description:\n \"--stats grain: day (default; one row per day per value, with its weekday), hour (one row per hour per value), total (one row per value with first_seen/last_seen)\",\n },\n event: {\n type: \"string\",\n description: \"--stats: keep only these values, comma-separated and exact (e.g. --event Lead,Purchase)\",\n },\n full: { type: \"boolean\", description: \"--stats: Meta's raw hourly buckets, every value, instead of the rows\" },\n \"no-cache\": NO_CACHE_ARG,\n output: { type: \"string\", description: \"Output format: json|csv|jsonl|md\", default: \"json\" },\n },\n run: async ({ args }) => {\n try {\n if (args.stats) {\n await runStats(args);\n return;\n }\n await runList(args);\n } catch (err) {\n handleMetaError(err);\n }\n },\n});\n\nasync function runStats(args: Record<string, unknown>): Promise<void> {\n const pixelId = args[\"pixel-id\"] as string | undefined;\n if (!pixelId) {\n handleMetaError(new Error(\"--pixel-id is required when --stats is set\"));\n }\n const days = args.days ? Number(args.days) : 7;\n if (!Number.isInteger(days) || days <= 0 || days > 90) {\n handleMetaError(new Error(\"--days must be a positive integer ≤ 90\"));\n }\n const params: Record<string, string> = {\n \"pixel-id\": pixelId,\n aggregation: (args.aggregation as string) ?? \"event\",\n \"start-time\": daysAgoIso(days),\n \"end-time\": todayIso(),\n };\n if (args[\"no-cache\"]) params[\"skip-cache\"] = \"true\";\n const by = (args.by as string | undefined) ?? \"day\";\n if (!isStatsGrain(by)) {\n writeAdsJson({\n ok: false,\n error: { code: \"INVALID_ARGS\", message: `--by must be one of ${STATS_GRAINS.join(\", \")}` },\n });\n process.exit(1);\n }\n const buckets = await apiGet<PixelStatBucket[]>(\"/api/ads/meta/pixel-stats\", params);\n if (args.full) {\n emit(buckets as Array<Record<string, unknown>>, args);\n return;\n }\n const events =\n typeof args.event === \"string\"\n ? args.event\n .split(\",\")\n .map((e) => e.trim())\n .filter(Boolean)\n : [];\n const window = { start: `${params[\"start-time\"]}T00:00:00Z`, end: `${params[\"end-time\"]}T00:00:00Z` };\n const { rows, hints } = rollUpPixelStats(buckets, { aggregation: params.aggregation ?? \"event\", by, events, window });\n writeAdsOutput(rows, csvOrJson(args), undefined, hints);\n}\n\n/** One time bucket as Meta's `/{pixel}/stats` returns it; `start_time` carries the ad account's offset. */\ninterface PixelStatBucket {\n start_time?: string;\n data?: Array<{ value?: string; count?: number }>;\n}\n\nconst STATS_GRAINS = [\"day\", \"hour\", \"total\"] as const;\ntype StatsGrain = (typeof STATS_GRAINS)[number];\n\nfunction isStatsGrain(value: string): value is StatsGrain {\n return (STATS_GRAINS as readonly string[]).includes(value);\n}\n\ninterface RollUp {\n aggregation: string;\n by: StatsGrain;\n events: string[];\n /** The UTC instants the read asked Meta for. */\n window: { start: string; end: string };\n}\n\n/**\n * Meta answers with one bucket per hour, each a nested list of values, so \"how\n * many Leads a day\" was a script over hundreds of rows at every call site. The\n * day is the one Meta wrote on `start_time` — the ad account's own day.\n */\nfunction rollUpPixelStats(\n buckets: PixelStatBucket[],\n { aggregation, by, events, window }: RollUp,\n): { rows: Array<Record<string, string | number>>; hints: string[] } {\n const { folded, seen } = foldBuckets(buckets, by, new Set(events));\n const rows = [...folded.values()]\n .sort((a, b) => a.key.localeCompare(b.key) || b.count - a.count)\n .map((row): Record<string, string | number> => {\n if (by === \"total\") {\n return { [aggregation]: row.value, count: row.count, first_seen: row.first, last_seen: row.last };\n }\n if (by === \"hour\") return { hour: row.key, [aggregation]: row.value, count: row.count };\n return { date: row.key, weekday: accountWeekday(row.first), [aggregation]: row.value, count: row.count };\n });\n const hints: string[] = [];\n const missing = events.filter((event) => !seen.has(event));\n if (missing.length > 0) {\n const received = [...seen].sort().join(\", \") || \"nothing\";\n hints.push(`No ${missing.join(\", \")} received in this window (names are exact). The pixel received: ${received}.`);\n }\n const partialDays = by === \"day\" && rows.length > 0 ? daysCutByWindow(buckets, window) : [];\n if (partialDays.length > 0) {\n hints.push(\n `${partialDays.join(\" and \")} ${partialDays.length === 1 ? \"is a partial day\" : \"are partial days\"}: the read covers ${window.start} → ${window.end}, so compare only the full days between them.`,\n );\n }\n return { rows, hints };\n}\n\ninterface FoldedRow {\n key: string;\n value: string;\n count: number;\n first: string;\n last: string;\n}\n\nconst ROW_KEY: Record<StatsGrain, (time: string) => string> = {\n day: (time) => accountDay(time),\n hour: (time) => time,\n total: () => \"\",\n};\n\nfunction foldBuckets(\n buckets: PixelStatBucket[],\n by: StatsGrain,\n wanted: Set<string>,\n): { folded: Map<string, FoldedRow>; seen: Set<string> } {\n const entries = buckets.flatMap((bucket) =>\n (bucket.data ?? []).map((entry) => ({\n time: bucket.start_time ?? \"\",\n value: entry.value ?? \"(unnamed)\",\n count: entry.count ?? 0,\n })),\n );\n const folded = new Map<string, FoldedRow>();\n for (const { time, value, count } of entries) {\n if (wanted.size > 0 && !wanted.has(value)) continue;\n const key = ROW_KEY[by](time);\n const id = `${key}\\u0000${value}`;\n const row = folded.get(id) ?? { key, value, count: 0, first: time, last: time };\n row.count += count;\n if (instant(time) < instant(row.first)) row.first = time;\n if (instant(time) > instant(row.last)) row.last = time;\n folded.set(id, row);\n }\n return { folded, seen: new Set(entries.map((entry) => entry.value)) };\n}\n\n/** The account-local days the window starts after or ends before, oldest first. */\nfunction daysCutByWindow(buckets: PixelStatBucket[], window: { start: string; end: string }): string[] {\n const cut = new Set<string>();\n for (const { start_time: time } of buckets) {\n if (time && dayOverhangsWindow(time, window)) cut.add(accountDay(time));\n }\n return [...cut].sort();\n}\n\n/** Whether the account-local day `time` falls on starts before or ends after the window read. */\nfunction dayOverhangsWindow(time: string, window: { start: string; end: string }): boolean {\n const dayStart = bucketTime(time).startOf(\"day\");\n if (!dayStart.isValid) return false;\n return dayStart < DateTime.fromISO(window.start) || dayStart.plus({ days: 1 }) > DateTime.fromISO(window.end);\n}\n\n/** A bucket's `start_time` in the offset Meta wrote on it — the ad account's. */\nfunction bucketTime(time: string): DateTime {\n return DateTime.fromISO(time, { setZone: true });\n}\n\nfunction accountDay(time: string): string {\n return bucketTime(time).toISODate() ?? \"\";\n}\n\n/** Written out so a reader never works the weekday out from the date, and gets it wrong. */\nfunction accountWeekday(time: string): string {\n return bucketTime(time).setLocale(\"en-US\").toFormat(\"ccc\");\n}\n\n/** Compared as instants: across a clock change, the same local hour carries two offsets. */\nfunction instant(time: string): number {\n return bucketTime(time).toMillis();\n}\n\nasync function runList(args: Record<string, unknown>): Promise<void> {\n const accounts = await accountsInScope(args);\n const params: Record<string, string> = {};\n if (args[\"no-cache\"]) params[\"skip-cache\"] = \"true\";\n const restricted = new Set<string>();\n const read = await readEachAccount(accounts, async (accountId) => {\n const { pixels, restrictedFields } = await apiGet<{\n pixels: Array<Record<string, unknown>>;\n restrictedFields: string[];\n }>(\"/api/ads/meta/pixels\", { ...params, \"account-id\": accountId });\n for (const field of restrictedFields) restricted.add(field);\n return pixels;\n });\n emit(withAccountColumn(read.rows, read.accountOf), args, pixelWarnings([...restricted]), read.hints);\n}\n\n/**\n * A listing Meta trimmed is still a listing — IDs, names and firing times are\n * complete. Say which setup fields are missing and how to get them, so the gap\n * reads as a client-side access grant rather than as a pixel that isn't there.\n */\nexport function pixelWarnings(restrictedFields: string[]): AdsWarning[] {\n if (restrictedFields.length === 0) {\n return [];\n }\n return [\n {\n code: \"PIXEL_FIELDS_RESTRICTED\",\n message:\n `Meta withheld ${restrictedFields.join(\", \")} for these pixels — the connected user holds no role in the Business that owns them. ` +\n \"IDs, names, creation and last-fired times are complete; install code and setup details are not. \" +\n \"To get them, the client assigns the pixel to the connected user in Meta Business settings → Data sources → Datasets.\",\n },\n ];\n}\n\nfunction emit(\n data: Array<Record<string, unknown>>,\n args: Record<string, unknown>,\n warnings: AdsWarning[] = [],\n hints: string[] = [],\n): void {\n const fmt = csvOrJson(args);\n if (fmt !== \"json\") {\n writeAdsOutput(data, fmt, undefined, hints);\n return;\n }\n writeAdsJson({\n ok: true,\n data,\n ...(warnings.length > 0 ? { warnings } : {}),\n ...(hints.length > 0 ? { hints } : {}),\n });\n}\n"],"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GACb;AACN,QAAM,MAAM,UAAU,IAAI;AAC1B,MAAI,QAAQ,QAAQ;AAClB,mBAAe,MAAM,KAAK,QAAW,KAAK;AAC1C;AAAA,EACF;AACA,eAAa;AAAA,IACX,IAAI;AAAA,IACJ;AAAA,IACA,GAAI,SAAS,SAAS,IAAI,EAAE,SAAS,IAAI,CAAC;AAAA,IAC1C,GAAI,MAAM,SAAS,IAAI,EAAE,MAAM,IAAI,CAAC;AAAA,EACtC,CAAC;AACH;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/ads/meta/rules.ts"],"sourcesContent":["import type { MetaAdRuleHistoryRow, MetaAdRuleRow } from \"@baker/api/ads-meta/adRules\";\nimport { defineCommand } from \"citty\";\nimport { apiGet } from \"../../../client.ts\";\nimport { registerSchema } from \"../../../schemas.ts\";\nimport { writeJsonEnvelope } from \"../output.ts\";\nimport {\n accountsInScope,\n handleMetaError,\n LISTING_ACCOUNT_ARG,\n listingLimit,\n loggedAt,\n readEachAccount,\n resolveAccountIdArg,\n withAccountColumn,\n} from \"./shared.ts\";\n\n/**\n * Meta automated rules — reads. A rule is Meta's own automation: it runs on\n * Meta, on Meta's schedule, with no Baker involvement once created. Writes\n * (create / update / enable / disable / delete) stage like every Meta change\n * and live in `rule-writes.ts`.\n */\n\n/** What an agent needs to pick a rule and know what it does. Specs sit behind --full. */\nexport function compactRule(row: MetaAdRuleRow): Record<string, unknown> {\n return {\n id: row.id,\n name: row.name,\n status: row.status,\n does: row.description,\n ...(row.disable_error_code ? { disable_error_code: row.disable_error_code } : {}),\n updated_time: row.updated_time,\n };\n}\n\nexport function ruleListHints(rows: readonly MetaAdRuleRow[]): string[] {\n const hints: string[] = [];\n if (rows.length === 0) {\n hints.push(\n 'No automated rules on this account. Stage one with `baker ads meta rules create --name … --apply-to ad --when \"cost_per_result>20\" --action pause`.',\n );\n }\n const issues = rows.filter((row) => row.status === \"HAS_ISSUES\");\n if (issues.length > 0) {\n hints.push(\n `${issues.map((row) => row.name ?? row.id).join(\", \")} ${issues.length === 1 ? \"has\" : \"have\"} been stopped by Meta (HAS_ISSUES) — read it with --rule-id and fix the spec with \\`rules update\\`.`,\n );\n }\n if (rows.length > 0) {\n hints.push(\n \"`rules history --rule-id <id>` shows what a rule did and when; `rules preview <id>` what it would act on now.\",\n );\n }\n return hints;\n}\n\nregisterSchema({\n command: \"ads.meta.rules\",\n description:\n \"List the automated rules on a Meta ad account (Ads Manager → Automated rules): each rule's status and what it does, in words. --rule-id reads one; --full adds its evaluation_spec, execution_spec and schedule_spec in the shape `rules update --file` takes (money in major units of the account currency). With no --account-id and several accounts connected, every account is read and each row leads with its account_id.\",\n args: {\n \"account-id\": { ...LISTING_ACCOUNT_ARG, required: false },\n \"rule-id\": { type: \"string\", description: \"Read one rule\", required: false },\n full: { type: \"boolean\", description: \"Include the specs and timestamps\", required: false },\n },\n});\n\nconst listCommand = defineCommand({\n meta: {\n name: \"list\",\n description:\n \"List automated rules. Runs by default. Example: baker ads meta rules --account-id act_123 · one rule in full: baker ads meta rules --rule-id 1132635173044914 --full\",\n },\n args: {\n \"account-id\": LISTING_ACCOUNT_ARG,\n \"rule-id\": { type: \"string\", description: \"Read one rule\" },\n full: { type: \"boolean\", description: \"Include the specs and timestamps\" },\n },\n run: async ({ args }) => {\n const accounts = await accountsInScope(args);\n try {\n const params: Record<string, string> = {};\n if (args[\"rule-id\"]) params[\"rule-id\"] = String(args[\"rule-id\"]);\n const read = await readEachAccount(accounts, (accountId) =>\n apiGet<MetaAdRuleRow[]>(\"/api/ads/meta/rules\", { ...params, \"account-id\": accountId }),\n );\n const rows = read.rows;\n const full = Boolean(args.full) || Boolean(args[\"rule-id\"]);\n const data = full\n ? withAccountColumn(rows, read.accountOf)\n : withAccountColumn(rows.map(compactRule), read.accountOf);\n writeJsonEnvelope({ ok: true, data, hints: [...read.hints, ...ruleListHints(rows)] });\n } catch (err) {\n handleMetaError(err);\n }\n },\n});\n\n/** A run in a line an agent can read: when, which rule, and what it changed. */\nexport function compactHistory(row: MetaAdRuleHistoryRow): Record<string, unknown> {\n const changes = (row.results ?? []).flatMap((result) =>\n (result.actions ?? []).map((action) => ({\n object_id: result.object_id,\n action: action.action,\n ...(action.field ? { field: action.field } : {}),\n ...(action.old_value !== undefined ? { from: action.old_value } : {}),\n ...(action.new_value !== undefined ? { to: action.new_value } : {}),\n })),\n );\n return {\n timestamp: row.timestamp,\n rule_id: row.rule_id,\n ...(row.is_manual ? { manual: true } : {}),\n changes,\n ...(row.exception_message ? { error: row.exception_message } : {}),\n };\n}\n\nregisterSchema({\n command: \"ads.meta.rules.history\",\n description:\n \"What automated rules did and when: each run with the objects it changed (PAUSED, CHANGED_BUDGET, …, old → new value). Without --rule-id, every rule on the account, newest first. With no --account-id and several accounts connected, every account is read and each row leads with its account_id.\",\n args: {\n \"account-id\": { ...LISTING_ACCOUNT_ARG, required: false },\n \"rule-id\": { type: \"string\", description: \"One rule's runs\", required: false },\n \"object-id\": { type: \"string\", description: \"Only runs that touched this ad, ad set or campaign\", required: false },\n action: { type: \"string\", description: \"Only this action, e.g. PAUSED, CHANGED_BUDGET\", required: false },\n \"hide-no-changes\": { type: \"boolean\", description: \"Drop runs that changed nothing\", required: false },\n limit: { type: \"string\", description: \"Max runs (default 50)\", required: false },\n full: { type: \"boolean\", description: \"Include the rule's specs at each run\", required: false },\n },\n});\n\nconst historyCommand = defineCommand({\n meta: {\n name: \"history\",\n description:\n \"What rules did and when. Example: baker ads meta rules history --rule-id 1132635173044914 --hide-no-changes · every rule: baker ads meta rules history --account-id act_123\",\n },\n args: {\n \"account-id\": LISTING_ACCOUNT_ARG,\n \"rule-id\": { type: \"string\", description: \"One rule's runs\" },\n \"object-id\": { type: \"string\", description: \"Only runs that touched this object\" },\n action: { type: \"string\", description: \"Only this action (PAUSED, CHANGED_BUDGET, …)\" },\n \"hide-no-changes\": { type: \"boolean\", description: \"Drop runs that changed nothing\" },\n limit: { type: \"string\", description: \"Max runs (default 50)\" },\n full: { type: \"boolean\", description: \"Include the rule's specs at each run\" },\n },\n run: async ({ args }) => {\n const accounts = await accountsInScope(args);\n try {\n const params: Record<string, string> = {};\n for (const key of [\"rule-id\", \"object-id\", \"action\", \"limit\"] as const) {\n if (args[key]) params[key] = String(args[key]);\n }\n if (args[\"hide-no-changes\"]) params[\"hide-no-changes\"] = \"true\";\n const read = await readEachAccount(\n accounts,\n (accountId) =>\n apiGet<MetaAdRuleHistoryRow[]>(\"/api/ads/meta/rules/history\", { ...params, \"account-id\": accountId }),\n { limit: listingLimit(args, 50), time: (row) => loggedAt(row.timestamp) },\n );\n const rows = read.rows;\n const hints =\n rows.length === 0\n ? [\n \"No runs recorded. A daily rule first runs just after midnight in the ad account's time zone; a switched-off rule never runs.\",\n ]\n : [];\n const data = withAccountColumn(args.full ? rows : rows.map(compactHistory), read.accountOf);\n writeJsonEnvelope({ ok: true, data, hints: [...read.hints, ...hints] });\n } catch (err) {\n handleMetaError(err);\n }\n },\n});\n\nregisterSchema({\n command: \"ads.meta.rules.preview\",\n description:\n \"Which ads, ad sets or campaigns a live schedule rule would act on right now, by Meta's own evaluation. Changes nothing.\",\n args: {\n id: { type: \"positional\", description: \"Rule id\", required: true },\n \"account-id\": { type: \"string\", description: \"Meta ad account ID (act_123)\", required: false },\n },\n});\n\nconst previewCommand = defineCommand({\n meta: {\n name: \"preview\",\n description:\n \"What a rule would act on right now (changes nothing). Example: baker ads meta rules preview 1132635173044914\",\n },\n args: {\n id: { type: \"positional\", description: \"Rule id\", required: true },\n \"account-id\": { type: \"string\", description: \"Meta ad account ID\" },\n },\n run: async ({ args }) => {\n const accountId = await resolveAccountIdArg(args);\n try {\n const data = await apiGet<{ ruleId: string; matched: unknown[] }>(\"/api/ads/meta/rules/preview\", {\n \"account-id\": accountId,\n \"rule-id\": String(args.id),\n });\n const hints =\n data.matched.length === 0 ? [\"Nothing matches right now — the rule would change nothing if it ran now.\"] : [];\n writeJsonEnvelope({ ok: true, data, hints });\n } catch (err) {\n handleMetaError(err);\n }\n },\n});\n\nexport const rulesCommand = defineCommand({\n meta: {\n name: \"rules\",\n description: `Meta automated rules — Meta's own automation, which runs on Meta with no Baker involvement once created.\nUse one for a standing \"if this metric crosses that line, do X\" that needs no judgement; use a Baker scheduled agent when the call needs reasoning.\n\nExamples:\n baker ads meta rules --account-id act_123 # every rule, what it does\n baker ads meta rules --rule-id 1132635173044914 # one rule with its specs\n baker ads meta rules history --rule-id 1132635173044914 --hide-no-changes # what it did\n baker ads meta rules preview 1132635173044914 # what it would act on now\n baker ads meta rules create --name \"Stop expensive ads\" --apply-to ad --when \"cost_per_result>20\" --action pause\n baker ads meta rules update 1132635173044914 --name \"Stop very expensive ads\"\n baker ads meta rules disable|enable|delete 1132635173044914\n baker ads meta rules run 1132635173044914 # run it once, at publish`,\n },\n subCommands: {\n list: listCommand,\n history: historyCommand,\n preview: previewCommand,\n create: () => import(\"./rule-writes.ts\").then((m) => m.rulesCreateCommand),\n update: () => import(\"./rule-writes.ts\").then((m) => m.rulesUpdateCommand),\n enable: () => import(\"./rule-writes.ts\").then((m) => m.rulesEnableCommand),\n disable: () => import(\"./rule-writes.ts\").then((m) => m.rulesDisableCommand),\n delete: () => import(\"./rule-writes.ts\").then((m) => m.rulesDeleteCommand),\n run: () => import(\"./rule-writes.ts\").then((m) => m.rulesRunCommand),\n },\n args: {\n \"account-id\": LISTING_ACCOUNT_ARG,\n \"rule-id\": { type: \"string\", description: \"Read one rule\" },\n full: { type: \"boolean\", description: \"Include the specs and timestamps\" },\n },\n default: \"list\",\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,qBAAqB;AAuBvB,SAAS,YAAY,KAA6C;AACvE,SAAO;AAAA,IACL,IAAI,IAAI;AAAA,IACR,MAAM,IAAI;AAAA,IACV,QAAQ,IAAI;AAAA,IACZ,MAAM,IAAI;AAAA,IACV,GAAI,IAAI,qBAAqB,EAAE,oBAAoB,IAAI,mBAAmB,IAAI,CAAC;AAAA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CAAC;AAAA,IAC7C,SAAS,KAAK;AACZ,sBAAgB,GAAG;AAAA,IACrB;AAAA,EACF;AACF,CAAC;AAEM,IAAM,eAAe,cAAc;AAAA,EACxC,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYf;AAAA,EACA,aAAa;AAAA,IACX,MAAM;AAAA,IACN,SAAS;AAAA,IACT,SAAS;AAAA,IACT,QAAQ,MAAM,OAAO,2BAAkB,EAAE,KAAK,CAAC,MAAM,EAAE,kBAAkB;AAAA,IACzE,QAAQ,MAAM,OAAO,2BAAkB,EAAE,KAAK,CAAC,MAAM,EAAE,kBAAkB;AAAA,IACzE,QAAQ,MAAM,OAAO,2BAAkB,EAAE,KAAK,CAAC,MAAM,EAAE,kBAAkB;AAAA,IACzE,SAAS,MAAM,OAAO,2BAAkB,EAAE,KAAK,CAAC,MAAM,EAAE,mBAAmB;AAAA,IAC3E,QAAQ,MAAM,OAAO,2BAAkB,EAAE,KAAK,CAAC,MAAM,EAAE,kBAAkB;AAAA,IACzE,KAAK,MAAM,OAAO,2BAAkB,EAAE,KAAK,CAAC,MAAM,EAAE,eAAe;AAAA,EACrE;AAAA,EACA,MAAM;AAAA,IACJ,cAAc;AAAA,IACd,WAAW,EAAE,MAAM,UAAU,aAAa,gBAAgB;AAAA,IAC1D,MAAM,EAAE,MAAM,WAAW,aAAa,mCAAmC;AAAA,EAC3E;AAAA,EACA,SAAS;AACX,CAAC;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../api/src/ads-meta/adStudyDescription.ts","../src/commands/ads/meta/studies.ts"],"sourcesContent":["/**\n * A Meta A/B test in words — the one reading shared by the staged summary, the\n * draft review rows and the CLI, so all three say the same thing: what each\n * version runs and how much of the audience it gets, what decides the winner,\n * for how long, and how sure Meta has to be.\n */\nimport type { AdStudyCell, AdStudyObjective } from \"./adStudies\";\n\nexport interface AdStudyWordsInput {\n type?: string;\n start_time?: number;\n end_time?: number;\n confidence_level?: number;\n cells?: readonly Pick<\n AdStudyCell,\n \"name\" | \"treatment_percentage\" | \"control_percentage\" | \"adsets\" | \"campaigns\" | \"ads\"\n >[];\n objectives?: readonly AdStudyObjective[];\n}\n\nexport interface AdStudyWords {\n sentence: string;\n versions?: string;\n measuring: string;\n /** The measures besides the primary one, by name. */\n alsoMeasured?: string;\n schedule?: string;\n confidence?: string;\n}\n\nconst MONTHS = [\"Jan\", \"Feb\", \"Mar\", \"Apr\", \"May\", \"Jun\", \"Jul\", \"Aug\", \"Sep\", \"Oct\", \"Nov\", \"Dec\"];\n\nexport function adStudyTime(seconds: number): string {\n const date = new Date(seconds * 1000);\n const hh = String(date.getUTCHours()).padStart(2, \"0\");\n const mm = String(date.getUTCMinutes()).padStart(2, \"0\");\n return `${date.getUTCDate()} ${MONTHS[date.getUTCMonth()]} ${date.getUTCFullYear()}, ${hh}:${mm} UTC`;\n}\n\nfunction daysLabel(seconds: number): string {\n const days = Math.round((seconds / 86_400) * 10) / 10;\n return `${days} ${days === 1 ? \"day\" : \"days\"}`;\n}\n\nfunction quoted(id: string, names: Record<string, string>): string {\n const name = names[id];\n return name ? `\"${name}\"` : id;\n}\n\nfunction cellWords(\n cell: Pick<AdStudyCell, \"name\" | \"treatment_percentage\" | \"control_percentage\" | \"adsets\" | \"campaigns\" | \"ads\">,\n names: Record<string, string>,\n): string {\n const [noun, ids] = cell.ads\n ? [\"ad\", cell.ads]\n : cell.adsets\n ? [\"ad set\", cell.adsets]\n : [\"campaign\", cell.campaigns ?? []];\n const plural = ids.length > 1 ? `${noun}s` : noun;\n const runs = ids.length > 0 ? ` (${plural} ${ids.map((id) => quoted(id, names)).join(\", \")})` : \"\";\n const share =\n cell.control_percentage === undefined\n ? `${cell.treatment_percentage}%`\n : `${cell.treatment_percentage}% see the ads, ${cell.control_percentage}% held out`;\n return `${cell.name}${runs} ${share}`;\n}\n\nconst STUDY_KIND: Record<string, string> = {\n SPLIT_TEST: \"Split test\",\n LIFT: \"Lift study\",\n SPLIT_TEST_V2: \"Creative test\",\n};\n\nfunction primaryObjective(objectives: readonly AdStudyObjective[] | undefined): AdStudyObjective | undefined {\n if (!objectives || objectives.length === 0) {\n return undefined;\n }\n return objectives.find((objective) => objective.is_primary === true) ?? objectives[0];\n}\n\nconst SOURCE_NOUN: Record<\"adspixels\" | \"applications\" | \"offsite_datasets\", string> = {\n adspixels: \"pixel\",\n applications: \"app\",\n offsite_datasets: \"dataset\",\n};\n\n/** \"Lead on pixel \"Site\"\", one per event source. */\nfunction sourceWords(objective: AdStudyObjective, names: Record<string, string>): string[] {\n const words: string[] = [];\n for (const key of [\"adspixels\", \"applications\", \"offsite_datasets\"] as const) {\n for (const source of objective[key] ?? []) {\n const events = source.event_names?.join(\" or \") ?? \"any event\";\n words.push(`${events} on ${SOURCE_NOUN[key]} ${quoted(source.id, names)}`);\n }\n }\n for (const source of objective.customconversions ?? []) {\n words.push(`custom conversion ${quoted(source.id, names)}`);\n }\n return words;\n}\n\n/** What decides the winner. Meta's split test compares cost per result of the primary measure. */\nfunction measuringWords(objectives: readonly AdStudyObjective[] | undefined, names: Record<string, string>): string {\n const primary = primaryObjective(objectives);\n if (!primary) {\n return \"cost per result on the campaigns' objective\";\n }\n const sources = sourceWords(primary, names);\n return `cost per \"${primary.name}\"${sources.length > 0 ? ` (${sources.join(\", \")})` : \"\"}`;\n}\n\n/** What the sentence says the study measures: a lift study reads the lift, a test the cost per result. */\nfunction measuringPhrase(type: string | undefined, primary: AdStudyObjective | undefined, measuring: string): string {\n if (type === \"LIFT\") return `measuring the lift in ${primary ? `\"${primary.name}\"` : \"results\"}`;\n return `measuring ${primary ? `cost per \"${primary.name}\"` : measuring}`;\n}\n\nexport function describeAdStudy(\n study: AdStudyWordsInput,\n { names = {} }: { names?: Record<string, string> } = {},\n): AdStudyWords {\n const versions =\n study.cells && study.cells.length > 0 ? study.cells.map((cell) => cellWords(cell, names)).join(\" vs \") : undefined;\n const measuring = measuringWords(study.objectives, names);\n const primary = primaryObjective(study.objectives);\n const others = (study.objectives ?? []).filter((objective) => objective !== primary);\n const alsoMeasured = others.length > 0 ? others.map((objective) => `\"${objective.name}\"`).join(\", \") : undefined;\n const hasSchedule = study.start_time !== undefined && study.end_time !== undefined;\n const length = hasSchedule ? daysLabel((study.end_time ?? 0) - (study.start_time ?? 0)) : undefined;\n const schedule = hasSchedule\n ? `${adStudyTime(study.start_time ?? 0)} → ${adStudyTime(study.end_time ?? 0)} · ${length}`\n : undefined;\n const confidence = study.confidence_level !== undefined ? `${Math.round(study.confidence_level * 100)}%` : undefined;\n const parts = [\n versions,\n measuringPhrase(study.type, primary, measuring),\n length,\n confidence ? `${confidence} confidence` : undefined,\n ].filter((part): part is string => part !== undefined);\n const kind = STUDY_KIND[study.type ?? \"SPLIT_TEST\"] ?? \"Split test\";\n return { sentence: `${kind}: ${parts.join(\", \")}`, versions, measuring, alsoMeasured, schedule, confidence };\n}\n","import { adStudyFromWire, cellObjects, unixSeconds } from \"@baker/api/ads-meta/adStudies\";\nimport { adStudyTime, describeAdStudy } from \"@baker/api/ads-meta/adStudyDescription\";\nimport { defineCommand } from \"citty\";\nimport { NO_CACHE_ARG } from \"../../../cache-flag.ts\";\nimport { apiGet } from \"../../../client.ts\";\nimport { registerSchema } from \"../../../schemas.ts\";\nimport { writeJsonEnvelope } from \"../output.ts\";\nimport {\n type AccountsRead,\n accountsInScope,\n handleMetaError,\n LISTING_ACCOUNT_ARG,\n readEachAccount,\n withAccountColumn,\n} from \"./shared.ts\";\n\n/**\n * Meta A/B tests (ad studies) — reads. A test splits one audience between\n * versions (ad sets, campaigns, or a creative test's ads) so each person sees one, and Meta calls the\n * winner. Writes (create / update / end / delete) stage like every Meta change\n * and live in `study-writes.ts`.\n */\n\ntype Row = Record<string, unknown>;\n\nexport type StudyState = \"scheduled\" | \"running\" | \"ended\" | \"cancelled\";\n\nexport function studyState(row: Row, nowSeconds: number): StudyState {\n if (row.canceled_time) return \"cancelled\";\n const start = unixSeconds(row.start_time) ?? 0;\n const end = unixSeconds(row.end_time) ?? Number.POSITIVE_INFINITY;\n if (nowSeconds < start) return \"scheduled\";\n return nowSeconds < end ? \"running\" : \"ended\";\n}\n\n/** What an agent needs to pick a test and know what it compares. The raw node sits behind --full. */\nexport function compactStudy(row: Row, nowSeconds: number): Row {\n const study = adStudyFromWire(row);\n const words = describeAdStudy(study, { names: study.names });\n return {\n id: study.id,\n name: study.name,\n state: studyState(row, nowSeconds),\n compares: words.versions,\n ...(study.start_time !== undefined ? { starts: adStudyTime(study.start_time) } : {}),\n ...(study.end_time !== undefined ? { ends: adStudyTime(study.end_time) } : {}),\n ...(row.results_first_available_date ? { results_from: row.results_first_available_date } : {}),\n };\n}\n\n/** One test in full: each version with its cell id (what `studies update --split` names), each measure with Meta's results. */\nexport function studyDetail(row: Row, nowSeconds: number): Row {\n const study = adStudyFromWire(row);\n const measures = ((row.objectives as { data?: Row[] } | undefined)?.data ?? []).map((objective) => ({\n id: objective.id,\n name: objective.name,\n primary: objective.is_primary === true,\n ...(objective.results !== undefined ? { results: objective.results } : {}),\n }));\n return {\n ...compactStudy(row, nowSeconds),\n ...(study.description ? { description: study.description } : {}),\n versions: study.cells.map((cell) => ({\n cell_id: cell.id,\n name: cell.name,\n share: `${cell.treatment_percentage}%`,\n runs: cellObjects(cell).map((id) => ({ id, name: study.names[id] })),\n level: cell.ads ? \"ad\" : cell.adsets ? \"ad set\" : \"campaign\",\n })),\n measures,\n };\n}\n\nexport function studyHints(detail: Row): string[] {\n const state = detail.state as StudyState;\n if (state === \"scheduled\") {\n return [\n \"Not started: it can still be re-timed, re-split (`studies update --split <cell_id>=60 …`) or deleted. Results appear once it runs.\",\n ];\n }\n const measures = (detail.measures as Row[] | undefined) ?? [];\n const hasResults = measures.some((measure) => measure.results !== undefined);\n return [\n hasResults\n ? \"Meta's verdict is in each measure's results, with its confidence. Report a winner only when Meta names one at the test's confidence level; otherwise say the versions performed alike.\"\n : \"No results yet — Meta publishes them once the test has gathered enough. Compare per-version delivery meanwhile with `baker ads meta insights --object <ad set or campaign id>`, and do not call a winner from it.\",\n state === \"running\"\n ? \"Running: its split and start are fixed; it can be renamed, its end moved, ended now (`studies end`) or deleted (results and all).\"\n : \"Over. Read the per-version numbers with `baker ads meta insights --object <id>` for the period it ran.\",\n ];\n}\n\nregisterSchema({\n command: \"ads.meta.studies\",\n description:\n \"Meta A/B tests (ad studies) whose versions run in an ad account — what each compares, when it runs and its state (scheduled, running, ended). --study-id reads one: every version with its cell id and share, and each measure with Meta's results. --business-id lists every test on a Business. Stage new ones with `studies create`. With no --account-id and several accounts connected, every account is read and each row leads with its account_id.\",\n args: {\n \"account-id\": { ...LISTING_ACCOUNT_ARG, required: false },\n \"business-id\": { type: \"string\", description: \"List every test on this Business instead\", required: false },\n \"study-id\": { type: \"string\", description: \"One test: its versions and results\", required: false },\n full: { type: \"boolean\", description: \"The tests as Meta returns them\", required: false },\n \"no-cache\": { type: \"boolean\", description: \"Bypass the cache\", required: false },\n },\n});\n\nconst listArgs = {\n \"account-id\": LISTING_ACCOUNT_ARG,\n \"business-id\": { type: \"string\", description: \"List every test on this Business instead\" },\n \"study-id\": { type: \"string\", description: \"Read one test: versions, cell ids, results\" },\n full: { type: \"boolean\", description: \"The tests as Meta returns them\" },\n \"no-cache\": NO_CACHE_ARG,\n} as const;\n\nasync function read<T>(path: string, params: Record<string, string>, noCache: unknown): Promise<T> {\n if (noCache) params[\"skip-cache\"] = \"true\";\n return await apiGet<T>(path, params);\n}\n\nconst listCommand = defineCommand({\n meta: {\n name: \"list\",\n description:\n \"List A/B tests. Runs by default. Example: baker ads meta studies --account-id act_123 · one test: baker ads meta studies --study-id 6123\",\n },\n args: listArgs,\n run: async ({ args }) => {\n const now = Math.floor(Date.now() / 1000);\n try {\n if (args[\"study-id\"]) {\n const row = await read<Row>(\n \"/api/ads/meta/study-results\",\n { \"study-id\": String(args[\"study-id\"]) },\n args[\"no-cache\"],\n );\n const detail = studyDetail(row, now);\n writeJsonEnvelope({ ok: true, data: args.full ? row : detail, hints: studyHints(detail) });\n return;\n }\n const listed: AccountsRead<Row> = args[\"business-id\"]\n ? {\n rows: await read<Row[]>(\n \"/api/ads/meta/studies\",\n { \"business-id\": String(args[\"business-id\"]) },\n args[\"no-cache\"],\n ),\n hints: [],\n }\n : await readEachAccount(await accountsInScope(args), (accountId) =>\n read<Row[]>(\"/api/ads/meta/studies\", { \"account-id\": accountId }, args[\"no-cache\"]),\n );\n const { rows } = listed;\n const hints = [\n ...listed.hints,\n ...(rows.length === 0\n ? [\n \"No A/B tests. To set one up: duplicate the ad set (`adsets duplicate`), change ONE thing on the copy, then `studies create --adsets <original>,<copy>`.\",\n ]\n : [\"`studies --study-id <id>` reads one test's versions and results.\"]),\n ];\n const data = withAccountColumn(args.full ? rows : rows.map((row) => compactStudy(row, now)), listed.accountOf);\n writeJsonEnvelope({ ok: true, data, hints });\n } catch (err) {\n handleMetaError(err);\n }\n },\n});\n\nexport const studiesCommand = defineCommand({\n meta: {\n name: \"studies\",\n description: `Meta A/B tests (ad studies): Meta splits one audience between versions — ad sets or campaigns — so each person sees one, and calls the winner.\nNot Baker's own page experiments (\\`baker experiment\\`), which test landing pages.\n\nExamples:\n baker ads meta studies --account-id act_123 # tests on this account and their state\n baker ads meta studies --study-id 6123 # versions, cell ids, Meta's results\n baker ads meta studies create --name \"Broad vs lookalike\" --adsets 6123,6124 --start 2026-10-20T08:00Z --days 14 --confidence 90\n baker ads meta studies update 6123 --end 2026-11-10T08:00Z\n baker ads meta studies end 6123 | delete 6123`,\n },\n subCommands: {\n list: listCommand,\n create: () => import(\"./study-writes.ts\").then((m) => m.studiesCreateCommand),\n update: () => import(\"./study-writes.ts\").then((m) => m.studiesUpdateCommand),\n end: () => import(\"./study-writes.ts\").then((m) => m.studiesEndCommand),\n delete: () => import(\"./study-writes.ts\").then((m) => m.studiesDeleteCommand),\n },\n args: listArgs,\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EM,IAAM,iBAAiB,cAAc;AAAA,EAC1C,MAAM;AAAA,IACJ,MAAM;AAAA,IACN,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASf;AAAA,EACA,aAAa;AAAA,IACX,MAAM;AAAA,IACN,QAAQ,MAAM,OAAO,4BAAmB,EAAE,KAAK,CAAC,MAAM,EAAE,oBAAoB;AAAA,IAC5E,QAAQ,MAAM,OAAO,4BAAmB,EAAE,KAAK,CAAC,MAAM,EAAE,oBAAoB;AAAA,IAC5E,KAAK,MAAM,OAAO,4BAAmB,EAAE,KAAK,CAAC,MAAM,EAAE,iBAAiB;AAAA,IACtE,QAAQ,MAAM,OAAO,4BAAmB,EAAE,KAAK,CAAC,MAAM,EAAE,oBAAoB;AAAA,EAC9E;AAAA,EACA,MAAM;AAAA,EACN,SAAS;AACX,CAAC;","names":[]}
|
package/dist/web-K3JH5TXT.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/commands/research/web.ts"],"sourcesContent":["import type { ResearchDeepResearchPollResponse, ResearchWebResponse, ResearchWebSource } from \"@baker/api\";\nimport { defineCommand } from \"citty\";\nimport { ApiError, apiGet, apiPost } from \"../../client.ts\";\nimport { registerSchema } from \"../../schemas.ts\";\nimport { webDepthHints, webSourceHints } from \"./hints.ts\";\nimport {\n type ListResult,\n namedBy,\n RESEARCH_LIST_CONCURRENCY,\n RESEARCH_LIST_MAX,\n readEach,\n refuseLongList,\n writeResearchList,\n} from \"./list-input.ts\";\nimport { handleResearchError, writeResearchHints, writeResearchJson } from \"./output.ts\";\n\nregisterSchema({\n command: \"research.web\",\n routes: [\n \"POST /api/research/explore\",\n \"POST /api/research/deep-research/start\",\n \"GET /api/research/deep-research/poll\",\n ],\n effect: \"read_live\",\n description:\n \"Search the web with AI to answer marketing questions — competitors, ICP, pricing, pain points, market trends. Each source is the page itself plus the part of the answer it backs. Depths: medium (a fast model, quick, default), high (the same model thinking longer — not a stronger model), xhigh (a deep-research agent, minutes).\",\n args: {\n question: {\n type: \"string\",\n description:\n \"The research question to answer using live web data. Several quoted questions (up to 30, or 10 at --depth xhigh) are answered at once in one call, one entry per question — never a shell loop or background jobs\",\n required: true,\n },\n depth: {\n type: \"string\",\n description: \"Research depth: medium (quick), high (thorough), xhigh (exhaustive). Default: medium\",\n required: false,\n enum: [\"medium\", \"high\", \"xhigh\"],\n },\n },\n});\n\ntype Depth = \"medium\" | \"high\" | \"xhigh\";\n\nconst TIMEOUT_MS: Record<Depth, number> = {\n medium: 180_000,\n high: 360_000,\n xhigh: 900_000,\n};\n\n// An older backend sends sources without `resolved`/`cites`; read both as optional.\ntype WebSource = Pick<ResearchWebSource, \"title\" | \"url\"> & Partial<Pick<ResearchWebSource, \"resolved\" | \"cites\">>;\ntype WebResult = Omit<ResearchWebResponse, \"sources\"> & { sources: WebSource[] };\n\nconst FIELDS: Record<string, string> = {\n answer: \"AI-generated research answer (markdown)\",\n sources:\n \"Array of {title, url, resolved, cites}: url is the page Google read; cites are the parts of the answer that page backs (verbatim). resolved:false = an opaque Google link that could not be followed — do not cite it\",\n};\n\n/** `--output md`: the answer, then each page with the claims it backs; unfollowable links are marked, not linked. */\nexport function webMarkdown(data: WebResult): string {\n const lines = [data.answer];\n if (data.sources.length > 0) {\n lines.push(\"\", \"## Sources\");\n for (const s of data.sources) {\n if (s.resolved === false) {\n lines.push(`- ${s.title} — unresolved Google link, do not cite: ${s.url}`);\n continue;\n }\n lines.push(`- [${s.title}](${s.url})`);\n for (const cite of s.cites ?? []) lines.push(` > \"${cite}\"`);\n }\n }\n return `${lines.join(\"\\n\")}\\n`;\n}\n\n/** `completed`, or `incomplete` — finished but cut short by a budget, so the report's tail may be missing. */\nconst DEEP_RESEARCH_FINISHED = new Set([\"completed\", \"incomplete\"]);\nconst DEEP_RESEARCH_RUNNING = new Set([\"queued\", \"in_progress\"]);\n\nfunction sleep(ms: number): Promise<void> {\n return new Promise((resolve) => setTimeout(resolve, ms));\n}\n\nasync function runDeepResearch(question: string): Promise<{ data: WebResult; incomplete: boolean }> {\n const { interactionId } = await apiPost<{ interactionId: string }>(\"/api/research/deep-research/start\", { question });\n\n process.stderr.write(`Deep research started (${interactionId}). Polling...\\n`);\n\n const deadline = Date.now() + TIMEOUT_MS.xhigh;\n while (Date.now() < deadline) {\n await sleep(10_000);\n const poll = await apiGet<ResearchDeepResearchPollResponse>(\"/api/research/deep-research/poll\", {\n id: interactionId,\n });\n\n if (DEEP_RESEARCH_FINISHED.has(poll.status) && poll.result) {\n return { data: poll.result, incomplete: poll.status === \"incomplete\" };\n }\n if (!DEEP_RESEARCH_RUNNING.has(poll.status)) {\n throw new Error(`Deep research ${poll.status}`);\n }\n process.stderr.write(` status: ${poll.status}\\n`);\n }\n\n throw new Error(\"Deep research timed out\");\n}\n\n/** One question answered, with the hints its answer earns. */\nasync function readWeb(question: string, depth: Depth): Promise<{ data: WebResult; hints: string[] }> {\n // Checked per question, so one too short is that question's error and the rest are still answered.\n if (question.length < 5) throw new ApiError(\"VALIDATION_ERROR\", \"Question must be at least 5 characters\");\n const { data, incomplete } =\n depth === \"xhigh\"\n ? await runDeepResearch(question)\n : {\n data: await apiPost<WebResult>(\n \"/api/research/explore\",\n { question, depth },\n { timeoutMs: TIMEOUT_MS[depth] },\n ),\n incomplete: false,\n };\n const hints = [\n ...webSourceHints(data.sources),\n ...(incomplete\n ? [\"Deep research stopped at its budget, so the end of this report may be missing — say so if you use it.\"]\n : []),\n ...webDepthHints({ answer: data.answer, sourceCount: data.sources.length, depth }),\n ];\n return { data, hints };\n}\n\n/** Several questions' answers: `--output md` gives each its own heading (hints on stderr), json one entry each. */\nfunction writeWebList(results: ListResult<string, { data: WebResult; hints: string[] }>[], format: string): void {\n // Every question failing is the call failing, in either format: the error envelope, exit 1.\n if (format !== \"md\" || results.every((entry) => !entry.ok)) {\n writeResearchList(results, { nameOf: namedBy(\"question\"), format: \"json\", envelope: { fields: FIELDS } });\n return;\n }\n process.stdout.write(\n results\n .map((entry) =>\n entry.ok\n ? `# ${entry.input}\\n\\n${webMarkdown(entry.read.data)}`\n : `# ${entry.input}\\n\\nNot answered — ${entry.error.message}\\n`,\n )\n .join(\"\\n\"),\n );\n for (const entry of results) {\n for (const hint of entry.ok ? entry.read.hints : []) process.stderr.write(`${entry.input}: ${hint}\\n`);\n }\n}\n\nexport const webCommand = defineCommand({\n meta: {\n name: \"web\",\n description: `Search the web with AI to answer any open-ended marketing question. Uses live internet data via Google Search.\n\nDepth levels:\n medium — Quick lookup: a fast model with minimal thinking (default)\n high — The SAME model and the same web search, thinking longer. Not a stronger model:\n it reasons more over similar sources, so do not present a high answer as better-sourced.\n xhigh — A deep-research agent: plans, searches and reads many pages, writes a cited report\n (minutes; use sparingly)\n\nSources: every source is the page itself (Google's redirect links are followed for you), with\n\"cites\" — the parts of the answer that page is attached to, verbatim. Cite a URL only for the\nclaim it backs. resolved:false means the link could not be followed: do not cite it or guess a path.\nAn answer with no sources is synthesis, not a citable fact.\n\nExamples:\n baker research web \"Who are the main competitors of HubSpot CRM?\"\n baker research web \"Who sells X in Spain?\" \"What does X cost in Spain?\" # several questions, one call\n baker research web \"What are the top pain points for SMB CRM buyers?\" --depth high\n baker research web \"Full competitive analysis of project management SaaS\" --depth xhigh`,\n },\n args: {\n question: {\n type: \"positional\",\n description: \"The research question; several quoted questions are answered at once\",\n required: true,\n },\n depth: { type: \"string\", description: \"Research depth: medium|high|xhigh (default: medium)\", required: false },\n output: { type: \"string\", description: \"Format: json|md (default: json)\", required: false, default: \"json\" },\n },\n run: async ({ args }) => {\n // Every quoted question is read: `baker research web \"<q1>\" \"<q2>\"`. A question may hold commas, so no comma list.\n const questions = [...new Set((Array.isArray(args._) ? args._ : [args.question]).map((q) => String(q).trim()))];\n if (questions.length > RESEARCH_LIST_MAX) {\n refuseLongList(questions.length, \"questions\");\n }\n\n const depth = ((args.depth as string) || \"medium\") as Depth;\n if (![\"medium\", \"high\", \"xhigh\"].includes(depth)) {\n writeResearchJson({\n ok: false,\n error: { code: \"VALIDATION_ERROR\", message: \"Depth must be one of: medium, high, xhigh\" },\n });\n process.exit(1);\n }\n // A deep-research job runs up to 15 minutes, so a queued second wave would outlive the command's wait:\n // an xhigh list is capped at what starts at once.\n if (depth === \"xhigh\" && questions.length > RESEARCH_LIST_CONCURRENCY) {\n refuseLongList(questions.length, \"deep-research questions\", RESEARCH_LIST_CONCURRENCY);\n }\n\n const read = (question: string) => readWeb(question, depth);\n const format = (args.output as string) || \"json\";\n\n if (questions.length > 1) {\n writeWebList(await readEach(questions, read), format);\n return;\n }\n try {\n const { data, hints } = await read(questions[0] ?? \"\");\n if (format === \"md\") {\n process.stdout.write(webMarkdown(data));\n writeResearchHints(hints, format);\n return;\n }\n writeResearchJson({ ok: true, data, fields: FIELDS, hints });\n } catch (err) {\n handleResearchError(err);\n }\n },\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,SAAS,qBAAqB;AAe9B,eAAe;AAAA,EACb,SAAS;AAAA,EACT,QAAQ;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EACF;AAAA,EACA,QAAQ;AAAA,EACR,aACE;AAAA,EACF,MAAM;AAAA,IACJ,UAAU;AAAA,MACR,MAAM;AAAA,MACN,aACE;AAAA,MACF,UAAU;AAAA,IACZ;AAAA,IACA,OAAO;AAAA,MACL,MAAM;AAAA,MACN,aAAa;AAAA,MACb,UAAU;AAAA,MACV,MAAM,CAAC,UAAU,QAAQ,OAAO;AAAA,IAClC;AAAA,EACF;AACF,CAAC;AAID,IAAM,aAAoC;AAAA,EACxC,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,OAAO;AACT;AAMA,IAAM,SAAiC;AAAA,EACrC,QAAQ;AAAA,EACR,SACE;AACJ;AAGO,SAAS,YAAY,MAAyB;AACnD,QAAM,QAAQ,CAAC,KAAK,MAAM;AAC1B,MAAI,KAAK,QAAQ,SAAS,GAAG;AAC3B,UAAM,KA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G,MAAM;AACpD;AAAA,IACF;AACA,QAAI;AACF,YAAM,EAAE,MAAM,MAAM,IAAI,MAAM,KAAK,UAAU,CAAC,KAAK,EAAE;AACrD,UAAI,WAAW,MAAM;AACnB,gBAAQ,OAAO,MAAM,YAAY,IAAI,CAAC;AACtC,2BAAmB,OAAO,MAAM;AAChC;AAAA,MACF;AACA,wBAAkB,EAAE,IAAI,MAAM,MAAM,QAAQ,QAAQ,MAAM,CAAC;AAAA,IAC7D,SAAS,KAAK;AACZ,0BAAoB,GAAG;AAAA,IACzB;AAAA,EACF;AACF,CAAC;","names":[]}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|